Hey, so i want to change the text this gives to something else. Heres the code i have: Code: sender.sendMessage(ChatColor.DARK_RED + "You have punched " + punchedName); punched.sendMessage(ChatColor.DARK_RED + "You have been punched by " + senderName); Now obviously that gives something around this: You have punched <NAME> You have been punched by <NAME> But... I want it to look like this... [♥iEmotions♥] You have been punched by <NAME> [♥iEmotions♥] You have punched <NAME> Any idea of what the code has to look like? (Heres my full code) Code: package net.skydevs.src; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; public class ChatPlugin extends JavaPlugin{ public void onEnable(){ //Server Starts getLogger().info("iEmotions has loaded!"); } public void onDisable(){ //Server Stops getLogger().info("iEmotions has been disabled!"); } public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { //Code String senderName = sender.getName(); if (cmd.getName().equalsIgnoreCase("punch") && args.length == 1) { String punchedName = args[0]; Player punched = sender.getServer().getPlayer(punchedName); if(punched == null){ //Code sender.sendMessage(ChatColor.DARK_RED + "You cannot punch an offline player!"); } else { //Code for Punch int currentHealth = punched.getHealth(); if (currentHealth > 0) { currentHealth--; } punched.setHealth(currentHealth); sender.sendMessage(ChatColor.DARK_RED + "You have punched " + punchedName); punched.sendMessage(ChatColor.DARK_RED + "You have been punched by " + senderName); } } if (cmd.getName().equalsIgnoreCase("kiss") && args.length == 1) { String kissedName = args[0]; Player kissed = sender.getServer().getPlayer(kissedName); if(kissed == null){ //Code sender.sendMessage(ChatColor.DARK_RED + "You cannot kiss an offline player!"); } else { //Code for Kiss int currentHealth = kissed.getHealth(); if (currentHealth < 0) { currentHealth++; } kissed.setHealth(currentHealth); sender.sendMessage(ChatColor.DARK_RED + "You have kissed " + kissedName); kissed.sendMessage(ChatColor.DARK_RED + "You have been kissed by " + senderName); } } if (cmd.getName().equalsIgnoreCase("kick") && args.length == 1) { String kickedName = args[0]; Player kicked = sender.getServer().getPlayer(kickedName); if(kicked == null){ //Code sender.sendMessage(ChatColor.DARK_RED + "You cannot kick an offline player!"); } else { //Code for Kicks int currentHealth = kicked.getHealth(); if(currentHealth > 0) // Warning, this will kill the player { currentHealth--; } kicked.setHealth(currentHealth); sender.sendMessage(ChatColor.DARK_RED + "You have kicked " + kickedName); kicked.sendMessage(ChatColor.DARK_RED + "You have been kicked by " + senderName); } } if (cmd.getName().equalsIgnoreCase("hug") && args.length == 1) { String huggeeName = args[0]; Player huggee = sender.getServer().getPlayer(huggeeName); if(huggee == null){ //Code sender.sendMessage(ChatColor.DARK_RED + "You cannot hug an offline player!"); } else { //Code for Hugs int currentHealth = huggee.getHealth(); if (currentHealth < 0) { currentHealth++; } huggee.setHealth(currentHealth); sender.sendMessage(ChatColor.DARK_RED + "You have hugged " + huggeeName); huggee.sendMessage(ChatColor.DARK_RED + "You have been hugged by " + senderName); } } return false; } }
[♥iEmotions♥] You have been punched by <NAME> would be: Code:java String s = "["+ChatColor. Code:java [COLOR=#000000]LIGHT_PURPLE+"iEmotions"+ChatColor.WHITE+"]"+ChatColor.RED+" you have been punched by "+ChatColor.GREEN+name;[/COLOR] You cannot do the ♥. Damnit bukkit, screwing with my text.
orange451 Can you now? Another thread ended up with another conclusion... If you really are convinced, show me the proof >:3 (in code)
linkrock4 yea bukkit is screwing up my code tag, sorry. String s ="["+ChatColor.LIGHT_PURPLE+"iEmotions"+ChatColor.WHITE+"]"+ChatColor.RED+" you have been punched by "+ChatColor.GREEN+name; hard to see, but works
orange451 mmh weird always thought it would not. Could be due all the testing with § linkrock4 the only error my IDE gives me is that name is undefined, as I never defined it. I hope you replaced 'name' with 'punchedName' or 'senderName'. If you get errors in the console, please post those EDIT by Moderator: merged posts, please use the edit button instead of double posting.
the name is replaced with senderName but its the String s is the problem, it says: the value of the local variable s is not used.
le sigh, you really need the tutorials I guess :3 Code:java punched.sendMessage("["+ChatColor.RED+"♥"+ChatColor.LIGHT_PURPLE+"iEmotions"+ChatColor.RED+"♥"+ChatColor.WHITE+"]"+ChatColor.RED+" You have been punched by "+ChatColor.GREEN+senderName);sender.sendMessage("["+ChatColor.RED+"♥"+ChatColor.LIGHT_PURPLE+"iEmotions"+ChatColor.RED+"♥"+ChatColor.WHITE+"]"+ChatColor.RED+" You have punched "+ChatColor.GREEN+punchedName); So yea this is what you do
Wanna be my tutor!? And thanks alot, it works Oh and btw...the ♥ wont let me save :/ EDIT by Moderator: merged posts, please use the edit button instead of double posting.
When you go to save the class, just save it as the mtf5(Just a guess i seriously forget the name of it) or what ever it asks you if you wanna save it as, it'll still work