Bugfix:
- A bug in the permission query was fixed
This commit is contained in:
JaTiTV 2022-01-21 21:03:11 +01:00
parent 2a098d6977
commit 1a5e39f99f
13 changed files with 9 additions and 28 deletions

View File

@ -6,7 +6,7 @@
<groupId>de.jatitv</groupId> <groupId>de.jatitv</groupId>
<artifactId>OPSecurity</artifactId> <artifactId>OPSecurity</artifactId>
<version>2.4.1</version> <version>2.4.2</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>OPSecurity</name> <name>OPSecurity</name>

View File

@ -29,12 +29,14 @@ public class Commands {
} }
if (sender.hasPermission(Permissions.help)) { if (sender.hasPermission(Permissions.help)) {
SelectConfig.Help(sender); SelectConfig.Help(sender);
} else sender.sendMessage(Util.getPrefix() + " §cYou do not have permission for OPSecurity!"); } else {
sender.sendMessage(Util.getPrefix() + " §cYou do not have permission for OPSecurity! §7<" + Permissions.help + ">");
}
} }
public static void reload(CommandSender sender) { public static void reload(CommandSender sender) {
if (!sender.hasPermission(Permissions.reload)) { if (!sender.hasPermission(Permissions.reload)) {
sender.sendMessage(Util.getPrefix() + "§cYou do not have permission for OPSecurity!"); sender.sendMessage(Util.getPrefix() + "§cYou do not have permission for OPSecurity! §7<" + Permissions.reload + ">");
return; return;
} }
if (sender instanceof Player) { if (sender instanceof Player) {
@ -62,7 +64,7 @@ public class Commands {
public static void info(CommandSender sender) { public static void info(CommandSender sender) {
if (!sender.hasPermission(Permissions.info)) { if (!sender.hasPermission(Permissions.info)) {
sender.sendMessage(Util.getPrefix() + "§cYou do not have permission for OPSecurity!"); sender.sendMessage(Util.getPrefix() + "§cYou do not have permission for OPSecurity! §7<" + Permissions.info + ">");
return; return;
} }
T2CodeTemplate.sendInfo(sender, Util.getPrefix(), Util.getSpigot(), Util.getDiscord(), Main.autor, Main.version, UpdateAPI.PluginVersionen.get(Main.plugin.getName()).publicVersion); T2CodeTemplate.sendInfo(sender, Util.getPrefix(), Util.getSpigot(), Util.getDiscord(), Main.autor, Main.version, UpdateAPI.PluginVersionen.get(Main.plugin.getName()).publicVersion);

View File

@ -52,7 +52,6 @@ public class ConfigConvert {
File config = new File(Main.plugin.getDataFolder().getPath(), "config.yml"); File config = new File(Main.plugin.getDataFolder().getPath(), "config.yml");
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config); YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
if (yamlConfiguration.get("ConfigVersion") == null) { if (yamlConfiguration.get("ConfigVersion") == null) {
try { try {
if (yamlConfiguration.get("Plugin.language") != null) { if (yamlConfiguration.get("Plugin.language") != null) {
@ -107,13 +106,10 @@ public class ConfigConvert {
} }
} }
List<String> oldOPs = yamlConfiguration.getStringList("OP_Whitelist.Whitelist"); List<String> oldOPs = yamlConfiguration.getStringList("OP_Whitelist.Whitelist");
yamlConfiguration.set("OP_Whitelist.Whitelist", null); yamlConfiguration.set("OP_Whitelist.Whitelist", null);
convertPlayer("OP_Whitelist.Whitelist", "OP_Whitelist.Whitelist.", oldOPs, yamlConfiguration); convertPlayer("OP_Whitelist.Whitelist", "OP_Whitelist.Whitelist.", oldOPs, yamlConfiguration);
List<String> oldPerms = yamlConfiguration.getStringList("Permission_Whitelist.Player"); List<String> oldPerms = yamlConfiguration.getStringList("Permission_Whitelist.Player");
yamlConfiguration.set("Permission_Whitelist.Player", null); yamlConfiguration.set("Permission_Whitelist.Player", null);
convertPlayer("Permission_Whitelist.Player", "Permission_Whitelist.Whitelist.", oldPerms, yamlConfiguration); convertPlayer("Permission_Whitelist.Player", "Permission_Whitelist.Whitelist.", oldPerms, yamlConfiguration);
@ -122,8 +118,6 @@ public class ConfigConvert {
} catch (IOException tac) { } catch (IOException tac) {
tac.printStackTrace(); tac.printStackTrace();
} }
} }
} }
public static void convert(String oldConfig, String newConfig) { public static void convert(String oldConfig, String newConfig) {
@ -156,7 +150,6 @@ public class ConfigConvert {
private static void renameLanguages() { private static void renameLanguages() {
String replace = Main.getPath().toString() + "/languages/"; String replace = Main.getPath().toString() + "/languages/";
Path messagesDEold = Paths.get(Main.getPath() + "/languages/de_DE_Messages.yml"); Path messagesDEold = Paths.get(Main.getPath() + "/languages/de_DE_Messages.yml");
Path messagesDE = Paths.get(Main.getPath() + "/languages/german_messages.yml"); Path messagesDE = Paths.get(Main.getPath() + "/languages/german_messages.yml");
if(Files.exists(messagesDEold) && !Files.isDirectory(messagesDEold)) { if(Files.exists(messagesDEold) && !Files.isDirectory(messagesDEold)) {

View File

@ -94,7 +94,6 @@ public class CreateConfig {
set("Notify.Sound.Sound", Notify_Sound_1_9_to_1_12, yamlConfiguration); set("Notify.Sound.Sound", Notify_Sound_1_9_to_1_12, yamlConfiguration);
} else set("Notify.Sound.Sound", Notify_Sound_from_1_13, yamlConfiguration); } else set("Notify.Sound.Sound", Notify_Sound_from_1_13, yamlConfiguration);
set("OP_Whitelist.Enable", OP_Whitelist_Enable, yamlConfiguration); set("OP_Whitelist.Enable", OP_Whitelist_Enable, yamlConfiguration);
set("OP_Whitelist.PlayerMustBeOnlineToOp", PlayerMustBeOnlineToOp, yamlConfiguration); set("OP_Whitelist.PlayerMustBeOnlineToOp", PlayerMustBeOnlineToOp, yamlConfiguration);
if (yamlConfiguration.get("OP_Whitelist.Whitelist") == null) { if (yamlConfiguration.get("OP_Whitelist.Whitelist") == null) {
@ -102,7 +101,6 @@ public class CreateConfig {
set("OP_Whitelist.Whitelist." + OP_Whitelist_P2 + ".UUID", OP_Whitelist_P2UUID, yamlConfiguration); set("OP_Whitelist.Whitelist." + OP_Whitelist_P2 + ".UUID", OP_Whitelist_P2UUID, yamlConfiguration);
} }
set("OP_Whitelist.noOpPlayerDeop.Enable", no_OP_Player_deop, yamlConfiguration); set("OP_Whitelist.noOpPlayerDeop.Enable", no_OP_Player_deop, yamlConfiguration);
set("OP_Whitelist.noOpPlayerDeop.PlayerSendMessage", sendPlayerDEOPmsg, yamlConfiguration); set("OP_Whitelist.noOpPlayerDeop.PlayerSendMessage", sendPlayerDEOPmsg, yamlConfiguration);
set("OP_Whitelist.noOpPlayerKick.Enable", no_OP_Player_kick, yamlConfiguration); set("OP_Whitelist.noOpPlayerKick.Enable", no_OP_Player_kick, yamlConfiguration);
@ -117,7 +115,6 @@ public class CreateConfig {
set("Permission_Whitelist.Whitelist." + Perm_Whitelist_P2 + ".UUID", Perm_Whitelist_P2UUID, yamlConfiguration); set("Permission_Whitelist.Whitelist." + Perm_Whitelist_P2 + ".UUID", Perm_Whitelist_P2UUID, yamlConfiguration);
} }
set("Permission_Whitelist.PlayerWhithPermission_kick", PlayerWhithPermission_kick, yamlConfiguration); set("Permission_Whitelist.PlayerWhithPermission_kick", PlayerWhithPermission_kick, yamlConfiguration);
set("Permission_Whitelist.customCommands.Enable", Perm_Command_enable, yamlConfiguration); set("Permission_Whitelist.customCommands.Enable", Perm_Command_enable, yamlConfiguration);
set("Permission_Whitelist.customCommands.Commands", Perm_Command, yamlConfiguration); set("Permission_Whitelist.customCommands.Commands", Perm_Command, yamlConfiguration);
@ -127,7 +124,6 @@ public class CreateConfig {
//set("LuckPerms_Whitelist.Whitelist", LP_Whitelist, yamlConfiguration); //set("LuckPerms_Whitelist.Whitelist", LP_Whitelist, yamlConfiguration);
try { try {
yamlConfiguration.save(configYML); yamlConfiguration.save(configYML);
} catch (IOException e) { } catch (IOException e) {

View File

@ -6,6 +6,7 @@ import de.jatitv.opsecurity.Util;
import de.jatitv.opsecurity.objects.PlayerObject; import de.jatitv.opsecurity.objects.PlayerObject;
import de.jatitv.opsecurity.system.Main; import de.jatitv.opsecurity.system.Main;
import de.jatitv.opsecurity.system.Permissions; import de.jatitv.opsecurity.system.Permissions;
import net.t2code.lib.Spigot.Lib.messages.send;
import net.t2code.lib.Spigot.Lib.yamlConfiguration.Config; import net.t2code.lib.Spigot.Lib.yamlConfiguration.Config;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -64,12 +65,11 @@ public class SelectConfig {
//help //help
public static void Help(CommandSender sender) { public static void Help(CommandSender sender) {
if (sender.hasPermission(Permissions.help)) { if (!sender.hasPermission(Permissions.help)) {
sender.sendMessage(Util.getPrefix() + "§cYou do not have permission for OPSecurity!"); sender.sendMessage(Util.getPrefix() + " §cYou do not have permission for OPSecurity! §7<" + Permissions.help + ">");
return; return;
} }
sender.sendMessage(Util.getPrefix() + " §8----- §2OP§4Security §chelp §8-----"); sender.sendMessage(Util.getPrefix() + " §8----- §2OP§4Security §chelp §8-----");
sender.sendMessage(Util.getPrefix()); sender.sendMessage(Util.getPrefix());
sender.sendMessage(Util.getPrefix() + " §8'§b/opsecurity reload§8' §eReload the Plugin."); sender.sendMessage(Util.getPrefix() + " §8'§b/opsecurity reload§8' §eReload the Plugin.");
@ -103,7 +103,6 @@ public class SelectConfig {
Notify_Sound_Enable = yamlConfiguration.getBoolean("Notify.Sound.Enable"); Notify_Sound_Enable = yamlConfiguration.getBoolean("Notify.Sound.Enable");
Notify_Sound_input = yamlConfiguration.getString("Notify.Sound.Sound"); Notify_Sound_input = yamlConfiguration.getString("Notify.Sound.Sound");
OP_Whitelist_Enable = yamlConfiguration.getBoolean("OP_Whitelist.Enable"); OP_Whitelist_Enable = yamlConfiguration.getBoolean("OP_Whitelist.Enable");
PlayerMustBeOnlineToOp = yamlConfiguration.getBoolean("OP_Whitelist.PlayerMustBeOnlineToOp"); PlayerMustBeOnlineToOp = yamlConfiguration.getBoolean("OP_Whitelist.PlayerMustBeOnlineToOp");

View File

@ -37,7 +37,6 @@ public class LanguagesCreate {
set("Permission_Whitelist.consoleKick", MSG.DE_Perm_consoleKick, yamlConfigurationDE); set("Permission_Whitelist.consoleKick", MSG.DE_Perm_consoleKick, yamlConfigurationDE);
set("Console.ExactKickReason", MSG.DE_ExactKickReason, yamlConfigurationDE); set("Console.ExactKickReason", MSG.DE_ExactKickReason, yamlConfigurationDE);
try { try {
yamlConfigurationDE.save(messagesDE); yamlConfigurationDE.save(messagesDE);
} catch (IOException e) { } catch (IOException e) {

View File

@ -82,5 +82,4 @@ public class SelectMessages {
private static String select(String path, YamlConfiguration yamlConfiguration) { private static String select(String path, YamlConfiguration yamlConfiguration) {
return Replace.replace(Util.getPrefix(),yamlConfiguration.getString(path)); return Replace.replace(Util.getPrefix(),yamlConfiguration.getString(path));
} }
} }

View File

@ -36,7 +36,6 @@ public class OPCommand implements Listener {
break; break;
} }
} }
} }
@EventHandler @EventHandler

View File

@ -15,7 +15,6 @@ public class PlugManCommand implements Listener {
@EventHandler @EventHandler
public void onOPServer(ServerCommandEvent event) { public void onOPServer(ServerCommandEvent event) {
if ((event.getCommand().toLowerCase().contains("plugman disable") && event.getCommand().toLowerCase().contains(Main.plugin.getDescription().getName().toLowerCase())) if ((event.getCommand().toLowerCase().contains("plugman disable") && event.getCommand().toLowerCase().contains(Main.plugin.getDescription().getName().toLowerCase()))
|| (event.getCommand().toLowerCase().contains("plugman reload") && event.getCommand().toLowerCase().contains(Main.plugin.getDescription().getName().toLowerCase())) || (event.getCommand().toLowerCase().contains("plugman reload") && event.getCommand().toLowerCase().contains(Main.plugin.getDescription().getName().toLowerCase()))
|| (event.getCommand().toLowerCase().contains("plugman unload") && event.getCommand().toLowerCase().contains(Main.plugin.getDescription().getName().toLowerCase())) || (event.getCommand().toLowerCase().contains("plugman unload") && event.getCommand().toLowerCase().contains(Main.plugin.getDescription().getName().toLowerCase()))
@ -28,7 +27,6 @@ public class PlugManCommand implements Listener {
@EventHandler @EventHandler
public void onOpPlayer(PlayerCommandPreprocessEvent event) { public void onOpPlayer(PlayerCommandPreprocessEvent event) {
if (event.getMessage().toLowerCase().startsWith("/plugman disable") && event.getMessage().toLowerCase().contains(Main.plugin.getDescription().getName().toLowerCase()) if (event.getMessage().toLowerCase().startsWith("/plugman disable") && event.getMessage().toLowerCase().contains(Main.plugin.getDescription().getName().toLowerCase())
|| (event.getMessage().toLowerCase().startsWith("/plugman reload") && event.getMessage().toLowerCase().contains(Main.plugin.getDescription().getName().toLowerCase())) || (event.getMessage().toLowerCase().startsWith("/plugman reload") && event.getMessage().toLowerCase().contains(Main.plugin.getDescription().getName().toLowerCase()))
|| (event.getMessage().toLowerCase().startsWith("/plugman unload") && event.getMessage().toLowerCase().contains(Main.plugin.getDescription().getName().toLowerCase())) || (event.getMessage().toLowerCase().startsWith("/plugman unload") && event.getMessage().toLowerCase().contains(Main.plugin.getDescription().getName().toLowerCase()))

View File

@ -61,7 +61,6 @@ public class Load {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
try { try {
Timer.RefreshTimer(); Timer.RefreshTimer();
} catch (Exception e) { } catch (Exception e) {

View File

@ -26,7 +26,6 @@ public final class Main extends JavaPlugin {
public static HashMap<String, PlayerObject> opHashMap = new HashMap<String, PlayerObject>(); public static HashMap<String, PlayerObject> opHashMap = new HashMap<String, PlayerObject>();
public static HashMap<String, PlayerObject> permissionHashMap = new HashMap<String, PlayerObject>(); public static HashMap<String, PlayerObject> permissionHashMap = new HashMap<String, PlayerObject>();
@Override @Override
public void onEnable() { public void onEnable() {
// Plugin startup logic // Plugin startup logic

View File

@ -17,7 +17,6 @@ import java.util.UUID;
public class NameHistory { public class NameHistory {
/** /**
* The URL from Mojang API that provides the JSON String in response. * The URL from Mojang API that provides the JSON String in response.
*/ */

View File

@ -28,6 +28,5 @@ public class Permissions {
Register.permission(admin, op, reload, true, Main.plugin); Register.permission(admin, op, reload, true, Main.plugin);
Register.permission(admin, op, info, true, Main.plugin); Register.permission(admin, op, info, true, Main.plugin);
Register.permission(admin, op, help, true, Main.plugin); Register.permission(admin, op, help, true, Main.plugin);
} }
} }