4 Commits
1.1.6 ... 1.1.8

Author SHA1 Message Date
3e24492bfa 1.1.8
The option Bungee was removed from the config.yml and from now on the option from the T2CodeLib will be used.
2023-01-05 19:33:53 +01:00
1ae32b2b59 stable 1.1.7 2022-12-21 10:52:47 +01:00
93f63ffad0 Default config was changed
The admin area was set to false in the default config.
2022-12-21 10:43:45 +01:00
2d49a7a4b7 bugfix for < 1.13 Server
Fixed a bug where you could not reload the plugin (/t2c-alias reload) when using a server below 1.13
2022-12-21 10:35:35 +01:00
11 changed files with 78 additions and 50 deletions

13
pom.xml
View File

@@ -6,7 +6,7 @@
<groupId>net.t2code</groupId>
<artifactId>Alias</artifactId>
<version>1.1.6</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_19.r1</groupId>
<groupId>net.t2code.minecraft.1_13.r1</groupId>
<artifactId>spigot</artifactId>
<version>1.19r1</version>
<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

@@ -39,7 +39,7 @@ public class CreateExampleAliasConfig {
T2Cconfig.set("Alias.Message.Enable", false, yamlConfiguration);
T2Cconfig.set("Alias.Message.Messages", Arrays.asList(), yamlConfiguration);
T2Cconfig.set("Alias.Admin.Enable", true, 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);

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

@@ -40,7 +40,7 @@ public class CreateExampleSubAliasConfig {
T2Cconfig.set("SubAlias.Message.Enable", false, yamlConfiguration);
T2Cconfig.set("SubAlias.Message.Messages",Arrays.asList(), yamlConfiguration);
T2Cconfig.set("SubAlias.Admin.Enable", true, 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);

View File

@@ -4,6 +4,7 @@ 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;
@@ -27,9 +28,13 @@ public class AliasRegister {
// 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();
}

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() {

View File

@@ -74,7 +74,7 @@ Alias:
# Player with Admin Perm: /server CityBuild
Admin:
# Here you can enable or disable the admin function
Enable: true
Enable: false
# Here you set the permission for the admin function
Permission: t2code.alias.admin
Command:

View File

@@ -73,7 +73,7 @@ SubAlias:
# Player with Admin Perm: /server CityBuild
Admin:
# Here you can enable or disable the admin function
Enable: true
Enable: false
# Here you set the permission for the admin function
Permission: t2code.alias.admin
Command: