The option Bungee was removed from the config.yml and from now on the option from the T2CodeLib will be used.
This commit is contained in:
JaTiTV 2023-01-05 19:33:53 +01:00
parent 1ae32b2b59
commit 3e24492bfa
6 changed files with 63 additions and 40 deletions

View File

@ -6,7 +6,7 @@
<groupId>net.t2code</groupId>
<artifactId>Alias</artifactId>
<version>1.1.7</version>
<version>1.1.8</version>
<packaging>jar</packaging>
<name>T2C-Alias</name>
@ -19,6 +19,7 @@
<url>T2Code.net</url>
<build>
<finalName>${project.artifactId}_${project.version}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@ -69,22 +70,26 @@
<dependency>
<groupId>net.t2code</groupId>
<artifactId>T2CodeLib</artifactId>
<version>13.4</version>
<version>14.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.t2code</groupId>
<artifactId>bungee</artifactId>
<version>1615</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.t2code</groupId>
<artifactId>PlugmanGUI</artifactId>
<version>3.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.t2code.minecraft.1_13.r1</groupId>
<artifactId>spigot</artifactId>
<version>1.13r1</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@ -11,6 +11,8 @@ 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.t2codelib.SPIGOT.api.yaml.T2CLibConfig;
import net.t2code.t2codelib.SPIGOT.api.yaml.T2Cconfig;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -122,7 +124,7 @@ public class ExecuteAlias {
if (alias.consoleCommandEnable) {
for (String cmd : alias.consoleCommands) {
if (alias.consoleBungeeCommand) {
if (SelectConfig.getBungee()) {
if (T2CLibConfig.getBungee()) {
BCommandSenderReciver.sendToBungee(sender, cmd, true);
} else {
T2Csend.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
@ -152,7 +154,7 @@ public class ExecuteAlias {
for (String cmd : aliasObject.consoleCommands) {
String replace = cmd.replace("[target]", targetSt).replace("[alias]", alias);
if (aliasObject.consoleBungeeCommand) {
if (SelectConfig.getBungee()) {
if (T2CLibConfig.getBungee()) {
BCommandSenderReciver.sendToBungee(sender, replace, true);
} else {
T2Csend.console(Util.getPrefix() + " §4To use bungee commands, enable the Bungee option in the config.");
@ -180,7 +182,7 @@ public class ExecuteAlias {
}
for (String cmd : aliasObject.adminCommands) {
if (aliasObject.adminBungeeCommand) {
if (SelectConfig.getBungee()) {
if (T2CLibConfig.getBungee()) {
BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()).replace("[target]", targetSt).replace("[alias]", alias), aliasObject.adminCommandAsConsole);
} else {
@ -207,7 +209,7 @@ public class ExecuteAlias {
}
for (String cmd : aliasObject.adminCommands) {
if (aliasObject.adminBungeeCommand) {
if (SelectConfig.getBungee()) {
if (T2CLibConfig.getBungee()) {
BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()).replace("[target]", targetSt).replace("[alias]", alias), aliasObject.adminCommandAsConsole);
} else {
@ -272,7 +274,7 @@ public class ExecuteAlias {
}
for (String cmd : aliasObject.command) {
if (aliasObject.bungeeCommand) {
if (SelectConfig.getBungee()) {
if (T2CLibConfig.getBungee()) {
BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", 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.");
@ -298,7 +300,7 @@ public class ExecuteAlias {
}
for (String cmd : alias.command) {
if (alias.bungeeCommand) {
if (SelectConfig.getBungee()) {
if (T2CLibConfig.getBungee()) {
BCommandSenderReciver.sendToBungee(player, cmd.replace("[player]", player.getName()).replace("[target]", targetSt), alias.commandAsConsole);
} else {

View File

@ -21,16 +21,19 @@ public class CreateConfig {
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);
if (yamlConfiguration.contains("ConfigVersion") && yamlConfiguration.getInt("ConfigVersion") < 4) {
convert();
return;
}
T2Cconfig.set("Buy.Message", true, yamlConfiguration);
T2Cconfig.set("SubAlias.TabComplete", true, yamlConfiguration);
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("buy.message", true, yamlConfiguration);
T2Cconfig.set("subAlias.tabComplete", true, yamlConfiguration);
try {
yamlConfiguration.save(config);
@ -39,4 +42,29 @@ public class CreateConfig {
}
T2Csend.console(Util.getPrefix() + " §2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
}
private static void convert() {
File configOld = new File(Main.getPath(), "config.yml");
configOld.renameTo(new File(Main.getPath(), "configV3.yml"));
YamlConfiguration yamlConfigurationOld = YamlConfiguration.loadConfiguration(configOld);
File config = new File(Main.getPath(), "config.yml");
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
T2Cconfig.set("plugin.language", yamlConfigurationOld.getString("Plugin.language"), yamlConfiguration);
T2Cconfig.set("plugin.updateCheck.onJoin", yamlConfigurationOld.getBoolean("Plugin.updateCheck.onJoin"), yamlConfiguration);
T2Cconfig.set("plugin.updateCheck.seePreReleaseUpdates", yamlConfigurationOld.getBoolean("Plugin.updateCheck.seePreReleaseUpdates"), yamlConfiguration);
T2Cconfig.set("plugin.updateCheck.timeInterval", yamlConfigurationOld.getInt("Plugin.updateCheck.timeInterval"), yamlConfiguration);
T2Cconfig.set("buy.message", yamlConfigurationOld.getBoolean("Buy.Message"), yamlConfiguration);
T2Cconfig.set("subAlias.tabComplete", yamlConfigurationOld.getBoolean("SubAlias.TabComplete"), yamlConfiguration);
try {
yamlConfiguration.save(config);
} catch (IOException e) {
e.printStackTrace();
}
configCreate();
}
}

View File

@ -8,14 +8,12 @@ import java.io.File;
import java.io.IOException;
public class SelectConfig {
private static Integer ConfigVersion = 3;
private static Integer ConfigVersion = 4;
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;
@ -24,24 +22,21 @@ public class SelectConfig {
File config = new File(Main.getPath(), "config.yml");
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
isConfigVersion = yamlConfiguration.getInt("ConfigVersion");
isConfigVersion = yamlConfiguration.getInt("configVersion");
updateCheckOnJoin = yamlConfiguration.getBoolean("Plugin.updateCheck.onJoin");
updateCheckSeePreReleaseUpdates = yamlConfiguration.getBoolean("Plugin.updateCheck.seePreReleaseUpdates");
updateCheckTimeInterval = yamlConfiguration.getInt("Plugin.updateCheck.timeInterval");
updateCheckOnJoin = yamlConfiguration.getBoolean("plugin.updateCheck.onJoin");
updateCheckSeePreReleaseUpdates = yamlConfiguration.getBoolean("plugin.updateCheck.seePreReleaseUpdates");
updateCheckTimeInterval = yamlConfiguration.getInt("plugin.updateCheck.timeInterval");
language = yamlConfiguration.getString("plugin.language");
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");
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);
yamlConfiguration.set("configVersion", ConfigVersion);
try {
yamlConfiguration.save(config);
} catch (IOException e) {
@ -73,14 +68,6 @@ public class SelectConfig {
return language;
}
public static Boolean getBungee() {
return Bungee;
}
public static String getThisServer() {
return thisServer;
}
public static Boolean getBuyMessage() {
return buyMessage;
}

View File

@ -14,6 +14,7 @@ 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.t2codelib.SPIGOT.api.yaml.T2CLibConfig;
import org.bukkit.Bukkit;
import java.io.File;
@ -70,7 +71,7 @@ public class Load {
T2Cregister.listener(new TabEvent(), plugin);
}
if (SelectConfig.getBungee()) {
if (T2CLibConfig.getBungee()) {
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "t2c:bcmd");
}
AliasRegisterPermissions.onPermRegister();

View File

@ -8,7 +8,7 @@ public class Util {
}
public static String getRequiredT2CodeLibVersion() {
return "13.4";
return "14.2";
}
public static String getPrefix() {