api to T2CodeLib 16.7_dev-22
This commit is contained in:
parent
456e13bf5f
commit
bc7803831c
10
pom.xml
10
pom.xml
@ -7,7 +7,7 @@
|
|||||||
<groupId>net.t2code</groupId>
|
<groupId>net.t2code</groupId>
|
||||||
<artifactId>Alias</artifactId>
|
<artifactId>Alias</artifactId>
|
||||||
|
|
||||||
<version>1.6_DEV-1</version>
|
<version>1.6_DEV-22</version>
|
||||||
<!--version>VERSION_snapshot-0</version-->
|
<!--version>VERSION_snapshot-0</version-->
|
||||||
<!--version>VERSION_beta-0</version-->
|
<!--version>VERSION_beta-0</version-->
|
||||||
<!--version>VERSION_dev-0</version-->
|
<!--version>VERSION_dev-0</version-->
|
||||||
@ -30,8 +30,8 @@
|
|||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.8.1</version>
|
<version>3.8.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>${java.version}</source>
|
<source>11</source>
|
||||||
<target>${java.version}</target>
|
<target>11</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
@ -101,13 +101,13 @@
|
|||||||
<groupId>net.t2code</groupId>
|
<groupId>net.t2code</groupId>
|
||||||
<artifactId>T2CodeLib</artifactId>
|
<artifactId>T2CodeLib</artifactId>
|
||||||
<version>16.7</version>
|
<version>16.7</version>
|
||||||
<classifier>dev-10</classifier>
|
<classifier>dev-21</classifier>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
<version>RELEASE</version>
|
<version>1.18.30</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -4,23 +4,23 @@ import lombok.Getter;
|
|||||||
import net.t2code.alias.Spigot.objects.AliasObject;
|
import net.t2code.alias.Spigot.objects.AliasObject;
|
||||||
import net.t2code.alias.Spigot.objects.SubAliasObject;
|
import net.t2code.alias.Spigot.objects.SubAliasObject;
|
||||||
import net.t2code.alias.Spigot.system.Load;
|
import net.t2code.alias.Spigot.system.Load;
|
||||||
import net.t2code.alias.Util;
|
import net.t2code.alias.util.Util;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Template;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2C_McVersion;
|
||||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
public final class Main extends JavaPlugin {
|
public final class Main extends JavaPlugin {
|
||||||
public static File getPath() {
|
public static File getPath() {
|
||||||
return plugin.getDataFolder();
|
return instance.getDataFolder();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@ -28,7 +28,10 @@ public final class Main extends JavaPlugin {
|
|||||||
@Getter
|
@Getter
|
||||||
private static List<String> autor;
|
private static List<String> autor;
|
||||||
@Getter
|
@Getter
|
||||||
private static Main plugin;
|
private static Main instance;
|
||||||
|
@Getter
|
||||||
|
private static Boolean t2codeLib = false;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private static String guiCode;
|
private static String guiCode;
|
||||||
public static HashMap<String, AliasObject> aliasHashMap = new HashMap<>();
|
public static HashMap<String, AliasObject> aliasHashMap = new HashMap<>();
|
||||||
@ -42,13 +45,13 @@ public final class Main extends JavaPlugin {
|
|||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
// Plugin startup logic
|
// Plugin startup logic
|
||||||
plugin = this;
|
instance = this;
|
||||||
autor = plugin.getDescription().getAuthors();
|
autor = instance.getDescription().getAuthors();
|
||||||
version = plugin.getDescription().getVersion();
|
version = instance.getDescription().getVersion();
|
||||||
|
|
||||||
if (pluginNotFound("T2CodeLib", 96388, Util.getRequiredT2CodeLibVersion())) return;
|
if (pluginNotFound("T2CodeLib", 96388, Util.getRequiredT2CodeLibVersion())) return;
|
||||||
|
t2codeLib = true;
|
||||||
if (T2CmcVersion.isMc1_13()) {
|
if (T2C_McVersion.isMc1_13()) {
|
||||||
guiCode = "";
|
guiCode = "";
|
||||||
} else guiCode = "§6§8§9§r";
|
} else guiCode = "§6§8§9§r";
|
||||||
|
|
||||||
@ -60,37 +63,37 @@ public final class Main extends JavaPlugin {
|
|||||||
// Plugin shutdown logic
|
// Plugin shutdown logic
|
||||||
aliasHashMap.clear();
|
aliasHashMap.clear();
|
||||||
allAliases.clear();
|
allAliases.clear();
|
||||||
if (Bukkit.getPluginManager().getPlugin("T2CodeLib") == null) return;
|
if (t2codeLib) return;
|
||||||
T2Ctemplate.onDisable(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord());
|
T2C_Template.onDisable(Util.getPrefix(), instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Boolean pluginNotFound(String pl, Integer spigotID, String ver) {
|
public static Boolean pluginNotFound(String pl, Integer spigotID, String ver) {
|
||||||
if (Bukkit.getPluginManager().getPlugin(pl) == null) {
|
if (Bukkit.getPluginManager().getPlugin(pl) == null) {
|
||||||
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
|
instance.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
|
||||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §e" + pl + " §4could not be found. Please download it here: "
|
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §e" + pl + " §4could not be found. Please download it here: "
|
||||||
+ "§6https://spigotmc.org/resources/" + pl + "." + spigotID + " §4to be able to use this plugin.");
|
+ "§6https://spigotmc.org/resources/" + pl + "." + spigotID + " §4to be able to use this plugin.");
|
||||||
Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
|
Main.instance.getPluginLoader().disablePlugin(Main.instance);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
String plVer = Bukkit.getPluginManager().getPlugin(pl).getDescription().getVersion();
|
String plVer = Objects.requireNonNull(Bukkit.getPluginManager().getPlugin(pl)).getDescription().getVersion();
|
||||||
if (ver.contains("_")) {
|
if (ver.contains("_")) {
|
||||||
if (!plVer.equals(ver)) {
|
if (!plVer.equals(ver)) {
|
||||||
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
|
instance.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
|
||||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §e" + pl + " §4is out of date! This plugin requires the version §2"
|
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §e" + pl + " §4is out of date! This plugin requires the version §2"
|
||||||
+ ver + " §4of §6" + pl + " §4Please use this version! Please download it here or contact us in Discord: §6https://spigotmc.org/resources/"
|
+ ver + " §4of §6" + pl + " §4Please use this version! Please download it here or contact us in Discord: §6https://spigotmc.org/resources/"
|
||||||
+ pl + "." + spigotID + " Or contact us in Discord: http://dc.t2code.net");
|
+ pl + "." + spigotID + " Or contact us in Discord: http://dc.t2code.net");
|
||||||
Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
|
Main.instance.getPluginLoader().disablePlugin(Main.instance);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String[] split = plVer.split("_");
|
String[] split = plVer.split("_");
|
||||||
if (Double.parseDouble(split[0]) < Double.parseDouble(ver)) {
|
if (Double.parseDouble(split[0]) < Double.parseDouble(ver)) {
|
||||||
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
|
instance.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
|
||||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §e" + pl + " §4is out of date! This plugin requires at least version §2"
|
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §e" + pl + " §4is out of date! This plugin requires at least version §2"
|
||||||
+ ver + " §4of §6" + pl + " §4Please update it here: §6https://spigotmc.org/resources/" + pl + "." + spigotID
|
+ ver + " §4of §6" + pl + " §4Please update it here: §6https://spigotmc.org/resources/" + pl + "." + spigotID
|
||||||
+ " §4to use this version of " + plugin.getDescription().getName() + ".");
|
+ " §4to use this version of " + instance.getDescription().getName() + ".");
|
||||||
Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
|
Main.instance.getPluginLoader().disablePlugin(Main.instance);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -3,7 +3,7 @@ package net.t2code.alias.Spigot.cmdManagement;
|
|||||||
import net.t2code.alias.Spigot.config.config.Config;
|
import net.t2code.alias.Spigot.config.config.Config;
|
||||||
import net.t2code.alias.Spigot.config.config.Language;
|
import net.t2code.alias.Spigot.config.config.Language;
|
||||||
import net.t2code.alias.Spigot.enums.Confirm;
|
import net.t2code.alias.Spigot.enums.Confirm;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -25,7 +25,7 @@ public class AliasCmdExecuter implements CommandExecutor, TabCompleter {
|
|||||||
// Command
|
// Command
|
||||||
if (sender.hasPermission("t2c.alias.command.info")) {
|
if (sender.hasPermission("t2c.alias.command.info")) {
|
||||||
Commands.info(sender);
|
Commands.info(sender);
|
||||||
} else T2Csend.sender(sender, Language.noPermission.value.replace("[cmd]", "/t2code-alias info")
|
} else T2C_Send.sender(sender, Language.VALUES.noPermission.getValue().toString().replace("[cmd]", "/t2code-alias info")
|
||||||
.replace("[perm]", "t2c.alias.command.info"));
|
.replace("[perm]", "t2c.alias.command.info"));
|
||||||
} else {
|
} else {
|
||||||
switch (args[0].toLowerCase()) {
|
switch (args[0].toLowerCase()) {
|
||||||
@ -33,7 +33,7 @@ public class AliasCmdExecuter implements CommandExecutor, TabCompleter {
|
|||||||
case "rl":
|
case "rl":
|
||||||
if (sender.hasPermission("t2c.alias.command.reload") || sender.isOp()) {
|
if (sender.hasPermission("t2c.alias.command.reload") || sender.isOp()) {
|
||||||
Commands.reload(sender);
|
Commands.reload(sender);
|
||||||
} else T2Csend.sender(sender, Language.noPermission.value.replace("[cmd]", "/t2code-alias reload")
|
} else T2C_Send.sender(sender, Language.VALUES.noPermission.getValue().toString().replace("[cmd]", "/t2code-alias reload")
|
||||||
.replace("[perm]", "t2c.alias.command.reload"));
|
.replace("[perm]", "t2c.alias.command.reload"));
|
||||||
break;
|
break;
|
||||||
case "confirm":
|
case "confirm":
|
||||||
@ -47,7 +47,7 @@ public class AliasCmdExecuter implements CommandExecutor, TabCompleter {
|
|||||||
case "version":
|
case "version":
|
||||||
if (sender.hasPermission("t2c.alias.command.info")) {
|
if (sender.hasPermission("t2c.alias.command.info")) {
|
||||||
Commands.info(sender);
|
Commands.info(sender);
|
||||||
} else T2Csend.sender(sender, Language.noPermission.value.replace("[cmd]", "/t2code-alias info")
|
} else T2C_Send.sender(sender, Language.VALUES.noPermission.getValue().toString().replace("[cmd]", "/t2code-alias info")
|
||||||
.replace("[perm]", "t2c.alias.command.info"));
|
.replace("[perm]", "t2c.alias.command.info"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -3,27 +3,27 @@ package net.t2code.alias.Spigot.cmdManagement;
|
|||||||
import net.t2code.alias.Spigot.Main;
|
import net.t2code.alias.Spigot.Main;
|
||||||
import net.t2code.alias.Spigot.config.config.Language;
|
import net.t2code.alias.Spigot.config.config.Language;
|
||||||
import net.t2code.alias.Spigot.system.Load;
|
import net.t2code.alias.Spigot.system.Load;
|
||||||
import net.t2code.alias.Util;
|
import net.t2code.alias.util.Util;
|
||||||
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.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class Commands {
|
public class Commands {
|
||||||
|
|
||||||
public static void info(CommandSender sender) {
|
public static void info(CommandSender sender) {
|
||||||
T2Ctemplate.sendInfo(sender, Main.getPlugin(), Util.getSpigotID(), Util.getDiscord(), Util.getInfoText());
|
T2C_Template.sendInfo(sender, Main.getInstance(), Util.getSpigotID(), Util.getDiscord(), Util.getInfoText());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void reload(CommandSender sender) {
|
public static void reload(CommandSender sender) {
|
||||||
if (sender instanceof Player) T2Csend.player((Player) sender, Language.reloadStart.value);
|
if (sender instanceof Player) T2C_Send.player((Player) sender, Language.VALUES.reloadStart.getValue().toString());
|
||||||
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-------------------------------");
|
||||||
Load.loadReload(Main.getPlugin());
|
Load.loadReload(Main.getInstance(),true);
|
||||||
if (sender instanceof Player) T2Csend.player((Player) sender, Language.reloadEnd.value);
|
if (sender instanceof Player) T2C_Send.player((Player) sender, Language.VALUES.reloadEnd.getValue().toString());
|
||||||
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-------------------------------");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,13 +9,13 @@ import net.t2code.alias.Spigot.objects.AliasObject;
|
|||||||
import net.t2code.alias.Spigot.objects.AliasStorageObject;
|
import net.t2code.alias.Spigot.objects.AliasStorageObject;
|
||||||
import net.t2code.alias.Spigot.objects.SubAliasObject;
|
import net.t2code.alias.Spigot.objects.SubAliasObject;
|
||||||
import net.t2code.alias.Spigot.system.BCommandSenderReciver;
|
import net.t2code.alias.Spigot.system.BCommandSenderReciver;
|
||||||
import net.t2code.alias.Util;
|
import net.t2code.alias.util.Util;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.commands.T2Ccmd;
|
import net.t2code.t2codelib.SPIGOT.api.commands.T2C_Cmd;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.eco.T2Ceco;
|
import net.t2code.t2codelib.SPIGOT.api.eco.T2C_Eco;
|
||||||
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.plugins.T2CpluginCheck;
|
import net.t2code.t2codelib.SPIGOT.api.plugins.T2C_PluginCheck;
|
||||||
import net.t2code.t2codelib.SPIGOT.system.config.config.T2CLibConfig;
|
import net.t2code.t2codelib.SPIGOT.system.config.config.T2C_LibConfig;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ public class ExecuteAlias {
|
|||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
if (!Cache.aliasStorage.containsKey(player.getUniqueId())) {
|
if (!Cache.aliasStorage.containsKey(player.getUniqueId())) {
|
||||||
T2Csend.player(player, Language.confirmNotPossible.value);
|
T2C_Send.player(player, Language.VALUES.confirmNotPossible.getValue().toString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ public class ExecuteAlias {
|
|||||||
Cache.aliasStorage.remove(player.getUniqueId());
|
Cache.aliasStorage.remove(player.getUniqueId());
|
||||||
|
|
||||||
if (!confirm) {
|
if (!confirm) {
|
||||||
T2Csend.player(player, Language.confirmCancel.value);
|
T2C_Send.player(player, Language.VALUES.confirmCancel.getValue().toString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,9 +67,9 @@ public class ExecuteAlias {
|
|||||||
if (!(player.hasPermission(aliasObject.permission.replace("[alias]", alias.toLowerCase())) || player.hasPermission("t2c.alias.admin"))) {
|
if (!(player.hasPermission(aliasObject.permission.replace("[alias]", alias.toLowerCase())) || player.hasPermission("t2c.alias.admin"))) {
|
||||||
String npmsg;
|
String npmsg;
|
||||||
if (aliasObject.permissionMSG == null || aliasObject.permissionMSG.equals("")) {
|
if (aliasObject.permissionMSG == null || aliasObject.permissionMSG.equals("")) {
|
||||||
npmsg = Language.noPermission.value;
|
npmsg = Language.VALUES.noPermission.getValue().toString();
|
||||||
} else npmsg = aliasObject.permissionMSG;
|
} else npmsg = aliasObject.permissionMSG;
|
||||||
T2Csend.player(player, npmsg.replace("[cmd]", "/" + alias.toLowerCase())
|
T2C_Send.player(player, npmsg.replace("[cmd]", "/" + alias.toLowerCase())
|
||||||
.replace("[perm]", aliasObject.permission.replace("[alias]", alias.toLowerCase())).replace("[alias]", alias));
|
.replace("[perm]", aliasObject.permission.replace("[alias]", alias.toLowerCase())).replace("[alias]", alias));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -83,12 +83,12 @@ public class ExecuteAlias {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CHAT:
|
case CHAT:
|
||||||
T2Csend.player(player, Language.confirmChat.value.replace("[price]", aliasObject.costPrice.toString() + " " + Config.VALUES.buyCurrency.getValue()));
|
T2C_Send.player(player, Language.VALUES.confirmChat.getValue().toString().replace("[price]", aliasObject.costPrice.toString() + " " + Config.VALUES.buyCurrency.getValue()));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COMMAND:
|
case COMMAND:
|
||||||
default:
|
default:
|
||||||
T2Csend.player(player, Language.confirmCommand.value.replace("[price]", aliasObject.costPrice.toString() + " " + Config.VALUES.buyCurrency.getValue()));
|
T2C_Send.player(player, Language.VALUES.confirmCommand.getValue().toString().replace("[price]", aliasObject.costPrice.toString() + " " + Config.VALUES.buyCurrency.getValue()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -104,7 +104,7 @@ public class ExecuteAlias {
|
|||||||
if (aliasObject.globalCooldownInt != 0) {
|
if (aliasObject.globalCooldownInt != 0) {
|
||||||
Long duration = System.currentTimeMillis() - aliasObject.globalCooldownInt;
|
Long duration = System.currentTimeMillis() - aliasObject.globalCooldownInt;
|
||||||
if (!(duration > (aliasObject.cooldownGlobal * 1000))) {
|
if (!(duration > (aliasObject.cooldownGlobal * 1000))) {
|
||||||
T2Csend.player(player, Language.cooldownGlobal.value.replace("[cooldown]", String.valueOf(aliasObject.cooldownGlobal - (int) (duration / 1000))));
|
T2C_Send.player(player, Language.VALUES.cooldownGlobal.getValue().toString().replace("[cooldown]", String.valueOf(aliasObject.cooldownGlobal - (int) (duration / 1000))));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -119,7 +119,7 @@ public class ExecuteAlias {
|
|||||||
if (cooldown != null) {
|
if (cooldown != null) {
|
||||||
long duration = System.currentTimeMillis() - cooldown;
|
long duration = System.currentTimeMillis() - cooldown;
|
||||||
if (!(duration > (aliasObject.cooldownPlayer * 1000))) {
|
if (!(duration > (aliasObject.cooldownPlayer * 1000))) {
|
||||||
T2Csend.player(player, Language.cooldownPlayer.value.replace("[cooldown]", String.valueOf(aliasObject.cooldownPlayer - (int) (duration / 1000))));
|
T2C_Send.player(player, Language.VALUES.cooldownPlayer.getValue().toString().replace("[cooldown]", String.valueOf(aliasObject.cooldownPlayer - (int) (duration / 1000))));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -128,12 +128,12 @@ public class ExecuteAlias {
|
|||||||
}
|
}
|
||||||
if (aliasObject.costEnable) {
|
if (aliasObject.costEnable) {
|
||||||
if (!(aliasObject.costAllowBypass && player.hasPermission("t2code.alias.buy." + alias.toLowerCase() + ".bypass") && player.hasPermission("t2c.alias.buy.all.bypass"))) {
|
if (!(aliasObject.costAllowBypass && player.hasPermission("t2code.alias.buy." + alias.toLowerCase() + ".bypass") && player.hasPermission("t2c.alias.buy.all.bypass"))) {
|
||||||
if (!T2Ceco.moneyRemove(prefix, player, aliasObject.costPrice)) {
|
if (!T2C_Eco.moneyRemove(prefix, player, aliasObject.costPrice)) {
|
||||||
T2Csend.player(player, Language.noMoney.value);
|
T2C_Send.player(player, Language.VALUES.noMoney.getValue().toString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((Boolean) Config.VALUES.buyMessage.getValue())
|
if ((Boolean) Config.VALUES.buyMessage.getValue())
|
||||||
T2Csend.player(player, Language.buy.value.replace("[price]", aliasObject.costPrice.toString() + " " + Config.VALUES.buyCurrency.getPath()));
|
T2C_Send.player(player, Language.VALUES.buy.getValue().toString().replace("[price]", aliasObject.costPrice.toString() + " " + Config.VALUES.buyCurrency.getPath()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ public class ExecuteAlias {
|
|||||||
|
|
||||||
protected static void subAliasPlayer(CommandSender sender, SubAliasObject aliasObject, String alias, String[] args) {
|
protected static void subAliasPlayer(CommandSender sender, SubAliasObject aliasObject, String alias, String[] args) {
|
||||||
if (!aliasObject.subAliasEnable) {
|
if (!aliasObject.subAliasEnable) {
|
||||||
T2Csend.sender(sender, Language.aliasDisabled.value);
|
T2C_Send.sender(sender, Language.VALUES.aliasDisabled.getValue().toString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,9 +170,9 @@ public class ExecuteAlias {
|
|||||||
if (!(player.hasPermission(aliasObject.permission.replace("[alias]", alias.toLowerCase())) || player.hasPermission("t2code.alias.admin"))) {
|
if (!(player.hasPermission(aliasObject.permission.replace("[alias]", alias.toLowerCase())) || player.hasPermission("t2code.alias.admin"))) {
|
||||||
String npmsg;
|
String npmsg;
|
||||||
if (aliasObject.permissionMSG == null || aliasObject.permissionMSG.equals("")) {
|
if (aliasObject.permissionMSG == null || aliasObject.permissionMSG.equals("")) {
|
||||||
npmsg = Language.noPermission.value;
|
npmsg = Language.VALUES.noPermission.getValue().toString();
|
||||||
} else npmsg = aliasObject.permissionMSG;
|
} else npmsg = aliasObject.permissionMSG;
|
||||||
T2Csend.player(player, npmsg.replace("[cmd]", "/" + alias.toLowerCase())
|
T2C_Send.player(player, npmsg.replace("[cmd]", "/" + alias.toLowerCase())
|
||||||
.replace("[perm]", aliasObject.permission.replace("[alias]", alias.toLowerCase())).replace("[alias]", alias));
|
.replace("[perm]", aliasObject.permission.replace("[alias]", alias.toLowerCase())).replace("[alias]", alias));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -186,12 +186,12 @@ public class ExecuteAlias {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CHAT:
|
case CHAT:
|
||||||
T2Csend.player(player, Language.confirmChat.value.replace("[price]", aliasObject.costPrice.toString() + " " + Config.VALUES.buyCurrency.getValue()));
|
T2C_Send.player(player, Language.VALUES.confirmChat.getValue().toString().replace("[price]", aliasObject.costPrice.toString() + " " + Config.VALUES.buyCurrency.getValue()));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COMMAND:
|
case COMMAND:
|
||||||
default:
|
default:
|
||||||
T2Csend.player(player, Language.confirmCommand.value.replace("[price]", aliasObject.costPrice.toString() + " " + Config.VALUES.buyCurrency.getValue()));
|
T2C_Send.player(player, Language.VALUES.confirmCommand.getValue().toString().replace("[price]", aliasObject.costPrice.toString() + " " + Config.VALUES.buyCurrency.getValue()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -202,7 +202,7 @@ public class ExecuteAlias {
|
|||||||
} else {
|
} else {
|
||||||
if (aliasObject.consoleEnable) {
|
if (aliasObject.consoleEnable) {
|
||||||
subAliasConsole(aliasObject, alias, sender, args);
|
subAliasConsole(aliasObject, alias, sender, args);
|
||||||
} else T2Csend.sender(sender, Language.onlyForPlayer.value);
|
} else T2C_Send.sender(sender, Language.VALUES.onlyForPlayer.getValue().toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,7 +213,7 @@ public class ExecuteAlias {
|
|||||||
if (aliasObject.globalCooldownInt != 0) {
|
if (aliasObject.globalCooldownInt != 0) {
|
||||||
long duration = System.currentTimeMillis() - aliasObject.globalCooldownInt;
|
long duration = System.currentTimeMillis() - aliasObject.globalCooldownInt;
|
||||||
if (!(duration > (aliasObject.cooldownGlobal * 1000))) {
|
if (!(duration > (aliasObject.cooldownGlobal * 1000))) {
|
||||||
T2Csend.player(player, Language.cooldownGlobal.value.replace("[cooldown]", String.valueOf(aliasObject.cooldownGlobal - (int) (duration / 1000))));
|
T2C_Send.player(player, Language.VALUES.cooldownGlobal.getValue().toString().replace("[cooldown]", String.valueOf(aliasObject.cooldownGlobal - (int) (duration / 1000))));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -227,7 +227,7 @@ public class ExecuteAlias {
|
|||||||
if (cooldown != null) {
|
if (cooldown != null) {
|
||||||
long duration = System.currentTimeMillis() - cooldown;
|
long duration = System.currentTimeMillis() - cooldown;
|
||||||
if (!(duration > (aliasObject.cooldownPlayer * 1000))) {
|
if (!(duration > (aliasObject.cooldownPlayer * 1000))) {
|
||||||
T2Csend.player(player, Language.cooldownPlayer.value.replace("[cooldown]", String.valueOf(aliasObject.cooldownPlayer - (int) (duration / 1000))));
|
T2C_Send.player(player, Language.VALUES.cooldownPlayer.getValue().toString().replace("[cooldown]", String.valueOf(aliasObject.cooldownPlayer - (int) (duration / 1000))));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -238,12 +238,12 @@ public class ExecuteAlias {
|
|||||||
|
|
||||||
if (aliasObject.costEnable) {
|
if (aliasObject.costEnable) {
|
||||||
if (!(aliasObject.costAllowBypass && player.hasPermission("t2c.alias.sub.buy." + alias.toLowerCase() + ".bypass") && player.hasPermission("t2c.alias.sub.buy.all.bypass"))) {
|
if (!(aliasObject.costAllowBypass && player.hasPermission("t2c.alias.sub.buy." + alias.toLowerCase() + ".bypass") && player.hasPermission("t2c.alias.sub.buy.all.bypass"))) {
|
||||||
if (!T2Ceco.moneyRemove(prefix, player, aliasObject.costPrice)) {
|
if (!T2C_Eco.moneyRemove(prefix, player, aliasObject.costPrice)) {
|
||||||
T2Csend.player(player, Language.noMoney.value);
|
T2C_Send.player(player, Language.VALUES.noMoney.getValue().toString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((Boolean) Config.VALUES.buyMessage.getValue())
|
if ((Boolean) Config.VALUES.buyMessage.getValue())
|
||||||
T2Csend.player(player, Language.buy.value.replace("[price]", aliasObject.costPrice.toString() + " " + Config.VALUES.buyCurrency.getValue()));
|
T2C_Send.player(player, Language.VALUES.buy.getValue().toString().replace("[price]", aliasObject.costPrice.toString() + " " + Config.VALUES.buyCurrency.getValue()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (aliasObject.commandEnable) {
|
if (aliasObject.commandEnable) {
|
||||||
@ -258,20 +258,20 @@ public class ExecuteAlias {
|
|||||||
if (alias.consoleCommandEnable) {
|
if (alias.consoleCommandEnable) {
|
||||||
for (String cmd : alias.consoleCommands) {
|
for (String cmd : alias.consoleCommands) {
|
||||||
if (alias.consoleBungeeCommand) {
|
if (alias.consoleBungeeCommand) {
|
||||||
if ((boolean) T2CLibConfig.VALUES.proxy.getValue()) {
|
if ((boolean) T2C_LibConfig.VALUES.proxy.getValue()) {
|
||||||
BCommandSenderReciver.sendToBungee(sender, cmd, true);
|
BCommandSenderReciver.sendToBungee(sender, cmd, true);
|
||||||
} else {
|
} else {
|
||||||
T2Csend.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
T2C_Send.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||||
T2Csend.sender(sender, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
T2C_Send.sender(sender, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
T2Ccmd.console(cmd);
|
T2C_Cmd.console(cmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (alias.consoleMessageEnable) {
|
if (alias.consoleMessageEnable) {
|
||||||
for (String msg : alias.consoleMessages) {
|
for (String msg : alias.consoleMessages) {
|
||||||
T2Csend.console(T2Creplace.replace(prefix, msg));
|
T2C_Send.console(T2C_Replace.replace(prefix, msg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -288,20 +288,20 @@ public class ExecuteAlias {
|
|||||||
for (String cmd : aliasObject.consoleCommands) {
|
for (String cmd : aliasObject.consoleCommands) {
|
||||||
String replace = cmd.replace("[target]", targetSt).replace("[alias]", alias);
|
String replace = cmd.replace("[target]", targetSt).replace("[alias]", alias);
|
||||||
if (aliasObject.consoleBungeeCommand) {
|
if (aliasObject.consoleBungeeCommand) {
|
||||||
if ((boolean) T2CLibConfig.VALUES.proxy.getValue()) {
|
if ((boolean) T2C_LibConfig.VALUES.proxy.getValue()) {
|
||||||
BCommandSenderReciver.sendToBungee(sender, replace, true);
|
BCommandSenderReciver.sendToBungee(sender, replace, true);
|
||||||
} else {
|
} else {
|
||||||
T2Csend.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
T2C_Send.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||||
T2Csend.sender(sender, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
T2C_Send.sender(sender, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
T2Ccmd.console(replace);
|
T2C_Cmd.console(replace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (aliasObject.consoleMessageEnable) {
|
if (aliasObject.consoleMessageEnable) {
|
||||||
for (String msg : aliasObject.consoleMessages) {
|
for (String msg : aliasObject.consoleMessages) {
|
||||||
T2Csend.console(T2Creplace.replace(prefix, msg));
|
T2C_Send.console(T2C_Replace.replace(prefix, msg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -316,17 +316,17 @@ public class ExecuteAlias {
|
|||||||
}
|
}
|
||||||
for (String cmd : aliasObject.adminCommands) {
|
for (String cmd : aliasObject.adminCommands) {
|
||||||
if (aliasObject.adminBungeeCommand) {
|
if (aliasObject.adminBungeeCommand) {
|
||||||
if ((boolean) T2CLibConfig.VALUES.proxy.getValue()) {
|
if ((boolean) T2C_LibConfig.VALUES.proxy.getValue()) {
|
||||||
BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()).replace("%player_name%", player.getName()).replace("[target]", targetSt).replace("[alias]", alias), aliasObject.adminCommandAsConsole);
|
BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()).replace("%player_name%", player.getName()).replace("[target]", targetSt).replace("[alias]", alias), aliasObject.adminCommandAsConsole);
|
||||||
} else {
|
} else {
|
||||||
T2Csend.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
T2C_Send.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||||
T2Csend.player(player, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
T2C_Send.player(player, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (aliasObject.adminCommandAsConsole) {
|
if (aliasObject.adminCommandAsConsole) {
|
||||||
T2Ccmd.console(cmd.replace("[player]", player.getName()).replace("%player_name%", player.getName()).replace("[target]", targetSt).replace("[alias]", alias));
|
T2C_Cmd.console(cmd.replace("[player]", player.getName()).replace("%player_name%", player.getName()).replace("[target]", targetSt).replace("[alias]", alias));
|
||||||
} else {
|
} else {
|
||||||
T2Ccmd.player(player, cmd.replace("[player]", player.getName()).replace("%player_name%", player.getName()).replace("[target]", targetSt).replace("[alias]", alias));
|
T2C_Cmd.player(player, cmd.replace("[player]", player.getName()).replace("%player_name%", player.getName()).replace("[target]", targetSt).replace("[alias]", alias));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -343,17 +343,17 @@ public class ExecuteAlias {
|
|||||||
for (String cmd : aliasObject.adminCommands) {
|
for (String cmd : aliasObject.adminCommands) {
|
||||||
if (aliasObject.adminBungeeCommand) {
|
if (aliasObject.adminBungeeCommand) {
|
||||||
|
|
||||||
if ((boolean) T2CLibConfig.VALUES.proxy.getValue()) {
|
if ((boolean) T2C_LibConfig.VALUES.proxy.getValue()) {
|
||||||
BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()).replace("%player_name%", player.getName()).replace("[target]", targetSt).replace("[alias]", alias), aliasObject.adminCommandAsConsole);
|
BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()).replace("%player_name%", player.getName()).replace("[target]", targetSt).replace("[alias]", alias), aliasObject.adminCommandAsConsole);
|
||||||
} else {
|
} else {
|
||||||
T2Csend.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
T2C_Send.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||||
T2Csend.player(player, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
T2C_Send.player(player, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (aliasObject.adminCommandAsConsole) {
|
if (aliasObject.adminCommandAsConsole) {
|
||||||
T2Ccmd.console(cmd.replace("[player]", player.getName()).replace("%player_name%", player.getName()).replace("[target]", targetSt).replace("[alias]", alias));
|
T2C_Cmd.console(cmd.replace("[player]", player.getName()).replace("%player_name%", player.getName()).replace("[target]", targetSt).replace("[alias]", alias));
|
||||||
} else {
|
} else {
|
||||||
T2Ccmd.player(player, cmd.replace("[player]", player.getName()).replace("%player_name%", player.getName()).replace("[target]", targetSt).replace("[alias]", alias));
|
T2C_Cmd.player(player, cmd.replace("[player]", player.getName()).replace("%player_name%", player.getName()).replace("[target]", targetSt).replace("[alias]", alias));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -369,12 +369,12 @@ public class ExecuteAlias {
|
|||||||
}
|
}
|
||||||
for (String msg : aliasObject.adminMessages) {
|
for (String msg : aliasObject.adminMessages) {
|
||||||
String text;
|
String text;
|
||||||
if (T2CpluginCheck.papi()) {
|
if (T2C_PluginCheck.papi()) {
|
||||||
text = T2Creplace.replace(prefix, player, replacePlayer(msg, player)).replace("[target]", targetSt).replace("[alias]", alias);
|
text = T2C_Replace.replace(prefix, player, replacePlayer(msg, player)).replace("[target]", targetSt).replace("[alias]", alias);
|
||||||
} else {
|
} else {
|
||||||
text = T2Creplace.replace(prefix, replacePlayer(msg, player)).replace("[target]", targetSt).replace("[alias]", alias);
|
text = T2C_Replace.replace(prefix, replacePlayer(msg, player)).replace("[target]", targetSt).replace("[alias]", alias);
|
||||||
}
|
}
|
||||||
T2Csend.player(player, text);
|
T2C_Send.player(player, text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -388,12 +388,12 @@ public class ExecuteAlias {
|
|||||||
}
|
}
|
||||||
for (String msg : subAliasObject.adminMessages) {
|
for (String msg : subAliasObject.adminMessages) {
|
||||||
String text;
|
String text;
|
||||||
if (T2CpluginCheck.papi()) {
|
if (T2C_PluginCheck.papi()) {
|
||||||
text = T2Creplace.replace(prefix, player, replacePlayer(msg, player)).replace("[target]", targetSt).replace("[alias]", alias);
|
text = T2C_Replace.replace(prefix, player, replacePlayer(msg, player)).replace("[target]", targetSt).replace("[alias]", alias);
|
||||||
} else {
|
} else {
|
||||||
text = T2Creplace.replace(prefix, replacePlayer(msg, player)).replace("[target]", targetSt).replace("[alias]", alias);
|
text = T2C_Replace.replace(prefix, replacePlayer(msg, player)).replace("[target]", targetSt).replace("[alias]", alias);
|
||||||
}
|
}
|
||||||
T2Csend.player(player, text);
|
T2C_Send.player(player, text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -408,17 +408,17 @@ public class ExecuteAlias {
|
|||||||
for (String cmd : aliasObject.command) {
|
for (String cmd : aliasObject.command) {
|
||||||
if (aliasObject.bungeeCommand) {
|
if (aliasObject.bungeeCommand) {
|
||||||
|
|
||||||
if ((boolean) T2CLibConfig.VALUES.proxy.getValue()) {
|
if ((boolean) T2C_LibConfig.VALUES.proxy.getValue()) {
|
||||||
BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()).replace("%player_name%", player.getName()).replace("[target]", targetSt).replace("[alias]", alias), aliasObject.commandAsConsole);
|
BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()).replace("%player_name%", player.getName()).replace("[target]", targetSt).replace("[alias]", alias), aliasObject.commandAsConsole);
|
||||||
} else {
|
} else {
|
||||||
T2Csend.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
T2C_Send.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||||
T2Csend.player(player, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
T2C_Send.player(player, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (aliasObject.commandAsConsole) {
|
if (aliasObject.commandAsConsole) {
|
||||||
T2Ccmd.console(cmd.replace("[player]", player.getName()).replace("%player_name%", player.getName()).replace("[target]", targetSt).replace("[alias]", alias));
|
T2C_Cmd.console(cmd.replace("[player]", player.getName()).replace("%player_name%", player.getName()).replace("[target]", targetSt).replace("[alias]", alias));
|
||||||
} else {
|
} else {
|
||||||
T2Ccmd.player(player, cmd.replace("[player]", player.getName()).replace("%player_name%", player.getName()).replace("[target]", targetSt).replace("[alias]", alias));
|
T2C_Cmd.player(player, cmd.replace("[player]", player.getName()).replace("%player_name%", player.getName()).replace("[target]", targetSt).replace("[alias]", alias));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -434,17 +434,17 @@ public class ExecuteAlias {
|
|||||||
}
|
}
|
||||||
for (String cmd : alias.command) {
|
for (String cmd : alias.command) {
|
||||||
if (alias.bungeeCommand) {
|
if (alias.bungeeCommand) {
|
||||||
if ((boolean) T2CLibConfig.VALUES.proxy.getValue()) {
|
if ((boolean) T2C_LibConfig.VALUES.proxy.getValue()) {
|
||||||
BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()).replace("%player_name%", player.getName()).replace("[target]", targetSt), alias.commandAsConsole);
|
BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()).replace("%player_name%", player.getName()).replace("[target]", targetSt), alias.commandAsConsole);
|
||||||
} else {
|
} else {
|
||||||
T2Csend.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
T2C_Send.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||||
T2Csend.player(player, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
T2C_Send.player(player, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (alias.commandAsConsole) {
|
if (alias.commandAsConsole) {
|
||||||
T2Ccmd.console(cmd.replace("[player]", player.getName()).replace("%player_name%", player.getName()).replace("[target]", targetSt));
|
T2C_Cmd.console(cmd.replace("[player]", player.getName()).replace("%player_name%", player.getName()).replace("[target]", targetSt));
|
||||||
} else {
|
} else {
|
||||||
T2Ccmd.player(player, cmd.replace("[player]", player.getName()).replace("%player_name%", player.getName()).replace("[target]", targetSt));
|
T2C_Cmd.player(player, cmd.replace("[player]", player.getName()).replace("%player_name%", player.getName()).replace("[target]", targetSt));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -462,12 +462,12 @@ public class ExecuteAlias {
|
|||||||
|
|
||||||
for (String msg : aliasObject.messages) {
|
for (String msg : aliasObject.messages) {
|
||||||
String text;
|
String text;
|
||||||
if (T2CpluginCheck.papi()) {
|
if (T2C_PluginCheck.papi()) {
|
||||||
text = T2Creplace.replace(prefix, player, replacePlayer(msg, player)).replace("[target]", targetSt).replace("[alias]", alias);
|
text = T2C_Replace.replace(prefix, player, replacePlayer(msg, player)).replace("[target]", targetSt).replace("[alias]", alias);
|
||||||
} else {
|
} else {
|
||||||
text = T2Creplace.replace(prefix, replacePlayer(msg, player)).replace("[target]", targetSt).replace("[alias]", alias);
|
text = T2C_Replace.replace(prefix, replacePlayer(msg, player)).replace("[target]", targetSt).replace("[alias]", alias);
|
||||||
}
|
}
|
||||||
T2Csend.player(player, text);
|
T2C_Send.player(player, text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -481,12 +481,12 @@ public class ExecuteAlias {
|
|||||||
}
|
}
|
||||||
for (String msg : subAliasObject.messages) {
|
for (String msg : subAliasObject.messages) {
|
||||||
String text;
|
String text;
|
||||||
if (T2CpluginCheck.papi()) {
|
if (T2C_PluginCheck.papi()) {
|
||||||
text = T2Creplace.replace(prefix, player, replacePlayer(msg, player)).replace("[target]", targetSt).replace("[alias]", alias);
|
text = T2C_Replace.replace(prefix, player, replacePlayer(msg, player)).replace("[target]", targetSt).replace("[alias]", alias);
|
||||||
} else {
|
} else {
|
||||||
text = T2Creplace.replace(prefix, replacePlayer(msg, player)).replace("[target]", targetSt).replace("[alias]", alias);
|
text = T2C_Replace.replace(prefix, replacePlayer(msg, player)).replace("[target]", targetSt).replace("[alias]", alias);
|
||||||
}
|
}
|
||||||
T2Csend.player(player, text);
|
T2C_Send.player(player, text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,8 +4,8 @@ import net.t2code.alias.Spigot.Main;
|
|||||||
import net.t2code.alias.Spigot.config.config.Language;
|
import net.t2code.alias.Spigot.config.config.Language;
|
||||||
import net.t2code.alias.Spigot.objects.AliasObject;
|
import net.t2code.alias.Spigot.objects.AliasObject;
|
||||||
import net.t2code.alias.Spigot.objects.SubAliasObject;
|
import net.t2code.alias.Spigot.objects.SubAliasObject;
|
||||||
import net.t2code.alias.Util;
|
import net.t2code.alias.util.Util;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -24,11 +24,11 @@ public class RegisterCommands extends Command {
|
|||||||
AliasObject alias = Main.aliasHashMap.get(this.alias);
|
AliasObject alias = Main.aliasHashMap.get(this.alias);
|
||||||
|
|
||||||
if (alias == null) {
|
if (alias == null) {
|
||||||
T2Csend.error(Main.getPlugin(), "The alias " + this.alias + " does not exist.");
|
T2C_Send.error(Main.getInstance(), "The alias " + this.alias + " does not exist.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!alias.aliasEnable) {
|
if (!alias.aliasEnable) {
|
||||||
T2Csend.sender(sender, Language.aliasDisabled.value);
|
T2C_Send.sender(sender, Language.VALUES.aliasDisabled.getValue().toString());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (args.length == 0 || args.length == 1 && args[0].contains("-p:")) {
|
if (args.length == 0 || args.length == 1 && args[0].contains("-p:")) {
|
||||||
@ -37,7 +37,7 @@ public class RegisterCommands extends Command {
|
|||||||
} else {
|
} else {
|
||||||
if (alias.consoleEnable) {
|
if (alias.consoleEnable) {
|
||||||
ExecuteAlias.aliasConsole(alias, sender, prefix);
|
ExecuteAlias.aliasConsole(alias, sender, prefix);
|
||||||
} else T2Csend.sender(sender, Language.onlyForPlayer.value);
|
} else T2C_Send.sender(sender, Language.VALUES.onlyForPlayer.getValue().toString());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!Main.allForSubAliases.contains(this.alias)) {
|
if (!Main.allForSubAliases.contains(this.alias)) {
|
||||||
@ -54,7 +54,7 @@ public class RegisterCommands extends Command {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
T2Csend.sender(sender, Language.noSubCommand.value);
|
T2C_Send.sender(sender, Language.VALUES.noSubCommand.getValue().toString());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package net.t2code.alias.Spigot.cmdManagement;
|
|||||||
|
|
||||||
import net.t2code.alias.Spigot.Main;
|
import net.t2code.alias.Spigot.Main;
|
||||||
import net.t2code.alias.Spigot.objects.SubAliasObject;
|
import net.t2code.alias.Spigot.objects.SubAliasObject;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.commands.T2Ctab;
|
import net.t2code.t2codelib.SPIGOT.api.commands.T2C_Tab;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.server.TabCompleteEvent;
|
import org.bukkit.event.server.TabCompleteEvent;
|
||||||
@ -36,7 +36,7 @@ public class TabEvent implements Listener {
|
|||||||
int arg = aliasObject.subAliasArg;
|
int arg = aliasObject.subAliasArg;
|
||||||
if (args.length - 1 == arg) {
|
if (args.length - 1 == arg) {
|
||||||
for (String command : aliasObject.subAliasList) {
|
for (String command : aliasObject.subAliasList) {
|
||||||
if (T2Ctab.hasPermission(e.getSender(), arg1.get(command)) && T2Ctab.passend(command, args[arg])) {
|
if (T2C_Tab.hasPermission(e.getSender(), arg1.get(command)) && T2C_Tab.passend(command, args[arg])) {
|
||||||
list.add(command);
|
list.add(command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package net.t2code.alias.Spigot.config.alias;
|
package net.t2code.alias.Spigot.config.alias;
|
||||||
|
|
||||||
import net.t2code.alias.Spigot.Main;
|
import net.t2code.alias.Spigot.Main;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -24,13 +24,13 @@ public class AliasConfigConverter {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
T2Csend.error(Main.getPlugin(), "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
T2C_Send.error(Main.getInstance(), "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||||
T2Csend.error(Main.getPlugin(), "");
|
T2C_Send.error(Main.getInstance(), "");
|
||||||
T2Csend.warning(Main.getPlugin(), "The " + config_gui.getName() + " file is converted to the new config format.");
|
T2C_Send.warning(Main.getInstance(), "The " + config_gui.getName() + " file is converted to the new config format.");
|
||||||
T2Csend.warning(Main.getPlugin(), "The alias is no longer the filename, this is now adjustable in the file under 'Alias.AliasList'!");
|
T2C_Send.warning(Main.getInstance(), "The alias is no longer the filename, this is now adjustable in the file under 'Alias.AliasList'!");
|
||||||
T2Csend.warning(Main.getPlugin(), "This allows a function to have multiple alias commands without creating multiple files!");
|
T2C_Send.warning(Main.getInstance(), "This allows a function to have multiple alias commands without creating multiple files!");
|
||||||
T2Csend.error(Main.getPlugin(), "");
|
T2C_Send.error(Main.getInstance(), "");
|
||||||
T2Csend.error(Main.getPlugin(), "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
T2C_Send.error(Main.getInstance(), "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
package net.t2code.alias.Spigot.config.alias;
|
package net.t2code.alias.Spigot.config.alias;
|
||||||
|
|
||||||
import net.t2code.alias.Spigot.Main;
|
import net.t2code.alias.Spigot.Main;
|
||||||
import net.t2code.alias.Util;
|
import net.t2code.alias.util.Util;
|
||||||
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 net.t2code.t2codelib.SPIGOT.api.yaml.T2C_Config;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.api.yaml.T2C_Config;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
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.ArrayList;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
@ -16,56 +16,56 @@ public class CreateExampleAliasConfig {
|
|||||||
|
|
||||||
public static void configCreate() {
|
public static void configCreate() {
|
||||||
long long_ = System.currentTimeMillis();
|
long long_ = System.currentTimeMillis();
|
||||||
T2Csend.console(Util.getPrefix() + " §4Alias/aliasexample.yml are created...");
|
T2C_Send.console(Util.getPrefix() + " §4Alias/aliasexample.yml are created...");
|
||||||
|
|
||||||
File config = new File(Main.getPath(), "Alias/aliasexample.yml");
|
File config = new File(Main.getPath(), "Alias/aliasexample.yml");
|
||||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||||
|
|
||||||
T2Cconfig.set("Alias.Enable", true, yamlConfiguration);
|
T2C_Config.set("Alias.Enable", true, yamlConfiguration);
|
||||||
T2Cconfig.set("Alias.AliasList", Arrays.asList("aliasexample1","t2caliasexample"),yamlConfiguration);
|
T2C_Config.set("Alias.AliasList", Arrays.asList("aliasexample1","t2caliasexample"),yamlConfiguration);
|
||||||
|
|
||||||
T2Cconfig.set("Alias.Permission.Necessary", true, yamlConfiguration);
|
T2C_Config.set("Alias.Permission.Necessary", true, yamlConfiguration);
|
||||||
T2Cconfig.set("Alias.Permission.Permission", "t2c.alias.use.[alias]", yamlConfiguration);
|
T2C_Config.set("Alias.Permission.Permission", "t2c.alias.use.[alias]", yamlConfiguration);
|
||||||
T2Cconfig.set("Alias.Permission.CustomNoPermissionMSG", "", yamlConfiguration);
|
T2C_Config.set("Alias.Permission.CustomNoPermissionMSG", "", yamlConfiguration);
|
||||||
|
|
||||||
T2Cconfig.set("Alias.CooldownInSec.Global", 0, yamlConfiguration);
|
T2C_Config.set("Alias.CooldownInSec.Global", 0, yamlConfiguration);
|
||||||
T2Cconfig.set("Alias.CooldownInSec.Player", 0, yamlConfiguration);
|
T2C_Config.set("Alias.CooldownInSec.Player", 0, yamlConfiguration);
|
||||||
|
|
||||||
T2Cconfig.set("Alias.Cost.Enable", false,yamlConfiguration);
|
T2C_Config.set("Alias.Cost.Enable", false,yamlConfiguration);
|
||||||
T2Cconfig.set("Alias.Cost.Confirm", true,yamlConfiguration);
|
T2C_Config.set("Alias.Cost.Confirm", true,yamlConfiguration);
|
||||||
T2Cconfig.set("Alias.Cost.Price", 0.0,yamlConfiguration);
|
T2C_Config.set("Alias.Cost.Price", 0.0,yamlConfiguration);
|
||||||
T2Cconfig.set("Alias.Cost.AllowByPass", true,yamlConfiguration);
|
T2C_Config.set("Alias.Cost.AllowByPass", true,yamlConfiguration);
|
||||||
|
|
||||||
T2Cconfig.set("Alias.Command.Enable", false, yamlConfiguration);
|
T2C_Config.set("Alias.Command.Enable", false, yamlConfiguration);
|
||||||
T2Cconfig.set("Alias.Command.CommandAsConsole", true, yamlConfiguration);
|
T2C_Config.set("Alias.Command.CommandAsConsole", true, yamlConfiguration);
|
||||||
T2Cconfig.set("Alias.Command.BungeeCommand", false, yamlConfiguration);
|
T2C_Config.set("Alias.Command.BungeeCommand", false, yamlConfiguration);
|
||||||
T2Cconfig.set("Alias.Command.Commands", Arrays.asList(), yamlConfiguration);
|
T2C_Config.set("Alias.Command.Commands", Arrays.asList(), yamlConfiguration);
|
||||||
|
|
||||||
T2Cconfig.set("Alias.Message.Enable", true, yamlConfiguration);
|
T2C_Config.set("Alias.Message.Enable", true, yamlConfiguration);
|
||||||
T2Cconfig.set("Alias.Message.Messages", Arrays.asList("<rainbow>This is a test alias</rainbow>", "<color:#d7ff0f>With this you can use several functions such as <color:#ffd6ad>colored text</color>, <click:suggest_command:'/command'><hover:show_text:'<color:#ff745c>Use Command</color>'>clickable texts</hover></click>, <hover:show_text:'<color:#1f66ff>For example Warps</color>'><click:suggest_command:'/warp home'><color:#365eff>shorten commands of other plugins</color></click></hover> and much more.</color>", "<color:#85a0ff><click:open_url:'http://dc.t2code.net'><hover:show_text:'<color:#0887ff>http://dc.t2code.net</color>'>If you have any questions, please contact our support Discord.</hover></click></color>"), yamlConfiguration);
|
T2C_Config.set("Alias.Message.Messages", Arrays.asList("<rainbow>This is a test alias</rainbow>", "<color:#d7ff0f>With this you can use several functions such as <color:#ffd6ad>colored text</color>, <click:suggest_command:'/command'><hover:show_text:'<color:#ff745c>Use Command</color>'>clickable texts</hover></click>, <hover:show_text:'<color:#1f66ff>For example Warps</color>'><click:suggest_command:'/warp home'><color:#365eff>shorten commands of other plugins</color></click></hover> and much more.</color>", "<color:#85a0ff><click:open_url:'http://dc.t2code.net'><hover:show_text:'<color:#0887ff>http://dc.t2code.net</color>'>If you have any questions, please contact our support Discord.</hover></click></color>"), yamlConfiguration);
|
||||||
|
|
||||||
T2Cconfig.set("Alias.Admin.Enable", false, yamlConfiguration);
|
T2C_Config.set("Alias.Admin.Enable", false, yamlConfiguration);
|
||||||
T2Cconfig.set("Alias.Admin.Permission", "t2c.alias.[alias].admin", yamlConfiguration);
|
T2C_Config.set("Alias.Admin.Permission", "t2c.alias.[alias].admin", yamlConfiguration);
|
||||||
|
|
||||||
T2Cconfig.set("Alias.Admin.Command.Enable", true, yamlConfiguration);
|
T2C_Config.set("Alias.Admin.Command.Enable", true, yamlConfiguration);
|
||||||
T2Cconfig.set("Alias.Admin.Command.CommandAsConsole", true, yamlConfiguration);
|
T2C_Config.set("Alias.Admin.Command.CommandAsConsole", true, yamlConfiguration);
|
||||||
T2Cconfig.set("Alias.Admin.Command.BungeeCommand", false, yamlConfiguration);
|
T2C_Config.set("Alias.Admin.Command.BungeeCommand", false, yamlConfiguration);
|
||||||
T2Cconfig.set("Alias.Admin.Command.Commands", Collections.singletonList("say hi"), yamlConfiguration);
|
T2C_Config.set("Alias.Admin.Command.Commands", Collections.singletonList("say hi"), yamlConfiguration);
|
||||||
|
|
||||||
T2Cconfig.set("Alias.Admin.Message.Enable", false, yamlConfiguration);
|
T2C_Config.set("Alias.Admin.Message.Enable", false, yamlConfiguration);
|
||||||
T2Cconfig.set("Alias.Admin.Message.Messages", Arrays.asList(), yamlConfiguration);
|
T2C_Config.set("Alias.Admin.Message.Messages", Arrays.asList(), yamlConfiguration);
|
||||||
|
|
||||||
T2Cconfig.set("Alias.Console.Enable", false, yamlConfiguration);
|
T2C_Config.set("Alias.Console.Enable", false, yamlConfiguration);
|
||||||
T2Cconfig.set("Alias.Console.Command.Enable", false, yamlConfiguration);
|
T2C_Config.set("Alias.Console.Command.Enable", false, yamlConfiguration);
|
||||||
T2Cconfig.set("Alias.Console.Command.BungeeCommand", false, yamlConfiguration);
|
T2C_Config.set("Alias.Console.Command.BungeeCommand", false, yamlConfiguration);
|
||||||
T2Cconfig.set("Alias.Console.Command.Commands", Arrays.asList(), yamlConfiguration);
|
T2C_Config.set("Alias.Console.Command.Commands", Arrays.asList(), yamlConfiguration);
|
||||||
T2Cconfig.set("Alias.Console.Message.Enable", false, yamlConfiguration);
|
T2C_Config.set("Alias.Console.Message.Enable", false, yamlConfiguration);
|
||||||
T2Cconfig.set("Alias.Console.Message.Messages", Arrays.asList(), yamlConfiguration);
|
T2C_Config.set("Alias.Console.Message.Messages", Arrays.asList(), yamlConfiguration);
|
||||||
try {
|
try {
|
||||||
yamlConfiguration.save(config);
|
yamlConfiguration.save(config);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
T2Csend.console(Util.getPrefix() + " §2Alias/aliasexample.yml were successfully created." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
T2C_Send.console(Util.getPrefix() + " §2Alias/aliasexample.yml were successfully created." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,9 +4,9 @@ import com.google.common.base.Preconditions;
|
|||||||
import net.t2code.alias.Spigot.Main;
|
import net.t2code.alias.Spigot.Main;
|
||||||
import net.t2code.alias.Spigot.system.AliasRegister;
|
import net.t2code.alias.Spigot.system.AliasRegister;
|
||||||
import net.t2code.alias.Spigot.objects.AliasObject;
|
import net.t2code.alias.Spigot.objects.AliasObject;
|
||||||
import net.t2code.alias.Util;
|
import net.t2code.alias.util.Util;
|
||||||
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.configuration.InvalidConfigurationException;
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
@ -118,10 +118,10 @@ public class SelectAlias {
|
|||||||
for (String al : aliasList) {
|
for (String al : aliasList) {
|
||||||
Main.aliasHashMap.put(al, alias);
|
Main.aliasHashMap.put(al, alias);
|
||||||
}
|
}
|
||||||
T2Csend.console(Prefix + " §aAlias file §e" + config_gui.getName() + " §awas loaded");
|
T2C_Send.console(Prefix + " §aAlias file §e" + config_gui.getName() + " §awas loaded");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
T2Ctemplate.onLoadSeparateStroke(Util.getPrefix());
|
T2C_Template.onLoadSeparateStroke(Util.getPrefix());
|
||||||
new AliasRegister(main);
|
new AliasRegister(main);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,93 @@
|
|||||||
|
// This class was created by JaTiTV.
|
||||||
|
|
||||||
|
package net.t2code.alias.Spigot.config.alias.newConfig;
|
||||||
|
|
||||||
|
import net.t2code.alias.Spigot.Main;
|
||||||
|
import net.t2code.alias.util.Util;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.api.yaml.T2C_ConfigWriter;
|
||||||
|
import net.t2code.t2codelib.util.T2C_ConfigItem;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
public class AliasConverter {
|
||||||
|
private static YamlConfiguration yamlConfiguration;
|
||||||
|
|
||||||
|
public static void convert() {
|
||||||
|
File configDeclaration = new File(Main.getPath() + "X_configDeclaration_X.yml");
|
||||||
|
if (configDeclaration.exists()) configDeclaration.delete();
|
||||||
|
File aliasDeclaration = new File(Main.getPath() + "/Alias/X_aliasDeclaration_X.yml");
|
||||||
|
if (aliasDeclaration.exists()) aliasDeclaration.delete();
|
||||||
|
File subaliasDeclaration = new File(Main.getPath() + "/SubAlias/X_subAliasDeclaration_X.yml");
|
||||||
|
if (subaliasDeclaration.exists()) subaliasDeclaration.delete();
|
||||||
|
|
||||||
|
convertAlias();
|
||||||
|
convertSubAlias();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void convertAlias() {
|
||||||
|
File f = new File(Main.getPath() + "/Alias/");
|
||||||
|
if (!f.exists()) return;
|
||||||
|
|
||||||
|
File[] fileArray = f.listFiles();
|
||||||
|
assert fileArray != null;
|
||||||
|
for (File file : fileArray) {
|
||||||
|
String sub = file.getName().substring(file.getName().length() - 4);
|
||||||
|
if (sub.equals(".yml")) {
|
||||||
|
|
||||||
|
yamlConfiguration = YamlConfiguration.loadConfiguration(file);
|
||||||
|
|
||||||
|
setConfig("Alias.Enable", AliasFile.VALUES.aliasEnable);
|
||||||
|
setConfig("Alias.AliasList", AliasFile.VALUES.aliasList);
|
||||||
|
setConfig("Alias.Permission.Necessary", AliasFile.VALUES.permNecessary);
|
||||||
|
setConfig("Alias.Permission.Permission", AliasFile.VALUES.permission);
|
||||||
|
setConfig("Alias.Permission.CustomNoPermissionMSG", AliasFile.VALUES.permissionMSG);
|
||||||
|
setConfig("Alias.CooldownInSec.Global", AliasFile.VALUES.cooldownGlobal);
|
||||||
|
setConfig("Alias.CooldownInSec.Player", AliasFile.VALUES.cooldownPlayer);
|
||||||
|
setConfig("Alias.Cost.Enable", AliasFile.VALUES.costEnable);
|
||||||
|
setConfig("Alias.Cost.Confirm", AliasFile.VALUES.costConfirm);
|
||||||
|
setConfig("Alias.Cost.Price", AliasFile.VALUES.costPrice);
|
||||||
|
setConfig("Alias.Cost.AllowByPass", AliasFile.VALUES.costAllowBypass);
|
||||||
|
setConfig("Alias.Command.Enable", AliasFile.VALUES.commandEnable);
|
||||||
|
setConfig("Alias.Command.CommandAsConsole", AliasFile.VALUES.commandAsConsole);
|
||||||
|
setConfig("Alias.Command.BungeeCommand", AliasFile.VALUES.bungeeCommand);
|
||||||
|
setConfig("Alias.Command.Commands", AliasFile.VALUES.command);
|
||||||
|
setConfig("Alias.Message.Enable", AliasFile.VALUES.messageEnable);
|
||||||
|
setConfig("Alias.Message.Messages", AliasFile.VALUES.messages);
|
||||||
|
setConfig("Alias.Admin.Enable", AliasFile.VALUES.adminEnable);
|
||||||
|
setConfig("Alias.Admin.Permission", AliasFile.VALUES.adminPermission);
|
||||||
|
setConfig("Alias.Admin.Command.Enable", AliasFile.VALUES.adminCommandEnable);
|
||||||
|
setConfig("Alias.Admin.Command.CommandAsConsole", AliasFile.VALUES.adminCommandAsConsole);
|
||||||
|
setConfig("Alias.Admin.Command.BungeeCommand", AliasFile.VALUES.adminBungeeCommand);
|
||||||
|
setConfig("Alias.Admin.Command.Commands", AliasFile.VALUES.adminCommands);
|
||||||
|
setConfig("Alias.Admin.Message.Enable", AliasFile.VALUES.adminMessageEnable);
|
||||||
|
setConfig("Alias.Admin.Message.Messages", AliasFile.VALUES.adminMessages);
|
||||||
|
setConfig("Alias.Console.Enable", AliasFile.VALUES.consoleEnable);
|
||||||
|
setConfig("Alias.Console.Command.Enable", AliasFile.VALUES.consoleCommandEnable);
|
||||||
|
setConfig("Alias.Console.Command.BungeeCommand", AliasFile.VALUES.consoleBungeeCommand);
|
||||||
|
setConfig("Alias.Console.Command.Commands", AliasFile.VALUES.consoleCommands);
|
||||||
|
setConfig("Alias.Console.Message.Enable", AliasFile.VALUES.consoleMessageEnable);
|
||||||
|
setConfig("Alias.Console.Message.Messages", AliasFile.VALUES.consoleMessages);
|
||||||
|
|
||||||
|
T2C_ConfigWriter.createConfig(Util.getPrefix(), new File(Main.getPath(), "alias/" + file.getName()), AliasFile.VALUES.values(), false, Util.getConfigLogo());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (f.renameTo(new File(Main.getPath() + "/OldConfig/Alias/"))) {
|
||||||
|
T2C_Send.sendStartTextCenter(Util.getPrefix(), "§4Die Alias Dateien im Ordner plugins/T2C-Alias/Alias", false);
|
||||||
|
T2C_Send.sendStartTextCenter(Util.getPrefix(), "§4wurden in den neuen Ordner plugins/T2C-Alias/alias konvertiert!", false);
|
||||||
|
T2C_Send.sendStartTextCenter(Util.getPrefix(), "§4Die alten dateien wurden in plugins/T2C-Alias/OldConfig/Alias verschoben.", false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void convertSubAlias() {
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void setConfig(String path, T2C_ConfigItem item) {
|
||||||
|
if (yamlConfiguration.contains(path)) {
|
||||||
|
item.setValue(yamlConfiguration.get(path));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,325 @@
|
|||||||
|
// This class was created by JaTiTV.
|
||||||
|
|
||||||
|
package net.t2code.alias.Spigot.config.alias.newConfig;
|
||||||
|
|
||||||
|
import net.t2code.alias.Spigot.Main;
|
||||||
|
import net.t2code.alias.Spigot.config.config.Config;
|
||||||
|
import net.t2code.alias.Spigot.config.config.Language;
|
||||||
|
import net.t2code.alias.Spigot.objects.AliasObject;
|
||||||
|
import net.t2code.alias.Spigot.system.AliasRegister;
|
||||||
|
import net.t2code.alias.util.Util;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.api.yaml.T2C_ConfigWriter;
|
||||||
|
import net.t2code.t2codelib.util.T2C_ConfigItem;
|
||||||
|
import net.t2code.t2codelib.util.T2C_LanguageEnum;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class AliasFile {
|
||||||
|
|
||||||
|
public enum VALUES implements T2C_ConfigItem {
|
||||||
|
aliasEnable("alias.enable", true, true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of("Here you can disable the alias."));
|
||||||
|
}}),
|
||||||
|
aliasList("alias.aliasList", List.of("aliasexample1", "t2caliasexample"), true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of("Specify here what the Alias commands should be for this function."));
|
||||||
|
}}),
|
||||||
|
|
||||||
|
permNecessary("alias.permission.necessary", true, true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of("Here you can say if a permission is needed to use the alias."));
|
||||||
|
}}),
|
||||||
|
permission("alias.permission.permission", "t2c.alias.use.[alias]", true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of("Here you can set the permission for the alias.", "The placeholder <alias> is the alias name.", "If you have set multiple alias referrers in the list 'Alias.AliasList' you have a permission for each alias."));
|
||||||
|
}}),
|
||||||
|
permissionMSG("alias.permission.customNoPermissionMSG", "", true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of("Here you can set a custom No Permission message for this alias. If you want to use the default message, just leave this blank."));
|
||||||
|
}}),
|
||||||
|
|
||||||
|
cooldownGlobal("alias.cooldownInSec.global", 0, true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of("Here you can set a global cooldown for this alias.", "The value corresponds to the seconds.", "At 0, the cooldown is deactivated.", "The placeholder [alias] is the alias name.", "Bypass permission: t2c.alias.cooldown.global.[alias].bypass", "(The global cooldown is above the player cooldown)."));
|
||||||
|
}}),
|
||||||
|
cooldownPlayer("alias.cooldownInSec.player", 0, true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of("Here you can set a player-specific cooldown for this alias.","The value corresponds to the seconds.","At 0, the cooldown is deactivated.","The placeholder [alias] is the alias name.","Bypass permission: t2c.alias.cooldown.player.[alias].bypass"));
|
||||||
|
}}),
|
||||||
|
|
||||||
|
costEnable("alias.cost.enable", false, true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of("Here you can say if you have to pay for the alias."));
|
||||||
|
}}),
|
||||||
|
costConfirm("alias.cost.confirm", true, true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of("Here you can set if you have to confirm if you want to pay before executing the command","In the config.yml you can set under 'buy.confirm.use' if a command, a chatListener or a GUI should be used to confirm the command."));
|
||||||
|
}}),
|
||||||
|
costPrice("alias.cost.price", 0.0, true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of("Here you set the price."));
|
||||||
|
}}),
|
||||||
|
costAllowBypass("alias.Cost.allowByPass", true, true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of("Here you define if the bypass is activated or if you have to pay despite the bypass (t2c.alias.buy.[alias].bypass)."));
|
||||||
|
}}),
|
||||||
|
|
||||||
|
commandEnable("alias.command.enable", false, true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of("Here you can tell the alias to execute one or more commands"));
|
||||||
|
}}),
|
||||||
|
commandAsConsole("alias.command.commandAsConsole", true, true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of("Here you can specify whether the command should be executed from the console of the server"));
|
||||||
|
}}),
|
||||||
|
bungeeCommand("alias.command.proxyCommand", false, true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of("Here you can define if the command should be executed on the proxy.","For this function to work, the T2CodeLib must be present on your proxy and the API for T2C-OPSecurity must be activated in its config!","(If it is to be executed from the proxy console, the CommandAsConsole option must also be enabled)."));
|
||||||
|
}}),
|
||||||
|
command("alias.command.commands", List.of(), true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of("Here you can specify one or more commands to be executed.","Placeholder: [player] = The player who executes the alias"));
|
||||||
|
}}),
|
||||||
|
|
||||||
|
messageEnable("alias.message.enable", true, true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of("Here you can specify whether the player should receive a message."));
|
||||||
|
}}),
|
||||||
|
|
||||||
|
messages("alias.message.messages", Arrays.asList("<rainbow>This is a test alias</rainbow>", "<color:#d7ff0f>With this you can use several functions such as <color:#ffd6ad>colored text</color>, <click:suggest_command:'/command'><hover:show_text:'<color:#ff745c>Use Command</color>'>clickable texts</hover></click>, <hover:show_text:'<color:#1f66ff>For example Warps</color>'><click:suggest_command:'/warp home'><color:#365eff>shorten commands of other plugins</color></click></hover> and much more.</color>", "<color:#85a0ff><click:open_url:'http://dc.t2code.net'><hover:show_text:'<color:#0887ff>http://dc.t2code.net</color>'>If you have any questions, please contact our support Discord.</hover></click></color>"), true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of(""));
|
||||||
|
}}),
|
||||||
|
|
||||||
|
adminEnable("alias.admin.enable", false, true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of(""));
|
||||||
|
}}),
|
||||||
|
|
||||||
|
adminPermission("alias.admin.permission", "t2c.alias.[alias].admin", true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of(""));
|
||||||
|
}}),
|
||||||
|
|
||||||
|
adminCommandEnable("alias.admin.command.enable", true, true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of(""));
|
||||||
|
}}),
|
||||||
|
|
||||||
|
adminCommandAsConsole("alias.admin.command.commandAsConsole", true, true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of(""));
|
||||||
|
}}),
|
||||||
|
|
||||||
|
adminBungeeCommand("alias.admin.command.proxyCommand", false, true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of(""));
|
||||||
|
}}),
|
||||||
|
|
||||||
|
adminCommands("alias.admin.command.commands", Collections.singletonList("say hi"), true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of(""));
|
||||||
|
}}),
|
||||||
|
|
||||||
|
adminMessageEnable("alias.admin.message.enable", false, true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of(""));
|
||||||
|
}}),
|
||||||
|
|
||||||
|
adminMessages("alias.admin.message.messages", List.of(), true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of(""));
|
||||||
|
}}),
|
||||||
|
|
||||||
|
consoleEnable("alias.console.enable", false, true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of(""));
|
||||||
|
}}),
|
||||||
|
|
||||||
|
consoleCommandEnable("alias.console.command.enable", false, true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of(""));
|
||||||
|
}}),
|
||||||
|
|
||||||
|
consoleBungeeCommand("alias.console.command.proxyCommand", false, true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of(""));
|
||||||
|
}}),
|
||||||
|
|
||||||
|
consoleCommands("alias.console.command.commands", List.of(), true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of(""));
|
||||||
|
}}),
|
||||||
|
|
||||||
|
consoleMessageEnable("alias.console.message.enable", false, true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of(""));
|
||||||
|
}}),
|
||||||
|
|
||||||
|
consoleMessages("alias.console.message.messages", List.of(), true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of(""));
|
||||||
|
}}),
|
||||||
|
;
|
||||||
|
|
||||||
|
private final String path;
|
||||||
|
private Object value;
|
||||||
|
private final boolean forceSet;
|
||||||
|
private final HashMap<T2C_LanguageEnum, List<String>> comments;
|
||||||
|
|
||||||
|
VALUES(String path, Object value, boolean forceSet, HashMap<T2C_LanguageEnum, List<String>> comments) {
|
||||||
|
this.path = path;
|
||||||
|
this.value = value;
|
||||||
|
this.forceSet = forceSet;
|
||||||
|
this.comments = comments;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPath() {
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean getForceSet() {
|
||||||
|
return forceSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HashMap<T2C_LanguageEnum, List<String>> getComments() {
|
||||||
|
return comments;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getLanguagePath() {
|
||||||
|
return Config.VALUES.language.getPath();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setValue(Object newValue) {
|
||||||
|
value = newValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void set(boolean isReload) {
|
||||||
|
T2C_ConfigWriter.createConfig(Util.getPrefix(), new File(Main.getPath(), "alias/aliasexample.yml"), VALUES.values(), isReload, Util.getConfigLogo());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void select(boolean isReload) {
|
||||||
|
AliasConverter.convert();
|
||||||
|
File f = new File(Main.getPath() + "/alias/");
|
||||||
|
File[] fileArray = f.listFiles();
|
||||||
|
assert fileArray != null;
|
||||||
|
for (File config_gui : fileArray) {
|
||||||
|
String sub = config_gui.getName().substring(config_gui.getName().length() - 4);
|
||||||
|
if (sub.equals(".yml")) {
|
||||||
|
T2C_ConfigWriter.createConfig(Util.getPrefix(), new File(Main.getPath(), "alias/" + config_gui.getName()), VALUES.values(), isReload, Util.getConfigLogo());
|
||||||
|
for (String s : (List<String>) VALUES.aliasList.value) {
|
||||||
|
if (s != null) {
|
||||||
|
Main.allAliases.add(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AliasObject alias = new AliasObject(
|
||||||
|
(boolean) VALUES.aliasEnable.value,
|
||||||
|
(List<String>) VALUES.aliasList.value,
|
||||||
|
(boolean) VALUES.permNecessary.value,
|
||||||
|
(String) VALUES.permission.value,
|
||||||
|
(String) VALUES.permissionMSG.value,
|
||||||
|
(int) VALUES.cooldownGlobal.value,
|
||||||
|
(int) VALUES.cooldownPlayer.value,
|
||||||
|
(boolean) VALUES.costEnable.value,
|
||||||
|
(boolean) VALUES.costConfirm.value,
|
||||||
|
(double) VALUES.costPrice.value,
|
||||||
|
(boolean) VALUES.costAllowBypass.value,
|
||||||
|
(boolean) VALUES.commandEnable.value,
|
||||||
|
(boolean) VALUES.commandAsConsole.value,
|
||||||
|
(boolean) VALUES.bungeeCommand.value,
|
||||||
|
(List<String>) VALUES.command.value,
|
||||||
|
(boolean) VALUES.messageEnable.value,
|
||||||
|
(List<String>) VALUES.messages.value,
|
||||||
|
(boolean) VALUES.adminEnable.value,
|
||||||
|
(String) VALUES.adminPermission.value,
|
||||||
|
(boolean) VALUES.adminCommandEnable.value,
|
||||||
|
(boolean) VALUES.adminCommandAsConsole.value,
|
||||||
|
(boolean) VALUES.adminBungeeCommand.value,
|
||||||
|
(List<String>) VALUES.adminCommands.value,
|
||||||
|
(boolean) VALUES.adminMessageEnable.value,
|
||||||
|
(List<String>) VALUES.adminMessages.value,
|
||||||
|
(boolean) VALUES.consoleEnable.value,
|
||||||
|
(boolean) VALUES.consoleCommandEnable.value,
|
||||||
|
(boolean) VALUES.consoleBungeeCommand.value,
|
||||||
|
(List<String>) VALUES.consoleCommands.value,
|
||||||
|
(boolean) VALUES.consoleMessageEnable.value,
|
||||||
|
(List<String>) VALUES.consoleMessages.value);
|
||||||
|
for (String al : (List<String>) VALUES.aliasList.value) {
|
||||||
|
Main.aliasHashMap.put(al, alias);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
new AliasRegister(Main.getInstance());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -2,47 +2,109 @@ package net.t2code.alias.Spigot.config.config;
|
|||||||
|
|
||||||
import net.t2code.alias.Spigot.Main;
|
import net.t2code.alias.Spigot.Main;
|
||||||
import net.t2code.alias.Spigot.enums.Confirm;
|
import net.t2code.alias.Spigot.enums.Confirm;
|
||||||
import net.t2code.alias.Util;
|
import net.t2code.alias.util.Util;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;
|
import net.t2code.t2codelib.SPIGOT.api.items.T2C_ItemVersion;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
import net.t2code.t2codelib.SPIGOT.api.yaml.T2C_ConfigWriter;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.yaml.T2CconfigWriter;
|
import net.t2code.t2codelib.util.T2C_ConfigItem;
|
||||||
|
import net.t2code.t2codelib.util.T2C_LanguageEnum;
|
||||||
|
|
||||||
import net.t2code.t2codelib.T2CconfigItem;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.HashMap;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class Config {
|
public class Config {
|
||||||
|
|
||||||
public enum VALUES implements T2CconfigItem{
|
public enum VALUES implements T2C_ConfigItem {
|
||||||
language("plugin.language", "english", true,"In this option you can set the language of the plugin."),
|
language("plugin.language", "english", true,
|
||||||
updateCheckOnJoin("plugin.updateCheck.onJoin", true,true,"In this option you can set if players with the permission 't2c.alias.updatemsg' will get an update message on join when an update for the plugin is available."),
|
new HashMap<>() {{
|
||||||
updateCheckSeePreReleaseUpdates("plugin.updateCheck.seePreReleaseUpdates", true,true,"In this option you can set whether you want to receive and display beta and snapshot versions in the update check."),
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
updateCheckTimeInterval("plugin.updateCheck.timeInterval", 60,true,"In this option you can set the time interval in minutes in which updates should be checked."),
|
put(T2C_LanguageEnum.english, List.of("In this option you can set the language of the plugin."));
|
||||||
|
}}),
|
||||||
|
|
||||||
buyMessage("buy.message", true,true,"With this option you can set whether a confirmation should be sent after the payment for an alias for which you have to pay."),
|
updateCheckOnJoin("plugin.updateCheck.onJoin", true, true,
|
||||||
buyCurrency("buy.currency", "$",true,"With this option you set the currency."),
|
new HashMap<>() {{
|
||||||
buyConfirmDefault("buy.confirm.use", Confirm.COMMAND,true,"Here you can choose which confirmation method you want to use. (COMMAND, CHAT, GUI)"),
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
buyConfirmGuiFillItemDesc("buy.confirm.gui.fillItem", null,true," ","!! You can change the GUI name and the button texts in the language file !!"," "),
|
put(T2C_LanguageEnum.english, List.of("In this option you can set if players with the permission 't2c.alias.updatemsg' will get an update message on join when an update for the plugin is available."));
|
||||||
buyConfirmGuiFillItemEnabled("buy.confirm.gui.fillItem.enabled", true,true,"Here you can set if a fillitem should be used in the Confirm GUI."),
|
}}),
|
||||||
buyConfirmGuiFillItem("buy.confirm.gui.fillItem.material", T2CitemVersion.getBlackStainedGlassPane().getType().toString(),true,"Here you can set which fillitem should be used in the Confirm GUI."),
|
|
||||||
buyConfirmGuiConfirm("buy.confirm.gui.confirm.material", T2CitemVersion.getGreenWool().getType().toString(),true,"Here you can set the material for the confirmation button."),
|
updateCheckSeePreReleaseUpdates("plugin.updateCheck.seePreReleaseUpdates", true, true,
|
||||||
buyConfirmGuiCancel("buy.confirm.gui.cancel.material", T2CitemVersion.getRedWool().getType().toString(),true,"Here you can set the material for the cancel button."),
|
new HashMap<>() {{
|
||||||
subAliasTab("subAlias.tabComplete", true,true,"Here you can set if subcommands should be displayed as tabComplete."),
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of("In this option you can set whether you want to receive and display beta and snapshot versions in the update check."));
|
||||||
|
}}),
|
||||||
|
|
||||||
|
updateCheckTimeInterval("plugin.updateCheck.timeInterval", 60, true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of("In this option you can set the time interval in minutes in which updates should be checked."));
|
||||||
|
}}),
|
||||||
|
|
||||||
|
buyMessage("buy.message", true, true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of("With this option you can set whether a confirmation should be sent after the payment for an alias for which you have to pay."));
|
||||||
|
}}),
|
||||||
|
|
||||||
|
buyCurrency("buy.currency", "$", true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of("With this option you set the currency."));
|
||||||
|
}}),
|
||||||
|
|
||||||
|
buyConfirmDefault("buy.confirm.use", Confirm.COMMAND, true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of("Here you can choose which confirmation method you want to use. (COMMAND, CHAT, GUI)"));
|
||||||
|
}}),
|
||||||
|
|
||||||
|
buyConfirmGuiFillItemDesc("buy.confirm.gui.fillItem", null, true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of(" ", "!! You can change the GUI name and the button texts in the language file !!", " "));
|
||||||
|
}}),
|
||||||
|
|
||||||
|
buyConfirmGuiFillItemEnabled("buy.confirm.gui.fillItem.enabled", true, true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of("Here you can set if a fillitem should be used in the Confirm GUI."));
|
||||||
|
}}),
|
||||||
|
|
||||||
|
buyConfirmGuiFillItem("buy.confirm.gui.fillItem.material", T2C_ItemVersion.getBlackStainedGlassPane().getType().toString(), true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of("Here you can set which fillitem should be used in the Confirm GUI."));
|
||||||
|
}}),
|
||||||
|
|
||||||
|
buyConfirmGuiConfirm("buy.confirm.gui.confirm.material", T2C_ItemVersion.getGreenWool().getType().toString(), true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of("Here you can set the material for the confirmation button."));
|
||||||
|
}}),
|
||||||
|
|
||||||
|
buyConfirmGuiCancel("buy.confirm.gui.cancel.material", T2C_ItemVersion.getRedWool().getType().toString(), true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of("Here you can set the material for the cancel button."));
|
||||||
|
}}),
|
||||||
|
|
||||||
|
subAliasTab("subAlias.tabComplete", true, true,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of("Here you can set if subcommands should be displayed as tabComplete."));
|
||||||
|
}}),
|
||||||
;
|
;
|
||||||
|
|
||||||
private final String path;
|
private final String path;
|
||||||
private Object value;
|
private Object value;
|
||||||
private final boolean forceSet;
|
private final boolean forceSet;
|
||||||
private final List<String> comments;
|
private final HashMap<T2C_LanguageEnum, List<String>> comments;
|
||||||
|
|
||||||
VALUES(String path, Object value,boolean forceSet, String... comments) {
|
VALUES(String path, Object value, boolean forceSet, HashMap<T2C_LanguageEnum, List<String>> comments) {
|
||||||
this.path = path;
|
this.path = path;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
this.forceSet=forceSet;
|
this.forceSet = forceSet;
|
||||||
this.comments = new ArrayList<>(Arrays.asList(comments));
|
this.comments = comments;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -61,22 +123,23 @@ public class Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getComments() {
|
public HashMap<T2C_LanguageEnum, List<String>> getComments() {
|
||||||
return comments;
|
return comments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getLanguagePath() {
|
||||||
|
return language.path;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setValue(Object newValue) {
|
public void setValue(Object newValue) {
|
||||||
value = newValue;
|
value = newValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void set() {
|
public static void set(boolean isReload) {
|
||||||
long long_ = System.currentTimeMillis();
|
T2C_ConfigWriter.createConfig(Util.getPrefix(),new File(Main.getPath(), "config.yml"), VALUES.values(),isReload, Util.getConfigLogo());
|
||||||
T2CconfigWriter.createConfig(new File(Main.getPath(), "config.yml"), VALUES.values(), Util.getConfigLogo());
|
|
||||||
|
|
||||||
|
|
||||||
T2Csend.console(Util.getPrefix() + " §2The config.yml was loaded successfully §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,90 +0,0 @@
|
|||||||
package net.t2code.alias.Spigot.config.config;
|
|
||||||
|
|
||||||
import net.t2code.alias.Spigot.Main;
|
|
||||||
import net.t2code.alias.Util;
|
|
||||||
import net.t2code.t2codelib.SPIGOT.api.debug.T2Cdebug;
|
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class FileSelect {
|
|
||||||
|
|
||||||
private static ArrayList<String> defaultLanguages = new ArrayList<>(Arrays.asList("german", "english"));
|
|
||||||
|
|
||||||
public static void language() {
|
|
||||||
long long_ = System.currentTimeMillis();
|
|
||||||
for (String language : defaultLanguages) {
|
|
||||||
File config = new File(Main.getPath(), "languages/" + language + ".yml");
|
|
||||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
|
||||||
for (Language value : Language.values()) {
|
|
||||||
if (!yamlConfiguration.contains(value.path)) {
|
|
||||||
switch (value.configParam) {
|
|
||||||
case STRING:
|
|
||||||
switch (language) {
|
|
||||||
case "german":
|
|
||||||
yamlConfiguration.set(value.path, value.german);
|
|
||||||
break;
|
|
||||||
case "english":
|
|
||||||
yamlConfiguration.set(value.path, value.english);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case LIST:
|
|
||||||
switch (language) {
|
|
||||||
case "german":
|
|
||||||
yamlConfiguration.set(value.path, value.germanList);
|
|
||||||
break;
|
|
||||||
case "english":
|
|
||||||
yamlConfiguration.set(value.path, value.englishList);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
T2Cdebug.debug(Main.getPlugin(), "save: " + language);
|
|
||||||
try {
|
|
||||||
yamlConfiguration.save(config);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String selectMSG;
|
|
||||||
File config = new File(Main.getPath(), "languages/" + Config.VALUES.language.getValue() + ".yml");
|
|
||||||
T2Cdebug.debug(Main.getPlugin(), config.getAbsolutePath());
|
|
||||||
if (!config.isFile()) {
|
|
||||||
T2Csend.console(Util.getPrefix());
|
|
||||||
T2Csend.console(Util.getPrefix() + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
|
||||||
T2Csend.console(Util.getPrefix() + " §4The selected §c" + Config.VALUES.language.getPath() + " §4language file was not found.");
|
|
||||||
T2Csend.console(Util.getPrefix() + " §6The default language §eEnglish §6is used!");
|
|
||||||
T2Csend.console(Util.getPrefix() + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
|
||||||
T2Csend.console(Util.getPrefix());
|
|
||||||
config = new File(Main.getPath(), "languages/" + "english.yml");
|
|
||||||
selectMSG = "english";
|
|
||||||
} else selectMSG = (String) Config.VALUES.language.getValue();
|
|
||||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
|
||||||
for (Language value : Language.values()) {
|
|
||||||
switch (value.configParam) {
|
|
||||||
case STRING:
|
|
||||||
T2Cdebug.debug(Main.getPlugin(), "Select: File: " + config.getName() + " Path: " + value.path);
|
|
||||||
value.value = T2Creplace.replace(Util.getPrefix(), yamlConfiguration.getString(value.path));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case LIST:
|
|
||||||
T2Cdebug.debug(Main.getPlugin(), "Select: File: " + config.getName() + " Path: " + value.path);
|
|
||||||
value.valueList = T2Creplace.replace(Util.getPrefix(), (List<String>) yamlConfiguration.getList(value.path));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
T2Csend.console(Util.getPrefix() + " §2Language successfully selected to: §6" + selectMSG + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,76 +1,247 @@
|
|||||||
package net.t2code.alias.Spigot.config.config;
|
package net.t2code.alias.Spigot.config.config;
|
||||||
|
|
||||||
|
import net.t2code.alias.Spigot.Main;
|
||||||
import net.t2code.alias.Spigot.enums.ConfigParam;
|
import net.t2code.alias.Spigot.enums.ConfigParam;
|
||||||
|
import net.t2code.alias.util.Util;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.api.yaml.T2C_LanguageWriter;
|
||||||
|
import net.t2code.t2codelib.util.T2C_ConfigItemLanguages;
|
||||||
|
import net.t2code.t2codelib.util.T2C_LanguageEnum;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public enum Language {
|
public class Language {
|
||||||
|
|
||||||
onlyForPlayer("plugin.onlyForPlayer", null, "[prefix] <red>Dieser Command ist nur f[ue]r Spieler!</red>",
|
public enum VALUES implements T2C_ConfigItemLanguages {
|
||||||
"[prefix] <red>This command is for players only!</red>", ConfigParam.STRING),
|
|
||||||
|
|
||||||
aliasDisabled("plugin.aliasDisabled", null, "Unknown command. Type ''/help'' for help.",
|
|
||||||
"Unknown command. Type ''/help'' for help.", ConfigParam.STRING),
|
|
||||||
|
|
||||||
reloadStart("plugin.reload.start", null, "[prefix] <gold>Plugin wird neu geladen...</gold>",
|
|
||||||
"[prefix] <gold>Plugin is reloaded...</gold>", ConfigParam.STRING),
|
|
||||||
|
|
||||||
reloadEnd("plugin.reload.end", null, "[prefix] <dark_green>Plugin wurde erfolgreich neu geladen.</dark_green>",
|
|
||||||
"[prefix] <dark_green>Plugin was successfully reloaded.</dark_green>", ConfigParam.STRING),
|
|
||||||
|
|
||||||
noPermission("plugin.noPermissionForCommand", null, "[prefix] <red>F[ue]r <aqua>[cmd]</aqua> fehlt dir die Permission <gold>[perm]</gold>!</red>",
|
|
||||||
"[prefix] <red>For <aqua>[cmd]</aqua> you lack the permission <gold>[perm]</gold>!</red>", ConfigParam.STRING),
|
|
||||||
|
|
||||||
noSubCommand("plugin.noSubCommand", null, "[prefix] <red>Diesen Befehl gibt es nicht!</red>",
|
|
||||||
"[prefix] <red>This command does not exist!</red>", ConfigParam.STRING),
|
|
||||||
buy("cost.buy", null, "[prefix] <dark_green>Du hast f[ue]r diesen Command <gold>[price]</gold> bezahlt.</dark_green>",
|
|
||||||
"[prefix] <dark_green>You have paid <gold>[price]</gold> for this command.</dark_green>", ConfigParam.STRING),
|
|
||||||
noMoney("cost.noMoney", null, "[prefix] <red>Du hast nicht gen[ue]gend Geld für diesen Command!</red>", "[prefix] <red>You don't have enough money for this command!</red>", ConfigParam.STRING),
|
|
||||||
|
|
||||||
cooldownPlayer("cooldown.player",null,"[prefix] <red>Du musst noch <gold>[cooldown]</gold> Sekunden warten um diesen Command erneut zu nutzen.</red>","[prefix] <red>You must wait <gold>[cooldown]</gold> seconds to use this command again.</red>",ConfigParam.STRING),
|
|
||||||
cooldownGlobal("cooldown.global",null,"[prefix] <red>Du musst noch <gold>[cooldown]</gold> Sekunden warten um diesen Command zu nutzen.</red>","[prefix] <red>You have to wait <gold>[cooldown]</gold> seconds to use this command.</red>",ConfigParam.STRING),
|
|
||||||
|
|
||||||
confirmCommand("cost.confirm.command", null, "[prefix] <gold>Für diesen Befehl musst du [price] bezahlen!</gold><br>[prefix] <green><click:run_command:'/t2c-a confirm'><hover:show_text:'<gray>Klicke zum bestätigen</gray>'>Bestätigen</hover></click></green> <gray>-</gray> <red><click:run_command:'/t2c-a cancel'><hover:show_text:'<gray>Klicke zum abbrechen</gray>'>Abbrechen</hover></click></red>",
|
|
||||||
"[prefix] <gold>For this command you have to pay [price]!</gold><br>[prefix] <green><click:run_command:'/t2c-a confirm'><hover:show_text:'<gray>Click to confirm</gray>'>Confirm</hover></click></green> <gray>-</gray> <red><click:run_command:'/t2c-a cancel'><hover:show_text:'<gray>click to cancel</gray>'>Cancel</hover></click></red>", ConfigParam.STRING),
|
|
||||||
confirmChat("cost.confirm.chat", null, "[prefix] <gold>Für diesen Befehl musst du [price] bezahlen!</gold><br>[prefix] <green><click:run_command:'t2code-alias-confirm'><hover:show_text:'<gray>Klicke zum bestätigen</gray>'>Bestätigen</hover></click></green> <gray>-</gray> <red><click:run_command:'t2code-alias-cancel'><hover:show_text:'<gray>Klicke zum abbrechen</gray>'>Abbrechen</hover></click></red>",
|
|
||||||
"[prefix] <gold>For this command you have to pay [price]!</gold><br>[prefix] <green><click:run_command:'t2code-alias-confirm'><hover:show_text:'<gray>Click to confirm</gray>'>Confirm</hover></click></green> <gray>-</gray> <red><click:run_command:'t2code-alias-cancel'><hover:show_text:'<gray>click to cancel</gray>'>Cancel</hover></click></red>", ConfigParam.STRING),
|
|
||||||
|
|
||||||
confirmGuiTitle("cost.confirm.gui.title", null, "&2Bestätige den Zahlvorgang für: &6/[alias]",
|
|
||||||
"&2Confirm the payment process for: &6/[alias]", ConfigParam.STRING),
|
|
||||||
confirmGuiConfirm("cost.confirm.gui.confirm.displayName", null, "&2Bestätigen", "&2Confirm", ConfigParam.STRING),
|
|
||||||
confirmGuiConfirmLore("cost.confirm.gui.confirm.lore", null, Arrays.asList("&aDieser Befehl kostet", "&6[price]"),
|
|
||||||
Arrays.asList("&aThis command costs","&6[price]"), ConfigParam.LIST),
|
|
||||||
confirmGuiCancel("cost.confirm.gui.cancel.displayName", null, "&cAbbrechen", "&cCancel", ConfigParam.STRING),
|
|
||||||
confirmGuiCancelLore("cost.confirm.gui.cancel.lore", null, Arrays.asList(""), Arrays.asList(""), ConfigParam.LIST),
|
|
||||||
confirmCancel("cost.confirm.cancel", null, "[prefix] <gold>Der befehl wurde abgebrochen und du musst nichts bezahlen!</gold>",
|
|
||||||
"[prefix] <gold>The command was canceled and you do not have to pay anything!</gold>", ConfigParam.STRING),
|
|
||||||
confirmNotPossible("cost.confirm.notPossible", null, "[prefix] <gold>Bestätigen nicht möglich, du hast keinen bezahlungspflichtigen befehl ausgeführt.</gold>",
|
|
||||||
"[prefix] <gold>Confirmation not possible, you have not executed a payable command.</gold>", ConfigParam.STRING);
|
|
||||||
|
|
||||||
|
|
||||||
public String path;
|
onlyForPlayer("plugin.onlyForPlayer", null,
|
||||||
public String value;
|
new HashMap<>() {{
|
||||||
public List<String> valueList;
|
put(T2C_LanguageEnum.german, List.of("[prefix] <red>Dieser Command ist nur f[ue]r Spieler!</red>"));
|
||||||
public String german;
|
put(T2C_LanguageEnum.english, List.of("[prefix] <red>This command is for players only!</red>"));
|
||||||
public List<String> germanList;
|
}},
|
||||||
public String english;
|
new HashMap<>() {{
|
||||||
public List<String> englishList;
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
public ConfigParam configParam;
|
put(T2C_LanguageEnum.english, List.of());
|
||||||
|
}}),
|
||||||
|
|
||||||
Language(String path, String value, String german, String english, ConfigParam cEnum) {
|
aliasDisabled("plugin.aliasDisabled", null,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of("Unknown command. Type ''/help'' for help."));
|
||||||
|
put(T2C_LanguageEnum.english, List.of("Unknown command. Type ''/help'' for help."));
|
||||||
|
}},
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of());
|
||||||
|
}}),
|
||||||
|
|
||||||
|
reloadStart("plugin.reload.start", null,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of("[prefix] <gold>Plugin wird neu geladen...</gold>"));
|
||||||
|
put(T2C_LanguageEnum.english, List.of("[prefix] <gold>Plugin is reloaded...</gold>"));
|
||||||
|
}},
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of());
|
||||||
|
}}),
|
||||||
|
|
||||||
|
reloadEnd("plugin.reload.end", null,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of("[prefix] <dark_green>Plugin wurde erfolgreich neu geladen.</dark_green>"));
|
||||||
|
put(T2C_LanguageEnum.english, List.of("[prefix] <dark_green>Plugin was successfully reloaded.</dark_green>"));
|
||||||
|
}},
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of());
|
||||||
|
}}),
|
||||||
|
|
||||||
|
noPermission("plugin.noPermissionForCommand", null,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of("[prefix] <red>F[ue]r <aqua>[cmd]</aqua> fehlt dir die Permission <gold>[perm]</gold>!</red>"));
|
||||||
|
put(T2C_LanguageEnum.english, List.of("[prefix] <red>For <aqua>[cmd]</aqua> you lack the permission <gold>[perm]</gold>!</red>"));
|
||||||
|
}},
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of());
|
||||||
|
}}),
|
||||||
|
|
||||||
|
noSubCommand("plugin.noSubCommand", null,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of("[prefix] <red>Diesen Befehl gibt es nicht!</red>"));
|
||||||
|
put(T2C_LanguageEnum.english, List.of("[prefix] <red>This command does not exist!</red>"));
|
||||||
|
}},
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of());
|
||||||
|
}}),
|
||||||
|
buy("cost.buy", null,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of("[prefix] <dark_green>Du hast f[ue]r diesen Command <gold>[price]</gold> bezahlt.</dark_green>"));
|
||||||
|
put(T2C_LanguageEnum.english, List.of("[prefix] <dark_green>You have paid <gold>[price]</gold> for this command.</dark_green>"));
|
||||||
|
}},
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of());
|
||||||
|
}}),
|
||||||
|
noMoney("cost.noMoney", null,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of("[prefix] <red>Du hast nicht gen[ue]gend Geld für diesen Command!</red>"));
|
||||||
|
put(T2C_LanguageEnum.english, List.of("[prefix] <red>You don't have enough money for this command!</red>"));
|
||||||
|
}},
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of());
|
||||||
|
}}),
|
||||||
|
|
||||||
|
cooldownPlayer("cooldown.player", null,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of("[prefix] <red>Du musst noch <gold>[cooldown]</gold> Sekunden warten um diesen Command erneut zu nutzen.</red>"));
|
||||||
|
put(T2C_LanguageEnum.english, List.of("[prefix] <red>You must wait <gold>[cooldown]</gold> seconds to use this command again.</red>"));
|
||||||
|
}},
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of());
|
||||||
|
}}),
|
||||||
|
cooldownGlobal("cooldown.global", null,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of("[prefix] <red>Du musst noch <gold>[cooldown]</gold> Sekunden warten um diesen Command zu nutzen.</red>"));
|
||||||
|
put(T2C_LanguageEnum.english, List.of("[prefix] <red>You have to wait <gold>[cooldown]</gold> seconds to use this command.</red>"));
|
||||||
|
}},
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of());
|
||||||
|
}}),
|
||||||
|
|
||||||
|
confirmCommand("cost.confirm.command", null,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of("[prefix] <gold>Für diesen Befehl musst du [price] bezahlen!</gold><br>[prefix] <green><click:run_command:'/t2c-a confirm'><hover:show_text:'<gray>Klicke zum bestätigen</gray>'>Bestätigen</hover></click></green> <gray>-</gray> <red><click:run_command:'/t2c-a cancel'><hover:show_text:'<gray>Klicke zum abbrechen</gray>'>Abbrechen</hover></click></red>"));
|
||||||
|
put(T2C_LanguageEnum.english, List.of("[prefix] <gold>For this command you have to pay [price]!</gold><br>[prefix] <green><click:run_command:'/t2c-a confirm'><hover:show_text:'<gray>Click to confirm</gray>'>Confirm</hover></click></green> <gray>-</gray> <red><click:run_command:'/t2c-a cancel'><hover:show_text:'<gray>click to cancel</gray>'>Cancel</hover></click></red>"));
|
||||||
|
}},
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of());
|
||||||
|
}}),
|
||||||
|
confirmChat("cost.confirm.chat", null,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of("[prefix] <gold>Für diesen Befehl musst du [price] bezahlen!</gold><br>[prefix] <green><click:run_command:'t2code-alias-confirm'><hover:show_text:'<gray>Klicke zum bestätigen</gray>'>Bestätigen</hover></click></green> <gray>-</gray> <red><click:run_command:'t2code-alias-cancel'><hover:show_text:'<gray>Klicke zum abbrechen</gray>'>Abbrechen</hover></click></red>"));
|
||||||
|
put(T2C_LanguageEnum.english, List.of("[prefix] <gold>For this command you have to pay [price]!</gold><br>[prefix] <green><click:run_command:'t2code-alias-confirm'><hover:show_text:'<gray>Click to confirm</gray>'>Confirm</hover></click></green> <gray>-</gray> <red><click:run_command:'t2code-alias-cancel'><hover:show_text:'<gray>click to cancel</gray>'>Cancel</hover></click></red>"));
|
||||||
|
}},
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of());
|
||||||
|
}}),
|
||||||
|
|
||||||
|
confirmGuiTitle("cost.confirm.gui.title", null,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of("&2Bestätige den Zahlvorgang für: &6/[alias]"));
|
||||||
|
put(T2C_LanguageEnum.english, List.of("&2Confirm the payment process for: &6/[alias]"));
|
||||||
|
}},
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of());
|
||||||
|
}}),
|
||||||
|
confirmGuiConfirm("cost.confirm.gui.confirm.displayName", null,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of("&2Bestätigen"));
|
||||||
|
put(T2C_LanguageEnum.english, List.of("&2Confirm"));
|
||||||
|
}},
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of());
|
||||||
|
}}),
|
||||||
|
confirmGuiConfirmLore("cost.confirm.gui.confirm.lore", null,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of("&aDieser Befehl kostet", "&6[price]"));
|
||||||
|
put(T2C_LanguageEnum.english, List.of("&aThis command costs", "&6[price]"));
|
||||||
|
}},
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of());
|
||||||
|
}}),
|
||||||
|
confirmGuiCancel("cost.confirm.gui.cancel.displayName", null,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german,List.of( "&cAbbrechen"));
|
||||||
|
put(T2C_LanguageEnum.english, List.of("&cCancel"));
|
||||||
|
}},
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of());
|
||||||
|
}}),
|
||||||
|
confirmGuiCancelLore("cost.confirm.gui.cancel.lore", null,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of(""));
|
||||||
|
put(T2C_LanguageEnum.english, List.of(""));
|
||||||
|
}},
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of());
|
||||||
|
}}),
|
||||||
|
confirmCancel("cost.confirm.cancel", null,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of("[prefix] <gold>Der befehl wurde abgebrochen und du musst nichts bezahlen!</gold>"));
|
||||||
|
put(T2C_LanguageEnum.english, List.of("[prefix] <gold>The command was canceled and you do not have to pay anything!</gold>"));
|
||||||
|
}},
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of());
|
||||||
|
}}),
|
||||||
|
confirmNotPossible("cost.confirm.notPossible", null,
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of("[prefix] <gold>Bestätigen nicht möglich, du hast keinen zahlungspflichtigen befehl ausgeführt.</gold>"));
|
||||||
|
put(T2C_LanguageEnum.english, List.of("[prefix] <gold>Confirmation not possible, you have not executed a payable command.</gold>"));
|
||||||
|
}},
|
||||||
|
new HashMap<>() {{
|
||||||
|
put(T2C_LanguageEnum.german, List.of());
|
||||||
|
put(T2C_LanguageEnum.english, List.of());
|
||||||
|
}}),
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
private final String path;
|
||||||
|
private Object value;
|
||||||
|
private final HashMap<T2C_LanguageEnum, List<String>> lang;
|
||||||
|
private final HashMap<T2C_LanguageEnum, List<String>> comments;
|
||||||
|
|
||||||
|
VALUES(String path, Object value, HashMap<T2C_LanguageEnum, List<String>> lang, HashMap<T2C_LanguageEnum, List<String>> comments) {
|
||||||
this.path = path;
|
this.path = path;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
this.german = german;
|
this.lang = lang;
|
||||||
this.english = english;
|
this.comments = comments;
|
||||||
this.configParam = cEnum;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Language(String path, List<String> valueList, List<String> german, List<String> english, ConfigParam cEnum) {
|
@Override
|
||||||
this.path = path;
|
public String getPath() {
|
||||||
this.valueList = valueList;
|
return path;
|
||||||
this.germanList = german;
|
|
||||||
this.englishList = english;
|
|
||||||
this.configParam = cEnum;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getValue() {
|
||||||
|
if (value == null) {
|
||||||
|
return lang.get(T2C_LanguageEnum.english);
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HashMap<T2C_LanguageEnum, List<String>> getLanguage() {
|
||||||
|
return lang;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HashMap<T2C_LanguageEnum, List<String>> getComments() {
|
||||||
|
return comments;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setValue(Object newValue) {
|
||||||
|
value = newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void set(boolean isReload) {
|
||||||
|
T2C_LanguageWriter.createConfig(Util.getPrefix(), Main.getPath(), VALUES.values(), Config.VALUES.language.getValue().toString(), isReload, Util.getConfigLogo());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,71 +1,70 @@
|
|||||||
package net.t2code.alias.Spigot.config.subAlias;
|
package net.t2code.alias.Spigot.config.subAlias;
|
||||||
|
|
||||||
import net.t2code.alias.Spigot.Main;
|
import net.t2code.alias.Spigot.Main;
|
||||||
import net.t2code.alias.Util;
|
import net.t2code.alias.util.Util;
|
||||||
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 net.t2code.t2codelib.SPIGOT.api.yaml.T2C_Config;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
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.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
|
||||||
|
|
||||||
public class CreateExampleSubAliasConfig {
|
public class CreateExampleSubAliasConfig {
|
||||||
|
|
||||||
public static void configCreate() {
|
public static void configCreate() {
|
||||||
long long_ = System.currentTimeMillis();
|
long long_ = System.currentTimeMillis();
|
||||||
T2Csend.console(Util.getPrefix() + " §4SubAlias/aliasexample.yml are created...");
|
T2C_Send.console(Util.getPrefix() + " §4SubAlias/aliasexample.yml are created...");
|
||||||
|
|
||||||
File config = new File(Main.getPath(), "SubAlias/aliasexample.yml");
|
File config = new File(Main.getPath(), "SubAlias/aliasexample.yml");
|
||||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||||
|
|
||||||
T2Cconfig.set("SubAlias.Enable", true, yamlConfiguration);
|
T2C_Config.set("SubAlias.Enable", true, yamlConfiguration);
|
||||||
T2Cconfig.set("SubAlias.SubAliasList", Arrays.asList("test"), yamlConfiguration);
|
T2C_Config.set("SubAlias.SubAliasList", Arrays.asList("test"), yamlConfiguration);
|
||||||
T2Cconfig.set("SubAlias.SubAliasFor", "aliasexample1", yamlConfiguration);
|
T2C_Config.set("SubAlias.SubAliasFor", "aliasexample1", yamlConfiguration);
|
||||||
|
|
||||||
T2Cconfig.set("SubAlias.Permission.Necessary", true, yamlConfiguration);
|
T2C_Config.set("SubAlias.Permission.Necessary", true, yamlConfiguration);
|
||||||
T2Cconfig.set("SubAlias.Permission.Permission", "t2c.alias.sub.use.[alias]", yamlConfiguration);
|
T2C_Config.set("SubAlias.Permission.Permission", "t2c.alias.sub.use.[alias]", yamlConfiguration);
|
||||||
T2Cconfig.set("SubAlias.Permission.CustomNoPermissionMSG", "", yamlConfiguration);
|
T2C_Config.set("SubAlias.Permission.CustomNoPermissionMSG", "", yamlConfiguration);
|
||||||
|
|
||||||
T2Cconfig.set("SubAlias.CooldownInSec.Global", 0, yamlConfiguration);
|
T2C_Config.set("SubAlias.CooldownInSec.Global", 0, yamlConfiguration);
|
||||||
T2Cconfig.set("SubAlias.CooldownInSec.Player", 0, yamlConfiguration);
|
T2C_Config.set("SubAlias.CooldownInSec.Player", 0, yamlConfiguration);
|
||||||
|
|
||||||
T2Cconfig.set("SubAlias.Cost.Enable", false, yamlConfiguration);
|
T2C_Config.set("SubAlias.Cost.Enable", false, yamlConfiguration);
|
||||||
T2Cconfig.set("SubAlias.Cost.Confirm", true,yamlConfiguration);
|
T2C_Config.set("SubAlias.Cost.Confirm", true,yamlConfiguration);
|
||||||
T2Cconfig.set("SubAlias.Cost.Price", 0.0, yamlConfiguration);
|
T2C_Config.set("SubAlias.Cost.Price", 0.0, yamlConfiguration);
|
||||||
T2Cconfig.set("SubAlias.Cost.AllowByPass", true, yamlConfiguration);
|
T2C_Config.set("SubAlias.Cost.AllowByPass", true, yamlConfiguration);
|
||||||
|
|
||||||
T2Cconfig.set("SubAlias.Command.Enable", true, yamlConfiguration);
|
T2C_Config.set("SubAlias.Command.Enable", true, yamlConfiguration);
|
||||||
T2Cconfig.set("SubAlias.Command.CommandAsConsole", true, yamlConfiguration);
|
T2C_Config.set("SubAlias.Command.CommandAsConsole", true, yamlConfiguration);
|
||||||
T2Cconfig.set("SubAlias.Command.BungeeCommand", false, yamlConfiguration);
|
T2C_Config.set("SubAlias.Command.BungeeCommand", false, yamlConfiguration);
|
||||||
T2Cconfig.set("SubAlias.Command.Commands", Arrays.asList("say hi"), yamlConfiguration);
|
T2C_Config.set("SubAlias.Command.Commands", Arrays.asList("say hi"), yamlConfiguration);
|
||||||
|
|
||||||
T2Cconfig.set("SubAlias.Message.Enable", false, yamlConfiguration);
|
T2C_Config.set("SubAlias.Message.Enable", false, yamlConfiguration);
|
||||||
T2Cconfig.set("SubAlias.Message.Messages",Arrays.asList(), yamlConfiguration);
|
T2C_Config.set("SubAlias.Message.Messages",Arrays.asList(), yamlConfiguration);
|
||||||
|
|
||||||
T2Cconfig.set("SubAlias.Admin.Enable", false, yamlConfiguration);
|
T2C_Config.set("SubAlias.Admin.Enable", false, yamlConfiguration);
|
||||||
T2Cconfig.set("SubAlias.Admin.Permission", "t2c.alias.admin", yamlConfiguration);
|
T2C_Config.set("SubAlias.Admin.Permission", "t2c.alias.admin", yamlConfiguration);
|
||||||
|
|
||||||
T2Cconfig.set("SubAlias.Admin.Command.Enable", true, yamlConfiguration);
|
T2C_Config.set("SubAlias.Admin.Command.Enable", true, yamlConfiguration);
|
||||||
T2Cconfig.set("SubAlias.Admin.Command.CommandAsConsole", true, yamlConfiguration);
|
T2C_Config.set("SubAlias.Admin.Command.CommandAsConsole", true, yamlConfiguration);
|
||||||
T2Cconfig.set("SubAlias.Admin.Command.BungeeCommand", false, yamlConfiguration);
|
T2C_Config.set("SubAlias.Admin.Command.BungeeCommand", false, yamlConfiguration);
|
||||||
T2Cconfig.set("SubAlias.Admin.Command.Commands", Arrays.asList("say subalias hi"), yamlConfiguration);
|
T2C_Config.set("SubAlias.Admin.Command.Commands", Arrays.asList("say subalias hi"), yamlConfiguration);
|
||||||
|
|
||||||
T2Cconfig.set("SubAlias.Admin.Message.Enable", false, yamlConfiguration);
|
T2C_Config.set("SubAlias.Admin.Message.Enable", false, yamlConfiguration);
|
||||||
T2Cconfig.set("SubAlias.Admin.Message.Messages",Arrays.asList(), yamlConfiguration);
|
T2C_Config.set("SubAlias.Admin.Message.Messages",Arrays.asList(), yamlConfiguration);
|
||||||
|
|
||||||
T2Cconfig.set("SubAlias.Console.Enable", false, yamlConfiguration);
|
T2C_Config.set("SubAlias.Console.Enable", false, yamlConfiguration);
|
||||||
T2Cconfig.set("SubAlias.Console.Command.Enable", false, yamlConfiguration);
|
T2C_Config.set("SubAlias.Console.Command.Enable", false, yamlConfiguration);
|
||||||
T2Cconfig.set("SubAlias.Console.Command.BungeeCommand", false, yamlConfiguration);
|
T2C_Config.set("SubAlias.Console.Command.BungeeCommand", false, yamlConfiguration);
|
||||||
T2Cconfig.set("SubAlias.Console.Command.Commands",Arrays.asList(), yamlConfiguration);
|
T2C_Config.set("SubAlias.Console.Command.Commands",Arrays.asList(), yamlConfiguration);
|
||||||
T2Cconfig.set("SubAlias.Console.Message.Enable", false, yamlConfiguration);
|
T2C_Config.set("SubAlias.Console.Message.Enable", false, yamlConfiguration);
|
||||||
T2Cconfig.set("SubAlias.Console.Message.Messages",Arrays.asList(), yamlConfiguration);
|
T2C_Config.set("SubAlias.Console.Message.Messages",Arrays.asList(), yamlConfiguration);
|
||||||
try {
|
try {
|
||||||
yamlConfiguration.save(config);
|
yamlConfiguration.save(config);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
T2Csend.console(Util.getPrefix() + " §2Alias/aliasexample.yml were successfully created." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
T2C_Send.console(Util.getPrefix() + " §2Alias/aliasexample.yml were successfully created." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,8 @@ import com.google.common.base.Preconditions;
|
|||||||
import net.t2code.alias.Spigot.Main;
|
import net.t2code.alias.Spigot.Main;
|
||||||
import net.t2code.alias.Spigot.config.alias.AliasConfigConverter;
|
import net.t2code.alias.Spigot.config.alias.AliasConfigConverter;
|
||||||
import net.t2code.alias.Spigot.objects.SubAliasObject;
|
import net.t2code.alias.Spigot.objects.SubAliasObject;
|
||||||
import net.t2code.alias.Util;
|
import net.t2code.alias.util.Util;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
@ -51,7 +51,7 @@ public class SelectSubAlias {
|
|||||||
if (subAliasFor != null) {
|
if (subAliasFor != null) {
|
||||||
String[] imp = subAliasFor.split(" ");
|
String[] imp = subAliasFor.split(" ");
|
||||||
if (!Main.allAliases.contains(imp[0])) {
|
if (!Main.allAliases.contains(imp[0])) {
|
||||||
T2Csend.error(Main.getPlugin(), "The alias " + imp[0] + " in the file " + config_gui.getName() + " does not exist!");
|
T2C_Send.error(Main.getInstance(), "The alias " + imp[0] + " in the file " + config_gui.getName() + " does not exist!");
|
||||||
}
|
}
|
||||||
String[] args = subAliasFor.split(" ");
|
String[] args = subAliasFor.split(" ");
|
||||||
subAliasArg = args.length - 1;
|
subAliasArg = args.length - 1;
|
||||||
@ -120,7 +120,7 @@ public class SelectSubAlias {
|
|||||||
|
|
||||||
Main.allSubAliases.addAll(subAliasList);
|
Main.allSubAliases.addAll(subAliasList);
|
||||||
Main.allForSubAliases.add(subAliasFor);
|
Main.allForSubAliases.add(subAliasFor);
|
||||||
T2Csend.console(Prefix + " §aSubAlias file §e" + config_gui.getName() + " §awas loaded");
|
T2C_Send.console(Prefix + " §aSubAlias file §e" + config_gui.getName() + " §awas loaded");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ public class ChatConfirm implements Listener {
|
|||||||
switch (args[0].toLowerCase()) {
|
switch (args[0].toLowerCase()) {
|
||||||
case "t2code-alias-confirm":
|
case "t2code-alias-confirm":
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
Bukkit.getScheduler().runTask(Main.getPlugin(), new Runnable() {
|
Bukkit.getScheduler().runTask(Main.getInstance(), new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
ExecuteAlias.storage(player, true);
|
ExecuteAlias.storage(player, true);
|
||||||
@ -30,7 +30,7 @@ public class ChatConfirm implements Listener {
|
|||||||
break;
|
break;
|
||||||
case "t2code-alias-cancel":
|
case "t2code-alias-cancel":
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
Bukkit.getScheduler().runTask(Main.getPlugin(), new Runnable() {
|
Bukkit.getScheduler().runTask(Main.getInstance(), new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
ExecuteAlias.storage(player, false);
|
ExecuteAlias.storage(player, false);
|
||||||
|
@ -4,9 +4,9 @@ import net.t2code.alias.Spigot.Cache;
|
|||||||
import net.t2code.alias.Spigot.Main;
|
import net.t2code.alias.Spigot.Main;
|
||||||
import net.t2code.alias.Spigot.config.config.Config;
|
import net.t2code.alias.Spigot.config.config.Config;
|
||||||
import net.t2code.alias.Spigot.config.config.Language;
|
import net.t2code.alias.Spigot.config.config.Language;
|
||||||
import net.t2code.alias.Util;
|
import net.t2code.alias.util.Util;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemBuilder;
|
import net.t2code.t2codelib.SPIGOT.api.items.T2C_ItemBuilder;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Replace;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
@ -17,15 +17,15 @@ import java.util.List;
|
|||||||
public class ConfirmGUI {
|
public class ConfirmGUI {
|
||||||
|
|
||||||
public static void open(Player player, Double price, String alias) {
|
public static void open(Player player, Double price, String alias) {
|
||||||
Inventory inventory = Bukkit.createInventory((InventoryHolder) null, 9 * 3, (T2Creplace.replace(Util.getPrefix(), player,
|
Inventory inventory = Bukkit.createInventory((InventoryHolder) null, 9 * 3, (T2C_Replace.replace(Util.getPrefix(), player,
|
||||||
Main.getGuiCode() + Language.confirmGuiTitle.value.replace("[price]",price+ " "+Config.VALUES.buyCurrency.getValue()).replace("[alias]", alias))));
|
Main.getGuiCode() + Language.VALUES.confirmGuiTitle.getValue().toString().replace("[price]",price+ " "+Config.VALUES.buyCurrency.getValue()).replace("[alias]", alias))));
|
||||||
|
|
||||||
T2CitemBuilder.fillItem((boolean) Config.VALUES.buyConfirmGuiFillItemEnabled.getValue(), (String) Config.VALUES.buyConfirmGuiFillItem.getValue(), 3, inventory);
|
T2C_ItemBuilder.fillItem((boolean) Config.VALUES.buyConfirmGuiFillItemEnabled.getValue(), (String) Config.VALUES.buyConfirmGuiFillItem.getValue(), 3, inventory);
|
||||||
|
|
||||||
T2CitemBuilder.setItem(12, 1, (String) Config.VALUES.buyConfirmGuiConfirm.getValue(), Language.confirmGuiConfirm.value,
|
T2C_ItemBuilder.setItem(12, 1, (String) Config.VALUES.buyConfirmGuiConfirm.getValue(), Language.VALUES.confirmGuiConfirm.getValue().toString(),
|
||||||
(List<String>) T2Creplace.replace(Language.confirmGuiConfirmLore.valueList, "[price]", price + " " + Config.VALUES.buyCurrency.getValue()), inventory);
|
(List<String>) T2C_Replace.replace(Language.VALUES.confirmGuiConfirmLore.getValue(), "[price]", price + " " + Config.VALUES.buyCurrency.getValue()), inventory);
|
||||||
T2CitemBuilder.setItem(14, 1, (String) Config.VALUES.buyConfirmGuiCancel.getValue(), Language.confirmGuiCancel.value,
|
T2C_ItemBuilder.setItem(14, 1, (String) Config.VALUES.buyConfirmGuiCancel.getValue(), Language.VALUES.confirmGuiCancel.getValue().toString(),
|
||||||
(List<String>) T2Creplace.replace(Language.confirmGuiCancelLore.valueList, "[price]", price + " " + Config.VALUES.buyCurrency.getValue()), inventory);
|
(List<String>) T2C_Replace.replace(Language.VALUES.confirmGuiCancelLore.getValue(), "[price]", price + " " + Config.VALUES.buyCurrency.getValue()), inventory);
|
||||||
Cache.openPlayers.add(player.getUniqueId());
|
Cache.openPlayers.add(player.getUniqueId());
|
||||||
player.openInventory(inventory);
|
player.openInventory(inventory);
|
||||||
}
|
}
|
||||||
|
@ -2,38 +2,43 @@ package net.t2code.alias.Spigot.system;
|
|||||||
|
|
||||||
import net.t2code.alias.Spigot.Main;
|
import net.t2code.alias.Spigot.Main;
|
||||||
import net.t2code.alias.Spigot.cmdManagement.RegisterCommands;
|
import net.t2code.alias.Spigot.cmdManagement.RegisterCommands;
|
||||||
import net.t2code.alias.Util;
|
import net.t2code.alias.util.Util;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2C_McVersion;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandMap;
|
import org.bukkit.command.CommandMap;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.plugin.SimplePluginManager;
|
import org.bukkit.plugin.SimplePluginManager;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class AliasRegister {
|
public class AliasRegister {
|
||||||
private Main main;
|
private Main main;
|
||||||
|
|
||||||
public AliasRegister (Main main){
|
public AliasRegister(Main main) {
|
||||||
this.main=main;
|
this.main = main;
|
||||||
loadAliasCommands();
|
loadAliasCommands();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadAliasCommands() {
|
private void loadAliasCommands() {
|
||||||
CommandMap commandMap = getCommandMap();
|
CommandMap commandMap = getCommandMap();
|
||||||
|
unregister(commandMap);
|
||||||
if (commandMap == null) {
|
if (commandMap == null) {
|
||||||
main. getLogger().severe("CommandMap konnte nicht geladen werden!");
|
main.getLogger().severe("CommandMap konnte nicht geladen werden!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String alias : Main.allAliases) {
|
for (String alias : Main.allAliases) {
|
||||||
|
if (Main.aliasHashMap.get(alias).aliasEnable){
|
||||||
|
|
||||||
// Registrieren des Befehls
|
// Registrieren des Befehls
|
||||||
Command dynamicCommand = new RegisterCommands(alias);
|
System.out.println("Alias: " +alias);
|
||||||
commandMap.register(main.getDescription().getName(), dynamicCommand);
|
commandMap.register(main.getDescription().getName(), new RegisterCommands(alias));
|
||||||
T2Csend.console(Util.getPrefix() + " §aAlias §e" + alias + " §aregister");
|
T2C_Send.console(Util.getPrefix() + " §aAlias §e" + alias + " §aregister");
|
||||||
|
|
||||||
|
Main.loadAliasHashMap.put(alias, true);
|
||||||
|
} else Main.loadAliasHashMap.put(alias, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,4 +57,16 @@ public class AliasRegister {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void unregister(CommandMap commandMap) {
|
||||||
|
if (commandMap == null) return;
|
||||||
|
for (Map.Entry<String, Boolean> entry : Main.loadAliasHashMap.entrySet()) {
|
||||||
|
if (entry.getValue()){
|
||||||
|
Objects.requireNonNull(commandMap.getCommand(entry.getKey())).unregister(commandMap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Main.loadAliasHashMap.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ package net.t2code.alias.Spigot.system;
|
|||||||
import net.t2code.alias.Spigot.Main;
|
import net.t2code.alias.Spigot.Main;
|
||||||
import net.t2code.alias.Spigot.objects.AliasObject;
|
import net.t2code.alias.Spigot.objects.AliasObject;
|
||||||
import net.t2code.alias.Spigot.objects.SubAliasObject;
|
import net.t2code.alias.Spigot.objects.SubAliasObject;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.register.T2Cregister;
|
import net.t2code.t2codelib.SPIGOT.api.register.T2C_Register;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.permissions.PermissionDefault;
|
import org.bukkit.permissions.PermissionDefault;
|
||||||
|
|
||||||
@ -15,19 +15,19 @@ public class AliasRegisterPermissions {
|
|||||||
|
|
||||||
for (String alias : aliasObject.aliasList) {
|
for (String alias : aliasObject.aliasList) {
|
||||||
if (aliasObject.permission != null && Bukkit.getPluginManager().getPermission(aliasObject.permission.replace("[alias]", alias).toLowerCase()) == null) {
|
if (aliasObject.permission != null && Bukkit.getPluginManager().getPermission(aliasObject.permission.replace("[alias]", alias).toLowerCase()) == null) {
|
||||||
T2Cregister.permission(aliasObject.permission.replace("[alias]", alias).toLowerCase(), Main.getPlugin());
|
T2C_Register.permission(aliasObject.permission.replace("[alias]", alias).toLowerCase(), Main.getInstance());
|
||||||
}
|
}
|
||||||
if (aliasObject.adminPermission != null && Bukkit.getPluginManager().getPermission(aliasObject.adminPermission.replace("[alias]", alias).toLowerCase()) == null) {
|
if (aliasObject.adminPermission != null && Bukkit.getPluginManager().getPermission(aliasObject.adminPermission.replace("[alias]", alias).toLowerCase()) == null) {
|
||||||
T2Cregister.permission(aliasObject.adminPermission.replace("[alias]", alias).toLowerCase(), Main.getPlugin());
|
T2C_Register.permission(aliasObject.adminPermission.replace("[alias]", alias).toLowerCase(), Main.getInstance());
|
||||||
}
|
}
|
||||||
if (Bukkit.getPluginManager().getPermission("t2c.alias.buy." + alias.toLowerCase() + ".bypass") == null) {
|
if (Bukkit.getPluginManager().getPermission("t2c.alias.buy." + alias.toLowerCase() + ".bypass") == null) {
|
||||||
T2Cregister.permission("t2c.alias.buy." + alias.toLowerCase() + ".bypass", PermissionDefault.OP, Main.getPlugin());
|
T2C_Register.permission("t2c.alias.buy." + alias.toLowerCase() + ".bypass", PermissionDefault.OP, Main.getInstance());
|
||||||
}
|
}
|
||||||
if (Bukkit.getPluginManager().getPermission("t2c.alias.cooldown.global." + alias.toLowerCase() + ".bypass") == null) {
|
if (Bukkit.getPluginManager().getPermission("t2c.alias.cooldown.global." + alias.toLowerCase() + ".bypass") == null) {
|
||||||
T2Cregister.permission("t2c.alias.cooldown.global." + alias.toLowerCase() + ".bypass", PermissionDefault.OP, Main.getPlugin());
|
T2C_Register.permission("t2c.alias.cooldown.global." + alias.toLowerCase() + ".bypass", PermissionDefault.OP, Main.getInstance());
|
||||||
}
|
}
|
||||||
if (Bukkit.getPluginManager().getPermission("t2c.alias.cooldown.player." + alias.toLowerCase() + ".bypass") == null) {
|
if (Bukkit.getPluginManager().getPermission("t2c.alias.cooldown.player." + alias.toLowerCase() + ".bypass") == null) {
|
||||||
T2Cregister.permission("t2c.alias.cooldown.player." + alias.toLowerCase() + ".bypass", PermissionDefault.OP, Main.getPlugin());
|
T2C_Register.permission("t2c.alias.cooldown.player." + alias.toLowerCase() + ".bypass", PermissionDefault.OP, Main.getInstance());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -35,19 +35,19 @@ public class AliasRegisterPermissions {
|
|||||||
for (SubAliasObject subAliasObject : Main.subAliasHashMap.values()) {
|
for (SubAliasObject subAliasObject : Main.subAliasHashMap.values()) {
|
||||||
for (String alias : subAliasObject.subAliasList) {
|
for (String alias : subAliasObject.subAliasList) {
|
||||||
if (subAliasObject.permission != null && Bukkit.getPluginManager().getPermission(subAliasObject.permission.replace("[alias]", alias).toLowerCase()) == null) {
|
if (subAliasObject.permission != null && Bukkit.getPluginManager().getPermission(subAliasObject.permission.replace("[alias]", alias).toLowerCase()) == null) {
|
||||||
T2Cregister.permission(subAliasObject.permission.replace("[alias]", alias).toLowerCase(), Main.getPlugin());
|
T2C_Register.permission(subAliasObject.permission.replace("[alias]", alias).toLowerCase(), Main.getInstance());
|
||||||
}
|
}
|
||||||
if (subAliasObject.adminPermission != null && Bukkit.getPluginManager().getPermission(subAliasObject.adminPermission.replace("[alias]", alias).toLowerCase()) == null) {
|
if (subAliasObject.adminPermission != null && Bukkit.getPluginManager().getPermission(subAliasObject.adminPermission.replace("[alias]", alias).toLowerCase()) == null) {
|
||||||
T2Cregister.permission(subAliasObject.adminPermission.replace("[alias]", alias).toLowerCase(), Main.getPlugin());
|
T2C_Register.permission(subAliasObject.adminPermission.replace("[alias]", alias).toLowerCase(), Main.getInstance());
|
||||||
}
|
}
|
||||||
if (Bukkit.getPluginManager().getPermission("t2c.alias.sub.buy." + alias.toLowerCase() + ".bypass") == null) {
|
if (Bukkit.getPluginManager().getPermission("t2c.alias.sub.buy." + alias.toLowerCase() + ".bypass") == null) {
|
||||||
T2Cregister.permission("t2c.alias.sub.buy." + alias.toLowerCase() + ".bypass", PermissionDefault.OP, Main.getPlugin());
|
T2C_Register.permission("t2c.alias.sub.buy." + alias.toLowerCase() + ".bypass", PermissionDefault.OP, Main.getInstance());
|
||||||
}
|
}
|
||||||
if (Bukkit.getPluginManager().getPermission("t2c.alias.sub.cooldown.global." + alias.toLowerCase() + ".bypass") == null) {
|
if (Bukkit.getPluginManager().getPermission("t2c.alias.sub.cooldown.global." + alias.toLowerCase() + ".bypass") == null) {
|
||||||
T2Cregister.permission("t2c.alias.sub.cooldown.global." + alias.toLowerCase() + ".bypass", PermissionDefault.OP, Main.getPlugin());
|
T2C_Register.permission("t2c.alias.sub.cooldown.global." + alias.toLowerCase() + ".bypass", PermissionDefault.OP, Main.getInstance());
|
||||||
}
|
}
|
||||||
if (Bukkit.getPluginManager().getPermission("t2c.alias.sub.cooldown.player." + alias.toLowerCase() + ".bypass") == null) {
|
if (Bukkit.getPluginManager().getPermission("t2c.alias.sub.cooldown.player." + alias.toLowerCase() + ".bypass") == null) {
|
||||||
T2Cregister.permission("t2c.alias.sub.cooldown.player." + alias.toLowerCase() + ".bypass", PermissionDefault.OP, Main.getPlugin());
|
T2C_Register.permission("t2c.alias.sub.cooldown.player." + alias.toLowerCase() + ".bypass", PermissionDefault.OP, Main.getInstance());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,13 @@
|
|||||||
package net.t2code.alias.Spigot.system;
|
package net.t2code.alias.Spigot.system;
|
||||||
|
|
||||||
import net.t2code.alias.Spigot.Main;
|
|
||||||
import net.t2code.t2codelib.SPIGOT.system.T2CbungeeCommandSenderReciver;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import net.t2code.t2codelib.SPIGOT.system.T2C_ProxyCommandSenderReceiver;
|
||||||
import java.io.DataOutputStream;
|
import org.bukkit.command.CommandSender;
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class BCommandSenderReciver {
|
public class BCommandSenderReciver {
|
||||||
|
|
||||||
public static void sendToBungee(CommandSender sender, String information, Boolean console) {
|
public static void sendToBungee(CommandSender sender, String information, Boolean console) {
|
||||||
T2CbungeeCommandSenderReciver.sendToBungee(sender,information,console);
|
T2C_ProxyCommandSenderReceiver.sendToBungee(sender,information,console);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,20 +3,19 @@ package net.t2code.alias.Spigot.system;
|
|||||||
import net.t2code.alias.Spigot.Main;
|
import net.t2code.alias.Spigot.Main;
|
||||||
import net.t2code.alias.Spigot.cmdManagement.AliasCmdExecuter;
|
import net.t2code.alias.Spigot.cmdManagement.AliasCmdExecuter;
|
||||||
import net.t2code.alias.Spigot.cmdManagement.TabEvent;
|
import net.t2code.alias.Spigot.cmdManagement.TabEvent;
|
||||||
import net.t2code.alias.Spigot.config.alias.CreateExampleAliasConfig;
|
import net.t2code.alias.Spigot.config.alias.newConfig.AliasFile;
|
||||||
import net.t2code.alias.Spigot.config.alias.SelectAlias;
|
|
||||||
import net.t2code.alias.Spigot.config.config.Config;
|
import net.t2code.alias.Spigot.config.config.Config;
|
||||||
import net.t2code.alias.Spigot.config.config.FileSelect;
|
import net.t2code.alias.Spigot.config.config.Language;
|
||||||
import net.t2code.alias.Spigot.config.subAlias.CreateExampleSubAliasConfig;
|
import net.t2code.alias.Spigot.config.subAlias.CreateExampleSubAliasConfig;
|
||||||
import net.t2code.alias.Spigot.config.subAlias.SelectSubAlias;
|
import net.t2code.alias.Spigot.config.subAlias.SelectSubAlias;
|
||||||
import net.t2code.alias.Spigot.confirm.ChatConfirm;
|
import net.t2code.alias.Spigot.confirm.ChatConfirm;
|
||||||
import net.t2code.alias.Spigot.confirm.gui.GuiListener;
|
import net.t2code.alias.Spigot.confirm.gui.GuiListener;
|
||||||
import net.t2code.alias.Spigot.enums.Confirm;
|
import net.t2code.alias.Spigot.enums.Confirm;
|
||||||
import net.t2code.alias.Util;
|
import net.t2code.alias.util.Util;
|
||||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Template;
|
||||||
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 net.t2code.t2codelib.SPIGOT.system.config.config.T2CLibConfig;
|
import net.t2code.t2codelib.SPIGOT.system.config.config.T2C_LibConfig;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
@ -24,40 +23,40 @@ import java.io.File;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class Load {
|
public class Load {
|
||||||
private static final Main plugin = Main.getPlugin();
|
private static final Main plugin = Main.getInstance();
|
||||||
|
|
||||||
public Load (Main main,String prefix, List<String> autor, String version, String spigot, String discord, int bstatsID){
|
public Load(Main main, String prefix, List<String> autor, String version, String spigot, String discord, int bstatsID) {
|
||||||
onLoad(main, prefix, autor, version, spigot, discord, bstatsID);
|
onLoad(main, prefix, autor, version, spigot, discord, bstatsID);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onLoad(Main main,String prefix, List<String> autor, String version, String spigot, String discord, int bstatsID) {
|
private void onLoad(Main main, String prefix, List<String> autor, String version, String spigot, String discord, int bstatsID) {
|
||||||
Long long_ = T2Ctemplate.onLoadHeader(prefix, autor, version, spigot, discord);
|
Long long_ = T2C_Template.onLoadHeader(prefix, autor, version, spigot, discord);
|
||||||
plugin.getCommand("t2code-alias").setExecutor(new AliasCmdExecuter());
|
plugin.getCommand("t2code-alias").setExecutor(new AliasCmdExecuter());
|
||||||
loadReload(main);
|
loadReload(main, false);
|
||||||
T2CupdateAPI.onUpdateCheck(plugin, prefix, Util.getGit(), Util.getSpigotID(), Util.getDiscord(),
|
T2C_UpdateAPI.onUpdateCheck(plugin, prefix, Util.getGit(), Util.getSpigotID(), Util.getDiscord(),
|
||||||
(Boolean) Config.VALUES.updateCheckOnJoin.getValue(), (Boolean) Config.VALUES.updateCheckSeePreReleaseUpdates.getValue(), (Integer) Config.VALUES.updateCheckTimeInterval.getValue());
|
(Boolean) Config.VALUES.updateCheckOnJoin.getValue(), (Boolean) Config.VALUES.updateCheckSeePreReleaseUpdates.getValue(), (Integer) Config.VALUES.updateCheckTimeInterval.getValue());
|
||||||
|
|
||||||
T2Ctemplate.onLoadFooter(prefix, long_);
|
T2C_Template.onLoadFooter(prefix, long_);
|
||||||
T2Cregister.listener(new PluginEvents(), plugin);
|
T2C_Register.listener(new PluginEvents(), plugin);
|
||||||
Metrics.Bstats(plugin, bstatsID);
|
Metrics.Bstats(plugin, bstatsID);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ChatConfirm chatListener;
|
private static ChatConfirm chatListener;
|
||||||
private static GuiListener guiListener;
|
private static GuiListener guiListener;
|
||||||
|
|
||||||
public static void loadReload(Main main) {
|
public static void loadReload(Main main, boolean isReload) {
|
||||||
HandlerList.unregisterAll(chatListener);
|
HandlerList.unregisterAll(chatListener);
|
||||||
HandlerList.unregisterAll(guiListener);
|
HandlerList.unregisterAll(guiListener);
|
||||||
boolean newInstall = !new File(Main.getPath(), "config.yml").exists();
|
boolean newInstall = !new File(Main.getPath(), "config.yml").exists();
|
||||||
Config.set();
|
Config.set(isReload);
|
||||||
T2Ctemplate.onLoadSeparateStroke(Util.getPrefix());
|
T2C_Template.onLoadSeparateStroke(Util.getPrefix());
|
||||||
FileSelect.language();
|
Language.set(false);
|
||||||
if (newInstall) {
|
if (newInstall) { //todo old
|
||||||
try {
|
// try {
|
||||||
CreateExampleAliasConfig.configCreate();
|
// CreateExampleAliasConfig.configCreate();
|
||||||
} catch (Exception e) {
|
//} catch (Exception e) {
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}
|
// }
|
||||||
try {
|
try {
|
||||||
CreateExampleSubAliasConfig.configCreate();
|
CreateExampleSubAliasConfig.configCreate();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -65,18 +64,11 @@ public class Load {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
if (newInstall) {
|
||||||
plugin.saveResource("Alias/X_aliasDeclaration_X.yml", true);
|
AliasFile.set(false);
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
/**
|
AliasFile.select(false);
|
||||||
try {
|
|
||||||
plugin.saveResource("X_configDeclaration_X.yml", true);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
plugin.saveResource("SubAlias/X_subAliasDeclaration_X.yml", true);
|
plugin.saveResource("SubAlias/X_subAliasDeclaration_X.yml", true);
|
||||||
@ -84,18 +76,17 @@ public class Load {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
T2Ctemplate.onLoadSeparateStroke(Util.getPrefix());
|
T2C_Template.onLoadSeparateStroke(Util.getPrefix());
|
||||||
new SelectAlias(main);
|
T2C_Template.onLoadSeparateStroke(Util.getPrefix());
|
||||||
T2Ctemplate.onLoadSeparateStroke(Util.getPrefix());
|
|
||||||
SelectSubAlias.onSelect();
|
SelectSubAlias.onSelect();
|
||||||
if ((Boolean) Config.VALUES.subAliasTab.getValue()) {
|
if ((Boolean) Config.VALUES.subAliasTab.getValue()) {
|
||||||
T2Cregister.listener(new TabEvent(), plugin);
|
T2C_Register.listener(new TabEvent(), plugin);
|
||||||
}
|
}
|
||||||
chatListener = new ChatConfirm();
|
chatListener = new ChatConfirm();
|
||||||
if (Config.VALUES.buyConfirmDefault.getValue() == Confirm.CHAT) T2Cregister.listener(chatListener, plugin);
|
if (Config.VALUES.buyConfirmDefault.getValue() == Confirm.CHAT) T2C_Register.listener(chatListener, plugin);
|
||||||
guiListener = new GuiListener();
|
guiListener = new GuiListener();
|
||||||
if (Config.VALUES.buyConfirmDefault.getValue() == Confirm.GUI) T2Cregister.listener(guiListener, plugin);
|
if (Config.VALUES.buyConfirmDefault.getValue() == Confirm.GUI) T2C_Register.listener(guiListener, plugin);
|
||||||
if ((boolean)T2CLibConfig.VALUES.proxy.getValue()) {
|
if ((boolean) T2C_LibConfig.VALUES.proxy.getValue()) {
|
||||||
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "t2c:bcmd");
|
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "t2c:bcmd");
|
||||||
}
|
}
|
||||||
AliasRegisterPermissions.onPermRegister();
|
AliasRegisterPermissions.onPermRegister();
|
||||||
|
@ -2,10 +2,8 @@ package net.t2code.alias.Spigot.system;
|
|||||||
|
|
||||||
import net.t2code.alias.Spigot.Cache;
|
import net.t2code.alias.Spigot.Cache;
|
||||||
import net.t2code.alias.Spigot.Main;
|
import net.t2code.alias.Spigot.Main;
|
||||||
import net.t2code.alias.Spigot.cmdManagement.ExecuteAlias;
|
import net.t2code.alias.util.Util;
|
||||||
import net.t2code.alias.Spigot.confirm.gui.ConfirmGUI;
|
import net.t2code.t2codelib.SPIGOT.api.update.T2C_UpdateAPI;
|
||||||
import net.t2code.alias.Util;
|
|
||||||
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
@ -22,6 +20,6 @@ public class PluginEvents implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onJoinEvent(PlayerLoginEvent event) {
|
public void onJoinEvent(PlayerLoginEvent event) {
|
||||||
T2CupdateAPI.join(Main.getPlugin(), Util.getPrefix(), "t2c.alias.updatemsg", event.getPlayer(), Util.getSpigotID(), Util.getDiscord());
|
T2C_UpdateAPI.join(Main.getInstance(), Util.getPrefix(), "t2c.alias.updatemsg", event.getPlayer(), Util.getSpigotID(), Util.getDiscord());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,64 +0,0 @@
|
|||||||
package net.t2code.alias;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
public class Util {
|
|
||||||
|
|
||||||
|
|
||||||
public static String getInfoText() {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getRequiredT2CodeLibVersion() {
|
|
||||||
return "16.7";
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getPrefix() {
|
|
||||||
return prefix;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Integer getSpigotID() {
|
|
||||||
return 96389;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getGit() {
|
|
||||||
return "JaTiTV/T2Code-Alias";
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Integer getBstatsID() {
|
|
||||||
return 12517;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getSpigot() {
|
|
||||||
return "https://www.spigotmc.org/resources/" + getSpigotID();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getDiscord() {
|
|
||||||
return "http://dc.t2code.net";
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setPrefix(String pr) {
|
|
||||||
prefix = pr;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String prefix = "§8[§4T2Code§7-§aAlias§8]";
|
|
||||||
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
private static final String[] configLogo = new String[]{
|
|
||||||
"####################################################################################################################",
|
|
||||||
"## ##",
|
|
||||||
"## /$$$$$$$$ /$$$$$$ /$$$$$$ /$$ /$$ ##",
|
|
||||||
"## |__ $$__//$$__ $$ /$$__ $$ | $$ | $$ ##",
|
|
||||||
"## | $$ |__/ \\ $$| $$ \\__/ /$$$$$$ /$$$$$$$ /$$$$$$ /$$$$$$$ /$$$$$$ /$$$$$$ ##",
|
|
||||||
"## | $$ /$$$$$$/| $$ /$$__ $$ /$$__ $$ /$$__ $$ | $$__ $$ /$$__ $$|_ $$_/ ##",
|
|
||||||
"## | $$ /$$____/ | $$ | $$ \\ $$| $$ | $$| $$$$$$$$ | $$ \\ $$| $$$$$$$$ | $$ ##",
|
|
||||||
"## | $$ | $$ | $$ $$| $$ | $$| $$ | $$| $$_____/ | $$ | $$| $$_____/ | $$ /$$ ##",
|
|
||||||
"## | $$ | $$$$$$$$| $$$$$$/| $$$$$$/| $$$$$$$| $$$$$$$ /$$| $$ | $$| $$$$$$$ | $$$$/ ##",
|
|
||||||
"## |__/ |________/ \\______/ \\______/ \\_______/ \\_______/|__/|__/ |__/ \\_______/ \\___/ ##",
|
|
||||||
"## ##",
|
|
||||||
"## T2CodeLib from JaTiTV / T2Code.net. In case of problems please contact the Discord: https://dc.t2code.net ##",
|
|
||||||
"## ##",
|
|
||||||
"####################################################################################################################"
|
|
||||||
};
|
|
||||||
}
|
|
42
src/main/java/net/t2code/alias/util/Util.java
Normal file
42
src/main/java/net/t2code/alias/util/Util.java
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
package net.t2code.alias.util;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import net.t2code.t2codelib.util.T2C_Util;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
public class Util {
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private static final String infoText = "";
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private static final String requiredT2CodeLibVersion = "16.7";
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private static final Integer spigotID = 96389;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private static final String git = "JaTiTV/T2Code-Alias";
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private static final Integer bstatsID = 12517;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private static final String spigot = "https://spigotmc.org/resources/" + spigotID;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private static final String discord = "http://dc.t2code.net";
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
private static String prefix = "§8[§4T2Code§7-§aAlias§8]";
|
||||||
|
|
||||||
|
public static String[] getConfigLogo() {
|
||||||
|
ArrayList<String> arrayList = new ArrayList<>(T2C_Util.getConfigT2CodeLogo());
|
||||||
|
arrayList.addAll(Arrays.asList("", "# Spigot: " + spigot));
|
||||||
|
return arrayList.toArray(new String[0]);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user