This repository has been archived on 2022-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
hubthat-old/src/net/mindoverflow/hubthat/CommandListWorlds.java

44 lines
1.3 KiB
Java
Raw Permalink Blame History

package net.mindoverflow.hubthat;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import net.md_5.bungee.api.ChatColor;
public class CommandListWorlds implements CommandExecutor {
public Main plugin;
public CommandListWorlds (Main plugin) {
this.plugin = plugin;
}
public boolean onCommand(CommandSender sender, Command cmd, String CommandLabel, String[] args) {
if(CommandLabel.equalsIgnoreCase("worldlist")) {
if(sender.hasPermission(new permission().ListWorlds)) {
sender.sendMessage("<EFBFBD>3Worlds List:");
sender.sendMessage("<EFBFBD>7---------");
int wn = 0;
for (World ww : Bukkit.getWorlds()) {
++wn;
sender.sendMessage("<EFBFBD>3" + wn + "<EFBFBD>7: <20>6" + ww.getName() + "<EFBFBD>7, <20>8" + ww.getWorldType().toString().toLowerCase());
}
wn = 0;
sender.sendMessage("<EFBFBD>7---------");
return true;
} else {
String noperm = plugin.getConfig().getString("worldlist.NO_PERMISSIONS").replace("&", "<EFBFBD>");
String PREFIX = plugin.getConfig().getString("global.PREFIX").replace("&", "<EFBFBD>");
sender.sendMessage(PREFIX + ChatColor.RED + noperm);
return true;
}
}
return false;
}
}