1.5
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:
@@ -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
|
||||
|
@@ -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;
|
||||
|
@@ -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) {
|
||||
|
Reference in New Issue
Block a user