This commit is contained in:
JaTiTV 2023-07-16 08:22:30 +02:00
parent cdd375a673
commit de6ecdf7a8
8 changed files with 69 additions and 9 deletions

View File

@ -6,7 +6,7 @@
<groupId>net.t2code</groupId> <groupId>net.t2code</groupId>
<artifactId>T2CodeLib</artifactId> <artifactId>T2CodeLib</artifactId>
<version>15.7</version> <version>15.8_dev</version>
<!--version>VERSION_snapshot-0</version--> <!--version>VERSION_snapshot-0</version-->
<!--version>VERSION_beta-0</version--> <!--version>VERSION_beta-0</version-->
<!--version>VERSION_dev-0</version--> <!--version>VERSION_dev-0</version-->

View File

@ -21,6 +21,7 @@ public class T2CmcVersion {
mc1_18 = nms.contains("1_18"); mc1_18 = nms.contains("1_18");
mc1_19 = nms.contains("1_19"); mc1_19 = nms.contains("1_19");
mc1_20 = nms.contains("1_20"); mc1_20 = nms.contains("1_20");
mc1_21 = nms.contains("1_21");
nms1_8_R1 = nms.contains("1_8_R1"); nms1_8_R1 = nms.contains("1_8_R1");
nms1_8_R2 = nms.contains("1_8_R2"); nms1_8_R2 = nms.contains("1_8_R2");
@ -44,6 +45,7 @@ public class T2CmcVersion {
nms1_19_R2 = nms.contains("1_19_R2"); nms1_19_R2 = nms.contains("1_19_R2");
nms1_20_R1 = nms.contains("1_20_R1"); nms1_20_R1 = nms.contains("1_20_R1");
nms1_20_R2 = nms.contains("1_20_R2"); nms1_20_R2 = nms.contains("1_20_R2");
nms1_21_R1 = nms.contains("1_21_R1");
} }
private static String mcVersion; private static String mcVersion;
@ -61,6 +63,7 @@ public class T2CmcVersion {
private static boolean mc1_18; private static boolean mc1_18;
private static boolean mc1_19; private static boolean mc1_19;
private static boolean mc1_20; private static boolean mc1_20;
private static boolean mc1_21;
private static String nms; private static String nms;
private static boolean nms1_8_R1; private static boolean nms1_8_R1;
@ -85,6 +88,7 @@ public class T2CmcVersion {
private static boolean nms1_19_R2; private static boolean nms1_19_R2;
private static boolean nms1_20_R1; private static boolean nms1_20_R1;
private static boolean nms1_20_R2; private static boolean nms1_20_R2;
private static boolean nms1_21_R1;
public static String getMcVersion() { public static String getMcVersion() {
return mcVersion; return mcVersion;
@ -145,6 +149,9 @@ public class T2CmcVersion {
public static boolean isMc1_20() { public static boolean isMc1_20() {
return mc1_20; return mc1_20;
} }
public static boolean isMc1_21() {
return mc1_21;
}
public static String getNms() { public static String getNms() {
return nms; return nms;
@ -237,6 +244,9 @@ public class T2CmcVersion {
public static boolean isNms1_20_R2() { public static boolean isNms1_20_R2() {
return nms1_20_R2; return nms1_20_R2;
} }
public static boolean isNms1_21_R1() {
return nms1_21_R1;
}
public static boolean minMc1_8() { public static boolean minMc1_8() {

View File

@ -65,7 +65,20 @@ public final class T2CodeLibMain extends JavaPlugin {
if (T2CmcVersion.isNms1_20_R2()) { if (T2CmcVersion.isNms1_20_R2()) {
T2Csend.console(prefix + " §4!!!!!!!!!!!!!!!!!!!!"); T2Csend.console(prefix + " §4!!!!!!!!!!!!!!!!!!!!");
T2Csend.console(prefix); T2Csend.console(prefix);
T2Csend.warning(plugin, "The 1.20.* (R2) is a very fresh / new version. If there are any bugs in our plugins, please report them to us via our Discord: http://dc.t2code.net"); T2Csend.warning(plugin, "The 1.20.* (NMS R2) is a very fresh / new version. If there are any bugs in our plugins, please report them to us via our Discord: http://dc.t2code.net");
T2Csend.console(prefix);
T2Csend.console(prefix + " §4!!!!!!!!!!!!!!!!!!!!");
if (!SelectLibConfig.getT2cTestDevelopment()) {
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}if (T2CmcVersion.isMc1_21()) {
T2Csend.console(prefix + " §4!!!!!!!!!!!!!!!!!!!!");
T2Csend.console(prefix);
T2Csend.warning(plugin, "The 1.21 is a very fresh / new version. If there are any bugs in our plugins, please report them to us via our Discord: http://dc.t2code.net");
T2Csend.console(prefix); T2Csend.console(prefix);
T2Csend.console(prefix + " §4!!!!!!!!!!!!!!!!!!!!"); T2Csend.console(prefix + " §4!!!!!!!!!!!!!!!!!!!!");
if (!SelectLibConfig.getT2cTestDevelopment()) { if (!SelectLibConfig.getT2cTestDevelopment()) {

View File

@ -45,6 +45,13 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
} }
Commands.info(sender); Commands.info(sender);
return false; return false;
case "permtoggle":
if (!sender.hasPermission("t2code.permtoggle.use")) {
T2Csend.sender(sender, "§4No Permission §8t2code.permtoggle.use");
return false;
}
Commands.permtoggle(sender, args);
return false;
case "updateinfo": case "updateinfo":
if (!sender.hasPermission("t2code.admin")) { if (!sender.hasPermission("t2code.admin")) {
T2Csend.sender(sender, "§4No Permission §8t2code.admin"); T2Csend.sender(sender, "§4No Permission §8t2code.admin");

View File

@ -1,9 +1,11 @@
package net.t2code.t2codelib.SPIGOT.system.cmd; package net.t2code.t2codelib.SPIGOT.system.cmd;
import net.t2code.t2codelib.SPIGOT.api.commands.T2Ccmd;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend; import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate; import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI; import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain; import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
import net.t2code.t2codelib.SPIGOT.system.config.config.SelectLibConfig;
import net.t2code.t2codelib.Util; import net.t2code.t2codelib.Util;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -83,4 +85,23 @@ public class Commands {
protected static void updateInfo(CommandSender sender, String[] args) { protected static void updateInfo(CommandSender sender, String[] args) {
T2Csend.sender(sender, T2CupdateAPI.updateInfo(args, sender instanceof Player)); T2Csend.sender(sender, T2CupdateAPI.updateInfo(args, sender instanceof Player));
} }
public static void permtoggle(CommandSender sender, String[] args) {
Player player = (Player) Bukkit.getOfflinePlayer(args[1]);
if (player == null) {
T2Csend.sender(sender, "§4Player §6" + args[1] + " §4not exist!");
return;
}
String permission = args[2];
if (player.hasPermission(permission)) {
T2Ccmd.console(SelectLibConfig.getCommandPermToggleCommand().replace("[player]",player.getName()).replace("[perm]",permission).replace("[value]", "false"));
T2Csend.sender(sender, "§2Permission §8'§6" + permission + "§8' §2was set to §6false §2for the player §6" + player.getName() + "§2.");
} else {
T2Ccmd.console(SelectLibConfig.getCommandPermToggleCommand().replace("[player]",player.getName()).replace("[perm]",permission).replace("[value]", "true"));
T2Csend.sender(sender, "§2Permission §8'§6" + permission + "§8' §2was set to §6true §2for the player §6" + player.getName() + "§2.");
}
}
} }

View File

@ -33,6 +33,8 @@ public class ConfigCreate {
T2Cconfig.set("BungeeCord.Enable", T2CodeLibMain.getIsBungee(), yamlConfiguration); T2Cconfig.set("BungeeCord.Enable", T2CodeLibMain.getIsBungee(), yamlConfiguration);
T2Cconfig.set("Player.Inventories.CloseByServerStop", true, yamlConfiguration); T2Cconfig.set("Player.Inventories.CloseByServerStop", true, yamlConfiguration);
T2Cconfig.set("Command.PermToggle.PermissionSetCommand","lp user [player] permission set [perm] [value]",yamlConfiguration);
try { try {
yamlConfiguration.save(config); yamlConfiguration.save(config);
} catch (IOException e) { } catch (IOException e) {

View File

@ -28,6 +28,8 @@ public class SelectLibConfig {
private static Boolean bungee; private static Boolean bungee;
@Getter @Getter
private static Boolean inventoriesCloseByServerStop; private static Boolean inventoriesCloseByServerStop;
@Getter
private static String commandPermToggleCommand;
public static void onSelect() { public static void onSelect() {
File config = new File(T2CodeLibMain.getPath(), "config.yml"); File config = new File(T2CodeLibMain.getPath(), "config.yml");
@ -46,5 +48,6 @@ public class SelectLibConfig {
developerTool = yamlConfiguration.getBoolean("Plugin.Not recommended to disable.developerTool"); developerTool = yamlConfiguration.getBoolean("Plugin.Not recommended to disable.developerTool");
bungee = yamlConfiguration.getBoolean("BungeeCord.Enable"); bungee = yamlConfiguration.getBoolean("BungeeCord.Enable");
inventoriesCloseByServerStop = yamlConfiguration.getBoolean("Player.Inventories.CloseByServerStop"); inventoriesCloseByServerStop = yamlConfiguration.getBoolean("Player.Inventories.CloseByServerStop");
commandPermToggleCommand = yamlConfiguration.getString("Command.PermToggle.PermissionSetCommand");
} }
} }

View File

@ -29,3 +29,7 @@ commands:
permissions: permissions:
t2code.admin: t2code.admin:
default: op default: op
children:
t2code.permtoggle.use: true
t2code.permtoggle.use:
default: op