Update API T2CodeLib to 16.7

This commit is contained in:
JaTiTV 2024-07-11 13:22:18 +02:00
parent f119b226b1
commit 2d60da96cb
6 changed files with 174 additions and 250 deletions

13
pom.xml
View File

@ -6,7 +6,7 @@
<groupId>net.t2code</groupId>
<artifactId>T2C-AllayDuplicate</artifactId>
<version>1.4</version>
<version>1.5</version>
<packaging>jar</packaging>
<name>T2C AllayDuplicate</name>
@ -89,7 +89,8 @@
<dependency>
<groupId>net.t2code</groupId>
<artifactId>T2CodeLib</artifactId>
<version>13.4</version>
<version>16.7</version>
<classifier>dev-24</classifier>
</dependency>
<dependency>
<groupId>net.t2code.plotsquared</groupId>
@ -100,7 +101,7 @@
<dependency>
<groupId>com.github.angeschossen</groupId>
<artifactId>LandsAPI</artifactId>
<version>6.5.1</version>
<version>6.26.18</version>
<scope>provided</scope>
</dependency>
<!-- FAWE API -->
@ -123,6 +124,12 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.30</version>
<scope>provided</scope>
</dependency>
<!-- WorldGuard
<dependency>
<groupId>com.sk89q.worldguard</groupId>

View File

