4 Commits
1.3 ... 1.5

Author SHA1 Message Date
5d72e0d48d 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
2024-06-15 18:47:17 +02:00
d25b704ff1 1.5 dev
Changes in the Standard Config
minor code changes / bug fixes
started for cooldown
2024-06-15 02:32:10 +02:00
9aede116ac 1.4
Bugfix:
Fixed a bug where the plugin was not loading properly
2023-07-31 18:35:45 +02:00
97fc283951 1.3 hotfix 2023-07-16 11:43:13 +02:00
28 changed files with 366 additions and 400 deletions

View File

@@ -63,14 +63,14 @@ WebUI: https://webui.adventure.kyori.net
**/t2code-alias** | **/alias** **/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"> <img src="https://i.imgur.com/HoZSt7c.png" width="600">

39
pom.xml
View File

@@ -7,7 +7,10 @@
<groupId>net.t2code</groupId> <groupId>net.t2code</groupId>
<artifactId>Alias</artifactId> <artifactId>Alias</artifactId>
<version>1.3</version> <version>1.5</version>
<!--version>VERSION_snapshot-0</version-->
<!--version>VERSION_beta-0</version-->
<!--version>VERSION_dev-0</version-->
<packaging>jar</packaging> <packaging>jar</packaging>
<name>T2C-Alias</name> <name>T2C-Alias</name>
@@ -57,6 +60,16 @@
</build> </build>
<repositories> <repositories>
<!-- Spigot -->
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<!-- Mojang authlib -->
<repository>
<id>minecraft-repo</id>
<url>https://libraries.minecraft.net/</url>
</repository>
<repository> <repository>
<id>T2Code</id> <id>T2Code</id>
<url>https://repo.t2code.net/repository/T2Code/</url> <url>https://repo.t2code.net/repository/T2Code/</url>
@@ -68,10 +81,24 @@
</repositories> </repositories>
<dependencies> <dependencies>
<!-- Spigot-->
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.20.6-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!-- Mojang authlib -->
<dependency>
<groupId>com.mojang</groupId>
<artifactId>authlib</artifactId>
<version>1.5.21</version>
<scope>provided</scope>
</dependency>
<dependency> <dependency>
<groupId>net.t2code</groupId> <groupId>net.t2code</groupId>
<artifactId>T2CodeLib</artifactId> <artifactId>T2CodeLib</artifactId>
<version>15.7</version> <version>16.5</version>
<!--classifier>dev-3</classifier--> <!--classifier>dev-3</classifier-->
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
@@ -87,12 +114,8 @@
<version>3.0</version> <version>3.0</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>net.t2code.minecraft.1_13.r1</groupId>
<artifactId>spigot</artifactId>
<version>1.13r1</version>
<scope>provided</scope>
</dependency>
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>

View File

