1.0.8 #2

Closed
JaTiTV wants to merge 1 commits from add-placeholder-for-msg into development
20 changed files with 397 additions and 474 deletions
Showing only changes of commit 7a1fb49aff - Show all commits

View File

@ -6,7 +6,7 @@
<groupId>net.t2code</groupId> <groupId>net.t2code</groupId>
<artifactId>Alias</artifactId> <artifactId>Alias</artifactId>
<version>1.0.7</version> <version>1.0.8</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>T2C-Alias</name> <name>T2C-Alias</name>
@ -69,7 +69,7 @@
<dependency> <dependency>
<groupId>net.t2code</groupId> <groupId>net.t2code</groupId>
<artifactId>T2CodeLib</artifactId> <artifactId>T2CodeLib</artifactId>
<version>11.0</version> <version>11.6</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.t2code</groupId> <groupId>net.t2code</groupId>

View File

@ -1,6 +1,6 @@
package net.t2code.alias.Spigot; package net.t2code.alias.Spigot;
import net.t2code.alias.Spigot.objects.Alias_Objekt; import net.t2code.alias.Spigot.objects.AliasObjekt;
import net.t2code.alias.Spigot.system.Load; import net.t2code.alias.Spigot.system.Load;
import net.t2code.alias.Util; import net.t2code.alias.Util;
import net.t2code.lib.Spigot.Lib.messages.T2CodeTemplate; import net.t2code.lib.Spigot.Lib.messages.T2CodeTemplate;
@ -24,7 +24,7 @@ public final class Main extends JavaPlugin {
public static Main plugin; public static Main plugin;
public static HashMap<String, Alias_Objekt> aliasHashMap = new HashMap<>(); public static HashMap<String, AliasObjekt> aliasHashMap = new HashMap<>();
public static ArrayList<String> allAliases = new ArrayList<>(); public static ArrayList<String> allAliases = new ArrayList<>();
@Override @Override

View File

@ -1,6 +1,5 @@
package net.t2code.alias.Spigot.cmdManagement; 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.languages.SelectMessages;
import net.t2code.lib.Spigot.Lib.messages.send; import net.t2code.lib.Spigot.Lib.messages.send;
import org.bukkit.command.Command; import org.bukkit.command.Command;
@ -13,7 +12,7 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
public class Alias_CmdExecuter implements CommandExecutor, TabCompleter { public class AliasCmdExecuter implements CommandExecutor, TabCompleter {
String Prefix; String Prefix;
@ -24,7 +23,7 @@ public class Alias_CmdExecuter implements CommandExecutor, TabCompleter {
// Command // Command
if (sender.hasPermission("t2code.alias.command.info")) { if (sender.hasPermission("t2code.alias.command.info")) {
Commands.info(sender); Commands.info(sender);
} else send.sender(sender, SelectMessages.NoPermissionForCommand.replace("[cmd]", "/t2code-alias info") } else send.sender(sender, SelectMessages.noPermissionForCommand.replace("[cmd]", "/t2code-alias info")
.replace("[perm]", "t2code.alias.command.info")); .replace("[perm]", "t2code.alias.command.info"));
} else { } else {
switch (args[0].toLowerCase()) { switch (args[0].toLowerCase()) {
@ -32,7 +31,7 @@ public class Alias_CmdExecuter implements CommandExecutor, TabCompleter {
case "rl": case "rl":
if (sender.hasPermission("t2code.alias.command.reload") || sender.isOp()) { if (sender.hasPermission("t2code.alias.command.reload") || sender.isOp()) {
Commands.reload(sender); Commands.reload(sender);
} else send.sender(sender, SelectMessages.NoPermissionForCommand.replace("[cmd]", "/t2code-alias reload") } else send.sender(sender, SelectMessages.noPermissionForCommand.replace("[cmd]", "/t2code-alias reload")
.replace("[perm]", "t2code.alias.command.reload")); .replace("[perm]", "t2code.alias.command.reload"));
break; break;
case "info": case "info":
@ -40,7 +39,7 @@ public class Alias_CmdExecuter implements CommandExecutor, TabCompleter {
case "version": case "version":
if (sender.hasPermission("t2code.alias.command.info")) { if (sender.hasPermission("t2code.alias.command.info")) {
Commands.info(sender); Commands.info(sender);
} else send.sender(sender, SelectMessages.NoPermissionForCommand.replace("[cmd]", "/t2code-alias info") } else send.sender(sender, SelectMessages.noPermissionForCommand.replace("[cmd]", "/t2code-alias info")
.replace("[perm]", "t2code.alias.command.info")); .replace("[perm]", "t2code.alias.command.info"));
break; break;

View File

@ -9,9 +9,6 @@ import net.t2code.lib.Spigot.Lib.messages.send;
import net.t2code.lib.Spigot.Lib.update.UpdateAPI; import net.t2code.lib.Spigot.Lib.update.UpdateAPI;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import java.util.List;
public class Commands { public class Commands {
public static void info(CommandSender sender) { public static void info(CommandSender sender) {
@ -19,12 +16,12 @@ public class Commands {
} }
public static void reload(CommandSender sender) { public static void reload(CommandSender sender) {
if (sender instanceof Player) sender.sendMessage(SelectMessages.ReloadStart); if (sender instanceof Player) sender.sendMessage(SelectMessages.reloadStart);
send.console(Util.getPrefix() + "§8-------------------------------"); send.console(Util.getPrefix() + "§8-------------------------------");
send.console(Util.getPrefix() + " §6Plugin reload..."); send.console(Util.getPrefix() + " §6Plugin reload...");
send.console(Util.getPrefix() + "§8-------------------------------"); send.console(Util.getPrefix() + "§8-------------------------------");
Load.loadReload(); Load.loadReload();
if (sender instanceof Player) sender.sendMessage(SelectMessages.ReloadEnd); if (sender instanceof Player) sender.sendMessage(SelectMessages.reloadEnd);
send.console(Util.getPrefix() + "§8-------------------------------"); send.console(Util.getPrefix() + "§8-------------------------------");
send.console(Util.getPrefix() + " §2Plugin successfully reloaded."); send.console(Util.getPrefix() + " §2Plugin successfully reloaded.");
send.console(Util.getPrefix() + "§8-------------------------------"); send.console(Util.getPrefix() + "§8-------------------------------");

View File

@ -4,7 +4,7 @@ import net.md_5.bungee.api.chat.ClickEvent;
import net.t2code.alias.Spigot.Main; import net.t2code.alias.Spigot.Main;
import net.t2code.alias.Spigot.config.config.SelectConfig; import net.t2code.alias.Spigot.config.config.SelectConfig;
import net.t2code.alias.Spigot.config.languages.SelectMessages; import net.t2code.alias.Spigot.config.languages.SelectMessages;
import net.t2code.alias.Spigot.objects.Alias_Objekt; import net.t2code.alias.Spigot.objects.AliasObjekt;
import net.t2code.alias.Spigot.system.*; import net.t2code.alias.Spigot.system.*;
import net.t2code.alias.Util; import net.t2code.alias.Util;
import net.t2code.lib.Spigot.Lib.commands.Cmd; import net.t2code.lib.Spigot.Lib.commands.Cmd;
@ -12,6 +12,7 @@ import net.t2code.lib.Spigot.Lib.messages.TextBuilder;
import net.t2code.lib.Spigot.Lib.messages.send; import net.t2code.lib.Spigot.Lib.messages.send;
import net.t2code.lib.Spigot.Lib.plugins.PluginCheck; import net.t2code.lib.Spigot.Lib.plugins.PluginCheck;
import net.t2code.lib.Spigot.Lib.replace.Replace; import net.t2code.lib.Spigot.Lib.replace.Replace;
import net.t2code.lib.Spigot.Lib.vault.Vault;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -27,141 +28,174 @@ public class RegisterCommands extends Command {
@Override @Override
public boolean execute(CommandSender sender, String commandLabel, String[] args) { public boolean execute(CommandSender sender, String commandLabel, String[] args) {
Alias_Objekt Alias = Main.aliasHashMap.get(alias); AliasObjekt alias = Main.aliasHashMap.get(this.alias);
if (!Alias.AliasEnable) { if (!alias.aliasEnable) {
send.sender(sender, SelectMessages.AliasDisabled); send.sender(sender, SelectMessages.aliasDisabled);
return true; return true;
} }
if (sender instanceof Player) { if (sender instanceof Player) {
Player player = (Player) sender; Player player = (Player) sender;
if (Alias.AdminEnable) { if (alias.adminEnable) {
if (player.hasPermission(Alias.AdminPermission)) { if (player.hasPermission(alias.adminPermission)) {
if (Alias.AdminCommandEnable) { if (alias.adminCommandEnable) {
for (String cmd : Alias.AdminCommands) { adminCommand(alias, player);
if (Alias.AdminBungeeCommand) {
if (SelectConfig.Bungee) {
if (Alias.AdminCommandAsConsole) {
BCommand_Sender_Reciver.sendToBungee(player, cmd.replace("[player]", player.getName()), true);
} else BCommand_Sender_Reciver.sendToBungee(player, cmd.replace("[player]", player.getName()), false);
} else {
send.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
send.player(player, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
}
} else {
if (Alias.AdminCommandAsConsole) {
Cmd.console(cmd.replace("[player]", player.getName()));
} else {
Cmd.player(player, cmd.replace("[player]", player.getName()));
}
}
}
} }
if (Alias.AdminMessageEnable) { if (alias.adminMessageEnable) {
for (String msg : Alias.AdminMessages) { adminMessage(alias, player, prefix);
String text;
String hover;
if (PluginCheck.papi()) {
text = Replace.replace(prefix, player, msg);
hover = Replace.replace(prefix, player, Alias.AdminHover);
} else {
text = Replace.replace(prefix, msg);
hover = Replace.replace(prefix, Alias.AdminHover);
}
if (Alias.AdminTextBuilder) {
TextBuilder textBuilder = new TextBuilder(text);
textBuilder.addHover(hover);
if (Alias.AdminClickEvent) {
textBuilder.addClickEvent(ClickEvent.Action.valueOf(Alias.AdminAction), Alias.AdminActionValue);
}
player.spigot().sendMessage(textBuilder.build());
} else {
send.player(player, text);
}
}
} }
return true; return true;
} }
} }
if (Alias.Perm_necessary) { if (alias.permNecessary) {
if (!(player.hasPermission("t2code.alias.use." + alias.toLowerCase()) || player.hasPermission("t2code.alias.admin"))) { if (!(player.hasPermission("t2code.alias.use." + this.alias.toLowerCase()) || player.hasPermission("t2code.alias.admin"))) {
send.player(player, SelectMessages.NoPermissionForCommand.replace("[cmd]", "/" + alias.toLowerCase()) send.player(player, SelectMessages.noPermissionForCommand.replace("[cmd]", "/" + this.alias.toLowerCase())
.replace("[perm]", "t2code.alias.use." + alias.toLowerCase())); .replace("[perm]", "t2code.alias.use." + this.alias.toLowerCase()));
return true; return true;
} }
} }
if (Alias.Command_Enable) { if (alias.costEnable) {
for (String cmd : Alias.Command) { if (!(alias.costAllowBypass && player.hasPermission("t2code.alias.buy.bypass")) ){
if (Alias.BungeeCommand) { if (!Vault.buy(prefix, player, alias.costPrice)) {
if (SelectConfig.Bungee) { send.player(player, SelectMessages.noMoney);
if (Alias.CommandAsConsole) { return true;
BCommand_Sender_Reciver.sendToBungee(player, cmd.replace("[player]", player.getName()), true);
} else BCommand_Sender_Reciver.sendToBungee(player, cmd.replace("[player]", player.getName()), false);
} else {
send.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
send.player(player, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
}
} else {
if (Alias.CommandAsConsole) {
Cmd.console(cmd.replace("[player]", player.getName()));
} else {
Cmd.player(player, cmd.replace("[player]", player.getName()));
}
} }
if (SelectConfig.buyMessage) send.player(player, SelectMessages.buy.replace("[price]", alias.costPrice.toString()));
} }
} }
if (Alias.Message_Enable) { if (alias.commandEnable) {
for (String msg : Alias.Messages) { command(alias, player);
String text; }
String hover; if (alias.messageEnable) {
if (PluginCheck.papi()) { message(alias, player, prefix);
text = Replace.replace(prefix, player, msg);
hover = Replace.replace(prefix,player,Alias.Hover);
} else{
text = Replace.replace(prefix, msg);
hover = Replace.replace(prefix,Alias.Hover);
}
if (Alias.TextBuilder) {
TextBuilder textBuilder = new TextBuilder(text);
textBuilder.addHover(hover);
if (Alias.ClickEvent) {
textBuilder.addClickEvent(ClickEvent.Action.valueOf(Alias.Action), Alias.ActionValue);
}
player.spigot().sendMessage(textBuilder.build());
} else {
send.player(player, text);
}
}
} }
} else { } else {
if (Alias.ConsoleEnable) { if (alias.consoleEnable) {
if (Alias.ConsoleCommandEnable) { console(alias, sender, prefix);
for (String cmd : Alias.ConsoleCommands) { } else send.sender(sender, SelectMessages.onlyForPlayer);
if (Alias.ConsoleBungeeCommand) {
if (SelectConfig.Bungee) {
BCommand_Sender_Reciver.sendToBungee(sender, cmd.replace("[player]", sender.getName()), true);
} else {
send.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
send.sender(sender, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
}
} else {
Cmd.console(cmd.replace("[player]", sender.getName()));
}
}
}
if (Alias.ConsoleMessageEnable) {
for (String msg : Alias.ConsoleMessages) {
send.console(Replace.replace(prefix, msg));
}
}
} else send.sender(sender, SelectMessages.OnlyForPlayer);
} }
return true; return true;
} }
private static void adminCommand(AliasObjekt alias, Player player) {
for (String cmd : alias.adminCommands) {
if (alias.adminBungeeCommand) {
if (SelectConfig.Bungee) {
if (alias.adminCommandAsConsole) {
BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()), true);
} else BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()), false);
} else {
send.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
send.player(player, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
}
} else {
if (alias.adminCommandAsConsole) {
Cmd.console(cmd.replace("[player]", player.getName()));
} else {
Cmd.player(player, cmd.replace("[player]", player.getName()));
}
}
}
}
private static void adminMessage(AliasObjekt alias, Player player, String prefix) {
for (String msg : alias.adminMessages) {
String text;
String hover;
if (PluginCheck.papi()) {
text = Replace.replace(prefix, player, replacePlayer(msg, player));
hover = Replace.replace(prefix, player, alias.adminHover);
} else {
text = Replace.replace(prefix, replacePlayer(msg, player));
hover = Replace.replace(prefix, alias.adminHover);
}
if (alias.adminTextBuilder) {
TextBuilder textBuilder = new TextBuilder(text);
textBuilder.addHover(hover);
if (alias.adminClickEvent) {
textBuilder.addClickEvent(ClickEvent.Action.valueOf(alias.adminAction), alias.adminActionValue);
}
player.spigot().sendMessage(textBuilder.build());
} else {
send.player(player, text);
}
}
}
private static void command(AliasObjekt alias, Player player) {
for (String cmd : alias.command) {
if (alias.bungeeCommand) {
if (SelectConfig.Bungee) {
if (alias.commandAsConsole) {
BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()), true);
} else BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()), false);
} else {
send.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
send.player(player, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
}
} else {
if (alias.commandAsConsole) {
Cmd.console(cmd.replace("[player]", player.getName()));
} else {
Cmd.player(player, cmd.replace("[player]", player.getName()));
}
}
}
}
private static void message(AliasObjekt alias, Player player, String prefix) {
for (String msg : alias.messages) {
String text;
String hover;
if (PluginCheck.papi()) {
text = Replace.replace(prefix, player, replacePlayer(msg, player));
hover = Replace.replace(prefix, player, alias.hover);
} else {
text = Replace.replace(prefix, replacePlayer(msg, player));
hover = Replace.replace(prefix, alias.hover);
}
if (alias.textBuilder) {
TextBuilder textBuilder = new TextBuilder(text);
textBuilder.addHover(hover);
if (alias.clickEvent) {
textBuilder.addClickEvent(ClickEvent.Action.valueOf(alias.action), alias.actionValue);
}
player.spigot().sendMessage(textBuilder.build());
} else {
send.player(player, text);
}
}
}
private static void console(AliasObjekt alias, CommandSender sender, String prefix) {
if (alias.consoleCommandEnable) {
for (String cmd : alias.consoleCommands) {
if (alias.consoleBungeeCommand) {
if (SelectConfig.Bungee) {
BCommandSenderReciver.sendToBungee(sender, cmd.replace("[player]", sender.getName()), true);
} else {
send.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
send.sender(sender, Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
}
} else {
Cmd.console(cmd.replace("[player]", sender.getName()));
}
}
}
if (alias.consoleMessageEnable) {
for (String msg : alias.consoleMessages) {
send.console(Replace.replace(prefix, msg));
}
}
}
private static String replacePlayer(String s, Player player) {
return s.replace("[player]", player.getName());
}
} }

View File

@ -10,15 +10,10 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
public class CreateConfig { public class CreateConfig {
public static Integer ConfigVersion = 1; public static Integer ConfigVersion = 2;
private static Boolean UpdateCheckOnJoin = true;
private static String language = "english";
private static Boolean Bungee = false;
private static String thisServer = "server";
public static void configCreate() { public static void configCreate() {
Long long_ = Long.valueOf(System.currentTimeMillis()); long long_ = System.currentTimeMillis();
if (new File(Main.getPath(), "config.yml").exists()) { if (new File(Main.getPath(), "config.yml").exists()) {
if (Main.plugin.getConfig().getBoolean("Plugin.Debug")) send.console(Util.getPrefix() + " §5DEBUG: §6" + " §4config.yml are created / updated..."); if (Main.plugin.getConfig().getBoolean("Plugin.Debug")) send.console(Util.getPrefix() + " §5DEBUG: §6" + " §4config.yml are created / updated...");
} else send.console(Util.getPrefix() + " §4config.yml are created..."); } else send.console(Util.getPrefix() + " §4config.yml are created...");
@ -29,18 +24,18 @@ public class CreateConfig {
yamlConfiguration.set("ConfigVersion", ConfigVersion); yamlConfiguration.set("ConfigVersion", ConfigVersion);
Config.set("Plugin.UpdateCheckOnJoin", UpdateCheckOnJoin, yamlConfiguration); Config.set("Plugin.language", "english", yamlConfiguration);
Config.set("Plugin.language", language, yamlConfiguration);
Config.set("BungeeCord.Enable", Bungee, yamlConfiguration); Config.set("BungeeCord.Enable", false, yamlConfiguration);
Config.set("BungeeCord.ThisServer", thisServer, yamlConfiguration); Config.set("BungeeCord.ThisServer", "server", yamlConfiguration);
Config.set("Buy.Message", true, yamlConfiguration);
try { try {
yamlConfiguration.save(config); yamlConfiguration.save(config);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
send.console(Util.getPrefix() + " §2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms"); send.console(Util.getPrefix() + " §2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
} }
} }

View File

@ -9,51 +9,14 @@ import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections;
import java.util.List; import java.util.List;
public class CreateExampleAliasConfig { public class CreateExampleAliasConfig {
private static Boolean Enable = true;
private static Boolean PermNecessary = true;
private static Boolean CommandEnable = true;
private static Boolean CommandAsConsole = true;
private static Boolean BungeeCommand = false;
private static List Commands = Arrays.asList("say hi");
private static Boolean MessageEnable = false;
private static List Messages = Arrays.asList();
private static Boolean TextBuilder = false;
private static String Hover = "";
private static Boolean ClickEvent = false;
private static String Action = "";
private static String ActionValue = "";
private static Boolean AdminEnable = true;
private static String AdminPermission = "t2code.alias.admin";
private static Boolean AdminCommandEnable = true;
private static Boolean AdminCommandAsConsole = true;
private static Boolean AdminBungeeCommand = false;
private static List AdminCommands = Arrays.asList("say hi");
private static Boolean AdminMessageEnable = false;
private static List AdminMessages = Arrays.asList();
private static Boolean AdminTextBuilder = false;
private static String AdminHover = "";
private static Boolean AdminClickEvent = false;
private static String AdminAction = "";
private static String AdminActionValue = "";
private static Boolean ConsoleEnable = false;
private static Boolean ConsoleCommandEnable = false;
private static Boolean ConsoleBungeeCommand = false;
private static List<String> ConsoleCommands = Arrays.asList();
private static Boolean ConsoleMessageEnable = false;
private static List<String> ConsoleMessages = Arrays.asList();
public static void configCreate() { public static void configCreate() {
Long long_ = Long.valueOf(System.currentTimeMillis()); long long_ = System.currentTimeMillis();
if (new File(Main.getPath(), "config.yml").exists()) { if (new File(Main.getPath(), "config.yml").exists()) {
if (Main.plugin.getConfig().getBoolean("Plugin.Debug")) send.console(Util.getPrefix() + " §5DEBUG: §6" + " §4config.yml are created / updated..."); if (Main.plugin.getConfig().getBoolean("Plugin.Debug")) send.console(Util.getPrefix() + " §5DEBUG: §6" + " §4config.yml are created / updated...");
} else send.console(Util.getPrefix() + " §4config.yml are created..."); } else send.console(Util.getPrefix() + " §4config.yml are created...");
@ -63,50 +26,53 @@ public class CreateExampleAliasConfig {
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config); YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
Config.set("Alias.Enable", Enable, yamlConfiguration); Config.set("Alias.Enable", true, yamlConfiguration);
Config.set("Alias.Permission.Necessary", PermNecessary, yamlConfiguration); Config.set("Alias.Permission.Necessary", true, yamlConfiguration);
Config.set("Alias.Command.Enable", CommandEnable, yamlConfiguration); Config.set("Alias.Cost.Enable", false,yamlConfiguration);
Config.set("Alias.Command.CommandAsConsole", CommandAsConsole, yamlConfiguration); Config.set("Alias.Cost.Price", 0.0,yamlConfiguration);
Config.set("Alias.Command.BungeeCommand", BungeeCommand, yamlConfiguration); Config.set("Alias.Cost.AllowByPass", true,yamlConfiguration);
Config.set("Alias.Command.Commands", Commands, yamlConfiguration);
Config.set("Alias.Message.Enable", MessageEnable, yamlConfiguration); Config.set("Alias.Command.Enable", true, yamlConfiguration);
Config.set("Alias.Message.Messages", Messages, yamlConfiguration); Config.set("Alias.Command.CommandAsConsole", true, yamlConfiguration);
Config.set("Alias.Message.TextBuilder.Enable", TextBuilder, yamlConfiguration); Config.set("Alias.Command.BungeeCommand", false, yamlConfiguration);
Config.set("Alias.Message.TextBuilder.Hover", Hover, yamlConfiguration); Config.set("Alias.Command.Commands", Collections.singletonList("say hi"), yamlConfiguration);
Config.set("Alias.Message.TextBuilder.ClickEvent.Enable", ClickEvent, yamlConfiguration);
Config.set("Alias.Message.TextBuilder.ClickEvent.Action", Action, yamlConfiguration);
Config.set("Alias.Message.TextBuilder.ClickEvent.ActionValue", ActionValue, yamlConfiguration);
Config.set("Alias.Message.Enable", false, yamlConfiguration);
Config.set("Alias.Message.Messages", Collections.emptyList(), yamlConfiguration);
Config.set("Alias.Message.TextBuilder.Enable", false, yamlConfiguration);
Config.set("Alias.Message.TextBuilder.Hover", "", yamlConfiguration);
Config.set("Alias.Message.TextBuilder.ClickEvent.Enable", false, yamlConfiguration);
Config.set("Alias.Message.TextBuilder.ClickEvent.Action", "", yamlConfiguration);
Config.set("Alias.Message.TextBuilder.ClickEvent.ActionValue", "", yamlConfiguration);
Config.set("Alias.Admin.Enable", AdminEnable, yamlConfiguration); Config.set("Alias.Admin.Enable", true, yamlConfiguration);
Config.set("Alias.Admin.Permission", AdminPermission, yamlConfiguration); Config.set("Alias.Admin.Permission", "t2code.alias.admin", yamlConfiguration);
Config.set("Alias.Admin.Command.Enable", AdminCommandEnable, yamlConfiguration); Config.set("Alias.Admin.Command.Enable", true, yamlConfiguration);
Config.set("Alias.Admin.Command.CommandAsConsole", AdminCommandAsConsole, yamlConfiguration); Config.set("Alias.Admin.Command.CommandAsConsole", true, yamlConfiguration);
Config.set("Alias.Admin.Command.BungeeCommand", AdminBungeeCommand, yamlConfiguration); Config.set("Alias.Admin.Command.BungeeCommand", false, yamlConfiguration);
Config.set("Alias.Admin.Command.Commands", AdminCommands, yamlConfiguration); Config.set("Alias.Admin.Command.Commands", Collections.singletonList("say hi"), yamlConfiguration);
Config.set("Alias.Admin.Message.Enable", AdminMessageEnable, yamlConfiguration); Config.set("Alias.Admin.Message.Enable", false, yamlConfiguration);
Config.set("Alias.Admin.Message.Messages", AdminMessages, yamlConfiguration); Config.set("Alias.Admin.Message.Messages", Collections.emptyList(), yamlConfiguration);
Config.set("Alias.Admin.Message.TextBuilder.Enable", AdminTextBuilder, yamlConfiguration); Config.set("Alias.Admin.Message.TextBuilder.Enable", false, yamlConfiguration);
Config.set("Alias.Admin.Message.TextBuilder.Hover", AdminHover, yamlConfiguration); Config.set("Alias.Admin.Message.TextBuilder.Hover", "", yamlConfiguration);
Config.set("Alias.Admin.Message.TextBuilder.ClickEvent.Enable", AdminClickEvent, yamlConfiguration); Config.set("Alias.Admin.Message.TextBuilder.ClickEvent.Enable", false, yamlConfiguration);
Config.set("Alias.Admin.Message.TextBuilder.ClickEvent.Action", AdminAction, yamlConfiguration); Config.set("Alias.Admin.Message.TextBuilder.ClickEvent.Action", "", yamlConfiguration);
Config.set("Alias.Admin.Message.TextBuilder.ClickEvent.ActionValue", AdminActionValue, yamlConfiguration); Config.set("Alias.Admin.Message.TextBuilder.ClickEvent.ActionValue", "", yamlConfiguration);
Config.set("Alias.Console.Enable", ConsoleEnable, yamlConfiguration); Config.set("Alias.Console.Enable", false, yamlConfiguration);
Config.set("Alias.Console.Command.Enable", ConsoleCommandEnable, yamlConfiguration); Config.set("Alias.Console.Command.Enable", false, yamlConfiguration);
Config.set("Alias.Console.Command.BungeeCommand", ConsoleBungeeCommand, yamlConfiguration); Config.set("Alias.Console.Command.BungeeCommand", false, yamlConfiguration);
Config.set("Alias.Console.Command.Commands", ConsoleCommands, yamlConfiguration); Config.set("Alias.Console.Command.Commands", Collections.emptyList(), yamlConfiguration);
Config.set("Alias.Console.Message.Enable", ConsoleMessageEnable, yamlConfiguration); Config.set("Alias.Console.Message.Enable", false, yamlConfiguration);
Config.set("Alias.Console.Message.Messages", ConsoleMessages, yamlConfiguration); Config.set("Alias.Console.Message.Messages", Collections.emptyList(), yamlConfiguration);
try { try {
yamlConfiguration.save(config); yamlConfiguration.save(config);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
send.console(Util.getPrefix() + " §2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms"); send.console(Util.getPrefix() + " §2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
} }
} }

View File

@ -1,8 +1,9 @@
package net.t2code.alias.Spigot.config.config; package net.t2code.alias.Spigot.config.config;
import net.minecraft.world.level.levelgen.DensityFunctions;
import net.t2code.alias.Spigot.Main; import net.t2code.alias.Spigot.Main;
import net.t2code.alias.Spigot.system.AliasRegister; import net.t2code.alias.Spigot.system.AliasRegister;
import net.t2code.alias.Spigot.objects.Alias_Objekt; import net.t2code.alias.Spigot.objects.AliasObjekt;
import net.t2code.alias.Util; import net.t2code.alias.Util;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
@ -22,10 +23,14 @@ public class SelectAlias {
Main.allAliases.add(config_gui.getName().replace(".yml", "")); Main.allAliases.add(config_gui.getName().replace(".yml", ""));
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config_gui); YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config_gui);
Alias_Objekt alias = new Alias_Objekt( AliasObjekt alias = new AliasObjekt(
yamlConfiguration.getBoolean("Alias.Enable"), yamlConfiguration.getBoolean("Alias.Enable"),
yamlConfiguration.getBoolean("Alias.Permission.Necessary"), yamlConfiguration.getBoolean("Alias.Permission.Necessary"),
yamlConfiguration.getBoolean("Alias.Cost.Enable"),
yamlConfiguration.getDouble("Alias.Cost.Price"),
yamlConfiguration.getBoolean("Alias.Cost.AllowByPass"),
yamlConfiguration.getBoolean("Alias.Command.Enable"), yamlConfiguration.getBoolean("Alias.Command.Enable"),
yamlConfiguration.getBoolean("Alias.Command.CommandAsConsole"), yamlConfiguration.getBoolean("Alias.Command.CommandAsConsole"),
yamlConfiguration.getBoolean("Alias.Command.BungeeCommand"), yamlConfiguration.getBoolean("Alias.Command.BungeeCommand"),

View File

@ -11,6 +11,8 @@ public class SelectConfig {
public static String language; public static String language;
public static Boolean Bungee; public static Boolean Bungee;
public static String thisServer; public static String thisServer;
public static Boolean buyMessage;
public static void onSelect() { public static void onSelect() {
File config = new File(Main.getPath(), "config.yml"); File config = new File(Main.getPath(), "config.yml");
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config); YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
@ -21,5 +23,7 @@ public class SelectConfig {
language = yamlConfiguration.getString("Plugin.language"); language = yamlConfiguration.getString("Plugin.language");
Bungee = yamlConfiguration.getBoolean("BungeeCord.Enable"); Bungee = yamlConfiguration.getBoolean("BungeeCord.Enable");
thisServer = yamlConfiguration.getString("BungeeCord.ThisServer"); thisServer = yamlConfiguration.getString("BungeeCord.ThisServer");
buyMessage = yamlConfiguration.getBoolean("Buy.Message");
} }
} }

View File

@ -15,7 +15,7 @@ public class LanguagesCreate {
public static void langCreate() { public static void langCreate() {
send.debug(plugin,"§4Language files are created / updated..."); send.debug(plugin,"§4Language files are created / updated...");
Long long_ = Long.valueOf(System.currentTimeMillis()); long long_ = System.currentTimeMillis();
/** /**
* *
@ -32,6 +32,9 @@ public class LanguagesCreate {
Config.set("Plugin.Reload.End", MSG.EN_ReloadEnd, yamlConfigurationEN); Config.set("Plugin.Reload.End", MSG.EN_ReloadEnd, yamlConfigurationEN);
Config.set("Plugin.ForCommand", MSG.EN_NoPermissionForCommand, yamlConfigurationEN); Config.set("Plugin.ForCommand", MSG.EN_NoPermissionForCommand, yamlConfigurationEN);
Config. set("Cost.Buy", MSG.EN_Buy, yamlConfigurationEN);
Config.set("Cost.NoMoney", MSG.EN_NoMoney, yamlConfigurationEN);
try { try {
yamlConfigurationEN.save(messagesEN); yamlConfigurationEN.save(messagesEN);
} catch (IOException e) { } catch (IOException e) {
@ -55,6 +58,9 @@ public class LanguagesCreate {
Config.set("Plugin.Reload.End", MSG.DE_ReloadEnd, yamlConfigurationDE); Config.set("Plugin.Reload.End", MSG.DE_ReloadEnd, yamlConfigurationDE);
Config.set("Plugin.ForCommand", MSG.DE_NoPermissionForCommand, yamlConfigurationDE); Config.set("Plugin.ForCommand", MSG.DE_NoPermissionForCommand, yamlConfigurationDE);
Config.set("Cost.Buy", MSG.DE_Buy, yamlConfigurationDE);
Config.set("Cost.NoMoney", MSG.DE_NoMoney, yamlConfigurationDE);
try { try {
yamlConfigurationDE.save(messagesDE); yamlConfigurationDE.save(messagesDE);
} catch (IOException e) { } catch (IOException e) {
@ -63,31 +69,7 @@ public class LanguagesCreate {
} }
/** send.console(Util.getPrefix() + " §2Language files were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
*
* norwegian
*
*/
File messagesNO = new File(Main.getPath(), "languages/norwegian_messages.yml");
YamlConfiguration yamlConfigurationNO = YamlConfiguration.loadConfiguration(messagesNO);
Config.set("Plugin.OnlyForPlayer", MSG.NO_OnlyForPlayer, yamlConfigurationNO);
Config.set("Plugin.AliasDisabled", MSG.NO_Disabled, yamlConfigurationNO);
Config.set("Plugin.Reload.Start", MSG.NO_ReloadStart, yamlConfigurationNO);
Config.set("Plugin.Reload.End", MSG.NO_ReloadEnd, yamlConfigurationNO);
Config.set("Plugin.ForCommand", MSG.NO_NoPermissionForCommand, yamlConfigurationNO);
try {
yamlConfigurationNO.save(messagesNO);
} catch (IOException e) {
send.warning(plugin,e.getMessage());
e.printStackTrace();
}
send.console(Util.getPrefix() + " §2Language files were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
} }
} }

View File

@ -24,6 +24,10 @@ public class MSG {
public static String EN_NoPermissionForCommand = "[prefix] &cFor &b[cmd] &cyou lack the permission &6[perm]&c!"; public static String EN_NoPermissionForCommand = "[prefix] &cFor &b[cmd] &cyou lack the permission &6[perm]&c!";
public static String EN_Buy = "[prefix] &2You have paid &6[price] &2for this command.&2.";
public static String EN_NoMoney = "[prefix] &cYou don't have enough money for this command!";
// DE // DE
public static String DE_OnlyForPlayer = "[prefix] &cDieser Command ist nur f[ue]r Spieler!"; public static String DE_OnlyForPlayer = "[prefix] &cDieser Command ist nur f[ue]r Spieler!";
@ -33,17 +37,8 @@ public class MSG {
public static String DE_ReloadEnd = "[prefix] &2Plugin wurde erfolgreich neu geladen."; public static String DE_ReloadEnd = "[prefix] &2Plugin wurde erfolgreich neu geladen.";
public static String DE_NoPermissionForCommand = "[prefix] &cF[ue]r &b[cmd] &cfehlt dir die Permission &6[perm]&c!"; public static String DE_NoPermissionForCommand = "[prefix] &cF[ue]r &b[cmd] &cfehlt dir die Permission &6[perm]&c!";
// FR
public static String DE_Buy = "[prefix] &2Du hast f[ue]r diesen Command &6[price] &2bezahlt.";
// NO public static String DE_NoMoney = "[prefix] &cDu hast nicht gen[ue]gend Geld für diesen Command!";
public static String NO_OnlyForPlayer = "[prefix] &cDenne kommandoen er for spillere kun!";
public static String NO_Disabled = "Unknown command. Type ''/help'' for help.";
public static String NO_ReloadStart = "[prefix] &6Pluginet blir relastet...";
public static String NO_ReloadEnd = "[prefix] &2Pluginet har blitt lastet inn på nytt.";
public static String NO_NoPermissionForCommand = "[prefix] &cFor &b[cmd] &cmangler du tillatelsen &6[perm]&c!";
} }

View File

@ -4,22 +4,24 @@ import net.t2code.alias.Spigot.Main;
import net.t2code.alias.Spigot.config.config.SelectConfig; import net.t2code.alias.Spigot.config.config.SelectConfig;
import net.t2code.alias.Util; import net.t2code.alias.Util;
import net.t2code.lib.Spigot.Lib.messages.send; import net.t2code.lib.Spigot.Lib.messages.send;
import net.t2code.lib.Spigot.Lib.replace.Replace;
import net.t2code.lib.Spigot.Lib.yamlConfiguration.Config; import net.t2code.lib.Spigot.Lib.yamlConfiguration.Config;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File; import java.io.File;
public class SelectMessages { public class SelectMessages {
private static String prefix = Util.getPrefix();
public static String selectMSG; public static String selectMSG;
public static String OnlyForPlayer; public static String onlyForPlayer;
public static String ReloadStart; public static String reloadStart;
public static String ReloadEnd; public static String reloadEnd;
public static String NoPermissionForCommand; public static String noPermissionForCommand;
public static String AliasDisabled; public static String aliasDisabled;
public static String buy;
public static String noMoney;
public static void onSelect(String Prefix) { public static void onSelect(String Prefix) {
@ -42,12 +44,18 @@ public class SelectMessages {
} else selectMSG = SelectConfig.language; } else selectMSG = SelectConfig.language;
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(msg); YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(msg);
OnlyForPlayer = Config.select(prefix, "Plugin.OnlyForPlayer", yamlConfiguration); onlyForPlayer = replace(yamlConfiguration.getString("Plugin.OnlyForPlayer"));
AliasDisabled = Config.select(prefix, "Plugin.AliasDisabled", yamlConfiguration); aliasDisabled = replace(yamlConfiguration.getString("Plugin.AliasDisabled"));
ReloadStart = Config.select(prefix, "Plugin.Reload.Start", yamlConfiguration); reloadStart = replace(yamlConfiguration.getString("Plugin.Reload.Start"));
ReloadEnd = Config.select(prefix, "Plugin.Reload.End", yamlConfiguration); reloadEnd = replace(yamlConfiguration.getString("Plugin.Reload.End"));
NoPermissionForCommand = Config.select(prefix, "Plugin.ForCommand", yamlConfiguration); noPermissionForCommand = replace(yamlConfiguration.getString("Plugin.ForCommand"));
buy = replace(yamlConfiguration.getString("Cost.Buy"));
noMoney = replace(yamlConfiguration.getString("Cost.NoMoney"));
send.console(Prefix + " §2Language successfully selected to: §6" + selectMSG + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms"); send.console(Prefix + " §2Language successfully selected to: §6" + selectMSG + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
}
private static String replace(String text) {
return Replace.replace(Util.getPrefix(), text);
} }
} }

View File

@ -0,0 +1,124 @@
package net.t2code.alias.Spigot.objects;
import java.util.List;
public class AliasObjekt {
public Boolean aliasEnable;
public Boolean commandEnable;
public Boolean permNecessary;
public Boolean costEnable;
public Double costPrice;
public Boolean costAllowBypass;
public Boolean commandAsConsole;
public Boolean bungeeCommand;
public List<String> command;
public Boolean messageEnable;
public List<String> messages;
public Boolean textBuilder;
public String hover;
public Boolean clickEvent;
public String action;
public String actionValue;
public Boolean adminEnable;
public String adminPermission;
public Boolean adminCommandEnable;
public Boolean adminCommandAsConsole;
public Boolean adminBungeeCommand;
public List<String> adminCommands;
public Boolean adminMessageEnable;
public List<String> adminMessages;
public Boolean adminTextBuilder;
public String adminHover;
public Boolean adminClickEvent;
public String adminAction;
public String adminActionValue;
public Boolean consoleEnable;
public Boolean consoleCommandEnable;
public Boolean consoleBungeeCommand;
public List<String> consoleCommands;
public Boolean consoleMessageEnable;
public List<String> consoleMessages;
public AliasObjekt(Boolean aliasEnable,
Boolean permNecessary,
Boolean costEnable,
Double costPrice,
Boolean costAllowBypass,
Boolean commandEnable,
Boolean commandAsConsole,
Boolean bungeeCommand,
List<String> command,
Boolean messageEnable,
List<String> messages,
Boolean textBuilder,
String hover,
Boolean clickEvent,
String action,
String actionValue,
Boolean adminEnable,
String adminPermission,
Boolean adminCommandEnable,
Boolean adminCommandAsConsole,
Boolean adminBungeeCommand,
List<String> adminCommands,
Boolean adminMessageEnable,
List<String> adminMessages,
Boolean adminTextBuilder,
String adminHover,
Boolean adminClickEvent,
String adminAction,
String adminActionValue,
Boolean consoleEnable,
Boolean consoleCommandEnable,
Boolean consoleBungeeCommand,
List<String> consoleCommands,
Boolean consoleMessageEnable,
List<String> consoleMessages) {
this.aliasEnable = aliasEnable;
this.permNecessary = permNecessary;
this.costEnable = costEnable;
this.costPrice = costPrice;
this.costAllowBypass = costAllowBypass;
this.commandEnable = commandEnable;
this.commandAsConsole = commandAsConsole;
this.bungeeCommand = bungeeCommand;
this.command = command;
this.messageEnable = messageEnable;
this.messages = messages;
this.textBuilder = textBuilder;
this.hover = hover;
this.clickEvent = clickEvent;
this.action = action;
this.actionValue = actionValue;
this.adminEnable = adminEnable;
this.adminPermission = adminPermission;
this.adminCommandEnable = adminCommandEnable;
this.adminCommandAsConsole = adminCommandAsConsole;
this.adminBungeeCommand = adminBungeeCommand;
this.adminCommands = adminCommands;
this.adminMessageEnable = adminMessageEnable;
this.adminMessages = adminMessages;
this.adminTextBuilder = adminTextBuilder;
this.adminHover = adminHover;
this.adminClickEvent = adminClickEvent;
this.adminAction = adminAction;
this.adminActionValue = adminActionValue;
this.consoleEnable = consoleEnable;
this.consoleCommandEnable = consoleCommandEnable;
this.consoleBungeeCommand = consoleBungeeCommand;
this.consoleCommands = consoleCommands;
this.consoleMessageEnable = consoleMessageEnable;
this.consoleMessages = consoleMessages;
}
}

View File

@ -1,112 +0,0 @@
package net.t2code.alias.Spigot.objects;
import java.util.List;
public class Alias_Objekt {
public Boolean AliasEnable;
public Boolean Command_Enable;
public Boolean Perm_necessary;
public Boolean CommandAsConsole;
public Boolean BungeeCommand;
public List<String> Command;
public Boolean Message_Enable;
public List<String> Messages;
public Boolean TextBuilder;
public String Hover;
public Boolean ClickEvent;
public String Action;
public String ActionValue;
public Boolean AdminEnable;
public String AdminPermission;
public Boolean AdminCommandEnable;
public Boolean AdminCommandAsConsole;
public Boolean AdminBungeeCommand;
public List<String> AdminCommands;
public Boolean AdminMessageEnable;
public List<String> AdminMessages;
public Boolean AdminTextBuilder;
public String AdminHover;
public Boolean AdminClickEvent;
public String AdminAction;
public String AdminActionValue;
public Boolean ConsoleEnable;
public Boolean ConsoleCommandEnable;
public Boolean ConsoleBungeeCommand;
public List<String> ConsoleCommands;
public Boolean ConsoleMessageEnable;
public List<String> ConsoleMessages;
public Alias_Objekt(Boolean AliasEnable,
Boolean Perm_necessary,
Boolean Command_Enable,
Boolean CommandAsConsole,
Boolean BungeeCommand,
List Command,
Boolean Message_Enable,
List Messages,
Boolean TextBuilder,
String Hover,
Boolean ClickEvent,
String Action,
String ActionValue,
Boolean AdminEnable,
String AdminPermission,
Boolean AdminCommandEnable,
Boolean AdminCommandAsConsole,
Boolean AdminBungeeCommand,
List AdminCommands,
Boolean AdminMessageEnable,
List AdminMessages,
Boolean AdminTextBuilder,
String AdminHover,
Boolean AdminClickEvent,
String AdminAction,
String AdminActionValue,
Boolean ConsoleEnable,
Boolean ConsoleCommandEnable,
Boolean ConsoleBungeeCommand,
List<String> ConsoleCommands,
Boolean ConsoleMessageEnable,
List<String> ConsoleMessages) {
this.AliasEnable = AliasEnable;
this.Perm_necessary = Perm_necessary;
this.Command_Enable = Command_Enable;
this.CommandAsConsole = CommandAsConsole;
this.BungeeCommand = BungeeCommand;
this.Command = Command;
this.Message_Enable = Message_Enable;
this.Messages = Messages;
this.TextBuilder = TextBuilder;
this.Hover = Hover;
this.ClickEvent = ClickEvent;
this.Action = Action;
this.ActionValue = ActionValue;
this.AdminEnable = AdminEnable;
this.AdminPermission = AdminPermission;
this.AdminCommandEnable = AdminCommandEnable;
this.AdminCommandAsConsole = AdminCommandAsConsole;
this.AdminBungeeCommand = AdminBungeeCommand;
this.AdminCommands = AdminCommands;
this.AdminMessageEnable = AdminMessageEnable;
this.AdminMessages = AdminMessages;
this.AdminTextBuilder = AdminTextBuilder;
this.AdminHover = AdminHover;
this.AdminClickEvent = AdminClickEvent;
this.AdminAction = AdminAction;
this.AdminActionValue = AdminActionValue;
this.ConsoleEnable = ConsoleEnable;
this.ConsoleCommandEnable = ConsoleCommandEnable;
this.ConsoleBungeeCommand = ConsoleBungeeCommand;
this.ConsoleCommands = ConsoleCommands;
this.ConsoleMessageEnable = ConsoleMessageEnable;
this.ConsoleMessages = ConsoleMessages;
}
}

View File

@ -4,103 +4,28 @@ import net.t2code.alias.Spigot.Main;
import net.t2code.alias.Spigot.cmdManagement.RegisterCommands; import net.t2code.alias.Spigot.cmdManagement.RegisterCommands;
import net.t2code.lib.Spigot.Lib.messages.send; import net.t2code.lib.Spigot.Lib.messages.send;
import net.t2code.lib.Spigot.Lib.minecraftVersion.NMSVersion; import net.t2code.lib.Spigot.Lib.minecraftVersion.NMSVersion;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandMap;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import java.lang.reflect.Field;
public class AliasRegister { public class AliasRegister {
public static void onRegister() { public static void onRegister() {
Plugin plugin = Main.plugin; Plugin plugin = Main.plugin;
for (String alias : Main.allAliases) { for (String alias : Main.allAliases) {
if (Main.aliasHashMap.get(alias) != null) { if (Main.aliasHashMap.get(alias) != null) {
if (Main.aliasHashMap.get(alias).AliasEnable) { if (alias.equals(" ")) continue;
if (NMSVersion.v1_8_R1) { if (Main.aliasHashMap.get(alias).aliasEnable) {
send.debug(plugin, "Alias register 1.8_R1"); try {
org.bukkit.craftbukkit.v1_8_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_8_R1.CraftServer) plugin.getServer(); final Field bukkitCommandMap = Bukkit.getServer().getClass().getDeclaredField("commandMap");
craftServer.getCommandMap().register(alias, new RegisterCommands(alias));
} bukkitCommandMap.setAccessible(true);
if (NMSVersion.v1_8_R2) { CommandMap commandMap = (CommandMap) bukkitCommandMap.get(Bukkit.getServer());
send.debug(plugin, "Alias register 1.8_R2");
org.bukkit.craftbukkit.v1_8_R2.CraftServer craftServer = (org.bukkit.craftbukkit.v1_8_R2.CraftServer) plugin.getServer(); commandMap.register(alias, new RegisterCommands(alias));
craftServer.getCommandMap().register(alias, new RegisterCommands(alias)); } catch(Exception e) {
} e.printStackTrace();
if (NMSVersion.v1_8_R3) {
send.debug(plugin, "Alias register 1.8_R3");
org.bukkit.craftbukkit.v1_8_R3.CraftServer craftServer = (org.bukkit.craftbukkit.v1_8_R3.CraftServer) plugin.getServer();
craftServer.getCommandMap().register(alias, new RegisterCommands(alias));
}
if (NMSVersion.v1_9_R1) {
send.debug(plugin, "Alias register 1.9_R1");
org.bukkit.craftbukkit.v1_9_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_9_R1.CraftServer) plugin.getServer();
craftServer.getCommandMap().register(alias, new RegisterCommands(alias));
}
if (NMSVersion.v1_9_R2) {
send.debug(plugin, "Alias register 1.9_R2");
org.bukkit.craftbukkit.v1_9_R2.CraftServer craftServer = (org.bukkit.craftbukkit.v1_9_R2.CraftServer) plugin.getServer();
craftServer.getCommandMap().register(alias, new RegisterCommands(alias));
}
if (NMSVersion.v1_10_R1) {
send.debug(plugin, "Alias register 1.10_R1");
org.bukkit.craftbukkit.v1_10_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_10_R1.CraftServer) plugin.getServer();
craftServer.getCommandMap().register(alias, new RegisterCommands(alias));
}
if (NMSVersion.v1_11_R1) {
send.debug(plugin, "Alias register 1.11_R1");
org.bukkit.craftbukkit.v1_11_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_11_R1.CraftServer) plugin.getServer();
craftServer.getCommandMap().register(alias, new RegisterCommands(alias));
}
if (NMSVersion.v1_12_R1) {
send.debug(plugin, "Alias register 1.12_R1");
org.bukkit.craftbukkit.v1_12_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_12_R1.CraftServer) plugin.getServer();
craftServer.getCommandMap().register(alias, new RegisterCommands(alias));
}
if (NMSVersion.v1_13_R1) {
send.debug(plugin, "Alias register 1.13_R1");
org.bukkit.craftbukkit.v1_13_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_13_R1.CraftServer) plugin.getServer();
craftServer.getCommandMap().register(alias, new RegisterCommands(alias));
}
if (NMSVersion.v1_13_R2) {
send.debug(plugin, "Alias register 1.13_R2");
org.bukkit.craftbukkit.v1_13_R2.CraftServer craftServer = (org.bukkit.craftbukkit.v1_13_R2.CraftServer) plugin.getServer();
craftServer.getCommandMap().register(alias, new RegisterCommands(alias));
}
if (NMSVersion.v1_14_R1) {
send.debug(plugin, "Alias register 1.14_R1");
org.bukkit.craftbukkit.v1_14_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_14_R1.CraftServer) plugin.getServer();
craftServer.getCommandMap().register(alias, new RegisterCommands(alias));
}
if (NMSVersion.v1_15_R1) {
send.debug(plugin, "Alias register 1.15_R1");
org.bukkit.craftbukkit.v1_15_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_15_R1.CraftServer) plugin.getServer();
craftServer.getCommandMap().register(alias, new RegisterCommands(alias));
}
if (NMSVersion.v1_16_R1) {
send.debug(plugin, "Alias register 1.16_R1");
org.bukkit.craftbukkit.v1_16_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_16_R1.CraftServer) plugin.getServer();
craftServer.getCommandMap().register(alias, new RegisterCommands(alias));
}
if (NMSVersion.v1_16_R2) {
send.debug(plugin, "Alias register 1.16_R2");
org.bukkit.craftbukkit.v1_16_R2.CraftServer craftServer = (org.bukkit.craftbukkit.v1_16_R2.CraftServer) plugin.getServer();
craftServer.getCommandMap().register(alias, new RegisterCommands(alias));
}
if (NMSVersion.v1_16_R3) {
send.debug(plugin, "Alias register 1.16_R3");
org.bukkit.craftbukkit.v1_16_R3.CraftServer craftServer = (org.bukkit.craftbukkit.v1_16_R3.CraftServer) plugin.getServer();
craftServer.getCommandMap().register(alias, new RegisterCommands(alias));
}
if (NMSVersion.v1_17_R1) {
send.debug(plugin, "Alias register 1.17_R1");
org.bukkit.craftbukkit.v1_17_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_17_R1.CraftServer) plugin.getServer();
craftServer.getCommandMap().register(alias, new RegisterCommands(alias));
}
if (NMSVersion.v1_18_R1) {
send.debug(plugin, "Alias register 1.18_R1");
org.bukkit.craftbukkit.v1_18_R1.CraftServer craftServer = (org.bukkit.craftbukkit.v1_18_R1.CraftServer) plugin.getServer();
craftServer.getCommandMap().register(alias, new RegisterCommands(alias));
}
if (NMSVersion.v1_18_R2) {
send.debug(plugin, "Alias register 1.18_R2");
org.bukkit.craftbukkit.v1_18_R2.CraftServer craftServer = (org.bukkit.craftbukkit.v1_18_R2.CraftServer) plugin.getServer();
craftServer.getCommandMap().register(alias, new RegisterCommands(alias));
} }
} }
} else send.warning(plugin, " §4AliasHashmap is null! - " + alias); } else send.warning(plugin, " §4AliasHashmap is null! - " + alias);

View File

@ -3,9 +3,8 @@ package net.t2code.alias.Spigot.system;
import net.t2code.alias.Spigot.Main; import net.t2code.alias.Spigot.Main;
import net.t2code.lib.Spigot.Lib.register.Register; import net.t2code.lib.Spigot.Lib.register.Register;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.permissions.Permission;
public class Alias_RegisterPermissions { public class AliasRegisterPermissions {
public static void onPermRegister() { public static void onPermRegister() {
for (String alias : Main.allAliases){ for (String alias : Main.allAliases){

View File

@ -1,7 +1,6 @@
package net.t2code.alias.Spigot.system; package net.t2code.alias.Spigot.system;
import net.t2code.alias.Spigot.Main; import net.t2code.alias.Spigot.Main;
import net.t2code.lib.Spigot.Lib.messages.send;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -10,7 +9,7 @@ import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
public class BCommand_Sender_Reciver { public class BCommandSenderReciver {
public static void sendToBungee(CommandSender sender, String information, Boolean console) { public static void sendToBungee(CommandSender sender, String information, Boolean console) {
ByteArrayOutputStream stream = new ByteArrayOutputStream(); ByteArrayOutputStream stream = new ByteArrayOutputStream();

View File

@ -1,7 +1,7 @@
package net.t2code.alias.Spigot.system; package net.t2code.alias.Spigot.system;
import net.t2code.alias.Spigot.Main; import net.t2code.alias.Spigot.Main;
import net.t2code.alias.Spigot.cmdManagement.Alias_CmdExecuter; import net.t2code.alias.Spigot.cmdManagement.AliasCmdExecuter;
import net.t2code.alias.Spigot.config.config.CreateConfig; import net.t2code.alias.Spigot.config.config.CreateConfig;
import net.t2code.alias.Spigot.config.config.CreateExampleAliasConfig; import net.t2code.alias.Spigot.config.config.CreateExampleAliasConfig;
import net.t2code.alias.Spigot.config.config.SelectAlias; import net.t2code.alias.Spigot.config.config.SelectAlias;
@ -22,7 +22,7 @@ public class Load {
static Plugin plugin = Main.plugin; static Plugin plugin = Main.plugin;
public static void onLoad(String prefix, List autor, String version, String spigot, int spigotID, String discord, int bstatsID) { public static void onLoad(String prefix, List autor, String version, String spigot, int spigotID, String discord, int bstatsID) {
Long long_ = T2CodeTemplate.onLoadHeader(prefix, autor, version, spigot, discord); Long long_ = T2CodeTemplate.onLoadHeader(prefix, autor, version, spigot, discord);
Main.plugin.getCommand("t2code-alias").setExecutor(new Alias_CmdExecuter()); Main.plugin.getCommand("t2code-alias").setExecutor(new AliasCmdExecuter());
loadReload(); loadReload();
UpdateAPI.onUpdateCheck(plugin, prefix, spigot, spigotID, discord); UpdateAPI.onUpdateCheck(plugin, prefix, spigot, spigotID, discord);
Bukkit.getServer().getPluginManager().registerEvents(new JoinEvent(), plugin); Bukkit.getServer().getPluginManager().registerEvents(new JoinEvent(), plugin);
@ -51,6 +51,6 @@ public class Load {
Main.plugin.getServer().getMessenger().registerOutgoingPluginChannel(Main.plugin, "BungeeCord"); Main.plugin.getServer().getMessenger().registerOutgoingPluginChannel(Main.plugin, "BungeeCord");
Bukkit.getMessenger().registerOutgoingPluginChannel(Main.plugin, "t2codealias:bungee"); Bukkit.getMessenger().registerOutgoingPluginChannel(Main.plugin, "t2codealias:bungee");
} }
Alias_RegisterPermissions.onPermRegister(); AliasRegisterPermissions.onPermRegister();
} }
} }

View File

@ -1,7 +1,7 @@
package net.t2code.alias; package net.t2code.alias;
public class Util { public class Util {
private static double requiredT2CodeLibVersion = 11.0; private static double requiredT2CodeLibVersion = 11.6;
private static String Prefix = "§8[§4T2Code§7-§aAlias§8]"; private static String Prefix = "§8[§4T2Code§7-§aAlias§8]";
private static Integer SpigotID = 96389; private static Integer SpigotID = 96389;
private static Integer BstatsID = 12517; private static Integer BstatsID = 12517;

View File

@ -22,8 +22,11 @@ permissions:
t2code.alias.updatemsg: true t2code.alias.updatemsg: true
t2code.alias.command.reload: true t2code.alias.command.reload: true
t2code.alias.command.info: true t2code.alias.command.info: true
t2code.alias.buy.bypass: true
t2code.alias.buy.bypass:
default: op
t2code.alias.updatemsg: t2code.alias.updatemsg:
default: op default: op
t2code.alias.command.reload: t2code.alias.command.reload: