Merge pull request '2.4.3' (#5) from customCommands-fix into main
Reviewed-on: JaTiTV/OPSecurity#5
This commit is contained in:
commit
fc76ba90be
5
pom.xml
5
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>de.jatitv</groupId>
|
<groupId>de.jatitv</groupId>
|
||||||
<artifactId>OPSecurity</artifactId>
|
<artifactId>OPSecurity</artifactId>
|
||||||
<version>2.4.2</version>
|
<version>2.4.3</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>OPSecurity</name>
|
<name>OPSecurity</name>
|
||||||
@ -73,7 +73,8 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.t2code</groupId>
|
<groupId>net.t2code</groupId>
|
||||||
<artifactId>T2CodeLib</artifactId>
|
<artifactId>T2CodeLib</artifactId>
|
||||||
<version>10.1</version>
|
<version>DEV-13.0</version>
|
||||||
|
<classifier>dev-5</classifier>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
@ -1,34 +1,32 @@
|
|||||||
package de.jatitv.opsecurity;
|
package de.jatitv.opsecurity;
|
||||||
|
|
||||||
public class Util {
|
public class Util {
|
||||||
private static double requiredT2CodeLibVersion = 10.1;
|
|
||||||
private static String Prefix = "§8[§2OP§4Security§8]";
|
|
||||||
private static Integer SpigotID = 90739;
|
|
||||||
private static Integer BstatsID = 10858;
|
|
||||||
private static String Spigot = "https://www.spigotmc.org/resources/" + SpigotID;
|
|
||||||
private static String Discord = "http://dc.t2code.net";
|
|
||||||
|
|
||||||
public static double getRequiredT2CodeLibVersion() {
|
public static String getInfoText() {
|
||||||
return requiredT2CodeLibVersion;
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getRequiredT2CodeLibVersion() {
|
||||||
|
return "13.0";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getPrefix() {
|
public static String getPrefix() {
|
||||||
return Prefix;
|
return "§8[§2OP§4Security§8]";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Integer getSpigotID() {
|
public static Integer getSpigotID() {
|
||||||
return SpigotID;
|
return 90739;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Integer getBstatsID() {
|
public static Integer getBstatsID() {
|
||||||
return BstatsID;
|
return 10858;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getSpigot() {
|
public static String getSpigot() {
|
||||||
return Spigot;
|
return "https://www.spigotmc.org/resources/" + getSpigotID();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getDiscord() {
|
public static String getDiscord() {
|
||||||
return Discord;
|
return net.t2code.t2codelib.Util.getDiscord();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
|
|||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
Commands.mainCommand(sender);
|
Commands.mainCommand(sender);
|
||||||
} else {
|
} else {
|
||||||
if (SelectConfig.OnlyOPcanUseThePlugin) {
|
if (SelectConfig.onlyOpCanUseThePlugin) {
|
||||||
if (!sender.isOp()) {
|
if (!sender.isOp()) {
|
||||||
sender.sendMessage(Util.getPrefix() + "§cOnly OPs can use OPSecurity!");
|
sender.sendMessage(Util.getPrefix() + "§cOnly OPs can use OPSecurity!");
|
||||||
return false;
|
return false;
|
||||||
|
@ -6,22 +6,16 @@ import de.jatitv.opsecurity.config.config.SelectConfig;
|
|||||||
import de.jatitv.opsecurity.system.Load;
|
import de.jatitv.opsecurity.system.Load;
|
||||||
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.md_5.bungee.api.chat.ClickEvent;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
||||||
import net.t2code.lib.Spigot.Lib.messages.T2CodeTemplate;
|
|
||||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
|
||||||
import net.t2code.lib.Spigot.Lib.update.UpdateAPI;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.Plugin;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class Commands {
|
public class Commands {
|
||||||
|
|
||||||
public static void mainCommand(CommandSender sender) {
|
public static void mainCommand(CommandSender sender) {
|
||||||
if (SelectConfig.OnlyOPcanUseThePlugin) {
|
if (SelectConfig.onlyOpCanUseThePlugin) {
|
||||||
if (!sender.isOp()) {
|
if (!sender.isOp()) {
|
||||||
sender.sendMessage(Util.getPrefix() + "§cOnly OPs can use OPSecurity!");
|
sender.sendMessage(Util.getPrefix() + "§cOnly OPs can use OPSecurity!");
|
||||||
return;
|
return;
|
||||||
@ -41,17 +35,17 @@ public class Commands {
|
|||||||
}
|
}
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
if (!Main.opHashMap.containsKey(player.getName().toLowerCase())) {
|
if (!Main.getOpHashMap().containsKey(player.getName().toLowerCase())) {
|
||||||
sender.sendMessage(Util.getPrefix() + " §4You are not on the Whitelist!");
|
sender.sendMessage(Util.getPrefix() + " §4You are not on the Whitelist!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!Main.opHashMap.get(player.getName().toLowerCase()).UUID.equals(player.getUniqueId().toString().replace("-", ""))) {
|
if (!Main.getOpHashMap().get(player.getName().toLowerCase()).UUID.equals(player.getUniqueId().toString().replace("-", ""))) {
|
||||||
sender.sendMessage(Util.getPrefix() + " §4You are not on the Whitelist!");
|
sender.sendMessage(Util.getPrefix() + " §4You are not on the Whitelist!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
send.player(player, SelectMessages.ReloadStart);
|
T2Csend.player(player, SelectMessages.ReloadStart);
|
||||||
}
|
}
|
||||||
if (sender instanceof Player) send.player((Player) sender, SelectMessages.ReloadEnd);
|
if (sender instanceof Player) T2Csend.player((Player) sender, SelectMessages.ReloadEnd);
|
||||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + "§8-------------------------------");
|
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + "§8-------------------------------");
|
||||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §6Plugin reload...");
|
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §6Plugin reload...");
|
||||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + "§8-------------------------------");
|
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + "§8-------------------------------");
|
||||||
@ -67,6 +61,6 @@ public class Commands {
|
|||||||
sender.sendMessage(Util.getPrefix() + "§cYou do not have permission for OPSecurity! §7<" + Permissions.info + ">");
|
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);
|
T2Ctemplate.sendInfo(sender,Main.getPlugin(),Util.getSpigotID(),Util.getDiscord(),Util.getInfoText());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ package de.jatitv.opsecurity.config.config;
|
|||||||
import de.jatitv.opsecurity.Util;
|
import de.jatitv.opsecurity.Util;
|
||||||
import de.jatitv.opsecurity.system.Main;
|
import de.jatitv.opsecurity.system.Main;
|
||||||
import de.jatitv.opsecurity.system.NameHistory;
|
import de.jatitv.opsecurity.system.NameHistory;
|
||||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -49,7 +49,7 @@ public class ConfigConvert {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void configConvert() {
|
private static void configConvert() {
|
||||||
File config = new File(Main.plugin.getDataFolder().getPath(), "config.yml");
|
File config = new File(Main.getPlugin().getDataFolder().getPath(), "config.yml");
|
||||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config);
|
||||||
|
|
||||||
if (yamlConfiguration.get("ConfigVersion") == null) {
|
if (yamlConfiguration.get("ConfigVersion") == null) {
|
||||||
@ -121,11 +121,11 @@ public class ConfigConvert {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void convert(String oldConfig, String newConfig) {
|
public static void convert(String oldConfig, String newConfig) {
|
||||||
send.console(Util.getPrefix() + " §5Convert: §4" + oldConfig + " §5--> §2" + newConfig);
|
T2Csend.console(Util.getPrefix() + " §5Convert: §4" + oldConfig + " §5--> §2" + newConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void convert(String config, String oldConfig, String newConfig) {
|
public static void convert(String config, String oldConfig, String newConfig) {
|
||||||
send.console(Util.getPrefix() + " §5Convert: §e" + config + " §4" + oldConfig + " §5--> §2" + newConfig);
|
T2Csend.console(Util.getPrefix() + " §5Convert: §e" + config + " §4" + oldConfig + " §5--> §2" + newConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void convertPlayer(String oldPath, String newPath, List<String> oldPlayer, YamlConfiguration yamlConfiguration) {
|
private static void convertPlayer(String oldPath, String newPath, List<String> oldPlayer, YamlConfiguration yamlConfiguration) {
|
||||||
@ -133,7 +133,7 @@ public class ConfigConvert {
|
|||||||
try {
|
try {
|
||||||
String uuid = NameHistory.getPlayerUUID(Player);
|
String uuid = NameHistory.getPlayerUUID(Player);
|
||||||
if (uuid == null) {
|
if (uuid == null) {
|
||||||
send.warning(Main.plugin,
|
T2Csend.warning(Main.getPlugin(),
|
||||||
"The UUID of the player §6" + Player + " §ecould not be found. Please check the config.yml and / or if the player exists / if the player name is correct!");
|
"The UUID of the player §6" + Player + " §ecould not be found. Please check the config.yml and / or if the player exists / if the player name is correct!");
|
||||||
convert("config.yml", oldPath + ": " + Player, newPath + ": " + Player + ": UUID: Player UUID not found!");
|
convert("config.yml", oldPath + ": " + Player, newPath + ": " + Player + ": UUID: Player UUID not found!");
|
||||||
yamlConfiguration.set(newPath + Player + ".UUID", "Player UUID not found!");
|
yamlConfiguration.set(newPath + Player + ".UUID", "Player UUID not found!");
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
package de.jatitv.opsecurity.config.config;
|
package de.jatitv.opsecurity.config.config;
|
||||||
|
|
||||||
import de.jatitv.opsecurity.system.Main;
|
import de.jatitv.opsecurity.system.Main;
|
||||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ public class CreateConfig {
|
|||||||
public static void configCreate() {
|
public static void configCreate() {
|
||||||
Bukkit.getConsoleSender().sendMessage(Prefix + "§4config.yml load...");
|
Bukkit.getConsoleSender().sendMessage(Prefix + "§4config.yml load...");
|
||||||
|
|
||||||
File configYML = new File(Main.plugin.getDataFolder().getPath(), "config.yml");
|
File configYML = new File(Main.getPlugin().getDataFolder().getPath(), "config.yml");
|
||||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(configYML);
|
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(configYML);
|
||||||
|
|
||||||
yamlConfiguration.set("ConfigVersion", ConfigVersion);
|
yamlConfiguration.set("ConfigVersion", ConfigVersion);
|
||||||
@ -88,9 +88,9 @@ public class CreateConfig {
|
|||||||
set("Notify.JoinWarn.Enable", Notify_Warn, yamlConfiguration);
|
set("Notify.JoinWarn.Enable", Notify_Warn, yamlConfiguration);
|
||||||
set("Notify.Sound.Enable", Notify_Sound_Enable, yamlConfiguration);
|
set("Notify.Sound.Enable", Notify_Sound_Enable, yamlConfiguration);
|
||||||
|
|
||||||
if (MCVersion.minecraft1_8) {
|
if (T2CmcVersion.isMc1_8()) {
|
||||||
set("Notify.Sound.Sound", Notify_Sound_1_8, yamlConfiguration);
|
set("Notify.Sound.Sound", Notify_Sound_1_8, yamlConfiguration);
|
||||||
} else if (MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
|
} else if (T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
|
||||||
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);
|
||||||
|
|
||||||
|
@ -6,8 +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.t2codelib.SPIGOT.api.yaml.T2Cconfig;
|
||||||
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;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
@ -20,47 +19,43 @@ public class SelectConfig {
|
|||||||
|
|
||||||
// Config
|
// Config
|
||||||
|
|
||||||
public static Integer ConfigVersion;
|
public static Integer configVersion;
|
||||||
|
|
||||||
public static Boolean UpdateCheckOnJoin;
|
public static Boolean updateCheckOnJoin;
|
||||||
public static String language;
|
public static String language;
|
||||||
|
|
||||||
public static Boolean OnlyOPcanUseThePlugin;
|
public static Boolean onlyOpCanUseThePlugin;
|
||||||
public static Boolean CheckOnJoin;
|
public static Boolean checkOnJoin;
|
||||||
public static Boolean CheckOnInteract;
|
public static Boolean checkOnInteract;
|
||||||
public static Boolean CheckOnCommand;
|
public static Boolean checkOnCommand;
|
||||||
public static Boolean CheckOnChat;
|
public static Boolean checkOnChat;
|
||||||
|
|
||||||
public static String KickCommand;
|
public static String kickCommand;
|
||||||
|
|
||||||
public static Boolean Notify_Warn;
|
public static Boolean notifyWarn;
|
||||||
public static Boolean Notify_Sound_Enable;
|
public static Boolean notifySoundEnable;
|
||||||
public static Sound Notify_Sound;
|
public static Sound notifySound;
|
||||||
public static String Notify_Sound_input;
|
public static String notifySoundInput;
|
||||||
|
|
||||||
public static Boolean Timer_Enable;
|
public static Boolean timerEnable;
|
||||||
public static int RefreshTime;
|
public static int refreshTime;
|
||||||
|
|
||||||
public static Boolean OP_Whitelist_Enable;
|
public static Boolean opWhitelistEnable;
|
||||||
public static Boolean PlayerMustBeOnlineToOp;
|
public static Boolean playerMustBeOnlineToOp;
|
||||||
|
|
||||||
|
|
||||||
public static Boolean no_OP_Player_deop;
|
public static Boolean noOPPlayerDeop;
|
||||||
public static Boolean sendPlayerDEOPmsg;
|
public static Boolean sendPlayerDEOPmsg;
|
||||||
public static Boolean no_OP_Player_kick;
|
public static Boolean noOpPlayerKick;
|
||||||
public static Boolean customCommand_Enable;
|
public static Boolean customCommandEnable;
|
||||||
public static List<String> customKickCommand;
|
public static List<String> customKickCommand;
|
||||||
|
|
||||||
public static Boolean Permission_Whitelist_Enable;
|
public static Boolean permissionWhitelistEnable;
|
||||||
public static List<String> permissions;
|
public static List<String> permissions;
|
||||||
|
|
||||||
public static Boolean PlayerWhithPermission_kick;
|
public static Boolean playerWhithPermissionKick;
|
||||||
public static Boolean Perm_Command_enable;
|
public static Boolean permCommandEnable;
|
||||||
public static List<String> Perm_Command;
|
public static List<String> permCommand;
|
||||||
|
|
||||||
public static Boolean LP_Enable;
|
|
||||||
public static Boolean LP_AllowFromConsole;
|
|
||||||
public static List<String> LP_Whitelist;
|
|
||||||
|
|
||||||
|
|
||||||
//help
|
//help
|
||||||
@ -80,46 +75,46 @@ public class SelectConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void onSelect() {
|
public static void onSelect() {
|
||||||
File configYML = new File(Main.plugin.getDataFolder().getPath(), "config.yml");
|
File configYML = new File(Main.getPlugin().getDataFolder().getPath(), "config.yml");
|
||||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(configYML);
|
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(configYML);
|
||||||
|
|
||||||
Main.opHashMap.clear();
|
Main.getOpHashMap().clear();
|
||||||
Main.permissionHashMap.clear();
|
Main.getPermissionHashMap().clear();
|
||||||
|
|
||||||
ConfigVersion = yamlConfiguration.getInt("ConfigVersion");
|
configVersion = yamlConfiguration.getInt("ConfigVersion");
|
||||||
|
|
||||||
UpdateCheckOnJoin = yamlConfiguration.getBoolean("Plugin.UpdateCheckOnJoin");
|
updateCheckOnJoin = yamlConfiguration.getBoolean("Plugin.UpdateCheckOnJoin");
|
||||||
language = yamlConfiguration.getString("Plugin.language");
|
language = yamlConfiguration.getString("Plugin.language");
|
||||||
OnlyOPcanUseThePlugin = yamlConfiguration.getBoolean("Plugin.OnlyOPcanUseThePlugin");
|
onlyOpCanUseThePlugin = yamlConfiguration.getBoolean("Plugin.OnlyOPcanUseThePlugin");
|
||||||
CheckOnJoin = yamlConfiguration.getBoolean("Check.OnJoin");
|
checkOnJoin = yamlConfiguration.getBoolean("Check.OnJoin");
|
||||||
CheckOnInteract = yamlConfiguration.getBoolean("Check.OnInteract");
|
checkOnInteract = yamlConfiguration.getBoolean("Check.OnInteract");
|
||||||
CheckOnCommand = yamlConfiguration.getBoolean("Check.OnCommand");
|
checkOnCommand = yamlConfiguration.getBoolean("Check.OnCommand");
|
||||||
CheckOnChat = yamlConfiguration.getBoolean("Check.OnChat");
|
checkOnChat = yamlConfiguration.getBoolean("Check.OnChat");
|
||||||
Timer_Enable = yamlConfiguration.getBoolean("Check.Timer.Enable");
|
timerEnable = yamlConfiguration.getBoolean("Check.Timer.Enable");
|
||||||
RefreshTime = yamlConfiguration.getInt("Check.Timer.RefreshTime_inSec");
|
refreshTime = yamlConfiguration.getInt("Check.Timer.RefreshTime_inSec");
|
||||||
|
|
||||||
KickCommand = yamlConfiguration.getString("Kick.Command");
|
kickCommand = yamlConfiguration.getString("Kick.Command");
|
||||||
Notify_Warn = yamlConfiguration.getBoolean("Notify.JoinWarn.Enable");
|
notifyWarn = yamlConfiguration.getBoolean("Notify.JoinWarn.Enable");
|
||||||
Notify_Sound_Enable = yamlConfiguration.getBoolean("Notify.Sound.Enable");
|
notifySoundEnable = yamlConfiguration.getBoolean("Notify.Sound.Enable");
|
||||||
Notify_Sound_input = yamlConfiguration.getString("Notify.Sound.Sound");
|
notifySoundInput = yamlConfiguration.getString("Notify.Sound.Sound");
|
||||||
|
|
||||||
OP_Whitelist_Enable = yamlConfiguration.getBoolean("OP_Whitelist.Enable");
|
opWhitelistEnable = yamlConfiguration.getBoolean("OP_Whitelist.Enable");
|
||||||
PlayerMustBeOnlineToOp = yamlConfiguration.getBoolean("OP_Whitelist.PlayerMustBeOnlineToOp");
|
playerMustBeOnlineToOp = yamlConfiguration.getBoolean("OP_Whitelist.PlayerMustBeOnlineToOp");
|
||||||
|
|
||||||
ArrayList<PlayerObject> opWhitelist = new ArrayList<>();
|
ArrayList<PlayerObject> opWhitelist = new ArrayList<>();
|
||||||
for (String key : yamlConfiguration.getConfigurationSection("OP_Whitelist.Whitelist").getKeys(false)) {
|
for (String key : yamlConfiguration.getConfigurationSection("OP_Whitelist.Whitelist").getKeys(false)) {
|
||||||
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.toLowerCase(), player);
|
Main.getOpHashMap().put(key.toLowerCase(), player);
|
||||||
}
|
}
|
||||||
|
|
||||||
no_OP_Player_deop = yamlConfiguration.getBoolean("OP_Whitelist.noOpPlayerDeop.Enable");
|
noOPPlayerDeop = yamlConfiguration.getBoolean("OP_Whitelist.noOpPlayerDeop.Enable");
|
||||||
sendPlayerDEOPmsg = yamlConfiguration.getBoolean("OP_Whitelist.noOpPlayerDeop.PlayerSendMessage");
|
sendPlayerDEOPmsg = yamlConfiguration.getBoolean("OP_Whitelist.noOpPlayerDeop.PlayerSendMessage");
|
||||||
no_OP_Player_kick = yamlConfiguration.getBoolean("OP_Whitelist.noOpPlayerKick.Enable");
|
noOpPlayerKick = yamlConfiguration.getBoolean("OP_Whitelist.noOpPlayerKick.Enable");
|
||||||
customCommand_Enable = yamlConfiguration.getBoolean("OP_Whitelist.customCommands.Enable");
|
customCommandEnable = yamlConfiguration.getBoolean("OP_Whitelist.customCommands.Enable");
|
||||||
customKickCommand = yamlConfiguration.getStringList("OP_Whitelist.customCommands.Commands");
|
customKickCommand = yamlConfiguration.getStringList("OP_Whitelist.customCommands.Commands");
|
||||||
Permission_Whitelist_Enable = yamlConfiguration.getBoolean("Permission_Whitelist.Enable");
|
permissionWhitelistEnable = yamlConfiguration.getBoolean("Permission_Whitelist.Enable");
|
||||||
permissions = yamlConfiguration.getStringList("Permission_Whitelist.Permissions");
|
permissions = yamlConfiguration.getStringList("Permission_Whitelist.Permissions");
|
||||||
|
|
||||||
ArrayList<PlayerObject> permWhitelist = new ArrayList<>();
|
ArrayList<PlayerObject> permWhitelist = new ArrayList<>();
|
||||||
@ -127,18 +122,15 @@ 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.toLowerCase(), player);
|
Main.getPermissionHashMap().put(key.toLowerCase(), player);
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerWhithPermission_kick = yamlConfiguration.getBoolean("Permission_Whitelist.PlayerWhithPermission_kick");
|
playerWhithPermissionKick = yamlConfiguration.getBoolean("Permission_Whitelist.PlayerWhithPermission_kick");
|
||||||
Perm_Command_enable = yamlConfiguration.getBoolean("Permission_Whitelist.customCommands.Enable");
|
permCommandEnable = yamlConfiguration.getBoolean("Permission_Whitelist.customCommands.Enable");
|
||||||
Perm_Command = yamlConfiguration.getStringList("Permission_Whitelist.customCommands.Commands");
|
permCommand = yamlConfiguration.getStringList("Permission_Whitelist.customCommands.Commands");
|
||||||
LP_Enable = yamlConfiguration.getBoolean("LuckPerms_Whitelist.Enable");
|
|
||||||
LP_AllowFromConsole = yamlConfiguration.getBoolean("LuckPerms_Whitelist.AllowFromConsole");
|
|
||||||
LP_Whitelist = yamlConfiguration.getStringList("LuckPerms_Whitelist.Whitelist");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sound() {
|
public static void sound() {
|
||||||
Notify_Sound = Config.checkSound(CreateConfig.Notify_Sound_1_8, CreateConfig.Notify_Sound_1_9_to_1_12, CreateConfig.Notify_Sound_from_1_13, Notify_Sound_input, Util.getPrefix());
|
notifySound = T2Cconfig.checkSound(CreateConfig.Notify_Sound_1_8, CreateConfig.Notify_Sound_1_9_to_1_12, CreateConfig.Notify_Sound_from_1_13, notifySoundInput, Util.getPrefix());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ package de.jatitv.opsecurity.config.languages;
|
|||||||
|
|
||||||
import de.jatitv.opsecurity.Util;
|
import de.jatitv.opsecurity.Util;
|
||||||
import de.jatitv.opsecurity.system.Main;
|
import de.jatitv.opsecurity.system.Main;
|
||||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -14,8 +14,8 @@ import java.io.IOException;
|
|||||||
public class LanguagesCreate {
|
public class LanguagesCreate {
|
||||||
|
|
||||||
public static void messagesCreate() {
|
public static void messagesCreate() {
|
||||||
send.debug(Main.plugin,"§4Language files are created / updated...");
|
T2Csend.debug(Main.getPlugin(),"§4Language files are created / updated...");
|
||||||
Long long_ = Long.valueOf(System.currentTimeMillis());
|
long long_ = System.currentTimeMillis();
|
||||||
|
|
||||||
File messagesDE = new File(Main.getPath(), "languages/german_messages.yml");
|
File messagesDE = new File(Main.getPath(), "languages/german_messages.yml");
|
||||||
YamlConfiguration yamlConfigurationDE = YamlConfiguration.loadConfiguration(messagesDE);
|
YamlConfiguration yamlConfigurationDE = YamlConfiguration.loadConfiguration(messagesDE);
|
||||||
@ -94,7 +94,7 @@ public class LanguagesCreate {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
send.console(Util.getPrefix() + " §2Language files were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
T2Csend.console(Util.getPrefix() + " §2Language files were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void set(String path, String value, YamlConfiguration config) {
|
private static void set(String path, String value, YamlConfiguration config) {
|
||||||
|
@ -6,8 +6,8 @@ package de.jatitv.opsecurity.config.languages;
|
|||||||
import de.jatitv.opsecurity.Util;
|
import de.jatitv.opsecurity.Util;
|
||||||
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 net.t2code.lib.Spigot.Lib.messages.send;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
||||||
import net.t2code.lib.Spigot.Lib.replace.Replace;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -39,19 +39,19 @@ public class SelectMessages {
|
|||||||
|
|
||||||
public static void selectCreate(String Prefix) {
|
public static void selectCreate(String Prefix) {
|
||||||
|
|
||||||
send.debug(Main.plugin, "§4Select language...");
|
T2Csend.debug(Main.getPlugin(), "§4Select language...");
|
||||||
Long long_ = Long.valueOf(System.currentTimeMillis());
|
long long_ = System.currentTimeMillis();
|
||||||
|
|
||||||
File msg;
|
File msg;
|
||||||
|
|
||||||
msg = new File(Main.getPath(), "languages/" + SelectConfig.language + "_messages.yml");
|
msg = new File(Main.getPath(), "languages/" + SelectConfig.language + "_messages.yml");
|
||||||
if (!msg.isFile()) {
|
if (!msg.isFile()) {
|
||||||
send.console(Prefix);
|
T2Csend.console(Prefix);
|
||||||
send.console(Prefix + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
T2Csend.console(Prefix + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||||
send.console(Prefix + " §4The selected §c" + SelectConfig.language + " §4language file was not found.");
|
T2Csend.console(Prefix + " §4The selected §c" + SelectConfig.language + " §4language file was not found.");
|
||||||
send.console(Prefix + " §6The default language §eEnglish §6is used!");
|
T2Csend.console(Prefix + " §6The default language §eEnglish §6is used!");
|
||||||
send.console(Prefix + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
T2Csend.console(Prefix + " §4!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||||
send.console(Prefix);
|
T2Csend.console(Prefix);
|
||||||
msg = new File(Main.getPath(), "languages/" + "english_messages.yml");
|
msg = new File(Main.getPath(), "languages/" + "english_messages.yml");
|
||||||
selectMSG = "english";
|
selectMSG = "english";
|
||||||
} else selectMSG = SelectConfig.language;
|
} else selectMSG = SelectConfig.language;
|
||||||
@ -76,10 +76,10 @@ public class SelectMessages {
|
|||||||
Perm_consoleKick = select("Permission_Whitelist.consoleKick", yamlConfiguration);
|
Perm_consoleKick = select("Permission_Whitelist.consoleKick", yamlConfiguration);
|
||||||
ExactReason = select("Console.ExactKickReason", yamlConfiguration);
|
ExactReason = select("Console.ExactKickReason", yamlConfiguration);
|
||||||
|
|
||||||
send.console(Prefix + " §2Language successfully selected to: §6" + selectMSG + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
T2Csend.console(Prefix + " §2Language successfully selected to: §6" + selectMSG + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
|
||||||
}
|
}
|
||||||
|
|
||||||
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 T2Creplace.replace(Util.getPrefix(),yamlConfiguration.getString(path));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,129 +5,121 @@ import de.jatitv.opsecurity.config.languages.SelectMessages;
|
|||||||
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.system.Permissions;
|
import de.jatitv.opsecurity.system.Permissions;
|
||||||
import net.t2code.lib.Spigot.Lib.commands.Cmd;
|
import net.t2code.t2codelib.SPIGOT.api.commands.T2Ccmd;
|
||||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
||||||
import net.t2code.lib.Spigot.Lib.replace.Replace;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
public class Check {
|
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.opWhitelistEnable) {
|
||||||
if (player.isOp()) {
|
if (player.isOp()) {
|
||||||
if (opWhitelist(player)) {
|
if (opWhitelist(player)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (join) {
|
if (join) {
|
||||||
send.console(Replace.replace(Util.getPrefix(),SelectMessages.OP_consoleOnJoin.replace("[player]", player.getName())));
|
T2Csend.console(T2Creplace.replace(Util.getPrefix(), SelectMessages.OP_consoleOnJoin.replace("[player]", player.getName())));
|
||||||
}
|
}
|
||||||
if (SelectConfig.Notify_Warn) {
|
|
||||||
|
if (SelectConfig.notifyWarn) {
|
||||||
for (Player notifyperm : Bukkit.getOnlinePlayers()) {
|
for (Player notifyperm : Bukkit.getOnlinePlayers()) {
|
||||||
if (notifyperm.hasPermission(Permissions.notify)) {
|
if (notifyperm.hasPermission(Permissions.notify)) {
|
||||||
if (join) {
|
if (join) {
|
||||||
notifyperm.sendMessage(Replace.replace(Util.getPrefix(),SelectMessages.OP_consoleOnJoin.replace("[player]", player.getName())));
|
notifyperm.sendMessage(T2Creplace.replace(Util.getPrefix(), SelectMessages.OP_consoleOnJoin.replace("[player]", player.getName())));
|
||||||
} else notifyperm.sendMessage(Replace.replace(Util.getPrefix(),SelectMessages.OP_consoleKick.replace("[player]", player.getName())));
|
} else notifyperm.sendMessage(T2Creplace.replace(Util.getPrefix(), SelectMessages.OP_consoleKick.replace("[player]", player.getName())));
|
||||||
if (SelectConfig.Notify_Sound_Enable) {
|
if (SelectConfig.notifySoundEnable) {
|
||||||
notifyperm.playSound(player.getLocation(), SelectConfig.Notify_Sound, 3, 1);
|
notifyperm.playSound(player.getLocation(), SelectConfig.notifySound, 3, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (SelectConfig.no_OP_Player_kick && SelectConfig.no_OP_Player_deop) {
|
|
||||||
|
if (SelectConfig.noOpPlayerKick && SelectConfig.noOPPlayerDeop) {
|
||||||
player.setOp(false);
|
player.setOp(false);
|
||||||
Cmd.console(SelectConfig.KickCommand.replace("[player]", player.getName())
|
T2Ccmd.console(SelectConfig.kickCommand.replace("[player]", player.getName())
|
||||||
.replace("[reason]", Replace.replace(Util.getPrefix(),SelectMessages.OP_kick + "\n" + "\n" + SelectMessages.OP_deop)));
|
.replace("[reason]", T2Creplace.replace(Util.getPrefix(), SelectMessages.OP_kick + "\n" + "\n" + SelectMessages.OP_deop)));
|
||||||
send.console(Replace.replace(Util.getPrefix(),SelectMessages.OP_consoleKick.replace("[player]", player.getName())));
|
T2Csend.console(T2Creplace.replace(Util.getPrefix(), SelectMessages.OP_consoleKick.replace("[player]", player.getName())));
|
||||||
return true;
|
|
||||||
} else {
|
} else {
|
||||||
if (SelectConfig.no_OP_Player_kick) {
|
if (SelectConfig.noOpPlayerKick) {
|
||||||
Cmd.console(SelectConfig.KickCommand.replace("[player]", player.getName()).replace("[reason]", Replace.replace(Util.getPrefix(),SelectMessages.OP_kick)));
|
T2Ccmd.console(SelectConfig.kickCommand.replace("[player]", player.getName()).replace("[reason]", T2Creplace.replace(Util.getPrefix(), SelectMessages.OP_kick)));
|
||||||
send.console(Replace.replace(Util.getPrefix(),SelectMessages.OP_consoleKick.replace("[player]", player.getName())));
|
T2Csend.console(T2Creplace.replace(Util.getPrefix(), SelectMessages.OP_consoleKick.replace("[player]", player.getName())));
|
||||||
for (Player notifyperm : Bukkit.getOnlinePlayers()) {
|
for (Player notifyperm : Bukkit.getOnlinePlayers()) {
|
||||||
if (notifyperm.hasPermission(Permissions.notify)) {
|
if (notifyperm.hasPermission(Permissions.notify)) {
|
||||||
notifyperm.sendMessage(Replace.replace(Util.getPrefix(),SelectMessages.OP_consoleKick.replace("[player]", player.getName())
|
notifyperm.sendMessage(T2Creplace.replace(Util.getPrefix(), SelectMessages.OP_consoleKick.replace("[player]", player.getName())
|
||||||
+ "\n" + SelectMessages.OP_consoleDeop.replace("[player]", player.getName())));
|
+ "\n" + SelectMessages.OP_consoleDeop.replace("[player]", player.getName())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
if (SelectConfig.no_OP_Player_deop) {
|
if (SelectConfig.noOPPlayerDeop) {
|
||||||
player.setOp(false);
|
player.setOp(false);
|
||||||
if (SelectConfig.sendPlayerDEOPmsg) {
|
if (SelectConfig.sendPlayerDEOPmsg) {
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
player.sendMessage(Replace.replace(Util.getPrefix(),SelectMessages.OP_deop));
|
player.sendMessage(T2Creplace.replace(Util.getPrefix(), SelectMessages.OP_deop));
|
||||||
}
|
}
|
||||||
}.runTaskLater(Main.plugin, 5L);
|
}.runTaskLater(Main.getPlugin(), 5L);
|
||||||
|
|
||||||
}
|
}
|
||||||
send.console(Replace.replace(Util.getPrefix(),SelectMessages.OP_consoleDeop.replace("[player]", player.getName())));
|
T2Csend.console(T2Creplace.replace(Util.getPrefix(), SelectMessages.OP_consoleDeop.replace("[player]", player.getName())));
|
||||||
for (Player notifyperm : Bukkit.getOnlinePlayers()) {
|
for (Player notifyperm : Bukkit.getOnlinePlayers()) {
|
||||||
if (notifyperm.hasPermission(Permissions.notify)) {
|
if (notifyperm.hasPermission(Permissions.notify)) {
|
||||||
notifyperm.sendMessage(Replace.replace(Util.getPrefix(),SelectMessages.OP_consoleDeop.replace("[player]", player.getName())));
|
notifyperm.sendMessage(T2Creplace.replace(Util.getPrefix(), SelectMessages.OP_consoleDeop.replace("[player]", player.getName())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (SelectConfig.customCommand_Enable) {
|
|
||||||
new BukkitRunnable() {
|
if (SelectConfig.customCommandEnable) {
|
||||||
@Override
|
for (String cmd : SelectConfig.customKickCommand) {
|
||||||
public void run() {
|
T2Ccmd.console(T2Creplace.replace(Util.getPrefix(), cmd.replace("[player]", player.getName())));
|
||||||
for (String cmd : SelectConfig.customKickCommand) {
|
}
|
||||||
Cmd.console(Replace.replace(Util.getPrefix(),cmd.replace("[player]", player.getName())));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}.runTaskLater(Main.plugin, 5L);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SelectConfig.Permission_Whitelist_Enable) {
|
if (SelectConfig.permissionWhitelistEnable) {
|
||||||
for (String s : SelectConfig.permissions) {
|
for (String s : SelectConfig.permissions) {
|
||||||
if (player.hasPermission(s)) {
|
if (player.hasPermission(s)) {
|
||||||
if (!permWhitelist(player)) {
|
if (!permWhitelist(player)) {
|
||||||
if (join) {
|
if (join) {
|
||||||
send.console(Replace.replace(Util.getPrefix(),SelectMessages.Perm_consoleOnJoin.replace("[player]", player.getName()).replace("[perm]", s)));
|
T2Csend.console(T2Creplace.replace(Util.getPrefix(), SelectMessages.Perm_consoleOnJoin.replace("[player]", player.getName()).replace("[perm]", s)));
|
||||||
}
|
}
|
||||||
if (SelectConfig.Notify_Warn) {
|
if (SelectConfig.notifyWarn) {
|
||||||
for (Player notifyperm : Bukkit.getOnlinePlayers()) {
|
for (Player notifyperm : Bukkit.getOnlinePlayers()) {
|
||||||
if (notifyperm.hasPermission(Permissions.notify)) {
|
if (notifyperm.hasPermission(Permissions.notify)) {
|
||||||
if (join) {
|
if (join) {
|
||||||
notifyperm.sendMessage(Replace.replace(Util.getPrefix(),SelectMessages.Perm_consoleOnJoin.replace("[player]",
|
notifyperm.sendMessage(T2Creplace.replace(Util.getPrefix(), SelectMessages.Perm_consoleOnJoin.replace("[player]",
|
||||||
player.getName()).replace("[perm]", s)));
|
player.getName()).replace("[perm]", s)));
|
||||||
} else notifyperm.sendMessage(Replace.replace(Util.getPrefix(),SelectMessages.Perm_consoleKick.replace("[player]",
|
} else notifyperm.sendMessage(T2Creplace.replace(Util.getPrefix(), SelectMessages.Perm_consoleKick.replace("[player]",
|
||||||
player.getName()).replace("[perm]", s)));
|
player.getName()).replace("[perm]", s)));
|
||||||
if (SelectConfig.Notify_Sound_Enable) {
|
if (SelectConfig.notifySoundEnable) {
|
||||||
notifyperm.playSound(player.getLocation(), SelectConfig.Notify_Sound, 3, 1);
|
notifyperm.playSound(player.getLocation(), SelectConfig.notifySound, 3, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (SelectConfig.PlayerWhithPermission_kick && SelectConfig.Perm_Command_enable) {
|
if (SelectConfig.playerWhithPermissionKick && SelectConfig.permCommandEnable) {
|
||||||
Cmd.console(SelectConfig.KickCommand.replace("[player]", player.getName()).replace("[reason]", Replace.replace(Util.getPrefix(),SelectMessages.Perm_kick)));
|
T2Ccmd.console(SelectConfig.kickCommand.replace("[player]", player.getName()).replace("[reason]", T2Creplace.replace(Util.getPrefix(), SelectMessages.Perm_kick)));
|
||||||
send.console(Replace.replace(Util.getPrefix(),SelectMessages.Perm_consoleKick.replace("[player]",
|
T2Csend.console(T2Creplace.replace(Util.getPrefix(), SelectMessages.Perm_consoleKick.replace("[player]",
|
||||||
player.getName()).replace("[perm]", s)));
|
player.getName()).replace("[perm]", s)));
|
||||||
for (String cmd : SelectConfig.Perm_Command) {
|
for (String cmd : SelectConfig.permCommand) {
|
||||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), cmd.replace("[player]", player.getName()).replace("[perm]", s));
|
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), cmd.replace("[player]", player.getName()).replace("[perm]", s));
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if (SelectConfig.PlayerWhithPermission_kick) {
|
if (SelectConfig.playerWhithPermissionKick) {
|
||||||
Cmd.console(SelectConfig.KickCommand.replace("[player]", player.getName()).replace("[reason]", Replace.replace(Util.getPrefix(),SelectMessages.Perm_kick)));
|
T2Ccmd.console(SelectConfig.kickCommand.replace("[player]", player.getName()).replace("[reason]", T2Creplace.replace(Util.getPrefix(), SelectMessages.Perm_kick)));
|
||||||
send.console(Replace.replace(Util.getPrefix(),SelectMessages.Perm_consoleKick.replace("[player]",
|
T2Csend.console(T2Creplace.replace(Util.getPrefix(), SelectMessages.Perm_consoleKick.replace("[player]",
|
||||||
player.getName()).replace("[perm]", s)));
|
player.getName()).replace("[perm]", s)));
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
if (SelectConfig.Perm_Command_enable) {
|
if (SelectConfig.permCommandEnable) {
|
||||||
for (String cmd : SelectConfig.Perm_Command) {
|
for (String cmd : SelectConfig.permCommand) {
|
||||||
Cmd.console(cmd.replace("[player]", player.getName()).replace("[perm]", s));
|
T2Ccmd.console(cmd.replace("[player]", player.getName()).replace("[perm]", s));
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -138,29 +130,29 @@ public class Check {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static Boolean opWhitelist(Player player) {
|
private static Boolean opWhitelist(Player player) {
|
||||||
if (Main.opHashMap.containsKey(player.getName().toLowerCase())) {
|
if (Main.getOpHashMap().containsKey(player.getName().toLowerCase())) {
|
||||||
if (Main.opHashMap.get(player.getName().toLowerCase()).UUID.equals(player.getUniqueId().toString().replace("-", ""))) {
|
if (Main.getOpHashMap().get(player.getName().toLowerCase()).UUID.equals(player.getUniqueId().toString().replace("-", ""))) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
send.console(SelectMessages.ExactReason.replace("[reason]", "Player UUID: " + player.getUniqueId().toString() + " not whitelisted"));
|
T2Csend.console(SelectMessages.ExactReason.replace("[reason]", "Player UUID: " + player.getUniqueId().toString() + " not whitelisted"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
send.console(SelectMessages.ExactReason.replace("[reason]", "Player name: " + player.getName() + " not whitelisted"));
|
T2Csend.console(SelectMessages.ExactReason.replace("[reason]", "Player name: " + player.getName() + " not whitelisted"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Boolean permWhitelist(Player player) {
|
private static Boolean permWhitelist(Player player) {
|
||||||
if (Main.permissionHashMap.containsKey(player.getName().toLowerCase())) {
|
if (Main.getPermissionHashMap().containsKey(player.getName().toLowerCase())) {
|
||||||
if (Main.permissionHashMap.get(player.getName().toLowerCase()).UUID.equals(player.getUniqueId().toString().replace("-", ""))) {
|
if (Main.getPermissionHashMap().get(player.getName().toLowerCase()).UUID.equals(player.getUniqueId().toString().replace("-", ""))) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
send.console(SelectMessages.ExactReason.replace("[reason]", "Player UUID: " + player.getUniqueId().toString() + " not whitelisted"));
|
T2Csend.console(SelectMessages.ExactReason.replace("[reason]", "Player UUID: " + player.getUniqueId().toString() + " not whitelisted"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
send.console(SelectMessages.ExactReason.replace("[reason]", "Player name: " + player.getName() + " not whitelisted"));
|
T2Csend.console(SelectMessages.ExactReason.replace("[reason]", "Player name: " + player.getName() + " not whitelisted"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ package de.jatitv.opsecurity.listener;
|
|||||||
import de.jatitv.opsecurity.Util;
|
import de.jatitv.opsecurity.Util;
|
||||||
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 net.t2code.lib.Spigot.Lib.update.UpdateAPI;
|
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
|
||||||
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.*;
|
||||||
@ -15,7 +15,7 @@ public class Events implements org.bukkit.event.Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void CommandSendEvent(PlayerCommandPreprocessEvent event) {
|
public void CommandSendEvent(PlayerCommandPreprocessEvent event) {
|
||||||
if (SelectConfig.CheckOnCommand) {
|
if (SelectConfig.checkOnCommand) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
if (Check.onCheck(player, false)) {
|
if (Check.onCheck(player, false)) {
|
||||||
if (event.isCancelled()) return;
|
if (event.isCancelled()) return;
|
||||||
@ -26,7 +26,7 @@ public class Events implements org.bukkit.event.Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void PlayerChatEvent(PlayerChatEvent event) {
|
public void PlayerChatEvent(PlayerChatEvent event) {
|
||||||
if (SelectConfig.CheckOnChat) {
|
if (SelectConfig.checkOnChat) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
if (Check.onCheck(player, false)) {
|
if (Check.onCheck(player, false)) {
|
||||||
if (event.isCancelled()) return;
|
if (event.isCancelled()) return;
|
||||||
@ -37,33 +37,33 @@ public class Events implements org.bukkit.event.Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onInteract(PlayerInteractEvent event) {
|
public void onInteract(PlayerInteractEvent event) {
|
||||||
if (SelectConfig.CheckOnInteract) {
|
if (SelectConfig.checkOnInteract) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
event.setCancelled(Check.onCheck(player, false));
|
event.setCancelled(Check.onCheck(player, false));
|
||||||
}
|
}
|
||||||
}.runTaskLater(Main.plugin, 1L);
|
}.runTaskLater(Main.getPlugin(), 1L);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onJoinCheck(PlayerJoinEvent event) {
|
public void onJoinCheck(PlayerJoinEvent event) {
|
||||||
if (SelectConfig.CheckOnJoin) {
|
if (SelectConfig.checkOnJoin) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Check.onCheck(player, true);
|
Check.onCheck(player, true);
|
||||||
}
|
}
|
||||||
}.runTaskLater(Main.plugin, 1L);
|
}.runTaskLater(Main.getPlugin(), 1L);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onJoinEvent(PlayerLoginEvent event) {
|
public void onJoinEvent(PlayerLoginEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
UpdateAPI.join(Main.plugin, Util.getPrefix(), "opsecurity.updatemsg", player, Util.getSpigot(), Util.getDiscord());
|
T2CupdateAPI.join(Main.getPlugin(), Util.getPrefix(), "opsecurity.updatemsg", player, Util.getSpigotID(), Util.getDiscord());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,16 +3,8 @@
|
|||||||
|
|
||||||
package de.jatitv.opsecurity.listener;
|
package de.jatitv.opsecurity.listener;
|
||||||
|
|
||||||
import de.jatitv.opsecurity.Util;
|
|
||||||
import de.jatitv.opsecurity.config.languages.SelectMessages;
|
|
||||||
import de.jatitv.opsecurity.config.config.SelectConfig;
|
|
||||||
import de.jatitv.opsecurity.system.Main;
|
|
||||||
import net.t2code.lib.Spigot.Lib.replace.Replace;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
|
||||||
import org.bukkit.event.server.ServerCommandEvent;
|
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
@ -7,8 +7,8 @@ import de.jatitv.opsecurity.config.languages.SelectMessages;
|
|||||||
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.system.NameHistory;
|
import de.jatitv.opsecurity.system.NameHistory;
|
||||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
||||||
import net.t2code.lib.Spigot.Lib.replace.Replace;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -24,14 +24,14 @@ public class OPCommand implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onOPServer(ServerCommandEvent event) {
|
public void onOPServer(ServerCommandEvent event) {
|
||||||
|
|
||||||
if ((event.getCommand().toLowerCase().startsWith("op ") || event.getCommand().toLowerCase().startsWith("minecraft:op ")) && SelectConfig.OP_Whitelist_Enable) {
|
if ((event.getCommand().toLowerCase().startsWith("op ") || event.getCommand().toLowerCase().startsWith("minecraft:op ")) && SelectConfig.opWhitelistEnable) {
|
||||||
switch (this.isNotOPWTL(event.getCommand())) {
|
switch (this.isNotOPWTL(event.getCommand())) {
|
||||||
case 1:
|
case 1:
|
||||||
send.sender(event.getSender(), Util.getPrefix() + " " + SelectMessages.PlayerMustBeOnlineToOp);
|
T2Csend.sender(event.getSender(), Util.getPrefix() + " " + SelectMessages.PlayerMustBeOnlineToOp);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
send.sender(event.getSender(), (Replace.replace(Util.getPrefix(), Util.getPrefix() + " " + SelectMessages.OP_opCommand)));
|
T2Csend.sender(event.getSender(), (T2Creplace.replace(Util.getPrefix(), Util.getPrefix() + " " + SelectMessages.OP_opCommand)));
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -41,15 +41,15 @@ public class OPCommand implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onOpPlayer(PlayerCommandPreprocessEvent event) {
|
public void onOpPlayer(PlayerCommandPreprocessEvent event) {
|
||||||
|
|
||||||
if (SelectConfig.OP_Whitelist_Enable) {
|
if (SelectConfig.opWhitelistEnable) {
|
||||||
if ((event.getMessage().toLowerCase().startsWith("/op ") || event.getMessage().toLowerCase().startsWith("/minecraft:op "))) {
|
if ((event.getMessage().toLowerCase().startsWith("/op ") || event.getMessage().toLowerCase().startsWith("/minecraft:op "))) {
|
||||||
switch (this.isNotOPWTL(event.getMessage())) {
|
switch (this.isNotOPWTL(event.getMessage())) {
|
||||||
case 1:
|
case 1:
|
||||||
send.sender(event.getPlayer(), Util.getPrefix() + " " + SelectMessages.PlayerMustBeOnlineToOp);
|
T2Csend.sender(event.getPlayer(), Util.getPrefix() + " " + SelectMessages.PlayerMustBeOnlineToOp);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
send.player(event.getPlayer(), Replace.replace(Util.getPrefix(), Util.getPrefix() + " " + SelectMessages.OP_opCommand));
|
T2Csend.player(event.getPlayer(), T2Creplace.replace(Util.getPrefix(), Util.getPrefix() + " " + SelectMessages.OP_opCommand));
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -62,25 +62,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 ", "");
|
||||||
|
|
||||||
if (SelectConfig.PlayerMustBeOnlineToOp) {
|
if (SelectConfig.playerMustBeOnlineToOp) {
|
||||||
if (Main.opHashMap.containsKey(arg.toLowerCase())) {
|
if (Main.getOpHashMap().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().toLowerCase()).UUID.equals(target.getUniqueId().toString().replace("-", ""))) {
|
if (Main.getOpHashMap().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.toLowerCase())) {
|
if (Main.getOpHashMap().containsKey(arg.toLowerCase())) {
|
||||||
String targetUUID = null;
|
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.toLowerCase()).UUID.equals(targetUUID)) {
|
if (Main.getOpHashMap().get(arg.toLowerCase()).UUID.equals(targetUUID)) {
|
||||||
return 0;
|
return 0;
|
||||||
} else return 2;
|
} else return 2;
|
||||||
} else return 2;
|
} else return 2;
|
||||||
|
@ -4,7 +4,7 @@ package de.jatitv.opsecurity.listener;
|
|||||||
|
|
||||||
import de.jatitv.opsecurity.Util;
|
import de.jatitv.opsecurity.Util;
|
||||||
import de.jatitv.opsecurity.system.Main;
|
import de.jatitv.opsecurity.system.Main;
|
||||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||||
@ -15,25 +15,25 @@ 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.getPlugin().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.getPlugin().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.getPlugin().getDescription().getName().toLowerCase()))
|
||||||
|| (event.getCommand().toLowerCase().contains("plugman restart") && event.getCommand().toLowerCase().contains(Main.plugin.getDescription().getName().toLowerCase()))
|
|| (event.getCommand().toLowerCase().contains("plugman restart") && event.getCommand().toLowerCase().contains(Main.getPlugin().getDescription().getName().toLowerCase()))
|
||||||
) {
|
) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
send.console(Util.getPrefix() + " §4OPSecurity cannot be deactivated!");
|
T2Csend.console(Util.getPrefix() + " §4OPSecurity cannot be deactivated!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@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.getPlugin().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.getPlugin().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.getPlugin().getDescription().getName().toLowerCase()))
|
||||||
|| (event.getMessage().toLowerCase().startsWith("/plugman restart") && event.getMessage().toLowerCase().contains(Main.plugin.getDescription().getName().toLowerCase()))
|
|| (event.getMessage().toLowerCase().startsWith("/plugman restart") && event.getMessage().toLowerCase().contains(Main.getPlugin().getDescription().getName().toLowerCase()))
|
||||||
) {
|
) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
send.player(event.getPlayer(), Util.getPrefix() + " §4OPSecurity cannot be deactivated!");
|
T2Csend.player(event.getPlayer(), Util.getPrefix() + " §4OPSecurity cannot be deactivated!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,16 +11,16 @@ import org.bukkit.entity.Player;
|
|||||||
public class Timer {
|
public class Timer {
|
||||||
|
|
||||||
public static void RefreshTimer() {
|
public static void RefreshTimer() {
|
||||||
if (SelectConfig.OP_Whitelist_Enable || SelectConfig.Permission_Whitelist_Enable) {
|
if (SelectConfig.opWhitelistEnable || SelectConfig.permissionWhitelistEnable) {
|
||||||
if (SelectConfig.Timer_Enable) {
|
if (SelectConfig.timerEnable) {
|
||||||
int Count = Bukkit.getScheduler().scheduleSyncRepeatingTask(Main.plugin, new Runnable() {
|
int Count = Bukkit.getScheduler().scheduleSyncRepeatingTask(Main.getPlugin(), new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
Check.onCheck(player, false);
|
Check.onCheck(player, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 0, SelectConfig.RefreshTime * 20L);
|
}, 0, SelectConfig.refreshTime * 20L);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,25 +13,24 @@ import de.jatitv.opsecurity.listener.Events;
|
|||||||
import de.jatitv.opsecurity.listener.OPCommand;
|
import de.jatitv.opsecurity.listener.OPCommand;
|
||||||
import de.jatitv.opsecurity.listener.PlugManCommand;
|
import de.jatitv.opsecurity.listener.PlugManCommand;
|
||||||
import de.jatitv.opsecurity.listener.Timer;
|
import de.jatitv.opsecurity.listener.Timer;
|
||||||
import net.t2code.lib.Spigot.Lib.messages.T2CodeTemplate;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
||||||
import net.t2code.lib.Spigot.Lib.register.Register;
|
import net.t2code.t2codelib.SPIGOT.api.register.T2Cregister;
|
||||||
import net.t2code.lib.Spigot.Lib.update.UpdateAPI;
|
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
|
||||||
import net.t2code.lib.Spigot.system.Metrics;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class Load {
|
public class Load {
|
||||||
public static void onLoad(String prefix, List<String> autor, String version, String spigot, int spigotID, String discord, int bstatsID) {
|
public static void onLoad(String prefix, List<String> autor, String version, String spigot, int spigotID, String discord, int bstatsID) {
|
||||||
Long long_ = T2CodeTemplate.onLoadHeader(prefix, autor, version, spigot, discord);
|
Long long_ = T2Ctemplate.onLoadHeader(prefix, autor, version, spigot, discord);
|
||||||
UpdateAPI.onUpdateCheck(Main.plugin, prefix, spigot, spigotID, discord);
|
T2CupdateAPI.onUpdateCheck(Main.getPlugin(), prefix, spigotID, discord);
|
||||||
Metrics.Bstats(Main.plugin, bstatsID);
|
Metrics.Bstats();
|
||||||
loadReload();
|
loadReload();
|
||||||
Permissions.register();
|
Permissions.register();
|
||||||
Main.plugin.getCommand("opsecurity").setExecutor(new CmdExecuter());
|
Main.getPlugin().getCommand("opsecurity").setExecutor(new CmdExecuter());
|
||||||
Register.listener(new Events(), Main.plugin);
|
T2Cregister.listener(new Events(), Main.getPlugin());
|
||||||
Register.listener(new OPCommand(), Main.plugin);
|
T2Cregister.listener(new OPCommand(), Main.getPlugin());
|
||||||
Register.listener(new PlugManCommand(), Main.plugin);
|
T2Cregister.listener(new PlugManCommand(), Main.getPlugin());
|
||||||
T2CodeTemplate.onLoadFooter(prefix, long_);
|
T2Ctemplate.onLoadFooter(prefix, long_);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void loadReload() {
|
public static void loadReload() {
|
||||||
|
@ -2,29 +2,28 @@ package de.jatitv.opsecurity.system;
|
|||||||
|
|
||||||
import de.jatitv.opsecurity.Util;
|
import de.jatitv.opsecurity.Util;
|
||||||
import de.jatitv.opsecurity.objects.PlayerObject;
|
import de.jatitv.opsecurity.objects.PlayerObject;
|
||||||
import net.t2code.lib.Spigot.Lib.messages.T2CodeTemplate;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
public final class Main extends JavaPlugin {
|
public final class Main extends JavaPlugin {
|
||||||
|
|
||||||
public static List<String> autor;
|
private static List<String> autor;
|
||||||
public static String version;
|
private static String version;
|
||||||
public static Main plugin;
|
private static Main plugin;
|
||||||
private static boolean enable;
|
private static boolean enable;
|
||||||
|
|
||||||
public static File getPath() {
|
public static File getPath() {
|
||||||
return plugin.getDataFolder();
|
return plugin.getDataFolder();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HashMap<String, PlayerObject> opHashMap = new HashMap<String, PlayerObject>();
|
private static HashMap<String, PlayerObject> opHashMap = new HashMap<String, PlayerObject>();
|
||||||
public static HashMap<String, PlayerObject> permissionHashMap = new HashMap<String, PlayerObject>();
|
private static HashMap<String, PlayerObject> permissionHashMap = new HashMap<String, PlayerObject>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
@ -47,23 +46,51 @@ public final class Main extends JavaPlugin {
|
|||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
// Plugin shutdown logic
|
// Plugin shutdown logic
|
||||||
if (enable) T2CodeTemplate.onDisable(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord());
|
if (enable) T2Ctemplate.onDisable(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord());
|
||||||
}
|
}
|
||||||
public static Boolean pluginNotFound(String pl, Integer spigotID, double ver) {
|
|
||||||
|
public static Boolean pluginNotFound(String pl, Integer spigotID, String ver) {
|
||||||
if (Bukkit.getPluginManager().getPlugin(pl) == null) {
|
if (Bukkit.getPluginManager().getPlugin(pl) == null) {
|
||||||
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
|
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
|
||||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §e" + pl + " §4could not be found. Please download it here: " +
|
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §e" + pl + " §4could not be found. Please download it here: "
|
||||||
"§6https://spigotmc.org/resources/" + pl + "." + spigotID + " §4to be able to use this plugin.");
|
+ "§6https://spigotmc.org/resources/" + pl + "." + spigotID + " §4to be able to use this plugin.");
|
||||||
Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
|
Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
if (Double.parseDouble(Objects.requireNonNull(Bukkit.getPluginManager().getPlugin(pl)).getDescription().getVersion()) < ver) {
|
String plVer = Bukkit.getPluginManager().getPlugin(pl).getDescription().getVersion();
|
||||||
|
if (ver.contains("_")) {
|
||||||
|
if (!plVer.equals(ver)) {
|
||||||
|
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
|
||||||
|
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §e" + pl + " §4is out of date! This plugin requires the version §2"
|
||||||
|
+ ver + " §4of §6" + pl + " §4Please use this version! Please download it here or contact us in Discord: §6https://spigotmc.org/resources/"
|
||||||
|
+ pl + "." + spigotID + " Or contact us in Discord: http://dc.t2code.net");
|
||||||
|
Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
String[] split = plVer.split("_");
|
||||||
|
if (Double.parseDouble(split[0]) < Double.parseDouble(ver)) {
|
||||||
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
|
plugin.getLogger().log(Level.SEVERE, "Plugin can not be loaded!");
|
||||||
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §e" + pl + " §4is out of date! This plugin requires at least version §2" + ver + " §4of §6" + pl + " §4Please update it here: §6https://spigotmc.org/resources/" + pl + "." + spigotID + " §4to use this version of " + plugin.getDescription().getName() + ".");
|
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §e" + pl + " §4is out of date! This plugin requires at least version §2"
|
||||||
|
+ ver + " §4of §6" + pl + " §4Please update it here: §6https://spigotmc.org/resources/" + pl + "." + spigotID
|
||||||
|
+ " §4to use this version of " + plugin.getDescription().getName() + ".");
|
||||||
Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
|
Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Main getPlugin() {
|
||||||
|
return plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HashMap<String, PlayerObject> getOpHashMap() {
|
||||||
|
return opHashMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HashMap<String, PlayerObject> getPermissionHashMap() {
|
||||||
|
return permissionHashMap;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
// This claas was created by JaTiTV
|
// This claas was created by JaTiTV
|
||||||
|
|
||||||
package de.jatitv.opsecurity.util;
|
package de.jatitv.opsecurity.system;
|
||||||
|
|
||||||
|
import de.jatitv.opsecurity.Util;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -27,6 +28,11 @@ import java.util.zip.GZIPOutputStream;
|
|||||||
|
|
||||||
public class Metrics {
|
public class Metrics {
|
||||||
|
|
||||||
|
public static void Bstats() {
|
||||||
|
int pluginId = Util.getBstatsID(); // <-- Replace with the id of your plugin!
|
||||||
|
Metrics metrics = new Metrics(Main.getPlugin(), pluginId);
|
||||||
|
}
|
||||||
|
|
||||||
private final Plugin plugin;
|
private final Plugin plugin;
|
||||||
|
|
||||||
private final MetricsBase metricsBase;
|
private final MetricsBase metricsBase;
|
@ -1,6 +1,6 @@
|
|||||||
package de.jatitv.opsecurity.system;
|
package de.jatitv.opsecurity.system;
|
||||||
|
|
||||||
import net.t2code.lib.Spigot.Lib.register.Register;
|
import net.t2code.t2codelib.SPIGOT.api.register.T2Cregister;
|
||||||
import org.bukkit.permissions.PermissionDefault;
|
import org.bukkit.permissions.PermissionDefault;
|
||||||
|
|
||||||
public class Permissions {
|
public class Permissions {
|
||||||
@ -16,17 +16,17 @@ public class Permissions {
|
|||||||
public static final PermissionDefault notOp = PermissionDefault.NOT_OP;
|
public static final PermissionDefault notOp = PermissionDefault.NOT_OP;
|
||||||
|
|
||||||
protected static void register() {
|
protected static void register() {
|
||||||
Register.permission(notify, op, Main.plugin);
|
T2Cregister.permission(notify, op, Main.getPlugin());
|
||||||
Register.permissionDescription(notify,"Players with this permission get the update message when joining if an update is available",Main.plugin);
|
T2Cregister.permissionDescription(notify,"Players with this permission get the update message when joining if an update is available",Main.getPlugin());
|
||||||
Register.permission(updatemsg, op, Main.plugin);
|
T2Cregister.permission(updatemsg, op, Main.getPlugin());
|
||||||
Register.permission(reload, op, Main.plugin);
|
T2Cregister.permission(reload, op, Main.getPlugin());
|
||||||
Register.permission(info, op, Main.plugin);
|
T2Cregister.permission(info, op, Main.getPlugin());
|
||||||
Register.permission(help, op, Main.plugin);
|
T2Cregister.permission(help, op, Main.getPlugin());
|
||||||
|
|
||||||
Register.permission(admin, op, notify, true, Main.plugin);
|
T2Cregister.permission(admin, op, notify, true, Main.getPlugin());
|
||||||
Register.permission(admin, op, updatemsg, true, Main.plugin);
|
T2Cregister.permission(admin, op, updatemsg, true, Main.getPlugin());
|
||||||
Register.permission(admin, op, reload, true, Main.plugin);
|
T2Cregister.permission(admin, op, reload, true, Main.getPlugin());
|
||||||
Register.permission(admin, op, info, true, Main.plugin);
|
T2Cregister.permission(admin, op, info, true, Main.getPlugin());
|
||||||
Register.permission(admin, op, help, true, Main.plugin);
|
T2Cregister.permission(admin, op, help, true, Main.getPlugin());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user