Compare commits
9 Commits
1.1.4
...
1.2.0_beta
Author | SHA1 | Date | |
---|---|---|---|
5514e62f5d | |||
ba1db37a90 | |||
02e7020815 | |||
546b827e02 | |||
1ae32b2b59 | |||
93f63ffad0 | |||
2d49a7a4b7 | |||
f00ac77743 | |||
e96447d4fa |
14
pom.xml
14
pom.xml
@@ -6,7 +6,8 @@
|
||||
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>Alias</artifactId>
|
||||
<version>1.1.4</version>
|
||||
|
||||
<version>1.2.0_snapshot-1</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>T2C-Alias</name>
|
||||
@@ -19,6 +20,7 @@
|
||||
<url>T2Code.net</url>
|
||||
|
||||
<build>
|
||||
<finalName>${project.name}_${project.version}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
@@ -69,22 +71,26 @@
|
||||
<dependency>
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>T2CodeLib</artifactId>
|
||||
<version>13.2</version>
|
||||
<version>14.4</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>bungee</artifactId>
|
||||
<version>1615</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>PlugmanGUI</artifactId>
|
||||
<version>3.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.t2code.minecraft.1_19.r1</groupId>
|
||||
<groupId>net.t2code.minecraft.1_13.r1</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.19r1</version>
|
||||
<version>1.13r1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
@@ -2,6 +2,8 @@ package net.t2code.alias.Spigot;
|
||||
|
||||
import net.t2code.alias.Spigot.objects.AliasObject;
|
||||
import net.t2code.alias.Spigot.objects.SubAliasObject;
|
||||
import net.t2code.alias.Spigot.system.BukkitCommandWrap;
|
||||
import net.t2code.alias.Spigot.system.BukkitCommandWrap_Useless;
|
||||
import net.t2code.alias.Spigot.system.Load;
|
||||
import net.t2code.alias.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
||||
@@ -23,6 +25,7 @@ public final class Main extends JavaPlugin {
|
||||
private static List<String> autor;
|
||||
private static Main plugin;
|
||||
public static HashMap<String, AliasObject> aliasHashMap = new HashMap<>();
|
||||
public static HashMap<String, Boolean> loadAliasHashMap = new HashMap<>();
|
||||
public static HashMap<String, SubAliasObject> subAliasHashMap = new HashMap<>();
|
||||
public static ArrayList<String> allAliases = new ArrayList<>();
|
||||
public static ArrayList<String> allSubAliases = new ArrayList<>();
|
||||
@@ -35,7 +38,13 @@ public final class Main extends JavaPlugin {
|
||||
autor = plugin.getDescription().getAuthors();
|
||||
version = plugin.getDescription().getVersion();
|
||||
if (pluginNotFound("T2CodeLib", 96388, Util.getRequiredT2CodeLibVersion())) return;
|
||||
Load.onLoad(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getSpigotID(), Util.getDiscord(), Util.getBstatsID());
|
||||
try {
|
||||
Class.forName("com.mojang.brigadier.CommandDispatcher");
|
||||
this.bukkitCommandWrap = new BukkitCommandWrap();
|
||||
} catch (ClassNotFoundException | NoClassDefFoundError e) {
|
||||
this.bukkitCommandWrap = new BukkitCommandWrap_Useless();
|
||||
}
|
||||
Load.onLoad(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord(), Util.getBstatsID());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -91,4 +100,10 @@ public final class Main extends JavaPlugin {
|
||||
public static List<String> getAutor() {
|
||||
return autor;
|
||||
}
|
||||
|
||||
private BukkitCommandWrap bukkitCommandWrap = null;
|
||||
|
||||
public BukkitCommandWrap getBukkitCommandWrap() {
|
||||
return this.bukkitCommandWrap;
|
||||
}
|
||||
}
|
||||
|
@@ -34,6 +34,12 @@ public class AliasCmdExecuter implements CommandExecutor, TabCompleter {
|
||||
} else T2Csend.sender(sender, SelectMessages.noPermissionForCommand.replace("[cmd]", "/t2code-alias reload")
|
||||
.replace("[perm]", "t2code.alias.command.reload"));
|
||||
break;
|
||||
case "confirm":
|
||||
ExecuteAlias.storage(sender, true);
|
||||
break;
|
||||
case "cancel":
|
||||
ExecuteAlias.storage(sender, false);
|
||||
break;
|
||||
case "info":
|
||||
case "plugin":
|
||||
case "version":
|
||||
|
@@ -2,6 +2,7 @@ package net.t2code.alias.Spigot.cmdManagement;
|
||||
|
||||
import net.t2code.alias.Spigot.Main;
|
||||
import net.t2code.alias.Spigot.config.languages.SelectMessages;
|
||||
import net.t2code.alias.Spigot.system.Load;
|
||||
import net.t2code.alias.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
||||
@@ -10,16 +11,16 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public class Commands {
|
||||
public static void info(CommandSender sender) {
|
||||
T2Ctemplate.sendInfo(sender,Main.getPlugin(),Util.getSpigotID(),Util.getDiscord(),Util.getInfoText());
|
||||
T2Ctemplate.sendInfo(sender, Main.getPlugin(), Util.getSpigotID(), Util.getDiscord(), Util.getInfoText());
|
||||
}
|
||||
|
||||
public static void reload(CommandSender sender) {
|
||||
if (sender instanceof Player) sender.sendMessage(SelectMessages.reloadStart);
|
||||
if (sender instanceof Player) T2Csend.player((Player) sender, SelectMessages.reloadStart);
|
||||
T2Csend.console(Util.getPrefix() + "§8-------------------------------");
|
||||
T2Csend.console(Util.getPrefix() + " §6Plugin reload...");
|
||||
T2Csend.console(Util.getPrefix() + "§8-------------------------------");
|
||||
Main.getPlugin().onEnable();
|
||||
if (sender instanceof Player) sender.sendMessage(SelectMessages.reloadEnd);
|
||||
Load.loadReload();
|
||||
if (sender instanceof Player) T2Csend.player((Player) sender, SelectMessages.reloadEnd);
|
||||
T2Csend.console(Util.getPrefix() + "§8-------------------------------");
|
||||
T2Csend.console(Util.getPrefix() + " §2Plugin successfully reloaded.");
|
||||
T2Csend.console(Util.getPrefix() + "§8-------------------------------");
|
||||
|
@@ -3,6 +3,7 @@ package net.t2code.alias.Spigot.cmdManagement;
|
||||
import net.t2code.alias.Spigot.config.config.SelectConfig;
|
||||
import net.t2code.alias.Spigot.config.languages.SelectMessages;
|
||||
import net.t2code.alias.Spigot.objects.AliasObject;
|
||||
import net.t2code.alias.Spigot.objects.AliasStorageObject;
|
||||
import net.t2code.alias.Spigot.objects.SubAliasObject;
|
||||
import net.t2code.alias.Spigot.system.BCommandSenderReciver;
|
||||
import net.t2code.alias.Util;
|
||||
@@ -11,23 +12,50 @@ import net.t2code.t2codelib.SPIGOT.api.eco.T2Ceco;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.api.plugins.T2CpluginCheck;
|
||||
import net.t2code.t2codelib.SPIGOT.api.yaml.T2CLibConfig;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ExecuteAlias {
|
||||
|
||||
public static HashMap<UUID, AliasStorageObject> aliasStorage = new HashMap<>();
|
||||
|
||||
private static final String prefix = Util.getPrefix();
|
||||
|
||||
protected static void storage(CommandSender sender, boolean confirm) {
|
||||
Player player = (Player) sender;
|
||||
|
||||
if (!aliasStorage.containsKey(player.getUniqueId())) {
|
||||
T2Csend.player(player, SelectMessages.buyConfirmNotPossible);
|
||||
return;
|
||||
}
|
||||
|
||||
AliasStorageObject object = aliasStorage.get(player.getUniqueId());
|
||||
aliasStorage.remove(player.getUniqueId());
|
||||
|
||||
if (!confirm) {
|
||||
T2Csend.player(player, SelectMessages.buyCancel);
|
||||
return;
|
||||
}
|
||||
|
||||
if (object.sub) {
|
||||
executeSubAlias(player, (SubAliasObject) object.aliasObject, object.alias, object.args);
|
||||
} else executeAlias(player, (AliasObject) object.aliasObject, object.alias, object.args);
|
||||
}
|
||||
|
||||
protected static void aliasPlayer(CommandSender sender, AliasObject aliasObject, String alias, String[] args) {
|
||||
Player player = (Player) sender;
|
||||
|
||||
if (aliasObject.adminEnable) {
|
||||
if (player.hasPermission(aliasObject.adminPermission)) {
|
||||
if (aliasObject.adminCommandEnable) {
|
||||
aliasAdminCommand(aliasObject, player, args);
|
||||
aliasAdminCommand(aliasObject, alias, player, args);
|
||||
}
|
||||
if (aliasObject.adminMessageEnable) {
|
||||
aliasAdminMessage(aliasObject, alias, player, args);
|
||||
@@ -47,17 +75,30 @@ public class ExecuteAlias {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (aliasObject.costEnable && aliasObject.costConfirm) {
|
||||
if (!(aliasObject.costAllowBypass && player.hasPermission("t2code.alias.buy.bypass"))) {
|
||||
T2Csend.player(player, SelectMessages.buyConfirm.replace("[price]", aliasObject.costPrice.toString() + " " + SelectConfig.getBuyCurrency()));
|
||||
aliasStorage.put(player.getUniqueId(), new AliasStorageObject(aliasObject, alias, args, false));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
executeAlias(player, aliasObject, alias, args);
|
||||
}
|
||||
|
||||
protected static void executeAlias(Player player, AliasObject aliasObject, String alias, String[] args) {
|
||||
if (aliasObject.costEnable) {
|
||||
if (!(aliasObject.costAllowBypass && player.hasPermission("t2code.alias.buy.bypass"))) {
|
||||
if (!T2Ceco.moneyRemove(prefix, player, aliasObject.costPrice)) {
|
||||
T2Csend.player(player, SelectMessages.noMoney);
|
||||
return;
|
||||
}
|
||||
if (SelectConfig.buyMessage) T2Csend.player(player, SelectMessages.buy.replace("[price]", aliasObject.costPrice.toString()));
|
||||
if (SelectConfig.getBuyMessage())
|
||||
T2Csend.player(player, SelectMessages.buy.replace("[price]", aliasObject.costPrice.toString() + " " + SelectConfig.getBuyCurrency()));
|
||||
}
|
||||
}
|
||||
if (aliasObject.commandEnable) {
|
||||
aliasCommand(aliasObject, player, args);
|
||||
aliasCommand(aliasObject, alias, player, args);
|
||||
}
|
||||
if (aliasObject.messageEnable) {
|
||||
aliasMessage(aliasObject, alias, player, args);
|
||||
@@ -76,7 +117,7 @@ public class ExecuteAlias {
|
||||
if (aliasObject.adminEnable) {
|
||||
if (player.hasPermission(aliasObject.adminPermission)) {
|
||||
if (aliasObject.adminCommandEnable) {
|
||||
subAliasAdminCommand(aliasObject, player, args);
|
||||
subAliasAdminCommand(aliasObject, alias, player, args);
|
||||
}
|
||||
if (aliasObject.adminMessageEnable) {
|
||||
subAliasAdminMessage(aliasObject, alias, player, args);
|
||||
@@ -96,33 +137,46 @@ public class ExecuteAlias {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (aliasObject.costEnable) {
|
||||
if (aliasObject.costEnable && aliasObject.costConfirm) {
|
||||
if (!(aliasObject.costAllowBypass && player.hasPermission("t2code.alias.buy.bypass"))) {
|
||||
if (!T2Ceco.moneyRemove(prefix, player, aliasObject.costPrice)) {
|
||||
T2Csend.player(player, SelectMessages.noMoney);
|
||||
return;
|
||||
}
|
||||
if (SelectConfig.buyMessage) T2Csend.player(player, SelectMessages.buy.replace("[price]", aliasObject.costPrice.toString()));
|
||||
T2Csend.player(player, SelectMessages.buyConfirm.replace("[price]", aliasObject.costPrice.toString() + " " + SelectConfig.getBuyCurrency()));
|
||||
aliasStorage.put(player.getUniqueId(), new AliasStorageObject(aliasObject, alias, args, true));
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (aliasObject.commandEnable) {
|
||||
subAliasCommand(aliasObject, player, args);
|
||||
}
|
||||
if (aliasObject.messageEnable) {
|
||||
subAliasMessage(aliasObject, alias, player, args);
|
||||
}
|
||||
|
||||
executeSubAlias(player, aliasObject, alias, args);
|
||||
} else {
|
||||
if (aliasObject.consoleEnable) {
|
||||
subAliasConsole(aliasObject, sender, args);
|
||||
subAliasConsole(aliasObject, alias, sender, args);
|
||||
} else T2Csend.sender(sender, SelectMessages.onlyForPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
protected static void executeSubAlias(Player player, SubAliasObject aliasObject, String alias, String[] args) {
|
||||
if (aliasObject.costEnable) {
|
||||
if (!(aliasObject.costAllowBypass && player.hasPermission("t2code.alias.buy.bypass"))) {
|
||||
if (!T2Ceco.moneyRemove(prefix, player, aliasObject.costPrice)) {
|
||||
T2Csend.player(player, SelectMessages.noMoney);
|
||||
return;
|
||||
}
|
||||
if (SelectConfig.getBuyMessage())
|
||||
T2Csend.player(player, SelectMessages.buy.replace("[price]", aliasObject.costPrice.toString() + " " + SelectConfig.getBuyCurrency()));
|
||||
}
|
||||
}
|
||||
if (aliasObject.commandEnable) {
|
||||
subAliasCommand(aliasObject, player, args);
|
||||
}
|
||||
if (aliasObject.messageEnable) {
|
||||
subAliasMessage(aliasObject, alias, player, args);
|
||||
}
|
||||
}
|
||||
|
||||
protected static void aliasConsole(AliasObject alias, CommandSender sender, String prefix) {
|
||||
if (alias.consoleCommandEnable) {
|
||||
for (String cmd : alias.consoleCommands) {
|
||||
if (alias.consoleBungeeCommand) {
|
||||
if (SelectConfig.Bungee) {
|
||||
if (T2CLibConfig.getBungee()) {
|
||||
BCommandSenderReciver.sendToBungee(sender, cmd, true);
|
||||
} else {
|
||||
T2Csend.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||
@@ -140,7 +194,7 @@ public class ExecuteAlias {
|
||||
}
|
||||
}
|
||||
|
||||
private static void subAliasConsole(SubAliasObject alias, CommandSender sender, String[] args) {
|
||||
private static void subAliasConsole(SubAliasObject aliasObject, String alias, CommandSender sender, String[] args) {
|
||||
String targetSt = "[target]";
|
||||
try {
|
||||
List<String> results = Arrays.stream(args).filter(a -> a.contains("-p:")).collect(Collectors.toList());
|
||||
@@ -148,28 +202,29 @@ public class ExecuteAlias {
|
||||
} catch (Exception ignored) {
|
||||
|
||||
}
|
||||
if (alias.consoleCommandEnable) {
|
||||
for (String cmd : alias.consoleCommands) {
|
||||
if (alias.consoleBungeeCommand) {
|
||||
if (SelectConfig.Bungee) {
|
||||
BCommandSenderReciver.sendToBungee(sender, cmd.replace("[target]", targetSt), true);
|
||||
if (aliasObject.consoleCommandEnable) {
|
||||
for (String cmd : aliasObject.consoleCommands) {
|
||||
String replace = cmd.replace("[target]", targetSt).replace("[alias]", alias);
|
||||
if (aliasObject.consoleBungeeCommand) {
|
||||
if (T2CLibConfig.getBungee()) {
|
||||
BCommandSenderReciver.sendToBungee(sender, replace, true);
|
||||
} else {
|
||||
T2Csend.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.");
|
||||
}
|
||||
} else {
|
||||
T2Ccmd.console(cmd.replace("[target]", targetSt));
|
||||
T2Ccmd.console(replace);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (alias.consoleMessageEnable) {
|
||||
for (String msg : alias.consoleMessages) {
|
||||
if (aliasObject.consoleMessageEnable) {
|
||||
for (String msg : aliasObject.consoleMessages) {
|
||||
T2Csend.console(T2Creplace.replace(prefix, msg));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void aliasAdminCommand(AliasObject alias, Player player, String[] args) {
|
||||
private static void aliasAdminCommand(AliasObject aliasObject, String alias, Player player, String[] args) {
|
||||
String targetSt = "[target]";
|
||||
try {
|
||||
List<String> results = Arrays.stream(args).filter(a -> a.contains("-p:")).collect(Collectors.toList());
|
||||
@@ -177,26 +232,26 @@ public class ExecuteAlias {
|
||||
} catch (Exception ignored) {
|
||||
|
||||
}
|
||||
for (String cmd : alias.adminCommands) {
|
||||
if (alias.adminBungeeCommand) {
|
||||
if (SelectConfig.Bungee) {
|
||||
BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()).replace("[target]", targetSt), alias.adminCommandAsConsole);
|
||||
for (String cmd : aliasObject.adminCommands) {
|
||||
if (aliasObject.adminBungeeCommand) {
|
||||
if (T2CLibConfig.getBungee()) {
|
||||
BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()).replace("[target]", targetSt).replace("[alias]", alias), aliasObject.adminCommandAsConsole);
|
||||
|
||||
} else {
|
||||
T2Csend.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.");
|
||||
}
|
||||
} else {
|
||||
if (alias.adminCommandAsConsole) {
|
||||
T2Ccmd.console(cmd.replace("[player]", player.getName()).replace("[target]", targetSt));
|
||||
if (aliasObject.adminCommandAsConsole) {
|
||||
T2Ccmd.console(cmd.replace("[player]", player.getName()).replace("[target]", targetSt).replace("[alias]", alias));
|
||||
} else {
|
||||
T2Ccmd.player(player, cmd.replace("[player]", player.getName()).replace("[target]", targetSt));
|
||||
T2Ccmd.player(player, cmd.replace("[player]", player.getName()).replace("[target]", targetSt).replace("[alias]", alias));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void subAliasAdminCommand(SubAliasObject alias, Player player, String[] args) {
|
||||
private static void subAliasAdminCommand(SubAliasObject aliasObject, String alias, Player player, String[] args) {
|
||||
String targetSt = "[target]";
|
||||
try {
|
||||
List<String> results = Arrays.stream(args).filter(a -> a.contains("-p:")).collect(Collectors.toList());
|
||||
@@ -204,20 +259,20 @@ public class ExecuteAlias {
|
||||
} catch (Exception ignored) {
|
||||
|
||||
}
|
||||
for (String cmd : alias.adminCommands) {
|
||||
if (alias.adminBungeeCommand) {
|
||||
if (SelectConfig.Bungee) {
|
||||
BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()).replace("[target]", targetSt), alias.adminCommandAsConsole);
|
||||
for (String cmd : aliasObject.adminCommands) {
|
||||
if (aliasObject.adminBungeeCommand) {
|
||||
if (T2CLibConfig.getBungee()) {
|
||||
BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()).replace("[target]", targetSt).replace("[alias]", alias), aliasObject.adminCommandAsConsole);
|
||||
|
||||
} else {
|
||||
T2Csend.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.");
|
||||
}
|
||||
} else {
|
||||
if (alias.adminCommandAsConsole) {
|
||||
T2Ccmd.console(cmd.replace("[player]", player.getName()).replace("[target]", targetSt));
|
||||
if (aliasObject.adminCommandAsConsole) {
|
||||
T2Ccmd.console(cmd.replace("[player]", player.getName()).replace("[target]", targetSt).replace("[alias]", alias));
|
||||
} else {
|
||||
T2Ccmd.player(player, cmd.replace("[player]", player.getName()).replace("[target]", targetSt));
|
||||
T2Ccmd.player(player, cmd.replace("[player]", player.getName()).replace("[target]", targetSt).replace("[alias]", alias));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -261,7 +316,7 @@ public class ExecuteAlias {
|
||||
}
|
||||
}
|
||||
|
||||
private static void aliasCommand(AliasObject alias, Player player, String[] args) {
|
||||
private static void aliasCommand(AliasObject aliasObject, String alias, Player player, String[] args) {
|
||||
String targetSt = "[target]";
|
||||
try {
|
||||
List<String> results = Arrays.stream(args).filter(a -> a.contains("-p:")).collect(Collectors.toList());
|
||||
@@ -269,20 +324,19 @@ public class ExecuteAlias {
|
||||
} catch (Exception ignored) {
|
||||
|
||||
}
|
||||
for (String cmd : alias.command) {
|
||||
if (alias.bungeeCommand) {
|
||||
if (SelectConfig.Bungee) {
|
||||
BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()).replace("[target]", targetSt), alias.commandAsConsole);
|
||||
|
||||
for (String cmd : aliasObject.command) {
|
||||
if (aliasObject.bungeeCommand) {
|
||||
if (T2CLibConfig.getBungee()) {
|
||||
BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()).replace("[target]", targetSt).replace("[alias]", alias), aliasObject.commandAsConsole);
|
||||
} else {
|
||||
T2Csend.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.");
|
||||
}
|
||||
} else {
|
||||
if (alias.commandAsConsole) {
|
||||
T2Ccmd.console(cmd.replace("[player]", player.getName()).replace("[target]", targetSt));
|
||||
if (aliasObject.commandAsConsole) {
|
||||
T2Ccmd.console(cmd.replace("[player]", player.getName()).replace("[target]", targetSt).replace("[alias]", alias));
|
||||
} else {
|
||||
T2Ccmd.player(player, cmd.replace("[player]", player.getName()).replace("[target]", targetSt));
|
||||
T2Ccmd.player(player, cmd.replace("[player]", player.getName()).replace("[target]", targetSt).replace("[alias]", alias));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -298,7 +352,7 @@ public class ExecuteAlias {
|
||||
}
|
||||
for (String cmd : alias.command) {
|
||||
if (alias.bungeeCommand) {
|
||||
if (SelectConfig.Bungee) {
|
||||
if (T2CLibConfig.getBungee()) {
|
||||
BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()).replace("[target]", targetSt), alias.commandAsConsole);
|
||||
|
||||
} else {
|
||||
|
@@ -55,4 +55,15 @@ public class AliasConfigConverter {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void convertAddCostConfirm(YamlConfiguration yamlConfiguration, File config_gui, Boolean subalias) {
|
||||
if (subalias) {
|
||||
yamlConfiguration.set("SubAlias.Cost.Confirm", false);
|
||||
} else yamlConfiguration.set("Alias.Cost.Confirm", false);
|
||||
try {
|
||||
yamlConfiguration.save(config_gui);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -28,6 +28,7 @@ public class CreateExampleAliasConfig {
|
||||
T2Cconfig.set("Alias.Permission.CustomNoPermissionMSG", "", yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("Alias.Cost.Enable", false,yamlConfiguration);
|
||||
T2Cconfig.set("Alias.Cost.Confirm", true,yamlConfiguration);
|
||||
T2Cconfig.set("Alias.Cost.Price", 0.0,yamlConfiguration);
|
||||
T2Cconfig.set("Alias.Cost.AllowByPass", true,yamlConfiguration);
|
||||
|
||||
@@ -39,7 +40,7 @@ public class CreateExampleAliasConfig {
|
||||
T2Cconfig.set("Alias.Message.Enable", false, yamlConfiguration);
|
||||
T2Cconfig.set("Alias.Message.Messages", Arrays.asList(), yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("Alias.Admin.Enable", true, yamlConfiguration);
|
||||
T2Cconfig.set("Alias.Admin.Enable", false, yamlConfiguration);
|
||||
T2Cconfig.set("Alias.Admin.Permission", "t2code.alias.admin", yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("Alias.Admin.Command.Enable", true, yamlConfiguration);
|
||||
|
@@ -4,11 +4,14 @@ import com.google.common.base.Preconditions;
|
||||
import net.t2code.alias.Spigot.Main;
|
||||
import net.t2code.alias.Spigot.system.AliasRegister;
|
||||
import net.t2code.alias.Spigot.objects.AliasObject;
|
||||
import net.t2code.alias.Spigot.system.BukkitCommandWrap_Useless;
|
||||
import net.t2code.alias.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
@@ -23,6 +26,7 @@ public class SelectAlias {
|
||||
|
||||
Main.aliasHashMap.clear();
|
||||
Main.allAliases.clear();
|
||||
|
||||
File f = new File(Main.getPath() + "/Alias/");
|
||||
File[] fileArray = f.listFiles();
|
||||
for (File config_gui : fileArray) {
|
||||
@@ -62,6 +66,10 @@ public class SelectAlias {
|
||||
String permissionMSG = yamlConfiguration.getString("Alias.Permission.CustomNoPermissionMSG");
|
||||
|
||||
Boolean costEnable = yamlConfiguration.getBoolean("Alias.Cost.Enable");
|
||||
if (yamlConfiguration.get("Alias.Cost.Confirm") == null) {
|
||||
AliasConfigConverter.convertAddCostConfirm(yamlConfiguration, config_gui, false);
|
||||
}
|
||||
Boolean costConfirm = yamlConfiguration.getBoolean("Alias.Cost.Confirm");
|
||||
Double costPrice = yamlConfiguration.getDouble("Alias.Cost.Price");
|
||||
Boolean costAllowBypass = yamlConfiguration.getBoolean("Alias.Cost.AllowByPass");
|
||||
|
||||
@@ -92,7 +100,7 @@ public class SelectAlias {
|
||||
List<String> consoleMessages = yamlConfiguration.getStringList("Alias.Console.Message.Messages");
|
||||
|
||||
Main.allAliases.addAll(aliasList);
|
||||
AliasObject alias = new AliasObject(aliasEnable, aliasList, permNecessary, permission, permissionMSG, costEnable, costPrice, costAllowBypass, commandEnable, commandAsConsole, bungeeCommand,
|
||||
AliasObject alias = new AliasObject(aliasEnable, aliasList, permNecessary, permission, permissionMSG, costEnable, costConfirm, costPrice, costAllowBypass, commandEnable, commandAsConsole, bungeeCommand,
|
||||
command, messageEnable, messages, adminEnable, adminPermission, adminCommandEnable, adminCommandAsConsole, adminBungeeCommand, adminCommands,
|
||||
adminMessageEnable, adminMessages, consoleEnable, consoleCommandEnable, consoleBungeeCommand, consoleCommands, consoleMessageEnable, consoleMessages);
|
||||
for (String al : aliasList) {
|
||||
@@ -101,6 +109,7 @@ public class SelectAlias {
|
||||
T2Csend.console(Prefix + " §aAlias file §e" + config_gui.getName() + " §awas loaded");
|
||||
}
|
||||
}
|
||||
T2Ctemplate.onLoadSeparateStroke(Util.getPrefix());
|
||||
AliasRegister.onRegister();
|
||||
}
|
||||
|
||||
|
@@ -11,7 +11,6 @@ import java.io.IOException;
|
||||
|
||||
public class CreateConfig {
|
||||
|
||||
|
||||
public static void configCreate() {
|
||||
long long_ = System.currentTimeMillis();
|
||||
if (new File(Main.getPath(), "config.yml").exists()) {
|
||||
@@ -21,13 +20,16 @@ public class CreateConfig {
|
||||
File config = new File(Main.getPath(), "config.yml");
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
|
||||
T2Cconfig.set("Plugin.language", "english", yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("BungeeCord.Enable", false, yamlConfiguration);
|
||||
T2Cconfig.set("BungeeCord.ThisServer", "server", yamlConfiguration);
|
||||
T2Cconfig.set("plugin.language", "english", yamlConfiguration);
|
||||
T2Cconfig.set("plugin.updateCheck.onJoin", true, yamlConfiguration);
|
||||
T2Cconfig.set("plugin.updateCheck.seePreReleaseUpdates", true, yamlConfiguration);
|
||||
T2Cconfig.set("plugin.updateCheck.timeInterval", 60, yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("buy.message", true, yamlConfiguration);
|
||||
T2Cconfig.set("buy.currency", "$", yamlConfiguration);
|
||||
T2Cconfig.set("subAlias.tabComplete", true, yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("Buy.Message", true, yamlConfiguration);
|
||||
T2Cconfig.set("SubAlias.TabComplete", true, yamlConfiguration);
|
||||
|
||||
try {
|
||||
yamlConfiguration.save(config);
|
||||
@@ -36,4 +38,30 @@ public class CreateConfig {
|
||||
}
|
||||
T2Csend.console(Util.getPrefix() + " §2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
}
|
||||
|
||||
private static void convert() {
|
||||
File configOld = new File(Main.getPath(), "config.yml");
|
||||
configOld.renameTo(new File(Main.getPath(), "configV3.yml"));
|
||||
configOld = new File(Main.getPath(), "configV3.yml");
|
||||
YamlConfiguration yamlConfigurationOld = YamlConfiguration.loadConfiguration(configOld);
|
||||
|
||||
File config = new File(Main.getPath(), "config.yml");
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
|
||||
T2Cconfig.set("plugin.language", yamlConfigurationOld.getString("Plugin.language"), yamlConfiguration);
|
||||
T2Cconfig.set("plugin.updateCheck.onJoin", yamlConfigurationOld.getBoolean("Plugin.updateCheck.onJoin"), yamlConfiguration);
|
||||
T2Cconfig.set("plugin.updateCheck.seePreReleaseUpdates", yamlConfigurationOld.getBoolean("Plugin.updateCheck.seePreReleaseUpdates"), yamlConfiguration);
|
||||
T2Cconfig.set("plugin.updateCheck.timeInterval", yamlConfigurationOld.getInt("Plugin.updateCheck.timeInterval"), yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("buy.message", yamlConfigurationOld.getBoolean("Buy.Message"), yamlConfiguration);
|
||||
T2Cconfig.set("subAlias.tabComplete", yamlConfigurationOld.getBoolean("SubAlias.TabComplete"), yamlConfiguration);
|
||||
|
||||
try {
|
||||
yamlConfiguration.save(config);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
configCreate();
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package net.t2code.alias.Spigot.config.config;
|
||||
|
||||
import net.t2code.alias.Spigot.Main;
|
||||
import net.t2code.t2codelib.SPIGOT.api.yaml.T2Cconfig;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
@@ -8,14 +9,15 @@ import java.io.IOException;
|
||||
|
||||
public class SelectConfig {
|
||||
private static Integer ConfigVersion = 3;
|
||||
public static Integer isConfigVersion;
|
||||
public static Boolean UpdateCheckOnJoin;
|
||||
public static String language;
|
||||
public static Boolean Bungee;
|
||||
public static String thisServer;
|
||||
private static Integer isConfigVersion;
|
||||
private static Boolean updateCheckOnJoin;
|
||||
private static Boolean updateCheckSeePreReleaseUpdates;
|
||||
private static Integer updateCheckTimeInterval;
|
||||
private static String language;
|
||||
|
||||
public static Boolean buyMessage;
|
||||
public static Boolean subAliasTab;
|
||||
private static Boolean buyMessage;
|
||||
private static String buyCurrency;
|
||||
private static Boolean subAliasTab;
|
||||
|
||||
public static void onSelect() {
|
||||
File config = new File(Main.getPath(), "config.yml");
|
||||
@@ -23,13 +25,15 @@ public class SelectConfig {
|
||||
|
||||
isConfigVersion = yamlConfiguration.getInt("ConfigVersion");
|
||||
|
||||
UpdateCheckOnJoin = yamlConfiguration.getBoolean("Plugin.UpdateCheckOnJoin");
|
||||
language = yamlConfiguration.getString("Plugin.language");
|
||||
Bungee = yamlConfiguration.getBoolean("BungeeCord.Enable");
|
||||
thisServer = yamlConfiguration.getString("BungeeCord.ThisServer");
|
||||
updateCheckOnJoin = yamlConfiguration.getBoolean("plugin.updateCheck.onJoin");
|
||||
updateCheckSeePreReleaseUpdates = yamlConfiguration.getBoolean("plugin.updateCheck.seePreReleaseUpdates");
|
||||
updateCheckTimeInterval = yamlConfiguration.getInt("plugin.updateCheck.timeInterval");
|
||||
|
||||
buyMessage = yamlConfiguration.getBoolean("Buy.Message");
|
||||
subAliasTab = yamlConfiguration.getBoolean("SubAlias.TabComplete");
|
||||
language = yamlConfiguration.getString("plugin.language");
|
||||
|
||||
buyMessage = yamlConfiguration.getBoolean("buy.message");
|
||||
buyCurrency = yamlConfiguration.getString("buy.currency");
|
||||
subAliasTab = yamlConfiguration.getBoolean("subAlias.tabComplete");
|
||||
}
|
||||
public static void setConfigVersion() {
|
||||
File config = new File(Main.getPath(), "config.yml");
|
||||
@@ -41,4 +45,41 @@ public class SelectConfig {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static Integer getConfigVersion() {
|
||||
return ConfigVersion;
|
||||
}
|
||||
|
||||
public static Integer getIsConfigVersion() {
|
||||
return isConfigVersion;
|
||||
}
|
||||
|
||||
public static Boolean getUpdateCheckOnJoin() {
|
||||
return updateCheckOnJoin;
|
||||
}
|
||||
|
||||
public static Boolean getUpdateCheckSeePreReleaseUpdates() {
|
||||
return updateCheckSeePreReleaseUpdates;
|
||||
}
|
||||
|
||||
public static Integer getUpdateCheckTimeInterval() {
|
||||
return updateCheckTimeInterval;
|
||||
}
|
||||
|
||||
public static String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
|
||||
public static Boolean getBuyMessage() {
|
||||
return buyMessage;
|
||||
}
|
||||
|
||||
public static String getBuyCurrency() {
|
||||
return buyCurrency;
|
||||
}
|
||||
|
||||
public static Boolean getSubAliasTab() {
|
||||
return subAliasTab;
|
||||
}
|
||||
}
|
||||
|
@@ -32,6 +32,9 @@ public class LanguagesCreate {
|
||||
T2Cconfig.set("Plugin.NoSubCommand", MSG.EN_NoSubCommand, yamlConfigurationEN);
|
||||
|
||||
T2Cconfig. set("Cost.Buy", MSG.EN_Buy, yamlConfigurationEN);
|
||||
T2Cconfig. set("Cost.BuyConfirm", MSG.EN_BuyConfirm, yamlConfigurationEN);
|
||||
T2Cconfig. set("Cost.BuyCancel", MSG.EN_BuyCancel, yamlConfigurationEN);
|
||||
T2Cconfig. set("Cost.BuyConfirmNotPossible", MSG.EN_BuyConfirmNotPossible, yamlConfigurationEN);
|
||||
T2Cconfig.set("Cost.NoMoney", MSG.EN_NoMoney, yamlConfigurationEN);
|
||||
|
||||
try {
|
||||
@@ -59,6 +62,9 @@ public class LanguagesCreate {
|
||||
T2Cconfig.set("Plugin.NoSubCommand", MSG.DE_NoSubCommand, yamlConfigurationDE);
|
||||
|
||||
T2Cconfig.set("Cost.Buy", MSG.DE_Buy, yamlConfigurationDE);
|
||||
T2Cconfig.set("Cost.BuyConfirm", MSG.DE_BuyConfirm, yamlConfigurationDE);
|
||||
T2Cconfig.set("Cost.BuyCancel", MSG.DE_BuyCancel, yamlConfigurationDE);
|
||||
T2Cconfig.set("Cost.BuyConfirmNotPossible", MSG.DE_BuyConfirmNotPossible, yamlConfigurationDE);
|
||||
T2Cconfig.set("Cost.NoMoney", MSG.DE_NoMoney, yamlConfigurationDE);
|
||||
|
||||
try {
|
||||
|
@@ -25,6 +25,10 @@ public class MSG {
|
||||
public static String EN_NoPermissionForCommand = "[prefix] <red>For <aqua>[cmd]</aqua> you lack the permission <gold>[perm]</gold>!</red>";
|
||||
|
||||
public static String EN_Buy = "[prefix] <dark_green>You have paid <gold>[price]</gold> for this command.</dark_green>";
|
||||
public static String EN_BuyConfirm = "[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>";
|
||||
public static String EN_BuyCancel = "[prefix] <gold>The command was canceled and you do not have to pay anything!</gold>";
|
||||
public static String EN_BuyConfirmNotPossible = "[prefix] <gold>Confirmation not possible, you have not executed a payable command.</gold>";
|
||||
public static String EN_NoMoney = "[prefix] <red>You don't have enough money for this command!</red>";
|
||||
public static String EN_NoSubCommand = "[prefix] <red>This command does not exist!</red>";
|
||||
|
||||
@@ -40,6 +44,10 @@ public class MSG {
|
||||
public static String DE_NoPermissionForCommand = "[prefix] <red>F[ue]r <aqua>[cmd]</aqua> fehlt dir die Permission <gold>[perm]</gold>!</red>";
|
||||
|
||||
public static String DE_Buy = "[prefix] <dark_green>Du hast f[ue]r diesen Command <gold>[price]</gold> bezahlt.</dark_green>";
|
||||
public static String DE_BuyConfirm = "[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>";
|
||||
public static String DE_BuyCancel = "[prefix] <gold>Der befehl wurde abgebrochen und du musst nichts bezahlen!</gold>";
|
||||
public static String DE_BuyConfirmNotPossible = "[prefix] <gold>Bestätigen nicht möglich, du hast keinen bezahlungspflichtigen befehl ausgeführt.</gold>";
|
||||
public static String DE_NoMoney = "[prefix] <red>Du hast nicht gen[ue]gend Geld für diesen Command!</red>";
|
||||
|
||||
public static String DE_NoSubCommand = "[prefix] <red>Diesen Befehl gibt es nicht!</red>";
|
||||
|
@@ -21,6 +21,9 @@ public class SelectMessages {
|
||||
public static String aliasDisabled;
|
||||
|
||||
public static String buy;
|
||||
public static String buyConfirm;
|
||||
public static String buyCancel;
|
||||
public static String buyConfirmNotPossible;
|
||||
public static String noMoney;
|
||||
|
||||
|
||||
@@ -31,17 +34,17 @@ public class SelectMessages {
|
||||
|
||||
File msg;
|
||||
|
||||
msg = new File(Main.getPath(), "languages/" + SelectConfig.language + "_messages.yml");
|
||||
msg = new File(Main.getPath(), "languages/" + SelectConfig.getLanguage() + "_messages.yml");
|
||||
if (!msg.isFile()) {
|
||||
T2Csend.console(Prefix);
|
||||
T2Csend.console(Prefix + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
T2Csend.console(Prefix + " §4The selected §c" + SelectConfig.language + " §4language file was not found.");
|
||||
T2Csend.console(Prefix + " §4The selected §c" + SelectConfig.getLanguage() + " §4language file was not found.");
|
||||
T2Csend.console(Prefix + " §6The default language §eEnglish §6is used!");
|
||||
T2Csend.console(Prefix + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
T2Csend.console(Prefix);
|
||||
msg = new File(Main.getPath(), "languages/" + "english_messages.yml");
|
||||
selectMSG = "english";
|
||||
} else selectMSG = SelectConfig.language;
|
||||
} else selectMSG = SelectConfig.getLanguage();
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(msg);
|
||||
|
||||
if (yamlConfiguration.get("Plugin.Prefix") != null) {
|
||||
@@ -54,6 +57,9 @@ public class SelectMessages {
|
||||
noPermissionForCommand = replace(yamlConfiguration.getString("Plugin.ForCommand"));
|
||||
noSubCommand = replace(yamlConfiguration.getString("Plugin.NoSubCommand"));
|
||||
buy = replace(yamlConfiguration.getString("Cost.Buy"));
|
||||
buyConfirm = replace(yamlConfiguration.getString("Cost.BuyConfirm"));
|
||||
buyCancel = replace(yamlConfiguration.getString("Cost.BuyCancel"));
|
||||
buyConfirmNotPossible = replace(yamlConfiguration.getString("Cost.BuyConfirmNotPossible"));
|
||||
noMoney = replace(yamlConfiguration.getString("Cost.NoMoney"));
|
||||
|
||||
T2Csend.console(Prefix + " §2Language successfully selected to: §6" + selectMSG + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
|
@@ -29,6 +29,7 @@ public class CreateExampleSubAliasConfig {
|
||||
T2Cconfig.set("SubAlias.Permission.CustomNoPermissionMSG", "", yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("SubAlias.Cost.Enable", false, yamlConfiguration);
|
||||
T2Cconfig.set("SubAlias.Cost.Confirm", true,yamlConfiguration);
|
||||
T2Cconfig.set("SubAlias.Cost.Price", 0.0, yamlConfiguration);
|
||||
T2Cconfig.set("SubAlias.Cost.AllowByPass", true, yamlConfiguration);
|
||||
|
||||
@@ -40,7 +41,7 @@ public class CreateExampleSubAliasConfig {
|
||||
T2Cconfig.set("SubAlias.Message.Enable", false, yamlConfiguration);
|
||||
T2Cconfig.set("SubAlias.Message.Messages",Arrays.asList(), yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("SubAlias.Admin.Enable", true, yamlConfiguration);
|
||||
T2Cconfig.set("SubAlias.Admin.Enable", false, yamlConfiguration);
|
||||
T2Cconfig.set("SubAlias.Admin.Permission", "t2code.alias.admin", yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("SubAlias.Admin.Command.Enable", true, yamlConfiguration);
|
||||
|
@@ -67,6 +67,10 @@ public class SelectSubAlias {
|
||||
String permissionMSG = yamlConfiguration.getString("SubAlias.Permission.CustomNoPermissionMSG");
|
||||
|
||||
Boolean costEnable = yamlConfiguration.getBoolean("SubAlias.Cost.Enable");
|
||||
if (yamlConfiguration.get("SubAlias.Cost.Confirm") == null) {
|
||||
AliasConfigConverter.convertAddCostConfirm(yamlConfiguration, config_gui, true);
|
||||
}
|
||||
Boolean costConfirm = yamlConfiguration.getBoolean("SubAlias.Cost.Confirm");
|
||||
Double costPrice = yamlConfiguration.getDouble("SubAlias.Cost.Price");
|
||||
Boolean costAllowBypass = yamlConfiguration.getBoolean("SubAlias.Cost.AllowByPass");
|
||||
|
||||
@@ -96,7 +100,7 @@ public class SelectSubAlias {
|
||||
Boolean consoleMessageEnable = yamlConfiguration.getBoolean("SubAlias.Console.Message.Enable");
|
||||
List<String> consoleMessages = yamlConfiguration.getStringList("SubAlias.Console.Message.Messages");
|
||||
|
||||
SubAliasObject subAlias = new SubAliasObject(aliasEnable, subAliasList, subAliasFor, subAliasArg, permNecessary, permission, permissionMSG, costEnable, costPrice, costAllowBypass, commandEnable, commandAsConsole, bungeeCommand,
|
||||
SubAliasObject subAlias = new SubAliasObject(aliasEnable, subAliasList, subAliasFor, subAliasArg, permNecessary, permission, permissionMSG, costEnable,costConfirm, costPrice, costAllowBypass, commandEnable, commandAsConsole, bungeeCommand,
|
||||
command, messageEnable, messages, adminEnable, adminPermission, adminCommandEnable, adminCommandAsConsole, adminBungeeCommand, adminCommands,
|
||||
adminMessageEnable, adminMessages, consoleEnable, consoleCommandEnable, consoleBungeeCommand, consoleCommands, consoleMessageEnable, consoleMessages);
|
||||
for (String sal : subAliasList) {
|
||||
|
@@ -0,0 +1,24 @@
|
||||
package net.t2code.alias.Spigot.listener;
|
||||
|
||||
import net.t2code.alias.Spigot.Main;
|
||||
import net.t2code.alias.Spigot.cmdManagement.ExecuteAlias;
|
||||
import net.t2code.alias.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
public class PluginEvents implements Listener {
|
||||
@EventHandler
|
||||
public void onJoinEvent(PlayerQuitEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
ExecuteAlias.aliasStorage.remove(player.getUniqueId());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onJoinEvent(PlayerLoginEvent event) {
|
||||
T2CupdateAPI.join(Main.getPlugin(), Util.getPrefix(), "t2code.alias.updatemsg", event.getPlayer(), Util.getSpigotID(), Util.getDiscord());
|
||||
}
|
||||
}
|
@@ -11,6 +11,7 @@ public class AliasObject {
|
||||
public String permissionMSG;
|
||||
|
||||
public Boolean costEnable;
|
||||
public Boolean costConfirm;
|
||||
public Double costPrice;
|
||||
public Boolean costAllowBypass;
|
||||
|
||||
@@ -44,6 +45,7 @@ public class AliasObject {
|
||||
String permissionMSG,
|
||||
|
||||
Boolean costEnable,
|
||||
Boolean costConfirm,
|
||||
Double costPrice,
|
||||
Boolean costAllowBypass,
|
||||
|
||||
@@ -76,6 +78,7 @@ public class AliasObject {
|
||||
this.permissionMSG = permissionMSG;
|
||||
|
||||
this.costEnable = costEnable;
|
||||
this.costConfirm = costConfirm;
|
||||
this.costPrice = costPrice;
|
||||
this.costAllowBypass = costAllowBypass;
|
||||
|
||||
|
@@ -0,0 +1,15 @@
|
||||
package net.t2code.alias.Spigot.objects;
|
||||
|
||||
public class AliasStorageObject {
|
||||
public Object aliasObject;
|
||||
public String alias;
|
||||
public String[] args;
|
||||
public boolean sub;
|
||||
|
||||
public AliasStorageObject( Object aliasObject, String alias, String[] args, boolean sub) {
|
||||
this.aliasObject = aliasObject;
|
||||
this.alias = alias;
|
||||
this.args = args;
|
||||
this.sub=sub;
|
||||
}
|
||||
}
|
@@ -13,6 +13,7 @@ public class SubAliasObject {
|
||||
public String permissionMSG;
|
||||
|
||||
public Boolean costEnable;
|
||||
public Boolean costConfirm;
|
||||
public Double costPrice;
|
||||
public Boolean costAllowBypass;
|
||||
|
||||
@@ -48,6 +49,7 @@ public class SubAliasObject {
|
||||
String permissionMSG,
|
||||
|
||||
Boolean costEnable,
|
||||
Boolean costConfirm,
|
||||
Double costPrice,
|
||||
Boolean costAllowBypass,
|
||||
|
||||
@@ -82,6 +84,7 @@ public class SubAliasObject {
|
||||
this.permissionMSG = permissionMSG;
|
||||
|
||||
this.costEnable = costEnable;
|
||||
this.costConfirm = costConfirm;
|
||||
this.costPrice = costPrice;
|
||||
this.costAllowBypass = costAllowBypass;
|
||||
|
||||
|
@@ -2,28 +2,89 @@ package net.t2code.alias.Spigot.system;
|
||||
|
||||
import net.t2code.alias.Spigot.Main;
|
||||
import net.t2code.alias.Spigot.cmdManagement.RegisterCommands;
|
||||
import net.t2code.alias.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandMap;
|
||||
import org.bukkit.command.SimpleCommandMap;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.SimplePluginManager;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
public class AliasRegister {
|
||||
public static void onRegister() {
|
||||
for (String alias : Main.allAliases) {
|
||||
if (Main.aliasHashMap.get(alias) != null) {
|
||||
if (alias.equals(" ")) continue;
|
||||
if (Main.aliasHashMap.get(alias).aliasEnable) {
|
||||
try {
|
||||
final Field bukkitCommandMap = Bukkit.getServer().getClass().getDeclaredField("commandMap");
|
||||
bukkitCommandMap.setAccessible(true);
|
||||
CommandMap commandMap = (CommandMap) bukkitCommandMap.get(Bukkit.getServer());
|
||||
commandMap.register(alias, new RegisterCommands(alias));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
} else T2Csend.warning(Main.getPlugin(), " §4AliasHashmap is null! - " + alias);
|
||||
try {
|
||||
final Field bukkitCommandMap = Bukkit.getServer().getClass().getDeclaredField("commandMap");
|
||||
bukkitCommandMap.setAccessible(true);
|
||||
CommandMap commandMap = (CommandMap) bukkitCommandMap.get(Bukkit.getServer());
|
||||
// onUnRegister(bukkitCommandMap);
|
||||
for (String alias : Main.allAliases) {
|
||||
register(alias, commandMap);
|
||||
// wrap(alias, commandMap);
|
||||
}
|
||||
|
||||
|
||||
if (!(T2CmcVersion.isMc1_8() || T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12())) {
|
||||
Main.getPlugin().getBukkitCommandWrap().sync();
|
||||
if (Bukkit.getOnlinePlayers().size() >= 1)
|
||||
for (Player player : Bukkit.getOnlinePlayers()) player.updateCommands();
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
//public static void onUnRegister(Field bukkitCommandMap) throws IllegalAccessException {
|
||||
//
|
||||
// // if (Main.allAliases != null && !Main.allAliases.isEmpty()) {
|
||||
// // if (!(Main.getPlugin().getBukkitCommandWrap() instanceof BukkitCommandWrap_Useless)) {
|
||||
// // for (String alias : Main.allAliases) {
|
||||
// // T2Csend.debugmsg(Main.getPlugin(),"uload: " + alias);
|
||||
// // Main.getPlugin().
|
||||
// // Main.getPlugin().getBukkitCommandWrap().unwrap(alias);
|
||||
// // }
|
||||
// // Main.getPlugin().getBukkitCommandWrap().sync();
|
||||
// // if (Bukkit.getOnlinePlayers().size() >= 1)
|
||||
// // for (Player player : Bukkit.getOnlinePlayers()) player.updateCommands();
|
||||
// // }
|
||||
// // }
|
||||
// // commandMap.clearCommands();
|
||||
//
|
||||
//
|
||||
// for (Map.Entry<String, Boolean> entry : Main.loadAliasHashMap.entrySet()) {
|
||||
// ((SimpleCommandMap) bukkitCommandMap.get(simplePluginManager)).getCommand(entry.getKey()).unregister(bukkitCommandMap.get(Bukkit.getServer()));
|
||||
//
|
||||
//
|
||||
// if (entry.getValue())
|
||||
// Main.getPlugin().getBukkitCommandWrap().unwrap(entry.getKey());
|
||||
// }
|
||||
//
|
||||
// Main.getPlugin().getBukkitCommandWrap().sync();
|
||||
// if (Bukkit.getOnlinePlayers().size() >= 1)
|
||||
// for (Player player : Bukkit.getOnlinePlayers()) player.updateCommands();
|
||||
// Main.loadAliasHashMap.clear();
|
||||
//
|
||||
//}
|
||||
|
||||
private static void register(String alias, CommandMap commandMap) {
|
||||
if (Main.aliasHashMap.get(alias) != null) {
|
||||
if (alias.equals(" ")) return;
|
||||
if (Main.aliasHashMap.get(alias).aliasEnable) {
|
||||
commandMap.register(alias, new RegisterCommands(alias));
|
||||
T2Csend.console(Util.getPrefix() + " §aAlias §e" + alias + " §aregister");
|
||||
Main.loadAliasHashMap.put(alias, true);
|
||||
} else Main.loadAliasHashMap.put(alias, false);
|
||||
} else T2Csend.warning(Main.getPlugin(), " §4AliasHashmap is null! - " + alias);
|
||||
}
|
||||
|
||||
private static void wrap(String alias, CommandMap commandMap) {
|
||||
Command cmd = commandMap.getCommand(alias);
|
||||
Main.getPlugin().getBukkitCommandWrap().wrap(cmd, alias);
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,247 @@
|
||||
package net.t2code.alias.Spigot.system;
|
||||
|
||||
import com.mojang.brigadier.tree.CommandNode;
|
||||
import com.mojang.brigadier.tree.RootCommandNode;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class BukkitCommandWrap {
|
||||
private Field bField;
|
||||
private Method removeCommandMethod;
|
||||
private String nmsVersion;
|
||||
private Class minecraftServerClass;
|
||||
private Method aMethod;
|
||||
private Method getServerMethod;
|
||||
private Field vanillaCommandDispatcherField;
|
||||
private Method getCommandDispatcherMethod;
|
||||
private Method registerMethod;
|
||||
private Method syncCommandsMethod;
|
||||
private Constructor bukkitcommandWrapperConstructor;
|
||||
|
||||
public BukkitCommandWrap() {
|
||||
try {
|
||||
this.nmsVersion = Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3];
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
e.printStackTrace();
|
||||
this.nmsVersion = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void wrap(Command command, String alias) {
|
||||
if (this.nmsVersion == null) return;
|
||||
if (this.minecraftServerClass == null) try {
|
||||
this.minecraftServerClass = Class.forName("net.minecraft.server." + this.nmsVersion + ".MinecraftServer");
|
||||
} catch (ClassNotFoundException e) {
|
||||
try {
|
||||
this.minecraftServerClass = Class.forName("net.minecraft.server.MinecraftServer");
|
||||
} catch (ClassNotFoundException classNotFoundException) {
|
||||
classNotFoundException.addSuppressed(e);
|
||||
classNotFoundException.printStackTrace();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.getServerMethod == null) try {
|
||||
this.getServerMethod = this.minecraftServerClass.getMethod("getServer");
|
||||
this.getServerMethod.setAccessible(true);
|
||||
} catch (NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
Object minecraftServer;
|
||||
try {
|
||||
minecraftServer = this.getServerMethod.invoke(this.minecraftServerClass);
|
||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.vanillaCommandDispatcherField == null) try {
|
||||
this.vanillaCommandDispatcherField = this.minecraftServerClass.getDeclaredField("vanillaCommandDispatcher");
|
||||
this.vanillaCommandDispatcherField.setAccessible(true);
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
Object commandDispatcher = null;
|
||||
try {
|
||||
commandDispatcher = this.vanillaCommandDispatcherField.get(minecraftServer);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.bField == null) try {
|
||||
this.bField = Class.forName("net.minecraft.commands.CommandDispatcher").getDeclaredField("g");
|
||||
this.bField.setAccessible(true);
|
||||
} catch (NoSuchFieldException | ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
com.mojang.brigadier.CommandDispatcher b;
|
||||
try {
|
||||
b = (com.mojang.brigadier.CommandDispatcher) this.bField.get(commandDispatcher);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.aMethod == null) try {
|
||||
this.aMethod = commandDispatcher.getClass().getDeclaredMethod("a");
|
||||
this.aMethod.setAccessible(true);
|
||||
} catch (NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.bukkitcommandWrapperConstructor == null) try {
|
||||
this.bukkitcommandWrapperConstructor = Class.forName("org.bukkit.craftbukkit." + this.nmsVersion + ".command.BukkitCommandWrapper").getDeclaredConstructor(Class.forName("org.bukkit.craftbukkit." + this.nmsVersion + ".CraftServer"), Command.class);
|
||||
this.bukkitcommandWrapperConstructor.setAccessible(true);
|
||||
} catch (NoSuchMethodException | ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
Object commandWrapper;
|
||||
|
||||
try {
|
||||
commandWrapper = this.bukkitcommandWrapperConstructor.newInstance(Bukkit.getServer(), command);
|
||||
} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
Object a;
|
||||
|
||||
try {
|
||||
a = this.aMethod.invoke(commandDispatcher);
|
||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.registerMethod == null) try {
|
||||
this.registerMethod = Class.forName("org.bukkit.craftbukkit." + this.nmsVersion + ".command.BukkitCommandWrapper").getMethod("register", com.mojang.brigadier.CommandDispatcher.class, String.class);
|
||||
this.registerMethod.setAccessible(true);
|
||||
} catch (NoSuchMethodException | ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
this.registerMethod.invoke(commandWrapper, a, alias);
|
||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void sync() {
|
||||
if (this.syncCommandsMethod == null) try {
|
||||
this.syncCommandsMethod = Class.forName("org.bukkit.craftbukkit." + this.nmsVersion + ".CraftServer").getDeclaredMethod("syncCommands");
|
||||
this.syncCommandsMethod.setAccessible(true);
|
||||
} catch (NoSuchMethodException | ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
this.syncCommandsMethod.invoke(Bukkit.getServer());
|
||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void unwrap(String command) {
|
||||
if (this.nmsVersion == null) return;
|
||||
if (this.minecraftServerClass == null) try {
|
||||
this.minecraftServerClass = Class.forName("net.minecraft.server." + this.nmsVersion + ".MinecraftServer");
|
||||
} catch (ClassNotFoundException e) {
|
||||
try {
|
||||
this.minecraftServerClass = Class.forName("net.minecraft.server.MinecraftServer");
|
||||
} catch (ClassNotFoundException classNotFoundException) {
|
||||
classNotFoundException.printStackTrace();
|
||||
classNotFoundException.addSuppressed(e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (this.getServerMethod == null) try {
|
||||
this.getServerMethod = this.minecraftServerClass.getMethod("getServer");
|
||||
this.getServerMethod.setAccessible(true);
|
||||
} catch (NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
Object server;
|
||||
|
||||
try {
|
||||
server = this.getServerMethod.invoke(this.minecraftServerClass);
|
||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.vanillaCommandDispatcherField == null) try {
|
||||
this.vanillaCommandDispatcherField = this.minecraftServerClass.getDeclaredField("vanillaCommandDispatcher");
|
||||
this.vanillaCommandDispatcherField.setAccessible(true);
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
Object commandDispatcher = null;
|
||||
try {
|
||||
commandDispatcher = this.vanillaCommandDispatcherField.get(server);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.bField == null) try {
|
||||
this.bField = Class.forName("net.minecraft.server." + this.nmsVersion + ".CommandDispatcher").getDeclaredField("b");
|
||||
this.bField.setAccessible(true);
|
||||
} catch (NoSuchFieldException | ClassNotFoundException e) {
|
||||
if (this.bField == null) try {
|
||||
this.bField = Class.forName("net.minecraft.commands.CommandDispatcher").getDeclaredField("g");
|
||||
this.bField.setAccessible(true);
|
||||
} catch (NoSuchFieldException | ClassNotFoundException ex) {
|
||||
ex.addSuppressed(e);
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
com.mojang.brigadier.CommandDispatcher b;
|
||||
try {
|
||||
b = (com.mojang.brigadier.CommandDispatcher) this.bField.get(commandDispatcher);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.removeCommandMethod == null) try {
|
||||
try {
|
||||
this.removeCommandMethod = RootCommandNode.class.getDeclaredMethod("removeCommand", String.class);
|
||||
} catch (NoSuchMethodException | NoSuchMethodError ex) {
|
||||
this.removeCommandMethod = CommandNode.class.getDeclaredMethod("removeCommand", String.class);
|
||||
}
|
||||
} catch (NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
this.removeCommandMethod.invoke(b.getRoot(), command);
|
||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,17 @@
|
||||
package net.t2code.alias.Spigot.system;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
|
||||
public class BukkitCommandWrap_Useless extends BukkitCommandWrap {
|
||||
|
||||
public BukkitCommandWrap_Useless() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wrap(Command command, String alias) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unwrap(String command) {
|
||||
}
|
||||
}
|
@@ -1,18 +0,0 @@
|
||||
// This claas was created by JaTiTV
|
||||
|
||||
package net.t2code.alias.Spigot.system;
|
||||
|
||||
import net.t2code.alias.Spigot.Main;
|
||||
import net.t2code.alias.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
|
||||
public class JoinEvent implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onJoinEvent(PlayerLoginEvent event) {
|
||||
T2CupdateAPI.join(Main.getPlugin(),Util.getPrefix(), "t2code.alias.updatemsg", event.getPlayer(), Util.getSpigotID(), Util.getDiscord());
|
||||
}
|
||||
}
|
@@ -10,26 +10,29 @@ import net.t2code.alias.Spigot.config.languages.LanguagesCreate;
|
||||
import net.t2code.alias.Spigot.config.languages.SelectMessages;
|
||||
import net.t2code.alias.Spigot.config.subAlias.CreateExampleSubAliasConfig;
|
||||
import net.t2code.alias.Spigot.config.subAlias.SelectSubAlias;
|
||||
import net.t2code.alias.Spigot.listener.PluginEvents;
|
||||
import net.t2code.alias.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
||||
import net.t2code.t2codelib.SPIGOT.api.register.T2Cregister;
|
||||
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
|
||||
import net.t2code.t2codelib.SPIGOT.api.yaml.T2CLibConfig;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
public class Load {
|
||||
private static Main plugin = Main.getPlugin();
|
||||
private static final Main plugin = Main.getPlugin();
|
||||
|
||||
public static void onLoad(String prefix, List autor, String version, String spigot, int spigotID, String discord, int bstatsID) {
|
||||
public static void onLoad(String prefix, List<String> autor, String version, String spigot, String discord, int bstatsID) {
|
||||
Long long_ = T2Ctemplate.onLoadHeader(prefix, autor, version, spigot, discord);
|
||||
plugin.getCommand("t2code-alias").setExecutor(new AliasCmdExecuter());
|
||||
loadReload();
|
||||
T2CupdateAPI.onUpdateCheck(plugin, prefix, spigotID, discord);
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new JoinEvent(), plugin);
|
||||
T2CupdateAPI.onUpdateCheck(plugin, prefix, Util.getGit(), Util.getSpigotID(), Util.getDiscord(),
|
||||
SelectConfig.getUpdateCheckOnJoin(), SelectConfig.getUpdateCheckSeePreReleaseUpdates(), SelectConfig.getUpdateCheckTimeInterval());
|
||||
|
||||
T2Ctemplate.onLoadFooter(prefix, long_, version);
|
||||
T2Cregister.listener(new PluginEvents(), plugin);
|
||||
Metrics.Bstats(plugin, bstatsID);
|
||||
}
|
||||
|
||||
@@ -65,11 +68,11 @@ public class Load {
|
||||
T2Ctemplate.onLoadSeparateStroke(Util.getPrefix());
|
||||
SelectSubAlias.onSelect();
|
||||
SelectConfig.setConfigVersion();
|
||||
if (SelectConfig.subAliasTab) {
|
||||
if (SelectConfig.getSubAliasTab()) {
|
||||
T2Cregister.listener(new TabEvent(), plugin);
|
||||
}
|
||||
|
||||
if (SelectConfig.Bungee) {
|
||||
if (T2CLibConfig.getBungee()) {
|
||||
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "t2c:bcmd");
|
||||
}
|
||||
AliasRegisterPermissions.onPermRegister();
|
||||
|
@@ -3,7 +3,6 @@
|
||||
|
||||
package net.t2code.alias.Spigot.system;
|
||||
|
||||
import net.t2code.alias.Spigot.Main;
|
||||
import net.t2code.alias.Spigot.config.config.SelectConfig;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
@@ -34,7 +33,6 @@ public class Metrics {
|
||||
public static void Bstats(Plugin plugin, int bstatsID) {
|
||||
int pluginId = bstatsID; // <-- Replace with the id of your plugin!
|
||||
Metrics metrics = new Metrics((JavaPlugin) plugin, pluginId);
|
||||
metrics.addCustomChart(new SimplePie("updatecheckonjoin", () -> String.valueOf(SelectConfig.UpdateCheckOnJoin)));
|
||||
}
|
||||
|
||||
private final Plugin plugin;
|
||||
|
@@ -8,7 +8,7 @@ public class Util {
|
||||
}
|
||||
|
||||
public static String getRequiredT2CodeLibVersion() {
|
||||
return "13.0";
|
||||
return "13.4";
|
||||
}
|
||||
|
||||
public static String getPrefix() {
|
||||
@@ -19,6 +19,10 @@ public class Util {
|
||||
return 96389;
|
||||
}
|
||||
|
||||
public static String getGit() {
|
||||
return "JaTiTV/T2Code-Alias";
|
||||
}
|
||||
|
||||
public static Integer getBstatsID() {
|
||||
return 12517;
|
||||
}
|
||||
|
@@ -74,7 +74,7 @@ Alias:
|
||||
# Player with Admin Perm: /server CityBuild
|
||||
Admin:
|
||||
# Here you can enable or disable the admin function
|
||||
Enable: true
|
||||
Enable: false
|
||||
# Here you set the permission for the admin function
|
||||
Permission: t2code.alias.admin
|
||||
Command:
|
||||
|
@@ -73,7 +73,7 @@ SubAlias:
|
||||
# Player with Admin Perm: /server CityBuild
|
||||
Admin:
|
||||
# Here you can enable or disable the admin function
|
||||
Enable: true
|
||||
Enable: false
|
||||
# Here you set the permission for the admin function
|
||||
Permission: t2code.alias.admin
|
||||
Command:
|
||||
|
Reference in New Issue
Block a user