Skip to content

Commit

Permalink
More organization BS
Browse files Browse the repository at this point in the history
  • Loading branch information
Vyladence committed May 4, 2023
1 parent 8ff1fb7 commit 9d6bb6a
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions src/main/java/org/simplelinks/commands/ReloadConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import org.simplelinks.SimpleLinks;

import org.bukkit.ChatColor;
import org.bukkit.command.*;
import org.bukkit.entity.Player;
import org.simplelinks.util.ChatFormat;

public class ReloadConfig implements CommandExecutor {
@Override
Expand All @@ -16,31 +16,28 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
SimpleLinks.getPlugin(SimpleLinks.class).saveDefaultConfig();
SimpleLinks.getPlugin(SimpleLinks.class).reloadConfig();

if (!(sender instanceof Player player)) {
System.out.println("Config Reloaded!");
if (sender instanceof Player player) {
player.sendMessage(ChatFormat.format("&8[&dSimpleLinks&8] &fConfig Reloaded!"));
} else {
String sendThis = ChatColor.translateAlternateColorCodes('&', "&8[&dSimpleLinks&8] &fConfig Reloaded!");
player.sendMessage(sendThis);
System.out.println("Config Reloaded!");
}
} else {
// Unknown Command fallback

if (!(sender instanceof Player player)) {
System.out.println("Unknown Subcommand!");
if (sender instanceof Player player) {
player.sendMessage(ChatFormat.format("&8[&dSimpleLinks&8] &cUnknown subcommand!"));
} else {
String sendThis = ChatColor.translateAlternateColorCodes('&', "&8[&dSimpleLinks&8] &cUnknown subcommand!");
player.sendMessage(sendThis);
System.out.println("Unknown Subcommand!");
}
}
} else {
// Base command
String version = SimpleLinks.getPlugin(SimpleLinks.class).getDescription().getVersion();

if (!(sender instanceof Player player)) {
System.out.println("Running SimpleLinks v" + version);
if (sender instanceof Player player) {
player.sendMessage(ChatFormat.format("&8[&dSimpleLinks&8] &fRunning &fLinksPlugin &av" + version));
} else {
String sendThis = ChatColor.translateAlternateColorCodes('&', "&8[&dSimpleLinks&8] &fRunning &fLinksPlugin &av" + version);
player.sendMessage(sendThis);
System.out.println("Running SimpleLinks v" + version);
}
}
return true;
Expand Down

0 comments on commit 9d6bb6a

Please sign in to comment.