Compare commits

..

No commits in common. "main" and "1.3" have entirely different histories.
main ... 1.3

6 changed files with 229 additions and 186 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.5</version> <version>1.3</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>16.7</version> <version>DEV-13.0</version>
<classifier>dev-24</classifier> <classifier>dev-5</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.26.18</version> <version>6.5.1</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<!-- FAWE API --> <!-- FAWE API -->
@ -124,12 +124,6 @@
</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,41 +1,33 @@
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 {
@Getter public static String getInfoText() {
private static String infoText = ""; return "";
}
@Getter public static String getRequiredT2CodeLibVersion() {
private static String requiredT2CodeLibVersion = "16.7"; return "13.0";
}
@Getter public static String getPrefix() {
private static String prefix = "§8[§4T2C§bAllay§6Duplicate§8]"; return "§8[§4T2C§bAllay§6Duplicate§8]";
}
@Getter public static Integer getSpigotID() {
private static Integer spigotID = 103745; return 103745;
}
@Getter public static Integer getBstatsID() {
private static String git = "JaTiTV/T2C-AllayDuplicate"; return 15932;
}
@Getter public static String getSpigot() {
private static Integer bstatsID = 15932; return "https://www.spigotmc.org/resources/" + getSpigotID();
}
@Getter public static String getDiscord() {
private static String spigot = "https://www.spigotmc.org/resources/" + spigotID; 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.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.T2C_Tab; import net.t2code.t2codelib.SPIGOT.api.commands.T2Ctab;
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send; import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Template; import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
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")) {
T2C_Send.sender(sender, ConfigFile.getNoPerm()); T2Csend.sender(sender, ConfigFile.getNoPerm());
return false; return false;
} }
T2C_Template.sendInfo(sender,Main.getPlugin(),Util.getSpigotID(),Util.getDiscord(),Util.getInfoText()); T2Ctemplate.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")) {
T2C_Send.sender(sender, ConfigFile.getNoPerm()); T2Csend.sender(sender, ConfigFile.getNoPerm());
return false; return false;
} }
T2C_Send.console(Util.getPrefix() + "§8-------------------------------"); T2Csend.console(Util.getPrefix() + "§8-------------------------------");
T2C_Send.console(Util.getPrefix() + " §6Plugin reload..."); T2Csend.console(Util.getPrefix() + " §6Plugin reload...");
T2C_Send.console(Util.getPrefix() + "§8-------------------------------"); T2Csend.console(Util.getPrefix() + "§8-------------------------------");
T2C_Send.sender(sender, Util.getPrefix() + " §6Plugin is reloaded..."); T2Csend.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();
T2C_Send.sender(sender, Util.getPrefix() + " §6Plugin was successfully reloaded."); T2Csend.sender(sender, Util.getPrefix() + " §6Plugin was successfully reloaded.");
T2C_Send.console(Util.getPrefix() + "§8-------------------------------"); T2Csend.console(Util.getPrefix() + "§8-------------------------------");
T2C_Send.console(Util.getPrefix() + " §2Plugin successfully reloaded."); T2Csend.console(Util.getPrefix() + " §2Plugin successfully reloaded.");
T2C_Send.console(Util.getPrefix() + "§8-------------------------------"); T2Csend.console(Util.getPrefix() + "§8-------------------------------");
break; break;
case "reset": case "reset":
if (!sender.hasPermission("t2code.allayduplicate.reset")) { if (!sender.hasPermission("t2code.allayduplicate.reset")) {
T2C_Send.sender(sender, ConfigFile.getNoPerm()); T2Csend.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"))) {
T2C_Send.sender(sender, ConfigFile.getErrorReset().replace("[player]", name)); T2Csend.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);
} }
T2C_Send.sender(sender, ConfigFile.getResetAll()); T2Csend.sender(sender, ConfigFile.getResetAll());
} else { } else {
Event.removePlayer(Bukkit.getPlayer(name)); Event.removePlayer(Bukkit.getPlayer(name));
T2C_Send.sender(sender, ConfigFile.getReset().replace("[player]", name)); T2Csend.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")) {
T2C_Send.sender(sender, ConfigFile.getNoPerm()); T2Csend.sender(sender, ConfigFile.getNoPerm());
return false; return false;
} }
T2C_Template.sendInfo(sender,Main.getPlugin(),Util.getSpigotID(),Util.getDiscord(),Util.getInfoText()); T2Ctemplate.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<>();
T2C_Tab.tab(list, sender, 0, args, arg1); T2Ctab.tab(list, sender, 0, args, arg1);
T2C_Tab.tab(list, sender, 1, args, arg2); T2Ctab.tab(list, sender, 1, args, arg2);
T2C_Tab.tab(list, sender, 1, args, "t2code.allayduplicate.admin", true); T2Ctab.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.T2C_Replace; import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send; import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
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,60 +11,55 @@ 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);
yamlConfiguration.set("Plugin.Language", "ENGLISH"); T2Cconfig.set("Plugin.Language", "ENGLISH", yamlConfiguration);
yamlConfiguration.set("Plugin.updateCheck.onJoin",true); T2Cconfig.set("Duplicate.SneakRequired", true, yamlConfiguration);
yamlConfiguration.set("Plugin.updateCheck.seePreReleaseUpdates",true); T2Cconfig.set("Duplicate.Item.Enable", true, yamlConfiguration);
yamlConfiguration.set("Plugin.updateCheck.timeInterval",60); T2Cconfig.set("Duplicate.Item.Material", Material.AMETHYST_SHARD.toString(), yamlConfiguration);
T2Cconfig.set("Duplicate.Item.Amount", 1, yamlConfiguration);
yamlConfiguration.set("Duplicate.SneakRequired", true); T2Cconfig.set("Duplicate.Particle.Enable", true, yamlConfiguration);
yamlConfiguration.set("Duplicate.Item.Enable", true); T2Cconfig.set("Duplicate.Particle.Particle", "HEART", yamlConfiguration);
yamlConfiguration.set("Duplicate.Item.Material", Material.AMETHYST_SHARD.toString());
yamlConfiguration.set("Duplicate.Item.Amount", 1);
yamlConfiguration.set("Duplicate.Particle.Enable", true); T2Cconfig.set("Duplicate.Sound.Enable", true, yamlConfiguration);
yamlConfiguration.set("Duplicate.Particle.Particle", "HEART"); T2Cconfig.set("Duplicate.Sound.Sound", "ENTITY_ALLAY_AMBIENT_WITHOUT_ITEM", yamlConfiguration);
T2Cconfig.set("Duplicate.Sound.Volume", 3, yamlConfiguration);
yamlConfiguration.set("Duplicate.Sound.Enable", true); T2Cconfig.set("Duplicate.Delay.Enable", true, yamlConfiguration);
yamlConfiguration.set("Duplicate.Sound.Sound", "ENTITY_ALLAY_AMBIENT_WITHOUT_ITEM"); T2Cconfig.set("Duplicate.Delay.ProAllay", false, yamlConfiguration);
yamlConfiguration.set("Duplicate.Sound.Volume", 3); T2Cconfig.set("Duplicate.Delay.ResetOnReload", true, yamlConfiguration);
T2Cconfig.set("Duplicate.Delay.Seconds", 300, yamlConfiguration);
yamlConfiguration.set("Duplicate.Delay.Enable", true); T2Cconfig.set("Duplicate.Cost.Enable", true, yamlConfiguration);
yamlConfiguration.set("Duplicate.Delay.ProAllay", false); T2Cconfig.set("Duplicate.Cost.Price", 10.00, yamlConfiguration);
yamlConfiguration.set("Duplicate.Delay.ResetOnReload", true);
yamlConfiguration.set("Duplicate.Delay.Seconds", 300);
yamlConfiguration.set("Duplicate.Cost.Enable", true); T2Cconfig.set("Messages.MiniMessagesEditorLink", "https://webui.adventure.kyori.net", yamlConfiguration);
yamlConfiguration.set("Duplicate.Cost.Price", 10.00); 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"); T2Cconfig.set("Messages.ENGLISH.Plugin.NoPerm", "[prefix] <red>You are not authorized to do that!</red>", yamlConfiguration);
yamlConfiguration.set("Messages.Prefix", "<dark_gray>[<dark_red>T2C</dark_red><aqua>Allay</aqua><gold>Duplicate</gold>]</dark_gray>"); 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>"); T2Cconfig.set("Messages.GERMAN.Plugin.NoPerm", "[prefix] <red>Dazu bist du nicht berechtigt!</red>", yamlConfiguration);
yamlConfiguration.set("Messages.ENGLISH.Duplicate", "[prefix] <green>Du You have duplicated an allay.</green>"); T2Cconfig.set("Messages.GERMAN.Duplicate", "[prefix] <green>Du hast ein Allay verdoppelt.</green>", 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.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.IncorrectItem", "[prefix] <red>You need <gold>[amount] [item]</gold> to be able to duplicate an 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.NoMoney", "[prefix] <red>You need <gold>[price] $</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.Reset", "[prefix] <red>Player <gold>[player]</gold> not online!</red>"); T2Cconfig.set("Messages.GERMAN.Error.Reset", "[prefix] <red>Spieler <gold>[player]</gold> nicht Online!</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.Error.CanNotBuild", "[prefix] <red>Du bist an diesem Bereich nicht dazu berechtigt.</red>", yamlConfiguration);
yamlConfiguration.set("Messages.ENGLISH.Reset", "[prefix] <green>The delay of <gold>[player]</gold> has been reset.</green>"); T2Cconfig.set("Messages.GERMAN.Reset", "[prefix] <green>Das Delay von <gold>[player]</gold> wurde zurückgesetzt.</green>", yamlConfiguration);
yamlConfiguration.set("Messages.ENGLISH.ResetAll", "[prefix] <green>The delay of all players has been reset.</green>"); 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 { try {
yamlConfiguration.save(config); yamlConfiguration.save(config);
} catch (IOException e) { } catch (IOException e) {
@ -76,9 +71,6 @@ 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");
@ -89,9 +81,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) {
T2C_Send.error(Main.getPlugin(), ""); T2Csend.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")); 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.error(Main.getPlugin(), ""); T2Csend.error(Main.getPlugin(), "");
particleParticle = Particle.HEART; particleParticle = Particle.HEART;
} }
@ -99,9 +91,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) {
T2C_Send.error(Main.getPlugin(), ""); T2Csend.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")); 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.error(Main.getPlugin(), ""); T2Csend.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");
@ -116,91 +108,156 @@ public class ConfigFile {
prefix = yamlConfiguration.getString("Messages.Prefix"); prefix = yamlConfiguration.getString("Messages.Prefix");
noPerm = getMSG("Messages." + language + ".Plugin.NoPerm",yamlConfiguration); noPerm = getMSG("Messages." + language + ".Plugin.NoPerm", yamlConfiguration);
duplicate = getMSG("Messages." + language + ".Duplicate",yamlConfiguration); duplicate = getMSG("Messages." + language + ".Duplicate", yamlConfiguration);
errorDelay = getMSG("Messages." + language + ".Error.Delay",yamlConfiguration); errorDelay = getMSG("Messages." + language + ".Error.Delay", yamlConfiguration);
errorIncorrectItem = getMSG("Messages." + language + ".Error.IncorrectItem",yamlConfiguration); errorIncorrectItem = getMSG("Messages." + language + ".Error.IncorrectItem", yamlConfiguration);
errorNoMoney = getMSG("Messages." + language + ".Error.NoMoney",yamlConfiguration); errorNoMoney = getMSG("Messages." + language + ".Error.NoMoney", yamlConfiguration);
errorReset = getMSG("Messages." + language + ".Error.Reset",yamlConfiguration); errorReset = getMSG("Messages." + language + ".Error.Reset", yamlConfiguration);
errorCanNotBuild = getMSG("Messages." + language + ".Error.CanNotBuild",yamlConfiguration); errorCanNotBuild = getMSG("Messages." + language + ".Error.CanNotBuild", yamlConfiguration);
reset = getMSG("Messages." + language + ".Reset",yamlConfiguration); reset = getMSG("Messages." + language + ".Reset", yamlConfiguration);
ResetAll = getMSG("Messages." + language + ".ResetAll",yamlConfiguration); ResetAll = getMSG("Messages." + language + ".ResetAll", yamlConfiguration);
} }
@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 = T2C_Replace.replace(prefix, Objects.requireNonNull(yamlConfiguration.getString(path))); out = T2Creplace.replace(prefix, yamlConfiguration.getString(path));
} else { } else {
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)); T2Csend.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.T2C_Eco; import net.t2code.t2codelib.SPIGOT.api.eco.T2Ceco;
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send; import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.update.T2C_UpdateAPI; import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
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,11 +20,12 @@ 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) {
T2C_UpdateAPI.join(Main.getPlugin(), Util.getPrefix(), "t2code.allayduplicate.admin", event.getPlayer(), Util.getSpigotID(), Util.getDiscord()); T2CupdateAPI.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<>();
@ -54,7 +55,7 @@ public class Event implements Listener {
e.setCancelled(true); e.setCancelled(true);
if (!BuildCheck.canBuild(player, location)) { if (!BuildCheck.canBuild(player, location)) {
T2C_Send.player(player, ConfigFile.getErrorCanNotBuild()); T2Csend.player(player, ConfigFile.getErrorCanNotBuild());
return; return;
} }
@ -71,20 +72,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);
T2C_Send.player(player, ConfigFile.getErrorDelay().replace("&", "§").replace("[min]", String.valueOf(remainingMin)) T2Csend.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 (!T2C_Eco.moneyRemove(ConfigFile.getPrefix(), player, ConfigFile.getCostPrice())) { if (!T2Ceco.moneyRemove(ConfigFile.getPrefix(), player, ConfigFile.getCostPrice())) {
T2C_Send.player(player, ConfigFile.getErrorNoMoney().replace("[price]", String.valueOf(ConfigFile.getCostPrice()))); T2Csend.player(player, ConfigFile.getErrorNoMoney().replace("[price]", String.valueOf(ConfigFile.getCostPrice())));
return; return;
} }
} }
if (!T2C_Eco.itemRemove(player, ConfigFile.getItemMaterial(), ConfigFile.getItemAmount())) { if (!T2Ceco.itemRemove(player, ConfigFile.getItemMaterial(), ConfigFile.getItemAmount())) {
T2C_Send.player(player, ConfigFile.getErrorIncorrectItem().replace("[amount]", String.valueOf(ConfigFile.getItemAmount())) T2Csend.player(player, ConfigFile.getErrorIncorrectItem().replace("[amount]", String.valueOf(ConfigFile.getItemAmount()))
.replace("[item]", ConfigFile.getItemMaterial())); .replace("[item]", ConfigFile.getItemMaterial()));
return; return;
} }
@ -103,7 +104,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());
T2C_Send.player(player, ConfigFile.getDuplicate()); T2Csend.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.T2C_Send; import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Template; import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
import net.t2code.t2codelib.SPIGOT.api.plugins.T2C_PluginCheck; import net.t2code.t2codelib.SPIGOT.api.plugins.T2CpluginCheck;
import net.t2code.t2codelib.SPIGOT.api.register.T2C_Register; import net.t2code.t2codelib.SPIGOT.api.register.T2Cregister;
import net.t2code.t2codelib.SPIGOT.api.update.T2C_UpdateAPI; import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
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,28 +49,27 @@ 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_ = T2C_Template.onLoadHeader(Util.getPrefix(), this.getDescription().getAuthors(), this.getDescription().getVersion(), Util.getSpigot(), Util.getDiscord()); long long_ = T2Ctemplate.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 (T2C_PluginCheck.plotSquared()) { if (T2CpluginCheck.plotSquared()) {
plotsquared = true; plotsquared = true;
plotSquaredIntegration = new PlotSquaredIntegration(); plotSquaredIntegration = new PlotSquaredIntegration();
T2C_Send.console(Util.getPrefix() + " §2Load Hook: §6PlotSquared - " + T2C_PluginCheck.pluginInfos("PlotSquared").getDescription().getVersion()); T2Csend.console(Util.getPrefix() + " §2Load Hook: §6PlotSquared - " + T2CpluginCheck.pluginInfos("PlotSquared").getDescription().getVersion());
} }
if (T2C_PluginCheck.pluginCheck("Lands")) { if (T2CpluginCheck.pluginCheck("Lands")) {
lands = true; lands = true;
landsintegrator = new LandsIntegratior(this); landsintegrator = new LandsIntegratior(this);
T2C_Send.console(Util.getPrefix() + " §2Load Hook: §6Lands - " + T2C_PluginCheck.pluginInfos("Lands").getDescription().getVersion()); T2Csend.console(Util.getPrefix() + " §2Load Hook: §6Lands - " + T2CpluginCheck.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());
T2C_Register.listener(new Event(), this); T2Cregister.listener(new Event(), this);
T2C_Template.onLoadFooter(Util.getPrefix(), long_); T2Ctemplate.onLoadFooter(Util.getPrefix(), long_);
} }
@ -79,7 +78,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) T2C_Template.onDisable(Util.getPrefix(), plugin); if (enable) T2Ctemplate.onDisable(Util.getPrefix(), this.getDescription().getAuthors(), this.getDescription().getVersion(), Util.getSpigot(), Util.getDiscord());
} }
public static Boolean pluginNotFound(String pl, Integer spigotID, String ver) { public static Boolean pluginNotFound(String pl, Integer spigotID, String ver) {