This commit is contained in:
JaTiTV 2022-11-15 14:58:46 +01:00
parent 3053bc53a3
commit e96447d4fa
9 changed files with 83 additions and 30 deletions

View File

@ -6,7 +6,7 @@
<groupId>net.t2code</groupId>
<artifactId>Alias</artifactId>
<version>1.1.4</version>
<version>1.1.5</version>
<packaging>jar</packaging>
<name>T2C-Alias</name>
@ -69,7 +69,7 @@
<dependency>
<groupId>net.t2code</groupId>
<artifactId>T2CodeLib</artifactId>
<version>13.2</version>
<version>13.4</version>
</dependency>
<dependency>
<groupId>net.t2code</groupId>

View File

@ -35,7 +35,7 @@ public final class Main extends JavaPlugin {
autor = plugin.getDescription().getAuthors();
version = plugin.getDescription().getVersion();
if (pluginNotFound("T2CodeLib", 96388, Util.getRequiredT2CodeLibVersion())) return;
Load.onLoad(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getSpigotID(), Util.getDiscord(), Util.getBstatsID());
Load.onLoad(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord(), Util.getBstatsID());
}
@Override

View File

@ -53,7 +53,7 @@ public class ExecuteAlias {
T2Csend.player(player, SelectMessages.noMoney);
return;
}
if (SelectConfig.buyMessage) T2Csend.player(player, SelectMessages.buy.replace("[price]", aliasObject.costPrice.toString()));
if (SelectConfig.getBuyMessage()) T2Csend.player(player, SelectMessages.buy.replace("[price]", aliasObject.costPrice.toString()));
}
}
if (aliasObject.commandEnable) {
@ -102,7 +102,7 @@ public class ExecuteAlias {
T2Csend.player(player, SelectMessages.noMoney);
return;
}
if (SelectConfig.buyMessage) T2Csend.player(player, SelectMessages.buy.replace("[price]", aliasObject.costPrice.toString()));
if (SelectConfig.getBuyMessage()) T2Csend.player(player, SelectMessages.buy.replace("[price]", aliasObject.costPrice.toString()));
}
}
if (aliasObject.commandEnable) {
@ -122,7 +122,7 @@ public class ExecuteAlias {
if (alias.consoleCommandEnable) {
for (String cmd : alias.consoleCommands) {
if (alias.consoleBungeeCommand) {
if (SelectConfig.Bungee) {
if (SelectConfig.getBungee()) {
BCommandSenderReciver.sendToBungee(sender, cmd, true);
} else {
T2Csend.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
@ -151,7 +151,7 @@ public class ExecuteAlias {
if (alias.consoleCommandEnable) {
for (String cmd : alias.consoleCommands) {
if (alias.consoleBungeeCommand) {
if (SelectConfig.Bungee) {
if (SelectConfig.getBungee()) {
BCommandSenderReciver.sendToBungee(sender, cmd.replace("[target]", targetSt), true);
} else {
T2Csend.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
@ -179,7 +179,7 @@ public class ExecuteAlias {
}
for (String cmd : alias.adminCommands) {
if (alias.adminBungeeCommand) {
if (SelectConfig.Bungee) {
if (SelectConfig.getBungee()) {
BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()).replace("[target]", targetSt), alias.adminCommandAsConsole);
} else {
@ -206,7 +206,7 @@ public class ExecuteAlias {
}
for (String cmd : alias.adminCommands) {
if (alias.adminBungeeCommand) {
if (SelectConfig.Bungee) {
if (SelectConfig.getBungee()) {
BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()).replace("[target]", targetSt), alias.adminCommandAsConsole);
} else {
@ -271,7 +271,7 @@ public class ExecuteAlias {
}
for (String cmd : alias.command) {
if (alias.bungeeCommand) {
if (SelectConfig.Bungee) {
if (SelectConfig.getBungee()) {
BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()).replace("[target]", targetSt), alias.commandAsConsole);
} else {
@ -298,7 +298,7 @@ public class ExecuteAlias {
}
for (String cmd : alias.command) {
if (alias.bungeeCommand) {
if (SelectConfig.Bungee) {
if (SelectConfig.getBungee()) {
BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()).replace("[target]", targetSt), alias.commandAsConsole);
} else {

View File

@ -22,6 +22,9 @@ public class CreateConfig {
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);

View File

@ -1,6 +1,7 @@
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;
@ -8,14 +9,16 @@ import java.io.IOException;
public class SelectConfig {
private static Integer ConfigVersion = 3;
public static Integer isConfigVersion;
public static Boolean UpdateCheckOnJoin;
public static String language;
public static Boolean Bungee;
public static String thisServer;
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;
public static Boolean buyMessage;
public static Boolean subAliasTab;
private static Boolean buyMessage;
private static Boolean subAliasTab;
public static void onSelect() {
File config = new File(Main.getPath(), "config.yml");
@ -23,7 +26,11 @@ public class SelectConfig {
isConfigVersion = yamlConfiguration.getInt("ConfigVersion");
UpdateCheckOnJoin = yamlConfiguration.getBoolean("Plugin.UpdateCheckOnJoin");
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");
@ -41,4 +48,44 @@ public class SelectConfig {
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;
}
}

View File

@ -31,17 +31,17 @@ public class SelectMessages {
File msg;
msg = new File(Main.getPath(), "languages/" + SelectConfig.language + "_messages.yml");
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.language + " §4language file was not found.");
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.language;
} else selectMSG = SelectConfig.getLanguage();
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(msg);
if (yamlConfiguration.get("Plugin.Prefix") != null) {

View File

@ -20,13 +20,14 @@ import java.io.File;
import java.util.List;
public class Load {
private static Main plugin = Main.getPlugin();
private static final Main plugin = Main.getPlugin();
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<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, spigotID, discord);
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);
@ -65,11 +66,11 @@ public class Load {
T2Ctemplate.onLoadSeparateStroke(Util.getPrefix());
SelectSubAlias.onSelect();
SelectConfig.setConfigVersion();
if (SelectConfig.subAliasTab) {
if (SelectConfig.getSubAliasTab()) {
T2Cregister.listener(new TabEvent(), plugin);
}
if (SelectConfig.Bungee) {
if (SelectConfig.getBungee()) {
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "t2c:bcmd");
}
AliasRegisterPermissions.onPermRegister();

View File

@ -3,7 +3,6 @@
package net.t2code.alias.Spigot.system;
import net.t2code.alias.Spigot.Main;
import net.t2code.alias.Spigot.config.config.SelectConfig;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration;
@ -34,7 +33,6 @@ public class Metrics {
public static void Bstats(Plugin plugin, int bstatsID) {
int pluginId = bstatsID; // <-- Replace with the id of your plugin!
Metrics metrics = new Metrics((JavaPlugin) plugin, pluginId);
metrics.addCustomChart(new SimplePie("updatecheckonjoin", () -> String.valueOf(SelectConfig.UpdateCheckOnJoin)));
}
private final Plugin plugin;

View File

@ -8,7 +8,7 @@ public class Util {
}
public static String getRequiredT2CodeLibVersion() {
return "13.0";
return "13.4";
}
public static String getPrefix() {
@ -19,6 +19,10 @@ public class Util {
return 96389;
}
public static String getGit() {
return "JaTiTV/T2Code-Alias";
}
public static Integer getBstatsID() {
return 12517;
}