-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathNoEncryption.java
More file actions
87 lines (68 loc) · 3.44 KB
/
NoEncryption.java
File metadata and controls
87 lines (68 loc) · 3.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package me.doclic.noencryption;
import me.doclic.noencryption.compatibility.Compatibility;
import me.doclic.noencryption.config.ConfigurationHandler;
import me.doclic.noencryption.utils.FileMgmt;
import me.doclic.noencryption.utils.InternalMetrics;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.logging.Logger;
public final class NoEncryption extends JavaPlugin {
private static NoEncryption plugin;
private static Logger logger;
@Override
public void onEnable() {
plugin = this;
logger = getLogger();
if (Compatibility.SERVER_COMPATIBLE) {
FileMgmt.initialize(this);
ConfigurationHandler.initialize(this);
if (!ConfigurationHandler.loadSettings()) {
logger().severe("Configuration could not be loaded, disabling...");
Bukkit.getPluginManager().disablePlugin(this);
return;
}
ConfigurationHandler.printChanges();
Bukkit.getPluginManager().registerEvents(new PlayerListener(), this);
logger().info("Compatibility successful!");
logger().info("If you used /reload to update NoEncryption, your players need to disconnect and join back");
if (Bukkit.getPluginManager().getPlugin("Essentials") != null) {
logger().info("=====================================================================");
logger().info("We are aware of the Essentials warning about severe issues.");
logger().info("Currently, there are no known issues relating to NoEncryption and Essentials.");
logger().info("If you encounter any issues, please create an issue on the NoEncryption GitHub at");
logger().info("https://github.com/Doclic/NoEncryption/issues");
}
if (Bukkit.getPluginManager().getPlugin("ViaVersion") != null) {
logger().info("=====================================================================");
logger().info("We are aware of the ViaVersion warning about severe issues.");
logger().info("Currently, there are no known issues relating to NoEncryption and ViaVersion.");
logger().info("If you encounter any issues, please create an issue on the NoEncryption GitHub at");
logger().info("https://github.com/Doclic/NoEncryption/issues");
}
InternalMetrics.loadMetrics();
} else {
logger().severe("Failed to setup NoEncryption's compatibility!");
logger().severe("Your server version (" + Compatibility.SERVER_VERSION + ") is not compatible with this JAR! Check here for the latest version: https://github.com/Doclic/NoEncryption/releases/latest");
Bukkit.getPluginManager().disablePlugin(this);
}
}
public static NoEncryption plugin() {
return plugin;
}
public static Logger logger() {
return logger;
}
public String getRootFolder() {
return this.getDataFolder().getPath();
}
public static boolean usesKyoriChat() {
try {
Class.forName("net.kyori.adventure.Adventure");
Class.forName("net.kyori.adventure.text.Component");
Class.forName("net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer");
return true;
} catch (ClassNotFoundException e) {
return false;
}
}
}