@ -1,37 +1,41 @@
package net.t2code.t2callayduplicate;
import lombok.Getter;
import net.t2code.t2codelib.util.T2C_Util;
import java.util.ArrayList;
import java.util.Arrays;
public class Util {
public static String getInfoText() {
return "";
}
@Getter
private static String infoText = "";
public static String getRequiredT2CodeLibVersion() {
return "13.4";
}
@Getter
private static String requiredT2CodeLibVersion = "16.7";
public static String getPrefix() {
return "§8[§4T2C§bAllay§6Duplicate§8]";
}
@Getter
private static String prefix = "§8[§4T2C§bAllay§6Duplicate§8]";
public static Integer getSpigotID() {
return 103745;
}
@Getter
private static Integer spigotID = 103745;
public static String getGit() {
return "JaTiTV/T2C-AllayDuplicate";
}
@Getter
private static String git = "JaTiTV/T2C-AllayDuplicate";
public static Integer getBstatsID() {
return 15932;
}
@Getter
private static Integer bstatsID = 15932;
public static String getSpigot() {
return "https://www.spigotmc.org/resources/" + getSpigotID();
}
@Getter
private static String spigot = "https://www.spigotmc.org/resources/" + spigotID;
public static String getDiscord() {
return net.t2code.t2codelib.Util.getDiscord();
@Getter
private static String discord = "http://dc.t2code.net";
public static String[] getConfigLogo() {
ArrayList<String> arrayList = new ArrayList<>(T2C_Util.getConfigT2CodeLogo());
arrayList.addAll(Arrays.asList("", "# Spigot: " + spigot));
return arrayList.toArray(new String[0]);
}
}

View File

@ -4,9 +4,9 @@ import net.t2code.t2callayduplicate.Util;
import net.t2code.t2callayduplicate.config.ConfigFile;
import net.t2code.t2callayduplicate.event.Event;
import net.t2code.t2callayduplicate.system.Main;
import net.t2code.t2codelib.SPIGOT.api.commands.T2Ctab;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
import net.t2code.t2codelib.SPIGOT.api.commands.T2C_Tab;
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Template;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
@ -23,48 +23,48 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (args.length == 0) {
if (!sender.hasPermission("t2code.allayduplicate.info")) {
T2Csend.sender(sender, ConfigFile.getNoPerm());
T2C_Send.sender(sender, ConfigFile.getNoPerm());
return false;
}
T2Ctemplate.sendInfo(sender,Main.getPlugin(),Util.getSpigotID(),Util.getDiscord(),Util.getInfoText());
T2C_Template.sendInfo(sender,Main.getPlugin(),Util.getSpigotID(),Util.getDiscord(),Util.getInfoText());
} else {
switch (args[0].toLowerCase()) {
case "reload":
case "rl":
if (!sender.hasPermission("t2code.allayduplicate.reload")) {
T2Csend.sender(sender, ConfigFile.getNoPerm());
T2C_Send.sender(sender, ConfigFile.getNoPerm());
return false;
}
T2Csend.console(Util.getPrefix() + "§8-------------------------------");
T2Csend.console(Util.getPrefix() + " §6Plugin reload...");
T2Csend.console(Util.getPrefix() + "§8-------------------------------");
T2Csend.sender(sender, Util.getPrefix() + " §6Plugin is reloaded...");
T2C_Send.console(Util.getPrefix() + "§8-------------------------------");
T2C_Send.console(Util.getPrefix() + " §6Plugin reload...");
T2C_Send.console(Util.getPrefix() + "§8-------------------------------");
T2C_Send.sender(sender, Util.getPrefix() + " §6Plugin is reloaded...");
if (ConfigFile.getDelayResetOnReload()) Event.clearCash();
ConfigFile.create();
ConfigFile.select();
T2Csend.sender(sender, Util.getPrefix() + " §6Plugin was successfully reloaded.");
T2Csend.console(Util.getPrefix() + "§8-------------------------------");
T2Csend.console(Util.getPrefix() + " §2Plugin successfully reloaded.");
T2Csend.console(Util.getPrefix() + "§8-------------------------------");
T2C_Send.sender(sender, Util.getPrefix() + " §6Plugin was successfully reloaded.");
T2C_Send.console(Util.getPrefix() + "§8-------------------------------");
T2C_Send.console(Util.getPrefix() + " §2Plugin successfully reloaded.");
T2C_Send.console(Util.getPrefix() + "§8-------------------------------");
break;
case "reset":
if (!sender.hasPermission("t2code.allayduplicate.reset")) {
T2Csend.sender(sender, ConfigFile.getNoPerm());
T2C_Send.sender(sender, ConfigFile.getNoPerm());
return false;
}
String name = args[1];
if (Bukkit.getPlayer(name) == null && !(name.equals("*") || name.equals("all"))) {
T2Csend.sender(sender, ConfigFile.getErrorReset().replace("[player]", name));
T2C_Send.sender(sender, ConfigFile.getErrorReset().replace("[player]", name));
return false;
}
if (name.equals("*") || name.equals("all")) {
for (Player player : Bukkit.getOnlinePlayers()) {
Event.removePlayer(player);
}
T2Csend.sender(sender, ConfigFile.getResetAll());
T2C_Send.sender(sender, ConfigFile.getResetAll());
} else {
Event.removePlayer(Bukkit.getPlayer(name));
T2Csend.sender(sender, ConfigFile.getReset().replace("[player]", name));
T2C_Send.sender(sender, ConfigFile.getReset().replace("[player]", name));
}
break;
case "info":
@ -74,10 +74,10 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
case "ver":
default:
if (!sender.hasPermission("t2code.allayduplicate.info")) {
T2Csend.sender(sender, ConfigFile.getNoPerm());
T2C_Send.sender(sender, ConfigFile.getNoPerm());
return false;
}
T2Ctemplate.sendInfo(sender,Main.getPlugin(),Util.getSpigotID(),Util.getDiscord(),Util.getInfoText());
T2C_Template.sendInfo(sender,Main.getPlugin(),Util.getSpigotID(),Util.getDiscord(),Util.getInfoText());
break;
}
}
@ -99,9 +99,9 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
@Override
public List<String> onTabComplete(CommandSender sender, Command cmd, String s, String[] args) {
List<String> list = new ArrayList<>();
T2Ctab.tab(list, sender, 0, args, arg1);
T2Ctab.tab(list, sender, 1, args, arg2);
T2Ctab.tab(list, sender, 1, args, "t2code.allayduplicate.admin", true);
T2C_Tab.tab(list, sender, 0, args, arg1);
T2C_Tab.tab(list, sender, 1, args, arg2);
T2C_Tab.tab(list, sender, 1, args, "t2code.allayduplicate.admin", true);
return list;
}
}

View File

