2.4.0 SN 2
Code changes and performance improved. T2CodeLib is required from now on!
This commit is contained in:
parent
5812efa050
commit
b3a334239a
22
pom.xml
22
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>de.jatitv</groupId>
|
<groupId>de.jatitv</groupId>
|
||||||
<artifactId>OPSecurity</artifactId>
|
<artifactId>OPSecurity</artifactId>
|
||||||
<version>2.4.0_Snapshot_1</version>
|
<version>2.4.0_Snapshot_2</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>OPSecurity</name>
|
<name>OPSecurity</name>
|
||||||
@ -54,16 +54,26 @@
|
|||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>Builders-Paradise</id>
|
<id>spigot-repo</id>
|
||||||
<url>https://repo.t2code.net/repository/Builders-Paradise/</url>
|
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||||
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>T2Code</id>
|
||||||
|
<url>https://repo.t2code.net/repository/T2Code/</url>
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.t2code.minecraft.1_8.r3</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot</artifactId>
|
<artifactId>spigot-api</artifactId>
|
||||||
<version>1.8r3</version>
|
<version>1.8.8-R0.1-SNAPSHOT</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.t2code</groupId>
|
||||||
|
<artifactId>T2CodeLib</artifactId>
|
||||||
|
<version>10.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
34
src/main/java/de/jatitv/opsecurity/Util.java
Normal file
34
src/main/java/de/jatitv/opsecurity/Util.java
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
package de.jatitv.opsecurity;
|
||||||
|
|
||||||
|
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() {
|
||||||
|
return requiredT2CodeLibVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getPrefix() {
|
||||||
|
return Prefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Integer getSpigotID() {
|
||||||
|
return SpigotID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Integer getBstatsID() {
|
||||||
|
return BstatsID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getSpigot() {
|
||||||
|
return Spigot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getDiscord() {
|
||||||
|
return Discord;
|
||||||
|
}
|
||||||
|
}
|
@ -2,8 +2,9 @@
|
|||||||
|
|
||||||
package de.jatitv.opsecurity.cmdManagement;
|
package de.jatitv.opsecurity.cmdManagement;
|
||||||
|
|
||||||
|
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.Permissions;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
@ -19,69 +20,40 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
String version = Main.plugin.getDescription().getVersion();
|
|
||||||
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()) {
|
||||||
switch (args[0].toLowerCase()) {
|
sender.sendMessage(Util.getPrefix() + "§cOnly OPs can use OPSecurity!");
|
||||||
case "reload":
|
return false;
|
||||||
case "rl":
|
|
||||||
if (sender.hasPermission("opsecurity.command.reload")) {
|
|
||||||
Commands.reload(sender);
|
|
||||||
} else sender.sendMessage(Main.Prefix + "§cYou do not have permission for OPSecurity!");
|
|
||||||
break;
|
|
||||||
case "info":
|
|
||||||
case "plugin":
|
|
||||||
case "pl":
|
|
||||||
case "version":
|
|
||||||
case "ver":
|
|
||||||
if (sender.hasPermission("opsecurity.command.info")) {
|
|
||||||
Commands.info(sender);
|
|
||||||
} else sender.sendMessage(Main.Prefix + "§cYou do not have permission for OPSecurity!");
|
|
||||||
break;
|
|
||||||
case "help":
|
|
||||||
default:
|
|
||||||
if (sender.hasPermission("opsecurity.command.help")) {
|
|
||||||
SelectConfig.Help(sender);
|
|
||||||
} else sender.sendMessage(Main.Prefix + "§cYou do not have permission for OPSecurity!");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else sender.sendMessage(Main.Prefix + "§cOnly OPs can use OPSecurity!");
|
|
||||||
} else {
|
|
||||||
switch (args[0].toLowerCase()) {
|
|
||||||
case "reload":
|
|
||||||
case "rl":
|
|
||||||
if (sender.hasPermission("opsecurity.command.reload")) {
|
|
||||||
Commands.reload(sender);
|
|
||||||
} else sender.sendMessage(Main.Prefix + "§cYou do not have permission for OPSecurity!");
|
|
||||||
break;
|
|
||||||
case "info":
|
|
||||||
case "plugin":
|
|
||||||
case "pl":
|
|
||||||
case "version":
|
|
||||||
case "ver":
|
|
||||||
if (sender.hasPermission("opsecurity.command.info")) {
|
|
||||||
Commands.info(sender);
|
|
||||||
} else sender.sendMessage(Main.Prefix + "§cYou do not have permission for OPSecurity!");
|
|
||||||
break;
|
|
||||||
case "help":
|
|
||||||
default:
|
|
||||||
if (sender.hasPermission("opsecurity.command.help")) {
|
|
||||||
SelectConfig.Help(sender);
|
|
||||||
} else sender.sendMessage(Main.Prefix + "§cYou do not have permission for OPSecurity!");
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
switch (args[0].toLowerCase()) {
|
||||||
|
case "reload":
|
||||||
|
case "rl":
|
||||||
|
Commands.reload(sender);
|
||||||
|
break;
|
||||||
|
case "info":
|
||||||
|
case "plugin":
|
||||||
|
case "pl":
|
||||||
|
case "version":
|
||||||
|
case "ver":
|
||||||
|
Commands.info(sender);
|
||||||
|
break;
|
||||||
|
case "help":
|
||||||
|
default:
|
||||||
|
SelectConfig.Help(sender);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static HashMap<String, String> arg1 = new HashMap<String, String>() {{
|
private static HashMap<String, String> arg1 = new HashMap<String, String>() {{
|
||||||
put("help", "opsecurity.admin");
|
put("help", Permissions.help);
|
||||||
put("reload", "opsecurity.admin");
|
put("reload", Permissions.reload);
|
||||||
put("info", "opsecurity.admin");
|
put("info", Permissions.info);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,100 +1,70 @@
|
|||||||
package de.jatitv.opsecurity.cmdManagement;
|
package de.jatitv.opsecurity.cmdManagement;
|
||||||
|
|
||||||
|
import de.jatitv.opsecurity.Util;
|
||||||
import de.jatitv.opsecurity.config.languages.SelectMessages;
|
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.Load;
|
import de.jatitv.opsecurity.system.Load;
|
||||||
import de.jatitv.opsecurity.system.Main;
|
import de.jatitv.opsecurity.system.Main;
|
||||||
import de.jatitv.opsecurity.util.TextBuilder;
|
import de.jatitv.opsecurity.system.Permissions;
|
||||||
import de.jatitv.opsecurity.util.send;
|
|
||||||
import net.md_5.bungee.api.chat.ClickEvent;
|
import net.md_5.bungee.api.chat.ClickEvent;
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
|
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 org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class Commands {
|
public class Commands {
|
||||||
private static Plugin plugin = Main.plugin;
|
|
||||||
private static String Prefix = Main.Prefix;
|
|
||||||
private static String Autor = String.valueOf(Main.Autor);
|
|
||||||
private static String Version = Main.Version;
|
|
||||||
private static String Spigot = Main.Spigot;
|
|
||||||
private static String Discord = Main.Discord;
|
|
||||||
|
|
||||||
public static void mainCommand(CommandSender sender) {
|
public static void mainCommand(CommandSender sender) {
|
||||||
if (SelectConfig.OnlyOPcanUseThePlugin) {
|
if (SelectConfig.OnlyOPcanUseThePlugin) {
|
||||||
if (sender.isOp()) {
|
if (!sender.isOp()) {
|
||||||
if (sender.hasPermission("opsecurity.admin")) {
|
sender.sendMessage(Util.getPrefix() + "§cOnly OPs can use OPSecurity!");
|
||||||
SelectConfig.Help(sender);
|
return;
|
||||||
} else sender.sendMessage(Main.Prefix + "§cYou do not have permission for OPSecurity!");
|
}
|
||||||
} else sender.sendMessage(Main.Prefix + "§cOnly OPs can use OPSecurity!");
|
|
||||||
} else {
|
|
||||||
if (sender.hasPermission("opsecurity.admin")) {
|
|
||||||
SelectConfig.Help(sender);
|
|
||||||
} else sender.sendMessage(Main.Prefix + " §cYou do not have permission for OPSecurity!");
|
|
||||||
}
|
}
|
||||||
|
if (sender.hasPermission(Permissions.help)) {
|
||||||
|
SelectConfig.Help(sender);
|
||||||
|
} else sender.sendMessage(Util.getPrefix() + " §cYou do not have permission for OPSecurity!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void reload(CommandSender sender) {
|
public static void reload(CommandSender sender) {
|
||||||
|
if (!sender.hasPermission(Permissions.reload)) {
|
||||||
|
sender.sendMessage(Util.getPrefix() + "§cYou do not have permission for OPSecurity!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
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.opHashMap.containsKey(player.getName().toLowerCase())) {
|
||||||
if (Main.opHashMap.get(player.getName().toLowerCase()).UUID.equals(player.getUniqueId().toString().replace("-", ""))) {
|
sender.sendMessage(Util.getPrefix() + " §4You are not on the Whitelist!");
|
||||||
send.player(player, SelectMessages.ReloadStart);
|
return;
|
||||||
Bukkit.getConsoleSender().sendMessage(Main.Prefix + "§8-------------------------------");
|
}
|
||||||
Bukkit.getConsoleSender().sendMessage(Main.Prefix + "§6Plugin reload...");
|
if (!Main.opHashMap.get(player.getName().toLowerCase()).UUID.equals(player.getUniqueId().toString().replace("-", ""))) {
|
||||||
Bukkit.getConsoleSender().sendMessage(Main.Prefix + "§8-------------------------------");
|
sender.sendMessage(Util.getPrefix() + " §4You are not on the Whitelist!");
|
||||||
Load.loadReload();
|
return;
|
||||||
Bukkit.getConsoleSender().sendMessage(Main.Prefix + "§8-------------------------------");
|
}
|
||||||
Bukkit.getConsoleSender().sendMessage(Main.Prefix + " §2Plugin successfully reloaded.");
|
send.player(player, SelectMessages.ReloadStart);
|
||||||
Bukkit.getConsoleSender().sendMessage(Main.Prefix + "§8-------------------------------");
|
|
||||||
send.player(player, SelectMessages.ReloadEnd);
|
|
||||||
} else sender.sendMessage(Main.Prefix + " §4You are not on the Whitelist!");
|
|
||||||
|
|
||||||
|
|
||||||
} else sender.sendMessage(Main.Prefix + " §4You are not on the Whitelist!");
|
|
||||||
} else {
|
|
||||||
Bukkit.getConsoleSender().sendMessage(Main.Prefix + "§8-------------------------------");
|
|
||||||
Bukkit.getConsoleSender().sendMessage(Main.Prefix + " §6Plugin reload...");
|
|
||||||
Bukkit.getConsoleSender().sendMessage(Main.Prefix + "§8-------------------------------");
|
|
||||||
Load.loadReload();
|
|
||||||
Bukkit.getConsoleSender().sendMessage(Main.Prefix + "§8-------------------------------");
|
|
||||||
Bukkit.getConsoleSender().sendMessage(Main.Prefix + " §2Plugin successfully reloaded.");
|
|
||||||
Bukkit.getConsoleSender().sendMessage(Main.Prefix + "§8-------------------------------");
|
|
||||||
}
|
}
|
||||||
|
if (sender instanceof Player) send.player((Player) sender, SelectMessages.ReloadEnd);
|
||||||
|
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + "§8-------------------------------");
|
||||||
|
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §6Plugin reload...");
|
||||||
|
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + "§8-------------------------------");
|
||||||
|
Load.loadReload();
|
||||||
|
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + "§8-------------------------------");
|
||||||
|
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §2Plugin successfully reloaded.");
|
||||||
|
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + "§8-------------------------------");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void info(CommandSender sender) {
|
public static void info(CommandSender sender) {
|
||||||
sender.sendMessage(Main.Prefix + "§8-------- §4Plugin-Info §8--------");
|
if (!sender.hasPermission(Permissions.info)) {
|
||||||
sender.sendMessage(Main.Prefix + "§2This plugin was developed by §9JaTiTV");
|
sender.sendMessage(Util.getPrefix() + "§cYou do not have permission for OPSecurity!");
|
||||||
sender.sendMessage(Main.Prefix + "§2");
|
return;
|
||||||
sender.sendMessage(Main.Prefix + "§2Twitch: §ehttps://www.twitch.tv/jatitv");
|
|
||||||
sender.sendMessage(Main.Prefix + "§2Support-Discord: §e" + Main.Discord);
|
|
||||||
sender.sendMessage(Main.Prefix + "§2Spigot: §e" + Main.Spigot);
|
|
||||||
sender.sendMessage(Main.Prefix + "§2");
|
|
||||||
sender.sendMessage(Main.Prefix + "§2Version: §6" + Main.plugin.getDescription().getVersion());
|
|
||||||
sender.sendMessage(Main.Prefix + "§8-----------------------------");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void info(CommandSender sender, Boolean onlyOP) {
|
|
||||||
Player player = (Player) sender;
|
|
||||||
sender.sendMessage(Prefix + "§4======= §8[§4Command§9GUI§8] §4=======");
|
|
||||||
sender.sendMessage(Prefix + " §2Autor: §6" + String.valueOf(Autor).replace("[", "").replace("]", ""));
|
|
||||||
|
|
||||||
if (Main.update_version.equalsIgnoreCase(Version)) {
|
|
||||||
sender.sendMessage(Prefix + " §2Version: §6" + Version);
|
|
||||||
} else {
|
|
||||||
sender.sendMessage(Prefix + " §6A new version was found!");
|
|
||||||
TextComponent comp = new TextBuilder(Prefix + " §6Your version: §c" + Version + " §7- §6Current version: §a" + Main.update_version)
|
|
||||||
.addHover("§6You can download it here: §e" + Main.Spigot).addClickEvent(ClickEvent.Action.OPEN_URL, Main.Spigot).build();
|
|
||||||
player.spigot().sendMessage(comp);
|
|
||||||
TextComponent comp2 = new TextBuilder(Prefix + " §6You can find more information on Discord.")
|
|
||||||
.addHover("§e" + Main.Discord).addClickEvent(ClickEvent.Action.OPEN_URL, Main.Discord).build();
|
|
||||||
player.spigot().sendMessage(comp2);
|
|
||||||
}
|
}
|
||||||
sender.sendMessage(Prefix + " §2Spigot: §6" + Spigot);
|
T2CodeTemplate.sendInfo(sender, Util.getPrefix(), Util.getSpigot(), Util.getDiscord(), Main.autor, Main.version, UpdateAPI.PluginVersionen.get(Main.plugin.getName()).publicVersion);
|
||||||
sender.sendMessage(Prefix + " §2Discord: §6" + Discord);
|
|
||||||
sender.sendMessage(Prefix + "§4======= §8[§4Command§9GUI§8] §4=======");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package de.jatitv.opsecurity.config.config;
|
package de.jatitv.opsecurity.config.config;
|
||||||
|
|
||||||
|
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 de.jatitv.opsecurity.util.send;
|
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||||
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;
|
||||||
@ -38,7 +39,7 @@ public class ConfigConvert {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String replace = Main.getPath().toString() + "/";
|
String replace = Main.getPath().toString() + "/";
|
||||||
send.convert(configOld.toString().replace(replace, ""), config.toString().replace(replace, ""));
|
convert(configOld.toString().replace(replace, ""), config.toString().replace(replace, ""));
|
||||||
try {
|
try {
|
||||||
Files.move(configOld, config);
|
Files.move(configOld, config);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -58,7 +59,7 @@ public class ConfigConvert {
|
|||||||
switch (yamlConfiguration.getString("Plugin.language")) {
|
switch (yamlConfiguration.getString("Plugin.language")) {
|
||||||
case "de_DE":
|
case "de_DE":
|
||||||
yamlConfiguration.set("Plugin.language", "german");
|
yamlConfiguration.set("Plugin.language", "german");
|
||||||
send.convert("config.yml", "Plugin.language: de_DE", "Plugin.language: german");
|
convert("config.yml", "Plugin.language: de_DE", "Plugin.language: german");
|
||||||
try {
|
try {
|
||||||
yamlConfiguration.save(config);
|
yamlConfiguration.save(config);
|
||||||
} catch (IOException tac) {
|
} catch (IOException tac) {
|
||||||
@ -67,7 +68,7 @@ public class ConfigConvert {
|
|||||||
break;
|
break;
|
||||||
case "en_EN":
|
case "en_EN":
|
||||||
yamlConfiguration.set("Plugin.language", "english");
|
yamlConfiguration.set("Plugin.language", "english");
|
||||||
send.convert("config.yml", "Plugin.language: en_EN", "Plugin.language: english");
|
convert("config.yml", "Plugin.language: en_EN", "Plugin.language: english");
|
||||||
try {
|
try {
|
||||||
yamlConfiguration.save(config);
|
yamlConfiguration.save(config);
|
||||||
} catch (IOException tac) {
|
} catch (IOException tac) {
|
||||||
@ -76,7 +77,7 @@ public class ConfigConvert {
|
|||||||
break;
|
break;
|
||||||
case "no_NO":
|
case "no_NO":
|
||||||
yamlConfiguration.set("Plugin.language", "norwegian");
|
yamlConfiguration.set("Plugin.language", "norwegian");
|
||||||
send.convert("config.yml", "Plugin.language: no_NO", "Plugin.language: norwegian");
|
convert("config.yml", "Plugin.language: no_NO", "Plugin.language: norwegian");
|
||||||
try {
|
try {
|
||||||
yamlConfiguration.save(config);
|
yamlConfiguration.save(config);
|
||||||
} catch (IOException tac) {
|
} catch (IOException tac) {
|
||||||
@ -94,9 +95,9 @@ public class ConfigConvert {
|
|||||||
Integer time = yamlConfiguration.getInt("Timer.RefreshTime_inSec");
|
Integer time = yamlConfiguration.getInt("Timer.RefreshTime_inSec");
|
||||||
|
|
||||||
yamlConfiguration.set("Check.Timer.Enable", enable);
|
yamlConfiguration.set("Check.Timer.Enable", enable);
|
||||||
send.convert("config.yml", "Timer.Enable: " + enable, "Check.Timer.Enable: " + enable);
|
convert("config.yml", "Timer.Enable: " + enable, "Check.Timer.Enable: " + enable);
|
||||||
yamlConfiguration.set("Check.Timer.RefreshTime_inSec", time);
|
yamlConfiguration.set("Check.Timer.RefreshTime_inSec", time);
|
||||||
send.convert("config.yml", "Timer.RefreshTime_inSec: " + time, "Check.Timer.RefreshTime_inSec: " + time);
|
convert("config.yml", "Timer.RefreshTime_inSec: " + time, "Check.Timer.RefreshTime_inSec: " + time);
|
||||||
|
|
||||||
yamlConfiguration.set("Timer", null);
|
yamlConfiguration.set("Timer", null);
|
||||||
try {
|
try {
|
||||||
@ -125,6 +126,13 @@ public class ConfigConvert {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public static void convert(String oldConfig, String newConfig) {
|
||||||
|
send.console(Util.getPrefix() + " §5Convert: §4" + oldConfig + " §5--> §2" + newConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void convert(String config, String oldConfig, String newConfig) {
|
||||||
|
send.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) {
|
||||||
for (String Player : oldPlayer) {
|
for (String Player : oldPlayer) {
|
||||||
@ -133,10 +141,10 @@ public class ConfigConvert {
|
|||||||
if (uuid == null) {
|
if (uuid == null) {
|
||||||
send.warning(Main.plugin,
|
send.warning(Main.plugin,
|
||||||
"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!");
|
||||||
send.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!");
|
||||||
} else {
|
} else {
|
||||||
send.convert("config.yml", oldPath + ": " + Player, newPath + ": " + Player + ": UUID: " + uuid);
|
convert("config.yml", oldPath + ": " + Player, newPath + ": " + Player + ": UUID: " + uuid);
|
||||||
yamlConfiguration.set(newPath + Player + ".UUID", uuid);
|
yamlConfiguration.set(newPath + Player + ".UUID", uuid);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -155,7 +163,7 @@ public class ConfigConvert {
|
|||||||
if(Files.exists(messagesDE) && !Files.isDirectory(messagesDE)) {
|
if(Files.exists(messagesDE) && !Files.isDirectory(messagesDE)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
send.convert(messagesDEold.toString().replace(replace, ""), messagesDE.toString().replace(replace, ""));
|
convert(messagesDEold.toString().replace(replace, ""), messagesDE.toString().replace(replace, ""));
|
||||||
try {
|
try {
|
||||||
Files.move(messagesDEold, messagesDE);
|
Files.move(messagesDEold, messagesDE);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -169,7 +177,7 @@ public class ConfigConvert {
|
|||||||
if(Files.exists(messagesEN) && !Files.isDirectory(messagesEN)) {
|
if(Files.exists(messagesEN) && !Files.isDirectory(messagesEN)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
send.convert(messagesENold.toString().replace(replace, ""), messagesEN.toString().replace(replace, ""));
|
convert(messagesENold.toString().replace(replace, ""), messagesEN.toString().replace(replace, ""));
|
||||||
try {
|
try {
|
||||||
Files.move(messagesENold, messagesEN);
|
Files.move(messagesENold, messagesEN);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -183,7 +191,7 @@ public class ConfigConvert {
|
|||||||
if(Files.exists(messagesNO) && !Files.isDirectory(messagesNO)) {
|
if(Files.exists(messagesNO) && !Files.isDirectory(messagesNO)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
send.convert(messagesNOold.toString().replace(replace, ""), messagesNO.toString().replace(replace, ""));
|
convert(messagesNOold.toString().replace(replace, ""), messagesNO.toString().replace(replace, ""));
|
||||||
try {
|
try {
|
||||||
Files.move(messagesNOold, messagesNO);
|
Files.move(messagesNOold, messagesNO);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -3,6 +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 org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
@ -87,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 (Main.minecraft1_8) {
|
if (MCVersion.minecraft1_8) {
|
||||||
set("Notify.Sound.Sound", Notify_Sound_1_8, yamlConfiguration);
|
set("Notify.Sound.Sound", Notify_Sound_1_8, yamlConfiguration);
|
||||||
} else if (Main.minecraft1_9 || Main.minecraft1_10 || Main.minecraft1_11 || Main.minecraft1_12) {
|
} else if (MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_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);
|
||||||
|
|
||||||
|
@ -2,10 +2,11 @@
|
|||||||
|
|
||||||
package de.jatitv.opsecurity.config.config;
|
package de.jatitv.opsecurity.config.config;
|
||||||
|
|
||||||
import de.jatitv.opsecurity.config.languages.SelectMessages;
|
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 org.bukkit.Bukkit;
|
import de.jatitv.opsecurity.system.Permissions;
|
||||||
|
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;
|
||||||
@ -50,7 +51,7 @@ public class SelectConfig {
|
|||||||
public static List<String> customKickCommand;
|
public static List<String> customKickCommand;
|
||||||
|
|
||||||
public static Boolean Permission_Whitelist_Enable;
|
public static Boolean Permission_Whitelist_Enable;
|
||||||
public static List<String> Permissions;
|
public static List<String> permissions;
|
||||||
|
|
||||||
public static Boolean PlayerWhithPermission_kick;
|
public static Boolean PlayerWhithPermission_kick;
|
||||||
public static Boolean Perm_Command_enable;
|
public static Boolean Perm_Command_enable;
|
||||||
@ -63,13 +64,19 @@ public class SelectConfig {
|
|||||||
|
|
||||||
//help
|
//help
|
||||||
public static void Help(CommandSender sender) {
|
public static void Help(CommandSender sender) {
|
||||||
sender.sendMessage(Main.Prefix + " §8----- §2OP§4Security §chelp §8-----");
|
if (sender.hasPermission(Permissions.help)) {
|
||||||
sender.sendMessage(Main.Prefix);
|
sender.sendMessage(Util.getPrefix() + "§cYou do not have permission for OPSecurity!");
|
||||||
sender.sendMessage(Main.Prefix + " §8'§b/opsecurity reload§8' §eReload the Plugin.");
|
return;
|
||||||
sender.sendMessage(Main.Prefix + " §8'§b/opsecurity help§8' §eOpens this help.");
|
}
|
||||||
sender.sendMessage(Main.Prefix + " §8'§b/opsecurity info§8' §eCall the info about §2OP§4Security§e.");
|
|
||||||
sender.sendMessage(Main.Prefix);
|
|
||||||
sender.sendMessage(Main.Prefix + " §8----------------------------");
|
sender.sendMessage(Util.getPrefix() + " §8----- §2OP§4Security §chelp §8-----");
|
||||||
|
sender.sendMessage(Util.getPrefix());
|
||||||
|
sender.sendMessage(Util.getPrefix() + " §8'§b/opsecurity reload§8' §eReload the Plugin.");
|
||||||
|
sender.sendMessage(Util.getPrefix() + " §8'§b/opsecurity help§8' §eOpens this help.");
|
||||||
|
sender.sendMessage(Util.getPrefix() + " §8'§b/opsecurity info§8' §eCall the info about §2OP§4Security§e.");
|
||||||
|
sender.sendMessage(Util.getPrefix());
|
||||||
|
sender.sendMessage(Util.getPrefix() + " §8----------------------------");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onSelect() {
|
public static void onSelect() {
|
||||||
@ -103,7 +110,7 @@ public class SelectConfig {
|
|||||||
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.opHashMap.put(key.toLowerCase(), player);
|
||||||
}
|
}
|
||||||
@ -114,12 +121,12 @@ public class SelectConfig {
|
|||||||
customCommand_Enable = yamlConfiguration.getBoolean("OP_Whitelist.customCommands.Enable");
|
customCommand_Enable = 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");
|
Permission_Whitelist_Enable = 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<>();
|
||||||
for (String key : yamlConfiguration.getConfigurationSection("Permission_Whitelist.Whitelist").getKeys(false)) {
|
for (String key : yamlConfiguration.getConfigurationSection("Permission_Whitelist.Whitelist").getKeys(false)) {
|
||||||
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.permissionHashMap.put(key.toLowerCase(), player);
|
||||||
}
|
}
|
||||||
@ -133,23 +140,6 @@ public class SelectConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void sound() {
|
public static void sound() {
|
||||||
String soundNotify;
|
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());
|
||||||
|
|
||||||
if (Main.minecraft1_8) {
|
|
||||||
soundNotify = CreateConfig.Notify_Sound_1_8;
|
|
||||||
} else if (Main.minecraft1_9 || Main.minecraft1_10 || Main.minecraft1_11 || Main.minecraft1_12) {
|
|
||||||
soundNotify = CreateConfig.Notify_Sound_1_9_to_1_12;
|
|
||||||
} else soundNotify = CreateConfig.Notify_Sound_from_1_13;
|
|
||||||
|
|
||||||
try {
|
|
||||||
Sound sound_Notify = Sound.valueOf(Notify_Sound_input);
|
|
||||||
if (sound_Notify != null) {
|
|
||||||
Notify_Sound = sound_Notify;
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
Bukkit.getConsoleSender().sendMessage("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", Main.Prefix)
|
|
||||||
.replace("[sound]", "§8PlayerNotFound: §6" + Notify_Sound_input) + "§4\n§4\n§4\n");
|
|
||||||
Notify_Sound = Sound.valueOf(soundNotify);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,9 @@
|
|||||||
|
|
||||||
package de.jatitv.opsecurity.config.languages;
|
package de.jatitv.opsecurity.config.languages;
|
||||||
|
|
||||||
|
import de.jatitv.opsecurity.Util;
|
||||||
import de.jatitv.opsecurity.system.Main;
|
import de.jatitv.opsecurity.system.Main;
|
||||||
import de.jatitv.opsecurity.util.send;
|
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -94,7 +95,7 @@ public class LanguagesCreate {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
send.console(Main.Prefix + " §2Language files were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
send.console(Util.getPrefix() + " §2Language files were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void set(String path, String value, YamlConfiguration config) {
|
private static void set(String path, String value, YamlConfiguration config) {
|
||||||
|
@ -3,10 +3,11 @@
|
|||||||
|
|
||||||
package de.jatitv.opsecurity.config.languages;
|
package de.jatitv.opsecurity.config.languages;
|
||||||
|
|
||||||
|
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 de.jatitv.opsecurity.util.Replace;
|
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||||
import de.jatitv.opsecurity.util.send;
|
import net.t2code.lib.Spigot.Lib.replace.Replace;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -79,7 +80,7 @@ public class SelectMessages {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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(Util.getPrefix(),yamlConfiguration.getString(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
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.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.util.Replace;
|
import de.jatitv.opsecurity.system.Permissions;
|
||||||
import de.jatitv.opsecurity.util.Cmd;
|
import net.t2code.lib.Spigot.Lib.commands.Cmd;
|
||||||
import de.jatitv.opsecurity.util.send;
|
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||||
|
import net.t2code.lib.Spigot.Lib.replace.Replace;
|
||||||
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;
|
||||||
@ -18,14 +20,14 @@ public class Check {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (join) {
|
if (join) {
|
||||||
send.console(Replace.replace(SelectMessages.OP_consoleOnJoin.replace("[player]", player.getName())));
|
send.console(Replace.replace(Util.getPrefix(),SelectMessages.OP_consoleOnJoin.replace("[player]", player.getName())));
|
||||||
}
|
}
|
||||||
if (SelectConfig.Notify_Warn) {
|
if (SelectConfig.Notify_Warn) {
|
||||||
for (Player notifyperm : Bukkit.getOnlinePlayers()) {
|
for (Player notifyperm : Bukkit.getOnlinePlayers()) {
|
||||||
if (notifyperm.hasPermission("opsecurity.notify")) {
|
if (notifyperm.hasPermission(Permissions.notify)) {
|
||||||
if (join) {
|
if (join) {
|
||||||
notifyperm.sendMessage(Replace.replace(SelectMessages.OP_consoleOnJoin.replace("[player]", player.getName())));
|
notifyperm.sendMessage(Replace.replace(Util.getPrefix(),SelectMessages.OP_consoleOnJoin.replace("[player]", player.getName())));
|
||||||
} else notifyperm.sendMessage(Replace.replace(SelectMessages.OP_consoleKick.replace("[player]", player.getName())));
|
} else notifyperm.sendMessage(Replace.replace(Util.getPrefix(),SelectMessages.OP_consoleKick.replace("[player]", player.getName())));
|
||||||
if (SelectConfig.Notify_Sound_Enable) {
|
if (SelectConfig.Notify_Sound_Enable) {
|
||||||
notifyperm.playSound(player.getLocation(), SelectConfig.Notify_Sound, 3, 1);
|
notifyperm.playSound(player.getLocation(), SelectConfig.Notify_Sound, 3, 1);
|
||||||
}
|
}
|
||||||
@ -35,16 +37,16 @@ public class Check {
|
|||||||
if (SelectConfig.no_OP_Player_kick && SelectConfig.no_OP_Player_deop) {
|
if (SelectConfig.no_OP_Player_kick && SelectConfig.no_OP_Player_deop) {
|
||||||
player.setOp(false);
|
player.setOp(false);
|
||||||
Cmd.console(SelectConfig.KickCommand.replace("[player]", player.getName())
|
Cmd.console(SelectConfig.KickCommand.replace("[player]", player.getName())
|
||||||
.replace("[reason]", Replace.replace(SelectMessages.OP_kick + "\n" + "\n" + SelectMessages.OP_deop)));
|
.replace("[reason]", Replace.replace(Util.getPrefix(),SelectMessages.OP_kick + "\n" + "\n" + SelectMessages.OP_deop)));
|
||||||
send.console(Replace.replace(SelectMessages.OP_consoleKick.replace("[player]", player.getName())));
|
send.console(Replace.replace(Util.getPrefix(),SelectMessages.OP_consoleKick.replace("[player]", player.getName())));
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
if (SelectConfig.no_OP_Player_kick) {
|
if (SelectConfig.no_OP_Player_kick) {
|
||||||
Cmd.console(SelectConfig.KickCommand.replace("[player]", player.getName()).replace("[reason]", Replace.replace(SelectMessages.OP_kick)));
|
Cmd.console(SelectConfig.KickCommand.replace("[player]", player.getName()).replace("[reason]", Replace.replace(Util.getPrefix(),SelectMessages.OP_kick)));
|
||||||
send.console(Replace.replace(SelectMessages.OP_consoleKick.replace("[player]", player.getName())));
|
send.console(Replace.replace(Util.getPrefix(),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(Permissions.notify)) {
|
||||||
notifyperm.sendMessage(Replace.replace(SelectMessages.OP_consoleKick.replace("[player]", player.getName())
|
notifyperm.sendMessage(Replace.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())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -56,15 +58,15 @@ public class Check {
|
|||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
player.sendMessage(Replace.replace(SelectMessages.OP_deop));
|
player.sendMessage(Replace.replace(Util.getPrefix(),SelectMessages.OP_deop));
|
||||||
}
|
}
|
||||||
}.runTaskLater(Main.plugin, 5L);
|
}.runTaskLater(Main.plugin, 5L);
|
||||||
|
|
||||||
}
|
}
|
||||||
send.console(Replace.replace(SelectMessages.OP_consoleDeop.replace("[player]", player.getName())));
|
send.console(Replace.replace(Util.getPrefix(),SelectMessages.OP_consoleDeop.replace("[player]", player.getName())));
|
||||||
for (Player notifyperm : Bukkit.getOnlinePlayers()) {
|
for (Player notifyperm : Bukkit.getOnlinePlayers()) {
|
||||||
if (notifyperm.hasPermission("opsecurity.notify")) {
|
if (notifyperm.hasPermission(Permissions.notify)) {
|
||||||
notifyperm.sendMessage(Replace.replace(SelectMessages.OP_consoleDeop.replace("[player]", player.getName())));
|
notifyperm.sendMessage(Replace.replace(Util.getPrefix(),SelectMessages.OP_consoleDeop.replace("[player]", player.getName())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -75,7 +77,7 @@ public class Check {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
for (String cmd : SelectConfig.customKickCommand) {
|
for (String cmd : SelectConfig.customKickCommand) {
|
||||||
Cmd.console(Replace.replace(cmd.replace("[player]", player.getName())));
|
Cmd.console(Replace.replace(Util.getPrefix(),cmd.replace("[player]", player.getName())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.runTaskLater(Main.plugin, 5L);
|
}.runTaskLater(Main.plugin, 5L);
|
||||||
@ -85,19 +87,19 @@ public class Check {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (SelectConfig.Permission_Whitelist_Enable) {
|
if (SelectConfig.Permission_Whitelist_Enable) {
|
||||||
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(SelectMessages.Perm_consoleOnJoin.replace("[player]", player.getName()).replace("[perm]", s)));
|
send.console(Replace.replace(Util.getPrefix(),SelectMessages.Perm_consoleOnJoin.replace("[player]", player.getName()).replace("[perm]", s)));
|
||||||
}
|
}
|
||||||
if (SelectConfig.Notify_Warn) {
|
if (SelectConfig.Notify_Warn) {
|
||||||
for (Player notifyperm : Bukkit.getOnlinePlayers()) {
|
for (Player notifyperm : Bukkit.getOnlinePlayers()) {
|
||||||
if (notifyperm.hasPermission("opsecurity.notify")) {
|
if (notifyperm.hasPermission(Permissions.notify)) {
|
||||||
if (join) {
|
if (join) {
|
||||||
notifyperm.sendMessage(Replace.replace(SelectMessages.Perm_consoleOnJoin.replace("[player]",
|
notifyperm.sendMessage(Replace.replace(Util.getPrefix(),SelectMessages.Perm_consoleOnJoin.replace("[player]",
|
||||||
player.getName()).replace("[perm]", s)));
|
player.getName()).replace("[perm]", s)));
|
||||||
} else notifyperm.sendMessage(Replace.replace(SelectMessages.Perm_consoleKick.replace("[player]",
|
} else notifyperm.sendMessage(Replace.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.Notify_Sound_Enable) {
|
||||||
notifyperm.playSound(player.getLocation(), SelectConfig.Notify_Sound, 3, 1);
|
notifyperm.playSound(player.getLocation(), SelectConfig.Notify_Sound, 3, 1);
|
||||||
@ -106,8 +108,8 @@ 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(Util.getPrefix(),SelectMessages.Perm_kick)));
|
||||||
send.console(Replace.replace(SelectMessages.Perm_consoleKick.replace("[player]",
|
send.console(Replace.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.Perm_Command) {
|
||||||
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));
|
||||||
@ -116,8 +118,8 @@ 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(Util.getPrefix(),SelectMessages.Perm_kick)));
|
||||||
send.console(Replace.replace(SelectMessages.Perm_consoleKick.replace("[player]",
|
send.console(Replace.replace(Util.getPrefix(),SelectMessages.Perm_consoleKick.replace("[player]",
|
||||||
player.getName()).replace("[perm]", s)));
|
player.getName()).replace("[perm]", s)));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,10 @@
|
|||||||
|
|
||||||
package de.jatitv.opsecurity.listener;
|
package de.jatitv.opsecurity.listener;
|
||||||
|
|
||||||
|
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 de.jatitv.opsecurity.util.UpdateChecker;
|
import net.t2code.lib.Spigot.Lib.update.UpdateAPI;
|
||||||
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.*;
|
||||||
@ -19,12 +20,13 @@ public class Events implements org.bukkit.event.Listener {
|
|||||||
event.setCancelled(Check.onCheck(player, false));
|
event.setCancelled(Check.onCheck(player, false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@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()){
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -52,7 +54,7 @@ public class Events implements org.bukkit.event.Listener {
|
|||||||
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.plugin, 1L);
|
||||||
}
|
}
|
||||||
@ -61,18 +63,6 @@ public class Events implements org.bukkit.event.Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onJoinEvent(PlayerLoginEvent event) {
|
public void onJoinEvent(PlayerLoginEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
String foundVersion = Main.plugin.getDescription().getVersion();
|
UpdateAPI.join(Main.plugin, Util.getPrefix(), "opsecurity.updatemsg", player, Util.getSpigot(), Util.getDiscord());
|
||||||
if (player.hasPermission("opsecurity.updatemsg") || player.isOp()) {
|
|
||||||
if (!foundVersion.equals(Main.update_version)) {
|
|
||||||
if (SelectConfig.UpdateCheckOnJoin) {
|
|
||||||
new BukkitRunnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
UpdateChecker.sendUpdateMsg(Main.Prefix, foundVersion, Main.update_version, player);
|
|
||||||
}
|
|
||||||
}.runTaskLater(Main.plugin, 200L);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,10 +3,11 @@
|
|||||||
|
|
||||||
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.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.util.Replace;
|
import net.t2code.lib.Spigot.Lib.replace.Replace;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
@ -57,7 +58,7 @@ public class LPCommand implements Listener {
|
|||||||
event.getCommand().toLowerCase().startsWith("lpv ") ||
|
event.getCommand().toLowerCase().startsWith("lpv ") ||
|
||||||
event.getCommand().toLowerCase().startsWith("luckpermsvelocity ")) && SelectConfig.LP_Enable
|
event.getCommand().toLowerCase().startsWith("luckpermsvelocity ")) && SelectConfig.LP_Enable
|
||||||
&& this.LPCheck(event.getCommand())) {
|
&& this.LPCheck(event.getCommand())) {
|
||||||
event.getSender().sendMessage(Replace.replace(Main.Prefix + SelectMessages.OP_opCommand));
|
event.getSender().sendMessage(Replace.replace(Util.getPrefix(),Util.getPrefix() + SelectMessages.OP_opCommand));
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -78,7 +79,7 @@ public class LPCommand implements Listener {
|
|||||||
event.getMessage().toLowerCase().startsWith("/luckpermsbungee ") ||
|
event.getMessage().toLowerCase().startsWith("/luckpermsbungee ") ||
|
||||||
event.getMessage().toLowerCase().startsWith("/lpv ") ||
|
event.getMessage().toLowerCase().startsWith("/lpv ") ||
|
||||||
event.getMessage().toLowerCase().startsWith("/luckpermsvelocity ") && SelectConfig.OP_Whitelist_Enable && this.LPCheck(event.getMessage())) {
|
event.getMessage().toLowerCase().startsWith("/luckpermsvelocity ") && SelectConfig.OP_Whitelist_Enable && this.LPCheck(event.getMessage())) {
|
||||||
event.getPlayer().sendMessage(Replace.replace(Main.Prefix + SelectMessages.OP_opCommand));
|
event.getPlayer().sendMessage(Replace.replace(Util.getPrefix(),Util.getPrefix() + SelectMessages.OP_opCommand));
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,13 @@
|
|||||||
|
|
||||||
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.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 de.jatitv.opsecurity.util.Replace;
|
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||||
import de.jatitv.opsecurity.util.send;
|
import net.t2code.lib.Spigot.Lib.replace.Replace;
|
||||||
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;
|
||||||
@ -54,11 +55,11 @@ public class OPCommand implements Listener {
|
|||||||
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.OP_Whitelist_Enable) {
|
||||||
switch (this.isNotOPWTL(event.getCommand())) {
|
switch (this.isNotOPWTL(event.getCommand())) {
|
||||||
case 1:
|
case 1:
|
||||||
send.sender(event.getSender(), Main.Prefix + " " + SelectMessages.PlayerMustBeOnlineToOp);
|
send.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(Main.Prefix + " " + SelectMessages.OP_opCommand)));
|
send.sender(event.getSender(), (Replace.replace(Util.getPrefix(), Util.getPrefix() + " " + SelectMessages.OP_opCommand)));
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -68,15 +69,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.OP_Whitelist_Enable) {
|
||||||
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(), Main.Prefix + " " + SelectMessages.PlayerMustBeOnlineToOp);
|
send.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( Main.Prefix + " " + SelectMessages.OP_opCommand));
|
send.player(event.getPlayer(), Replace.replace(Util.getPrefix(), Util.getPrefix() + " " + SelectMessages.OP_opCommand));
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,9 @@
|
|||||||
|
|
||||||
package de.jatitv.opsecurity.listener;
|
package de.jatitv.opsecurity.listener;
|
||||||
|
|
||||||
|
import de.jatitv.opsecurity.Util;
|
||||||
import de.jatitv.opsecurity.system.Main;
|
import de.jatitv.opsecurity.system.Main;
|
||||||
import de.jatitv.opsecurity.util.send;
|
import net.t2code.lib.Spigot.Lib.messages.send;
|
||||||
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;
|
||||||
@ -20,19 +21,19 @@ public class PlugManCommand implements Listener {
|
|||||||
|| (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.plugin.getDescription().getName().toLowerCase()))
|
||||||
) {
|
) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
send.console(Main.Prefix+ " §4OPSecurity cannot be deactivated!");
|
send.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.plugin.getDescription().getName().toLowerCase())
|
||||||
|| (event.getMessage().toLowerCase().startsWith("/plugman reload") && event.getMessage().toLowerCase().contains(Main.plugin.getDescription().getName().toLowerCase()))
|
|| (event.getMessage().toLowerCase().startsWith("/plugman reload") && event.getMessage().toLowerCase().contains(Main.plugin.getDescription().getName().toLowerCase()))
|
||||||
|| (event.getMessage().toLowerCase().startsWith("/plugman unload") && event.getMessage().toLowerCase().contains(Main.plugin.getDescription().getName().toLowerCase()))
|
|| (event.getMessage().toLowerCase().startsWith("/plugman unload") && event.getMessage().toLowerCase().contains(Main.plugin.getDescription().getName().toLowerCase()))
|
||||||
|| (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.plugin.getDescription().getName().toLowerCase()))
|
||||||
) {
|
) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
send.player(event.getPlayer(), Main.Prefix+ " §4OPSecurity cannot be deactivated!");
|
send.player(event.getPlayer(), Util.getPrefix() + " §4OPSecurity cannot be deactivated!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,36 +2,40 @@
|
|||||||
|
|
||||||
package de.jatitv.opsecurity.system;
|
package de.jatitv.opsecurity.system;
|
||||||
|
|
||||||
|
import de.jatitv.opsecurity.Util;
|
||||||
|
import de.jatitv.opsecurity.cmdManagement.CmdExecuter;
|
||||||
import de.jatitv.opsecurity.config.config.ConfigConvert;
|
import de.jatitv.opsecurity.config.config.ConfigConvert;
|
||||||
import de.jatitv.opsecurity.config.config.CreateConfig;
|
import de.jatitv.opsecurity.config.config.CreateConfig;
|
||||||
import de.jatitv.opsecurity.config.languages.LanguagesCreate;
|
import de.jatitv.opsecurity.config.languages.LanguagesCreate;
|
||||||
import de.jatitv.opsecurity.config.languages.SelectMessages;
|
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.listener.Events;
|
||||||
|
import de.jatitv.opsecurity.listener.OPCommand;
|
||||||
|
import de.jatitv.opsecurity.listener.PlugManCommand;
|
||||||
import de.jatitv.opsecurity.listener.Timer;
|
import de.jatitv.opsecurity.listener.Timer;
|
||||||
import de.jatitv.opsecurity.util.send;
|
import net.t2code.lib.Spigot.Lib.messages.T2CodeTemplate;
|
||||||
|
import net.t2code.lib.Spigot.Lib.register.Register;
|
||||||
|
import net.t2code.lib.Spigot.Lib.update.UpdateAPI;
|
||||||
|
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 Autor, String Version, String Spigot, String Discord) {
|
public static void onLoad(String prefix, List<String> autor, String version, String spigot, int spigotID, String discord, int bstatsID) {
|
||||||
send.console(Prefix + " §2-------------- §2OP§4Security §2--------------");
|
Long long_ = T2CodeTemplate.onLoadHeader(prefix, autor, version, spigot, discord);
|
||||||
send.console(Prefix + " §2Autor: §6JaTiTV");
|
UpdateAPI.onUpdateCheck(Main.plugin, prefix, spigot, spigotID, discord);
|
||||||
send.console(Prefix + " §2Version: §6" + Version);
|
Metrics.Bstats(Main.plugin, bstatsID);
|
||||||
send.console(Prefix + " §2Spigot: §6" + Spigot);
|
|
||||||
send.console(Prefix + " §2Discord: §6" + Discord);
|
|
||||||
send.console(Prefix + " §2");
|
|
||||||
send.console(Prefix + " §4Plugin load...");
|
|
||||||
send.console(Prefix + " §8-------------------------------");
|
|
||||||
loadReload();
|
loadReload();
|
||||||
send.console(Prefix + " §8-------------------------------");
|
Permissions.register();
|
||||||
send.console(Prefix + " §2Plugin loaded successfully.");
|
Main.plugin.getCommand("opsecurity").setExecutor(new CmdExecuter());
|
||||||
send.console(Prefix + " §2-----------------------------------------");
|
Register.listener(new Events(), Main.plugin);
|
||||||
|
Register.listener(new OPCommand(), Main.plugin);
|
||||||
|
Register.listener(new PlugManCommand(), Main.plugin);
|
||||||
|
T2CodeTemplate.onLoadFooter(prefix, long_);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void loadReload() {
|
public static void loadReload() {
|
||||||
|
|
||||||
ConfigConvert.convert();
|
ConfigConvert.convert();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
CreateConfig.configCreate();
|
CreateConfig.configCreate();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -48,7 +52,7 @@ public class Load {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
SelectMessages.selectCreate(Main.Prefix);
|
SelectMessages.selectCreate(Util.getPrefix());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -1,51 +1,23 @@
|
|||||||
package de.jatitv.opsecurity.system;
|
package de.jatitv.opsecurity.system;
|
||||||
|
|
||||||
import de.jatitv.opsecurity.cmdManagement.CmdExecuter;
|
import de.jatitv.opsecurity.Util;
|
||||||
import de.jatitv.opsecurity.config.config.SelectConfig;
|
|
||||||
import de.jatitv.opsecurity.listener.Events;
|
|
||||||
import de.jatitv.opsecurity.listener.OPCommand;
|
|
||||||
import de.jatitv.opsecurity.listener.PlugManCommand;
|
|
||||||
import de.jatitv.opsecurity.objects.PlayerObject;
|
import de.jatitv.opsecurity.objects.PlayerObject;
|
||||||
import de.jatitv.opsecurity.util.Metrics;
|
import net.t2code.lib.Spigot.Lib.messages.T2CodeTemplate;
|
||||||
import de.jatitv.opsecurity.util.UpdateChecker;
|
|
||||||
import de.jatitv.opsecurity.util.send;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
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.logging.Logger;
|
import java.util.Objects;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
public final class Main extends JavaPlugin {
|
public final class Main extends JavaPlugin {
|
||||||
|
|
||||||
|
public static List<String> autor;
|
||||||
// Debug Settings
|
public static String version;
|
||||||
|
|
||||||
public static Boolean Bstats = true;
|
|
||||||
|
|
||||||
public static String Prefix = "§8[§2OP§4Security§8]";
|
|
||||||
|
|
||||||
public static List<String> Autor;
|
|
||||||
public static Integer SpigotID = 90739;
|
|
||||||
public static Integer BstatsID = 10858;
|
|
||||||
public static String Spigot = "https://spigotmc.org/resources/" + SpigotID;
|
|
||||||
public static String Discord = "http://dc.t2code.net";
|
|
||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------
|
|
||||||
|
|
||||||
public static String Version;
|
|
||||||
|
|
||||||
public static Main plugin;
|
public static Main plugin;
|
||||||
public static String update_version = null;
|
private static boolean enable;
|
||||||
|
|
||||||
public static boolean minecraft1_8;
|
|
||||||
public static boolean minecraft1_9;
|
|
||||||
public static boolean minecraft1_10;
|
|
||||||
public static boolean minecraft1_11;
|
|
||||||
public static boolean minecraft1_12;
|
|
||||||
|
|
||||||
public static File getPath() {
|
public static File getPath() {
|
||||||
return plugin.getDataFolder();
|
return plugin.getDataFolder();
|
||||||
@ -58,48 +30,41 @@ public final class Main extends JavaPlugin {
|
|||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
// Plugin startup logic
|
// Plugin startup logic
|
||||||
Logger logger = this.getLogger();
|
|
||||||
plugin = this;
|
plugin = this;
|
||||||
|
try {
|
||||||
Autor = plugin.getDescription().getAuthors();
|
enable();
|
||||||
Version = plugin.getDescription().getVersion();
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
minecraft1_8 = Bukkit.getServer().getClass().getPackage().getName().contains("1_8");
|
|
||||||
minecraft1_9 = Bukkit.getServer().getClass().getPackage().getName().contains("1_9");
|
|
||||||
minecraft1_10 = Bukkit.getServer().getClass().getPackage().getName().contains("1_10");
|
|
||||||
minecraft1_11 = Bukkit.getServer().getClass().getPackage().getName().contains("1_11");
|
|
||||||
minecraft1_12 = Bukkit.getServer().getClass().getPackage().getName().contains("1_12");
|
|
||||||
|
|
||||||
Load.onLoad(Prefix, Autor, Version, Spigot, Discord);
|
|
||||||
|
|
||||||
getCommand("opsecurity").setExecutor(new CmdExecuter());
|
|
||||||
|
|
||||||
Bukkit.getServer().getPluginManager().registerEvents(new Events(), this);
|
|
||||||
Bukkit.getServer().getPluginManager().registerEvents(new OPCommand(), this);
|
|
||||||
Bukkit.getServer().getPluginManager().registerEvents(new PlugManCommand(), this);
|
|
||||||
// Bukkit.getServer().getPluginManager().registerEvents(new LPCommand(), this);
|
|
||||||
|
|
||||||
|
|
||||||
if (Main.Bstats) {
|
|
||||||
int pluginId = BstatsID; // <-- Replace with the id of your plugin!
|
|
||||||
Metrics metrics = new Metrics(this, pluginId);
|
|
||||||
metrics.addCustomChart(new Metrics.SimplePie("updatecheckonjoin", () -> String.valueOf(SelectConfig.UpdateCheckOnJoin)));
|
|
||||||
} else {
|
|
||||||
new BukkitRunnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
Bukkit.getConsoleSender().sendMessage(Main.Prefix + "§4\n" + Main.Prefix + "§4Bstats is disabled!");
|
|
||||||
}
|
|
||||||
}.runTaskLater(Main.plugin, 200L);
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
private static void enable() {
|
||||||
UpdateChecker.onUpdateCheck();
|
autor = plugin.getDescription().getAuthors();
|
||||||
UpdateChecker.onUpdateCheckTimer();
|
version = plugin.getDescription().getVersion();
|
||||||
|
if (pluginNotFound("T2CodeLib", 96388, Util.getRequiredT2CodeLibVersion())) return;
|
||||||
|
Load.onLoad(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getSpigotID(), Util.getDiscord(), Util.getBstatsID());
|
||||||
|
enable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@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());
|
||||||
|
}
|
||||||
|
public static Boolean pluginNotFound(String pl, Integer spigotID, double ver) {
|
||||||
|
if (Bukkit.getPluginManager().getPlugin(pl) == null) {
|
||||||
|
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: " +
|
||||||
|
"§6https://spigotmc.org/resources/" + pl + "." + spigotID + " §4to be able to use this plugin.");
|
||||||
|
Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
if (Double.parseDouble(Objects.requireNonNull(Bukkit.getPluginManager().getPlugin(pl)).getDescription().getVersion()) < 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 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);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
33
src/main/java/de/jatitv/opsecurity/system/Permissions.java
Normal file
33
src/main/java/de/jatitv/opsecurity/system/Permissions.java
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
package de.jatitv.opsecurity.system;
|
||||||
|
|
||||||
|
import net.t2code.lib.Spigot.Lib.register.Register;
|
||||||
|
import org.bukkit.permissions.PermissionDefault;
|
||||||
|
|
||||||
|
public class Permissions {
|
||||||
|
public static final String key = "opsecurity.";
|
||||||
|
public static final String notify = key + "notify";
|
||||||
|
public static final String updatemsg = key + "updatemsg";
|
||||||
|
public static final String reload = key + "command.reload";
|
||||||
|
public static final String info = key + "command.info";
|
||||||
|
public static final String help = key + "command.help";
|
||||||
|
|
||||||
|
public static final String admin = key + "admin";
|
||||||
|
public static final PermissionDefault op = PermissionDefault.OP;
|
||||||
|
public static final PermissionDefault notOp = PermissionDefault.NOT_OP;
|
||||||
|
|
||||||
|
protected static void register() {
|
||||||
|
Register.permission(notify, op, Main.plugin);
|
||||||
|
Register.permissionDescription(notify,"Players with this permission get the update message when joining if an update is available",Main.plugin);
|
||||||
|
Register.permission(updatemsg, op, Main.plugin);
|
||||||
|
Register.permission(reload, op, Main.plugin);
|
||||||
|
Register.permission(info, op, Main.plugin);
|
||||||
|
Register.permission(help, op, Main.plugin);
|
||||||
|
|
||||||
|
Register.permission(admin, op, notify, true, Main.plugin);
|
||||||
|
Register.permission(admin, op, updatemsg, true, Main.plugin);
|
||||||
|
Register.permission(admin, op, reload, true, Main.plugin);
|
||||||
|
Register.permission(admin, op, info, true, Main.plugin);
|
||||||
|
Register.permission(admin, op, help, true, Main.plugin);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -1,16 +0,0 @@
|
|||||||
package de.jatitv.opsecurity.util;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class Cmd {
|
|
||||||
|
|
||||||
public static void console(String cmd) {
|
|
||||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(),cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void player(Player player, String cmd) {
|
|
||||||
player.chat("/" + cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,38 +0,0 @@
|
|||||||
package de.jatitv.opsecurity.util;
|
|
||||||
|
|
||||||
import de.jatitv.opsecurity.system.Main;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class Replace {
|
|
||||||
private static String prefix = Main.Prefix;
|
|
||||||
|
|
||||||
public static String replace(String Text) {
|
|
||||||
return Text.replace("[prefix]", prefix).replace("&", "§").replace("[ue]", "ü")
|
|
||||||
.replace("[UE]", "Ü").replace("[oe]", "ö").replace("[OE]", "Ö")
|
|
||||||
.replace("[ae]", "ä").replace("[AE]", "Ä");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<String> replace(List<String> Text) {
|
|
||||||
List<String> output = new ArrayList<>();
|
|
||||||
for (String input : Text) {
|
|
||||||
output.add(input.replace("[prefix]", prefix).replace("&", "§")
|
|
||||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
|
||||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä"));
|
|
||||||
}
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static List replacePrice(List<String> Text, String price) {
|
|
||||||
List rp = new ArrayList();
|
|
||||||
for (String s : Text) {
|
|
||||||
rp.add(s.replace("[prefix]", prefix).replace("&", "§")
|
|
||||||
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
|
|
||||||
.replace("[OE]", "Ö").replace("[ae]", "ä").replace("[AE]", "Ä")
|
|
||||||
.replace("[price]", String.valueOf(price)));
|
|
||||||
}
|
|
||||||
return rp;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,45 +0,0 @@
|
|||||||
package de.jatitv.opsecurity.util;
|
|
||||||
|
|
||||||
import net.md_5.bungee.api.chat.ClickEvent;
|
|
||||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
|
||||||
import net.md_5.bungee.api.chat.HoverEvent;
|
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
|
||||||
|
|
||||||
public class TextBuilder {
|
|
||||||
|
|
||||||
private final String text;
|
|
||||||
private String hover;
|
|
||||||
private String click;
|
|
||||||
private ClickEvent.Action action;
|
|
||||||
|
|
||||||
public TextBuilder(String text) {
|
|
||||||
this.text = text;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TextBuilder addHover(String hover) {
|
|
||||||
this.hover = hover;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TextBuilder addClickEvent(ClickEvent.Action clickEventAction, String value) {
|
|
||||||
this.action = clickEventAction;
|
|
||||||
this.click = value;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TextComponent build() {
|
|
||||||
TextComponent textComponent = new TextComponent();
|
|
||||||
textComponent.setText(this.text);
|
|
||||||
if(this.hover != null) {
|
|
||||||
textComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(this.hover).create()));
|
|
||||||
}
|
|
||||||
if(this.click != null && (this.action != null)) {
|
|
||||||
textComponent.setClickEvent(new ClickEvent(action, this.click));
|
|
||||||
}
|
|
||||||
return textComponent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum ClickEventType {
|
|
||||||
RUN_COMMAND, SUGGEST_COMMAND, OPEN_URL
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,125 +0,0 @@
|
|||||||
// This claas was created by JaTiTV
|
|
||||||
|
|
||||||
package de.jatitv.opsecurity.util;
|
|
||||||
|
|
||||||
import de.jatitv.opsecurity.system.Main;
|
|
||||||
import net.md_5.bungee.api.chat.ClickEvent;
|
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.Scanner;
|
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
public class UpdateChecker {
|
|
||||||
|
|
||||||
public static boolean cannotLookForUpdates;
|
|
||||||
|
|
||||||
public static void sendUpdateMsg(String Prefix, String foundVersion, String update_version) {
|
|
||||||
send.console("§4=========== " + Prefix + " §4===========");
|
|
||||||
send.console("§6A new version was found!");
|
|
||||||
send.console("§6Your version: §c" + foundVersion + " §7- §6Current version: §a" + update_version);
|
|
||||||
send.console("§6You can download it here: §e" + Main.Spigot);
|
|
||||||
send.console("§6You can find more information on Discord: §e" + Main.Discord);
|
|
||||||
send.console("§4=========== " + Prefix + " §4===========");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void sendUpdateMsg(String Prefix, String foundVersion, String update_version, Player player) {
|
|
||||||
TextComponent comp = new TextBuilder(Prefix + " §6A new version was found!")
|
|
||||||
.addHover("§6You can download it here: §e" + Main.Spigot).addClickEvent(ClickEvent.Action.OPEN_URL, Main.Spigot).build();
|
|
||||||
player.spigot().sendMessage(comp);
|
|
||||||
TextComponent comp1 = new TextBuilder(Prefix + " §c" + foundVersion + " §7-> §a" + update_version)
|
|
||||||
.addHover("§6You can download it here: §e" + Main.Spigot).addClickEvent(ClickEvent.Action.OPEN_URL, Main.Spigot).build();
|
|
||||||
player.spigot().sendMessage(comp1);
|
|
||||||
TextComponent comp2 = new TextBuilder(Prefix + " §6You can find more information on Discord.")
|
|
||||||
.addHover("§e" + Main.Discord).addClickEvent(ClickEvent.Action.OPEN_URL, Main.Discord).build();
|
|
||||||
player.spigot().sendMessage(comp2);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void onUpdateCheckTimer() {
|
|
||||||
int taskID = Bukkit.getScheduler().scheduleSyncRepeatingTask(Main.plugin, new Runnable() {
|
|
||||||
public void run() {
|
|
||||||
(new UpdateChecker(Main.plugin, Main.SpigotID)).getVersion((update_version) -> {
|
|
||||||
String foundVersion = Main.plugin.getDescription().getVersion();
|
|
||||||
Main.update_version = update_version;
|
|
||||||
if (!foundVersion.equalsIgnoreCase(update_version)) {
|
|
||||||
new BukkitRunnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
sendUpdateMsg(Main.Prefix, foundVersion, update_version);
|
|
||||||
}
|
|
||||||
}.runTaskLater(Main.plugin, 600L);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}, 0L, 20 * 60 * 60L);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void onUpdateCheck() {
|
|
||||||
(new UpdateChecker(Main.plugin, Main.SpigotID)).getVersion((update_version) -> {
|
|
||||||
String foundVersion = Main.plugin.getDescription().getVersion();
|
|
||||||
Main.update_version = update_version;
|
|
||||||
if (foundVersion.equalsIgnoreCase(update_version)) {
|
|
||||||
new BukkitRunnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
send.console(Main.Prefix + " §2No update found.");
|
|
||||||
}
|
|
||||||
}.runTaskLater(Main.plugin, 120L);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private JavaPlugin plugin;
|
|
||||||
private int resourceId;
|
|
||||||
|
|
||||||
public UpdateChecker(JavaPlugin plugin, int resourceId) {
|
|
||||||
this.plugin = plugin;
|
|
||||||
this.resourceId = resourceId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void getVersion(Consumer<String> consumer) {
|
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(this.plugin, () -> {
|
|
||||||
try {
|
|
||||||
InputStream inputStream = (new URL("https://api.spigotmc.org/legacy/update.php?resource=" + this.resourceId)).openStream();
|
|
||||||
try {
|
|
||||||
Scanner scanner = new Scanner(inputStream);
|
|
||||||
|
|
||||||
try {
|
|
||||||
if (scanner.hasNext()) {
|
|
||||||
consumer.accept(scanner.next());
|
|
||||||
}
|
|
||||||
} catch (Throwable var8) {
|
|
||||||
try {
|
|
||||||
scanner.close();
|
|
||||||
} catch (Throwable var7) {
|
|
||||||
var8.addSuppressed(var7);
|
|
||||||
}
|
|
||||||
throw var8;
|
|
||||||
}
|
|
||||||
scanner.close();
|
|
||||||
} catch (Throwable var9) {
|
|
||||||
if (inputStream != null) {
|
|
||||||
try {
|
|
||||||
inputStream.close();
|
|
||||||
} catch (Throwable var6) {
|
|
||||||
var9.addSuppressed(var6);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throw var9;
|
|
||||||
}
|
|
||||||
if (inputStream != null) {
|
|
||||||
inputStream.close();
|
|
||||||
}
|
|
||||||
} catch (IOException var10) {
|
|
||||||
cannotLookForUpdates = true;
|
|
||||||
this.plugin.getLogger().severe(Main.Prefix + "§4 Cannot look for updates: §c" + var10.getMessage());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,53 +0,0 @@
|
|||||||
package de.jatitv.opsecurity.util;
|
|
||||||
|
|
||||||
import de.jatitv.opsecurity.system.Main;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.plugin.Plugin;
|
|
||||||
|
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
public class send {
|
|
||||||
|
|
||||||
public static void console(String msg) {
|
|
||||||
Bukkit.getConsoleSender().sendMessage(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void player(Player player, String msg) {
|
|
||||||
player.sendMessage(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void sender(CommandSender sender, String msg) {
|
|
||||||
sender.sendMessage(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void debug(Plugin plugin, String msg) {
|
|
||||||
// if (!new File(Main.getPath(), "config.yml").exists()) return;
|
|
||||||
if (plugin.getConfig().getBoolean("Plugin.Debug")) Bukkit.getConsoleSender().sendMessage(plugin.getDescription().getPrefix() + " §5DEBUG: §6" + msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void debugmsg(Plugin plugin, String msg) {
|
|
||||||
Bukkit.getConsoleSender().sendMessage(plugin.getDescription().getPrefix() + " §5DEBUG-MSG: §6" + msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void info(Plugin plugin, String msg) {
|
|
||||||
plugin.getLogger().log(Level.INFO, msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void warning(Plugin plugin, String msg) {
|
|
||||||
plugin.getLogger().log(Level.WARNING, msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void error(Plugin plugin, String msg) {
|
|
||||||
plugin.getLogger().log(Level.SEVERE, msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void convert(String oldConfig, String newConfig) {
|
|
||||||
send.console(Main.Prefix + " §5Convert: §4" + oldConfig + " §5--> §2" + newConfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void convert(String config, String oldConfig, String newConfig) {
|
|
||||||
send.console(Main.Prefix + " §5Convert: §e" + config + " §4" + oldConfig + " §5--> §2" + newConfig);
|
|
||||||
}
|
|
||||||
}
|
|
@ -2,31 +2,11 @@ name: OPSecurity
|
|||||||
version: ${project.version}
|
version: ${project.version}
|
||||||
api-version: 1.13
|
api-version: 1.13
|
||||||
load: STARTUP
|
load: STARTUP
|
||||||
|
softdepend:
|
||||||
|
- T2CodeLib
|
||||||
main: de.jatitv.opsecurity.system.Main
|
main: de.jatitv.opsecurity.system.Main
|
||||||
prefix: OPSecurity
|
prefix: OPSecurity
|
||||||
authors: [ JaTiTV ]
|
authors: [ JaTiTV ]
|
||||||
commands:
|
commands:
|
||||||
opsecurity:
|
opsecurity:
|
||||||
aliases: [opsec]
|
aliases: [opsec]
|
||||||
permissions:
|
|
||||||
opsecurity.admin:
|
|
||||||
default: op
|
|
||||||
children:
|
|
||||||
opsecurity.notify: true
|
|
||||||
opsecurity.updatemsg: true
|
|
||||||
opsecurity.command.reload: true
|
|
||||||
opsecurity.command.info: true
|
|
||||||
opsecurity.command.help: true
|
|
||||||
|
|
||||||
opsecurity.notify:
|
|
||||||
description: Players with this permission get the update message when joining if an update is available
|
|
||||||
default: op
|
|
||||||
opsecurity.updatemsg:
|
|
||||||
default: op
|
|
||||||
opsecurity.command.reload:
|
|
||||||
default: op
|
|
||||||
opsecurity.command.info:
|
|
||||||
default: op
|
|
||||||
opsecurity.command.help:
|
|
||||||
default: op
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user