1.2.0 Dev

Added an option for players to confirm when an alias costs. (Per alias adjustable)
This commit is contained in:
JaTiTV 2023-05-03 22:35:46 +02:00
parent 1ae32b2b59
commit 546b827e02
18 changed files with 218 additions and 17 deletions

View File

@ -6,7 +6,11 @@
<groupId>net.t2code</groupId> <groupId>net.t2code</groupId>
<artifactId>Alias</artifactId> <artifactId>Alias</artifactId>
<<<<<<< Updated upstream
<version>1.1.7</version> <version>1.1.7</version>
=======
<version>1.2.0_DEV-1</version>
>>>>>>> Stashed changes
<packaging>jar</packaging> <packaging>jar</packaging>
<name>T2C-Alias</name> <name>T2C-Alias</name>
@ -19,6 +23,10 @@
<url>T2Code.net</url> <url>T2Code.net</url>
<build> <build>
<<<<<<< Updated upstream
=======
<finalName>${project.name}_${project.version}</finalName>
>>>>>>> Stashed changes
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>

View File

@ -34,6 +34,12 @@ public class AliasCmdExecuter implements CommandExecutor, TabCompleter {
} else T2Csend.sender(sender, SelectMessages.noPermissionForCommand.replace("[cmd]", "/t2code-alias reload") } else T2Csend.sender(sender, SelectMessages.noPermissionForCommand.replace("[cmd]", "/t2code-alias reload")
.replace("[perm]", "t2code.alias.command.reload")); .replace("[perm]", "t2code.alias.command.reload"));
break; break;
case "confirm":
ExecuteAlias.storage(sender, true);
break;
case "cancel":
ExecuteAlias.storage(sender, false);
break;
case "info": case "info":
case "plugin": case "plugin":
case "version": case "version":

View File

