Refractor

This commit is contained in:
BuildTools committed 2024-10-11 01:56:24 -05:00
1 parent b6cf670fe0
commit d54d2a199e
2 files changed
+19 -18

No files matched your search

@@ -61,6 +61,7 @@ public final class KnockbackSync extends JavaPlugin {
PacketEvents.getAPI().getSettings()
.checkForUpdates(false)
.debug(false);
PacketEvents.getAPI().load();
PacketEvents.getAPI().init();
@@ -28,30 +28,30 @@ public class StatusSubcommand implements Listener {
(globalStatus ? ChatColor.GREEN + "Enabled" : ChatColor.RED + "Disabled"));
// Show player status
if (target == null && sender instanceof Player) {
if (target == null && sender instanceof Player)
target = (Player) sender;
}
if (target != null) {
if (sender.hasPermission("knockbacksync.status.self") ||
(sender.hasPermission("knockbacksync.status.other") && !sender.equals(target))) {
if (target == null)
return;
UUID uuid = target.getUniqueId();
boolean playerStatus = !PlayerDataManager.containsPlayerData(uuid);
if (sender.hasPermission("knockbacksync.status.self") ||
(sender.hasPermission("knockbacksync.status.other") && !sender.equals(target))) {
if (!globalStatus) {
sender.sendMessage(ChatColor.YELLOW + target.getName() + "'s KnockbackSync status: " +
ChatColor.RED + "Disabled (Global toggle is off)");
} else {
sender.sendMessage(ChatColor.YELLOW + target.getName() + "'s KnockbackSync status: " +
(playerStatus ? ChatColor.GREEN + "Enabled" : ChatColor.RED + "Disabled"));
}
UUID uuid = target.getUniqueId();
boolean playerStatus = !PlayerDataManager.containsPlayerData(uuid);
if (!globalStatus) {
sender.sendMessage(ChatColor.YELLOW + target.getName() + "'s KnockbackSync status: " +
ChatColor.RED + "Disabled (Global toggle is off)");
} else {
sender.sendMessage(ChatColor.RED + "You don't have the "
+ (sender.equals(target) ? "knockbacksync.status.self" : "knockbacksync.status.other") +
" permission needed to check status for " +
(sender.equals(target) ? "yourself" : "other players") + ".");
sender.sendMessage(ChatColor.YELLOW + target.getName() + "'s KnockbackSync status: " +
(playerStatus ? ChatColor.GREEN + "Enabled" : ChatColor.RED + "Disabled"));
}
} else {
sender.sendMessage(ChatColor.RED + "You don't have the "
+ (sender.equals(target) ? "knockbacksync.status.self" : "knockbacksync.status.other") +
" permission needed to check status for " +
(sender.equals(target) ? "yourself" : "other players") + ".");
}
});
}