New features:
- The option "CooldownInSec.Global" has been added to give an alias a global cooldown that counts for all players.
- The option "CooldownInSec.Player" has been added to give an alias a cooldown that counts for a single player.

The permissions have been revised:
- t2code.alias.admin -> t2c.alias.admin
- t2code.alias.updatemsg -> t2c.alias.updatemsg
- t2code.alias.command.reload -> t2c.alias.command.reload
- t2code.alias.command.info -> t2c.alias.command.info
- t2code.alias.buy.bypass -> t2c.alias.buy.all.bypass
- The bypass for payment can now also be set individually for each alias / subalias: t2c.alias.buy.[alias].bypass / t2c.alias.sub.buy.all.bypass
This commit is contained in:
JaTiTV 2024-06-15 18:47:17 +02:00
parent d25b704ff1
commit 5d72e0d48d
20 changed files with 263 additions and 71 deletions

View File

@ -63,14 +63,14 @@ WebUI: https://webui.adventure.kyori.net
**/t2code-alias** | **/alias**
**/alias info** - Open the T2C-Alias info. | *t2code.alias.command.info*
**/alias info** - Open the T2C-Alias info. | *t2c.alias.command.info*
**/alias reload** - Reload the plugin. | *t2code.alias.command.reload*
**/alias reload** - Reload the plugin. | *t2c.alias.command.reload*
*t2code.alias.admin* - Permission for all T2C-Alias Commands
*t2c.alias.admin* - Permission for all T2C-Alias Commands
*t2code.alias.updatemsg* - Get a notification when an update is available when joining
*t2c.alias.updatemsg* - Get a notification when an update is available when joining
---
<img src="https://i.imgur.com/HoZSt7c.png" width="600">

View File

@ -8,6 +8,9 @@
<artifactId>Alias</artifactId>
<version>1.5</version>
<!--version>VERSION_snapshot-0</version-->
<!--version>VERSION_beta-0</version-->
<!--version>VERSION_dev-0</version-->
<packaging>jar</packaging>
<name>T2C-Alias</name>

View File

