Compare commits
34 Commits
1.1.7
...
Developmen
Author | SHA1 | Date | |
---|---|---|---|
ad55fb53de | |||
f5ec79e90d | |||
ffa4423b7c | |||
3b0a2fbe94 | |||
2f2c68efdd | |||
4735f9f6fe | |||
bc7803831c | |||
456e13bf5f | |||
5f6648c628 | |||
f0b3b6e4fd | |||
d95de86b58 | |||
a85fd20f93 | |||
b7b3fbcb03 | |||
5d72e0d48d | |||
d25b704ff1 | |||
9aede116ac | |||
97fc283951 | |||
7e6c889583 | |||
a1ffd48f3e | |||
0c1d32e0e8 | |||
987370586a | |||
020f33da07 | |||
48196f446c | |||
6e96509069 | |||
fd0db6939a | |||
b5f3737fbd | |||
7833144a9a | |||
10e23c6dcf | |||
be73deface | |||
f4d8d3496a | |||
5514e62f5d | |||
ba1db37a90 | |||
02e7020815 | |||
546b827e02 |
@ -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">
|
||||
|
72
pom.xml
72
pom.xml
@ -6,7 +6,11 @@
|
||||
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>Alias</artifactId>
|
||||
<version>1.1.7</version>
|
||||
|
||||
<version>1.6_beta-1</version>
|
||||
<!--version>VERSION_snapshot-0</version-->
|
||||
<!--version>VERSION_beta-0</version-->
|
||||
<!--version>VERSION_dev-0</version-->
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>T2C-Alias</name>
|
||||
@ -19,14 +23,15 @@
|
||||
<url>T2Code.net</url>
|
||||
|
||||
<build>
|
||||
<finalName>${project.name}_${project.version}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
<source>11</source>
|
||||
<target>11</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
@ -35,15 +40,19 @@
|
||||
<version>3.2.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>shade</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
<relocations>
|
||||
|
||||
</relocations>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<resources>
|
||||
@ -55,36 +64,51 @@
|
||||
</build>
|
||||
|
||||
<repositories>
|
||||
<!-- Spigot -->
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
|
||||
<!-- Mojang authlib -->
|
||||
<repository>
|
||||
<id>paper-repo</id>
|
||||
<url>https://papermc.io/repo/repository/maven-public/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>T2Code</id>
|
||||
<url>https://repo.t2code.net/repository/T2Code/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>Builders-Paradise</id>
|
||||
<url>https://repo.t2code.net/repository/Builders-Paradise/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<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>3.4.40</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>T2CodeLib</artifactId>
|
||||
<version>13.4</version>
|
||||
<version>16.7</version>
|
||||
<classifier>dev-23</classifier>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>bungee</artifactId>
|
||||
<version>1615</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.t2code</groupId>
|
||||
<artifactId>PlugmanGUI</artifactId>
|
||||
<version>3.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.t2code.minecraft.1_13.r1</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.13r1</version>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.30</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
12
src/main/java/net/t2code/alias/Spigot/Cache.java
Normal file
12
src/main/java/net/t2code/alias/Spigot/Cache.java
Normal file
@ -0,0 +1,12 @@
|
||||
package net.t2code.alias.Spigot;
|
||||
|
||||
import net.t2code.alias.Spigot.objects.AliasStorageObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
public class Cache {
|
||||
public static ArrayList<UUID> openPlayers = new ArrayList<UUID>();
|
||||
public static HashMap<UUID, AliasStorageObject> aliasStorage = new HashMap<>();
|
||||
}
|
@ -1,29 +1,39 @@
|
||||
package net.t2code.alias.Spigot;
|
||||
|
||||
import lombok.Getter;
|
||||
import net.t2code.alias.Spigot.objects.AliasObject;
|
||||
import net.t2code.alias.Spigot.objects.SubAliasObject;
|
||||
import net.t2code.alias.Spigot.system.BukkitCommandWrap;
|
||||
import net.t2code.alias.Spigot.system.BukkitCommandWrap_Useless;
|
||||
import net.t2code.alias.Spigot.system.Load;
|
||||
import net.t2code.alias.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
||||
import net.t2code.alias.util.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Template;
|
||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2C_McVersion;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public final class Main extends JavaPlugin {
|
||||
public static File getPath() {
|
||||
return plugin.getDataFolder();
|
||||
return instance.getDataFolder();
|
||||
}
|
||||
|
||||
@Getter
|
||||
private static String version;
|
||||
@Getter
|
||||
private static List<String> autor;
|
||||
private static Main plugin;
|
||||
@Getter
|
||||
private static Main instance;
|
||||
@Getter
|
||||
private static Boolean t2codeLib = false;
|
||||
|
||||
@Getter
|
||||
private static String guiCode;
|
||||
public static HashMap<String, AliasObject> aliasHashMap = new HashMap<>();
|
||||
public static HashMap<String, Boolean> loadAliasHashMap = new HashMap<>();
|
||||
public static HashMap<String, SubAliasObject> subAliasHashMap = new HashMap<>();
|
||||
@ -31,20 +41,21 @@ public final class Main extends JavaPlugin {
|
||||
public static ArrayList<String> allSubAliases = new ArrayList<>();
|
||||
public static ArrayList<String> allForSubAliases = new ArrayList<>();
|
||||
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
// Plugin startup logic
|
||||
plugin = this;
|
||||
autor = plugin.getDescription().getAuthors();
|
||||
version = plugin.getDescription().getVersion();
|
||||
if (pluginNotFound("T2CodeLib", 96388, Util.getRequiredT2CodeLibVersion())) return;
|
||||
try {
|
||||
Class.forName("com.mojang.brigadier.CommandDispatcher");
|
||||
this.bukkitCommandWrap = new BukkitCommandWrap();
|
||||
} catch (ClassNotFoundException | NoClassDefFoundError e) {
|
||||
this.bukkitCommandWrap = new BukkitCommandWrap_Useless();
|
||||
}
|
||||
Load.onLoad(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord(), Util.getBstatsID());
|
||||
instance = this;
|
||||
autor = instance.getDescription().getAuthors();
|
||||
version = instance.getDescription().getVersion();
|
||||
|
||||
if (pluginNotFound("T2CodeLib", 96388, Util.getRequiredT2CodeLibVersion())) return;
|
||||
t2codeLib = true;
|
||||
if (T2C_McVersion.isMc1_13()) {
|
||||
guiCode = "";
|
||||
} else guiCode = "§6§8§9§r";
|
||||
|
||||
new Load(this, Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord(), Util.getBstatsID());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -52,58 +63,40 @@ public final class Main extends JavaPlugin {
|
||||
// Plugin shutdown logic
|
||||
aliasHashMap.clear();
|
||||
allAliases.clear();
|
||||
if (Bukkit.getPluginManager().getPlugin("T2CodeLib") == null) return;
|
||||
T2Ctemplate.onDisable(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord());
|
||||
if (!t2codeLib) return;
|
||||
T2C_Template.onDisable(Util.getPrefix(), instance);
|
||||
}
|
||||
|
||||
public static Boolean pluginNotFound(String pl, Integer spigotID, String ver) {
|
||||
if (Bukkit.getPluginManager().getPlugin(pl) == null) {
|
||||
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
|
||||
instance.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
|
||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §e" + pl + " §4could not be found. Please download it here: "
|
||||
+ "§6https://spigotmc.org/resources/" + pl + "." + spigotID + " §4to be able to use this plugin.");
|
||||
Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
|
||||
Main.instance.getPluginLoader().disablePlugin(Main.instance);
|
||||
return true;
|
||||
} else {
|
||||
String plVer = Bukkit.getPluginManager().getPlugin(pl).getDescription().getVersion();
|
||||
String plVer = Objects.requireNonNull(Bukkit.getPluginManager().getPlugin(pl)).getDescription().getVersion();
|
||||
if (ver.contains("_")) {
|
||||
if (!plVer.equals(ver)) {
|
||||
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
|
||||
instance.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
|
||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §e" + pl + " §4is out of date! This plugin requires the version §2"
|
||||
+ ver + " §4of §6" + pl + " §4Please use this version! Please download it here or contact us in Discord: §6https://spigotmc.org/resources/"
|
||||
+ pl + "." + spigotID + " Or contact us in Discord: http://dc.t2code.net");
|
||||
Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
|
||||
Main.instance.getPluginLoader().disablePlugin(Main.instance);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
String[] split = plVer.split("_");
|
||||
if (Double.parseDouble(split[0]) < Double.parseDouble(ver)) {
|
||||
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
|
||||
instance.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
|
||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §e" + pl + " §4is out of date! This plugin requires at least version §2"
|
||||
+ ver + " §4of §6" + pl + " §4Please update it here: §6https://spigotmc.org/resources/" + pl + "." + spigotID
|
||||
+ " §4to use this version of " + plugin.getDescription().getName() + ".");
|
||||
Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
|
||||
+ " §4to use this version of " + instance.getDescription().getName() + ".");
|
||||
Main.instance.getPluginLoader().disablePlugin(Main.instance);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static Main getPlugin() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
public static String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public static List<String> getAutor() {
|
||||
return autor;
|
||||
}
|
||||
|
||||
private BukkitCommandWrap bukkitCommandWrap = null;
|
||||
|
||||
public BukkitCommandWrap getBukkitCommandWrap() {
|
||||
return this.bukkitCommandWrap;
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,9 @@
|
||||
package net.t2code.alias.Spigot.cmdManagement;
|
||||
|
||||
import net.t2code.alias.Spigot.config.languages.SelectMessages;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.alias.Spigot.config.config.Config;
|
||||
import net.t2code.alias.Spigot.config.config.Language;
|
||||
import net.t2code.alias.Spigot.enums.Confirm;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -21,26 +23,32 @@ 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, SelectMessages.noPermissionForCommand.replace("[cmd]", "/t2code-alias info")
|
||||
.replace("[perm]", "t2code.alias.command.info"));
|
||||
} else T2C_Send.sender(sender, Language.VALUES.noPermission.getValue().toString().replace("[cmd]", "/t2code-alias 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, SelectMessages.noPermissionForCommand.replace("[cmd]", "/t2code-alias reload")
|
||||
.replace("[perm]", "t2code.alias.command.reload"));
|
||||
} else T2C_Send.sender(sender, Language.VALUES.noPermission.getValue().toString().replace("[cmd]", "/t2code-alias reload")
|
||||
.replace("[perm]", "t2c.alias.command.reload"));
|
||||
break;
|
||||
case "confirm":
|
||||
if (Config.VALUES.buyConfirmDefault.getValue() == Confirm.COMMAND) ExecuteAlias.storage(sender, true);
|
||||
break;
|
||||
case "cancel":
|
||||
ExecuteAlias.storage(sender, false);
|
||||
break;
|
||||
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, SelectMessages.noPermissionForCommand.replace("[cmd]", "/t2code-alias info")
|
||||
.replace("[perm]", "t2code.alias.command.info"));
|
||||
} else T2C_Send.sender(sender, Language.VALUES.noPermission.getValue().toString().replace("[cmd]", "/t2code-alias info")
|
||||
.replace("[perm]", "t2c.alias.command.info"));
|
||||
break;
|
||||
|
||||
}
|
||||
@ -50,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
|
||||
@ -62,7 +70,7 @@ public class AliasCmdExecuter implements CommandExecutor, TabCompleter {
|
||||
Player p = (Player) sender;
|
||||
if (args.length == 1) {
|
||||
for (String command : arg1.keySet()) {
|
||||
Boolean passend = true;
|
||||
boolean passend = true;
|
||||
for (int i = 0; i < args[0].length(); i++) {
|
||||
if (args[0].length() >= command.length()) {
|
||||
passend = false;
|
||||
|
@ -1,28 +1,29 @@
|
||||
package net.t2code.alias.Spigot.cmdManagement;
|
||||
|
||||
import net.t2code.alias.Spigot.Main;
|
||||
import net.t2code.alias.Spigot.config.languages.SelectMessages;
|
||||
import net.t2code.alias.Spigot.config.config.Language;
|
||||
import net.t2code.alias.Spigot.system.Load;
|
||||
import net.t2code.alias.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
||||
import net.t2code.alias.util.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Template;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Commands {
|
||||
|
||||
public static void info(CommandSender sender) {
|
||||
T2Ctemplate.sendInfo(sender, Main.getPlugin(), Util.getSpigotID(), Util.getDiscord(), Util.getInfoText());
|
||||
T2C_Template.sendInfo(sender, Main.getInstance(), Util.getSpigotID(), Util.getDiscord(), Util.getInfoText());
|
||||
}
|
||||
|
||||
public static void reload(CommandSender sender) {
|
||||
if (sender instanceof Player) T2Csend.player((Player) sender, SelectMessages.reloadStart);
|
||||
T2Csend.console(Util.getPrefix() + "§8-------------------------------");
|
||||
T2Csend.console(Util.getPrefix() + " §6Plugin reload...");
|
||||
T2Csend.console(Util.getPrefix() + "§8-------------------------------");
|
||||
Load.loadReload();
|
||||
if (sender instanceof Player) T2Csend.player((Player) sender, SelectMessages.reloadEnd);
|
||||
T2Csend.console(Util.getPrefix() + "§8-------------------------------");
|
||||
T2Csend.console(Util.getPrefix() + " §2Plugin successfully reloaded.");
|
||||
T2Csend.console(Util.getPrefix() + "§8-------------------------------");
|
||||
if (sender instanceof Player) T2C_Send.player((Player) sender, Language.VALUES.reloadStart.getValue().toString());
|
||||
T2C_Send.console(Util.getPrefix() + "§8-------------------------------");
|
||||
T2C_Send.console(Util.getPrefix() + " §6Plugin reload...");
|
||||
T2C_Send.console(Util.getPrefix() + "§8-------------------------------");
|
||||
Load.loadReload(Main.getInstance(),true);
|
||||
if (sender instanceof Player) T2C_Send.player((Player) sender, Language.VALUES.reloadEnd.getValue().toString());
|
||||
T2C_Send.console(Util.getPrefix() + "§8-------------------------------");
|
||||
T2C_Send.console(Util.getPrefix() + " §2Plugin successfully reloaded.");
|
||||
T2C_Send.console(Util.getPrefix() + "§8-------------------------------");
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,21 @@
|
||||
package net.t2code.alias.Spigot.cmdManagement;
|
||||
|
||||
import net.t2code.alias.Spigot.config.config.SelectConfig;
|
||||
import net.t2code.alias.Spigot.config.languages.SelectMessages;
|
||||
import net.t2code.alias.Spigot.Cache;
|
||||
import net.t2code.alias.Spigot.config.config.Config;
|
||||
import net.t2code.alias.Spigot.config.config.Language;
|
||||
import net.t2code.alias.Spigot.confirm.gui.ConfirmGUI;
|
||||
import net.t2code.alias.Spigot.enums.Confirm;
|
||||
import net.t2code.alias.Spigot.objects.AliasObject;
|
||||
import net.t2code.alias.Spigot.objects.AliasStorageObject;
|
||||
import net.t2code.alias.Spigot.objects.SubAliasObject;
|
||||
import net.t2code.alias.Spigot.system.BCommandSenderReciver;
|
||||
import net.t2code.alias.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.commands.T2Ccmd;
|
||||
import net.t2code.t2codelib.SPIGOT.api.eco.T2Ceco;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.api.plugins.T2CpluginCheck;
|
||||
import net.t2code.alias.util.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.commands.T2C_Cmd;
|
||||
import net.t2code.t2codelib.SPIGOT.api.eco.T2C_Eco;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Replace;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
||||
import net.t2code.t2codelib.SPIGOT.api.plugins.T2C_PluginCheck;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.T2C_LibConfig;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -19,13 +24,35 @@ import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ExecuteAlias {
|
||||
|
||||
private static final String prefix = Util.getPrefix();
|
||||
|
||||
public static void storage(CommandSender sender, boolean confirm) {
|
||||
Player player = (Player) sender;
|
||||
|
||||
if (!Cache.aliasStorage.containsKey(player.getUniqueId())) {
|
||||
T2C_Send.player(player, Language.VALUES.confirmNotPossible.getValue().toString());
|
||||
return;
|
||||
}
|
||||
|
||||
AliasStorageObject object = Cache.aliasStorage.get(player.getUniqueId());
|
||||
Cache.aliasStorage.remove(player.getUniqueId());
|
||||
|
||||
if (!confirm) {
|
||||
T2C_Send.player(player, Language.VALUES.confirmCancel.getValue().toString());
|
||||
return;
|
||||
}
|
||||
|
||||
if (object.sub) {
|
||||
executeSubAlias(player, (SubAliasObject) object.aliasObject, object.alias, object.args);
|
||||
} else executeAlias(player, (AliasObject) object.aliasObject, object.alias, object.args);
|
||||
}
|
||||
|
||||
protected static void aliasPlayer(CommandSender sender, AliasObject aliasObject, String alias, String[] args) {
|
||||
Player player = (Player) sender;
|
||||
|
||||
if (aliasObject.adminEnable) {
|
||||
if (player.hasPermission(aliasObject.adminPermission)) {
|
||||
if (player.hasPermission(aliasObject.adminPermission.replace("[alias]", alias.toLowerCase()))) {
|
||||
if (aliasObject.adminCommandEnable) {
|
||||
aliasAdminCommand(aliasObject, alias, player, args);
|
||||
}
|
||||
@ -37,25 +64,79 @@ 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 = SelectMessages.noPermissionForCommand;
|
||||
npmsg = Language.VALUES.noPermission.getValue().toString();
|
||||
} else npmsg = aliasObject.permissionMSG;
|
||||
T2Csend.player(player, npmsg.replace("[cmd]", "/" + alias.toLowerCase())
|
||||
.replace("[perm]", aliasObject.permission.replace("<alias>", alias.toLowerCase())).replace("[alias]", alias));
|
||||
T2C_Send.player(player, npmsg.replace("[cmd]", "/" + alias.toLowerCase())
|
||||
.replace("[perm]", aliasObject.permission.replace("[alias]", alias.toLowerCase())).replace("[alias]", alias));
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (aliasObject.costEnable) {
|
||||
if (!(aliasObject.costAllowBypass && player.hasPermission("t2code.alias.buy.bypass"))) {
|
||||
if (!T2Ceco.moneyRemove(prefix, player, aliasObject.costPrice)) {
|
||||
T2Csend.player(player, SelectMessages.noMoney);
|
||||
return;
|
||||
if (aliasObject.costEnable && aliasObject.costConfirm) {
|
||||
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.VALUES.buyConfirmDefault.getValue()) {
|
||||
case GUI:
|
||||
ConfirmGUI.open(player, aliasObject.costPrice, alias);
|
||||
break;
|
||||
|
||||
case CHAT:
|
||||
T2C_Send.player(player, Language.VALUES.confirmChat.getValue().toString().replace("[price]", aliasObject.costPrice.toString() + " " + Config.VALUES.buyCurrency.getValue()));
|
||||
break;
|
||||
|
||||
case COMMAND:
|
||||
default:
|
||||
T2C_Send.player(player, Language.VALUES.confirmCommand.getValue().toString().replace("[price]", aliasObject.costPrice.toString() + " " + Config.VALUES.buyCurrency.getValue()));
|
||||
break;
|
||||
}
|
||||
if (SelectConfig.getBuyMessage()) T2Csend.player(player, SelectMessages.buy.replace("[price]", aliasObject.costPrice.toString()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
executeAlias(player, aliasObject, alias, 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))) {
|
||||
T2C_Send.player(player, Language.VALUES.cooldownGlobal.getValue().toString().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))) {
|
||||
T2C_Send.player(player, Language.VALUES.cooldownPlayer.getValue().toString().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." + alias.toLowerCase() + ".bypass") && player.hasPermission("t2c.alias.buy.all.bypass"))) {
|
||||
if (!T2C_Eco.moneyRemove(prefix, player, aliasObject.costPrice)) {
|
||||
T2C_Send.player(player, Language.VALUES.noMoney.getValue().toString());
|
||||
return;
|
||||
}
|
||||
if ((Boolean) Config.VALUES.buyMessage.getValue())
|
||||
T2C_Send.player(player, Language.VALUES.buy.getValue().toString().replace("[price]", aliasObject.costPrice.toString() + " " + Config.VALUES.buyCurrency.getPath()));
|
||||
}
|
||||
}
|
||||
|
||||
if (aliasObject.commandEnable) {
|
||||
aliasCommand(aliasObject, alias, player, args);
|
||||
}
|
||||
@ -66,7 +147,7 @@ public class ExecuteAlias {
|
||||
|
||||
protected static void subAliasPlayer(CommandSender sender, SubAliasObject aliasObject, String alias, String[] args) {
|
||||
if (!aliasObject.subAliasEnable) {
|
||||
T2Csend.sender(sender, SelectMessages.aliasDisabled);
|
||||
T2C_Send.sender(sender, Language.VALUES.aliasDisabled.getValue().toString());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -74,9 +155,9 @@ public class ExecuteAlias {
|
||||
Player player = (Player) sender;
|
||||
|
||||
if (aliasObject.adminEnable) {
|
||||
if (player.hasPermission(aliasObject.adminPermission)) {
|
||||
if (player.hasPermission(aliasObject.adminPermission.replace("[alias]", alias.toLowerCase()))) {
|
||||
if (aliasObject.adminCommandEnable) {
|
||||
subAliasAdminCommand(aliasObject,alias, player, args);
|
||||
subAliasAdminCommand(aliasObject, alias, player, args);
|
||||
}
|
||||
if (aliasObject.adminMessageEnable) {
|
||||
subAliasAdminMessage(aliasObject, alias, player, args);
|
||||
@ -86,35 +167,90 @@ 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 = SelectMessages.noPermissionForCommand;
|
||||
npmsg = Language.VALUES.noPermission.getValue().toString();
|
||||
} else npmsg = aliasObject.permissionMSG;
|
||||
T2Csend.player(player, npmsg.replace("[cmd]", "/" + alias.toLowerCase())
|
||||
.replace("[perm]", aliasObject.permission.replace("<alias>", alias.toLowerCase())).replace("[alias]", alias));
|
||||
T2C_Send.player(player, npmsg.replace("[cmd]", "/" + alias.toLowerCase())
|
||||
.replace("[perm]", aliasObject.permission.replace("[alias]", alias.toLowerCase())).replace("[alias]", alias));
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (aliasObject.costEnable) {
|
||||
if (aliasObject.costEnable && aliasObject.costConfirm) {
|
||||
if (!(aliasObject.costAllowBypass && player.hasPermission("t2code.alias.buy.bypass"))) {
|
||||
if (!T2Ceco.moneyRemove(prefix, player, aliasObject.costPrice)) {
|
||||
T2Csend.player(player, SelectMessages.noMoney);
|
||||
return;
|
||||
Cache.aliasStorage.put(player.getUniqueId(), new AliasStorageObject(aliasObject, alias, args, true));
|
||||
switch ((Confirm) Config.VALUES.buyConfirmDefault.getValue()) {
|
||||
case GUI:
|
||||
ConfirmGUI.open(player, aliasObject.costPrice, alias);
|
||||
break;
|
||||
|
||||
case CHAT:
|
||||
T2C_Send.player(player, Language.VALUES.confirmChat.getValue().toString().replace("[price]", aliasObject.costPrice.toString() + " " + Config.VALUES.buyCurrency.getValue()));
|
||||
break;
|
||||
|
||||
case COMMAND:
|
||||
default:
|
||||
T2C_Send.player(player, Language.VALUES.confirmCommand.getValue().toString().replace("[price]", aliasObject.costPrice.toString() + " " + Config.VALUES.buyCurrency.getValue()));
|
||||
break;
|
||||
}
|
||||
if (SelectConfig.getBuyMessage()) T2Csend.player(player, SelectMessages.buy.replace("[price]", aliasObject.costPrice.toString()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (aliasObject.commandEnable) {
|
||||
subAliasCommand(aliasObject, player, args);
|
||||
}
|
||||
if (aliasObject.messageEnable) {
|
||||
subAliasMessage(aliasObject, alias, player, args);
|
||||
}
|
||||
|
||||
executeSubAlias(player, aliasObject, alias, args);
|
||||
} else {
|
||||
if (aliasObject.consoleEnable) {
|
||||
subAliasConsole(aliasObject,alias, sender, args);
|
||||
} else T2Csend.sender(sender, SelectMessages.onlyForPlayer);
|
||||
subAliasConsole(aliasObject, alias, sender, args);
|
||||
} else T2C_Send.sender(sender, Language.VALUES.onlyForPlayer.getValue().toString());
|
||||
}
|
||||
}
|
||||
|
||||
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))) {
|
||||
T2C_Send.player(player, Language.VALUES.cooldownGlobal.getValue().toString().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))) {
|
||||
T2C_Send.player(player, Language.VALUES.cooldownPlayer.getValue().toString().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("t2c.alias.sub.buy." + alias.toLowerCase() + ".bypass") && player.hasPermission("t2c.alias.sub.buy.all.bypass"))) {
|
||||
if (!T2C_Eco.moneyRemove(prefix, player, aliasObject.costPrice)) {
|
||||
T2C_Send.player(player, Language.VALUES.noMoney.getValue().toString());
|
||||
return;
|
||||
}
|
||||
if ((Boolean) Config.VALUES.buyMessage.getValue())
|
||||
T2C_Send.player(player, Language.VALUES.buy.getValue().toString().replace("[price]", aliasObject.costPrice.toString() + " " + Config.VALUES.buyCurrency.getValue()));
|
||||
}
|
||||
}
|
||||
if (aliasObject.commandEnable) {
|
||||
subAliasCommand(aliasObject, player, args);
|
||||
}
|
||||
if (aliasObject.messageEnable) {
|
||||
subAliasMessage(aliasObject, alias, player, args);
|
||||
}
|
||||
}
|
||||
|
||||
@ -122,20 +258,20 @@ public class ExecuteAlias {
|
||||
if (alias.consoleCommandEnable) {
|
||||
for (String cmd : alias.consoleCommands) {
|
||||
if (alias.consoleBungeeCommand) {
|
||||
if (SelectConfig.getBungee()) {
|
||||
if ((boolean) T2C_LibConfig.VALUES.proxy.getValue()) {
|
||||
BCommandSenderReciver.sendToBungee(sender, cmd, true);
|
||||
} else {
|
||||
T2Csend.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||
T2Csend.sender(sender, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||
T2C_Send.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||
T2C_Send.sender(sender, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||
}
|
||||
} else {
|
||||
T2Ccmd.console(cmd);
|
||||
T2C_Cmd.console(cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (alias.consoleMessageEnable) {
|
||||
for (String msg : alias.consoleMessages) {
|
||||
T2Csend.console(T2Creplace.replace(prefix, msg));
|
||||
T2C_Send.console(T2C_Replace.replace(prefix, msg));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -152,20 +288,20 @@ public class ExecuteAlias {
|
||||
for (String cmd : aliasObject.consoleCommands) {
|
||||
String replace = cmd.replace("[target]", targetSt).replace("[alias]", alias);
|
||||
if (aliasObject.consoleBungeeCommand) {
|
||||
if (SelectConfig.getBungee()) {
|
||||
if ((boolean) T2C_LibConfig.VALUES.proxy.getValue()) {
|
||||
BCommandSenderReciver.sendToBungee(sender, replace, true);
|
||||
} else {
|
||||
T2Csend.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||
T2Csend.sender(sender, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||
T2C_Send.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||
T2C_Send.sender(sender, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||
}
|
||||
} else {
|
||||
T2Ccmd.console(replace);
|
||||
T2C_Cmd.console(replace);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (aliasObject.consoleMessageEnable) {
|
||||
for (String msg : aliasObject.consoleMessages) {
|
||||
T2Csend.console(T2Creplace.replace(prefix, msg));
|
||||
T2C_Send.console(T2C_Replace.replace(prefix, msg));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -180,18 +316,17 @@ public class ExecuteAlias {
|
||||
}
|
||||
for (String cmd : aliasObject.adminCommands) {
|
||||
if (aliasObject.adminBungeeCommand) {
|
||||
if (SelectConfig.getBungee()) {
|
||||
BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()).replace("[target]", targetSt).replace("[alias]", alias), aliasObject.adminCommandAsConsole);
|
||||
|
||||
if ((boolean) T2C_LibConfig.VALUES.proxy.getValue()) {
|
||||
BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()).replace("%player_name%", player.getName()).replace("[target]", targetSt).replace("[alias]", alias), aliasObject.adminCommandAsConsole);
|
||||
} else {
|
||||
T2Csend.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||
T2Csend.player(player, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||
T2C_Send.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||
T2C_Send.player(player, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||
}
|
||||
} else {
|
||||
if (aliasObject.adminCommandAsConsole) {
|
||||
T2Ccmd.console(cmd.replace("[player]", player.getName()).replace("[target]", targetSt).replace("[alias]", alias));
|
||||
T2C_Cmd.console(cmd.replace("[player]", player.getName()).replace("%player_name%", player.getName()).replace("[target]", targetSt).replace("[alias]", alias));
|
||||
} else {
|
||||
T2Ccmd.player(player, cmd.replace("[player]", player.getName()).replace("[target]", targetSt).replace("[alias]", alias));
|
||||
T2C_Cmd.player(player, cmd.replace("[player]", player.getName()).replace("%player_name%", player.getName()).replace("[target]", targetSt).replace("[alias]", alias));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -207,18 +342,18 @@ public class ExecuteAlias {
|
||||
}
|
||||
for (String cmd : aliasObject.adminCommands) {
|
||||
if (aliasObject.adminBungeeCommand) {
|
||||
if (SelectConfig.getBungee()) {
|
||||
BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()).replace("[target]", targetSt).replace("[alias]", alias), aliasObject.adminCommandAsConsole);
|
||||
|
||||
if ((boolean) T2C_LibConfig.VALUES.proxy.getValue()) {
|
||||
BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()).replace("%player_name%", player.getName()).replace("[target]", targetSt).replace("[alias]", alias), aliasObject.adminCommandAsConsole);
|
||||
} else {
|
||||
T2Csend.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||
T2Csend.player(player, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||
T2C_Send.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||
T2C_Send.player(player, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||
}
|
||||
} else {
|
||||
if (aliasObject.adminCommandAsConsole) {
|
||||
T2Ccmd.console(cmd.replace("[player]", player.getName()).replace("[target]", targetSt).replace("[alias]", alias));
|
||||
T2C_Cmd.console(cmd.replace("[player]", player.getName()).replace("%player_name%", player.getName()).replace("[target]", targetSt).replace("[alias]", alias));
|
||||
} else {
|
||||
T2Ccmd.player(player, cmd.replace("[player]", player.getName()).replace("[target]", targetSt).replace("[alias]", alias));
|
||||
T2C_Cmd.player(player, cmd.replace("[player]", player.getName()).replace("%player_name%", player.getName()).replace("[target]", targetSt).replace("[alias]", alias));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -234,12 +369,12 @@ public class ExecuteAlias {
|
||||
}
|
||||
for (String msg : aliasObject.adminMessages) {
|
||||
String text;
|
||||
if (T2CpluginCheck.papi()) {
|
||||
text = T2Creplace.replace(prefix, player, replacePlayer(msg, player)).replace("[target]", targetSt).replace("[alias]", alias);
|
||||
if (T2C_PluginCheck.papi()) {
|
||||
text = T2C_Replace.replace(prefix, player, replacePlayer(msg, player)).replace("[target]", targetSt).replace("[alias]", alias);
|
||||
} else {
|
||||
text = T2Creplace.replace(prefix, replacePlayer(msg, player)).replace("[target]", targetSt).replace("[alias]", alias);
|
||||
text = T2C_Replace.replace(prefix, replacePlayer(msg, player)).replace("[target]", targetSt).replace("[alias]", alias);
|
||||
}
|
||||
T2Csend.player(player, text);
|
||||
T2C_Send.player(player, text);
|
||||
}
|
||||
}
|
||||
|
||||
@ -253,12 +388,12 @@ public class ExecuteAlias {
|
||||
}
|
||||
for (String msg : subAliasObject.adminMessages) {
|
||||
String text;
|
||||
if (T2CpluginCheck.papi()) {
|
||||
text = T2Creplace.replace(prefix, player, replacePlayer(msg, player)).replace("[target]", targetSt).replace("[alias]", alias);
|
||||
if (T2C_PluginCheck.papi()) {
|
||||
text = T2C_Replace.replace(prefix, player, replacePlayer(msg, player)).replace("[target]", targetSt).replace("[alias]", alias);
|
||||
} else {
|
||||
text = T2Creplace.replace(prefix, replacePlayer(msg, player)).replace("[target]", targetSt).replace("[alias]", alias);
|
||||
text = T2C_Replace.replace(prefix, replacePlayer(msg, player)).replace("[target]", targetSt).replace("[alias]", alias);
|
||||
}
|
||||
T2Csend.player(player, text);
|
||||
T2C_Send.player(player, text);
|
||||
}
|
||||
}
|
||||
|
||||
@ -272,17 +407,18 @@ public class ExecuteAlias {
|
||||
}
|
||||
for (String cmd : aliasObject.command) {
|
||||
if (aliasObject.bungeeCommand) {
|
||||
if (SelectConfig.getBungee()) {
|
||||
BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()).replace("[target]", targetSt).replace("[alias]", alias), aliasObject.commandAsConsole);
|
||||
|
||||
if ((boolean) T2C_LibConfig.VALUES.proxy.getValue()) {
|
||||
BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()).replace("%player_name%", player.getName()).replace("[target]", targetSt).replace("[alias]", alias), aliasObject.commandAsConsole);
|
||||
} else {
|
||||
T2Csend.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||
T2Csend.player(player, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||
T2C_Send.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||
T2C_Send.player(player, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||
}
|
||||
} else {
|
||||
if (aliasObject.commandAsConsole) {
|
||||
T2Ccmd.console(cmd.replace("[player]", player.getName()).replace("[target]", targetSt).replace("[alias]", alias));
|
||||
T2C_Cmd.console(cmd.replace("[player]", player.getName()).replace("%player_name%", player.getName()).replace("[target]", targetSt).replace("[alias]", alias));
|
||||
} else {
|
||||
T2Ccmd.player(player, cmd.replace("[player]", player.getName()).replace("[target]", targetSt).replace("[alias]", alias));
|
||||
T2C_Cmd.player(player, cmd.replace("[player]", player.getName()).replace("%player_name%", player.getName()).replace("[target]", targetSt).replace("[alias]", alias));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -298,18 +434,17 @@ public class ExecuteAlias {
|
||||
}
|
||||
for (String cmd : alias.command) {
|
||||
if (alias.bungeeCommand) {
|
||||
if (SelectConfig.getBungee()) {
|
||||
BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()).replace("[target]", targetSt), alias.commandAsConsole);
|
||||
|
||||
if ((boolean) T2C_LibConfig.VALUES.proxy.getValue()) {
|
||||
BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()).replace("%player_name%", player.getName()).replace("[target]", targetSt), alias.commandAsConsole);
|
||||
} else {
|
||||
T2Csend.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||
T2Csend.player(player, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||
T2C_Send.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||
T2C_Send.player(player, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
|
||||
}
|
||||
} else {
|
||||
if (alias.commandAsConsole) {
|
||||
T2Ccmd.console(cmd.replace("[player]", player.getName()).replace("[target]", targetSt));
|
||||
T2C_Cmd.console(cmd.replace("[player]", player.getName()).replace("%player_name%", player.getName()).replace("[target]", targetSt));
|
||||
} else {
|
||||
T2Ccmd.player(player, cmd.replace("[player]", player.getName()).replace("[target]", targetSt));
|
||||
T2C_Cmd.player(player, cmd.replace("[player]", player.getName()).replace("%player_name%", player.getName()).replace("[target]", targetSt));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -327,12 +462,12 @@ public class ExecuteAlias {
|
||||
|
||||
for (String msg : aliasObject.messages) {
|
||||
String text;
|
||||
if (T2CpluginCheck.papi()) {
|
||||
text = T2Creplace.replace(prefix, player, replacePlayer(msg, player)).replace("[target]", targetSt).replace("[alias]", alias);
|
||||
if (T2C_PluginCheck.papi()) {
|
||||
text = T2C_Replace.replace(prefix, player, replacePlayer(msg, player)).replace("[target]", targetSt).replace("[alias]", alias);
|
||||
} else {
|
||||
text = T2Creplace.replace(prefix, replacePlayer(msg, player)).replace("[target]", targetSt).replace("[alias]", alias);
|
||||
text = T2C_Replace.replace(prefix, replacePlayer(msg, player)).replace("[target]", targetSt).replace("[alias]", alias);
|
||||
}
|
||||
T2Csend.player(player, text);
|
||||
T2C_Send.player(player, text);
|
||||
}
|
||||
}
|
||||
|
||||
@ -346,16 +481,16 @@ public class ExecuteAlias {
|
||||
}
|
||||
for (String msg : subAliasObject.messages) {
|
||||
String text;
|
||||
if (T2CpluginCheck.papi()) {
|
||||
text = T2Creplace.replace(prefix, player, replacePlayer(msg, player)).replace("[target]", targetSt).replace("[alias]", alias);
|
||||
if (T2C_PluginCheck.papi()) {
|
||||
text = T2C_Replace.replace(prefix, player, replacePlayer(msg, player)).replace("[target]", targetSt).replace("[alias]", alias);
|
||||
} else {
|
||||
text = T2Creplace.replace(prefix, replacePlayer(msg, player)).replace("[target]", targetSt).replace("[alias]", alias);
|
||||
text = T2C_Replace.replace(prefix, replacePlayer(msg, player)).replace("[target]", targetSt).replace("[alias]", alias);
|
||||
}
|
||||
T2Csend.player(player, text);
|
||||
T2C_Send.player(player, text);
|
||||
}
|
||||
}
|
||||
|
||||
private static String replacePlayer(String s, Player player) {
|
||||
return s.replace("[player]", player.getName());
|
||||
return s.replace("[player]", player.getName()).replace("%player_name%", player.getName());
|
||||
}
|
||||
}
|
||||
|
@ -1,20 +1,15 @@
|
||||
package net.t2code.alias.Spigot.cmdManagement;
|
||||
|
||||
import net.t2code.alias.Spigot.Main;
|
||||
import net.t2code.alias.Spigot.config.languages.SelectMessages;
|
||||
import net.t2code.alias.Spigot.config.config.Language;
|
||||
import net.t2code.alias.Spigot.objects.AliasObject;
|
||||
import net.t2code.alias.Spigot.objects.SubAliasObject;
|
||||
import net.t2code.alias.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.alias.util.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabCompleter;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class RegisterCommands extends Command {
|
||||
private String alias;
|
||||
private String prefix = Util.getPrefix();
|
||||
@ -29,11 +24,11 @@ public class RegisterCommands extends Command {
|
||||
AliasObject alias = Main.aliasHashMap.get(this.alias);
|
||||
|
||||
if (alias == null) {
|
||||
T2Csend.error(Main.getPlugin(), "The alias " + this.alias + " does not exist.");
|
||||
T2C_Send.error(Main.getInstance(), "The alias " + this.alias + " does not exist.");
|
||||
return false;
|
||||
}
|
||||
if (!alias.aliasEnable) {
|
||||
T2Csend.sender(sender, SelectMessages.aliasDisabled);
|
||||
T2C_Send.sender(sender, Language.VALUES.aliasDisabled.getValue().toString());
|
||||
return true;
|
||||
}
|
||||
if (args.length == 0 || args.length == 1 && args[0].contains("-p:")) {
|
||||
@ -42,7 +37,7 @@ public class RegisterCommands extends Command {
|
||||
} else {
|
||||
if (alias.consoleEnable) {
|
||||
ExecuteAlias.aliasConsole(alias, sender, prefix);
|
||||
} else T2Csend.sender(sender, SelectMessages.onlyForPlayer);
|
||||
} else T2C_Send.sender(sender, Language.VALUES.onlyForPlayer.getValue().toString());
|
||||
}
|
||||
} else {
|
||||
if (!Main.allForSubAliases.contains(this.alias)) {
|
||||
@ -59,7 +54,7 @@ public class RegisterCommands extends Command {
|
||||
}
|
||||
}
|
||||
}
|
||||
T2Csend.sender(sender, SelectMessages.noSubCommand);
|
||||
T2C_Send.sender(sender, Language.VALUES.noSubCommand.getValue().toString());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package net.t2code.alias.Spigot.cmdManagement;
|
||||
|
||||
import net.t2code.alias.Spigot.Main;
|
||||
import net.t2code.alias.Spigot.objects.SubAliasObject;
|
||||
import net.t2code.t2codelib.SPIGOT.api.commands.T2Ctab;
|
||||
import net.t2code.t2codelib.SPIGOT.api.commands.T2C_Tab;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.server.TabCompleteEvent;
|
||||
@ -31,12 +31,12 @@ 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) {
|
||||
for (String command : aliasObject.subAliasList) {
|
||||
if (T2Ctab.hasPermission(e.getSender(), arg1.get(command)) && T2Ctab.passend(command, args[arg])) {
|
||||
if (T2C_Tab.hasPermission(e.getSender(), arg1.get(command)) && T2C_Tab.passend(command, args[arg])) {
|
||||
list.add(command);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,154 @@
|
||||
// This class was created by JaTiTV.
|
||||
|
||||
package net.t2code.alias.Spigot.config;
|
||||
|
||||
import net.t2code.alias.Spigot.Main;
|
||||
import net.t2code.alias.Spigot.config.alias.AliasFile;
|
||||
import net.t2code.alias.Spigot.config.subAlias.SubAliasFile;
|
||||
import net.t2code.alias.util.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.yaml.T2C_ConfigWriter;
|
||||
import net.t2code.t2codelib.util.T2C_ConfigItem;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class ConfigFileConverter {
|
||||
private static YamlConfiguration yamlConfiguration;
|
||||
|
||||
public static void convert() {
|
||||
File configDeclaration = new File(Main.getPath() + "/X_configDeclaration_X.yml");
|
||||
configDeclaration.delete();
|
||||
File aliasDeclaration = new File(Main.getPath() + "/Alias/X_aliasDeclaration_X.yml");
|
||||
aliasDeclaration.delete();
|
||||
File subaliasDeclaration = new File(Main.getPath() + "/SubAlias/X_subAliasDeclaration_X.yml");
|
||||
subaliasDeclaration.delete();
|
||||
|
||||
convertAlias();
|
||||
convertSubAlias();
|
||||
}
|
||||
|
||||
private static void convertAlias() {
|
||||
File f = new File(Main.getPath() + "/Alias/");
|
||||
if (!f.exists()) return;
|
||||
|
||||
File[] fileArray = f.listFiles();
|
||||
if (fileArray == null) return;
|
||||
for (File file : fileArray) {
|
||||
String sub = file.getName().substring(file.getName().length() - 4);
|
||||
if (sub.equals(".yml")) {
|
||||
|
||||
yamlConfiguration = YamlConfiguration.loadConfiguration(file);
|
||||
|
||||
setConfig("Alias.Enable", AliasFile.VALUES.aliasEnable);
|
||||
setConfig("Alias.AliasList", AliasFile.VALUES.aliasList);
|
||||
setConfig("Alias.Permission.Necessary", AliasFile.VALUES.permNecessary);
|
||||
setConfig("Alias.Permission.Permission", AliasFile.VALUES.permission);
|
||||
setConfig("Alias.Permission.CustomNoPermissionMSG", AliasFile.VALUES.permissionMSG);
|
||||
setConfig("Alias.CooldownInSec.Global", AliasFile.VALUES.cooldownGlobal);
|
||||
setConfig("Alias.CooldownInSec.Player", AliasFile.VALUES.cooldownPlayer);
|
||||
setConfig("Alias.Cost.Enable", AliasFile.VALUES.costEnable);
|
||||
setConfig("Alias.Cost.Confirm", AliasFile.VALUES.costConfirm);
|
||||
setConfig("Alias.Cost.Price", AliasFile.VALUES.costPrice);
|
||||
setConfig("Alias.Cost.AllowByPass", AliasFile.VALUES.costAllowBypass);
|
||||
setConfig("Alias.Command.Enable", AliasFile.VALUES.commandEnable);
|
||||
setConfig("Alias.Command.CommandAsConsole", AliasFile.VALUES.commandAsConsole);
|
||||
setConfig("Alias.Command.BungeeCommand", AliasFile.VALUES.bungeeCommand);
|
||||
setConfig("Alias.Command.Commands", AliasFile.VALUES.command);
|
||||
setConfig("Alias.Message.Enable", AliasFile.VALUES.messageEnable);
|
||||
setConfig("Alias.Message.Messages", AliasFile.VALUES.messages);
|
||||
setConfig("Alias.Admin.Enable", AliasFile.VALUES.adminEnable);
|
||||
setConfig("Alias.Admin.Permission", AliasFile.VALUES.adminPermission);
|
||||
setConfig("Alias.Admin.Command.Enable", AliasFile.VALUES.adminCommandEnable);
|
||||
setConfig("Alias.Admin.Command.CommandAsConsole", AliasFile.VALUES.adminCommandAsConsole);
|
||||
setConfig("Alias.Admin.Command.BungeeCommand", AliasFile.VALUES.adminBungeeCommand);
|
||||
setConfig("Alias.Admin.Command.Commands", AliasFile.VALUES.adminCommands);
|
||||
setConfig("Alias.Admin.Message.Enable", AliasFile.VALUES.adminMessageEnable);
|
||||
setConfig("Alias.Admin.Message.Messages", AliasFile.VALUES.adminMessages);
|
||||
setConfig("Alias.Console.Enable", AliasFile.VALUES.consoleEnable);
|
||||
setConfig("Alias.Console.Command.Enable", AliasFile.VALUES.consoleCommandEnable);
|
||||
setConfig("Alias.Console.Command.BungeeCommand", AliasFile.VALUES.consoleBungeeCommand);
|
||||
setConfig("Alias.Console.Command.Commands", AliasFile.VALUES.consoleCommands);
|
||||
setConfig("Alias.Console.Message.Enable", AliasFile.VALUES.consoleMessageEnable);
|
||||
setConfig("Alias.Console.Message.Messages", AliasFile.VALUES.consoleMessages);
|
||||
|
||||
T2C_ConfigWriter.createConfig(Util.getPrefix(), new File(Main.getPath(), "alias/" + file.getName()), AliasFile.VALUES.values(), false, Util.getConfigLogo());
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
|
||||
deleteDirectory(f);
|
||||
}
|
||||
|
||||
private static void convertSubAlias() {
|
||||
File f = new File(Main.getPath() + "/SubAlias/");
|
||||
if (!f.exists()) return;
|
||||
|
||||
File[] fileArray = f.listFiles();
|
||||
assert fileArray != null;
|
||||
for (File file : fileArray) {
|
||||
String sub = file.getName().substring(file.getName().length() - 4);
|
||||
if (sub.equals(".yml")) {
|
||||
|
||||
yamlConfiguration = YamlConfiguration.loadConfiguration(file);
|
||||
|
||||
setConfig("SubAlias.Enable", SubAliasFile.VALUES.aliasEnable);
|
||||
setConfig("SubAlias.SubAliasList", SubAliasFile.VALUES.subAliasList);
|
||||
setConfig("SubAlias.SubAliasFor", SubAliasFile.VALUES.subAliasFor);
|
||||
setConfig("SubAlias.Permission.Necessary", SubAliasFile.VALUES.permNecessary);
|
||||
setConfig("SubAlias.Permission.Permission", SubAliasFile.VALUES.permission);
|
||||
setConfig("SubAlias.Permission.CustomNoPermissionMSG", SubAliasFile.VALUES.permissionMSG);
|
||||
setConfig("SubAlias.CooldownInSec.Global", SubAliasFile.VALUES.cooldownGlobal);
|
||||
setConfig("SubAlias.CooldownInSec.Player", SubAliasFile.VALUES.cooldownPlayer);
|
||||
setConfig("SubAlias.Cost.Enable", SubAliasFile.VALUES.costEnable);
|
||||
setConfig("SubAlias.Cost.Confirm", SubAliasFile.VALUES.costConfirm);
|
||||
setConfig("SubAlias.Cost.Price", SubAliasFile.VALUES.costPrice);
|
||||
setConfig("SubAlias.Cost.AllowByPass", SubAliasFile.VALUES.costAllowBypass);
|
||||
setConfig("SubAlias.Command.Enable", SubAliasFile.VALUES.commandEnable);
|
||||
setConfig("SubAlias.Command.CommandAsConsole", SubAliasFile.VALUES.commandAsConsole);
|
||||
setConfig("SubAlias.Command.BungeeCommand", SubAliasFile.VALUES.bungeeCommand);
|
||||
setConfig("SubAlias.Command.Commands", SubAliasFile.VALUES.command);
|
||||
setConfig("SubAlias.Message.Enable", SubAliasFile.VALUES.messageEnable);
|
||||
setConfig("SubAlias.Message.Messages", SubAliasFile.VALUES.messages);
|
||||
setConfig("SubAlias.Admin.Enable", SubAliasFile.VALUES.adminEnable);
|
||||
setConfig("SubAlias.Admin.Permission", SubAliasFile.VALUES.adminPermission);
|
||||
setConfig("SubAlias.Admin.Command.Enable", SubAliasFile.VALUES.adminCommandEnable);
|
||||
setConfig("SubAlias.Admin.Command.CommandAsConsole", SubAliasFile.VALUES.adminCommandAsConsole);
|
||||
setConfig("SubAlias.Admin.Command.BungeeCommand", SubAliasFile.VALUES.adminBungeeCommand);
|
||||
setConfig("SubAlias.Admin.Command.Commands", SubAliasFile.VALUES.adminCommands);
|
||||
setConfig("SubAlias.Admin.Message.Enable", SubAliasFile.VALUES.adminMessageEnable);
|
||||
setConfig("SubAlias.Admin.Message.Messages", SubAliasFile.VALUES.adminMessages);
|
||||
setConfig("SubAlias.Console.Enable", SubAliasFile.VALUES.consoleEnable);
|
||||
setConfig("SubAlias.Console.Command.Enable", SubAliasFile.VALUES.consoleCommandEnable);
|
||||
setConfig("SubAlias.Console.Command.BungeeCommand", SubAliasFile.VALUES.consoleBungeeCommand);
|
||||
setConfig("SubAlias.Console.Command.Commands", SubAliasFile.VALUES.consoleCommands);
|
||||
setConfig("SubAlias.Console.Message.Enable", SubAliasFile.VALUES.consoleMessageEnable);
|
||||
setConfig("SubAlias.Console.Message.Messages", SubAliasFile.VALUES.consoleMessages);
|
||||
|
||||
T2C_ConfigWriter.createConfig(Util.getPrefix(), new File(Main.getPath(), "subAlias/" + file.getName()), SubAliasFile.VALUES.values(), false, Util.getConfigLogo());
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
|
||||
deleteDirectory(f);
|
||||
|
||||
}
|
||||
|
||||
private static void setConfig(String path, T2C_ConfigItem item) {
|
||||
if (yamlConfiguration.contains(path)) {
|
||||
item.setValue(yamlConfiguration.get(path));
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean deleteDirectory(File dir) {
|
||||
if (dir.isDirectory()) {
|
||||
String[] children = dir.list();
|
||||
for (int i = 0; i < children.length; i++) {
|
||||
boolean success = deleteDirectory(new File(dir, children[i]));
|
||||
if (!success) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return dir.delete();
|
||||
}
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
package net.t2code.alias.Spigot.config.alias;
|
||||
|
||||
import net.t2code.alias.Spigot.Main;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
|
||||
public class AliasConfigConverter {
|
||||
/**
|
||||
* Converter 1.1
|
||||
*
|
||||
* @param yamlConfiguration
|
||||
* @param config_gui
|
||||
*/
|
||||
|
||||
public static void convertAliasList(YamlConfiguration yamlConfiguration, File config_gui) {
|
||||
yamlConfiguration.set("Alias.AliasList", Collections.singletonList(config_gui.getName().replace(".yml", "")));
|
||||
try {
|
||||
yamlConfiguration.save(config_gui);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
T2Csend.error(Main.getPlugin(), "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
T2Csend.error(Main.getPlugin(), "");
|
||||
T2Csend.warning(Main.getPlugin(), "The " + config_gui.getName() + " file is converted to the new config format.");
|
||||
T2Csend.warning(Main.getPlugin(), "The alias is no longer the filename, this is now adjustable in the file under 'Alias.AliasList'!");
|
||||
T2Csend.warning(Main.getPlugin(), "This allows a function to have multiple alias commands without creating multiple files!");
|
||||
T2Csend.error(Main.getPlugin(), "");
|
||||
T2Csend.error(Main.getPlugin(), "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
|
||||
}
|
||||
|
||||
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>");
|
||||
try {
|
||||
yamlConfiguration.save(config_gui);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void convertAddPermissionMSG(YamlConfiguration yamlConfiguration, File config_gui, Boolean subalias) {
|
||||
if (subalias) {
|
||||
yamlConfiguration.set("SubAlias.Permission.CustomNoPermissionMSG", "");
|
||||
} else yamlConfiguration.set("Alias.Permission.CustomNoPermissionMSG", "");
|
||||
try {
|
||||
yamlConfiguration.save(config_gui);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,337 @@
|
||||
// This class was created by JaTiTV.
|
||||
|
||||
package net.t2code.alias.Spigot.config.alias;
|
||||
|
||||
import net.t2code.alias.Spigot.Main;
|
||||
import net.t2code.alias.Spigot.config.ConfigFileConverter;
|
||||
import net.t2code.alias.Spigot.config.config.Config;
|
||||
import net.t2code.alias.Spigot.objects.AliasObject;
|
||||
import net.t2code.alias.Spigot.register.AliasRegister;
|
||||
import net.t2code.alias.util.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.yaml.T2C_ConfigWriter;
|
||||
import net.t2code.t2codelib.util.T2C_ConfigItem;
|
||||
import net.t2code.t2codelib.util.T2C_LanguageEnum;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class AliasFile {
|
||||
|
||||
public enum VALUES implements T2C_ConfigItem {
|
||||
|
||||
aliasDesc("alias", null, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Wenn du weitere Alias Commands hinzufügen möchtest, lege einfach eine weitere Alias Datei an."));
|
||||
put(T2C_LanguageEnum.english, List.of("If you want to add more alias commands, simply create another alias file."));
|
||||
}}),
|
||||
|
||||
|
||||
aliasEnable("alias.enable", true, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du den Alias deaktivieren."));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can disable the alias."));
|
||||
}}),
|
||||
aliasList("alias.aliasList", List.of("aliasexample1", "t2caliasexample"), true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Gib hier an, wie die Alias-Befehle für diese Funktion lauten sollen."));
|
||||
put(T2C_LanguageEnum.english, List.of("Specify here what the Alias commands should be for this function."));
|
||||
}}),
|
||||
|
||||
permNecessary("alias.permission.necessary", true, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du angeben, ob für die Verwendung des Alias eine Erlaubnis erforderlich ist."));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can say if a permission is needed to use the alias."));
|
||||
}}),
|
||||
permission("alias.permission.permission", "t2c.alias.use.[alias]", true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du die Berechtigung für den Alias festlegen.", "Der Platzhalter <alias> ist der Alias-Name.", "Wenn du mehrere Alias-Referrer in der Liste 'alias.aliasList' festgelegt hast, hast du für jeden Alias eine Berechtigung."));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can set the permission for the alias.", "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."));
|
||||
}}),
|
||||
permissionMSG("alias.permission.customNoPermissionMSG", "", true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du eine benutzerdefinierte Nicht-Erlaubnis-Meldung für diesen Alias festlegen. Wenn du die Standardmeldung verwenden willst, lass dieses Feld einfach leer."));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can set a custom No Permission message for this alias. If you want to use the default message, just leave this blank."));
|
||||
}}),
|
||||
|
||||
cooldownGlobal("alias.cooldownInSec.global", 0, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du eine globale Abklingzeit für diesen Alias festlegen.", "Der Wert entspricht den Sekunden.", "Bei 0 ist die Abklingzeit deaktiviert.", "Der Platzhalter [alias] ist der Name des Alias.", "Bypass permission: t2c.alias.cooldown.global.[alias].bypass", "(Die globale Abklingzeit ist höher als die Abklingzeit des Spielers)."));
|
||||
put(T2C_LanguageEnum.english, List.of("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)."));
|
||||
}}),
|
||||
cooldownPlayer("alias.cooldownInSec.player", 0, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du eine spielerspezifische Abklingzeit für diesen Alias festlegen.", "Der Wert entspricht den Sekunden.", "Bei 0 ist die Abklingzeit deaktiviert.", "Der Platzhalter [alias] ist der Name des Alias.", "Bypass permission: t2c.alias.cooldown.player.[alias].bypass"));
|
||||
put(T2C_LanguageEnum.english, List.of("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"));
|
||||
}}),
|
||||
|
||||
costEnable("alias.cost.enable", false, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du angeben, ob du für den Alias bezahlen musst."));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can say if you have to pay for the alias."));
|
||||
}}),
|
||||
costConfirm("alias.cost.confirm", true, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du einstellen, ob du vor dem Ausführen des Befehls bestätigen musst, ob du bezahlen willst", "In der config.yml kannst du unter 'buy.confirm.use' einstellen, ob ein Befehl, ein chatListener oder eine GUI zur Bestätigung des Befehls verwendet werden soll."));
|
||||
put(T2C_LanguageEnum.english, List.of("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."));
|
||||
}}),
|
||||
costPrice("alias.cost.price", 0.0, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier legst du den Preis fest."));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you set the price."));
|
||||
}}),
|
||||
costAllowBypass("alias.cost.allowByPass", true, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier legst du fest, ob der Bypass aktiviert ist oder ob du trotz des Bypasses zahlen musst (t2c.alias.buy.[alias].bypass)."));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you define if the bypass is activated or if you have to pay despite the bypass (t2c.alias.buy.[alias].bypass)."));
|
||||
}}),
|
||||
|
||||
commandEnable("alias.command.enable", false, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du dem Alias mitteilen, dass er einen oder mehrere Befehle ausführen soll"));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can tell the alias to execute one or more commands"));
|
||||
}}),
|
||||
commandAsConsole("alias.command.commandAsConsole", true, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du angeben, ob der Befehl über die Konsole des Servers ausgeführt werden soll"));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can specify whether the command should be executed from the console of the server"));
|
||||
}}),
|
||||
bungeeCommand("alias.command.proxyCommand", false, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du festlegen, ob der Befehl auf dem Proxy ausgeführt werden soll.", "Damit diese Funktion funktioniert, muss die T2CodeLib auf deinem Proxy vorhanden sein und die API für T2C-OPSecurity muss in seiner Konfiguration aktiviert sein!", "(Wenn sie von der Proxy-Konsole aus ausgeführt werden soll, muss die Option CommandAsConsole ebenfalls aktiviert sein)."));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can define if the command should be executed on the proxy.", "For this function to work, the T2CodeLib must be present on your proxy and the API for T2C-OPSecurity must be activated in its config!", "(If it is to be executed from the proxy console, the CommandAsConsole option must also be enabled)."));
|
||||
}}),
|
||||
command("alias.command.commands", List.of(), true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du einen oder mehrere Befehle angeben, die ausgeführt werden sollen.", "Placeholder: [player] = Der Spieler, der den Alias ausführt"));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can specify one or more commands to be executed.", "Placeholder: [player] = The player who executes the alias"));
|
||||
}}),
|
||||
|
||||
messageEnable("alias.message.enable", true, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du angeben, ob der Spieler eine Nachricht erhalten soll."));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can specify whether the player should receive a message."));
|
||||
}}),
|
||||
|
||||
messages("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>"), true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Gib hier die Nachricht an, die der Spieler erhalten soll.", "Es können mehrere Zeilen verwendet werden und Platzhalter werden unterstützt!", "Placeholder: [player] = Der Spieler, der den Alias ausführt", "#", "Du kannst die Minecraft eigenen Farbcodes verwenden: https://minecraft.fandom.com/de/wiki/Formatierungscodes", "Du kannst auch MiniMessage verwenden:", " Wiki: https://docs.adventure.kyori.net/minimessage/format.html", " WebUI: https://webui.adventure.kyori.net"));
|
||||
put(T2C_LanguageEnum.english, List.of("Specify here the message that the player should get.", "Multiple lines can be used and placeholders are supported!", "Placeholder: [player] = The player who executes the alias", "#", "You can use Minecraft color codes: https://minecraft.fandom.com/de/wiki/Formatierungscodes", "You can also use MiniMessage:", " Wiki: https://docs.adventure.kyori.net/minimessage/format.html", " WebUI: https://webui.adventure.kyori.net"));
|
||||
}}),
|
||||
|
||||
admin("alias.admin", null, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du festlegen, dass Spieler mit der Berechtigung (Bei der Option alias.admin.permission angegeben) eine andere Funktion haben als andere Spieler.", "Du kannst z.B. sagen, dass Spieler zu einem bestimmten Punkt kommen sollen und Spieler mit der Admin-Funktion nur auf dem Server zu der Position kommen sollen, wo sie vorher waren.", "Example:", "Player: /warp CityBuild", "Spieler mit Admin Perm: /server CityBuild"));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can specify that players with the authorisation (specified in the alias.admin.permission option) 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.", "Example:", "Player: /warp CityBuild", "Player with Admin Perm: /server CityBuild"));
|
||||
}}),
|
||||
adminEnable("alias.admin.enable", false, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du die Admin-Funktion aktivieren oder deaktivieren"));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can enable or disable the admin function"));
|
||||
}}),
|
||||
|
||||
adminPermission("alias.admin.permission", "t2c.alias.[alias].admin", true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier legst du die Berechtigung für die Admin-Funktion fest", "Der Platzhalter [alias] ist der Name des Alias.", "Der Platzhalter [alias] ist der Name des Alias."));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you set the permission for the admin function", "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."));
|
||||
}}),
|
||||
|
||||
adminCommandEnable("alias.admin.command.enable", true, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du dem Alias mitteilen, dass er einen oder mehrere Befehle ausführen soll"));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can tell the alias to execute one or more commands"));
|
||||
}}),
|
||||
|
||||
adminCommandAsConsole("alias.admin.command.commandAsConsole", true, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du angeben, ob der Befehl über die Konsole des Servers ausgeführt werden soll"));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can specify whether the command should be executed from the console of the server"));
|
||||
}}),
|
||||
|
||||
adminBungeeCommand("alias.admin.command.proxyCommand", false, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du festlegen, ob der Befehl auf dem Proxy ausgeführt werden soll.", "For this function to work, the T2CodeLib must be present on your proxy and the API for T2C-OPSecurity must be activated in its config!", "(If it is to be executed from the proxy console, the CommandAsConsole option must also be enabled)."));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can define if the command should be executed on the proxy.", "For this function to work, the T2CodeLib must be present on your proxy and the API for T2C-OPSecurity must be activated in its config!", "(If it is to be executed from the proxy console, the CommandAsConsole option must also be enabled)."));
|
||||
}}),
|
||||
|
||||
adminCommands("alias.admin.command.commands", Collections.singletonList("say hi"), true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du einen oder mehrere Befehle angeben, die ausgeführt werden sollen.", "Placeholder: [player] = Der Spieler, der den Alias ausführt"));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can specify one or more commands to be executed.", "Placeholder: [player] = The player who executes the alias"));
|
||||
|
||||
}}),
|
||||
|
||||
adminMessageEnable("alias.admin.message.enable", false, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du angeben, ob der Spieler eine Nachricht erhalten soll."));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can specify whether the player should receive a message."));
|
||||
}}),
|
||||
|
||||
adminMessages("alias.admin.message.messages", List.of(), true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Gib hier die Nachricht an, die der Spieler erhalten soll.", "Es können mehrere Zeilen verwendet werden und Platzhalter werden unterstützt!", "Placeholder: [player] = Der Spieler, der den Alias ausführt", "#", "Du kannst die Minecraft eigenen Farbcodes verwenden: https://minecraft.fandom.com/de/wiki/Formatierungscodes", "Du kannst auch MiniMessage verwenden:", " Wiki: https://docs.adventure.kyori.net/minimessage/format.html", " WebUI: https://webui.adventure.kyori.net"));
|
||||
put(T2C_LanguageEnum.english, List.of("Specify here the message that the player should get.", "Multiple lines can be used and placeholders are supported!", "Placeholder: [player] = The player who executes the alias", "#", "You can use Minecraft custom color codes: https://minecraft.fandom.com/de/wiki/Formatierungscodes", "You can also use MiniMessage:", " Wiki: https://docs.adventure.kyori.net/minimessage/format.html", " WebUI: https://webui.adventure.kyori.net"));
|
||||
}}),
|
||||
|
||||
consoleEnable("alias.console.enable", false, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du festlegen, ob der Alias auch in der Konsole verwendet werden kann und was er dort tun soll."));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can define if the alias is also usable in the console and what it should do from there."));
|
||||
}}),
|
||||
|
||||
consoleCommandEnable("alias.console.command.enable", false, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du dem Alias mitteilen, dass er einen oder mehrere Befehle ausführen soll"));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can tell the alias to execute one or more commands"));
|
||||
}}),
|
||||
|
||||
consoleBungeeCommand("alias.console.command.proxyCommand", false, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du festlegen, ob der Befehl auf dem Proxy ausgeführt werden soll.", "Damit diese Funktion funktioniert, muss die T2CodeLib auf deinem Proxy vorhanden sein und die API für T2C-OPSecurity muss in seiner Konfiguration aktiviert sein!", "(Wenn sie von der Proxy-Konsole aus ausgeführt werden soll, muss die Option CommandAsConsole ebenfalls aktiviert sein)."));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can define if the command should be executed on the proxy.", "For this function to work, the T2CodeLib must be present on your proxy and the API for T2C-OPSecurity must be activated in its config!", "(If it is to be executed from the proxy console, the CommandAsConsole option must also be enabled)."));
|
||||
}}),
|
||||
|
||||
consoleCommands("alias.console.command.commands", List.of(), true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du einen oder mehrere Befehle angeben, die ausgeführt werden sollen."));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can specify one or more commands to be executed."));
|
||||
}}),
|
||||
|
||||
consoleMessageEnable("alias.console.message.enable", false, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du angeben, ob der Spieler eine Nachricht erhalten soll."));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can specify whether the player should receive a message."));
|
||||
}}),
|
||||
|
||||
consoleMessages("alias.console.message.messages", List.of(), true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Gib hier die Nachricht an, die der Spieler erhalten soll."));
|
||||
put(T2C_LanguageEnum.english, List.of("Specify here the message that the player should get."));
|
||||
}}),
|
||||
;
|
||||
|
||||
private final String path;
|
||||
private Object value;
|
||||
private final boolean forceSet;
|
||||
private final HashMap<T2C_LanguageEnum, List<String>> comments;
|
||||
|
||||
VALUES(String path, Object value, boolean forceSet, HashMap<T2C_LanguageEnum, List<String>> comments) {
|
||||
this.path = path;
|
||||
this.value = value;
|
||||
this.forceSet = forceSet;
|
||||
this.comments = comments;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getForceSet() {
|
||||
return forceSet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<T2C_LanguageEnum, List<String>> getComments() {
|
||||
return comments;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLanguagePath() {
|
||||
return Config.VALUES.language.getValue().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(Object newValue) {
|
||||
value = newValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void set(boolean isReload) {
|
||||
ConfigFileConverter.convert();
|
||||
File f = new File(Main.getPath() + "/alias/");
|
||||
File[] fileArray = f.listFiles();
|
||||
if (fileArray == null) {
|
||||
T2C_ConfigWriter.createConfig(Util.getPrefix(), new File(Main.getPath(), "alias/aliasexample.yml"), VALUES.values(), isReload, Util.getConfigLogo());
|
||||
}
|
||||
for (File file : fileArray) {
|
||||
String sub = file.getName().substring(file.getName().length() - 4);
|
||||
if (sub.equals(".yml")) {
|
||||
T2C_ConfigWriter.createConfig(Util.getPrefix(), new File(Main.getPath(), "alias/" + file.getName()), VALUES.values(), isReload, Util.getConfigLogo());
|
||||
for (String s : (List<String>) VALUES.aliasList.value) {
|
||||
if (s != null) {
|
||||
Main.allAliases.add(s);
|
||||
}
|
||||
}
|
||||
AliasObject alias = new AliasObject(
|
||||
(boolean) VALUES.aliasEnable.value,
|
||||
(List<String>) VALUES.aliasList.value,
|
||||
(boolean) VALUES.permNecessary.value,
|
||||
(String) VALUES.permission.value,
|
||||
(String) VALUES.permissionMSG.value,
|
||||
(int) VALUES.cooldownGlobal.value,
|
||||
(int) VALUES.cooldownPlayer.value,
|
||||
(boolean) VALUES.costEnable.value,
|
||||
(boolean) VALUES.costConfirm.value,
|
||||
(double) VALUES.costPrice.value,
|
||||
(boolean) VALUES.costAllowBypass.value,
|
||||
(boolean) VALUES.commandEnable.value,
|
||||
(boolean) VALUES.commandAsConsole.value,
|
||||
(boolean) VALUES.bungeeCommand.value,
|
||||
(List<String>) VALUES.command.value,
|
||||
(boolean) VALUES.messageEnable.value,
|
||||
(List<String>) VALUES.messages.value,
|
||||
(boolean) VALUES.adminEnable.value,
|
||||
(String) VALUES.adminPermission.value,
|
||||
(boolean) VALUES.adminCommandEnable.value,
|
||||
(boolean) VALUES.adminCommandAsConsole.value,
|
||||
(boolean) VALUES.adminBungeeCommand.value,
|
||||
(List<String>) VALUES.adminCommands.value,
|
||||
(boolean) VALUES.adminMessageEnable.value,
|
||||
(List<String>) VALUES.adminMessages.value,
|
||||
(boolean) VALUES.consoleEnable.value,
|
||||
(boolean) VALUES.consoleCommandEnable.value,
|
||||
(boolean) VALUES.consoleBungeeCommand.value,
|
||||
(List<String>) VALUES.consoleCommands.value,
|
||||
(boolean) VALUES.consoleMessageEnable.value,
|
||||
(List<String>) VALUES.consoleMessages.value);
|
||||
for (String al : (List<String>) VALUES.aliasList.value) {
|
||||
Main.aliasHashMap.put(al, alias);
|
||||
}
|
||||
}
|
||||
}
|
||||
new AliasRegister(Main.getInstance(), isReload);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,66 +0,0 @@
|
||||
package net.t2code.alias.Spigot.config.alias;
|
||||
|
||||
import net.t2code.alias.Spigot.Main;
|
||||
import net.t2code.alias.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.api.yaml.T2Cconfig;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
public class CreateExampleAliasConfig {
|
||||
|
||||
public static void configCreate() {
|
||||
long long_ = System.currentTimeMillis();
|
||||
T2Csend.console(Util.getPrefix() + " §4Alias/aliasexample.yml are created...");
|
||||
|
||||
File config = new File(Main.getPath(), "Alias/aliasexample.yml");
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
|
||||
T2Cconfig.set("Alias.Enable", true, yamlConfiguration);
|
||||
T2Cconfig.set("Alias.AliasList", Arrays.asList("aliasexample1"),yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("Alias.Permission.Necessary", true, yamlConfiguration);
|
||||
T2Cconfig.set("Alias.Permission.Permission", "t2code.alias.use.<alias>", yamlConfiguration);
|
||||
T2Cconfig.set("Alias.Permission.CustomNoPermissionMSG", "", yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("Alias.Cost.Enable", false,yamlConfiguration);
|
||||
T2Cconfig.set("Alias.Cost.Price", 0.0,yamlConfiguration);
|
||||
T2Cconfig.set("Alias.Cost.AllowByPass", true,yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("Alias.Command.Enable", true, yamlConfiguration);
|
||||
T2Cconfig.set("Alias.Command.CommandAsConsole", true, yamlConfiguration);
|
||||
T2Cconfig.set("Alias.Command.BungeeCommand", false, yamlConfiguration);
|
||||
T2Cconfig.set("Alias.Command.Commands", Arrays.asList("say hi"), yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("Alias.Message.Enable", false, yamlConfiguration);
|
||||
T2Cconfig.set("Alias.Message.Messages", Arrays.asList(), yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("Alias.Admin.Enable", false, yamlConfiguration);
|
||||
T2Cconfig.set("Alias.Admin.Permission", "t2code.alias.admin", yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("Alias.Admin.Command.Enable", true, yamlConfiguration);
|
||||
T2Cconfig.set("Alias.Admin.Command.CommandAsConsole", true, yamlConfiguration);
|
||||
T2Cconfig.set("Alias.Admin.Command.BungeeCommand", false, yamlConfiguration);
|
||||
T2Cconfig.set("Alias.Admin.Command.Commands", Collections.singletonList("say hi"), yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("Alias.Admin.Message.Enable", false, yamlConfiguration);
|
||||
T2Cconfig.set("Alias.Admin.Message.Messages", Arrays.asList(), yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("Alias.Console.Enable", false, yamlConfiguration);
|
||||
T2Cconfig.set("Alias.Console.Command.Enable", false, yamlConfiguration);
|
||||
T2Cconfig.set("Alias.Console.Command.BungeeCommand", false, yamlConfiguration);
|
||||
T2Cconfig.set("Alias.Console.Command.Commands", Arrays.asList(), yamlConfiguration);
|
||||
T2Cconfig.set("Alias.Console.Message.Enable", false, yamlConfiguration);
|
||||
T2Cconfig.set("Alias.Console.Message.Messages", Arrays.asList(), yamlConfiguration);
|
||||
try {
|
||||
yamlConfiguration.save(config);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
T2Csend.console(Util.getPrefix() + " §2Alias/aliasexample.yml were successfully created." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
}
|
||||
}
|
@ -1,115 +0,0 @@
|
||||
package net.t2code.alias.Spigot.config.alias;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.t2code.alias.Spigot.Main;
|
||||
import net.t2code.alias.Spigot.system.AliasRegister;
|
||||
import net.t2code.alias.Spigot.objects.AliasObject;
|
||||
import net.t2code.alias.Spigot.system.BukkitCommandWrap_Useless;
|
||||
import net.t2code.alias.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class SelectAlias {
|
||||
private static String Prefix = Util.getPrefix();
|
||||
|
||||
public static void onSelect() {
|
||||
|
||||
Main.aliasHashMap.clear();
|
||||
Main.allAliases.clear();
|
||||
|
||||
File f = new File(Main.getPath() + "/Alias/");
|
||||
File[] fileArray = f.listFiles();
|
||||
for (File config_gui : fileArray) {
|
||||
if (config_gui.getName().equals("X_aliasDeclaration_X.yml")) continue;
|
||||
|
||||
String sub = config_gui.getName().substring(config_gui.getName().length() - 4);
|
||||
if (sub.equals(".yml")) {
|
||||
YamlConfiguration yamlConfiguration;
|
||||
try {
|
||||
Preconditions.checkArgument(config_gui != null, "File cannot be null");
|
||||
YamlConfiguration config = new YamlConfiguration();
|
||||
config.load(config_gui);
|
||||
yamlConfiguration = config;
|
||||
} catch (FileNotFoundException var3) {
|
||||
continue;
|
||||
} catch (IOException var4) {
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Cannot load " + config_gui, var4);
|
||||
continue;
|
||||
} catch (InvalidConfigurationException var5) {
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Cannot load " + config_gui, var5);
|
||||
continue;
|
||||
}
|
||||
Boolean aliasEnable = yamlConfiguration.getBoolean("Alias.Enable");
|
||||
List<String> aliasList;
|
||||
if (yamlConfiguration.get("Alias.AliasList") == null) {
|
||||
AliasConfigConverter.convertAliasList(yamlConfiguration, config_gui);
|
||||
}
|
||||
aliasList = yamlConfiguration.getStringList("Alias.AliasList");
|
||||
Boolean permNecessary = yamlConfiguration.getBoolean("Alias.Permission.Necessary");
|
||||
if (yamlConfiguration.get("Alias.Permission.Permission") == null) {
|
||||
AliasConfigConverter.convertAddPermission(yamlConfiguration, config_gui, false);
|
||||
}
|
||||
String permission = yamlConfiguration.getString("Alias.Permission.Permission");
|
||||
if (yamlConfiguration.get("Alias.Permission.CustomNoPermissionMSG") == null) {
|
||||
AliasConfigConverter.convertAddPermissionMSG(yamlConfiguration, config_gui, false);
|
||||
}
|
||||
String permissionMSG = yamlConfiguration.getString("Alias.Permission.CustomNoPermissionMSG");
|
||||
|
||||
Boolean costEnable = yamlConfiguration.getBoolean("Alias.Cost.Enable");
|
||||
Double costPrice = yamlConfiguration.getDouble("Alias.Cost.Price");
|
||||
Boolean costAllowBypass = yamlConfiguration.getBoolean("Alias.Cost.AllowByPass");
|
||||
|
||||
Boolean commandEnable = yamlConfiguration.getBoolean("Alias.Command.Enable");
|
||||
Boolean commandAsConsole = yamlConfiguration.getBoolean("Alias.Command.CommandAsConsole");
|
||||
Boolean bungeeCommand = yamlConfiguration.getBoolean("Alias.Command.BungeeCommand");
|
||||
List<String> command = yamlConfiguration.getStringList("Alias.Command.Commands");
|
||||
|
||||
Boolean messageEnable = yamlConfiguration.getBoolean("Alias.Message.Enable");
|
||||
List<String> messages = yamlConfiguration.getStringList("Alias.Message.Messages");
|
||||
|
||||
Boolean adminEnable = yamlConfiguration.getBoolean("Alias.Admin.Enable");
|
||||
String adminPermission = yamlConfiguration.getString("Alias.Admin.Permission");
|
||||
|
||||
Boolean adminCommandEnable = yamlConfiguration.getBoolean("Alias.Admin.Command.Enable");
|
||||
Boolean adminCommandAsConsole = yamlConfiguration.getBoolean("Alias.Admin.Command.CommandAsConsole");
|
||||
Boolean adminBungeeCommand = yamlConfiguration.getBoolean("Alias.Admin.Command.BungeeCommand");
|
||||
List<String> adminCommands = yamlConfiguration.getStringList("Alias.Admin.Command.Commands");
|
||||
|
||||
Boolean adminMessageEnable = yamlConfiguration.getBoolean("Alias.Admin.Message.Enable");
|
||||
List<String> adminMessages = yamlConfiguration.getStringList("Alias.Admin.Message.Messages");
|
||||
|
||||
Boolean consoleEnable = yamlConfiguration.getBoolean("Alias.Console.Enable");
|
||||
Boolean consoleCommandEnable = yamlConfiguration.getBoolean("Alias.Console.Command.Enable");
|
||||
Boolean consoleBungeeCommand = yamlConfiguration.getBoolean("Alias.Console.Command.BungeeCommand");
|
||||
List<String> consoleCommands = yamlConfiguration.getStringList("Alias.Console.Command.Commands");
|
||||
Boolean consoleMessageEnable = yamlConfiguration.getBoolean("Alias.Console.Message.Enable");
|
||||
List<String> consoleMessages = yamlConfiguration.getStringList("Alias.Console.Message.Messages");
|
||||
|
||||
Main.allAliases.addAll(aliasList);
|
||||
AliasObject alias = new AliasObject(aliasEnable, aliasList, permNecessary, permission, permissionMSG, costEnable, costPrice, costAllowBypass, commandEnable, commandAsConsole, bungeeCommand,
|
||||
command, messageEnable, messages, adminEnable, adminPermission, adminCommandEnable, adminCommandAsConsole, adminBungeeCommand, adminCommands,
|
||||
adminMessageEnable, adminMessages, consoleEnable, consoleCommandEnable, consoleBungeeCommand, consoleCommands, consoleMessageEnable, consoleMessages);
|
||||
for (String al : aliasList) {
|
||||
Main.aliasHashMap.put(al, alias);
|
||||
}
|
||||
T2Csend.console(Prefix + " §aAlias file §e" + config_gui.getName() + " §awas loaded");
|
||||
}
|
||||
}
|
||||
T2Ctemplate.onLoadSeparateStroke(Util.getPrefix());
|
||||
AliasRegister.onRegister();
|
||||
}
|
||||
|
||||
private YamlConfiguration loadFile(File file) throws InvalidConfigurationException {
|
||||
return YamlConfiguration.loadConfiguration(file);
|
||||
}
|
||||
}
|
145
src/main/java/net/t2code/alias/Spigot/config/config/Config.java
Normal file
145
src/main/java/net/t2code/alias/Spigot/config/config/Config.java
Normal file
@ -0,0 +1,145 @@
|
||||
package net.t2code.alias.Spigot.config.config;
|
||||
|
||||
import net.t2code.alias.Spigot.Main;
|
||||
import net.t2code.alias.Spigot.enums.Confirm;
|
||||
import net.t2code.alias.util.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.items.T2C_ItemVersion;
|
||||
import net.t2code.t2codelib.SPIGOT.api.yaml.T2C_ConfigWriter;
|
||||
import net.t2code.t2codelib.util.T2C_ConfigItem;
|
||||
import net.t2code.t2codelib.util.T2C_LanguageEnum;
|
||||
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class Config {
|
||||
|
||||
public enum VALUES implements T2C_ConfigItem {
|
||||
language("plugin.language", "english", true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du die Sprache des Plugins einstellen."));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can set the language of the plugin."));
|
||||
}}),
|
||||
|
||||
updateCheckOnJoin("plugin.updateCheck.onJoin", true, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Mit dieser Option kannst du festlegen, ob Spieler mit der Berechtigung 't2c.opsecurity.updatemsg' beim Beitritt eine Update-Nachricht erhalten, wenn ein Update für das Plugin verfügbar ist."));
|
||||
put(T2C_LanguageEnum.english, List.of("In this option you can set if players with the permission 't2c.opsecurity.updatemsg' will get an update message on join when an update for the plugin is available."));
|
||||
}}),
|
||||
|
||||
updateCheckSeePreReleaseUpdates("plugin.updateCheck.seePreReleaseUpdates", true, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("In dieser Option kannst du einstellen, ob du Beta- und Snapshot-Versionen in der Update-Prüfung erhalten und anzeigen möchtest."));
|
||||
put(T2C_LanguageEnum.english, List.of("In this option you can set whether you want to receive and display beta and snapshot versions in the update check."));
|
||||
}}),
|
||||
|
||||
updateCheckTimeInterval("plugin.updateCheck.timeInterval", 60, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Mit dieser Option kannst du das Zeitintervall in Minuten festlegen, in dem Aktualisierungen überprüft werden sollen."));
|
||||
put(T2C_LanguageEnum.english, List.of("In this option you can set the time interval in minutes in which updates should be checked."));
|
||||
}}),
|
||||
|
||||
buyMessage("buy.message", true, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Mit dieser Option kannst du einstellen, ob nach der Zahlung für einen Alias, für den man bezahlen muss, eine Bestätigung gesendet werden soll."));
|
||||
put(T2C_LanguageEnum.english, List.of("With this option you can set whether a confirmation should be sent after the payment for an alias for which you have to pay."));
|
||||
}}),
|
||||
|
||||
buyCurrency("buy.currency", "$", true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of(""));
|
||||
put(T2C_LanguageEnum.english, List.of("With this option you set the currency."));
|
||||
}}),
|
||||
|
||||
buyConfirmDefault("buy.confirm.use", Confirm.COMMAND, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kann man wählen, welche Bestätigungsmethode verwendet werden möchte. (COMMAND, CHAT, GUI)"));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can choose which confirmation method you want to use. (COMMAND, CHAT, GUI)"));
|
||||
}}),
|
||||
|
||||
buyConfirmGuiFillItemDesc("buy.confirm.gui.fillItem", null, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("","!! Du kannst den GUI-Namen und die Schaltflächentexte in der Sprachdatei ändern !!",""));
|
||||
put(T2C_LanguageEnum.english, List.of(" ", "!! You can change the GUI name and the button texts in the language file !!", " "));
|
||||
}}),
|
||||
|
||||
buyConfirmGuiFillItemEnabled("buy.confirm.gui.fillItem.enabled", true, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du einstellen, ob ein Fillitem in der Confirm GUI verwendet werden soll."));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can set if a fillitem should be used in the Confirm GUI."));
|
||||
}}),
|
||||
|
||||
buyConfirmGuiFillItem("buy.confirm.gui.fillItem.material", T2C_ItemVersion.getBlackStainedGlassPane().getType().toString(), true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du einstellen, welches Fillitem in der Confirm GUI verwendet werden soll."));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can set which fillitem should be used in the Confirm GUI."));
|
||||
}}),
|
||||
|
||||
buyConfirmGuiConfirm("buy.confirm.gui.confirm.material", T2C_ItemVersion.getGreenWool().getType().toString(), true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du das Material für die Bestätigungsschaltfläche festlegen."));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can set the material for the confirmation button."));
|
||||
}}),
|
||||
|
||||
buyConfirmGuiCancel("buy.confirm.gui.cancel.material", T2C_ItemVersion.getRedWool().getType().toString(), true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du das Material für die Abbruchtaste festlegen."));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can set the material for the cancel button."));
|
||||
}}),
|
||||
|
||||
subAliasTab("subAlias.tabComplete", true, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du einstellen, ob Unterbefehle als tabComplete angezeigt werden sollen."));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can set if subcommands should be displayed as tabComplete."));
|
||||
}}),
|
||||
;
|
||||
|
||||
private final String path;
|
||||
private Object value;
|
||||
private final boolean forceSet;
|
||||
private final HashMap<T2C_LanguageEnum, List<String>> comments;
|
||||
|
||||
VALUES(String path, Object value, boolean forceSet, HashMap<T2C_LanguageEnum, List<String>> comments) {
|
||||
this.path = path;
|
||||
this.value = value;
|
||||
this.forceSet = forceSet;
|
||||
this.comments = comments;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getForceSet() {
|
||||
return forceSet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<T2C_LanguageEnum, List<String>> getComments() {
|
||||
return comments;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLanguagePath() {
|
||||
return language.path;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(Object newValue) {
|
||||
value = newValue;
|
||||
}
|
||||
}
|
||||
|
||||
public static void set(boolean isReload) {
|
||||
T2C_ConfigWriter.createConfig(Util.getPrefix(),new File(Main.getPath(), "config.yml"), VALUES.values(),isReload, Util.getConfigLogo());
|
||||
}
|
||||
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
package net.t2code.alias.Spigot.config.config;
|
||||
|
||||
import net.t2code.alias.Spigot.Main;
|
||||
import net.t2code.alias.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.api.yaml.T2Cconfig;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class CreateConfig {
|
||||
|
||||
|
||||
public static void configCreate() {
|
||||
long long_ = System.currentTimeMillis();
|
||||
if (new File(Main.getPath(), "config.yml").exists()) {
|
||||
if (Main.getPlugin().getConfig().getBoolean("Plugin.Debug")) T2Csend.console(Util.getPrefix() + " §5DEBUG: §6" + " §4config.yml are created / updated...");
|
||||
} else T2Csend.console(Util.getPrefix() + " §4config.yml are created...");
|
||||
|
||||
File config = new File(Main.getPath(), "config.yml");
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
|
||||
T2Cconfig.set("Plugin.language", "english", yamlConfiguration);
|
||||
T2Cconfig.set("Plugin.updateCheck.onJoin", true, yamlConfiguration);
|
||||
T2Cconfig.set("Plugin.updateCheck.seePreReleaseUpdates", true, yamlConfiguration);
|
||||
T2Cconfig.set("Plugin.updateCheck.timeInterval", 60, yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("BungeeCord.Enable", false, yamlConfiguration);
|
||||
T2Cconfig.set("BungeeCord.ThisServer", "server", yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("Buy.Message", true, yamlConfiguration);
|
||||
T2Cconfig.set("SubAlias.TabComplete", true, yamlConfiguration);
|
||||
|
||||
try {
|
||||
yamlConfiguration.save(config);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
T2Csend.console(Util.getPrefix() + " §2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
}
|
||||
}
|
@ -0,0 +1,256 @@
|
||||
package net.t2code.alias.Spigot.config.config;
|
||||
|
||||
import net.t2code.alias.Spigot.Main;
|
||||
import net.t2code.alias.Spigot.enums.ConfigParam;
|
||||
import net.t2code.alias.util.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.yaml.T2C_LanguageWriter;
|
||||
import net.t2code.t2codelib.util.T2C_ConfigItemLanguages;
|
||||
import net.t2code.t2codelib.util.T2C_LanguageEnum;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class Language {
|
||||
|
||||
public enum VALUES implements T2C_ConfigItemLanguages {
|
||||
|
||||
otherLang("plugin", null,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, null);
|
||||
put(T2C_LanguageEnum.english, null);
|
||||
}},
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Wenn du eine Eigene Sprache hinzufügen magst, dann kopiere einfach eine Sprachdatei und benenne sie in deine Sprache, dies kannst du dann in der config.yml einstellen.", ""));
|
||||
put(T2C_LanguageEnum.english, List.of("If you want to add your own language, simply copy a language file and rename it to your language, you can then set this in config.yml.", ""));
|
||||
}}),
|
||||
|
||||
onlyForPlayer("plugin.onlyForPlayer", null,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("[prefix] <red>Dieser Command ist nur f[ue]r Spieler!</red>"));
|
||||
put(T2C_LanguageEnum.english, List.of("[prefix] <red>This command is for players only!</red>"));
|
||||
}},
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of());
|
||||
put(T2C_LanguageEnum.english, List.of());
|
||||
}}),
|
||||
|
||||
aliasDisabled("plugin.aliasDisabled", null,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Unknown command. Type ''/help'' for help."));
|
||||
put(T2C_LanguageEnum.english, List.of("Unknown command. Type ''/help'' for help."));
|
||||
}},
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of());
|
||||
put(T2C_LanguageEnum.english, List.of());
|
||||
}}),
|
||||
|
||||
reloadStart("plugin.reload.start", null,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("[prefix] <gold>Plugin wird neu geladen...</gold>"));
|
||||
put(T2C_LanguageEnum.english, List.of("[prefix] <gold>Plugin is reloaded...</gold>"));
|
||||
}},
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of());
|
||||
put(T2C_LanguageEnum.english, List.of());
|
||||
}}),
|
||||
|
||||
reloadEnd("plugin.reload.end", null,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("[prefix] <dark_green>Plugin wurde erfolgreich neu geladen.</dark_green>"));
|
||||
put(T2C_LanguageEnum.english, List.of("[prefix] <dark_green>Plugin was successfully reloaded.</dark_green>"));
|
||||
}},
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of());
|
||||
put(T2C_LanguageEnum.english, List.of());
|
||||
}}),
|
||||
|
||||
noPermission("plugin.noPermissionForCommand", null,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("[prefix] <red>F[ue]r <aqua>[cmd]</aqua> fehlt dir die Permission <gold>[perm]</gold>!</red>"));
|
||||
put(T2C_LanguageEnum.english, List.of("[prefix] <red>For <aqua>[cmd]</aqua> you lack the permission <gold>[perm]</gold>!</red>"));
|
||||
}},
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of());
|
||||
put(T2C_LanguageEnum.english, List.of());
|
||||
}}),
|
||||
|
||||
noSubCommand("plugin.noSubCommand", null,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("[prefix] <red>Diesen Befehl gibt es nicht!</red>"));
|
||||
put(T2C_LanguageEnum.english, List.of("[prefix] <red>This command does not exist!</red>"));
|
||||
}},
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of());
|
||||
put(T2C_LanguageEnum.english, List.of());
|
||||
}}),
|
||||
buy("cost.buy", null,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("[prefix] <dark_green>Du hast f[ue]r diesen Command <gold>[price]</gold> bezahlt.</dark_green>"));
|
||||
put(T2C_LanguageEnum.english, List.of("[prefix] <dark_green>You have paid <gold>[price]</gold> for this command.</dark_green>"));
|
||||
}},
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of());
|
||||
put(T2C_LanguageEnum.english, List.of());
|
||||
}}),
|
||||
noMoney("cost.noMoney", null,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("[prefix] <red>Du hast nicht gen[ue]gend Geld für diesen Command!</red>"));
|
||||
put(T2C_LanguageEnum.english, List.of("[prefix] <red>You don't have enough money for this command!</red>"));
|
||||
}},
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of());
|
||||
put(T2C_LanguageEnum.english, List.of());
|
||||
}}),
|
||||
|
||||
cooldownPlayer("cooldown.player", null,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("[prefix] <red>Du musst noch <gold>[cooldown]</gold> Sekunden warten um diesen Command erneut zu nutzen.</red>"));
|
||||
put(T2C_LanguageEnum.english, List.of("[prefix] <red>You must wait <gold>[cooldown]</gold> seconds to use this command again.</red>"));
|
||||
}},
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of());
|
||||
put(T2C_LanguageEnum.english, List.of());
|
||||
}}),
|
||||
cooldownGlobal("cooldown.global", null,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("[prefix] <red>Du musst noch <gold>[cooldown]</gold> Sekunden warten um diesen Command zu nutzen.</red>"));
|
||||
put(T2C_LanguageEnum.english, List.of("[prefix] <red>You have to wait <gold>[cooldown]</gold> seconds to use this command.</red>"));
|
||||
}},
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of());
|
||||
put(T2C_LanguageEnum.english, List.of());
|
||||
}}),
|
||||
|
||||
confirmCommand("cost.confirm.command", null,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("[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>"));
|
||||
put(T2C_LanguageEnum.english, List.of("[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>"));
|
||||
}},
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of());
|
||||
put(T2C_LanguageEnum.english, List.of());
|
||||
}}),
|
||||
confirmChat("cost.confirm.chat", null,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("[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>"));
|
||||
put(T2C_LanguageEnum.english, List.of("[prefix] <gold>For this command you have to pay [price]!</gold><br>[prefix] <green><click:run_command:'t2code-alias-confirm'><hover:show_text:'<gray>Click to confirm</gray>'>Confirm</hover></click></green> <gray>-</gray> <red><click:run_command:'t2code-alias-cancel'><hover:show_text:'<gray>click to cancel</gray>'>Cancel</hover></click></red>"));
|
||||
}},
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of());
|
||||
put(T2C_LanguageEnum.english, List.of());
|
||||
}}),
|
||||
|
||||
confirmGuiTitle("cost.confirm.gui.title", null,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("&2Bestätige den Zahlvorgang für: &6/[alias]"));
|
||||
put(T2C_LanguageEnum.english, List.of("&2Confirm the payment process for: &6/[alias]"));
|
||||
}},
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of());
|
||||
put(T2C_LanguageEnum.english, List.of());
|
||||
}}),
|
||||
confirmGuiConfirm("cost.confirm.gui.confirm.displayName", null,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("&2Bestätigen"));
|
||||
put(T2C_LanguageEnum.english, List.of("&2Confirm"));
|
||||
}},
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of());
|
||||
put(T2C_LanguageEnum.english, List.of());
|
||||
}}),
|
||||
confirmGuiConfirmLore("cost.confirm.gui.confirm.lore", null,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("&aDieser Befehl kostet", "&6[price]"));
|
||||
put(T2C_LanguageEnum.english, List.of("&aThis command costs", "&6[price]"));
|
||||
}},
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of());
|
||||
put(T2C_LanguageEnum.english, List.of());
|
||||
}}),
|
||||
confirmGuiCancel("cost.confirm.gui.cancel.displayName", null,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german,List.of( "&cAbbrechen"));
|
||||
put(T2C_LanguageEnum.english, List.of("&cCancel"));
|
||||
}},
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of());
|
||||
put(T2C_LanguageEnum.english, List.of());
|
||||
}}),
|
||||
confirmGuiCancelLore("cost.confirm.gui.cancel.lore", null,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of(""));
|
||||
put(T2C_LanguageEnum.english, List.of(""));
|
||||
}},
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of());
|
||||
put(T2C_LanguageEnum.english, List.of());
|
||||
}}),
|
||||
confirmCancel("cost.confirm.cancel", null,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("[prefix] <gold>Der befehl wurde abgebrochen und du musst nichts bezahlen!</gold>"));
|
||||
put(T2C_LanguageEnum.english, List.of("[prefix] <gold>The command was canceled and you do not have to pay anything!</gold>"));
|
||||
}},
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of());
|
||||
put(T2C_LanguageEnum.english, List.of());
|
||||
}}),
|
||||
confirmNotPossible("cost.confirm.notPossible", null,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("[prefix] <gold>Bestätigen nicht möglich, du hast keinen zahlungspflichtigen befehl ausgeführt.</gold>"));
|
||||
put(T2C_LanguageEnum.english, List.of("[prefix] <gold>Confirmation not possible, you have not executed a payable command.</gold>"));
|
||||
}},
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of());
|
||||
put(T2C_LanguageEnum.english, List.of());
|
||||
}}),
|
||||
;
|
||||
|
||||
|
||||
private final String path;
|
||||
private Object value;
|
||||
private final HashMap<T2C_LanguageEnum, List<String>> lang;
|
||||
private final HashMap<T2C_LanguageEnum, List<String>> comments;
|
||||
|
||||
VALUES(String path, Object value, HashMap<T2C_LanguageEnum, List<String>> lang, HashMap<T2C_LanguageEnum, List<String>> comments) {
|
||||
this.path = path;
|
||||
this.value = value;
|
||||
this.lang = lang;
|
||||
this.comments = comments;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValue() {
|
||||
if (value == null) {
|
||||
return lang.get(T2C_LanguageEnum.english);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<T2C_LanguageEnum, List<String>> getLanguage() {
|
||||
return lang;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<T2C_LanguageEnum, List<String>> getComments() {
|
||||
return comments;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(Object newValue) {
|
||||
value = newValue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void set(boolean isReload) {
|
||||
T2C_LanguageWriter.createConfig(Util.getPrefix(), Main.getPath(), VALUES.values(), Config.VALUES.language.getValue().toString(), isReload, Util.getConfigLogo());
|
||||
}
|
||||
|
||||
}
|
@ -1,91 +0,0 @@
|
||||
package net.t2code.alias.Spigot.config.config;
|
||||
|
||||
import net.t2code.alias.Spigot.Main;
|
||||
import net.t2code.t2codelib.SPIGOT.api.yaml.T2Cconfig;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class SelectConfig {
|
||||
private static Integer ConfigVersion = 3;
|
||||
private static Integer isConfigVersion;
|
||||
private static Boolean updateCheckOnJoin;
|
||||
private static Boolean updateCheckSeePreReleaseUpdates;
|
||||
private static Integer updateCheckTimeInterval;
|
||||
private static String language;
|
||||
private static Boolean Bungee;
|
||||
private static String thisServer;
|
||||
|
||||
private static Boolean buyMessage;
|
||||
private static Boolean subAliasTab;
|
||||
|
||||
public static void onSelect() {
|
||||
File config = new File(Main.getPath(), "config.yml");
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
|
||||
isConfigVersion = yamlConfiguration.getInt("ConfigVersion");
|
||||
|
||||
updateCheckOnJoin = yamlConfiguration.getBoolean("Plugin.updateCheck.onJoin");
|
||||
updateCheckSeePreReleaseUpdates = yamlConfiguration.getBoolean("Plugin.updateCheck.seePreReleaseUpdates");
|
||||
updateCheckTimeInterval = yamlConfiguration.getInt("Plugin.updateCheck.timeInterval");
|
||||
|
||||
|
||||
language = yamlConfiguration.getString("Plugin.language");
|
||||
Bungee = yamlConfiguration.getBoolean("BungeeCord.Enable");
|
||||
thisServer = yamlConfiguration.getString("BungeeCord.ThisServer");
|
||||
|
||||
buyMessage = yamlConfiguration.getBoolean("Buy.Message");
|
||||
subAliasTab = yamlConfiguration.getBoolean("SubAlias.TabComplete");
|
||||
}
|
||||
public static void setConfigVersion() {
|
||||
File config = new File(Main.getPath(), "config.yml");
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
yamlConfiguration.set("ConfigVersion", ConfigVersion);
|
||||
try {
|
||||
yamlConfiguration.save(config);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static Integer getConfigVersion() {
|
||||
return ConfigVersion;
|
||||
}
|
||||
|
||||
public static Integer getIsConfigVersion() {
|
||||
return isConfigVersion;
|
||||
}
|
||||
|
||||
public static Boolean getUpdateCheckOnJoin() {
|
||||
return updateCheckOnJoin;
|
||||
}
|
||||
|
||||
public static Boolean getUpdateCheckSeePreReleaseUpdates() {
|
||||
return updateCheckSeePreReleaseUpdates;
|
||||
}
|
||||
|
||||
public static Integer getUpdateCheckTimeInterval() {
|
||||
return updateCheckTimeInterval;
|
||||
}
|
||||
|
||||
public static String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
public static Boolean getBungee() {
|
||||
return Bungee;
|
||||
}
|
||||
|
||||
public static String getThisServer() {
|
||||
return thisServer;
|
||||
}
|
||||
|
||||
public static Boolean getBuyMessage() {
|
||||
return buyMessage;
|
||||
}
|
||||
|
||||
public static Boolean getSubAliasTab() {
|
||||
return subAliasTab;
|
||||
}
|
||||
}
|
@ -1,75 +0,0 @@
|
||||
package net.t2code.alias.Spigot.config.languages;
|
||||
|
||||
import net.t2code.alias.Spigot.Main;
|
||||
import net.t2code.alias.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.api.yaml.T2Cconfig;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class LanguagesCreate {
|
||||
|
||||
public static void langCreate() {
|
||||
T2Csend.debug(Main.getPlugin(),"§4Language files are created / updated...");
|
||||
long long_ = System.currentTimeMillis();
|
||||
|
||||
/**
|
||||
*
|
||||
* ENGLISH
|
||||
*
|
||||
*/
|
||||
|
||||
File messagesEN = new File(Main.getPath(), "languages/english_messages.yml");
|
||||
YamlConfiguration yamlConfigurationEN = YamlConfiguration.loadConfiguration(messagesEN);
|
||||
|
||||
T2Cconfig.set("Plugin.OnlyForPlayer", MSG.EN_OnlyForPlayer, yamlConfigurationEN);
|
||||
T2Cconfig.set("Plugin.AliasDisabled", MSG.EN_Disabled, yamlConfigurationEN);
|
||||
T2Cconfig.set("Plugin.Reload.Start", MSG.EN_ReloadStart, yamlConfigurationEN);
|
||||
T2Cconfig.set("Plugin.Reload.End", MSG.EN_ReloadEnd, yamlConfigurationEN);
|
||||
T2Cconfig.set("Plugin.ForCommand", MSG.EN_NoPermissionForCommand, yamlConfigurationEN);
|
||||
T2Cconfig.set("Plugin.NoSubCommand", MSG.EN_NoSubCommand, yamlConfigurationEN);
|
||||
|
||||
T2Cconfig. set("Cost.Buy", MSG.EN_Buy, yamlConfigurationEN);
|
||||
T2Cconfig.set("Cost.NoMoney", MSG.EN_NoMoney, yamlConfigurationEN);
|
||||
|
||||
try {
|
||||
yamlConfigurationEN.save(messagesEN);
|
||||
} catch (IOException e) {
|
||||
T2Csend.warning(Main.getPlugin(),e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* GERMAN
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
File messagesDE = new File(Main.getPath(), "languages/german_messages.yml");
|
||||
YamlConfiguration yamlConfigurationDE = YamlConfiguration.loadConfiguration(messagesDE);
|
||||
|
||||
T2Cconfig.set("Plugin.OnlyForPlayer", MSG.DE_OnlyForPlayer, yamlConfigurationDE);
|
||||
T2Cconfig.set("Plugin.AliasDisabled", MSG.DE_Disabled, yamlConfigurationDE);
|
||||
T2Cconfig.set("Plugin.Reload.Start", MSG.DE_ReloadStart, yamlConfigurationDE);
|
||||
T2Cconfig.set("Plugin.Reload.End", MSG.DE_ReloadEnd, yamlConfigurationDE);
|
||||
T2Cconfig.set("Plugin.ForCommand", MSG.DE_NoPermissionForCommand, yamlConfigurationDE);
|
||||
T2Cconfig.set("Plugin.NoSubCommand", MSG.DE_NoSubCommand, yamlConfigurationDE);
|
||||
|
||||
T2Cconfig.set("Cost.Buy", MSG.DE_Buy, yamlConfigurationDE);
|
||||
T2Cconfig.set("Cost.NoMoney", MSG.DE_NoMoney, yamlConfigurationDE);
|
||||
|
||||
try {
|
||||
yamlConfigurationDE.save(messagesDE);
|
||||
} catch (IOException e) {
|
||||
T2Csend.warning(Main.getPlugin(),e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
T2Csend.console(Util.getPrefix() + " §2Language files were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
}
|
||||
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
// This claas was created by JaTiTV
|
||||
|
||||
// -----------------------------
|
||||
// _____ _____ _ _ _____
|
||||
// / ____/ ____| | | |_ _|
|
||||
// | | | | __| | | | | |
|
||||
// | | | | |_ | | | | | |
|
||||
// | |___| |__| | |__| |_| |_
|
||||
// \_____\_____|\____/|_____|
|
||||
// -----------------------------
|
||||
|
||||
package net.t2code.alias.Spigot.config.languages;
|
||||
|
||||
public class MSG {
|
||||
|
||||
// EN
|
||||
|
||||
public static String EN_OnlyForPlayer = "[prefix] <red>This command is for players only!</red>";
|
||||
|
||||
public static String EN_Disabled = "Unknown command. Type ''/help'' for help.";
|
||||
|
||||
public static String EN_ReloadStart = "[prefix] <gold>Plugin is reloaded...</gold>";
|
||||
public static String EN_ReloadEnd = "[prefix] <dark_green>Plugin was successfully reloaded.</dark_green>";
|
||||
|
||||
public static String EN_NoPermissionForCommand = "[prefix] <red>For <aqua>[cmd]</aqua> you lack the permission <gold>[perm]</gold>!</red>";
|
||||
|
||||
public static String EN_Buy = "[prefix] <dark_green>You have paid <gold>[price]</gold> for this command.</dark_green>";
|
||||
public static String EN_NoMoney = "[prefix] <red>You don't have enough money for this command!</red>";
|
||||
public static String EN_NoSubCommand = "[prefix] <red>This command does not exist!</red>";
|
||||
|
||||
|
||||
// DE
|
||||
public static String DE_OnlyForPlayer = "[prefix] <red>Dieser Command ist nur f[ue]r Spieler!</red>";
|
||||
|
||||
public static String DE_Disabled = "Unknown command. Type ''/help'' for help.";
|
||||
|
||||
public static String DE_ReloadStart = "[prefix] <gold>Plugin wird neu geladen...</gold>";
|
||||
public static String DE_ReloadEnd = "[prefix] <dark_green>Plugin wurde erfolgreich neu geladen.</dark_green>";
|
||||
|
||||
public static String DE_NoPermissionForCommand = "[prefix] <red>F[ue]r <aqua>[cmd]</aqua> fehlt dir die Permission <gold>[perm]</gold>!</red>";
|
||||
|
||||
public static String DE_Buy = "[prefix] <dark_green>Du hast f[ue]r diesen Command <gold>[price]</gold> bezahlt.</dark_green>";
|
||||
public static String DE_NoMoney = "[prefix] <red>Du hast nicht gen[ue]gend Geld für diesen Command!</red>";
|
||||
|
||||
public static String DE_NoSubCommand = "[prefix] <red>Diesen Befehl gibt es nicht!</red>";
|
||||
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
package net.t2code.alias.Spigot.config.languages;
|
||||
|
||||
import net.t2code.alias.Spigot.Main;
|
||||
import net.t2code.alias.Spigot.config.config.SelectConfig;
|
||||
import net.t2code.alias.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class SelectMessages {
|
||||
public static String selectMSG;
|
||||
|
||||
public static String onlyForPlayer;
|
||||
public static String reloadStart;
|
||||
public static String reloadEnd;
|
||||
|
||||
public static String noPermissionForCommand;
|
||||
public static String noSubCommand;
|
||||
public static String aliasDisabled;
|
||||
|
||||
public static String buy;
|
||||
public static String noMoney;
|
||||
|
||||
|
||||
public static void onSelect(String Prefix) {
|
||||
|
||||
T2Csend.debug(Main.getPlugin(), "§4Select language...");
|
||||
long long_ = System.currentTimeMillis();
|
||||
|
||||
File msg;
|
||||
|
||||
msg = new File(Main.getPath(), "languages/" + SelectConfig.getLanguage() + "_messages.yml");
|
||||
if (!msg.isFile()) {
|
||||
T2Csend.console(Prefix);
|
||||
T2Csend.console(Prefix + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
T2Csend.console(Prefix + " §4The selected §c" + SelectConfig.getLanguage() + " §4language file was not found.");
|
||||
T2Csend.console(Prefix + " §6The default language §eEnglish §6is used!");
|
||||
T2Csend.console(Prefix + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
T2Csend.console(Prefix);
|
||||
msg = new File(Main.getPath(), "languages/" + "english_messages.yml");
|
||||
selectMSG = "english";
|
||||
} else selectMSG = SelectConfig.getLanguage();
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(msg);
|
||||
|
||||
if (yamlConfiguration.get("Plugin.Prefix") != null) {
|
||||
Util.setPrefix(replace(yamlConfiguration.getString("Plugin.Prefix")));
|
||||
}
|
||||
onlyForPlayer = replace(yamlConfiguration.getString("Plugin.OnlyForPlayer"));
|
||||
aliasDisabled = replace(yamlConfiguration.getString("Plugin.AliasDisabled"));
|
||||
reloadStart = replace(yamlConfiguration.getString("Plugin.Reload.Start"));
|
||||
reloadEnd = replace(yamlConfiguration.getString("Plugin.Reload.End"));
|
||||
noPermissionForCommand = replace(yamlConfiguration.getString("Plugin.ForCommand"));
|
||||
noSubCommand = replace(yamlConfiguration.getString("Plugin.NoSubCommand"));
|
||||
buy = replace(yamlConfiguration.getString("Cost.Buy"));
|
||||
noMoney = replace(yamlConfiguration.getString("Cost.NoMoney"));
|
||||
|
||||
T2Csend.console(Prefix + " §2Language successfully selected to: §6" + selectMSG + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
}
|
||||
|
||||
private static String replace(String text) {
|
||||
return T2Creplace.replace(Util.getPrefix(), text);
|
||||
}
|
||||
}
|
@ -1,67 +0,0 @@
|
||||
package net.t2code.alias.Spigot.config.subAlias;
|
||||
|
||||
import net.t2code.alias.Spigot.Main;
|
||||
import net.t2code.alias.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.api.yaml.T2Cconfig;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
public class CreateExampleSubAliasConfig {
|
||||
|
||||
public static void configCreate() {
|
||||
long long_ = System.currentTimeMillis();
|
||||
T2Csend.console(Util.getPrefix() + " §4SubAlias/aliasexample.yml are created...");
|
||||
|
||||
File config = new File(Main.getPath(), "SubAlias/aliasexample.yml");
|
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||
|
||||
T2Cconfig.set("SubAlias.Enable", true, yamlConfiguration);
|
||||
T2Cconfig.set("SubAlias.SubAliasList", Arrays.asList("test"), yamlConfiguration);
|
||||
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.CustomNoPermissionMSG", "", yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("SubAlias.Cost.Enable", false, yamlConfiguration);
|
||||
T2Cconfig.set("SubAlias.Cost.Price", 0.0, yamlConfiguration);
|
||||
T2Cconfig.set("SubAlias.Cost.AllowByPass", true, yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("SubAlias.Command.Enable", true, yamlConfiguration);
|
||||
T2Cconfig.set("SubAlias.Command.CommandAsConsole", true, yamlConfiguration);
|
||||
T2Cconfig.set("SubAlias.Command.BungeeCommand", false, yamlConfiguration);
|
||||
T2Cconfig.set("SubAlias.Command.Commands", Arrays.asList("say hi"), yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("SubAlias.Message.Enable", false, yamlConfiguration);
|
||||
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.Command.Enable", true, yamlConfiguration);
|
||||
T2Cconfig.set("SubAlias.Admin.Command.CommandAsConsole", true, yamlConfiguration);
|
||||
T2Cconfig.set("SubAlias.Admin.Command.BungeeCommand", false, yamlConfiguration);
|
||||
T2Cconfig.set("SubAlias.Admin.Command.Commands", Arrays.asList("say subalias hi"), yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("SubAlias.Admin.Message.Enable", false, yamlConfiguration);
|
||||
T2Cconfig.set("SubAlias.Admin.Message.Messages",Arrays.asList(), yamlConfiguration);
|
||||
|
||||
T2Cconfig.set("SubAlias.Console.Enable", false, yamlConfiguration);
|
||||
T2Cconfig.set("SubAlias.Console.Command.Enable", false, yamlConfiguration);
|
||||
T2Cconfig.set("SubAlias.Console.Command.BungeeCommand", false, yamlConfiguration);
|
||||
T2Cconfig.set("SubAlias.Console.Command.Commands",Arrays.asList(), yamlConfiguration);
|
||||
T2Cconfig.set("SubAlias.Console.Message.Enable", false, yamlConfiguration);
|
||||
T2Cconfig.set("SubAlias.Console.Message.Messages",Arrays.asList(), yamlConfiguration);
|
||||
try {
|
||||
yamlConfiguration.save(config);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
T2Csend.console(Util.getPrefix() + " §2Alias/aliasexample.yml were successfully created." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||
}
|
||||
}
|
@ -1,111 +0,0 @@
|
||||
package net.t2code.alias.Spigot.config.subAlias;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.t2code.alias.Spigot.Main;
|
||||
import net.t2code.alias.Spigot.config.alias.AliasConfigConverter;
|
||||
import net.t2code.alias.Spigot.objects.SubAliasObject;
|
||||
import net.t2code.alias.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class SelectSubAlias {
|
||||
private static String Prefix = Util.getPrefix();
|
||||
|
||||
public static void onSelect() {
|
||||
|
||||
Main.subAliasHashMap.clear();
|
||||
Main.allSubAliases.clear();
|
||||
File f = new File(Main.getPath() + "/SubAlias/");
|
||||
File[] fileArray = f.listFiles();
|
||||
for (File config_gui : fileArray) {
|
||||
if (config_gui.getName().equals("X_subAliasDeclaration_X.yml")) continue;
|
||||
String sub = config_gui.getName().substring(config_gui.getName().length() - 4);
|
||||
if (sub.equals(".yml")) {
|
||||
YamlConfiguration yamlConfiguration;
|
||||
try {
|
||||
Preconditions.checkArgument(config_gui != null, "File cannot be null");
|
||||
YamlConfiguration config = new YamlConfiguration();
|
||||
config.load(config_gui);
|
||||
yamlConfiguration = config;
|
||||
} catch (FileNotFoundException var3) {
|
||||
continue;
|
||||
} catch (IOException var4) {
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Cannot load " + config_gui, var4);
|
||||
continue;
|
||||
} catch (InvalidConfigurationException var5) {
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Cannot load " + config_gui, var5);
|
||||
continue;
|
||||
}
|
||||
Boolean aliasEnable = yamlConfiguration.getBoolean("SubAlias.Enable");
|
||||
List<String> subAliasList = yamlConfiguration.getStringList("SubAlias.SubAliasList");
|
||||
String subAliasFor = yamlConfiguration.getString("SubAlias.SubAliasFor");
|
||||
int subAliasArg = 0;
|
||||
if (subAliasFor != null) {
|
||||
String[] imp = subAliasFor.split(" ");
|
||||
if (!Main.allAliases.contains(imp[0])) {
|
||||
T2Csend.error(Main.getPlugin(), "The alias " + imp[0] + " in the file " + config_gui.getName() + " does not exist!");
|
||||
}
|
||||
String[] args = subAliasFor.split(" ");
|
||||
subAliasArg = args.length - 1;
|
||||
}
|
||||
Boolean permNecessary = yamlConfiguration.getBoolean("SubAlias.Permission.Necessary");
|
||||
if (yamlConfiguration.get("SubAlias.Permission.Permission") == null) {
|
||||
AliasConfigConverter.convertAddPermission(yamlConfiguration, config_gui, true);
|
||||
}
|
||||
String permission = yamlConfiguration.getString("SubAlias.Permission.Permission");
|
||||
if (yamlConfiguration.get("SubAlias.Permission.CustomNoPermissionMSG") == null) {
|
||||
AliasConfigConverter.convertAddPermissionMSG(yamlConfiguration, config_gui, true);
|
||||
}
|
||||
String permissionMSG = yamlConfiguration.getString("SubAlias.Permission.CustomNoPermissionMSG");
|
||||
|
||||
Boolean costEnable = yamlConfiguration.getBoolean("SubAlias.Cost.Enable");
|
||||
Double costPrice = yamlConfiguration.getDouble("SubAlias.Cost.Price");
|
||||
Boolean costAllowBypass = yamlConfiguration.getBoolean("SubAlias.Cost.AllowByPass");
|
||||
|
||||
Boolean commandEnable = yamlConfiguration.getBoolean("SubAlias.Command.Enable");
|
||||
Boolean commandAsConsole = yamlConfiguration.getBoolean("SubAlias.Command.CommandAsConsole");
|
||||
Boolean bungeeCommand = yamlConfiguration.getBoolean("SubAlias.Command.BungeeCommand");
|
||||
List<String> command = yamlConfiguration.getStringList("SubAlias.Command.Commands");
|
||||
|
||||
Boolean messageEnable = yamlConfiguration.getBoolean("SubAlias.Message.Enable");
|
||||
List<String> messages = yamlConfiguration.getStringList("SubAlias.Message.Messages");
|
||||
|
||||
Boolean adminEnable = yamlConfiguration.getBoolean("SubAlias.Admin.Enable");
|
||||
String adminPermission = yamlConfiguration.getString("SubAlias.Admin.Permission");
|
||||
|
||||
Boolean adminCommandEnable = yamlConfiguration.getBoolean("SubAlias.Admin.Command.Enable");
|
||||
Boolean adminCommandAsConsole = yamlConfiguration.getBoolean("SubAlias.Admin.Command.CommandAsConsole");
|
||||
Boolean adminBungeeCommand = yamlConfiguration.getBoolean("SubAlias.Admin.Command.BungeeCommand");
|
||||
List<String> adminCommands = yamlConfiguration.getStringList("SubAlias.Admin.Command.Commands");
|
||||
|
||||
Boolean adminMessageEnable = yamlConfiguration.getBoolean("SubAlias.Admin.Message.Enable");
|
||||
List<String> adminMessages = yamlConfiguration.getStringList("SubAlias.Admin.Message.Messages");
|
||||
|
||||
Boolean consoleEnable = yamlConfiguration.getBoolean("SubAlias.Console.Enable");
|
||||
Boolean consoleCommandEnable = yamlConfiguration.getBoolean("SubAlias.Console.Command.Enable");
|
||||
Boolean consoleBungeeCommand = yamlConfiguration.getBoolean("SubAlias.Console.Command.BungeeCommand");
|
||||
List<String> consoleCommands = yamlConfiguration.getStringList("SubAlias.Console.Command.Commands");
|
||||
Boolean consoleMessageEnable = yamlConfiguration.getBoolean("SubAlias.Console.Message.Enable");
|
||||
List<String> consoleMessages = yamlConfiguration.getStringList("SubAlias.Console.Message.Messages");
|
||||
|
||||
SubAliasObject subAlias = new SubAliasObject(aliasEnable, subAliasList, subAliasFor, subAliasArg, permNecessary, permission, permissionMSG, costEnable, costPrice, costAllowBypass, commandEnable, commandAsConsole, bungeeCommand,
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,350 @@
|
||||
// This class was created by JaTiTV.
|
||||
|
||||
package net.t2code.alias.Spigot.config.subAlias;
|
||||
|
||||
import net.t2code.alias.Spigot.Main;
|
||||
import net.t2code.alias.Spigot.config.ConfigFileConverter;
|
||||
import net.t2code.alias.Spigot.config.config.Config;
|
||||
import net.t2code.alias.Spigot.objects.SubAliasObject;
|
||||
import net.t2code.alias.util.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
||||
import net.t2code.t2codelib.SPIGOT.api.yaml.T2C_ConfigWriter;
|
||||
import net.t2code.t2codelib.util.T2C_ConfigItem;
|
||||
import net.t2code.t2codelib.util.T2C_LanguageEnum;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class SubAliasFile {
|
||||
|
||||
public enum VALUES implements T2C_ConfigItem {
|
||||
aliasEnable("subAlias.enable", true, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du den Alias deaktivieren."));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can disable the alias."));
|
||||
}}),
|
||||
subAliasList("subAlias.subAliasList", List.of("subaliasexample1"), true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Gib hier an, wie die SubAlias-Befehle für diese Funktion lauten sollen"));
|
||||
put(T2C_LanguageEnum.english, List.of("Specify here what the SubAlias commands should be for this function"));
|
||||
}}),
|
||||
subAliasFor("subAlias.subAliasFor", "aliasexample1", true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Gib hier den Alias-Befehl ein, dem die Subalias folgen sollen.","Zum Beispiel:"," - aliasexample1 -> aliasexample1 <this SubAlias>"," - aliasexample2 test -> aliasexample2 test <this SubAlias>"));
|
||||
put(T2C_LanguageEnum.english, List.of("Enter here the alias command where the subalias should follow.","For example:"," - aliasexample1 -> aliasexample1 <this SubAlias>"," - aliasexample2 test -> aliasexample2 test <this SubAlias>"));
|
||||
}}),
|
||||
|
||||
permNecessary("subAlias.permission.necessary", true, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du angeben, ob für die Verwendung des Alias eine Erlaubnis erforderlich ist."));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can say if a permission is needed to use the alias."));
|
||||
}}),
|
||||
permission("subAlias.permission.permission", "t2c.alias.sub.use.[alias]", true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du die Berechtigung für den Alias festlegen.", "Der Platzhalter <alias> ist der Alias-Name.", "Wenn du mehrere Alias Commands in der Liste 'subAlias.subAliasList' festgelegt hast, hast du für jeden Alias eine Berechtigung."));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can set the permission for the alias.", "The placeholder <alias> is the alias name.", "If you have set multiple alias referrers in the list 'subAlias.subAliasList' you have a permission for each alias."));
|
||||
}}),
|
||||
permissionMSG("subAlias.permission.customNoPermissionMSG", "", true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du eine benutzerdefinierte Nicht-Erlaubnis-Meldung für diesen Alias festlegen. Wenn du die Standardmeldung verwenden willst, lass dieses Feld einfach leer."));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can set a custom No Permission message for this alias. If you want to use the default message, just leave this blank."));
|
||||
}}),
|
||||
|
||||
cooldownGlobal("subAlias.cooldownInSec.global", 0, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du eine globale Abklingzeit für diesen Alias festlegen.", "Der Wert entspricht den Sekunden.", "Bei 0 ist die Abklingzeit deaktiviert.", "Der Platzhalter [alias] ist der Name des Alias.", "Bypass permission: t2c.alias.cooldown.global.[alias].bypass", "(Die globale Abklingzeit ist höher als die Abklingzeit des Spielers)."));
|
||||
put(T2C_LanguageEnum.english, List.of("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)."));
|
||||
}}),
|
||||
cooldownPlayer("subAlias.cooldownInSec.player", 0, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du eine spielerspezifische Abklingzeit für diesen Alias festlegen.", "Der Wert entspricht den Sekunden.", "Bei 0 ist die Abklingzeit deaktiviert.", "Der Platzhalter [alias] ist der Name des Alias.", "Bypass permission: t2c.alias.cooldown.player.[alias].bypass"));
|
||||
put(T2C_LanguageEnum.english, List.of("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"));
|
||||
}}),
|
||||
|
||||
costEnable("subAlias.cost.enable", false, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du angeben, ob du für den Alias bezahlen musst."));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can say if you have to pay for the alias."));
|
||||
}}),
|
||||
costConfirm("subAlias.cost.confirm", true, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du einstellen, ob du vor dem Ausführen des Befehls bestätigen musst, ob du bezahlen willst", "In der config.yml kannst du unter 'buy.confirm.use' einstellen, ob ein Befehl, ein chatListener oder eine GUI zur Bestätigung des Befehls verwendet werden soll."));
|
||||
put(T2C_LanguageEnum.english, List.of("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."));
|
||||
}}),
|
||||
costPrice("subAlias.cost.price", 0.0, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier legst du den Preis fest."));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you set the price."));
|
||||
}}),
|
||||
costAllowBypass("subAlias.cost.allowByPass", true, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier legst du fest, ob der Bypass aktiviert ist oder ob du trotz des Bypasses zahlen musst (t2c.alias.buy.[alias].bypass)."));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you define if the bypass is activated or if you have to pay despite the bypass (t2c.alias.buy.[alias].bypass)."));
|
||||
}}),
|
||||
|
||||
commandEnable("subAlias.command.enable", false, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du dem Alias mitteilen, dass er einen oder mehrere Befehle ausführen soll"));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can tell the alias to execute one or more commands"));
|
||||
}}),
|
||||
commandAsConsole("subAlias.command.commandAsConsole", false, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du angeben, ob der Befehl über die Konsole des Servers ausgeführt werden soll"));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can specify whether the command should be executed from the console of the server"));
|
||||
}}),
|
||||
bungeeCommand("subAlias.command.proxyCommand", false, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du festlegen, ob der Befehl auf dem Proxy ausgeführt werden soll.", "Damit diese Funktion funktioniert, muss die T2CodeLib auf deinem Proxy vorhanden sein und die API für T2C-OPSecurity muss in seiner Konfiguration aktiviert sein!", "(Wenn sie von der Proxy-Konsole aus ausgeführt werden soll, muss die Option CommandAsConsole ebenfalls aktiviert sein)"));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can define if the command should be executed on the proxy.", "For this function to work, the T2CodeLib must be present on your proxy and the API for T2C-OPSecurity must be activated in its config!", "(If it is to be executed from the proxy console, the CommandAsConsole option must also be enabled)"));
|
||||
}}),
|
||||
command("subAlias.command.commands", List.of(), true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du einen oder mehrere Befehle angeben, die ausgeführt werden sollen.", "Placeholder: [player] = Der Spieler, der den Alias ausführt"));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can specify one or more commands to be executed.", "Placeholder: [player] = The player who executes the alias"));
|
||||
}}),
|
||||
|
||||
messageEnable("subAlias.message.enable", true, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du angeben, ob der Spieler eine Nachricht erhalten soll."));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can specify whether the player should receive a message."));
|
||||
}}),
|
||||
|
||||
messages("subAlias.message.messages", List.of("This is a test subvcommand of T2C-Alias."), true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Gib hier die Nachricht an, die der Spieler erhalten soll.", "Gib hier die Nachricht an, die der Spieler erhalten soll.", "Placeholder: [player] = Der Spieler, der den Alias ausführt", "#", "Du kannst die Minecraft eigenen Farbcodes verwenden: https://minecraft.fandom.com/de/wiki/Formatierungscodes", "Du kannst auch MiniMessage verwenden:", " Wiki: https://docs.adventure.kyori.net/minimessage/format.html", " WebUI: https://webui.adventure.kyori.net"));
|
||||
put(T2C_LanguageEnum.english, List.of("Specify here the message that the player should get.", "Multiple lines can be used and placeholders are supported!", "Placeholder: [player] = The player who executes the alias", "#", "You can use Minecraft custom color codes: https://minecraft.fandom.com/de/wiki/Formatierungscodes", "You can also use MiniMessage:", " Wiki: https://docs.adventure.kyori.net/minimessage/format.html", " WebUI: https://webui.adventure.kyori.net"));
|
||||
}}),
|
||||
|
||||
admin("subAlias.admin", null, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du festlegen, dass Spieler mit der (in der Option subAlias.admin.permission angegebenen) Erlaubnis eine andere Funktion haben als andere Spieler.", "Du kannst z.B. sagen, dass Spieler zu einem bestimmten Punkt kommen sollen und Spieler mit der Admin-Funktion nur auf dem Server zu der Position kommen sollen, wo sie vorher waren.", "Beispiel:", "Spieler: /warp CityBuild", "Spieler mit Admin Permission: /server CityBuild"));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can specify that players with the permission (specified in the subAlias.admin.permission option) 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.", "Example:", "Player: /warp CityBuild", "Player with Admin Perm: /server CityBuild"));
|
||||
}}),
|
||||
adminEnable("subAlias.admin.enable", false, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du die Admin-Funktion aktivieren oder deaktivieren"));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can enable or disable the admin function"));
|
||||
}}),
|
||||
|
||||
adminPermission("subAlias.admin.permission", "t2c.alias.[alias].admin", true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier legst du die Berechtigung für die Admin-Funktion fest","Der Platzhalter [alias] ist der Name des Alias.","Wenn du mehrere Alias-Referrer in der Liste 'subAlias.subAliasList' festgelegt hast, hast du für jeden Alias eine Berechtigung."));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you set the permission for the admin function","The placeholder [alias] is the alias name.","If you have set multiple alias referrers in the list 'subAlias.subAliasList' you have a permission for each alias."));
|
||||
}}),
|
||||
|
||||
adminCommandEnable("subAlias.admin.command.enable", true, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du dem Alias mitteilen, dass er einen oder mehrere Befehle ausführen soll"));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can tell the alias to execute one or more commands"));
|
||||
}}),
|
||||
|
||||
adminCommandAsConsole("subAlias.admin.command.commandAsConsole", true, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du angeben, ob der Befehl über die Konsole des Servers ausgeführt werden soll"));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can specify whether the command should be executed from the console of the server"));
|
||||
}}),
|
||||
|
||||
adminBungeeCommand("subAlias.admin.command.proxyCommand", false, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du festlegen, ob der Befehl auf dem Proxy ausgeführt werden soll.", "Damit diese Funktion funktioniert, muss die T2CodeLib auf deinem Proxy vorhanden sein und die API für T2C-Alias muss in seiner Konfiguration aktiviert sein!", "(Wenn sie von der Proxy-Konsole aus ausgeführt werden soll, muss die Option CommandAsConsole ebenfalls aktiviert sein)."));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can define if the command should be executed on the proxy.", "For this function to work, the T2CodeLib must be present on your proxy and the API for T2C-Alias must be activated in its config!", "(If it is to be executed from the proxy console, the CommandAsConsole option must also be enabled)."));
|
||||
}}),
|
||||
|
||||
adminCommands("subAlias.admin.command.commands", Collections.singletonList("say hi"), true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du einen oder mehrere Befehle angeben, die ausgeführt werden sollen.", "Placeholder: [player] = Symbolleiste anpassen..."));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can specify one or more commands to be executed.", "Placeholder: [player] = The player who executes the alias"));
|
||||
|
||||
}}),
|
||||
|
||||
adminMessageEnable("subAlias.admin.message.enable", false, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du angeben, ob der Spieler eine Nachricht erhalten soll."));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can specify whether the player should receive a message."));
|
||||
}}),
|
||||
|
||||
adminMessages("subAlias.admin.message.messages", List.of(), true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Gib hier die Nachricht an, die der Spieler erhalten soll.", "Es können mehrere Zeilen verwendet werden und Platzhalter werden unterstützt!", "Placeholder: [player] = Der Spieler, der den Alias ausführt", "#", "Du kannst die Minecraft eigenen Farbcodes verwenden:: https://minecraft.fandom.com/de/wiki/Formatierungscodes", "Du kannst auch MiniMessage verwenden:", " Wiki: https://docs.adventure.kyori.net/minimessage/format.html", " WebUI: https://webui.adventure.kyori.net"));
|
||||
put(T2C_LanguageEnum.english, List.of("Specify here the message that the player should get.", "Multiple lines can be used and placeholders are supported!", "Placeholder: [player] = The player who executes the alias", "#", "You can use Minecraft custom color codes: https://minecraft.fandom.com/de/wiki/Formatierungscodes", "You can also use MiniMessage:", " Wiki: https://docs.adventure.kyori.net/minimessage/format.html", " WebUI: https://webui.adventure.kyori.net"));
|
||||
}}),
|
||||
|
||||
consoleEnable("subAlias.console.enable", false, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du festlegen, ob der Alias auch in der Konsole verwendet werden kann und was er dort tun soll."));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can define if the alias is also usable in the console and what it should do from there."));
|
||||
}}),
|
||||
|
||||
consoleCommandEnable("subAlias.console.command.enable", false, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du dem Alias mitteilen, dass er einen oder mehrere Befehle ausführen soll"));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can tell the alias to execute one or more commands"));
|
||||
}}),
|
||||
|
||||
consoleBungeeCommand("subAlias.console.command.proxyCommand", false, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du festlegen, ob der Befehl auf dem Proxy ausgeführt werden soll.", "Damit diese Funktion funktioniert, muss die T2CodeLib auf deinem Proxy vorhanden sein und die API für T2C-Alias muss in seiner Konfiguration aktiviert sein!", "(Wenn sie von der Proxy-Konsole aus ausgeführt werden soll, muss die Option CommandAsConsole ebenfalls aktiviert sein)"));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can define if the command should be executed on the proxy.", "For this function to work, the T2CodeLib must be present on your proxy and the API for T2C-Alias must be activated in its config!", "(If it is to be executed from the proxy console, the CommandAsConsole option must also be enabled)"));
|
||||
}}),
|
||||
|
||||
consoleCommands("subAlias.console.command.commands", List.of(), true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du einen oder mehrere Befehle angeben, die ausgeführt werden sollen."));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can specify one or more commands to be executed."));
|
||||
}}),
|
||||
|
||||
consoleMessageEnable("subAlias.console.message.enable", false, true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Hier kannst du angeben, ob der Spieler eine Nachricht erhalten soll."));
|
||||
put(T2C_LanguageEnum.english, List.of("Here you can specify whether the player should receive a message."));
|
||||
}}),
|
||||
|
||||
consoleMessages("subAlias.console.message.messages", List.of(), true,
|
||||
new HashMap<>() {{
|
||||
put(T2C_LanguageEnum.german, List.of("Gib hier die Nachricht an, die der Spieler erhalten soll."));
|
||||
put(T2C_LanguageEnum.english, List.of("Specify here the message that the player should get."));
|
||||
}}),
|
||||
;
|
||||
|
||||
private final String path;
|
||||
private Object value;
|
||||
private final boolean forceSet;
|
||||
private final HashMap<T2C_LanguageEnum, List<String>> comments;
|
||||
|
||||
VALUES(String path, Object value, boolean forceSet, HashMap<T2C_LanguageEnum, List<String>> comments) {
|
||||
this.path = path;
|
||||
this.value = value;
|
||||
this.forceSet = forceSet;
|
||||
this.comments = comments;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getForceSet() {
|
||||
return forceSet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<T2C_LanguageEnum, List<String>> getComments() {
|
||||
return comments;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLanguagePath() {
|
||||
return Config.VALUES.language.getPath();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(Object newValue) {
|
||||
value = newValue;
|
||||
}
|
||||
}
|
||||
|
||||
public static void set(boolean isReload) {
|
||||
T2C_ConfigWriter.createConfig(Util.getPrefix(), new File(Main.getPath(), "subAlias/subaliasexample.yml"), VALUES.values(), isReload, Util.getConfigLogo());
|
||||
}
|
||||
|
||||
|
||||
public static void select(boolean isReload) {
|
||||
|
||||
ConfigFileConverter.convert();
|
||||
File f = new File(Main.getPath() + "/subAlias/");
|
||||
File[] fileArray = f.listFiles();
|
||||
assert fileArray != null;
|
||||
for (File file : fileArray) {
|
||||
String sub = file.getName().substring(file.getName().length() - 4);
|
||||
if (sub.equals(".yml")) {
|
||||
T2C_ConfigWriter.createConfig(Util.getPrefix(), new File(Main.getPath(), "subAlias/" + file.getName()), VALUES.values(), isReload, Util.getConfigLogo());
|
||||
for (String s : (List<String>) VALUES.subAliasList.value) {
|
||||
if (s != null) {
|
||||
Main.allSubAliases.add(s);
|
||||
}
|
||||
}
|
||||
|
||||
int subAliasArg = 0;
|
||||
if (VALUES.subAliasFor.value != null) {
|
||||
Main.allForSubAliases.add((String) VALUES.subAliasFor.value);
|
||||
String[] imp = ((String) VALUES.subAliasFor.value).split(" ");
|
||||
if (!Main.allAliases.contains(imp[0])) {
|
||||
T2C_Send.error(Main.getInstance(), "The alias " + imp[0] + " in the file " + file.getName() + " does not exist!");
|
||||
}
|
||||
String[] args = ((String) VALUES.subAliasFor.value).split(" ");
|
||||
subAliasArg = args.length - 1;
|
||||
}
|
||||
|
||||
SubAliasObject subAlias = new SubAliasObject(
|
||||
(boolean) VALUES.aliasEnable.value,
|
||||
(List<String>) VALUES.subAliasList.value,
|
||||
(String) VALUES.subAliasFor.value,
|
||||
subAliasArg,
|
||||
(boolean) VALUES.permNecessary.value,
|
||||
(String) VALUES.permission.value,
|
||||
(String) VALUES.permissionMSG.value,
|
||||
(int) VALUES.cooldownGlobal.value,
|
||||
(int) VALUES.cooldownPlayer.value,
|
||||
(boolean) VALUES.costEnable.value,
|
||||
(boolean) VALUES.costConfirm.value,
|
||||
(double) VALUES.costPrice.value,
|
||||
(boolean) VALUES.costAllowBypass.value,
|
||||
(boolean) VALUES.commandEnable.value,
|
||||
(boolean) VALUES.commandAsConsole.value,
|
||||
(boolean) VALUES.bungeeCommand.value,
|
||||
(List<String>) VALUES.command.value,
|
||||
(boolean) VALUES.messageEnable.value,
|
||||
(List<String>) VALUES.messages.value,
|
||||
(boolean) VALUES.adminEnable.value,
|
||||
(String) VALUES.adminPermission.value,
|
||||
(boolean) VALUES.adminCommandEnable.value,
|
||||
(boolean) VALUES.adminCommandAsConsole.value,
|
||||
(boolean) VALUES.adminBungeeCommand.value,
|
||||
(List<String>) VALUES.adminCommands.value,
|
||||
(boolean) VALUES.adminMessageEnable.value,
|
||||
(List<String>) VALUES.adminMessages.value,
|
||||
(boolean) VALUES.consoleEnable.value,
|
||||
(boolean) VALUES.consoleCommandEnable.value,
|
||||
(boolean) VALUES.consoleBungeeCommand.value,
|
||||
(List<String>) VALUES.consoleCommands.value,
|
||||
(boolean) VALUES.consoleMessageEnable.value,
|
||||
(List<String>) VALUES.consoleMessages.value);
|
||||
for (String sal : (List<String>) VALUES.subAliasList.value) {
|
||||
Main.subAliasHashMap.put(sal, subAlias);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,42 @@
|
||||
package net.t2code.alias.Spigot.confirm;
|
||||
|
||||
import net.t2code.alias.Spigot.Main;
|
||||
import net.t2code.alias.Spigot.cmdManagement.ExecuteAlias;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
|
||||
public class ChatConfirm implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onChat(AsyncPlayerChatEvent e) {
|
||||
String[] args = e.getMessage().split(" ");
|
||||
if (args.length == 0) {
|
||||
return;
|
||||
}
|
||||
Player player = e.getPlayer();
|
||||
switch (args[0].toLowerCase()) {
|
||||
case "t2code-alias-confirm":
|
||||
e.setCancelled(true);
|
||||
Bukkit.getScheduler().runTask(Main.getInstance(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ExecuteAlias.storage(player, true);
|
||||
}
|
||||
});
|
||||
|
||||
break;
|
||||
case "t2code-alias-cancel":
|
||||
e.setCancelled(true);
|
||||
Bukkit.getScheduler().runTask(Main.getInstance(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ExecuteAlias.storage(player, false);
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package net.t2code.alias.Spigot.confirm.gui;
|
||||
|
||||
import net.t2code.alias.Spigot.Cache;
|
||||
import net.t2code.alias.Spigot.Main;
|
||||
import net.t2code.alias.Spigot.config.config.Config;
|
||||
import net.t2code.alias.Spigot.config.config.Language;
|
||||
import net.t2code.alias.util.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.items.T2C_ItemBuilder;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Replace;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ConfirmGUI {
|
||||
|
||||
public static void open(Player player, Double price, String alias) {
|
||||
Inventory inventory = Bukkit.createInventory((InventoryHolder) null, 9 * 3, (T2C_Replace.replace(Util.getPrefix(), player,
|
||||
Main.getGuiCode() + Language.VALUES.confirmGuiTitle.getValue().toString().replace("[price]",price+ " "+Config.VALUES.buyCurrency.getValue()).replace("[alias]", alias))));
|
||||
|
||||
T2C_ItemBuilder.fillItem((boolean) Config.VALUES.buyConfirmGuiFillItemEnabled.getValue(), (String) Config.VALUES.buyConfirmGuiFillItem.getValue(), 3, inventory);
|
||||
|
||||
T2C_ItemBuilder.setItem(12, 1, (String) Config.VALUES.buyConfirmGuiConfirm.getValue(), Language.VALUES.confirmGuiConfirm.getValue().toString(),
|
||||
(List<String>) T2C_Replace.replace(Language.VALUES.confirmGuiConfirmLore.getValue(), "[price]", price + " " + Config.VALUES.buyCurrency.getValue()), inventory);
|
||||
T2C_ItemBuilder.setItem(14, 1, (String) Config.VALUES.buyConfirmGuiCancel.getValue(), Language.VALUES.confirmGuiCancel.getValue().toString(),
|
||||
(List<String>) T2C_Replace.replace(Language.VALUES.confirmGuiCancelLore.getValue(), "[price]", price + " " + Config.VALUES.buyCurrency.getValue()), inventory);
|
||||
Cache.openPlayers.add(player.getUniqueId());
|
||||
player.openInventory(inventory);
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package net.t2code.alias.Spigot.confirm.gui;
|
||||
|
||||
import net.t2code.alias.Spigot.Cache;
|
||||
import net.t2code.alias.Spigot.cmdManagement.ExecuteAlias;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
|
||||
public class GuiListener implements Listener {
|
||||
@EventHandler
|
||||
public void onInventoryClick(InventoryClickEvent e) {
|
||||
Player player = (Player) e.getWhoClicked();
|
||||
if (e.getInventory() == null) return;
|
||||
if (e.getCurrentItem() == null) return;
|
||||
|
||||
if (!Cache.openPlayers.contains(player.getUniqueId())) return;
|
||||
e.setCancelled(true);
|
||||
if (e.getClickedInventory() != e.getWhoClicked().getOpenInventory().getTopInventory()) return;
|
||||
switch (e.getSlot()) {
|
||||
case 12:
|
||||
Cache.openPlayers.remove(player.getUniqueId());
|
||||
player.closeInventory();
|
||||
ExecuteAlias.storage(player, true);
|
||||
break;
|
||||
case 14:
|
||||
Cache.openPlayers.remove(player.getUniqueId());
|
||||
player.closeInventory();
|
||||
ExecuteAlias.storage(player, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryCloseEvent(InventoryCloseEvent e) {
|
||||
Player player = (Player) e.getPlayer();
|
||||
Cache.openPlayers.remove(player.getUniqueId());
|
||||
}
|
||||
}
|
10
src/main/java/net/t2code/alias/Spigot/enums/ConfigParam.java
Normal file
10
src/main/java/net/t2code/alias/Spigot/enums/ConfigParam.java
Normal file
@ -0,0 +1,10 @@
|
||||
package net.t2code.alias.Spigot.enums;
|
||||
|
||||
public enum ConfigParam {
|
||||
STRING,
|
||||
INTEGER,
|
||||
LIST,
|
||||
BOOLEAN,
|
||||
CONFIRMENUM,
|
||||
SOUND
|
||||
}
|
7
src/main/java/net/t2code/alias/Spigot/enums/Confirm.java
Normal file
7
src/main/java/net/t2code/alias/Spigot/enums/Confirm.java
Normal file
@ -0,0 +1,7 @@
|
||||
package net.t2code.alias.Spigot.enums;
|
||||
|
||||
public enum Confirm {
|
||||
COMMAND,
|
||||
CHAT,
|
||||
GUI
|
||||
}
|
@ -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;
|
||||
|
||||
@ -10,7 +16,11 @@ public class AliasObject {
|
||||
public String permission;
|
||||
public String permissionMSG;
|
||||
|
||||
public Integer cooldownGlobal;
|
||||
public Integer cooldownPlayer;
|
||||
|
||||
public Boolean costEnable;
|
||||
public Boolean costConfirm;
|
||||
public Double costPrice;
|
||||
public Boolean costAllowBypass;
|
||||
|
||||
@ -43,7 +53,11 @@ public class AliasObject {
|
||||
String permission,
|
||||
String permissionMSG,
|
||||
|
||||
Integer cooldownGlobal,
|
||||
Integer cooldownPlayer,
|
||||
|
||||
Boolean costEnable,
|
||||
Boolean costConfirm,
|
||||
Double costPrice,
|
||||
Boolean costAllowBypass,
|
||||
|
||||
@ -75,7 +89,11 @@ public class AliasObject {
|
||||
this.permission = permission;
|
||||
this.permissionMSG = permissionMSG;
|
||||
|
||||
this.cooldownGlobal = cooldownGlobal;
|
||||
this.cooldownPlayer = cooldownPlayer;
|
||||
|
||||
this.costEnable = costEnable;
|
||||
this.costConfirm = costConfirm;
|
||||
this.costPrice = costPrice;
|
||||
this.costAllowBypass = costAllowBypass;
|
||||
|
||||
|
@ -0,0 +1,15 @@
|
||||
package net.t2code.alias.Spigot.objects;
|
||||
|
||||
public class AliasStorageObject {
|
||||
public Object aliasObject;
|
||||
public String alias;
|
||||
public String[] args;
|
||||
public boolean sub;
|
||||
|
||||
public AliasStorageObject( Object aliasObject, String alias, String[] args, boolean sub) {
|
||||
this.aliasObject = aliasObject;
|
||||
this.alias = alias;
|
||||
this.args = args;
|
||||
this.sub=sub;
|
||||
}
|
||||
}
|
15
src/main/java/net/t2code/alias/Spigot/objects/Cooldown.java
Normal file
15
src/main/java/net/t2code/alias/Spigot/objects/Cooldown.java
Normal 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_;
|
||||
}
|
||||
}
|
@ -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;
|
||||
@ -12,7 +17,11 @@ public class SubAliasObject {
|
||||
public String permission;
|
||||
public String permissionMSG;
|
||||
|
||||
public Integer cooldownGlobal;
|
||||
public Integer cooldownPlayer;
|
||||
|
||||
public Boolean costEnable;
|
||||
public Boolean costConfirm;
|
||||
public Double costPrice;
|
||||
public Boolean costAllowBypass;
|
||||
|
||||
@ -47,7 +56,11 @@ public class SubAliasObject {
|
||||
String permission,
|
||||
String permissionMSG,
|
||||
|
||||
Integer cooldownGlobal,
|
||||
Integer cooldownPlayer,
|
||||
|
||||
Boolean costEnable,
|
||||
Boolean costConfirm,
|
||||
Double costPrice,
|
||||
Boolean costAllowBypass,
|
||||
|
||||
@ -81,7 +94,11 @@ public class SubAliasObject {
|
||||
this.permission = permission;
|
||||
this.permissionMSG = permissionMSG;
|
||||
|
||||
this.cooldownGlobal = cooldownGlobal;
|
||||
this.cooldownPlayer = cooldownPlayer;
|
||||
|
||||
this.costEnable = costEnable;
|
||||
this.costConfirm = costConfirm;
|
||||
this.costPrice = costPrice;
|
||||
this.costAllowBypass = costAllowBypass;
|
||||
|
||||
|
@ -0,0 +1,68 @@
|
||||
package net.t2code.alias.Spigot.register;
|
||||
|
||||
import net.t2code.alias.Spigot.Main;
|
||||
import net.t2code.alias.Spigot.cmdManagement.RegisterCommands;
|
||||
import net.t2code.alias.util.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send;
|
||||
import org.bukkit.command.CommandMap;
|
||||
import org.bukkit.plugin.SimplePluginManager;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
public class AliasRegister {
|
||||
private Main main;
|
||||
|
||||
public AliasRegister(Main main, boolean isReload) {
|
||||
this.main = main;
|
||||
loadAliasCommands(isReload);
|
||||
}
|
||||
|
||||
private void loadAliasCommands(boolean isReload) {
|
||||
CommandMap commandMap = getCommandMap();
|
||||
unregister(commandMap);
|
||||
if (commandMap == null) {
|
||||
main.getLogger().severe("CommandMap konnte nicht geladen werden!");
|
||||
return;
|
||||
}
|
||||
|
||||
for (String alias : Main.allAliases) {
|
||||
if (Main.aliasHashMap.get(alias).aliasEnable) {
|
||||
|
||||
// Registrieren des Befehls
|
||||
commandMap.register(main.getDescription().getName(), new RegisterCommands(alias));
|
||||
T2C_Send.sendStartTextCenter(Util.getPrefix(), "§aAlias §e" + alias + " §aregister", isReload);
|
||||
|
||||
Main.loadAliasHashMap.put(alias, true);
|
||||
} else Main.loadAliasHashMap.put(alias, false);
|
||||
}
|
||||
}
|
||||
|
||||
private CommandMap getCommandMap() {
|
||||
if (main.getServer().getPluginManager() instanceof SimplePluginManager) {
|
||||
SimplePluginManager manager = (SimplePluginManager) main.getServer().getPluginManager();
|
||||
try {
|
||||
Field field = SimplePluginManager.class.getDeclaredField("commandMap");
|
||||
field.setAccessible(true);
|
||||
return (CommandMap) field.get(manager);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private void unregister(CommandMap commandMap) {
|
||||
if (commandMap == null) return;
|
||||
for (Map.Entry<String, Boolean> entry : Main.loadAliasHashMap.entrySet()) {
|
||||
if (entry.getValue()) {
|
||||
Objects.requireNonNull(commandMap.getCommand(entry.getKey())).unregister(commandMap);
|
||||
}
|
||||
}
|
||||
Main.loadAliasHashMap.clear();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package net.t2code.alias.Spigot.register;
|
||||
|
||||
import net.t2code.alias.Spigot.Main;
|
||||
import net.t2code.alias.Spigot.objects.AliasObject;
|
||||
import net.t2code.alias.Spigot.objects.SubAliasObject;
|
||||
import net.t2code.t2codelib.SPIGOT.api.register.T2C_Register;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
public class AliasRegisterPermissions {
|
||||
|
||||
public static void onPermRegister() {
|
||||
|
||||
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) {
|
||||
T2C_Register.permission(aliasObject.permission.replace("[alias]", alias).toLowerCase(), Main.getInstance());
|
||||
}
|
||||
if (aliasObject.adminPermission != null && Bukkit.getPluginManager().getPermission(aliasObject.adminPermission.replace("[alias]", alias).toLowerCase()) == null) {
|
||||
T2C_Register.permission(aliasObject.adminPermission.replace("[alias]", alias).toLowerCase(), Main.getInstance());
|
||||
}
|
||||
if (Bukkit.getPluginManager().getPermission("t2c.alias.buy." + alias.toLowerCase() + ".bypass") == null) {
|
||||
T2C_Register.permission("t2c.alias.buy." + alias.toLowerCase() + ".bypass", PermissionDefault.OP, Main.getInstance());
|
||||
}
|
||||
if (Bukkit.getPluginManager().getPermission("t2c.alias.cooldown.global." + alias.toLowerCase() + ".bypass") == null) {
|
||||
T2C_Register.permission("t2c.alias.cooldown.global." + alias.toLowerCase() + ".bypass", PermissionDefault.OP, Main.getInstance());
|
||||
}
|
||||
if (Bukkit.getPluginManager().getPermission("t2c.alias.cooldown.player." + alias.toLowerCase() + ".bypass") == null) {
|
||||
T2C_Register.permission("t2c.alias.cooldown.player." + alias.toLowerCase() + ".bypass", PermissionDefault.OP, Main.getInstance());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
T2C_Register.permission(subAliasObject.permission.replace("[alias]", alias).toLowerCase(), Main.getInstance());
|
||||
}
|
||||
if (subAliasObject.adminPermission != null && Bukkit.getPluginManager().getPermission(subAliasObject.adminPermission.replace("[alias]", alias).toLowerCase()) == null) {
|
||||
T2C_Register.permission(subAliasObject.adminPermission.replace("[alias]", alias).toLowerCase(), Main.getInstance());
|
||||
}
|
||||
if (Bukkit.getPluginManager().getPermission("t2c.alias.sub.buy." + alias.toLowerCase() + ".bypass") == null) {
|
||||
T2C_Register.permission("t2c.alias.sub.buy." + alias.toLowerCase() + ".bypass", PermissionDefault.OP, Main.getInstance());
|
||||
}
|
||||
if (Bukkit.getPluginManager().getPermission("t2c.alias.sub.cooldown.global." + alias.toLowerCase() + ".bypass") == null) {
|
||||
T2C_Register.permission("t2c.alias.sub.cooldown.global." + alias.toLowerCase() + ".bypass", PermissionDefault.OP, Main.getInstance());
|
||||
}
|
||||
if (Bukkit.getPluginManager().getPermission("t2c.alias.sub.cooldown.player." + alias.toLowerCase() + ".bypass") == null) {
|
||||
T2C_Register.permission("t2c.alias.sub.cooldown.player." + alias.toLowerCase() + ".bypass", PermissionDefault.OP, Main.getInstance());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,90 +0,0 @@
|
||||
package net.t2code.alias.Spigot.system;
|
||||
|
||||
import net.t2code.alias.Spigot.Main;
|
||||
import net.t2code.alias.Spigot.cmdManagement.RegisterCommands;
|
||||
import net.t2code.alias.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandMap;
|
||||
import org.bukkit.command.SimpleCommandMap;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.SimplePluginManager;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
public class AliasRegister {
|
||||
public static void onRegister() {
|
||||
try {
|
||||
final Field bukkitCommandMap = Bukkit.getServer().getClass().getDeclaredField("commandMap");
|
||||
bukkitCommandMap.setAccessible(true);
|
||||
CommandMap commandMap = (CommandMap) bukkitCommandMap.get(Bukkit.getServer());
|
||||
// onUnRegister(bukkitCommandMap);
|
||||
for (String alias : Main.allAliases) {
|
||||
register(alias, commandMap);
|
||||
// wrap(alias, commandMap);
|
||||
}
|
||||
|
||||
|
||||
if (!(T2CmcVersion.isMc1_8() || T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12())) {
|
||||
Main.getPlugin().getBukkitCommandWrap().sync();
|
||||
if (Bukkit.getOnlinePlayers().size() >= 1)
|
||||
for (Player player : Bukkit.getOnlinePlayers()) player.updateCommands();
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
//public static void onUnRegister(Field bukkitCommandMap) throws IllegalAccessException {
|
||||
//
|
||||
// // if (Main.allAliases != null && !Main.allAliases.isEmpty()) {
|
||||
// // if (!(Main.getPlugin().getBukkitCommandWrap() instanceof BukkitCommandWrap_Useless)) {
|
||||
// // for (String alias : Main.allAliases) {
|
||||
// // T2Csend.debugmsg(Main.getPlugin(),"uload: " + alias);
|
||||
// // Main.getPlugin().
|
||||
// // Main.getPlugin().getBukkitCommandWrap().unwrap(alias);
|
||||
// // }
|
||||
// // Main.getPlugin().getBukkitCommandWrap().sync();
|
||||
// // if (Bukkit.getOnlinePlayers().size() >= 1)
|
||||
// // for (Player player : Bukkit.getOnlinePlayers()) player.updateCommands();
|
||||
// // }
|
||||
// // }
|
||||
// // commandMap.clearCommands();
|
||||
//
|
||||
//
|
||||
// for (Map.Entry<String, Boolean> entry : Main.loadAliasHashMap.entrySet()) {
|
||||
// ((SimpleCommandMap) bukkitCommandMap.get(simplePluginManager)).getCommand(entry.getKey()).unregister(bukkitCommandMap.get(Bukkit.getServer()));
|
||||
//
|
||||
//
|
||||
// if (entry.getValue())
|
||||
// Main.getPlugin().getBukkitCommandWrap().unwrap(entry.getKey());
|
||||
// }
|
||||
//
|
||||
// Main.getPlugin().getBukkitCommandWrap().sync();
|
||||
// if (Bukkit.getOnlinePlayers().size() >= 1)
|
||||
// for (Player player : Bukkit.getOnlinePlayers()) player.updateCommands();
|
||||
// Main.loadAliasHashMap.clear();
|
||||
//
|
||||
//}
|
||||
|
||||
private static void register(String alias, CommandMap commandMap) {
|
||||
if (Main.aliasHashMap.get(alias) != null) {
|
||||
if (alias.equals(" ")) return;
|
||||
if (Main.aliasHashMap.get(alias).aliasEnable) {
|
||||
commandMap.register(alias, new RegisterCommands(alias));
|
||||
T2Csend.console(Util.getPrefix() + " §aAlias §e" + alias + " §aregister");
|
||||
Main.loadAliasHashMap.put(alias, true);
|
||||
} else Main.loadAliasHashMap.put(alias, false);
|
||||
} else T2Csend.warning(Main.getPlugin(), " §4AliasHashmap is null! - " + alias);
|
||||
}
|
||||
|
||||
private static void wrap(String alias, CommandMap commandMap) {
|
||||
Command cmd = commandMap.getCommand(alias);
|
||||
Main.getPlugin().getBukkitCommandWrap().wrap(cmd, alias);
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
package net.t2code.alias.Spigot.system;
|
||||
|
||||
import net.t2code.alias.Spigot.Main;
|
||||
import net.t2code.t2codelib.SPIGOT.api.register.T2Cregister;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
public class AliasRegisterPermissions {
|
||||
|
||||
public static void onPermRegister() {
|
||||
for (String alias : Main.allAliases){
|
||||
if (Bukkit.getPluginManager().getPermission("t2code.alias.use." + alias.toLowerCase()) == null) {
|
||||
T2Cregister.permission("t2code.alias.use." + alias.toLowerCase(), Main.getPlugin());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,42 +1,13 @@
|
||||
package net.t2code.alias.Spigot.system;
|
||||
|
||||
import net.t2code.alias.Spigot.Main;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import net.t2code.t2codelib.SPIGOT.system.T2C_ProxyCommandSenderReceiver;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class BCommandSenderReciver {
|
||||
|
||||
public static void sendToBungee(CommandSender sender, String information, Boolean console) {
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
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;
|
||||
}
|
||||
}
|
||||
T2C_ProxyCommandSenderReceiver.sendToBungee(sender,information,console);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
@ -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) {
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
// This claas was created by JaTiTV
|
||||
|
||||
package net.t2code.alias.Spigot.system;
|
||||
|
||||
import net.t2code.alias.Spigot.Main;
|
||||
import net.t2code.alias.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
|
||||
public class JoinEvent implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onJoinEvent(PlayerLoginEvent event) {
|
||||
T2CupdateAPI.join(Main.getPlugin(),Util.getPrefix(), "t2code.alias.updatemsg", event.getPlayer(), Util.getSpigotID(), Util.getDiscord());
|
||||
}
|
||||
}
|
@ -3,75 +3,71 @@ package net.t2code.alias.Spigot.system;
|
||||
import net.t2code.alias.Spigot.Main;
|
||||
import net.t2code.alias.Spigot.cmdManagement.AliasCmdExecuter;
|
||||
import net.t2code.alias.Spigot.cmdManagement.TabEvent;
|
||||
import net.t2code.alias.Spigot.config.alias.CreateExampleAliasConfig;
|
||||
import net.t2code.alias.Spigot.config.alias.SelectAlias;
|
||||
import net.t2code.alias.Spigot.config.config.*;
|
||||
import net.t2code.alias.Spigot.config.languages.LanguagesCreate;
|
||||
import net.t2code.alias.Spigot.config.languages.SelectMessages;
|
||||
import net.t2code.alias.Spigot.config.subAlias.CreateExampleSubAliasConfig;
|
||||
import net.t2code.alias.Spigot.config.subAlias.SelectSubAlias;
|
||||
import net.t2code.alias.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
||||
import net.t2code.t2codelib.SPIGOT.api.register.T2Cregister;
|
||||
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
|
||||
import net.t2code.alias.Spigot.config.alias.AliasFile;
|
||||
import net.t2code.alias.Spigot.config.config.Config;
|
||||
import net.t2code.alias.Spigot.config.config.Language;
|
||||
import net.t2code.alias.Spigot.config.subAlias.SubAliasFile;
|
||||
import net.t2code.alias.Spigot.confirm.ChatConfirm;
|
||||
import net.t2code.alias.Spigot.confirm.gui.GuiListener;
|
||||
import net.t2code.alias.Spigot.enums.Confirm;
|
||||
import net.t2code.alias.Spigot.register.AliasRegisterPermissions;
|
||||
import net.t2code.alias.util.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Template;
|
||||
import net.t2code.t2codelib.SPIGOT.api.register.T2C_Register;
|
||||
import net.t2code.t2codelib.SPIGOT.api.update.T2C_UpdateAPI;
|
||||
import net.t2code.t2codelib.SPIGOT.system.config.config.T2C_LibConfig;
|
||||
import net.t2code.t2codelib.util.T2C_Util;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
public class Load {
|
||||
private static final Main plugin = Main.getPlugin();
|
||||
private static final Main plugin = Main.getInstance();
|
||||
|
||||
public static void onLoad(String prefix, List<String> autor, String version, String spigot, String discord, int bstatsID) {
|
||||
Long long_ = T2Ctemplate.onLoadHeader(prefix, autor, version, spigot, discord);
|
||||
plugin.getCommand("t2code-alias").setExecutor(new AliasCmdExecuter());
|
||||
loadReload();
|
||||
T2CupdateAPI.onUpdateCheck(plugin,prefix,Util.getGit(),Util.getSpigotID(),Util.getDiscord(),
|
||||
SelectConfig.getUpdateCheckOnJoin(),SelectConfig.getUpdateCheckSeePreReleaseUpdates(),SelectConfig.getUpdateCheckTimeInterval());
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new JoinEvent(), plugin);
|
||||
|
||||
T2Ctemplate.onLoadFooter(prefix, long_, version);
|
||||
Metrics.Bstats(plugin, bstatsID);
|
||||
public Load(Main main, String prefix, List<String> autor, String version, String spigot, String discord, int bstatsID) {
|
||||
onLoad(main, prefix, autor, version, spigot, discord, bstatsID);
|
||||
}
|
||||
|
||||
public static void loadReload() {
|
||||
if (!new File(Main.getPath(), "config.yml").exists()) {
|
||||
try {
|
||||
CreateExampleAliasConfig.configCreate();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
CreateExampleSubAliasConfig.configCreate();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
try {
|
||||
plugin.saveResource("Alias/X_aliasDeclaration_X.yml", true);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
plugin.saveResource("SubAlias/X_subAliasDeclaration_X.yml", true);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
CreateConfig.configCreate();
|
||||
LanguagesCreate.langCreate();
|
||||
SelectConfig.onSelect();
|
||||
SelectMessages.onSelect(Util.getPrefix());
|
||||
T2Ctemplate.onLoadSeparateStroke(Util.getPrefix());
|
||||
SelectAlias.onSelect();
|
||||
T2Ctemplate.onLoadSeparateStroke(Util.getPrefix());
|
||||
SelectSubAlias.onSelect();
|
||||
SelectConfig.setConfigVersion();
|
||||
if (SelectConfig.getSubAliasTab()) {
|
||||
T2Cregister.listener(new TabEvent(), plugin);
|
||||
}
|
||||
private void onLoad(Main main, String prefix, List<String> autor, String version, String spigot, String discord, int bstatsID) {
|
||||
Long long_ = T2C_Template.onLoadHeader(prefix, autor, version, spigot, discord);
|
||||
plugin.getCommand("t2code-alias").setExecutor(new AliasCmdExecuter());
|
||||
loadReload(main, false);
|
||||
T2C_UpdateAPI.onUpdateCheck(plugin, prefix, Util.getGit(), Util.getSpigotID(), Util.getDiscord(),
|
||||
(Boolean) Config.VALUES.updateCheckOnJoin.getValue(), (Boolean) Config.VALUES.updateCheckSeePreReleaseUpdates.getValue(), (Integer) Config.VALUES.updateCheckTimeInterval.getValue());
|
||||
|
||||
if (SelectConfig.getBungee()) {
|
||||
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "t2c:bcmd");
|
||||
T2C_Register.listener(new PluginEvents(), plugin);
|
||||
Metrics.Bstats(plugin, bstatsID);
|
||||
T2C_Template.onLoadFooter(prefix, long_);
|
||||
}
|
||||
|
||||
private static ChatConfirm chatListener;
|
||||
private static GuiListener guiListener;
|
||||
|
||||
public static void loadReload(Main main, boolean isReload) {
|
||||
HandlerList.unregisterAll(chatListener);
|
||||
HandlerList.unregisterAll(guiListener);
|
||||
boolean newInstall = !new File(Main.getPath(), "config.yml").exists();
|
||||
Config.set(isReload);
|
||||
Language.set(false);
|
||||
T2C_Template.onLoadSeparateStroke(Util.getPrefix());
|
||||
if (newInstall) {
|
||||
SubAliasFile.set(false);
|
||||
}
|
||||
AliasFile.set(false);
|
||||
SubAliasFile.select(false);
|
||||
|
||||
|
||||
if ((Boolean) Config.VALUES.subAliasTab.getValue()) {
|
||||
T2C_Register.listener(new TabEvent(), plugin);
|
||||
}
|
||||
chatListener = new ChatConfirm();
|
||||
if (Config.VALUES.buyConfirmDefault.getValue() == Confirm.CHAT) T2C_Register.listener(chatListener, plugin);
|
||||
guiListener = new GuiListener();
|
||||
if (Config.VALUES.buyConfirmDefault.getValue() == Confirm.GUI) T2C_Register.listener(guiListener, plugin);
|
||||
if ((boolean) T2C_LibConfig.VALUES.proxy.getValue()) {
|
||||
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, T2C_Util.getPluginChannel_ProxyCommand());
|
||||
}
|
||||
AliasRegisterPermissions.onPermRegister();
|
||||
}
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
|
||||
package net.t2code.alias.Spigot.system;
|
||||
|
||||
import net.t2code.alias.Spigot.config.config.SelectConfig;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -0,0 +1,25 @@
|
||||
package net.t2code.alias.Spigot.system;
|
||||
|
||||
import net.t2code.alias.Spigot.Cache;
|
||||
import net.t2code.alias.Spigot.Main;
|
||||
import net.t2code.alias.util.Util;
|
||||
import net.t2code.t2codelib.SPIGOT.api.update.T2C_UpdateAPI;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
public class PluginEvents implements Listener {
|
||||
@EventHandler
|
||||
public void onJoinEvent(PlayerQuitEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
Cache.aliasStorage.remove(player.getUniqueId());
|
||||
Cache.openPlayers.remove(player.getUniqueId());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onJoinEvent(PlayerLoginEvent event) {
|
||||
T2C_UpdateAPI.join(Main.getInstance(), Util.getPrefix(), "t2c.alias.updatemsg", event.getPlayer(), Util.getSpigotID(), Util.getDiscord());
|
||||
}
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
package net.t2code.alias;
|
||||
|
||||
public class Util {
|
||||
|
||||
|
||||
public static String getInfoText() {
|
||||
return "";
|
||||
}
|
||||
|
||||
public static String getRequiredT2CodeLibVersion() {
|
||||
return "13.4";
|
||||
}
|
||||
|
||||
public static String getPrefix() {
|
||||
return prefix;
|
||||
}
|
||||
|
||||
public static Integer getSpigotID() {
|
||||
return 96389;
|
||||
}
|
||||
|
||||
public static String getGit() {
|
||||
return "JaTiTV/T2Code-Alias";
|
||||
}
|
||||
|
||||
public static Integer getBstatsID() {
|
||||
return 12517;
|
||||
}
|
||||
|
||||
public static String getSpigot() {
|
||||
return "https://www.spigotmc.org/resources/" + getSpigotID();
|
||||
}
|
||||
|
||||
public static String getDiscord() {
|
||||
return "http://dc.t2code.net";
|
||||
}
|
||||
|
||||
public static void setPrefix(String pr) {
|
||||
prefix = pr;
|
||||
}
|
||||
|
||||
private static String prefix = "§8[§4T2Code§7-§aAlias§8]";
|
||||
}
|
42
src/main/java/net/t2code/alias/util/Util.java
Normal file
42
src/main/java/net/t2code/alias/util/Util.java
Normal file
@ -0,0 +1,42 @@
|
||||
package net.t2code.alias.util;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.t2code.t2codelib.util.T2C_Util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class Util {
|
||||
|
||||
@Getter
|
||||
private static final String infoText = "";
|
||||
|
||||
@Getter
|
||||
private static final String requiredT2CodeLibVersion = "16.7";
|
||||
|
||||
@Getter
|
||||
private static final Integer spigotID = 96389;
|
||||
|
||||
@Getter
|
||||
private static final String git = "JaTiTV/T2Code-Alias";
|
||||
|
||||
@Getter
|
||||
private static final Integer bstatsID = 12517;
|
||||
|
||||
@Getter
|
||||
private static final String spigot = "https://spigotmc.org/resources/" + spigotID;
|
||||
|
||||
@Getter
|
||||
private static final String discord = "http://dc.t2code.net";
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private static String prefix = "§8[§4T2Code§7-§aAlias§8]";
|
||||
|
||||
public static String[] getConfigLogo() {
|
||||
ArrayList<String> arrayList = new ArrayList<>(T2C_Util.getConfigT2CodeLogo());
|
||||
arrayList.addAll(Arrays.asList("", "# Spigot: " + spigot));
|
||||
return arrayList.toArray(new String[0]);
|
||||
}
|
||||
}
|
@ -1,8 +1,7 @@
|
||||
####################################################################
|
||||
## The alias command is no longer the filename! ##
|
||||
## Multiple alias commands can now be specified in one file, ##
|
||||
## so there is no need to create multiple files! ##
|
||||
## This option is under 'Alias.AliasList' ##
|
||||
## This is an example file and serves only for the explanation ##
|
||||
## of the individual options. ##
|
||||
## Changes in this file are not considered and will be reset! ##
|
||||
####################################################################
|
||||
|
||||
Alias:
|
||||
@ -12,22 +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
|
||||
@ -39,7 +59,8 @@ Alias:
|
||||
BungeeCommand: false
|
||||
# Here you can specify one or more commands to be executed.
|
||||
# Placeholder: [player] = The player who executes the alias
|
||||
Commands: [ ]
|
||||
Commands: []
|
||||
|
||||
Message:
|
||||
# Here you can specify whether the player should receive a message.
|
||||
Enable: false
|
||||
@ -65,7 +86,7 @@ Alias:
|
||||
# You can also use MiniMessage:
|
||||
# Wiki: https://docs.adventure.kyori.net/minimessage/format.html
|
||||
# WebUI: https://webui.adventure.kyori.net
|
||||
Messages: [ ]
|
||||
Messages: []
|
||||
|
||||
# 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.
|
||||
@ -76,7 +97,9 @@ Alias:
|
||||
# Here you can enable or disable the admin function
|
||||
Enable: false
|
||||
# Here you set the permission for the admin function
|
||||
Permission: t2code.alias.admin
|
||||
# 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: t2c.alias.[alias].admin
|
||||
Command:
|
||||
# Here you can tell the alias to execute one or more commands
|
||||
Enable: false
|
||||
@ -88,7 +111,8 @@ Alias:
|
||||
BungeeCommand: false
|
||||
# Here you can specify one or more commands to be executed.
|
||||
# Placeholder: [player] = The player who executes the alias
|
||||
Commands: [ ]
|
||||
Commands: []
|
||||
|
||||
Message:
|
||||
# Here you can specify whether the player should receive a message.
|
||||
Enable: false
|
||||
@ -114,7 +138,7 @@ Alias:
|
||||
# You can also use MiniMessage:
|
||||
# Wiki: https://docs.adventure.kyori.net/minimessage/format.html
|
||||
# WebUI: https://webui.adventure.kyori.net
|
||||
Messages: [ ]
|
||||
Messages: []
|
||||
|
||||
Console:
|
||||
# Here you can define if the alias is also usable in the console and what it should do from there.
|
||||
@ -126,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.
|
||||
BungeeCommand: false
|
||||
# Here you can specify one or more commands to be executed.
|
||||
Commands: [ ]
|
||||
Commands: []
|
||||
Message:
|
||||
# Here you can specify whether the player should receive a message.
|
||||
Enable: false
|
||||
# Specify here the message that the player should get.
|
||||
Messages: [ ]
|
||||
Messages: []
|
@ -1,4 +1,8 @@
|
||||
#
|
||||
####################################################################
|
||||
## This is an example file and serves only for the explanation ##
|
||||
## of the individual options. ##
|
||||
## Changes in this file are not considered and will be reset! ##
|
||||
####################################################################
|
||||
|
||||
SubAlias:
|
||||
# Here you can disable the alias
|
||||
@ -15,18 +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.
|
||||
# If you have set multiple alias referrers in the list 'Alias.AliasList' you have a permission for each alias.
|
||||
Permission: 't2code.alias.use.subalias.<alias>'
|
||||
# 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: '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
|
||||
@ -39,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
|
||||
@ -75,7 +100,9 @@ SubAlias:
|
||||
# Here you can enable or disable the admin function
|
||||
Enable: false
|
||||
# Here you set the permission for the admin function
|
||||
Permission: t2code.alias.admin
|
||||
# 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: t2c.alias.sub.[alias].admin
|
||||
Command:
|
||||
# Here you can tell the alias to execute one or more commands
|
||||
Enable: false
|
||||
@ -88,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
|
||||
|
44
src/main/resources/X_configDeclaration_X.yml
Normal file
44
src/main/resources/X_configDeclaration_X.yml
Normal file
@ -0,0 +1,44 @@
|
||||
####################################################################
|
||||
## This is an example file and serves only for the explanation ##
|
||||
## of the individual options. ##
|
||||
## Changes in this file are not considered and will be reset! ##
|
||||
####################################################################
|
||||
|
||||
# This option is only used for updates and file conversions.
|
||||
configVersion: 4
|
||||
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 '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
|
||||
# In this option you can set the time interval in minutes in which updates should be checked.
|
||||
timeInterval: 60
|
||||
buy:
|
||||
# With this option you can set whether a confirmation should be sent after the payment for an alias for which you have to pay.
|
||||
message: true
|
||||
# With this option you set the currency.
|
||||
currency: $
|
||||
confirm:
|
||||
# Here you can choose which confirmation method you want to use. (COMMAND, CHAT, GUI)
|
||||
use: COMMAND
|
||||
gui:
|
||||
#
|
||||
# !! You can change the GUI name and the button texts in the language file !!
|
||||
#
|
||||
fillItem:
|
||||
# Here you can set if a fillitem should be used in the Confirm GUI.
|
||||
enabled: true
|
||||
# Here you can set which fillitem should be used in the Confirm GUI
|
||||
material: BLACK_STAINED_GLASS_PANE
|
||||
confirm:
|
||||
# Here you can set the material for the confirmation button.
|
||||
material: GREEN_WOOL
|
||||
cancel:
|
||||
# Here you can set the material for the cancel button.
|
||||
material: RED_WOOL
|
||||
subAlias:
|
||||
# Here you can set if subcommands should be displayed as tabComplete
|
||||
tabComplete: true
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user