@@ -3,8 +3,6 @@ package net.t2code.alias.Spigot;
import lombok.Getter; import lombok.Getter;
import net.t2code.alias.Spigot.objects.AliasObject; import net.t2code.alias.Spigot.objects.AliasObject;
import net.t2code.alias.Spigot.objects.SubAliasObject; import net.t2code.alias.Spigot.objects.SubAliasObject;
import net.t2code.alias.Spigot.system.BukkitCommandWrap;
import net.t2code.alias.Spigot.system.BukkitCommandWrap_Useless;
import net.t2code.alias.Spigot.system.Load; import net.t2code.alias.Spigot.system.Load;
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;
@@ -38,11 +36,11 @@ public final class Main extends JavaPlugin {
public static ArrayList<String> allSubAliases = new ArrayList<>(); public static ArrayList<String> allSubAliases = new ArrayList<>();
public static ArrayList<String> allForSubAliases = new ArrayList<>(); public static ArrayList<String> allForSubAliases = new ArrayList<>();
private BukkitCommandWrap bukkitCommandWrap = null; // private BukkitCommandWrap bukkitCommandWrap = null;
//
public BukkitCommandWrap getBukkitCommandWrap() { // public BukkitCommandWrap getBukkitCommandWrap() {
return this.bukkitCommandWrap; // return this.bukkitCommandWrap;
} // }
@@ -53,12 +51,12 @@ public final class Main extends JavaPlugin {
autor = plugin.getDescription().getAuthors(); autor = plugin.getDescription().getAuthors();
version = plugin.getDescription().getVersion(); version = plugin.getDescription().getVersion();
if (pluginNotFound("T2CodeLib", 96388, Util.getRequiredT2CodeLibVersion())) return; if (pluginNotFound("T2CodeLib", 96388, Util.getRequiredT2CodeLibVersion())) return;
try { // try {
Class.forName("com.mojang.brigadier.CommandDispatcher"); // Class.forName("com.mojang.brigadier.CommandDispatcher");
this.bukkitCommandWrap = new BukkitCommandWrap(); // this.bukkitCommandWrap = new BukkitCommandWrap();
} catch (ClassNotFoundException | NoClassDefFoundError e) { // } catch (ClassNotFoundException | NoClassDefFoundError e) {
this.bukkitCommandWrap = new BukkitCommandWrap_Useless(); // this.bukkitCommandWrap = new BukkitCommandWrap_Useless();
} // }
if (T2CmcVersion.isMc1_13()) { if (T2CmcVersion.isMc1_13()) {
guiCode = ""; guiCode = "";
} else guiCode = "§6§8§9§r"; } else guiCode = "§6§8§9§r";

View File

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

View File

@@ -52,7 +52,7 @@ public class ExecuteAlias {
Player player = (Player) sender; Player player = (Player) sender;
if (aliasObject.adminEnable) { if (aliasObject.adminEnable) {
if (player.hasPermission(aliasObject.adminPermission.replace("<alias>", alias.toLowerCase()))) { if (player.hasPermission(aliasObject.adminPermission.replace("[alias]", alias.toLowerCase()))) {
if (aliasObject.adminCommandEnable) { if (aliasObject.adminCommandEnable) {
aliasAdminCommand(aliasObject, alias, player, args); aliasAdminCommand(aliasObject, alias, player, args);
} }
@@ -64,18 +64,18 @@ public class ExecuteAlias {
} }
if (aliasObject.permNecessary) { 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; String npmsg;
if (aliasObject.permissionMSG == null || aliasObject.permissionMSG.equals("")) { if (aliasObject.permissionMSG == null || aliasObject.permissionMSG.equals("")) {
npmsg = Language.noPermission.value; npmsg = Language.noPermission.value;
} else npmsg = aliasObject.permissionMSG; } else npmsg = aliasObject.permissionMSG;
T2Csend.player(player, npmsg.replace("[cmd]", "/" + alias.toLowerCase()) 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; return;
} }
} }
if (aliasObject.costEnable && aliasObject.costConfirm) { 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)); Cache.aliasStorage.put(player.getUniqueId(), new AliasStorageObject(aliasObject, alias, args, false));
switch ((Confirm) Config.buyConfirmDefault.value) { switch ((Confirm) Config.buyConfirmDefault.value) {
case GUI: case GUI:
@@ -99,8 +99,35 @@ public class ExecuteAlias {
} }
protected static void executeAlias(Player player, AliasObject aliasObject, String alias, String[] args) { 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.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)) { if (!T2Ceco.moneyRemove(prefix, player, aliasObject.costPrice)) {
T2Csend.player(player, Language.noMoney.value); T2Csend.player(player, Language.noMoney.value);
return; return;
@@ -109,6 +136,7 @@ public class ExecuteAlias {
T2Csend.player(player, Language.buy.value.replace("[price]", aliasObject.costPrice.toString() + " " + Config.buyCurrency.value)); T2Csend.player(player, Language.buy.value.replace("[price]", aliasObject.costPrice.toString() + " " + Config.buyCurrency.value));
} }
} }
if (aliasObject.commandEnable) { if (aliasObject.commandEnable) {
aliasCommand(aliasObject, alias, player, args); aliasCommand(aliasObject, alias, player, args);
} }
@@ -127,7 +155,7 @@ public class ExecuteAlias {
Player player = (Player) sender; Player player = (Player) sender;
if (aliasObject.adminEnable) { if (aliasObject.adminEnable) {
if (player.hasPermission(aliasObject.adminPermission.replace("<alias>", alias.toLowerCase()))){ if (player.hasPermission(aliasObject.adminPermission.replace("[alias]", alias.toLowerCase()))) {
if (aliasObject.adminCommandEnable) { if (aliasObject.adminCommandEnable) {
subAliasAdminCommand(aliasObject, alias, player, args); subAliasAdminCommand(aliasObject, alias, player, args);
} }
@@ -139,13 +167,13 @@ public class ExecuteAlias {
} }
if (aliasObject.permNecessary) { 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; String npmsg;
if (aliasObject.permissionMSG == null || aliasObject.permissionMSG.equals("")) { if (aliasObject.permissionMSG == null || aliasObject.permissionMSG.equals("")) {
npmsg = Language.noPermission.value; npmsg = Language.noPermission.value;
} else npmsg = aliasObject.permissionMSG; } else npmsg = aliasObject.permissionMSG;
T2Csend.player(player, npmsg.replace("[cmd]", "/" + alias.toLowerCase()) 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; return;
} }
} }
@@ -179,8 +207,37 @@ public class ExecuteAlias {
} }
protected static void executeSubAlias(Player player, SubAliasObject aliasObject, String alias, String[] args) { 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.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)) { if (!T2Ceco.moneyRemove(prefix, player, aliasObject.costPrice)) {
T2Csend.player(player, Language.noMoney.value); T2Csend.player(player, Language.noMoney.value);
return; return;

View File

@@ -31,7 +31,7 @@ public class TabEvent implements Listener {
String[] args = input.split(" ", -1); String[] args = input.split(" ", -1);
for (String al : aliasObject.subAliasList) { 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; int arg = aliasObject.subAliasArg;
if (args.length - 1 == arg) { 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) { public static void convertAddPermission(YamlConfiguration yamlConfiguration, File config_gui, Boolean subalias) {
if (subalias) { if (subalias) {
yamlConfiguration.set("SubAlias.Permission.Permission", "t2code.alias.use.subalias.<alias>"); yamlConfiguration.set("SubAlias.Permission.Permission", "t2c.alias.sub.use.[alias]");
} else yamlConfiguration.set("Alias.Permission.Permission", "t2code.alias.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 { try {
yamlConfiguration.save(config_gui); yamlConfiguration.save(config_gui);
} catch (IOException e) { } catch (IOException e) {

View File

@@ -8,6 +8,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
@@ -21,27 +22,30 @@ public class CreateExampleAliasConfig {
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config); YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
T2Cconfig.set("Alias.Enable", true, yamlConfiguration); T2Cconfig.set("Alias.Enable", true, yamlConfiguration);
T2Cconfig.set("Alias.AliasList", Arrays.asList("aliasexample1"),yamlConfiguration); T2Cconfig.set("Alias.AliasList", Arrays.asList("aliasexample1","t2caliasexample"),yamlConfiguration);
T2Cconfig.set("Alias.Permission.Necessary", true, 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.Permission.CustomNoPermissionMSG", "", 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.Enable", false,yamlConfiguration);
T2Cconfig.set("Alias.Cost.Confirm", true,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);
T2Cconfig.set("Alias.Command.Enable", true, yamlConfiguration); T2Cconfig.set("Alias.Command.Enable", false, yamlConfiguration);
T2Cconfig.set("Alias.Command.CommandAsConsole", true, yamlConfiguration); T2Cconfig.set("Alias.Command.CommandAsConsole", true, yamlConfiguration);
T2Cconfig.set("Alias.Command.BungeeCommand", false, yamlConfiguration); T2Cconfig.set("Alias.Command.BungeeCommand", false, yamlConfiguration);
T2Cconfig.set("Alias.Command.Commands", Arrays.asList("say hi"), yamlConfiguration); T2Cconfig.set("Alias.Command.Commands", Arrays.asList(), yamlConfiguration);
T2Cconfig.set("Alias.Message.Enable", false, yamlConfiguration); T2Cconfig.set("Alias.Message.Enable", true, yamlConfiguration);
T2Cconfig.set("Alias.Message.Messages", Arrays.asList(), yamlConfiguration); T2Cconfig.set("Alias.Message.Messages", Arrays.asList("<rainbow>This is a test alias</rainbow>", "<color:#d7ff0f>With this you can use several functions such as <color:#ffd6ad>colored text</color>, <click:suggest_command:'/command'><hover:show_text:'<color:#ff745c>Use Command</color>'>clickable texts</hover></click>, <hover:show_text:'<color:#1f66ff>For example Warps</color>'><click:suggest_command:'/warp home'><color:#365eff>shorten commands of other plugins</color></click></hover> and much more.</color>", "<color:#85a0ff><click:open_url:'http://dc.t2code.net'><hover:show_text:'<color:#0887ff>http://dc.t2code.net</color>'>If you have any questions, please contact our support Discord.</hover></click></color>"), yamlConfiguration);
T2Cconfig.set("Alias.Admin.Enable", false, 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.Enable", true, yamlConfiguration);
T2Cconfig.set("Alias.Admin.Command.CommandAsConsole", true, yamlConfiguration); T2Cconfig.set("Alias.Admin.Command.CommandAsConsole", true, yamlConfiguration);

View File

@@ -4,14 +4,12 @@ import com.google.common.base.Preconditions;
import net.t2code.alias.Spigot.Main; import net.t2code.alias.Spigot.Main;
import net.t2code.alias.Spigot.system.AliasRegister; import net.t2code.alias.Spigot.system.AliasRegister;
import net.t2code.alias.Spigot.objects.AliasObject; import net.t2code.alias.Spigot.objects.AliasObject;
import net.t2code.alias.Spigot.system.BukkitCommandWrap_Useless;
import net.t2code.alias.Util; import net.t2code.alias.Util;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend; import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate; import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
@@ -65,6 +63,17 @@ public class SelectAlias {
} }
String permissionMSG = yamlConfiguration.getString("Alias.Permission.CustomNoPermissionMSG"); String permissionMSG = yamlConfiguration.getString("Alias.Permission.CustomNoPermissionMSG");
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"); Boolean costEnable = yamlConfiguration.getBoolean("Alias.Cost.Enable");
if (yamlConfiguration.get("Alias.Cost.Confirm") == null) { if (yamlConfiguration.get("Alias.Cost.Confirm") == null) {
AliasConfigConverter.convertAddCostConfirm(yamlConfiguration, config_gui, false); AliasConfigConverter.convertAddCostConfirm(yamlConfiguration, config_gui, false);
@@ -100,9 +109,9 @@ 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, costConfirm, costPrice, costAllowBypass, commandEnable, commandAsConsole, bungeeCommand, AliasObject alias = new AliasObject(aliasEnable, aliasList, permNecessary, permission, permissionMSG, cooldownGlobal, cooldownPlayer, costEnable, costConfirm, costPrice, costAllowBypass, commandEnable,
command, messageEnable, messages, adminEnable, adminPermission, adminCommandEnable, adminCommandAsConsole, adminBungeeCommand, adminCommands, commandAsConsole, bungeeCommand, command, messageEnable, messages, adminEnable, adminPermission, adminCommandEnable, adminCommandAsConsole, adminBungeeCommand, adminCommands, adminMessageEnable,
adminMessageEnable, adminMessages, consoleEnable, consoleCommandEnable, consoleBungeeCommand, consoleCommands, consoleMessageEnable, consoleMessages); adminMessages, consoleEnable, consoleCommandEnable, consoleBungeeCommand, consoleCommands, consoleMessageEnable, consoleMessages);
for (String al : aliasList) { for (String al : aliasList) {
Main.aliasHashMap.put(al, alias); Main.aliasHashMap.put(al, alias);
} }

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.ConfigParam;
import net.t2code.alias.Spigot.enums.Confirm; import net.t2code.alias.Spigot.enums.Confirm;
import net.t2code.alias.Util; 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.items.T2CitemVersion;
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion; import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
import org.bukkit.Sound; import org.bukkit.Sound;

View File

@@ -17,8 +17,9 @@ import java.util.logging.Level;
public class Convert { public class Convert {
protected static void convert() { protected static void convert() {
File config = new File(Main.getPath(),""); File path = new File(Main.getPath(),"");
if (config.exists()) convertTo4(); File file = new File(Main.getPath(), "config.yml");
if (path.exists() && file.exists()) convertTo4();
} }
private static void convertTo4() { private static void convertTo4() {
@@ -26,7 +27,7 @@ public class Convert {
File config = new File(Main.getPath(), "config.yml"); File config = new File(Main.getPath(), "config.yml");
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config); YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
if (yamlConfiguration.get(Config.configVersion.path) == null || ((Integer) Config.configVersion.value) < Util.getConfigVersion() && new File(Main.getPath(), "config.yml").exists()) { if (yamlConfiguration.get(Config.configVersion.path) == null || ((Integer) Config.configVersion.value) < Util.getConfigVersion()) {
yamlConfiguration.set("ConfigVersion", null); yamlConfiguration.set("ConfigVersion", null);
try { try {
yamlConfiguration.save(config); yamlConfiguration.save(config);
@@ -36,6 +37,9 @@ public class Convert {
File dir = new File(Main.getPath() + "/languages"); File dir = new File(Main.getPath() + "/languages");
File newDir = new File(Main.getPath() + "/OldConfig/Version3/languages"); File newDir = new File(Main.getPath() + "/OldConfig/Version3/languages");
if (!dir.exists()){
return;
}
try { try {
FileUtils.moveDirectory(dir, newDir); FileUtils.moveDirectory(dir, newDir);
} catch (IOException e) { } catch (IOException e) {

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>", 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), "[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), 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>", 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), "[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>", 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.SubAliasFor", "aliasexample1", yamlConfiguration);
T2Cconfig.set("SubAlias.Permission.Necessary", true, 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.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.Enable", false, yamlConfiguration);
T2Cconfig.set("SubAlias.Cost.Confirm", true,yamlConfiguration); T2Cconfig.set("SubAlias.Cost.Confirm", true,yamlConfiguration);
T2Cconfig.set("SubAlias.Cost.Price", 0.0, 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.Message.Messages",Arrays.asList(), yamlConfiguration);
T2Cconfig.set("SubAlias.Admin.Enable", false, 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.Enable", true, yamlConfiguration);
T2Cconfig.set("SubAlias.Admin.Command.CommandAsConsole", true, yamlConfiguration); T2Cconfig.set("SubAlias.Admin.Command.CommandAsConsole", true, yamlConfiguration);

View File

@@ -66,6 +66,16 @@ public class SelectSubAlias {
} }
String permissionMSG = yamlConfiguration.getString("SubAlias.Permission.CustomNoPermissionMSG"); String permissionMSG = yamlConfiguration.getString("SubAlias.Permission.CustomNoPermissionMSG");
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"); Boolean costEnable = yamlConfiguration.getBoolean("SubAlias.Cost.Enable");
if (yamlConfiguration.get("SubAlias.Cost.Confirm") == null) { if (yamlConfiguration.get("SubAlias.Cost.Confirm") == null) {
AliasConfigConverter.convertAddCostConfirm(yamlConfiguration, config_gui, true); AliasConfigConverter.convertAddCostConfirm(yamlConfiguration, config_gui, true);
@@ -100,12 +110,14 @@ 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,costConfirm, costPrice, costAllowBypass, commandEnable, commandAsConsole, bungeeCommand, SubAliasObject subAlias = new SubAliasObject(aliasEnable, subAliasList, subAliasFor, subAliasArg, permNecessary, permission, permissionMSG, cooldownGlobal, cooldownPlayer, costEnable, costConfirm,
command, messageEnable, messages, adminEnable, adminPermission, adminCommandEnable, adminCommandAsConsole, adminBungeeCommand, adminCommands, costPrice, costAllowBypass, commandEnable, commandAsConsole, bungeeCommand, command, messageEnable, messages, adminEnable, adminPermission, adminCommandEnable, adminCommandAsConsole,
adminMessageEnable, adminMessages, consoleEnable, consoleCommandEnable, consoleBungeeCommand, consoleCommands, consoleMessageEnable, consoleMessages); adminBungeeCommand, adminCommands, adminMessageEnable, adminMessages, consoleEnable, consoleCommandEnable, consoleBungeeCommand, consoleCommands, consoleMessageEnable, consoleMessages);
for (String sal : subAliasList) { for (String sal : subAliasList) {
Main.subAliasHashMap.put(sal, subAlias); Main.subAliasHashMap.put(sal, subAlias);
} }
Main.allSubAliases.addAll(subAliasList); Main.allSubAliases.addAll(subAliasList);
Main.allForSubAliases.add(subAliasFor); Main.allForSubAliases.add(subAliasFor);
T2Csend.console(Prefix + " §aSubAlias file §e" + config_gui.getName() + " §awas loaded"); T2Csend.console(Prefix + " §aSubAlias file §e" + config_gui.getName() + " §awas loaded");

View File

@@ -1,8 +1,14 @@
package net.t2code.alias.Spigot.objects; package net.t2code.alias.Spigot.objects;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.UUID;
public class AliasObject { public class AliasObject {
public HashMap<UUID, Long> cooldownPlayerMap = new HashMap<>();
public Long globalCooldownInt = 0L;
public Boolean aliasEnable; public Boolean aliasEnable;
public List<String> aliasList; public List<String> aliasList;
@@ -10,6 +16,9 @@ public class AliasObject {
public String permission; public String permission;
public String permissionMSG; public String permissionMSG;
public Integer cooldownGlobal;
public Integer cooldownPlayer;
public Boolean costEnable; public Boolean costEnable;
public Boolean costConfirm; public Boolean costConfirm;
public Double costPrice; public Double costPrice;
@@ -44,6 +53,9 @@ public class AliasObject {
String permission, String permission,
String permissionMSG, String permissionMSG,
Integer cooldownGlobal,
Integer cooldownPlayer,
Boolean costEnable, Boolean costEnable,
Boolean costConfirm, Boolean costConfirm,
Double costPrice, Double costPrice,
@@ -77,6 +89,9 @@ public class AliasObject {
this.permission = permission; this.permission = permission;
this.permissionMSG = permissionMSG; this.permissionMSG = permissionMSG;
this.cooldownGlobal = cooldownGlobal;
this.cooldownPlayer = cooldownPlayer;
this.costEnable = costEnable; this.costEnable = costEnable;
this.costConfirm = costConfirm; this.costConfirm = costConfirm;
this.costPrice = costPrice; this.costPrice = costPrice;

View File

@@ -0,0 +1,15 @@
package net.t2code.alias.Spigot.objects;
import java.util.UUID;
public class Cooldown {
public UUID player;
public Long long_;
public Cooldown(UUID player,
Long long_) {
this.player = player;
this.long_ = long_;
}
}

View File

@@ -1,8 +1,13 @@
package net.t2code.alias.Spigot.objects; package net.t2code.alias.Spigot.objects;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.UUID;
public class SubAliasObject { public class SubAliasObject {
public HashMap<UUID, Long> cooldownPlayerMap = new HashMap<>();
public Long globalCooldownInt = 0L;
public Boolean subAliasEnable; public Boolean subAliasEnable;
public List<String> subAliasList; public List<String> subAliasList;
public Integer subAliasArg; public Integer subAliasArg;
@@ -12,6 +17,9 @@ public class SubAliasObject {
public String permission; public String permission;
public String permissionMSG; public String permissionMSG;
public Integer cooldownGlobal;
public Integer cooldownPlayer;
public Boolean costEnable; public Boolean costEnable;
public Boolean costConfirm; public Boolean costConfirm;
public Double costPrice; public Double costPrice;
@@ -48,6 +56,9 @@ public class SubAliasObject {
String permission, String permission,
String permissionMSG, String permissionMSG,
Integer cooldownGlobal,
Integer cooldownPlayer,
Boolean costEnable, Boolean costEnable,
Boolean costConfirm, Boolean costConfirm,
Double costPrice, Double costPrice,
@@ -83,6 +94,9 @@ public class SubAliasObject {
this.permission = permission; this.permission = permission;
this.permissionMSG = permissionMSG; this.permissionMSG = permissionMSG;
this.cooldownGlobal = cooldownGlobal;
this.cooldownPlayer = cooldownPlayer;
this.costEnable = costEnable; this.costEnable = costEnable;
this.costConfirm = costConfirm; this.costConfirm = costConfirm;
this.costPrice = costPrice; this.costPrice = costPrice;

View File

@@ -30,7 +30,7 @@ public class AliasRegister {
if (!(T2CmcVersion.isMc1_8() || T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12())) { if (!(T2CmcVersion.isMc1_8() || T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12())) {
Main.getPlugin().getBukkitCommandWrap().sync(); // Main.getPlugin().getBukkitCommandWrap().sync();
if (Bukkit.getOnlinePlayers().size() >= 1) if (Bukkit.getOnlinePlayers().size() >= 1)
for (Player player : Bukkit.getOnlinePlayers()) player.updateCommands(); for (Player player : Bukkit.getOnlinePlayers()) player.updateCommands();
} }
@@ -83,8 +83,5 @@ public class AliasRegister {
} else T2Csend.warning(Main.getPlugin(), " §4AliasHashmap is null! - " + alias); } 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);
}
} }

View File

@@ -5,6 +5,7 @@ import net.t2code.alias.Spigot.objects.AliasObject;
import net.t2code.alias.Spigot.objects.SubAliasObject; import net.t2code.alias.Spigot.objects.SubAliasObject;
import net.t2code.t2codelib.SPIGOT.api.register.T2Cregister; import net.t2code.t2codelib.SPIGOT.api.register.T2Cregister;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.permissions.PermissionDefault;
public class AliasRegisterPermissions { public class AliasRegisterPermissions {
@@ -12,23 +13,41 @@ public class AliasRegisterPermissions {
for (AliasObject aliasObject : Main.aliasHashMap.values()) { for (AliasObject aliasObject : Main.aliasHashMap.values()) {
for (String alias : aliasObject.aliasList){ for (String alias : aliasObject.aliasList) {
if (Bukkit.getPluginManager().getPermission(aliasObject.permission.replace("<alias>",alias).toLowerCase()) == null) { if (aliasObject.permission != null && Bukkit.getPluginManager().getPermission(aliasObject.permission.replace("[alias]", alias).toLowerCase()) == null) {
T2Cregister.permission(aliasObject.permission.replace("<alias>",alias).toLowerCase(), Main.getPlugin()); T2Cregister.permission(aliasObject.permission.replace("[alias]", alias).toLowerCase(), Main.getPlugin());
} }
if (Bukkit.getPluginManager().getPermission(aliasObject.adminPermission.replace("<alias>",alias).toLowerCase()) == null) { if (aliasObject.adminPermission != null && Bukkit.getPluginManager().getPermission(aliasObject.adminPermission.replace("[alias]", alias).toLowerCase()) == null) {
T2Cregister.permission(aliasObject.adminPermission.replace("<alias>",alias).toLowerCase(), Main.getPlugin()); 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 (SubAliasObject subAliasObject : Main.subAliasHashMap.values()) {
for (String alias : subAliasObject.subAliasList){ for (String alias : subAliasObject.subAliasList) {
if (Bukkit.getPluginManager().getPermission(subAliasObject.permission.replace("<alias>",alias).toLowerCase()) == null) { if (subAliasObject.permission != null && Bukkit.getPluginManager().getPermission(subAliasObject.permission.replace("[alias]", alias).toLowerCase()) == null) {
T2Cregister.permission(subAliasObject.permission.replace("<alias>",alias).toLowerCase(), Main.getPlugin()); T2Cregister.permission(subAliasObject.permission.replace("[alias]", alias).toLowerCase(), Main.getPlugin());
} }
if (Bukkit.getPluginManager().getPermission(subAliasObject.adminPermission.replace("<alias>",alias).toLowerCase()) == null) { if (subAliasObject.adminPermission != null && Bukkit.getPluginManager().getPermission(subAliasObject.adminPermission.replace("[alias]", alias).toLowerCase()) == null) {
T2Cregister.permission(subAliasObject.adminPermission.replace("<alias>",alias).toLowerCase(), Main.getPlugin()); 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

@@ -1,6 +1,7 @@
package net.t2code.alias.Spigot.system; package net.t2code.alias.Spigot.system;
import net.t2code.alias.Spigot.Main; import net.t2code.alias.Spigot.Main;
import net.t2code.t2codelib.SPIGOT.system.T2CbungeeCommandSenderReciver;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@@ -12,31 +13,7 @@ import java.io.IOException;
public class BCommandSenderReciver { public class BCommandSenderReciver {
public static void sendToBungee(CommandSender sender, String information, Boolean console) { public static void sendToBungee(CommandSender sender, String information, Boolean console) {
ByteArrayOutputStream stream = new ByteArrayOutputStream(); T2CbungeeCommandSenderReciver.sendToBungee(sender,information,console);
DataOutputStream output = new DataOutputStream(stream);
try {
if (console) {
output.writeUTF("T2Code-Console");
} else {
if (sender instanceof Player) {
output.writeUTF(sender.getName());
} else {
output.writeUTF("T2Code-Console");
}
}
output.writeUTF(information);
} catch (IOException e) {
e.printStackTrace();
}
if (sender instanceof Player) {
Player player = (Player) sender;
player.sendPluginMessage(Main.getPlugin(), "t2c:bcmd", stream.toByteArray());
}else {
for(Player player : Bukkit.getOnlinePlayers()){
player.sendPluginMessage(Main.getPlugin(), "t2c:bcmd", stream.toByteArray());
return;
}
}
} }
} }

View File

@@ -1,247 +0,0 @@
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();
}
}
}

View File

@@ -1,17 +0,0 @@
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) {
}
}

View File

@@ -44,10 +44,11 @@ public class Load {
public static void loadReload() { public static void loadReload() {
HandlerList.unregisterAll(chatListener); HandlerList.unregisterAll(chatListener);
HandlerList.unregisterAll(guiListener); HandlerList.unregisterAll(guiListener);
boolean newInstall = !new File(Main.getPath(), "config.yml").exists();
FileSelect.config(); FileSelect.config();
T2Ctemplate.onLoadSeparateStroke(Util.getPrefix()); T2Ctemplate.onLoadSeparateStroke(Util.getPrefix());
FileSelect.language(); FileSelect.language();
if (!new File(Main.getPath(), "config.yml").exists()) { if (newInstall) {
try { try {
CreateExampleAliasConfig.configCreate(); CreateExampleAliasConfig.configCreate();
} catch (Exception e) { } catch (Exception e) {

View File

@@ -22,6 +22,6 @@ public class PluginEvents implements Listener {
@EventHandler @EventHandler
public void onJoinEvent(PlayerLoginEvent event) { 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: AliasList:
- aliasexample1 - aliasexample1
- aliasexample2 - aliasexample2
-
Permission: Permission:
# Here you can say if a permission is needed to use the alias# # Here you can say if a permission is needed to use the alias#
Necessary: true Necessary: true
# Here you can set the permission for the alias. # 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. # 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. # 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: "" 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: Cost:
# Here you can say if you have to pay for the alias # Here you can say if you have to pay for the alias
Enable: false Enable: false
# Here you set the price # Here you set the price
Price: 0.0 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 AllowByPass: true
# Here you can set if you have to confirm if you want to pay before executing the command # 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. # 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 Confirm: true
Command: Command:
# Here you can tell the alias to execute one or more commands # Here you can tell the alias to execute one or more commands
Enable: false Enable: false
@@ -41,7 +59,8 @@ Alias:
BungeeCommand: false BungeeCommand: false
# Here you can specify one or more commands to be executed. # Here you can specify one or more commands to be executed.
# Placeholder: [player] = The player who executes the alias # Placeholder: [player] = The player who executes the alias
Commands: [ ] Commands: []
Message: Message:
# Here you can specify whether the player should receive a message. # Here you can specify whether the player should receive a message.
Enable: false Enable: false
@@ -67,7 +86,7 @@ Alias:
# You can also use MiniMessage: # You can also use MiniMessage:
# Wiki: https://docs.adventure.kyori.net/minimessage/format.html # Wiki: https://docs.adventure.kyori.net/minimessage/format.html
# WebUI: https://webui.adventure.kyori.net # WebUI: https://webui.adventure.kyori.net
Messages: [ ] Messages: []
# Here you can specify that players with the permission () have a different function than other players. # Here you can specify that players with the permission () have a different function than other players.
# For example, you can say that players should come to a certain point and players with the admin function only to the server to the position where they were before. # For example, you can say that players should come to a certain point and players with the admin function only to the server to the position where they were before.
@@ -78,9 +97,9 @@ Alias:
# Here you can enable or disable the admin function # Here you can enable or disable the admin function
Enable: false Enable: false
# Here you set the permission for the admin function # 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. # 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: Command:
# Here you can tell the alias to execute one or more commands # Here you can tell the alias to execute one or more commands
Enable: false Enable: false
@@ -92,7 +111,8 @@ Alias:
BungeeCommand: false BungeeCommand: false
# Here you can specify one or more commands to be executed. # Here you can specify one or more commands to be executed.
# Placeholder: [player] = The player who executes the alias # Placeholder: [player] = The player who executes the alias
Commands: [ ] Commands: []
Message: Message:
# Here you can specify whether the player should receive a message. # Here you can specify whether the player should receive a message.
Enable: false Enable: false
@@ -118,7 +138,7 @@ Alias:
# You can also use MiniMessage: # You can also use MiniMessage:
# Wiki: https://docs.adventure.kyori.net/minimessage/format.html # Wiki: https://docs.adventure.kyori.net/minimessage/format.html
# WebUI: https://webui.adventure.kyori.net # WebUI: https://webui.adventure.kyori.net
Messages: [ ] Messages: []
Console: Console:
# Here you can define if the alias is also usable in the console and what it should do from there. # Here you can define if the alias is also usable in the console and what it should do from there.
@@ -130,9 +150,9 @@ Alias:
# For this option, BungeeCord must be set to true in config.yml and the plugin must also work on the proxy as a bridge. # For this option, BungeeCord must be set to true in config.yml and the plugin must also work on the proxy as a bridge.
BungeeCommand: false BungeeCommand: false
# Here you can specify one or more commands to be executed. # Here you can specify one or more commands to be executed.
Commands: [ ] Commands: []
Message: Message:
# Here you can specify whether the player should receive a message. # Here you can specify whether the player should receive a message.
Enable: false Enable: false
# Specify here the message that the player should get. # Specify here the message that the player should get.
Messages: [ ] Messages: []

View File

@@ -19,21 +19,38 @@ SubAlias:
# Here you can say if a permission is needed to use the alias# # Here you can say if a permission is needed to use the alias#
Necessary: true Necessary: true
# Here you can set the permission for the alias. # 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. # 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. # 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: "" 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: Cost:
# Here you can say if you have to pay for the alias # Here you can say if you have to pay for the alias
Enable: false Enable: false
# Here you set the price # Here you set the price
Price: 0.0 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 AllowByPass: true
# Here you can set if you have to confirm if you want to pay before executing the command # 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. # 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 Confirm: true
Command: Command:
# Here you can tell the alias to execute one or more commands # Here you can tell the alias to execute one or more commands
Enable: false Enable: false
@@ -46,6 +63,7 @@ SubAlias:
# Here you can specify one or more commands to be executed. # Here you can specify one or more commands to be executed.
# Placeholder: [player] = The player who executes the alias # Placeholder: [player] = The player who executes the alias
Commands: [] Commands: []
Message: Message:
# Here you can specify whether the player should receive a message. # Here you can specify whether the player should receive a message.
Enable: false Enable: false
@@ -82,9 +100,9 @@ SubAlias:
# Here you can enable or disable the admin function # Here you can enable or disable the admin function
Enable: false Enable: false
# Here you set the permission for the admin function # 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. # 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: Command:
# Here you can tell the alias to execute one or more commands # Here you can tell the alias to execute one or more commands
Enable: false Enable: false
@@ -97,6 +115,7 @@ SubAlias:
# Here you can specify one or more commands to be executed. # Here you can specify one or more commands to be executed.
# Placeholder: [player] = The player who executes the alias # Placeholder: [player] = The player who executes the alias
Commands: [] Commands: []
Message: Message:
# Here you can specify whether the player should receive a message. # Here you can specify whether the player should receive a message.
Enable: false Enable: false

View File

@@ -10,7 +10,7 @@ plugin:
# In this option you can set the language of the plugin. # In this option you can set the language of the plugin.
language: english language: english
updateCheck: 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 onJoin: true
# In this option you can set whether you want to receive and display beta and snapshot versions in the update check. # In this option you can set whether you want to receive and display beta and snapshot versions in the update check.
seePreReleaseUpdates: true seePreReleaseUpdates: true

View File

@@ -16,20 +16,39 @@ commands:
aliases: [t2c-a, alias] aliases: [t2c-a, alias]
permissions: permissions:
t2code.alias.admin: t2c.alias.admin:
default: op default: op
children: children:
t2code.alias.updatemsg: true t2c.alias.updatemsg: true
t2code.alias.command.reload: true t2c.alias.command.reload: true
t2code.alias.command.info: true t2c.alias.command.info: true
t2code.alias.buy.bypass: 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 default: op
t2code.alias.updatemsg: t2c.alias.command.reload:
default: op default: op
t2code.alias.command.reload: t2c.alias.command.info:
default: op 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 default: op