TFGuilds/src/main/java/totalfreedom/tfguilds/util/GUtil.java

37 lines
1.2 KiB
Java
Raw Normal View History

2020-06-15 21:39:52 +00:00
package totalfreedom.tfguilds.util;
2020-06-16 02:50:29 +00:00
import org.bukkit.ChatColor;
2020-06-15 21:39:52 +00:00
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import totalfreedom.tfguilds.TFGuilds;
import java.util.List;
public class GUtil
{
public static TFGuilds plugin = TFGuilds.plugin;
public static boolean isConsole(CommandSender sender)
{
return sender instanceof ConsoleCommandSender;
}
public static void createGuild(CommandSender owner, String guildName)
{
plugin.guilds.set("guilds." + guildName, guildName);
plugin.guilds.set("guilds." + guildName + ".owner", owner.getName());
plugin.guilds.set("guilds." + guildName + ".members", owner.getName());
List<String> players = plugin.guilds.getStringList("guilds." + guildName + ".members");
players.add(owner.getName());
plugin.guilds.set("guilds." + guildName + ".members", players);
plugin.guilds.save();
GLog.info(owner.getName() + " has created a new guild: " + guildName);
}
2020-06-16 02:50:29 +00:00
public static String color(String s)
{
return ChatColor.translateAlternateColorCodes('&', s);
}
2020-06-15 21:39:52 +00:00
}