Compare commits

...

2 Commits
1.3 ... main

Author SHA1 Message Date
2d60da96cb Update API T2CodeLib to 16.7 2024-07-11 13:22:18 +02:00
f119b226b1 1.4 2022-11-15 15:40:38 +01:00
6 changed files with 186 additions and 229 deletions

14
pom.xml
View File

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

View File

@ -1,33 +1,41 @@
package net.t2code.t2callayduplicate; 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 class Util {
public static String getInfoText() { @Getter
return ""; private static String infoText = "";
}
public static String getRequiredT2CodeLibVersion() { @Getter
return "13.0"; private static String requiredT2CodeLibVersion = "16.7";
}
public static String getPrefix() { @Getter
return "§8[§4T2C§bAllay§6Duplicate§8]"; private static String prefix = "§8[§4T2C§bAllay§6Duplicate§8]";
}
public static Integer getSpigotID() { @Getter
return 103745; private static Integer spigotID = 103745;
}
public static Integer getBstatsID() { @Getter
return 15932; private static String git = "JaTiTV/T2C-AllayDuplicate";
}
public static String getSpigot() { @Getter
return "https://www.spigotmc.org/resources/" + getSpigotID(); private static Integer bstatsID = 15932;
}
public static String getDiscord() { @Getter
return net.t2code.t2codelib.Util.getDiscord(); private static String spigot = "https://www.spigotmc.org/resources/" + spigotID;
@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.config.ConfigFile;
import net.t2code.t2callayduplicate.event.Event; import net.t2code.t2callayduplicate.event.Event;
import net.t2code.t2callayduplicate.system.Main; import net.t2code.t2callayduplicate.system.Main;
import net.t2code.t2codelib.SPIGOT.api.commands.T2Ctab; import net.t2code.t2codelib.SPIGOT.api.commands.T2C_Tab;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend; import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate; import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Template;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; 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) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (args.length == 0) { if (args.length == 0) {
if (!sender.hasPermission("t2code.allayduplicate.info")) { if (!sender.hasPermission("t2code.allayduplicate.info")) {
T2Csend.sender(sender, ConfigFile.getNoPerm()); T2C_Send.sender(sender, ConfigFile.getNoPerm());
return false; 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 { } else {
switch (args[0].toLowerCase()) { switch (args[0].toLowerCase()) {
case "reload": case "reload":
case "rl": case "rl":
if (!sender.hasPermission("t2code.allayduplicate.reload")) { if (!sender.hasPermission("t2code.allayduplicate.reload")) {
T2Csend.sender(sender, ConfigFile.getNoPerm()); T2C_Send.sender(sender, ConfigFile.getNoPerm());
return false; return false;
} }
T2Csend.console(Util.getPrefix() + "§8-------------------------------"); T2C_Send.console(Util.getPrefix() + "§8-------------------------------");
T2Csend.console(Util.getPrefix() + " §6Plugin reload..."); T2C_Send.console(Util.getPrefix() + " §6Plugin reload...");
T2Csend.console(Util.getPrefix() + "§8-------------------------------"); T2C_Send.console(Util.getPrefix() + "§8-------------------------------");
T2Csend.sender(sender, Util.getPrefix() + " §6Plugin is reloaded..."); T2C_Send.sender(sender, Util.getPrefix() + " §6Plugin is reloaded...");
if (ConfigFile.getDelayResetOnReload()) Event.clearCash(); if (ConfigFile.getDelayResetOnReload()) Event.clearCash();
ConfigFile.create(); ConfigFile.create();
ConfigFile.select(); ConfigFile.select();
T2Csend.sender(sender, Util.getPrefix() + " §6Plugin was successfully reloaded."); T2C_Send.sender(sender, Util.getPrefix() + " §6Plugin was successfully reloaded.");
T2Csend.console(Util.getPrefix() + "§8-------------------------------"); T2C_Send.console(Util.getPrefix() + "§8-------------------------------");
T2Csend.console(Util.getPrefix() + " §2Plugin successfully reloaded."); T2C_Send.console(Util.getPrefix() + " §2Plugin successfully reloaded.");
T2Csend.console(Util.getPrefix() + "§8-------------------------------"); T2C_Send.console(Util.getPrefix() + "§8-------------------------------");
break; break;
case "reset": case "reset":
if (!sender.hasPermission("t2code.allayduplicate.reset")) { if (!sender.hasPermission("t2code.allayduplicate.reset")) {
T2Csend.sender(sender, ConfigFile.getNoPerm()); T2C_Send.sender(sender, ConfigFile.getNoPerm());
return false; return false;
} }
String name = args[1]; String name = args[1];
if (Bukkit.getPlayer(name) == null && !(name.equals("*") || name.equals("all"))) { 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; return false;
} }
if (name.equals("*") || name.equals("all")) { if (name.equals("*") || name.equals("all")) {
for (Player player : Bukkit.getOnlinePlayers()) { for (Player player : Bukkit.getOnlinePlayers()) {
Event.removePlayer(player); Event.removePlayer(player);
} }
T2Csend.sender(sender, ConfigFile.getResetAll()); T2C_Send.sender(sender, ConfigFile.getResetAll());
} else { } else {
Event.removePlayer(Bukkit.getPlayer(name)); Event.removePlayer(Bukkit.getPlayer(name));
T2Csend.sender(sender, ConfigFile.getReset().replace("[player]", name)); T2C_Send.sender(sender, ConfigFile.getReset().replace("[player]", name));
} }
break; break;
case "info": case "info":
@ -74,10 +74,10 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
case "ver": case "ver":
default: default:
if (!sender.hasPermission("t2code.allayduplicate.info")) { if (!sender.hasPermission("t2code.allayduplicate.info")) {
T2Csend.sender(sender, ConfigFile.getNoPerm()); T2C_Send.sender(sender, ConfigFile.getNoPerm());
return false; 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; break;
} }
} }
@ -99,9 +99,9 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
@Override @Override
public List<String> onTabComplete(CommandSender sender, Command cmd, String s, String[] args) { public List<String> onTabComplete(CommandSender sender, Command cmd, String s, String[] args) {
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
T2Ctab.tab(list, sender, 0, args, arg1); T2C_Tab.tab(list, sender, 0, args, arg1);
T2Ctab.tab(list, sender, 1, args, arg2); T2C_Tab.tab(list, sender, 1, args, arg2);
T2Ctab.tab(list, sender, 1, args, "t2code.allayduplicate.admin", true); T2C_Tab.tab(list, sender, 1, args, "t2code.allayduplicate.admin", true);
return list; return list;
} }
} }

View File

@ -1,9 +1,9 @@
package net.t2code.t2callayduplicate.config; package net.t2code.t2callayduplicate.config;
import lombok.Getter;
import net.t2code.t2callayduplicate.system.Main; import net.t2code.t2callayduplicate.system.Main;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace; import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Replace;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend; import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
import net.t2code.t2codelib.SPIGOT.api.yaml.T2Cconfig;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Particle; import org.bukkit.Particle;
import org.bukkit.Sound; import org.bukkit.Sound;
@ -11,55 +11,60 @@ import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.Objects;
public class ConfigFile { public class ConfigFile {
public static void create() { public static void create() {
File config = new File(Main.getPath(), "config.yml"); File config = new File(Main.getPath(), "config.yml");
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config); YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
T2Cconfig.set("Plugin.Language", "ENGLISH", yamlConfiguration); yamlConfiguration.set("Plugin.Language", "ENGLISH");
T2Cconfig.set("Duplicate.SneakRequired", true, yamlConfiguration); yamlConfiguration.set("Plugin.updateCheck.onJoin",true);
T2Cconfig.set("Duplicate.Item.Enable", true, yamlConfiguration); yamlConfiguration.set("Plugin.updateCheck.seePreReleaseUpdates",true);
T2Cconfig.set("Duplicate.Item.Material", Material.AMETHYST_SHARD.toString(), yamlConfiguration); yamlConfiguration.set("Plugin.updateCheck.timeInterval",60);
T2Cconfig.set("Duplicate.Item.Amount", 1, yamlConfiguration);
T2Cconfig.set("Duplicate.Particle.Enable", true, yamlConfiguration); yamlConfiguration.set("Duplicate.SneakRequired", true);
T2Cconfig.set("Duplicate.Particle.Particle", "HEART", yamlConfiguration); yamlConfiguration.set("Duplicate.Item.Enable", true);
yamlConfiguration.set("Duplicate.Item.Material", Material.AMETHYST_SHARD.toString());
yamlConfiguration.set("Duplicate.Item.Amount", 1);
T2Cconfig.set("Duplicate.Sound.Enable", true, yamlConfiguration); yamlConfiguration.set("Duplicate.Particle.Enable", true);
T2Cconfig.set("Duplicate.Sound.Sound", "ENTITY_ALLAY_AMBIENT_WITHOUT_ITEM", yamlConfiguration); yamlConfiguration.set("Duplicate.Particle.Particle", "HEART");
T2Cconfig.set("Duplicate.Sound.Volume", 3, yamlConfiguration);
T2Cconfig.set("Duplicate.Delay.Enable", true, yamlConfiguration); yamlConfiguration.set("Duplicate.Sound.Enable", true);
T2Cconfig.set("Duplicate.Delay.ProAllay", false, yamlConfiguration); yamlConfiguration.set("Duplicate.Sound.Sound", "ENTITY_ALLAY_AMBIENT_WITHOUT_ITEM");
T2Cconfig.set("Duplicate.Delay.ResetOnReload", true, yamlConfiguration); yamlConfiguration.set("Duplicate.Sound.Volume", 3);
T2Cconfig.set("Duplicate.Delay.Seconds", 300, yamlConfiguration);
T2Cconfig.set("Duplicate.Cost.Enable", true, yamlConfiguration); yamlConfiguration.set("Duplicate.Delay.Enable", true);
T2Cconfig.set("Duplicate.Cost.Price", 10.00, yamlConfiguration); yamlConfiguration.set("Duplicate.Delay.ProAllay", false);
yamlConfiguration.set("Duplicate.Delay.ResetOnReload", true);
yamlConfiguration.set("Duplicate.Delay.Seconds", 300);
T2Cconfig.set("Messages.MiniMessagesEditorLink", "https://webui.adventure.kyori.net", yamlConfiguration); yamlConfiguration.set("Duplicate.Cost.Enable", true);
T2Cconfig.set("Messages.Prefix", "<dark_gray>[<dark_red>T2C</dark_red><aqua>Allay</aqua><gold>Duplicate</gold>]</dark_gray>", yamlConfiguration); yamlConfiguration.set("Duplicate.Cost.Price", 10.00);
T2Cconfig.set("Messages.ENGLISH.Plugin.NoPerm", "[prefix] <red>You are not authorized to do that!</red>", yamlConfiguration); yamlConfiguration.set("Messages.MiniMessagesEditorLink", "https://webui.adventure.kyori.net");
T2Cconfig.set("Messages.ENGLISH.Duplicate", "[prefix] <green>Du You have duplicated an allay.</green>", yamlConfiguration); yamlConfiguration.set("Messages.Prefix", "<dark_gray>[<dark_red>T2C</dark_red><aqua>Allay</aqua><gold>Duplicate</gold>]</dark_gray>");
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);
T2Cconfig.set("Messages.GERMAN.Plugin.NoPerm", "[prefix] <red>Dazu bist du nicht berechtigt!</red>", yamlConfiguration); yamlConfiguration.set("Messages.ENGLISH.Plugin.NoPerm", "[prefix] <red>You are not authorized to do that!</red>");
T2Cconfig.set("Messages.GERMAN.Duplicate", "[prefix] <green>Du hast ein Allay verdoppelt.</green>", yamlConfiguration); yamlConfiguration.set("Messages.ENGLISH.Duplicate", "[prefix] <green>Du You have duplicated an allay.</green>");
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); 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>");
T2Cconfig.set("Messages.GERMAN.Error.IncorrectItem", "[prefix] <red>Du benötigst <gold>[amount] [item]</gold> um einen Allay duplizieren kannst.</red>", yamlConfiguration); yamlConfiguration.set("Messages.ENGLISH.Error.IncorrectItem", "[prefix] <red>You need <gold>[amount] [item]</gold> to be able to duplicate an allay.</red>");
T2Cconfig.set("Messages.GERMAN.Error.NoMoney", "[prefix] <red>Du benötigst <gold>[price] $</gold> um einen Allay duplizieren kannst.</red>", yamlConfiguration); yamlConfiguration.set("Messages.ENGLISH.Error.NoMoney", "[prefix] <red>You need <gold>[price] $</gold> to be able to duplicate an allay.</red>");
T2Cconfig.set("Messages.GERMAN.Error.Reset", "[prefix] <red>Spieler <gold>[player]</gold> nicht Online!</red>", yamlConfiguration); yamlConfiguration.set("Messages.ENGLISH.Error.Reset", "[prefix] <red>Player <gold>[player]</gold> not online!</red>");
T2Cconfig.set("Messages.GERMAN.Error.CanNotBuild", "[prefix] <red>Du bist an diesem Bereich nicht dazu berechtigt.</red>", yamlConfiguration); yamlConfiguration.set("Messages.ENGLISH.Error.CanNotBuild", "[prefix] <red>You are not authorized to do so at this area.</red>");
T2Cconfig.set("Messages.GERMAN.Reset", "[prefix] <green>Das Delay von <gold>[player]</gold> wurde zurückgesetzt.</green>", yamlConfiguration); yamlConfiguration.set("Messages.ENGLISH.Reset", "[prefix] <green>The delay of <gold>[player]</gold> has been reset.</green>");
T2Cconfig.set("Messages.GERMAN.ResetAll", "[prefix] <green>Das Delay von allen Spielern wurde zurückgesetzt.</green>", yamlConfiguration); yamlConfiguration.set("Messages.ENGLISH.ResetAll", "[prefix] <green>The delay of all players has been reset.</green>");
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 { try {
yamlConfiguration.save(config); yamlConfiguration.save(config);
} catch (IOException e) { } catch (IOException e) {
@ -71,6 +76,9 @@ public class ConfigFile {
File config = new File(Main.getPath(), "config.yml"); File config = new File(Main.getPath(), "config.yml");
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config); YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
language = yamlConfiguration.getString("Plugin.Language"); language = yamlConfiguration.getString("Plugin.Language");
updateCheckOnJoin = yamlConfiguration.getBoolean("Plugin.updateCheck.onJoin");
updateCheckSeePreReleaseUpdates = yamlConfiguration.getBoolean("Plugin.updateCheck.seePreReleaseUpdates");
updateCheckTimeInterval = yamlConfiguration.getInt("Plugin.updateCheck.timeInterval");
sneakRequired = yamlConfiguration.getBoolean("Duplicate.SneakRequired"); sneakRequired = yamlConfiguration.getBoolean("Duplicate.SneakRequired");
itemEnable = yamlConfiguration.getBoolean("Duplicate.Item.Enable"); itemEnable = yamlConfiguration.getBoolean("Duplicate.Item.Enable");
@ -81,9 +89,9 @@ public class ConfigFile {
try { try {
particleParticle = Particle.valueOf(yamlConfiguration.getString("Duplicate.Particle.Particle")); particleParticle = Particle.valueOf(yamlConfiguration.getString("Duplicate.Particle.Particle"));
} catch (Exception ex) { } catch (Exception ex) {
T2Csend.error(Main.getPlugin(), ""); T2C_Send.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")); 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"));
T2Csend.error(Main.getPlugin(), ""); T2C_Send.error(Main.getPlugin(), "");
particleParticle = Particle.HEART; particleParticle = Particle.HEART;
} }
@ -91,9 +99,9 @@ public class ConfigFile {
try { try {
soundSound = Sound.valueOf(yamlConfiguration.getString("Duplicate.Sound.Sound")); soundSound = Sound.valueOf(yamlConfiguration.getString("Duplicate.Sound.Sound"));
} catch (Exception ex) { } catch (Exception ex) {
T2Csend.error(Main.getPlugin(), ""); T2C_Send.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")); 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"));
T2Csend.error(Main.getPlugin(), ""); T2C_Send.error(Main.getPlugin(), "");
soundSound = Sound.ENTITY_ALLAY_AMBIENT_WITHOUT_ITEM; soundSound = Sound.ENTITY_ALLAY_AMBIENT_WITHOUT_ITEM;
} }
soundVolume = yamlConfiguration.getInt("Duplicate.Sound.Volume"); soundVolume = yamlConfiguration.getInt("Duplicate.Sound.Volume");
@ -121,143 +129,78 @@ public class ConfigFile {
} }
@Getter
private static String language; private static String language;
@Getter
private static Boolean updateCheckOnJoin;
@Getter
private static Boolean updateCheckSeePreReleaseUpdates;
@Getter
private static Integer updateCheckTimeInterval;
@Getter
private static Boolean sneakRequired; private static Boolean sneakRequired;
@Getter
private static Boolean itemEnable; private static Boolean itemEnable;
@Getter
private static String itemMaterial; private static String itemMaterial;
@Getter
private static Integer itemAmount; private static Integer itemAmount;
@Getter
private static Boolean particleEnable; private static Boolean particleEnable;
@Getter
private static Particle particleParticle; private static Particle particleParticle;
@Getter
private static Boolean soundEnable; private static Boolean soundEnable;
@Getter
private static Sound soundSound; private static Sound soundSound;
@Getter
private static Integer soundVolume; private static Integer soundVolume;
@Getter
private static Boolean delayEnable; private static Boolean delayEnable;
@Getter
private static Boolean delayProAllay; private static Boolean delayProAllay;
@Getter
private static Boolean delayResetOnReload; private static Boolean delayResetOnReload;
@Getter
private static Integer delaySeconds; private static Integer delaySeconds;
@Getter
private static Boolean costEnable; private static Boolean costEnable;
@Getter
private static Double costPrice; private static Double costPrice;
@Getter
private static String prefix; private static String prefix;
@Getter
private static String noPerm; private static String noPerm;
@Getter
private static String duplicate; private static String duplicate;
@Getter
private static String errorDelay; private static String errorDelay;
@Getter
private static String errorIncorrectItem; private static String errorIncorrectItem;
@Getter
private static String errorNoMoney; private static String errorNoMoney;
@Getter
private static String errorReset; private static String errorReset;
@Getter
private static String errorCanNotBuild; private static String errorCanNotBuild;
@Getter
private static String reset; private static String reset;
@Getter
private static String ResetAll; private static String ResetAll;
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) { private static String getMSG(String path, YamlConfiguration yamlConfiguration) {
String out; String out;
if (yamlConfiguration.get(path) != null) { if (yamlConfiguration.get(path) != null) {
out = T2Creplace.replace(prefix, yamlConfiguration.getString(path)); out = T2C_Replace.replace(prefix, Objects.requireNonNull(yamlConfiguration.getString(path)));
} else { } 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; out = path;
} }
return out; return out;

View File

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

View File

@ -6,11 +6,11 @@ import net.t2code.t2callayduplicate.Util;
import net.t2code.t2callayduplicate.commands.CmdExecuter; import net.t2code.t2callayduplicate.commands.CmdExecuter;
import net.t2code.t2callayduplicate.config.ConfigFile; import net.t2code.t2callayduplicate.config.ConfigFile;
import net.t2code.t2callayduplicate.event.Event; import net.t2code.t2callayduplicate.event.Event;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend; import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate; import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Template;
import net.t2code.t2codelib.SPIGOT.api.plugins.T2CpluginCheck; import net.t2code.t2codelib.SPIGOT.api.plugins.T2C_PluginCheck;
import net.t2code.t2codelib.SPIGOT.api.register.T2Cregister; import net.t2code.t2codelib.SPIGOT.api.register.T2C_Register;
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI; import net.t2code.t2codelib.SPIGOT.api.update.T2C_UpdateAPI;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
@ -49,27 +49,28 @@ public final class Main extends JavaPlugin {
} }
if (pluginNotFound("T2CodeLib", 96388, Util.getRequiredT2CodeLibVersion())) return; if (pluginNotFound("T2CodeLib", 96388, Util.getRequiredT2CodeLibVersion())) return;
enable = true; 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());
T2CupdateAPI.onUpdateCheck(plugin, Util.getPrefix(), Util.getSpigotID(), Util.getDiscord());
Metrics.Bstats(); Metrics.Bstats();
if (T2CpluginCheck.plotSquared()) { if (T2C_PluginCheck.plotSquared()) {
plotsquared = true; plotsquared = true;
plotSquaredIntegration = new PlotSquaredIntegration(); 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; lands = true;
landsintegrator = new LandsIntegratior(this); 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.create();
ConfigFile.select(); ConfigFile.select();
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()); this.getCommand("t2c-allayduplicate").setExecutor(new CmdExecuter());
T2Cregister.listener(new Event(), this); T2C_Register.listener(new Event(), this);
T2Ctemplate.onLoadFooter(Util.getPrefix(), long_); T2C_Template.onLoadFooter(Util.getPrefix(), long_);
} }
@ -78,7 +79,7 @@ public final class Main extends JavaPlugin {
public void onDisable() { public void onDisable() {
// Plugin shutdown logic // Plugin shutdown logic
HandlerList.unregisterAll(event); 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) { public static Boolean pluginNotFound(String pl, Integer spigotID, String ver) {