@ -23,18 +23,18 @@ public class AliasCmdExecuter implements CommandExecutor, TabCompleter {
if (args.length == 0) {
// Command
if (sender.hasPermission("t2code.alias.command.info")) {
if (sender.hasPermission("t2c.alias.command.info")) {
Commands.info(sender);
} else T2Csend.sender(sender, Language.noPermission.value.replace("[cmd]", "/t2code-alias info")
.replace("[perm]", "t2code.alias.command.info"));
.replace("[perm]", "t2c.alias.command.info"));
} else {
switch (args[0].toLowerCase()) {
case "reload":
case "rl":
if (sender.hasPermission("t2code.alias.command.reload") || sender.isOp()) {
if (sender.hasPermission("t2c.alias.command.reload") || sender.isOp()) {
Commands.reload(sender);
} else T2Csend.sender(sender, Language.noPermission.value.replace("[cmd]", "/t2code-alias reload")
.replace("[perm]", "t2code.alias.command.reload"));
.replace("[perm]", "t2c.alias.command.reload"));
break;
case "confirm":
if (Config.buyConfirmDefault.value == Confirm.COMMAND) ExecuteAlias.storage(sender, true);
@ -45,10 +45,10 @@ public class AliasCmdExecuter implements CommandExecutor, TabCompleter {
case "info":
case "plugin":
case "version":
if (sender.hasPermission("t2code.alias.command.info")) {
if (sender.hasPermission("t2c.alias.command.info")) {
Commands.info(sender);
} else T2Csend.sender(sender, Language.noPermission.value.replace("[cmd]", "/t2code-alias info")
.replace("[perm]", "t2code.alias.command.info"));
.replace("[perm]", "t2c.alias.command.info"));
break;
}
@ -58,9 +58,9 @@ public class AliasCmdExecuter implements CommandExecutor, TabCompleter {
//TabCompleter
private static HashMap<String, String> arg1 = new HashMap<String, String>() {{
put("reload", "t2code.alias.command.reload");
put("rl", "t2code.alias.command.reload");
put("info", "t2code.alias.command.info");
put("reload", "t2c.alias.command.reload");
put("rl", "t2c.alias.command.reload");
put("info", "t2c.alias.command.info");
}};
@Override

View File

@ -52,7 +52,7 @@ public class ExecuteAlias {
Player player = (Player) sender;
if (aliasObject.adminEnable) {
if (player.hasPermission(aliasObject.adminPermission.replace("<alias>", alias.toLowerCase()))) {
if (player.hasPermission(aliasObject.adminPermission.replace("[alias]", alias.toLowerCase()))) {
if (aliasObject.adminCommandEnable) {
aliasAdminCommand(aliasObject, alias, player, args);
}
@ -64,18 +64,18 @@ public class ExecuteAlias {
}
if (aliasObject.permNecessary) {
if (!(player.hasPermission(aliasObject.permission.replace("<alias>", alias.toLowerCase())) || player.hasPermission("t2code.alias.admin"))) {
if (!(player.hasPermission(aliasObject.permission.replace("[alias]", alias.toLowerCase())) || player.hasPermission("t2c.alias.admin"))) {
String npmsg;
if (aliasObject.permissionMSG == null || aliasObject.permissionMSG.equals("")) {
npmsg = Language.noPermission.value;
} else npmsg = aliasObject.permissionMSG;
T2Csend.player(player, npmsg.replace("[cmd]", "/" + alias.toLowerCase())
.replace("[perm]", aliasObject.permission.replace("<alias>", alias.toLowerCase())).replace("[alias]", alias));
.replace("[perm]", aliasObject.permission.replace("[alias]", alias.toLowerCase())).replace("[alias]", alias));
return;
}
}
if (aliasObject.costEnable && aliasObject.costConfirm) {
if (!(aliasObject.costAllowBypass && player.hasPermission("t2code.alias.buy.bypass"))) {
if (!(aliasObject.costAllowBypass && player.hasPermission("t2code.alias.buy." + alias.toLowerCase() + ".bypass"))) {
Cache.aliasStorage.put(player.getUniqueId(), new AliasStorageObject(aliasObject, alias, args, false));
switch ((Confirm) Config.buyConfirmDefault.value) {
case GUI:
@ -99,8 +99,35 @@ public class ExecuteAlias {
}
protected static void executeAlias(Player player, AliasObject aliasObject, String alias, String[] args) {
if (aliasObject.cooldownGlobal != 0) {
if (!(player.hasPermission("t2code.alias.cooldown.global." + alias.toLowerCase() + ".bypass") && player.hasPermission("t2c.alias.cooldown.global.all.bypass"))) {
if (aliasObject.globalCooldownInt != 0) {
Long duration = System.currentTimeMillis() - aliasObject.globalCooldownInt;
if (!(duration > (aliasObject.cooldownGlobal * 1000))) {
T2Csend.player(player, Language.cooldownGlobal.value.replace("[cooldown]", String.valueOf(aliasObject.cooldownGlobal - (int) (duration / 1000))));
return;
}
}
aliasObject.globalCooldownInt = System.currentTimeMillis();
}
}
if (aliasObject.cooldownPlayer != 0) {
if (!(player.hasPermission("t2code.alias.cooldown.player." + alias.toLowerCase() + ".bypass") && player.hasPermission("t2c.alias.cooldown.player.all.bypass"))) {
Long cooldown = aliasObject.cooldownPlayerMap.get(player.getUniqueId());
if (cooldown != null) {
Long duration = System.currentTimeMillis() - cooldown;
if (!(duration > (aliasObject.cooldownPlayer * 1000))) {
T2Csend.player(player, Language.cooldownPlayer.value.replace("[cooldown]", String.valueOf(aliasObject.cooldownPlayer - (int) (duration / 1000))));
return;
}
}
aliasObject.cooldownPlayerMap.put(player.getUniqueId(), System.currentTimeMillis());
}
}
if (aliasObject.costEnable) {
if (!(aliasObject.costAllowBypass && player.hasPermission("t2code.alias.buy.bypass"))) {
if (!(aliasObject.costAllowBypass && player.hasPermission("t2code.alias.buy." + alias.toLowerCase() + ".bypass") && player.hasPermission("t2c.alias.buy.all.bypass"))) {
if (!T2Ceco.moneyRemove(prefix, player, aliasObject.costPrice)) {
T2Csend.player(player, Language.noMoney.value);
return;
@ -109,6 +136,7 @@ public class ExecuteAlias {
T2Csend.player(player, Language.buy.value.replace("[price]", aliasObject.costPrice.toString() + " " + Config.buyCurrency.value));
}
}
if (aliasObject.commandEnable) {
aliasCommand(aliasObject, alias, player, args);
}
@ -127,7 +155,7 @@ public class ExecuteAlias {
Player player = (Player) sender;
if (aliasObject.adminEnable) {
if (player.hasPermission(aliasObject.adminPermission.replace("<alias>", alias.toLowerCase()))){
if (player.hasPermission(aliasObject.adminPermission.replace("[alias]", alias.toLowerCase()))) {
if (aliasObject.adminCommandEnable) {
subAliasAdminCommand(aliasObject, alias, player, args);
}
@ -139,13 +167,13 @@ public class ExecuteAlias {
}
if (aliasObject.permNecessary) {
if (!(player.hasPermission(aliasObject.permission.replace("<alias>", alias.toLowerCase())) || player.hasPermission("t2code.alias.admin"))) {
if (!(player.hasPermission(aliasObject.permission.replace("[alias]", alias.toLowerCase())) || player.hasPermission("t2code.alias.admin"))) {
String npmsg;
if (aliasObject.permissionMSG == null || aliasObject.permissionMSG.equals("")) {
npmsg = Language.noPermission.value;
} else npmsg = aliasObject.permissionMSG;
T2Csend.player(player, npmsg.replace("[cmd]", "/" + alias.toLowerCase())
.replace("[perm]", aliasObject.permission.replace("<alias>", alias.toLowerCase())).replace("[alias]", alias));
.replace("[perm]", aliasObject.permission.replace("[alias]", alias.toLowerCase())).replace("[alias]", alias));
return;
}
}
@ -179,8 +207,37 @@ public class ExecuteAlias {
}
protected static void executeSubAlias(Player player, SubAliasObject aliasObject, String alias, String[] args) {
if (aliasObject.cooldownGlobal != 0) {
if (!(player.hasPermission("t2c.alias.sub.cooldown.global." + alias.toLowerCase() + ".bypass") && player.hasPermission("t2c.alias.sub.cooldown.global.all.bypass"))) {
if (aliasObject.globalCooldownInt != 0) {
Long duration = System.currentTimeMillis() - aliasObject.globalCooldownInt;
if (!(duration > (aliasObject.cooldownGlobal * 1000))) {
T2Csend.player(player, Language.cooldownGlobal.value.replace("[cooldown]", String.valueOf(aliasObject.cooldownGlobal - (int) (duration / 1000))));
return;
}
}
aliasObject.globalCooldownInt = System.currentTimeMillis();
}
}
if (aliasObject.cooldownPlayer != 0) {
if (!(player.hasPermission("t2c.alias.sub.cooldown.player." + alias.toLowerCase() + ".bypass") && player.hasPermission("t2c.alias.sub.cooldown.player.all.bypass"))) {
Long cooldown = aliasObject.cooldownPlayerMap.get(player.getUniqueId());
if (cooldown != null) {
Long duration = System.currentTimeMillis() - cooldown;
if (!(duration > (aliasObject.cooldownPlayer * 1000))) {
T2Csend.player(player, Language.cooldownPlayer.value.replace("[cooldown]", String.valueOf(aliasObject.cooldownPlayer - (int) (duration / 1000))));
return;
}
}
aliasObject.cooldownPlayerMap.put(player.getUniqueId(), System.currentTimeMillis());
}
}
if (aliasObject.costEnable) {
if (!(aliasObject.costAllowBypass && player.hasPermission("t2code.alias.buy.bypass"))) {
if (!(aliasObject.costAllowBypass && player.hasPermission("t2c.alias.sub.buy." + alias.toLowerCase() + ".bypass") && player.hasPermission("t2c.alias.sub.buy.all.bypass"))) {
if (!T2Ceco.moneyRemove(prefix, player, aliasObject.costPrice)) {
T2Csend.player(player, Language.noMoney.value);
return;

View File

@ -31,7 +31,7 @@ public class TabEvent implements Listener {
String[] args = input.split(" ", -1);
for (String al : aliasObject.subAliasList) {
arg1.put(al, aliasObject.permission.replace("<alias>", al.toLowerCase()));
arg1.put(al, aliasObject.permission.replace("[alias]", al.toLowerCase()));
}
int arg = aliasObject.subAliasArg;
if (args.length - 1 == arg) {

View File

@ -36,8 +36,29 @@ public class AliasConfigConverter {
public static void convertAddPermission(YamlConfiguration yamlConfiguration, File config_gui, Boolean subalias) {
if (subalias) {
yamlConfiguration.set("SubAlias.Permission.Permission", "t2code.alias.use.subalias.<alias>");
} else yamlConfiguration.set("Alias.Permission.Permission", "t2code.alias.use.<alias>");
yamlConfiguration.set("SubAlias.Permission.Permission", "t2c.alias.sub.use.[alias]");
} else yamlConfiguration.set("Alias.Permission.Permission", "t2c.alias.use.[alias]");
try {
yamlConfiguration.save(config_gui);
} catch (IOException e) {
e.printStackTrace();
}
}
public static void convertAddCooldownInSecGlobal(YamlConfiguration yamlConfiguration, File config_gui, Boolean subalias) {
if (subalias) {
yamlConfiguration.set("Alias.CooldownInSec.Global", 0);
} else yamlConfiguration.set("Alias.CooldownInSec.Global", 0);
try {
yamlConfiguration.save(config_gui);
} catch (IOException e) {
e.printStackTrace();
}
}
public static void convertAddCooldownInSecPlayer(YamlConfiguration yamlConfiguration, File config_gui, Boolean subalias) {
if (subalias) {
yamlConfiguration.set("Alias.CooldownInSec.Player", 0);
} else yamlConfiguration.set("Alias.CooldownInSec.Player", 0);
try {
yamlConfiguration.save(config_gui);
} catch (IOException e) {

View File

@ -25,11 +25,11 @@ public class CreateExampleAliasConfig {
T2Cconfig.set("Alias.AliasList", Arrays.asList("aliasexample1","t2caliasexample"),yamlConfiguration);
T2Cconfig.set("Alias.Permission.Necessary", true, yamlConfiguration);
T2Cconfig.set("Alias.Permission.Permission", "t2code.alias.use.<alias>", yamlConfiguration);
T2Cconfig.set("Alias.Permission.Permission", "t2c.alias.use.[alias]", yamlConfiguration);
T2Cconfig.set("Alias.Permission.CustomNoPermissionMSG", "", yamlConfiguration);
T2Cconfig.set("Alias.Cooldown.Global", 0, yamlConfiguration);
T2Cconfig.set("Alias.Cooldown.Player", 0, yamlConfiguration);
T2Cconfig.set("Alias.CooldownInSec.Global", 0, yamlConfiguration);
T2Cconfig.set("Alias.CooldownInSec.Player", 0, yamlConfiguration);
T2Cconfig.set("Alias.Cost.Enable", false,yamlConfiguration);
T2Cconfig.set("Alias.Cost.Confirm", true,yamlConfiguration);
@ -45,7 +45,7 @@ public class CreateExampleAliasConfig {
T2Cconfig.set("Alias.Message.Messages", Arrays.asList("<rainbow>This is a test alias</rainbow>", "<color:#d7ff0f>With this you can use several functions such as <color:#ffd6ad>colored text</color>, <click:suggest_command:'/command'><hover:show_text:'<color:#ff745c>Use Command</color>'>clickable texts</hover></click>, <hover:show_text:'<color:#1f66ff>For example Warps</color>'><click:suggest_command:'/warp home'><color:#365eff>shorten commands of other plugins</color></click></hover> and much more.</color>", "<color:#85a0ff><click:open_url:'http://dc.t2code.net'><hover:show_text:'<color:#0887ff>http://dc.t2code.net</color>'>If you have any questions, please contact our support Discord.</hover></click></color>"), yamlConfiguration);
T2Cconfig.set("Alias.Admin.Enable", false, yamlConfiguration);
T2Cconfig.set("Alias.Admin.Permission", "t2code.alias.admin", yamlConfiguration);
T2Cconfig.set("Alias.Admin.Permission", "t2c.alias.[alias].admin", yamlConfiguration);
T2Cconfig.set("Alias.Admin.Command.Enable", true, yamlConfiguration);
T2Cconfig.set("Alias.Admin.Command.CommandAsConsole", true, yamlConfiguration);

View File

@ -63,8 +63,16 @@ public class SelectAlias {
}
String permissionMSG = yamlConfiguration.getString("Alias.Permission.CustomNoPermissionMSG");
Integer cooldownGlobal = yamlConfiguration.getInt("Alias.Cooldown.Global");
Integer cooldownPlayer = yamlConfiguration.getInt("Alias.Cooldown.Player");
if (yamlConfiguration.get("Alias.CooldownInSec.Global") == null) {
AliasConfigConverter.convertAddCooldownInSecGlobal(yamlConfiguration, config_gui, false);
}
Integer cooldownGlobal = yamlConfiguration.getInt("Alias.CooldownInSec.Global");
if (yamlConfiguration.get("Alias.CooldownInSec.Player") == null) {
AliasConfigConverter.convertAddCooldownInSecPlayer(yamlConfiguration, config_gui, false);
}
Integer cooldownPlayer = yamlConfiguration.getInt("Alias.CooldownInSec.Player");
Boolean costEnable = yamlConfiguration.getBoolean("Alias.Cost.Enable");
if (yamlConfiguration.get("Alias.Cost.Confirm") == null) {

View File

@ -3,7 +3,6 @@ package net.t2code.alias.Spigot.config.config;
import net.t2code.alias.Spigot.enums.ConfigParam;
import net.t2code.alias.Spigot.enums.Confirm;
import net.t2code.alias.Util;
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemBuilder;
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
import org.bukkit.Sound;

View File

@ -27,6 +27,10 @@ public enum Language {
buy("cost.buy", null, "[prefix] <dark_green>Du hast f[ue]r diesen Command <gold>[price]</gold> bezahlt.</dark_green>",
"[prefix] <dark_green>You have paid <gold>[price]</gold> for this command.</dark_green>", ConfigParam.STRING),
noMoney("cost.noMoney", null, "[prefix] <red>Du hast nicht gen[ue]gend Geld für diesen Command!</red>", "[prefix] <red>You don't have enough money for this command!</red>", ConfigParam.STRING),
cooldownPlayer("cooldown.player",null,"[prefix] <red>Du musst noch <gold>[cooldown]</gold> Sekunden warten um diesen Command erneut zu nutzen.</red>","[prefix] <red>You must wait <gold>[cooldown]</gold> seconds to use this command again.</red>",ConfigParam.STRING),
cooldownGlobal("cooldown.global",null,"[prefix] <red>Du musst noch <gold>[cooldown]</gold> Sekunden warten um diesen Command zu nutzen.</red>","[prefix] <red>You have to wait <gold>[cooldown]</gold> seconds to use this command.</red>",ConfigParam.STRING),
confirmCommand("cost.confirm.command", null, "[prefix] <gold>Für diesen Befehl musst du [price] bezahlen!</gold><br>[prefix] <green><click:run_command:'/t2c-a confirm'><hover:show_text:'<gray>Klicke zum bestätigen</gray>'>Bestätigen</hover></click></green> <gray>-</gray> <red><click:run_command:'/t2c-a cancel'><hover:show_text:'<gray>Klicke zum abbrechen</gray>'>Abbrechen</hover></click></red>",
"[prefix] <gold>For this command you have to pay [price]!</gold><br>[prefix] <green><click:run_command:'/t2c-a confirm'><hover:show_text:'<gray>Click to confirm</gray>'>Confirm</hover></click></green> <gray>-</gray> <red><click:run_command:'/t2c-a cancel'><hover:show_text:'<gray>click to cancel</gray>'>Cancel</hover></click></red>", ConfigParam.STRING),
confirmChat("cost.confirm.chat", null, "[prefix] <gold>Für diesen Befehl musst du [price] bezahlen!</gold><br>[prefix] <green><click:run_command:'t2code-alias-confirm'><hover:show_text:'<gray>Klicke zum bestätigen</gray>'>Bestätigen</hover></click></green> <gray>-</gray> <red><click:run_command:'t2code-alias-cancel'><hover:show_text:'<gray>Klicke zum abbrechen</gray>'>Abbrechen</hover></click></red>",

View File

@ -25,9 +25,12 @@ public class CreateExampleSubAliasConfig {
T2Cconfig.set("SubAlias.SubAliasFor", "aliasexample1", yamlConfiguration);
T2Cconfig.set("SubAlias.Permission.Necessary", true, yamlConfiguration);
T2Cconfig.set("SubAlias.Permission.Permission", "t2code.alias.use.subalias.<alias>", yamlConfiguration);
T2Cconfig.set("SubAlias.Permission.Permission", "t2c.alias.sub.use.[alias]", yamlConfiguration);
T2Cconfig.set("SubAlias.Permission.CustomNoPermissionMSG", "", yamlConfiguration);
T2Cconfig.set("SubAlias.CooldownInSec.Global", 0, yamlConfiguration);
T2Cconfig.set("SubAlias.CooldownInSec.Player", 0, yamlConfiguration);
T2Cconfig.set("SubAlias.Cost.Enable", false, yamlConfiguration);
T2Cconfig.set("SubAlias.Cost.Confirm", true,yamlConfiguration);
T2Cconfig.set("SubAlias.Cost.Price", 0.0, yamlConfiguration);
@ -42,7 +45,7 @@ public class CreateExampleSubAliasConfig {
T2Cconfig.set("SubAlias.Message.Messages",Arrays.asList(), yamlConfiguration);
T2Cconfig.set("SubAlias.Admin.Enable", false, yamlConfiguration);
T2Cconfig.set("SubAlias.Admin.Permission", "t2code.alias.admin", yamlConfiguration);
T2Cconfig.set("SubAlias.Admin.Permission", "t2c.alias.admin", yamlConfiguration);
T2Cconfig.set("SubAlias.Admin.Command.Enable", true, yamlConfiguration);
T2Cconfig.set("SubAlias.Admin.Command.CommandAsConsole", true, yamlConfiguration);

View File

@ -66,8 +66,15 @@ public class SelectSubAlias {
}
String permissionMSG = yamlConfiguration.getString("SubAlias.Permission.CustomNoPermissionMSG");
Integer cooldownGlobal = yamlConfiguration.getInt("Alias.Cooldown.Global");
Integer cooldownPlayer = yamlConfiguration.getInt("Alias.Cooldown.Player");
if (yamlConfiguration.get("SubAlias.CooldownInSec.Global") == null) {
AliasConfigConverter.convertAddCooldownInSecGlobal(yamlConfiguration, config_gui, true);
}
Integer cooldownGlobal = yamlConfiguration.getInt("SubAlias.CooldownInSec.Global");
if (yamlConfiguration.get("SubAlias.CooldownInSec.Player") == null) {
AliasConfigConverter.convertAddCooldownInSecPlayer(yamlConfiguration, config_gui, true);
}
Integer cooldownPlayer = yamlConfiguration.getInt("SubAlias.CooldownInSec.Player");
Boolean costEnable = yamlConfiguration.getBoolean("SubAlias.Cost.Enable");
if (yamlConfiguration.get("SubAlias.Cost.Confirm") == null) {
@ -106,9 +113,11 @@ public class SelectSubAlias {
SubAliasObject subAlias = new SubAliasObject(aliasEnable, subAliasList, subAliasFor, subAliasArg, permNecessary, permission, permissionMSG, cooldownGlobal, cooldownPlayer, 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) {
Main.subAliasHashMap.put(sal, subAlias);
}
Main.allSubAliases.addAll(subAliasList);
Main.allForSubAliases.add(subAliasFor);
T2Csend.console(Prefix + " §aSubAlias file §e" + config_gui.getName() + " §awas loaded");

View File

@ -1,8 +1,14 @@
package net.t2code.alias.Spigot.objects;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;
public class AliasObject {
public HashMap<UUID, Long> cooldownPlayerMap = new HashMap<>();
public Long globalCooldownInt = 0L;
public Boolean aliasEnable;
public List<String> aliasList;

View File

@ -1,8 +1,13 @@
package net.t2code.alias.Spigot.objects;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;
public class SubAliasObject {
public HashMap<UUID, Long> cooldownPlayerMap = new HashMap<>();
public Long globalCooldownInt = 0L;
public Boolean subAliasEnable;
public List<String> subAliasList;
public Integer subAliasArg;

View File

@ -5,6 +5,7 @@ import net.t2code.alias.Spigot.objects.AliasObject;
import net.t2code.alias.Spigot.objects.SubAliasObject;
import net.t2code.t2codelib.SPIGOT.api.register.T2Cregister;
import org.bukkit.Bukkit;
import org.bukkit.permissions.PermissionDefault;
public class AliasRegisterPermissions {
@ -13,22 +14,40 @@ public class AliasRegisterPermissions {
for (AliasObject aliasObject : Main.aliasHashMap.values()) {
for (String alias : aliasObject.aliasList) {
if (aliasObject.permission != null && Bukkit.getPluginManager().getPermission(aliasObject.permission.replace("<alias>", alias).toLowerCase()) == null) {
T2Cregister.permission(aliasObject.permission.replace("<alias>", alias).toLowerCase(), Main.getPlugin());
if (aliasObject.permission != null && Bukkit.getPluginManager().getPermission(aliasObject.permission.replace("[alias]", alias).toLowerCase()) == null) {
T2Cregister.permission(aliasObject.permission.replace("[alias]", alias).toLowerCase(), Main.getPlugin());
}
if (aliasObject.adminPermission != null && Bukkit.getPluginManager().getPermission(aliasObject.adminPermission.replace("<alias>", alias).toLowerCase()) == null) {
T2Cregister.permission(aliasObject.adminPermission.replace("<alias>", alias).toLowerCase(), Main.getPlugin());
if (aliasObject.adminPermission != null && Bukkit.getPluginManager().getPermission(aliasObject.adminPermission.replace("[alias]", alias).toLowerCase()) == null) {
T2Cregister.permission(aliasObject.adminPermission.replace("[alias]", alias).toLowerCase(), Main.getPlugin());
}
if (Bukkit.getPluginManager().getPermission("t2c.alias.buy." + alias.toLowerCase() + ".bypass") == null) {
T2Cregister.permission("t2c.alias.buy." + alias.toLowerCase() + ".bypass", PermissionDefault.OP, Main.getPlugin());
}
if (Bukkit.getPluginManager().getPermission("t2c.alias.cooldown.global." + alias.toLowerCase() + ".bypass") == null) {
T2Cregister.permission("t2c.alias.cooldown.global." + alias.toLowerCase() + ".bypass", PermissionDefault.OP, Main.getPlugin());
}
if (Bukkit.getPluginManager().getPermission("t2c.alias.cooldown.player." + alias.toLowerCase() + ".bypass") == null) {
T2Cregister.permission("t2c.alias.cooldown.player." + alias.toLowerCase() + ".bypass", PermissionDefault.OP, Main.getPlugin());
}
}
}
for (SubAliasObject subAliasObject : Main.subAliasHashMap.values()) {
for (String alias : subAliasObject.subAliasList) {
if (subAliasObject.permission != null && Bukkit.getPluginManager().getPermission(subAliasObject.permission.replace("<alias>", alias).toLowerCase()) == null) {
T2Cregister.permission(subAliasObject.permission.replace("<alias>", alias).toLowerCase(), Main.getPlugin());
if (subAliasObject.permission != null && Bukkit.getPluginManager().getPermission(subAliasObject.permission.replace("[alias]", alias).toLowerCase()) == null) {
T2Cregister.permission(subAliasObject.permission.replace("[alias]", alias).toLowerCase(), Main.getPlugin());
}
if (subAliasObject.adminPermission != null && Bukkit.getPluginManager().getPermission(subAliasObject.adminPermission.replace("<alias>", alias).toLowerCase()) == null) {
T2Cregister.permission(subAliasObject.adminPermission.replace("<alias>", alias).toLowerCase(), Main.getPlugin());
if (subAliasObject.adminPermission != null && Bukkit.getPluginManager().getPermission(subAliasObject.adminPermission.replace("[alias]", alias).toLowerCase()) == null) {
T2Cregister.permission(subAliasObject.adminPermission.replace("[alias]", alias).toLowerCase(), Main.getPlugin());
}
if (Bukkit.getPluginManager().getPermission("t2c.alias.sub.buy." + alias.toLowerCase() + ".bypass") == null) {
T2Cregister.permission("t2c.alias.sub.buy." + alias.toLowerCase() + ".bypass", PermissionDefault.OP, Main.getPlugin());
}
if (Bukkit.getPluginManager().getPermission("t2c.alias.sub.cooldown.global." + alias.toLowerCase() + ".bypass") == null) {
T2Cregister.permission("t2c.alias.sub.cooldown.global." + alias.toLowerCase() + ".bypass", PermissionDefault.OP, Main.getPlugin());
}
if (Bukkit.getPluginManager().getPermission("t2c.alias.sub.cooldown.player." + alias.toLowerCase() + ".bypass") == null) {
T2Cregister.permission("t2c.alias.sub.cooldown.player." + alias.toLowerCase() + ".bypass", PermissionDefault.OP, Main.getPlugin());
}
}
}

View File

@ -22,6 +22,6 @@ public class PluginEvents implements Listener {
@EventHandler
public void onJoinEvent(PlayerLoginEvent event) {
T2CupdateAPI.join(Main.getPlugin(), Util.getPrefix(), "t2code.alias.updatemsg", event.getPlayer(), Util.getSpigotID(), Util.getDiscord());
T2CupdateAPI.join(Main.getPlugin(), Util.getPrefix(), "t2c.alias.updatemsg", event.getPlayer(), Util.getSpigotID(), Util.getDiscord());
}
}

View File

@ -11,25 +11,43 @@ Alias:
AliasList:
- aliasexample1
- aliasexample2
-
Permission:
# Here you can say if a permission is needed to use the alias#
Necessary: true
# Here you can set the permission for the alias.
# The placeholder <alias> is the alias name.
# The placeholder <[alias] is the alias name.
# If you have set multiple alias referrers in the list 'Alias.AliasList' you have a permission for each alias.
Permission: 't2code.alias.use.<alias>'
Permission: 't2c.alias.use.[alias]'
# Here you can set a custom No Permission message for this alias. If you want to use the default message, just leave this blank.
CustomNoPermissionMSG: ""
CooldownInSec:
# Here you can set a global cooldown for this alias.
# The value corresponds to the seconds.
# At 0, the cooldown is deactivated.
# The placeholder [alias] is the alias name.
# Bypass permission: t2c.alias.cooldown.global.[alias].bypass
# (The global cooldown is above the player cooldown).
Global: 0
# Here you can set a player-specific cooldown for this alias.
# The value corresponds to the seconds.
# At 0, the cooldown is deactivated.
# The placeholder [alias] is the alias name.
# Bypass permission: t2c.alias.cooldown.player.[alias].bypass
Player: 0
Cost:
# Here you can say if you have to pay for the alias
Enable: false
# Here you set the price
Price: 0.0
# Here you define if the bypass is activated or if you have to pay despite the bypass (t2code.alias.buy.bypass).
# Here you define if the bypass is activated or if you have to pay despite the bypass (t2c.alias.buy.[alias].bypass).
AllowByPass: true
# Here you can set if you have to confirm if you want to pay before executing the command
# In the config.yml you can set under 'buy.confirm.use' if a command, a chatListener or a GUI should be used to confirm the command.
Confirm: true
Command:
# Here you can tell the alias to execute one or more commands
Enable: false
@ -42,6 +60,7 @@ Alias:
# Here you can specify one or more commands to be executed.
# Placeholder: [player] = The player who executes the alias
Commands: []
Message:
# Here you can specify whether the player should receive a message.
Enable: false
@ -78,9 +97,9 @@ Alias:
# Here you can enable or disable the admin function
Enable: false
# Here you set the permission for the admin function
# The placeholder <alias> is the alias name.
# The placeholder [alias] is the alias name.
# If you have set multiple alias referrers in the list 'Alias.AliasList' you have a permission for each alias.
Permission: t2code.alias.admin
Permission: t2c.alias.[alias].admin
Command:
# Here you can tell the alias to execute one or more commands
Enable: false
@ -93,6 +112,7 @@ Alias:
# Here you can specify one or more commands to be executed.
# Placeholder: [player] = The player who executes the alias
Commands: []
Message:
# Here you can specify whether the player should receive a message.
Enable: false

View File

@ -19,21 +19,38 @@ SubAlias:
# Here you can say if a permission is needed to use the alias#
Necessary: true
# Here you can set the permission for the alias.
# The placeholder <alias> is the alias name.
# The placeholder [alias] is the subalias name.
# If you have set multiple alias referrers in the list 'Alias.SubAliasList' you have a permission for each alias.
Permission: 't2code.alias.use.subalias.<alias>'
Permission: 't2c.subalias.use.[alias]'
# Here you can set a custom No Permission message for this alias. If you want to use the default message, just leave this blank.
CustomNoPermissionMSG: ""
CooldownInSec:
# Here you can set a global cooldown for this alias.
# The value corresponds to the seconds.
# At 0, the cooldown is deactivated.
# The placeholder [alias] is the subalias name.
# Bypass permission: t2c.alias.sub.cooldown.global.[alias].bypass
# (The global cooldown is above the player cooldown).
Global: 0
# Here you can set a player-specific cooldown for this alias.
# The value corresponds to the seconds.
# At 0, the cooldown is deactivated.
# The placeholder [alias] is the subalias name.
# Bypass permission: t2c.alias.sub.cooldown.player.[alias].bypass
Player: 0
Cost:
# Here you can say if you have to pay for the alias
Enable: false
# Here you set the price
Price: 0.0
# Here you define if the bypass is activated or if you have to pay despite the bypass (t2code.alias.buy.bypass).
# Here you define if the bypass is activated or if you have to pay despite the bypass (t2c.alias.buy.[alias].bypass).
AllowByPass: true
# Here you can set if you have to confirm if you want to pay before executing the command
# In the config.yml you can set under 'buy.confirm.use' if a command, a chatListener or a GUI should be used to confirm the command.
Confirm: true
Command:
# Here you can tell the alias to execute one or more commands
Enable: false
@ -46,6 +63,7 @@ SubAlias:
# Here you can specify one or more commands to be executed.
# Placeholder: [player] = The player who executes the alias
Commands: []
Message:
# Here you can specify whether the player should receive a message.
Enable: false
@ -82,9 +100,9 @@ SubAlias:
# Here you can enable or disable the admin function
Enable: false
# Here you set the permission for the admin function
# The placeholder <alias> is the alias name.
# The placeholder [alias] is the alias name.
# If you have set multiple alias referrers in the list 'Alias.SubAliasList' you have a permission for each alias.
Permission: t2code.alias.admin
Permission: t2c.alias.sub.[alias].admin
Command:
# Here you can tell the alias to execute one or more commands
Enable: false
@ -97,6 +115,7 @@ SubAlias:
# Here you can specify one or more commands to be executed.
# Placeholder: [player] = The player who executes the alias
Commands: []
Message:
# Here you can specify whether the player should receive a message.
Enable: false

View File

@ -10,7 +10,7 @@ plugin:
# In this option you can set the language of the plugin.
language: english
updateCheck:
# In this option you can set if players with the permission 't2code.alias.updatemsg' will get an update message on join when an update for the plugin is available.
# In this option you can set if players with the permission 't2c.alias.updatemsg' will get an update message on join when an update for the plugin is available.
onJoin: true
# In this option you can set whether you want to receive and display beta and snapshot versions in the update check.
seePreReleaseUpdates: true

View File

@ -16,20 +16,39 @@ commands:
aliases: [t2c-a, alias]
permissions:
t2code.alias.admin:
t2c.alias.admin:
default: op
children:
t2code.alias.updatemsg: true
t2code.alias.command.reload: true
t2code.alias.command.info: true
t2code.alias.buy.bypass: true
t2c.alias.updatemsg: true
t2c.alias.command.reload: true
t2c.alias.command.info: true
t2c.alias.buy.all.bypass: true
t2c.alias.cooldown.global.all.bypass: true
t2c.alias.cooldown.player.all.bypass: true
t2c.alias.sub.buy.all.bypass: true
t2c.alias.sub.cooldown.global.all.bypass: true
t2c.alias.sub.cooldown.player.all.bypass: true
t2code.alias.buy.bypass:
t2c.alias.updatemsg:
default: op
t2code.alias.updatemsg:
t2c.alias.command.reload:
default: op
t2code.alias.command.reload:
t2c.alias.command.info:
default: op
t2code.alias.command.info:
t2c.alias.buy.all.bypass:
default: op
t2c.alias.cooldown.global.all.bypass:
default: op
t2c.alias.cooldown.player.all.bypass:
default: op
t2c.alias.sub.buy.all.bypass:
default: op
t2c.alias.sub.cooldown.global.all.bypass:
default: op
t2c.alias.sub.cooldown.player.all.bypass:
default: op