Compare commits
4 Commits
8f19f7e49b
...
2.4.0_Snap
Author | SHA1 | Date | |
---|---|---|---|
538f57f40b | |||
9a0cda7cb6 | |||
d9e6ba5089 | |||
d0c43a79a1 |
37
.gitea/ISSUE_TEMPLATE/bug_report.md
Normal file
37
.gitea/ISSUE_TEMPLATE/bug_report.md
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Create a report to help us improve
|
||||||
|
title: ''
|
||||||
|
labels:
|
||||||
|
- "bug report"
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Description of issue:**
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Plugin Version (using`/opsecurity info`):**
|
||||||
|
|
||||||
|
**Server Type (Spigot/Paperspigot/etc):**
|
||||||
|
|
||||||
|
**Server Version (using `/ver`):**
|
||||||
|
|
||||||
|
**Relevant plugins (Delete if this isn't needed):**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**ERROR (DELETE IF YOU HAVE NO ERROR):**
|
||||||
|
```
|
||||||
|
######################
|
||||||
|
## REPLACE WITH ERROR ##
|
||||||
|
######################
|
||||||
|
```
|
||||||
|
|
||||||
|
**CONFIG SECTION (DELETE IF NOT RELEVANT):**
|
||||||
|
```
|
||||||
|
#######################################
|
||||||
|
## REPLACE WITH RELEVANT CONFIG SECTION ##
|
||||||
|
#######################################
|
||||||
|
```
|
21
.gitea/ISSUE_TEMPLATE/feature_request.md
Normal file
21
.gitea/ISSUE_TEMPLATE/feature_request.md
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
---
|
||||||
|
name: Feature request
|
||||||
|
about: Suggest an idea/improvement
|
||||||
|
title: ''
|
||||||
|
labels:
|
||||||
|
- "feature request"
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Description of feature request:**
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Plugin Version (using`/opsecurity info`):**
|
||||||
|
|
||||||
|
**Server Type (Spigot/Paperspigot/etc):**
|
||||||
|
|
||||||
|
**Server Version (using `/ver`):**
|
||||||
|
|
||||||
|
**Relevant plugins (Delete if this isn't needed):**
|
22
.gitea/ISSUE_TEMPLATE/question.md
Normal file
22
.gitea/ISSUE_TEMPLATE/question.md
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
---
|
||||||
|
name: Question
|
||||||
|
about: Ask a question or get advice
|
||||||
|
title: ''
|
||||||
|
labels:
|
||||||
|
- question
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Share your question here:**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Plugin Version (using`/opsecurity info`):**
|
||||||
|
|
||||||
|
**Server Type (Spigot/Paperspigot/etc):**
|
||||||
|
|
||||||
|
**Server Version (using `/ver`):**
|
||||||
|
|
||||||
|
**Relevant plugins (Delete if this isn't needed):**
|
||||||
|
|
||||||
|
---
|
2
pom.xml
2
pom.xml
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>de.jatitv</groupId>
|
<groupId>de.jatitv</groupId>
|
||||||
<artifactId>OPSecurity</artifactId>
|
<artifactId>OPSecurity</artifactId>
|
||||||
<version>2.3.5</version>
|
<version>2.4.0_DEV</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>OPSecurity</name>
|
<name>OPSecurity</name>
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
// This claas was created by JaTiTV
|
// This claas was created by JaTiTV
|
||||||
|
|
||||||
|
|
||||||
package de.jatitv.opsecurity.cmdManagement;
|
package de.jatitv.opsecurity.cmdManagement;
|
||||||
|
|
||||||
import de.jatitv.opsecurity.config.config.SelectConfig;
|
import de.jatitv.opsecurity.config.config.SelectConfig;
|
||||||
@@ -16,7 +15,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
public class CmdExecuter implements CommandExecutor, TabCompleter {
|
public class CmdExecuter implements CommandExecutor, TabCompleter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -38,8 +38,8 @@ public class Commands {
|
|||||||
public static void reload(CommandSender sender) {
|
public static void reload(CommandSender sender) {
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
if (Main.opHashMap.containsKey(player.getName())) {
|
if (Main.opHashMap.containsKey(player.getName().toLowerCase())) {
|
||||||
if (Main.opHashMap.get(player.getName()).UUID.equals(player.getUniqueId().toString().replace("-", ""))) {
|
if (Main.opHashMap.get(player.getName().toLowerCase()).UUID.equals(player.getUniqueId().toString().replace("-", ""))) {
|
||||||
send.player(player, SelectMessages.ReloadStart);
|
send.player(player, SelectMessages.ReloadStart);
|
||||||
Bukkit.getConsoleSender().sendMessage(Main.Prefix + "§8-------------------------------");
|
Bukkit.getConsoleSender().sendMessage(Main.Prefix + "§8-------------------------------");
|
||||||
Bukkit.getConsoleSender().sendMessage(Main.Prefix + "§6Plugin reload...");
|
Bukkit.getConsoleSender().sendMessage(Main.Prefix + "§6Plugin reload...");
|
||||||
|
@@ -105,7 +105,7 @@ public class SelectConfig {
|
|||||||
PlayerObject player = new PlayerObject(
|
PlayerObject player = new PlayerObject(
|
||||||
yamlConfiguration.getString("OP_Whitelist.Whitelist." + key + ".UUID").replace("-",""));
|
yamlConfiguration.getString("OP_Whitelist.Whitelist." + key + ".UUID").replace("-",""));
|
||||||
opWhitelist.add(player);
|
opWhitelist.add(player);
|
||||||
Main.opHashMap.put(key, player);
|
Main.opHashMap.put(key.toLowerCase(), player);
|
||||||
}
|
}
|
||||||
|
|
||||||
no_OP_Player_deop = yamlConfiguration.getBoolean("OP_Whitelist.noOpPlayerDeop.Enable");
|
no_OP_Player_deop = yamlConfiguration.getBoolean("OP_Whitelist.noOpPlayerDeop.Enable");
|
||||||
@@ -121,7 +121,7 @@ public class SelectConfig {
|
|||||||
PlayerObject player = new PlayerObject(
|
PlayerObject player = new PlayerObject(
|
||||||
yamlConfiguration.getString("Permission_Whitelist.Whitelist." + key + ".UUID").replace("-",""));
|
yamlConfiguration.getString("Permission_Whitelist.Whitelist." + key + ".UUID").replace("-",""));
|
||||||
permWhitelist.add(player);
|
permWhitelist.add(player);
|
||||||
Main.permissionHashMap.put(key, player);
|
Main.permissionHashMap.put(key.toLowerCase(), player);
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerWhithPermission_kick = yamlConfiguration.getBoolean("Permission_Whitelist.PlayerWhithPermission_kick");
|
PlayerWhithPermission_kick = yamlConfiguration.getBoolean("Permission_Whitelist.PlayerWhithPermission_kick");
|
||||||
|
@@ -34,6 +34,8 @@ public class LanguagesCreate {
|
|||||||
set("Permission_Whitelist.consoleOnJoin", MSG.DE_Perm_consoleOnJoin, yamlConfigurationDE);
|
set("Permission_Whitelist.consoleOnJoin", MSG.DE_Perm_consoleOnJoin, yamlConfigurationDE);
|
||||||
set("Permission_Whitelist.kick", MSG.DE_Perm_kick, yamlConfigurationDE);
|
set("Permission_Whitelist.kick", MSG.DE_Perm_kick, yamlConfigurationDE);
|
||||||
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);
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
yamlConfigurationDE.save(messagesDE);
|
yamlConfigurationDE.save(messagesDE);
|
||||||
@@ -59,6 +61,7 @@ public class LanguagesCreate {
|
|||||||
set("Permission_Whitelist.consoleOnJoin", MSG.EN_Perm_consoleOnJoin, yamlConfigurationEN);
|
set("Permission_Whitelist.consoleOnJoin", MSG.EN_Perm_consoleOnJoin, yamlConfigurationEN);
|
||||||
set("Permission_Whitelist.kick", MSG.EN_Perm_kick, yamlConfigurationEN);
|
set("Permission_Whitelist.kick", MSG.EN_Perm_kick, yamlConfigurationEN);
|
||||||
set("Permission_Whitelist.consoleKick", MSG.EN_Perm_consoleKick, yamlConfigurationEN);
|
set("Permission_Whitelist.consoleKick", MSG.EN_Perm_consoleKick, yamlConfigurationEN);
|
||||||
|
set("Console.ExactKickReason", MSG.EN_ExactKickReason, yamlConfigurationEN);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
yamlConfigurationEN.save(messagesEN);
|
yamlConfigurationEN.save(messagesEN);
|
||||||
@@ -84,6 +87,7 @@ public class LanguagesCreate {
|
|||||||
set("Permission_Whitelist.consoleOnJoin", MSG.NO_Perm_consoleOnJoin, yamlConfigurationNO);
|
set("Permission_Whitelist.consoleOnJoin", MSG.NO_Perm_consoleOnJoin, yamlConfigurationNO);
|
||||||
set("Permission_Whitelist.kick", MSG.NO_Perm_kick, yamlConfigurationNO);
|
set("Permission_Whitelist.kick", MSG.NO_Perm_kick, yamlConfigurationNO);
|
||||||
set("Permission_Whitelist.consoleKick", MSG.NO_Perm_consoleKick, yamlConfigurationNO);
|
set("Permission_Whitelist.consoleKick", MSG.NO_Perm_consoleKick, yamlConfigurationNO);
|
||||||
|
set("Console.ExactKickReason", MSG.NO_ExactKickReason, yamlConfigurationNO);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
yamlConfigurationNO.save(messagesNO);
|
yamlConfigurationNO.save(messagesNO);
|
||||||
|
@@ -14,6 +14,7 @@ public class MSG {
|
|||||||
public static String EN_OP_consoleDeop = "&4Player &6[player] &4 was removed OP because he is not on the playerlist!";
|
public static String EN_OP_consoleDeop = "&4Player &6[player] &4 was removed OP because he is not on the playerlist!";
|
||||||
public static String EN_OP_kick = "&4You have op but are not authorized to do so, that's why you were kicked!";
|
public static String EN_OP_kick = "&4You have op but are not authorized to do so, that's why you were kicked!";
|
||||||
public static String EN_OP_consoleKick = "&4Player &6[player] &4was kicked because he is not on the OP_Whitelist!";
|
public static String EN_OP_consoleKick = "&4Player &6[player] &4was kicked because he is not on the OP_Whitelist!";
|
||||||
|
public static String EN_ExactKickReason = "[prefix] &4Exact reason: &6[reason]";
|
||||||
|
|
||||||
public static String EN_Perm_consoleOnJoin = "&4Player &6[player] &4has permission &6[perm] &4and is not authorized to do so! &6[player] &4is not on the Player list!";
|
public static String EN_Perm_consoleOnJoin = "&4Player &6[player] &4has permission &6[perm] &4and is not authorized to do so! &6[player] &4is not on the Player list!";
|
||||||
public static String EN_Perm_kick = "&4You were kicked because you have permissions to which you do not have permission!";
|
public static String EN_Perm_kick = "&4You were kicked because you have permissions to which you do not have permission!";
|
||||||
@@ -36,6 +37,7 @@ public class MSG {
|
|||||||
public static String DE_OP_kick = "&4You have op but are not authorized to do so, that's why you were kicked\n" +
|
public static String DE_OP_kick = "&4You have op but are not authorized to do so, that's why you were kicked\n" +
|
||||||
"&4Du hast op bist dazu aber nicht berechtigt, deswegen wurdest du gekickt!";
|
"&4Du hast op bist dazu aber nicht berechtigt, deswegen wurdest du gekickt!";
|
||||||
public static String DE_OP_consoleKick = "&4Spieler &6[player] &4wurde gekickt, da er nicht auf der OP_Whitelist steht!";
|
public static String DE_OP_consoleKick = "&4Spieler &6[player] &4wurde gekickt, da er nicht auf der OP_Whitelist steht!";
|
||||||
|
public static String DE_ExactKickReason = "[prefix] &4Genauer Grund: &6[reason]";
|
||||||
|
|
||||||
public static String DE_Perm_consoleOnJoin = "&4Player &6[player] &4hat die Permission &6[perm] &4und ist dazu nicht berechtigt! &6[player] &4ist nicht in der Spielerliste!";
|
public static String DE_Perm_consoleOnJoin = "&4Player &6[player] &4hat die Permission &6[perm] &4und ist dazu nicht berechtigt! &6[player] &4ist nicht in der Spielerliste!";
|
||||||
public static String DE_Perm_kick = "&4You were kicked because you have permissions to which you do not have permission!\n" +
|
public static String DE_Perm_kick = "&4You were kicked because you have permissions to which you do not have permission!\n" +
|
||||||
@@ -59,6 +61,7 @@ public class MSG {
|
|||||||
public static String NO_OP_kick = "&4You have op but are not authorized to do so, that's why you were kicked\n" +
|
public static String NO_OP_kick = "&4You have op but are not authorized to do so, that's why you were kicked\n" +
|
||||||
"&4Du er ikke på OP whitelist, så du ble sparket ut!";
|
"&4Du er ikke på OP whitelist, så du ble sparket ut!";
|
||||||
public static String NO_OP_consoleKick = "&4Spiller &6[player] &4ble sparket ut fordi han ikke er på OP_Whitelist!";
|
public static String NO_OP_consoleKick = "&4Spiller &6[player] &4ble sparket ut fordi han ikke er på OP_Whitelist!";
|
||||||
|
public static String NO_ExactKickReason = "[prefix] &4Nøyaktig grunn: &6[reason]";
|
||||||
|
|
||||||
public static String NO_Perm_consoleOnJoin = "&4Spiller &6[player] &4har tillatelsen &6[perm] &4og er ikke godkjent til dette! &6[player] &4er ikke en spiller på Spiller listen! Sparket ut: &4Du ble sparket ut fordi du har tillatelse til noe du ikke er tillatt!";
|
public static String NO_Perm_consoleOnJoin = "&4Spiller &6[player] &4har tillatelsen &6[perm] &4og er ikke godkjent til dette! &6[player] &4er ikke en spiller på Spiller listen! Sparket ut: &4Du ble sparket ut fordi du har tillatelse til noe du ikke er tillatt!";
|
||||||
public static String NO_Perm_kick = "&4You were kicked because you have permissions to which you do not have permission!\n" +
|
public static String NO_Perm_kick = "&4You were kicked because you have permissions to which you do not have permission!\n" +
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
|
|
||||||
package de.jatitv.opsecurity.config.languages;
|
package de.jatitv.opsecurity.config.languages;
|
||||||
|
|
||||||
import de.jatitv.opsecurity.config.config.SelectConfig;
|
import de.jatitv.opsecurity.config.config.SelectConfig;
|
||||||
import de.jatitv.opsecurity.system.Main;
|
import de.jatitv.opsecurity.system.Main;
|
||||||
import de.jatitv.opsecurity.util.Replace;
|
import de.jatitv.opsecurity.util.Replace;
|
||||||
@@ -21,14 +22,15 @@ public class SelectMessages {
|
|||||||
public static String ReloadStart;
|
public static String ReloadStart;
|
||||||
public static String ReloadEnd;
|
public static String ReloadEnd;
|
||||||
|
|
||||||
public static String OP_opCommand ;
|
public static String OP_opCommand;
|
||||||
public static String OP_consoleOnJoin ;
|
public static String OP_consoleOnJoin;
|
||||||
public static String OP_deop;
|
public static String OP_deop;
|
||||||
public static String OP_consoleDeop ;
|
public static String OP_consoleDeop;
|
||||||
public static String OP_kick;
|
public static String OP_kick;
|
||||||
public static String OP_consoleKick ;
|
public static String OP_consoleKick;
|
||||||
|
public static String ExactReason;
|
||||||
|
|
||||||
public static String Perm_consoleOnJoin ;
|
public static String Perm_consoleOnJoin;
|
||||||
public static String Perm_kick;
|
public static String Perm_kick;
|
||||||
public static String Perm_consoleKick;
|
public static String Perm_consoleKick;
|
||||||
|
|
||||||
@@ -67,13 +69,16 @@ public class SelectMessages {
|
|||||||
OP_kick = select("OP_Whitelist.kick", yamlConfiguration);
|
OP_kick = select("OP_Whitelist.kick", yamlConfiguration);
|
||||||
OP_consoleKick = select("OP_Whitelist.consoleKick", yamlConfiguration);
|
OP_consoleKick = select("OP_Whitelist.consoleKick", yamlConfiguration);
|
||||||
|
|
||||||
|
|
||||||
Perm_consoleOnJoin = select("Permission_Whitelist.consoleOnJoin", yamlConfiguration);
|
Perm_consoleOnJoin = select("Permission_Whitelist.consoleOnJoin", yamlConfiguration);
|
||||||
Perm_kick = select("Permission_Whitelist.kick", yamlConfiguration);
|
Perm_kick = select("Permission_Whitelist.kick", yamlConfiguration);
|
||||||
Perm_consoleKick = select("Permission_Whitelist.consoleKick", yamlConfiguration);
|
Perm_consoleKick = select("Permission_Whitelist.consoleKick", yamlConfiguration);
|
||||||
|
ExactReason = select("Console.ExactKickReason", yamlConfiguration);
|
||||||
|
|
||||||
send.console(Prefix + " §2Language successfully selected to: §6" + selectMSG + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
send.console(Prefix + " §2Language successfully selected to: §6" + selectMSG + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||||
}
|
}
|
||||||
private static String select(String path, YamlConfiguration yamlConfiguration){
|
|
||||||
|
private static String select(String path, YamlConfiguration yamlConfiguration) {
|
||||||
return Replace.replace(yamlConfiguration.getString(path));
|
return Replace.replace(yamlConfiguration.getString(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -14,72 +14,72 @@ public class Check {
|
|||||||
public static Boolean onCheck(Player player, Boolean join) {
|
public static Boolean onCheck(Player player, Boolean join) {
|
||||||
if (SelectConfig.OP_Whitelist_Enable) {
|
if (SelectConfig.OP_Whitelist_Enable) {
|
||||||
if (player.isOp()) {
|
if (player.isOp()) {
|
||||||
if (!opWhitelist(player)) {
|
if (opWhitelist(player)) {
|
||||||
if (join) {
|
return false;
|
||||||
send.console(Replace.replace(SelectMessages.OP_consoleOnJoin.replace("[player]", player.getName())));
|
}
|
||||||
|
if (join) {
|
||||||
|
send.console(Replace.replace(SelectMessages.OP_consoleOnJoin.replace("[player]", player.getName())));
|
||||||
|
}
|
||||||
|
if (SelectConfig.Notify_Warn) {
|
||||||
|
for (Player notifyperm : Bukkit.getOnlinePlayers()) {
|
||||||
|
if (notifyperm.hasPermission("opsecurity.notify")) {
|
||||||
|
if (join) {
|
||||||
|
notifyperm.sendMessage(Replace.replace(SelectMessages.OP_consoleOnJoin.replace("[player]", player.getName())));
|
||||||
|
} else notifyperm.sendMessage(Replace.replace(SelectMessages.OP_consoleKick.replace("[player]", player.getName())));
|
||||||
|
if (SelectConfig.Notify_Sound_Enable) {
|
||||||
|
notifyperm.playSound(player.getLocation(), SelectConfig.Notify_Sound, 3, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (SelectConfig.Notify_Warn) {
|
}
|
||||||
|
if (SelectConfig.no_OP_Player_kick && SelectConfig.no_OP_Player_deop) {
|
||||||
|
player.setOp(false);
|
||||||
|
Cmd.console(SelectConfig.KickCommand.replace("[player]", player.getName())
|
||||||
|
.replace("[reason]", Replace.replace(SelectMessages.OP_kick + "\n" + "\n" + SelectMessages.OP_deop)));
|
||||||
|
send.console(Replace.replace(SelectMessages.OP_consoleKick.replace("[player]", player.getName())));
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
if (SelectConfig.no_OP_Player_kick) {
|
||||||
|
Cmd.console(SelectConfig.KickCommand.replace("[player]", player.getName()).replace("[reason]", Replace.replace(SelectMessages.OP_kick)));
|
||||||
|
send.console(Replace.replace(SelectMessages.OP_consoleKick.replace("[player]", player.getName())));
|
||||||
for (Player notifyperm : Bukkit.getOnlinePlayers()) {
|
for (Player notifyperm : Bukkit.getOnlinePlayers()) {
|
||||||
if (notifyperm.hasPermission("opsecurity.notify")) {
|
if (notifyperm.hasPermission("opsecurity.notify")) {
|
||||||
if (join) {
|
notifyperm.sendMessage(Replace.replace(SelectMessages.OP_consoleKick.replace("[player]", player.getName())
|
||||||
notifyperm.sendMessage(Replace.replace(SelectMessages.OP_consoleOnJoin.replace("[player]", player.getName())));
|
+ "\n" + SelectMessages.OP_consoleDeop.replace("[player]", player.getName())));
|
||||||
} else notifyperm.sendMessage(Replace.replace(SelectMessages.OP_consoleKick.replace("[player]", player.getName())));
|
|
||||||
if (SelectConfig.Notify_Sound_Enable) {
|
|
||||||
notifyperm.playSound(player.getLocation(), SelectConfig.Notify_Sound, 3, 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
if (SelectConfig.no_OP_Player_kick && SelectConfig.no_OP_Player_deop) {
|
if (SelectConfig.no_OP_Player_deop) {
|
||||||
player.setOp(false);
|
player.setOp(false);
|
||||||
Cmd.console(SelectConfig.KickCommand.replace("[player]", player.getName())
|
if (SelectConfig.sendPlayerDEOPmsg) {
|
||||||
.replace("[reason]", Replace.replace(SelectMessages.OP_kick + "\n" + "\n" + SelectMessages.OP_deop)));
|
new BukkitRunnable() {
|
||||||
send.console(Replace.replace(SelectMessages.OP_consoleKick.replace("[player]", player.getName())));
|
@Override
|
||||||
return true;
|
public void run() {
|
||||||
} else {
|
player.sendMessage(Replace.replace(SelectMessages.OP_deop));
|
||||||
if (SelectConfig.no_OP_Player_kick) {
|
|
||||||
Cmd.console(SelectConfig.KickCommand.replace("[player]", player.getName()).replace("[reason]", Replace.replace(SelectMessages.OP_kick)));
|
|
||||||
send.console(Replace.replace(SelectMessages.OP_consoleKick.replace("[player]", player.getName())));
|
|
||||||
for (Player notifyperm : Bukkit.getOnlinePlayers()) {
|
|
||||||
if (notifyperm.hasPermission("opsecurity.notify")) {
|
|
||||||
notifyperm.sendMessage(Replace.replace(SelectMessages.OP_consoleKick.replace("[player]", player.getName())
|
|
||||||
+ "\n" + SelectMessages.OP_consoleDeop.replace("[player]", player.getName())));
|
|
||||||
}
|
}
|
||||||
}
|
}.runTaskLater(Main.plugin, 5L);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (SelectConfig.no_OP_Player_deop) {
|
|
||||||
player.setOp(false);
|
|
||||||
if (SelectConfig.sendPlayerDEOPmsg) {
|
|
||||||
new BukkitRunnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
player.sendMessage(Replace.replace(SelectMessages.OP_deop));
|
|
||||||
}
|
|
||||||
}.runTaskLater(Main.plugin, 5L);
|
|
||||||
|
|
||||||
}
|
|
||||||
send.console(Replace.replace(SelectMessages.OP_consoleDeop.replace("[player]", player.getName())));
|
|
||||||
for (Player notifyperm : Bukkit.getOnlinePlayers()) {
|
|
||||||
if (notifyperm.hasPermission("opsecurity.notify")) {
|
|
||||||
notifyperm.sendMessage(Replace.replace(SelectMessages.OP_consoleDeop.replace("[player]", player.getName())));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
send.console(Replace.replace(SelectMessages.OP_consoleDeop.replace("[player]", player.getName())));
|
||||||
if (SelectConfig.customCommand_Enable) {
|
for (Player notifyperm : Bukkit.getOnlinePlayers()) {
|
||||||
new BukkitRunnable() {
|
if (notifyperm.hasPermission("opsecurity.notify")) {
|
||||||
@Override
|
notifyperm.sendMessage(Replace.replace(SelectMessages.OP_consoleDeop.replace("[player]", player.getName())));
|
||||||
public void run() {
|
|
||||||
for (String cmd : SelectConfig.customKickCommand) {
|
|
||||||
Cmd.console(Replace.replace(cmd.replace("[player]", player.getName())));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}.runTaskLater(Main.plugin, 5L);
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (SelectConfig.customCommand_Enable) {
|
||||||
|
new BukkitRunnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
for (String cmd : SelectConfig.customKickCommand) {
|
||||||
|
Cmd.console(Replace.replace(cmd.replace("[player]", player.getName())));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.runTaskLater(Main.plugin, 5L);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -105,7 +105,7 @@ public class Check {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (SelectConfig.PlayerWhithPermission_kick && SelectConfig.Perm_Command_enable){
|
if (SelectConfig.PlayerWhithPermission_kick && SelectConfig.Perm_Command_enable) {
|
||||||
Cmd.console(SelectConfig.KickCommand.replace("[player]", player.getName()).replace("[reason]", Replace.replace(SelectMessages.Perm_kick)));
|
Cmd.console(SelectConfig.KickCommand.replace("[player]", player.getName()).replace("[reason]", Replace.replace(SelectMessages.Perm_kick)));
|
||||||
send.console(Replace.replace(SelectMessages.Perm_consoleKick.replace("[player]",
|
send.console(Replace.replace(SelectMessages.Perm_consoleKick.replace("[player]",
|
||||||
player.getName()).replace("[perm]", s)));
|
player.getName()).replace("[perm]", s)));
|
||||||
@@ -116,7 +116,7 @@ public class Check {
|
|||||||
|
|
||||||
}
|
}
|
||||||
if (SelectConfig.PlayerWhithPermission_kick) {
|
if (SelectConfig.PlayerWhithPermission_kick) {
|
||||||
Cmd.console( SelectConfig.KickCommand.replace("[player]", player.getName()).replace("[reason]", Replace.replace(SelectMessages.Perm_kick)));
|
Cmd.console(SelectConfig.KickCommand.replace("[player]", player.getName()).replace("[reason]", Replace.replace(SelectMessages.Perm_kick)));
|
||||||
send.console(Replace.replace(SelectMessages.Perm_consoleKick.replace("[player]",
|
send.console(Replace.replace(SelectMessages.Perm_consoleKick.replace("[player]",
|
||||||
player.getName()).replace("[perm]", s)));
|
player.getName()).replace("[perm]", s)));
|
||||||
return true;
|
return true;
|
||||||
@@ -136,18 +136,30 @@ public class Check {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static Boolean opWhitelist(Player player) {
|
private static Boolean opWhitelist(Player player) {
|
||||||
if (Main.opHashMap.containsKey(player.getName())) {
|
if (Main.opHashMap.containsKey(player.getName().toLowerCase())) {
|
||||||
if (Main.opHashMap.get(player.getName()).UUID.equals(player.getUniqueId().toString().replace("-", ""))) {
|
if (Main.opHashMap.get(player.getName().toLowerCase()).UUID.equals(player.getUniqueId().toString().replace("-", ""))) {
|
||||||
return true;
|
return true;
|
||||||
} else return false;
|
} else {
|
||||||
} else return false;
|
send.console(SelectMessages.ExactReason.replace("[reason]", "Player UUID: " + player.getUniqueId().toString() + " not whitelisted"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
send.console(SelectMessages.ExactReason.replace("[reason]", "Player name: " + player.getName() + " not whitelisted"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Boolean permWhitelist(Player player) {
|
private static Boolean permWhitelist(Player player) {
|
||||||
if (Main.permissionHashMap.containsKey(player.getName())) {
|
if (Main.permissionHashMap.containsKey(player.getName().toLowerCase())) {
|
||||||
if (Main.permissionHashMap.get(player.getName()).UUID.equals(player.getUniqueId().toString().replace("-",""))) {
|
if (Main.permissionHashMap.get(player.getName().toLowerCase()).UUID.equals(player.getUniqueId().toString().replace("-", ""))) {
|
||||||
return true;
|
return true;
|
||||||
} else return false;
|
} else {
|
||||||
} else return false;
|
send.console(SelectMessages.ExactReason.replace("[reason]", "Player UUID: " + player.getUniqueId().toString() + " not whitelisted"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
send.console(SelectMessages.ExactReason.replace("[reason]", "Player name: " + player.getName() + " not whitelisted"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -4,10 +4,7 @@ package de.jatitv.opsecurity.listener;
|
|||||||
|
|
||||||
import de.jatitv.opsecurity.config.config.SelectConfig;
|
import de.jatitv.opsecurity.config.config.SelectConfig;
|
||||||
import de.jatitv.opsecurity.system.Main;
|
import de.jatitv.opsecurity.system.Main;
|
||||||
import de.jatitv.opsecurity.util.TextBuilder;
|
|
||||||
import de.jatitv.opsecurity.util.UpdateChecker;
|
import de.jatitv.opsecurity.util.UpdateChecker;
|
||||||
import net.md_5.bungee.api.chat.ClickEvent;
|
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.player.*;
|
import org.bukkit.event.player.*;
|
||||||
|
@@ -24,27 +24,25 @@ public class OPCommand implements Listener {
|
|||||||
if (command.charAt(0) == '/') command = command.replaceFirst("/", "");
|
if (command.charAt(0) == '/') command = command.replaceFirst("/", "");
|
||||||
String arg = command.replace("op ", "");
|
String arg = command.replace("op ", "");
|
||||||
|
|
||||||
|
|
||||||
String targetUUID = null;
|
|
||||||
|
|
||||||
if (SelectConfig.PlayerMustBeOnlineToOp) {
|
if (SelectConfig.PlayerMustBeOnlineToOp) {
|
||||||
if (Main.opHashMap.containsKey(arg)) {
|
if (Main.opHashMap.containsKey(arg.toLowerCase())) {
|
||||||
Player target = Bukkit.getPlayer(arg);
|
Player target = Bukkit.getPlayer(arg);
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (Main.opHashMap.get(target.getName()).UUID.equals(target.getUniqueId().toString().replace("-", ""))) {
|
if (Main.opHashMap.get(target.getName().toLowerCase()).UUID.equals(target.getUniqueId().toString().replace("-", ""))) {
|
||||||
return 0;
|
return 0;
|
||||||
} else return 2;
|
} else return 2;
|
||||||
} else return 2;
|
} else return 2;
|
||||||
} else {
|
} else {
|
||||||
if (Main.opHashMap.containsKey(arg)) {
|
if (Main.opHashMap.containsKey(arg.toLowerCase())) {
|
||||||
|
String targetUUID = null;
|
||||||
try {
|
try {
|
||||||
targetUUID = NameHistory.getPlayerUUID(arg);
|
targetUUID = NameHistory.getPlayerUUID(arg);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
if (Main.opHashMap.get(arg).UUID.equals(targetUUID)) {
|
if (Main.opHashMap.get(arg.toLowerCase()).UUID.equals(targetUUID)) {
|
||||||
return 0;
|
return 0;
|
||||||
} else return 2;
|
} else return 2;
|
||||||
} else return 2;
|
} else return 2;
|
||||||
|
Reference in New Issue
Block a user