@ -1,9 +1,9 @@
package net.t2code.t2callayduplicate.config;
import lombok.Getter;
import net.t2code.t2callayduplicate.system.Main;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.yaml.T2Cconfig;
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Replace;
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.Sound;
@ -11,59 +11,60 @@ import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
import java.io.IOException;
import java.util.Objects;
public class ConfigFile {
public static void create() {
File config = new File(Main.getPath(), "config.yml");
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
T2Cconfig.set("Plugin.Language", "ENGLISH", yamlConfiguration);
yamlConfiguration.set("Plugin.Language", "ENGLISH");
T2Cconfig.set("Plugin.updateCheck.onJoin",true,yamlConfiguration);
T2Cconfig.set("Plugin.updateCheck.seePreReleaseUpdates",true,yamlConfiguration);
T2Cconfig.set("Plugin.updateCheck.timeInterval",60,yamlConfiguration);
yamlConfiguration.set("Plugin.updateCheck.onJoin",true);
yamlConfiguration.set("Plugin.updateCheck.seePreReleaseUpdates",true);
yamlConfiguration.set("Plugin.updateCheck.timeInterval",60);
T2Cconfig.set("Duplicate.SneakRequired", true, yamlConfiguration);
T2Cconfig.set("Duplicate.Item.Enable", true, yamlConfiguration);
T2Cconfig.set("Duplicate.Item.Material", Material.AMETHYST_SHARD.toString(), yamlConfiguration);
T2Cconfig.set("Duplicate.Item.Amount", 1, yamlConfiguration);
yamlConfiguration.set("Duplicate.SneakRequired", true);
yamlConfiguration.set("Duplicate.Item.Enable", true);
yamlConfiguration.set("Duplicate.Item.Material", Material.AMETHYST_SHARD.toString());
yamlConfiguration.set("Duplicate.Item.Amount", 1);
T2Cconfig.set("Duplicate.Particle.Enable", true, yamlConfiguration);
T2Cconfig.set("Duplicate.Particle.Particle", "HEART", yamlConfiguration);
yamlConfiguration.set("Duplicate.Particle.Enable", true);
yamlConfiguration.set("Duplicate.Particle.Particle", "HEART");
T2Cconfig.set("Duplicate.Sound.Enable", true, yamlConfiguration);
T2Cconfig.set("Duplicate.Sound.Sound", "ENTITY_ALLAY_AMBIENT_WITHOUT_ITEM", yamlConfiguration);
T2Cconfig.set("Duplicate.Sound.Volume", 3, yamlConfiguration);
yamlConfiguration.set("Duplicate.Sound.Enable", true);
yamlConfiguration.set("Duplicate.Sound.Sound", "ENTITY_ALLAY_AMBIENT_WITHOUT_ITEM");
yamlConfiguration.set("Duplicate.Sound.Volume", 3);
T2Cconfig.set("Duplicate.Delay.Enable", true, yamlConfiguration);
T2Cconfig.set("Duplicate.Delay.ProAllay", false, yamlConfiguration);
T2Cconfig.set("Duplicate.Delay.ResetOnReload", true, yamlConfiguration);
T2Cconfig.set("Duplicate.Delay.Seconds", 300, yamlConfiguration);
yamlConfiguration.set("Duplicate.Delay.Enable", true);
yamlConfiguration.set("Duplicate.Delay.ProAllay", false);
yamlConfiguration.set("Duplicate.Delay.ResetOnReload", true);
yamlConfiguration.set("Duplicate.Delay.Seconds", 300);
T2Cconfig.set("Duplicate.Cost.Enable", true, yamlConfiguration);
T2Cconfig.set("Duplicate.Cost.Price", 10.00, yamlConfiguration);
yamlConfiguration.set("Duplicate.Cost.Enable", true);
yamlConfiguration.set("Duplicate.Cost.Price", 10.00);
T2Cconfig.set("Messages.MiniMessagesEditorLink", "https://webui.adventure.kyori.net", yamlConfiguration);
T2Cconfig.set("Messages.Prefix", "<dark_gray>[<dark_red>T2C</dark_red><aqua>Allay</aqua><gold>Duplicate</gold>]</dark_gray>", yamlConfiguration);
yamlConfiguration.set("Messages.MiniMessagesEditorLink", "https://webui.adventure.kyori.net");
yamlConfiguration.set("Messages.Prefix", "<dark_gray>[<dark_red>T2C</dark_red><aqua>Allay</aqua><gold>Duplicate</gold>]</dark_gray>");
T2Cconfig.set("Messages.ENGLISH.Plugin.NoPerm", "[prefix] <red>You are not authorized to do that!</red>", yamlConfiguration);
T2Cconfig.set("Messages.ENGLISH.Duplicate", "[prefix] <green>Du You have duplicated an allay.</green>", yamlConfiguration);
T2Cconfig.set("Messages.ENGLISH.Error.Delay", "[prefix] <red>You have to wait <gold>[min] minutes, [sec] seconds</gold> before you can duplicate the next allay.</red>", yamlConfiguration);
T2Cconfig.set("Messages.ENGLISH.Error.IncorrectItem", "[prefix] <red>You need <gold>[amount] [item]</gold> to be able to duplicate an allay.</red>", yamlConfiguration);
T2Cconfig.set("Messages.ENGLISH.Error.NoMoney", "[prefix] <red>You need <gold>[price] $</gold> to be able to duplicate an allay.</red>", yamlConfiguration);
T2Cconfig.set("Messages.ENGLISH.Error.Reset", "[prefix] <red>Player <gold>[player]</gold> not online!</red>", yamlConfiguration);
T2Cconfig.set("Messages.ENGLISH.Error.CanNotBuild", "[prefix] <red>You are not authorized to do so at this area.</red>", yamlConfiguration);
T2Cconfig.set("Messages.ENGLISH.Reset", "[prefix] <green>The delay of <gold>[player]</gold> has been reset.</green>", yamlConfiguration);
T2Cconfig.set("Messages.ENGLISH.ResetAll", "[prefix] <green>The delay of all players has been reset.</green>", yamlConfiguration);
yamlConfiguration.set("Messages.ENGLISH.Plugin.NoPerm", "[prefix] <red>You are not authorized to do that!</red>");
yamlConfiguration.set("Messages.ENGLISH.Duplicate", "[prefix] <green>Du You have duplicated an allay.</green>");
yamlConfiguration.set("Messages.ENGLISH.Error.Delay", "[prefix] <red>You have to wait <gold>[min] minutes, [sec] seconds</gold> before you can duplicate the next allay.</red>");
yamlConfiguration.set("Messages.ENGLISH.Error.IncorrectItem", "[prefix] <red>You need <gold>[amount] [item]</gold> to be able to duplicate an allay.</red>");
yamlConfiguration.set("Messages.ENGLISH.Error.NoMoney", "[prefix] <red>You need <gold>[price] $</gold> to be able to duplicate an allay.</red>");
yamlConfiguration.set("Messages.ENGLISH.Error.Reset", "[prefix] <red>Player <gold>[player]</gold> not online!</red>");
yamlConfiguration.set("Messages.ENGLISH.Error.CanNotBuild", "[prefix] <red>You are not authorized to do so at this area.</red>");
yamlConfiguration.set("Messages.ENGLISH.Reset", "[prefix] <green>The delay of <gold>[player]</gold> has been reset.</green>");
yamlConfiguration.set("Messages.ENGLISH.ResetAll", "[prefix] <green>The delay of all players has been reset.</green>");
T2Cconfig.set("Messages.GERMAN.Plugin.NoPerm", "[prefix] <red>Dazu bist du nicht berechtigt!</red>", yamlConfiguration);
T2Cconfig.set("Messages.GERMAN.Duplicate", "[prefix] <green>Du hast ein Allay verdoppelt.</green>", yamlConfiguration);
T2Cconfig.set("Messages.GERMAN.Error.Delay", "[prefix] <red>Du musst noch <gold>[min] Minuten, [sec] Sekunden</gold> warten, befor du das nächste Allay duplizieren kannst.</red>", yamlConfiguration);
T2Cconfig.set("Messages.GERMAN.Error.IncorrectItem", "[prefix] <red>Du benötigst <gold>[amount] [item]</gold> um einen Allay duplizieren kannst.</red>", yamlConfiguration);
T2Cconfig.set("Messages.GERMAN.Error.NoMoney", "[prefix] <red>Du benötigst <gold>[price] $</gold> um einen Allay duplizieren kannst.</red>", yamlConfiguration);
T2Cconfig.set("Messages.GERMAN.Error.Reset", "[prefix] <red>Spieler <gold>[player]</gold> nicht Online!</red>", yamlConfiguration);
T2Cconfig.set("Messages.GERMAN.Error.CanNotBuild", "[prefix] <red>Du bist an diesem Bereich nicht dazu berechtigt.</red>", yamlConfiguration);
T2Cconfig.set("Messages.GERMAN.Reset", "[prefix] <green>Das Delay von <gold>[player]</gold> wurde zurückgesetzt.</green>", yamlConfiguration);
T2Cconfig.set("Messages.GERMAN.ResetAll", "[prefix] <green>Das Delay von allen Spielern wurde zurückgesetzt.</green>", yamlConfiguration);
yamlConfiguration.set("Messages.GERMAN.Plugin.NoPerm", "[prefix] <red>Dazu bist du nicht berechtigt!</red>");
yamlConfiguration.set("Messages.GERMAN.Duplicate", "[prefix] <green>Du hast ein Allay verdoppelt.</green>");
yamlConfiguration.set("Messages.GERMAN.Error.Delay", "[prefix] <red>Du musst noch <gold>[min] Minuten, [sec] Sekunden</gold> warten, befor du das nächste Allay duplizieren kannst.</red>");
yamlConfiguration.set("Messages.GERMAN.Error.IncorrectItem", "[prefix] <red>Du benötigst <gold>[amount] [item]</gold> um einen Allay duplizieren kannst.</red>");
yamlConfiguration.set("Messages.GERMAN.Error.NoMoney", "[prefix] <red>Du benötigst <gold>[price] $</gold> um einen Allay duplizieren kannst.</red>");
yamlConfiguration.set("Messages.GERMAN.Error.Reset", "[prefix] <red>Spieler <gold>[player]</gold> nicht Online!</red>");
yamlConfiguration.set("Messages.GERMAN.Error.CanNotBuild", "[prefix] <red>Du bist an diesem Bereich nicht dazu berechtigt.</red>");
yamlConfiguration.set("Messages.GERMAN.Reset", "[prefix] <green>Das Delay von <gold>[player]</gold> wurde zurückgesetzt.</green>");
yamlConfiguration.set("Messages.GERMAN.ResetAll", "[prefix] <green>Das Delay von allen Spielern wurde zurückgesetzt.</green>");
try {
yamlConfiguration.save(config);
} catch (IOException e) {
@ -88,9 +89,9 @@ public class ConfigFile {
try {
particleParticle = Particle.valueOf(yamlConfiguration.getString("Duplicate.Particle.Particle"));
} catch (Exception ex) {
T2Csend.error(Main.getPlugin(), "");
T2Csend.console(String.format("§4The particle %s does not exist, please check your config. The %s is used as particle.", yamlConfiguration.getString("Duplicate.Particle.Particle"), "HEART"));
T2Csend.error(Main.getPlugin(), "");
T2C_Send.error(Main.getPlugin(), "");
T2C_Send.console(String.format("§4The particle %s does not exist, please check your config. The %s is used as particle.", yamlConfiguration.getString("Duplicate.Particle.Particle"), "HEART"));
T2C_Send.error(Main.getPlugin(), "");
particleParticle = Particle.HEART;
}
@ -98,9 +99,9 @@ public class ConfigFile {
try {
soundSound = Sound.valueOf(yamlConfiguration.getString("Duplicate.Sound.Sound"));
} catch (Exception ex) {
T2Csend.error(Main.getPlugin(), "");
T2Csend.console(String.format("§4The sound %s does not exist, please check your config. The %s is used as sound.", yamlConfiguration.getString("Duplicate.Sound.Sound"), "ENTITY_ALLAY_AMBIENT_WITHOUT_ITEM"));
T2Csend.error(Main.getPlugin(), "");
T2C_Send.error(Main.getPlugin(), "");
T2C_Send.console(String.format("§4The sound %s does not exist, please check your config. The %s is used as sound.", yamlConfiguration.getString("Duplicate.Sound.Sound"), "ENTITY_ALLAY_AMBIENT_WITHOUT_ITEM"));
T2C_Send.error(Main.getPlugin(), "");
soundSound = Sound.ENTITY_ALLAY_AMBIENT_WITHOUT_ITEM;
}
soundVolume = yamlConfiguration.getInt("Duplicate.Sound.Volume");
@ -115,178 +116,91 @@ public class ConfigFile {
prefix = yamlConfiguration.getString("Messages.Prefix");
noPerm = getMSG("Messages." + language + ".Plugin.NoPerm", yamlConfiguration);
duplicate = getMSG("Messages." + language + ".Duplicate", yamlConfiguration);
errorDelay = getMSG("Messages." + language + ".Error.Delay", yamlConfiguration);
errorIncorrectItem = getMSG("Messages." + language + ".Error.IncorrectItem", yamlConfiguration);
errorNoMoney = getMSG("Messages." + language + ".Error.NoMoney", yamlConfiguration);
errorReset = getMSG("Messages." + language + ".Error.Reset", yamlConfiguration);
errorCanNotBuild = getMSG("Messages." + language + ".Error.CanNotBuild", yamlConfiguration);
reset = getMSG("Messages." + language + ".Reset", yamlConfiguration);
ResetAll = getMSG("Messages." + language + ".ResetAll", yamlConfiguration);
noPerm = getMSG("Messages." + language + ".Plugin.NoPerm",yamlConfiguration);
duplicate = getMSG("Messages." + language + ".Duplicate",yamlConfiguration);
errorDelay = getMSG("Messages." + language + ".Error.Delay",yamlConfiguration);
errorIncorrectItem = getMSG("Messages." + language + ".Error.IncorrectItem",yamlConfiguration);
errorNoMoney = getMSG("Messages." + language + ".Error.NoMoney",yamlConfiguration);
errorReset = getMSG("Messages." + language + ".Error.Reset",yamlConfiguration);
errorCanNotBuild = getMSG("Messages." + language + ".Error.CanNotBuild",yamlConfiguration);
reset = getMSG("Messages." + language + ".Reset",yamlConfiguration);
ResetAll = getMSG("Messages." + language + ".ResetAll",yamlConfiguration);
}
@Getter
private static String language;
@Getter
private static Boolean updateCheckOnJoin;
@Getter
private static Boolean updateCheckSeePreReleaseUpdates;
@Getter
private static Integer updateCheckTimeInterval;
@Getter
private static Boolean sneakRequired;
@Getter
private static Boolean itemEnable;
@Getter
private static String itemMaterial;
@Getter
private static Integer itemAmount;
@Getter
private static Boolean particleEnable;
@Getter
private static Particle particleParticle;
@Getter
private static Boolean soundEnable;
@Getter
private static Sound soundSound;
@Getter
private static Integer soundVolume;
@Getter
private static Boolean delayEnable;
@Getter
private static Boolean delayProAllay;
@Getter
private static Boolean delayResetOnReload;
@Getter
private static Integer delaySeconds;
@Getter
private static Boolean costEnable;
@Getter
private static Double costPrice;
@Getter
private static String prefix;
@Getter
private static String noPerm;
@Getter
private static String duplicate;
@Getter
private static String errorDelay;
@Getter
private static String errorIncorrectItem;
@Getter
private static String errorNoMoney;
@Getter
private static String errorReset;
@Getter
private static String errorCanNotBuild;
@Getter
private static String reset;
@Getter
private static String ResetAll;
public static String getLanguage() {
return language;
}
public static Boolean getUpdateCheckOnJoin() {
return updateCheckOnJoin;
}
public static Boolean getUpdateCheckSeePreReleaseUpdates() {
return updateCheckSeePreReleaseUpdates;
}
public static Integer getUpdateCheckTimeInterval() {
return updateCheckTimeInterval;
}
public static Boolean getSneakRequired() {
return sneakRequired;
}
public static Boolean getItemEnable() {
return itemEnable;
}
public static String getItemMaterial() {
return itemMaterial;
}
public static Integer getItemAmount() {
return itemAmount;
}
public static Boolean getParticleEnable() {
return particleEnable;
}
public static Particle getParticleParticle() {
return particleParticle;
}
public static Boolean getSoundEnable() {
return soundEnable;
}
public static Sound getSoundSound() {
return soundSound;
}
public static Integer getSoundVolume() {
return soundVolume;
}
public static Boolean getDelayEnable() {
return delayEnable;
}
public static Boolean getDelayProAllay() {
return delayProAllay;
}
public static Boolean getDelayResetOnReload() {
return delayResetOnReload;
}
public static Integer getDelaySeconds() {
return delaySeconds;
}
public static Boolean getCostEnable() {
return costEnable;
}
public static Double getCostPrice() {
return costPrice;
}
public static String getPrefix() {
return prefix;
}
public static String getNoPerm() {
return noPerm;
}
public static String getDuplicate() {
return duplicate;
}
public static String getErrorDelay() {
return errorDelay;
}
public static String getErrorIncorrectItem() {
return errorIncorrectItem;
}
public static String getErrorNoMoney() {
return errorNoMoney;
}
public static String getErrorReset() {
return errorReset;
}
public static String getErrorCanNotBuild() {
return errorCanNotBuild;
}
public static String getReset() {
return reset;
}
public static String getResetAll() {
return ResetAll;
}
private static String getMSG(String path, YamlConfiguration yamlConfiguration) {
String out;
if (yamlConfiguration.get(path) != null) {
out = T2Creplace.replace(prefix, yamlConfiguration.getString(path));
out = T2C_Replace.replace(prefix, Objects.requireNonNull(yamlConfiguration.getString(path)));
} else {
T2Csend.error(Main.getPlugin(), String.format("The message on the path [%s] was not found. Please check if the language [%s] exists.", path, language));
T2C_Send.error(Main.getPlugin(), String.format("The message on the path [%s] was not found. Please check if the language [%s] exists.", path, language));
out = path;
}
return out;

View File

@ -3,9 +3,9 @@ package net.t2code.t2callayduplicate.event;
import net.t2code.t2callayduplicate.Util;
import net.t2code.t2callayduplicate.config.ConfigFile;
import net.t2code.t2callayduplicate.system.Main;
import net.t2code.t2codelib.SPIGOT.api.eco.T2Ceco;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
import net.t2code.t2codelib.SPIGOT.api.eco.T2C_Eco;
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
import net.t2code.t2codelib.SPIGOT.api.update.T2C_UpdateAPI;
import org.bukkit.*;
import org.bukkit.entity.Allay;
import org.bukkit.entity.EntityType;
@ -20,12 +20,11 @@ import java.time.Instant;
import java.util.HashMap;
import java.util.UUID;
public class Event implements Listener {
@EventHandler
public void onJoinEvent(PlayerLoginEvent event) {
T2CupdateAPI.join(Main.getPlugin(), Util.getPrefix(), "t2code.allayduplicate.admin", event.getPlayer(), Util.getSpigotID(), Util.getDiscord());
T2C_UpdateAPI.join(Main.getPlugin(), Util.getPrefix(), "t2code.allayduplicate.admin", event.getPlayer(), Util.getSpigotID(), Util.getDiscord());
}
private static HashMap<UUID, Long> delay = new HashMap<>();
@ -55,7 +54,7 @@ public class Event implements Listener {
e.setCancelled(true);
if (!BuildCheck.canBuild(player, location)) {
T2Csend.player(player, ConfigFile.getErrorCanNotBuild());
T2C_Send.player(player, ConfigFile.getErrorCanNotBuild());
return;
}
@ -72,20 +71,20 @@ public class Event implements Listener {
long bonustime_min = ConfigFile.getDelaySeconds();
long remainingMin = (int) ((bonustime_min - diff) / 60);
long remainingSec = (int) ((bonustime_min - diff) % 60);
T2Csend.player(player, ConfigFile.getErrorDelay().replace("&", "§").replace("[min]", String.valueOf(remainingMin))
T2C_Send.player(player, ConfigFile.getErrorDelay().replace("&", "§").replace("[min]", String.valueOf(remainingMin))
.replace("[sec]", String.valueOf(remainingSec)));
return;
}
}
if (ConfigFile.getCostEnable()) {
if (!T2Ceco.moneyRemove(ConfigFile.getPrefix(), player, ConfigFile.getCostPrice())) {
T2Csend.player(player, ConfigFile.getErrorNoMoney().replace("[price]", String.valueOf(ConfigFile.getCostPrice())));
if (!T2C_Eco.moneyRemove(ConfigFile.getPrefix(), player, ConfigFile.getCostPrice())) {
T2C_Send.player(player, ConfigFile.getErrorNoMoney().replace("[price]", String.valueOf(ConfigFile.getCostPrice())));
return;
}
}
if (!T2Ceco.itemRemove(player, ConfigFile.getItemMaterial(), ConfigFile.getItemAmount())) {
T2Csend.player(player, ConfigFile.getErrorIncorrectItem().replace("[amount]", String.valueOf(ConfigFile.getItemAmount()))
if (!T2C_Eco.itemRemove(player, ConfigFile.getItemMaterial(), ConfigFile.getItemAmount())) {
T2C_Send.player(player, ConfigFile.getErrorIncorrectItem().replace("[amount]", String.valueOf(ConfigFile.getItemAmount()))
.replace("[item]", ConfigFile.getItemMaterial()));
return;
}
@ -104,7 +103,7 @@ public class Event implements Listener {
delay.put(e.getRightClicked().getUniqueId(), Instant.now().getEpochSecond());
} else delay.put(uuid, Instant.now().getEpochSecond());
T2Csend.player(player, ConfigFile.getDuplicate());
T2C_Send.player(player, ConfigFile.getDuplicate());
Bukkit.getScheduler().runTaskLaterAsynchronously(Main.getPlugin(), new Runnable() {
@Override
public void run() {

View File

@ -6,11 +6,11 @@ import net.t2code.t2callayduplicate.Util;
import net.t2code.t2callayduplicate.commands.CmdExecuter;
import net.t2code.t2callayduplicate.config.ConfigFile;
import net.t2code.t2callayduplicate.event.Event;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
import net.t2code.t2codelib.SPIGOT.api.plugins.T2CpluginCheck;
import net.t2code.t2codelib.SPIGOT.api.register.T2Cregister;
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Template;
import net.t2code.t2codelib.SPIGOT.api.plugins.T2C_PluginCheck;
import net.t2code.t2codelib.SPIGOT.api.register.T2C_Register;
import net.t2code.t2codelib.SPIGOT.api.update.T2C_UpdateAPI;
import org.bukkit.Bukkit;
import org.bukkit.event.HandlerList;
import org.bukkit.plugin.java.JavaPlugin;
@ -49,28 +49,28 @@ public final class Main extends JavaPlugin {
}
if (pluginNotFound("T2CodeLib", 96388, Util.getRequiredT2CodeLibVersion())) return;
enable = true;
long long_ = T2Ctemplate.onLoadHeader(Util.getPrefix(), this.getDescription().getAuthors(), this.getDescription().getVersion(), Util.getSpigot(), Util.getDiscord());
long long_ = T2C_Template.onLoadHeader(Util.getPrefix(), this.getDescription().getAuthors(), this.getDescription().getVersion(), Util.getSpigot(), Util.getDiscord());
Metrics.Bstats();
if (T2CpluginCheck.plotSquared()) {
if (T2C_PluginCheck.plotSquared()) {
plotsquared = true;
plotSquaredIntegration = new PlotSquaredIntegration();
T2Csend.console(Util.getPrefix() + " §2Load Hook: §6PlotSquared - " + T2CpluginCheck.pluginInfos("PlotSquared").getDescription().getVersion());
T2C_Send.console(Util.getPrefix() + " §2Load Hook: §6PlotSquared - " + T2C_PluginCheck.pluginInfos("PlotSquared").getDescription().getVersion());
}
if (T2CpluginCheck.pluginCheck("Lands")) {
if (T2C_PluginCheck.pluginCheck("Lands")) {
lands = true;
landsintegrator = new LandsIntegratior(this);
T2Csend.console(Util.getPrefix() + " §2Load Hook: §6Lands - " + T2CpluginCheck.pluginInfos("Lands").getDescription().getVersion());
T2C_Send.console(Util.getPrefix() + " §2Load Hook: §6Lands - " + T2C_PluginCheck.pluginInfos("Lands").getDescription().getVersion());
}
ConfigFile.create();
ConfigFile.select();
T2CupdateAPI.onUpdateCheck(plugin, Util.getPrefix(),Util.getGit(), Util.getSpigotID(), Util.getDiscord()
T2C_UpdateAPI.onUpdateCheck(plugin, Util.getPrefix(),Util.getGit(), Util.getSpigotID(), Util.getDiscord()
,ConfigFile.getUpdateCheckOnJoin(),ConfigFile.getUpdateCheckSeePreReleaseUpdates(),ConfigFile.getUpdateCheckTimeInterval());
this.getCommand("t2c-allayduplicate").setExecutor(new CmdExecuter());
T2Cregister.listener(new Event(), this);
T2Ctemplate.onLoadFooter(Util.getPrefix(), long_);
T2C_Register.listener(new Event(), this);
T2C_Template.onLoadFooter(Util.getPrefix(), long_);
}
@ -79,7 +79,7 @@ public final class Main extends JavaPlugin {
public void onDisable() {
// Plugin shutdown logic
HandlerList.unregisterAll(event);
if (enable) T2Ctemplate.onDisable(Util.getPrefix(), this.getDescription().getAuthors(), this.getDescription().getVersion(), Util.getSpigot(), Util.getDiscord());
if (enable) T2C_Template.onDisable(Util.getPrefix(), plugin);
}
public static Boolean pluginNotFound(String pl, Integer spigotID, String ver) {