5 Commits

Author SHA1 Message Date
1a5e39f99f 2.4.2
Bugfix:
- A bug in the permission query was fixed
2022-01-21 21:03:11 +01:00
JaTiTV
2a098d6977 Merge pull request '2.4.1 | WorldGuard bug' (#3) from OPsecurity-+-worldguard-flag-bug into main
Reviewed-on: JaTiTV/OPSecurity#3
2022-01-09 23:30:05 +01:00
d60cc4b69f Update pom.xml 2022-01-09 23:26:57 +01:00
3e6459d301 2.4.1_Snapshot_1 2022-01-09 05:12:20 +01:00
0bfbeac52d fix worldguard block-command bug 2022-01-09 05:11:31 +01:00
13 changed files with 17 additions and 30 deletions

View File

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

View File

@@ -29,12 +29,14 @@ public class Commands {
}
if (sender.hasPermission(Permissions.help)) {
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) {
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;
}
if (sender instanceof Player) {
@@ -62,7 +64,7 @@ public class Commands {
public static void info(CommandSender sender) {
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;
}
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");
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
if (yamlConfiguration.get("ConfigVersion") == null) {
try {
if (yamlConfiguration.get("Plugin.language") != null) {
@@ -107,13 +106,10 @@ public class ConfigConvert {
}
}
List<String> oldOPs = yamlConfiguration.getStringList("OP_Whitelist.Whitelist");
yamlConfiguration.set("OP_Whitelist.Whitelist", null);
convertPlayer("OP_Whitelist.Whitelist", "OP_Whitelist.Whitelist.", oldOPs, yamlConfiguration);
List<String> oldPerms = yamlConfiguration.getStringList("Permission_Whitelist.Player");
yamlConfiguration.set("Permission_Whitelist.Player", null);
convertPlayer("Permission_Whitelist.Player", "Permission_Whitelist.Whitelist.", oldPerms, yamlConfiguration);
@@ -122,8 +118,6 @@ public class ConfigConvert {
} catch (IOException tac) {
tac.printStackTrace();
}
}
}
public static void convert(String oldConfig, String newConfig) {
@@ -156,7 +150,6 @@ public class ConfigConvert {
private static void renameLanguages() {
String replace = Main.getPath().toString() + "/languages/";
Path messagesDEold = Paths.get(Main.getPath() + "/languages/de_DE_Messages.yml");
Path messagesDE = Paths.get(Main.getPath() + "/languages/german_messages.yml");
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);
} else set("Notify.Sound.Sound", Notify_Sound_from_1_13, yamlConfiguration);
set("OP_Whitelist.Enable", OP_Whitelist_Enable, yamlConfiguration);
set("OP_Whitelist.PlayerMustBeOnlineToOp", PlayerMustBeOnlineToOp, yamlConfiguration);
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.noOpPlayerDeop.Enable", no_OP_Player_deop, yamlConfiguration);
set("OP_Whitelist.noOpPlayerDeop.PlayerSendMessage", sendPlayerDEOPmsg, 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.PlayerWhithPermission_kick", PlayerWhithPermission_kick, yamlConfiguration);
set("Permission_Whitelist.customCommands.Enable", Perm_Command_enable, yamlConfiguration);
set("Permission_Whitelist.customCommands.Commands", Perm_Command, yamlConfiguration);
@@ -127,7 +124,6 @@ public class CreateConfig {
//set("LuckPerms_Whitelist.Whitelist", LP_Whitelist, yamlConfiguration);
try {
yamlConfiguration.save(configYML);
} catch (IOException e) {

View File

@@ -6,6 +6,7 @@ import de.jatitv.opsecurity.Util;
import de.jatitv.opsecurity.objects.PlayerObject;
import de.jatitv.opsecurity.system.Main;
import de.jatitv.opsecurity.system.Permissions;
import net.t2code.lib.Spigot.Lib.messages.send;
import net.t2code.lib.Spigot.Lib.yamlConfiguration.Config;
import org.bukkit.Sound;
import org.bukkit.command.CommandSender;
@@ -64,12 +65,11 @@ public class SelectConfig {
//help
public static void Help(CommandSender sender) {
if (sender.hasPermission(Permissions.help)) {
sender.sendMessage(Util.getPrefix() + "§cYou do not have permission for OPSecurity!");
if (!sender.hasPermission(Permissions.help)) {
sender.sendMessage(Util.getPrefix() + " §cYou do not have permission for OPSecurity! §7<" + Permissions.help + ">");
return;
}
sender.sendMessage(Util.getPrefix() + " §8----- §2OP§4Security §chelp §8-----");
sender.sendMessage(Util.getPrefix());
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_input = yamlConfiguration.getString("Notify.Sound.Sound");
OP_Whitelist_Enable = yamlConfiguration.getBoolean("OP_Whitelist.Enable");
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("Console.ExactKickReason", MSG.DE_ExactKickReason, yamlConfigurationDE);
try {
yamlConfigurationDE.save(messagesDE);
} catch (IOException e) {

View File

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

View File

@@ -17,7 +17,10 @@ public class Events implements org.bukkit.event.Listener {
public void CommandSendEvent(PlayerCommandPreprocessEvent event) {
if (SelectConfig.CheckOnCommand) {
Player player = event.getPlayer();
event.setCancelled(Check.onCheck(player, false));
if (Check.onCheck(player, false)) {
if (event.isCancelled()) return;
event.setCancelled(true);
}
}
}
@@ -26,9 +29,7 @@ public class Events implements org.bukkit.event.Listener {
if (SelectConfig.CheckOnChat) {
Player player = event.getPlayer();
if (Check.onCheck(player, false)) {
if (event.isCancelled()) {
return;
}
if (event.isCancelled()) return;
event.setCancelled(true);
}
}

View File

@@ -23,6 +23,7 @@ public class OPCommand implements Listener {
@EventHandler
public void onOPServer(ServerCommandEvent event) {
if ((event.getCommand().toLowerCase().startsWith("op ") || event.getCommand().toLowerCase().startsWith("minecraft:op ")) && SelectConfig.OP_Whitelist_Enable) {
switch (this.isNotOPWTL(event.getCommand())) {
case 1:
@@ -35,11 +36,11 @@ public class OPCommand implements Listener {
break;
}
}
}
@EventHandler
public void onOpPlayer(PlayerCommandPreprocessEvent event) {
if (SelectConfig.OP_Whitelist_Enable) {
if ((event.getMessage().toLowerCase().startsWith("/op ") || event.getMessage().toLowerCase().startsWith("/minecraft:op "))) {
switch (this.isNotOPWTL(event.getMessage())) {
@@ -57,6 +58,7 @@ public class OPCommand implements Listener {
}
private int isNotOPWTL(String command) {
if (!command.contains("op")) return 0;
if (command.charAt(0) == '/') command = command.replaceFirst("/", "");
String arg = command.replace("op ", "");

View File

@@ -61,7 +61,6 @@ public class Load {
} catch (Exception e) {
e.printStackTrace();
}
try {
Timer.RefreshTimer();
} 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> permissionHashMap = new HashMap<String, PlayerObject>();
@Override
public void onEnable() {
// Plugin startup logic

View File

@@ -17,7 +17,6 @@ import java.util.UUID;
public class NameHistory {
/**
* 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, info, true, Main.plugin);
Register.permission(admin, op, help, true, Main.plugin);
}
}