@ -3,6 +3,7 @@ package net.t2code.alias.Spigot.cmdManagement;
import net.t2code.alias.Spigot.config.config.SelectConfig; import net.t2code.alias.Spigot.config.config.SelectConfig;
import net.t2code.alias.Spigot.config.languages.SelectMessages; import net.t2code.alias.Spigot.config.languages.SelectMessages;
import net.t2code.alias.Spigot.objects.AliasObject; 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.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;
@ -11,16 +12,46 @@ import net.t2code.t2codelib.SPIGOT.api.eco.T2Ceco;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace; import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend; import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.plugins.T2CpluginCheck; import net.t2code.t2codelib.SPIGOT.api.plugins.T2CpluginCheck;
<<<<<<< Updated upstream
=======
import net.t2code.t2codelib.SPIGOT.api.yaml.T2CLibConfig;
>>>>>>> Stashed changes
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class ExecuteAlias { public class ExecuteAlias {
public static HashMap<UUID, AliasStorageObject> aliasStorage = new HashMap<>();
private static final String prefix = Util.getPrefix(); 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) { protected static void aliasPlayer(CommandSender sender, AliasObject aliasObject, String alias, String[] args) {
Player player = (Player) sender; Player player = (Player) sender;
@ -47,13 +78,26 @@ public class ExecuteAlias {
return; 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.costEnable) {
if (!(aliasObject.costAllowBypass && player.hasPermission("t2code.alias.buy.bypass"))) { if (!(aliasObject.costAllowBypass && player.hasPermission("t2code.alias.buy.bypass"))) {
if (!T2Ceco.moneyRemove(prefix, player, aliasObject.costPrice)) { if (!T2Ceco.moneyRemove(prefix, player, aliasObject.costPrice)) {
T2Csend.player(player, SelectMessages.noMoney); T2Csend.player(player, SelectMessages.noMoney);
return; return;
} }
if (SelectConfig.getBuyMessage()) 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) { if (aliasObject.commandEnable) {
@ -96,13 +140,31 @@ public class ExecuteAlias {
return; 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, true));
return;
}
}
executeSubAlias(player, aliasObject, alias, args);
} else {
if (aliasObject.consoleEnable) {
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.costEnable) {
if (!(aliasObject.costAllowBypass && player.hasPermission("t2code.alias.buy.bypass"))) { if (!(aliasObject.costAllowBypass && player.hasPermission("t2code.alias.buy.bypass"))) {
if (!T2Ceco.moneyRemove(prefix, player, aliasObject.costPrice)) { if (!T2Ceco.moneyRemove(prefix, player, aliasObject.costPrice)) {
T2Csend.player(player, SelectMessages.noMoney); T2Csend.player(player, SelectMessages.noMoney);
return; return;
} }
if (SelectConfig.getBuyMessage()) 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) { if (aliasObject.commandEnable) {
@ -111,11 +173,6 @@ public class ExecuteAlias {
if (aliasObject.messageEnable) { if (aliasObject.messageEnable) {
subAliasMessage(aliasObject, alias, player, args); subAliasMessage(aliasObject, alias, player, args);
} }
} else {
if (aliasObject.consoleEnable) {
subAliasConsole(aliasObject,alias, sender, args);
} else T2Csend.sender(sender, SelectMessages.onlyForPlayer);
}
} }
protected static void aliasConsole(AliasObject alias, CommandSender sender, String prefix) { protected static void aliasConsole(AliasObject alias, CommandSender sender, String prefix) {

View File

@ -55,4 +55,15 @@ public class AliasConfigConverter {
e.printStackTrace(); 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();
}
}
} }

View File

@ -28,6 +28,7 @@ public class CreateExampleAliasConfig {
T2Cconfig.set("Alias.Permission.CustomNoPermissionMSG", "", yamlConfiguration); T2Cconfig.set("Alias.Permission.CustomNoPermissionMSG", "", yamlConfiguration);
T2Cconfig.set("Alias.Cost.Enable", false,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.Price", 0.0,yamlConfiguration);
T2Cconfig.set("Alias.Cost.AllowByPass", true,yamlConfiguration); T2Cconfig.set("Alias.Cost.AllowByPass", true,yamlConfiguration);

View File

@ -66,6 +66,10 @@ public class SelectAlias {
String permissionMSG = yamlConfiguration.getString("Alias.Permission.CustomNoPermissionMSG"); String permissionMSG = yamlConfiguration.getString("Alias.Permission.CustomNoPermissionMSG");
Boolean costEnable = yamlConfiguration.getBoolean("Alias.Cost.Enable"); 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"); Double costPrice = yamlConfiguration.getDouble("Alias.Cost.Price");
Boolean costAllowBypass = yamlConfiguration.getBoolean("Alias.Cost.AllowByPass"); Boolean costAllowBypass = yamlConfiguration.getBoolean("Alias.Cost.AllowByPass");
@ -96,7 +100,7 @@ public class SelectAlias {
List<String> consoleMessages = yamlConfiguration.getStringList("Alias.Console.Message.Messages"); List<String> consoleMessages = yamlConfiguration.getStringList("Alias.Console.Message.Messages");
Main.allAliases.addAll(aliasList); 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, command, messageEnable, messages, adminEnable, adminPermission, adminCommandEnable, adminCommandAsConsole, adminBungeeCommand, adminCommands,
adminMessageEnable, adminMessages, consoleEnable, consoleCommandEnable, consoleBungeeCommand, consoleCommands, consoleMessageEnable, consoleMessages); adminMessageEnable, adminMessages, consoleEnable, consoleCommandEnable, consoleBungeeCommand, consoleCommands, consoleMessageEnable, consoleMessages);
for (String al : aliasList) { for (String al : aliasList) {

View File

@ -29,8 +29,19 @@ public class CreateConfig {
T2Cconfig.set("BungeeCord.Enable", false, yamlConfiguration); T2Cconfig.set("BungeeCord.Enable", false, yamlConfiguration);
T2Cconfig.set("BungeeCord.ThisServer", "server", yamlConfiguration); T2Cconfig.set("BungeeCord.ThisServer", "server", yamlConfiguration);
<<<<<<< Updated upstream
T2Cconfig.set("Buy.Message", true, yamlConfiguration); T2Cconfig.set("Buy.Message", true, yamlConfiguration);
T2Cconfig.set("SubAlias.TabComplete", true, yamlConfiguration); T2Cconfig.set("SubAlias.TabComplete", true, 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);
>>>>>>> Stashed changes
try { try {
yamlConfiguration.save(config); yamlConfiguration.save(config);
@ -39,4 +50,33 @@ public class CreateConfig {
} }
T2Csend.console(Util.getPrefix() + " §2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms"); T2Csend.console(Util.getPrefix() + " §2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
} }
<<<<<<< Updated upstream
=======
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();
}
>>>>>>> Stashed changes
} }

View File

@ -18,6 +18,7 @@ public class SelectConfig {
private static String thisServer; private static String thisServer;
private static Boolean buyMessage; private static Boolean buyMessage;
private static String buyCurrency;
private static Boolean subAliasTab; private static Boolean subAliasTab;
public static void onSelect() { public static void onSelect() {
@ -31,12 +32,18 @@ public class SelectConfig {
updateCheckTimeInterval = yamlConfiguration.getInt("Plugin.updateCheck.timeInterval"); updateCheckTimeInterval = yamlConfiguration.getInt("Plugin.updateCheck.timeInterval");
<<<<<<< Updated upstream
language = yamlConfiguration.getString("Plugin.language"); language = yamlConfiguration.getString("Plugin.language");
Bungee = yamlConfiguration.getBoolean("BungeeCord.Enable"); Bungee = yamlConfiguration.getBoolean("BungeeCord.Enable");
thisServer = yamlConfiguration.getString("BungeeCord.ThisServer"); thisServer = yamlConfiguration.getString("BungeeCord.ThisServer");
buyMessage = yamlConfiguration.getBoolean("Buy.Message"); buyMessage = yamlConfiguration.getBoolean("Buy.Message");
subAliasTab = yamlConfiguration.getBoolean("SubAlias.TabComplete"); subAliasTab = yamlConfiguration.getBoolean("SubAlias.TabComplete");
=======
buyMessage = yamlConfiguration.getBoolean("buy.message");
buyCurrency = yamlConfiguration.getString("buy.currency");
subAliasTab = yamlConfiguration.getBoolean("subAlias.tabComplete");
>>>>>>> Stashed changes
} }
public static void setConfigVersion() { public static void setConfigVersion() {
File config = new File(Main.getPath(), "config.yml"); File config = new File(Main.getPath(), "config.yml");
@ -85,6 +92,10 @@ public class SelectConfig {
return buyMessage; return buyMessage;
} }
public static String getBuyCurrency() {
return buyCurrency;
}
public static Boolean getSubAliasTab() { public static Boolean getSubAliasTab() {
return subAliasTab; return subAliasTab;
} }

View File

@ -32,6 +32,9 @@ public class LanguagesCreate {
T2Cconfig.set("Plugin.NoSubCommand", MSG.EN_NoSubCommand, yamlConfigurationEN); T2Cconfig.set("Plugin.NoSubCommand", MSG.EN_NoSubCommand, yamlConfigurationEN);
T2Cconfig. set("Cost.Buy", MSG.EN_Buy, 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); T2Cconfig.set("Cost.NoMoney", MSG.EN_NoMoney, yamlConfigurationEN);
try { try {
@ -59,6 +62,9 @@ public class LanguagesCreate {
T2Cconfig.set("Plugin.NoSubCommand", MSG.DE_NoSubCommand, yamlConfigurationDE); T2Cconfig.set("Plugin.NoSubCommand", MSG.DE_NoSubCommand, yamlConfigurationDE);
T2Cconfig.set("Cost.Buy", MSG.DE_Buy, 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); T2Cconfig.set("Cost.NoMoney", MSG.DE_NoMoney, yamlConfigurationDE);
try { try {

View File

@ -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_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_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_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>"; 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_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_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_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>"; public static String DE_NoSubCommand = "[prefix] <red>Diesen Befehl gibt es nicht!</red>";

View File

@ -21,6 +21,9 @@ public class SelectMessages {
public static String aliasDisabled; public static String aliasDisabled;
public static String buy; public static String buy;
public static String buyConfirm;
public static String buyCancel;
public static String buyConfirmNotPossible;
public static String noMoney; public static String noMoney;
@ -54,6 +57,9 @@ public class SelectMessages {
noPermissionForCommand = replace(yamlConfiguration.getString("Plugin.ForCommand")); noPermissionForCommand = replace(yamlConfiguration.getString("Plugin.ForCommand"));
noSubCommand = replace(yamlConfiguration.getString("Plugin.NoSubCommand")); noSubCommand = replace(yamlConfiguration.getString("Plugin.NoSubCommand"));
buy = replace(yamlConfiguration.getString("Cost.Buy")); 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")); noMoney = replace(yamlConfiguration.getString("Cost.NoMoney"));
T2Csend.console(Prefix + " §2Language successfully selected to: §6" + selectMSG + " §7- §e" + (System.currentTimeMillis() - long_) + "ms"); T2Csend.console(Prefix + " §2Language successfully selected to: §6" + selectMSG + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");

View File

@ -29,6 +29,7 @@ public class CreateExampleSubAliasConfig {
T2Cconfig.set("SubAlias.Permission.CustomNoPermissionMSG", "", yamlConfiguration); T2Cconfig.set("SubAlias.Permission.CustomNoPermissionMSG", "", yamlConfiguration);
T2Cconfig.set("SubAlias.Cost.Enable", false, 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.Price", 0.0, yamlConfiguration);
T2Cconfig.set("SubAlias.Cost.AllowByPass", true, yamlConfiguration); T2Cconfig.set("SubAlias.Cost.AllowByPass", true, yamlConfiguration);

View File

@ -67,6 +67,10 @@ public class SelectSubAlias {
String permissionMSG = yamlConfiguration.getString("SubAlias.Permission.CustomNoPermissionMSG"); String permissionMSG = yamlConfiguration.getString("SubAlias.Permission.CustomNoPermissionMSG");
Boolean costEnable = yamlConfiguration.getBoolean("SubAlias.Cost.Enable"); 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"); Double costPrice = yamlConfiguration.getDouble("SubAlias.Cost.Price");
Boolean costAllowBypass = yamlConfiguration.getBoolean("SubAlias.Cost.AllowByPass"); Boolean costAllowBypass = yamlConfiguration.getBoolean("SubAlias.Cost.AllowByPass");
@ -96,7 +100,7 @@ public class SelectSubAlias {
Boolean consoleMessageEnable = yamlConfiguration.getBoolean("SubAlias.Console.Message.Enable"); Boolean consoleMessageEnable = yamlConfiguration.getBoolean("SubAlias.Console.Message.Enable");
List<String> consoleMessages = yamlConfiguration.getStringList("SubAlias.Console.Message.Messages"); 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, command, messageEnable, messages, adminEnable, adminPermission, adminCommandEnable, adminCommandAsConsole, adminBungeeCommand, adminCommands,
adminMessageEnable, adminMessages, consoleEnable, consoleCommandEnable, consoleBungeeCommand, consoleCommands, consoleMessageEnable, consoleMessages); adminMessageEnable, adminMessages, consoleEnable, consoleCommandEnable, consoleBungeeCommand, consoleCommands, consoleMessageEnable, consoleMessages);
for (String sal : subAliasList) { for (String sal : subAliasList) {

View File

@ -0,0 +1,15 @@
package net.t2code.alias.Spigot.listener;
import net.t2code.alias.Spigot.cmdManagement.ExecuteAlias;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
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());
}
}

View File

@ -11,6 +11,7 @@ public class AliasObject {
public String permissionMSG; public String permissionMSG;
public Boolean costEnable; public Boolean costEnable;
public Boolean costConfirm;
public Double costPrice; public Double costPrice;
public Boolean costAllowBypass; public Boolean costAllowBypass;
@ -44,6 +45,7 @@ public class AliasObject {
String permissionMSG, String permissionMSG,
Boolean costEnable, Boolean costEnable,
Boolean costConfirm,
Double costPrice, Double costPrice,
Boolean costAllowBypass, Boolean costAllowBypass,
@ -76,6 +78,7 @@ public class AliasObject {
this.permissionMSG = permissionMSG; this.permissionMSG = permissionMSG;
this.costEnable = costEnable; this.costEnable = costEnable;
this.costConfirm = costConfirm;
this.costPrice = costPrice; this.costPrice = costPrice;
this.costAllowBypass = costAllowBypass; this.costAllowBypass = costAllowBypass;

View File

@ -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;
}
}

View File

@ -13,6 +13,7 @@ public class SubAliasObject {
public String permissionMSG; public String permissionMSG;
public Boolean costEnable; public Boolean costEnable;
public Boolean costConfirm;
public Double costPrice; public Double costPrice;
public Boolean costAllowBypass; public Boolean costAllowBypass;
@ -48,6 +49,7 @@ public class SubAliasObject {
String permissionMSG, String permissionMSG,
Boolean costEnable, Boolean costEnable,
Boolean costConfirm,
Double costPrice, Double costPrice,
Boolean costAllowBypass, Boolean costAllowBypass,
@ -82,6 +84,7 @@ public class SubAliasObject {
this.permissionMSG = permissionMSG; this.permissionMSG = permissionMSG;
this.costEnable = costEnable; this.costEnable = costEnable;
this.costConfirm = costConfirm;
this.costPrice = costPrice; this.costPrice = costPrice;
this.costAllowBypass = costAllowBypass; this.costAllowBypass = costAllowBypass;

View File

@ -10,6 +10,7 @@ import net.t2code.alias.Spigot.config.languages.LanguagesCreate;
import net.t2code.alias.Spigot.config.languages.SelectMessages; import net.t2code.alias.Spigot.config.languages.SelectMessages;
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.listener.PluginEvents;
import net.t2code.alias.Util; import net.t2code.alias.Util;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate; import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
import net.t2code.t2codelib.SPIGOT.api.register.T2Cregister; import net.t2code.t2codelib.SPIGOT.api.register.T2Cregister;
@ -31,6 +32,7 @@ public class Load {
Bukkit.getServer().getPluginManager().registerEvents(new JoinEvent(), plugin); Bukkit.getServer().getPluginManager().registerEvents(new JoinEvent(), plugin);
T2Ctemplate.onLoadFooter(prefix, long_, version); T2Ctemplate.onLoadFooter(prefix, long_, version);
T2Cregister.listener(new PluginEvents(), plugin);
Metrics.Bstats(plugin, bstatsID); Metrics.Bstats(plugin, bstatsID);
} }