chasechocolate mattrick16 I guess I'll just ask this question here. I've noticed that I can't add color support, because when ever I save the config with a wierd characted (such as &), it throws and error, saying "invalid character". Any way around this?
Gater12 I don't get it. So just tell the person using the file to add 'path here', and then when ever I look for a string I add '' around it?
JPG2000 Your question confuses me . I'm trying to say like when I have something to from the config that is a string and translate the color code I add a '. So what I'm saying that when you leave a string you do: String: MEHRANDOMSTRING But when I put a & it deleted it and who knows what the console said so I put a ' String: '&7MEHRANDOMSTRONG' And it worked and probably there's better explanation but that's what I see.
Here, it took me a while to get this, here's my code, and look SPECIFICALLY at Line 39. And yes, he's correct, you also need to add 'MSG', as you see here, it didn't work for color codes because I didn't add ' ' Code:java package org.horrgs.me; import java.util.logging.Logger; import org.bukkit.ChatColor;import org.bukkit.command.Command;import org.bukkit.command.CommandSender;import org.bukkit.configuration.file.FileConfiguration;import org.bukkit.entity.Player;import org.bukkit.plugin.java.JavaPlugin; public class serverinfoplus extends JavaPlugin { public final Logger logger = Logger.getLogger("Minecraft");private FileConfiguration config;public static serverinfoplus plugin; @Overridepublic void onEnable(){config = getConfig();saveDefaultConfig();} @Overridepublic void onDisable(){ } public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){Player player = (Player) sender;if(commandLabel.equalsIgnoreCase("sip"))if(args.length == 1) {if(args[0].equalsIgnoreCase("1"))player.sendMessage(ChatColor.DARK_BLUE + "[" + ChatColor.BLUE + "SIP" + ChatColor.DARK_BLUE + "] " + ChatColor.GOLD + "Version 1.5 by " + ChatColor.DARK_AQUA + "iiHeroo" + ChatColor.AQUA + " " + ChatColor.GOLD + "Type /sip (1/2/3) for command information. " + ChatColor.GOLD + "/sip" + ChatColor.GRAY + " - " + ChatColor.BLUE + "The ServerInfoPlus help command. " + ChatColor.GOLD + "/open" + ChatColor.GRAY + " - " + ChatColor.BLUE + "Tell's you the date the server opened.");}if(commandLabel.equalsIgnoreCase("facebook"))player.sendMessage(ChatColor.translateAlternateColorCodes('&', getConfig().getString("pfacebook")) + ChatColor.translateAlternateColorCodes('&', getConfig().getString("facebook"))); return false; }}