Im making a plugin and i want to change a part of the MOTD of the server with a string but i can t. How i can do that? My code: Code: public class ScrimmEvents implements Listener{ String player = "Test"; @EventHandler(priority=EventPriority.MONITOR) public void onServerListPing(ServerListPingEvent event) { event.setMotd("§a§lScrimmage of" getString.("player")); } }
@ElCreeperHD You should really get comfortable with Java before trying to write Bukkit plugins. Your code shows that you don't have a knowledge of Java.
"event.setMotd("§a§lScrimmage of" getString.("player"));" makes no sense. You don't put a period after the method name when calling it, as it is a method and has parameters. You also don't use quotation marks when using a variable either. You would do it like: "getString(player);" as earlier in the code you defined the variable "player" as a string. Even then though your code is still messed up in many ways. You can learn java here: https://docs.oracle.com/javase/tutorial/ You don't have to be an expert java programmer before learning bukkit, but you should definitely know the basics and how to call a method, use variables, ect.
@ElCreeperHD K ill help you here but ill try not to spoon feed, first its cool to see you are starting off but you should try some tutorials to help you with the basics of starting bukkit plugins, try either TheBCBros or Pogo - Coding and More , next for coloring strings in bukkit you need to use ChatColor.<What ever color you wish> and to put 2 strings together you need to use the '+' character for example: player.sendmessage(ChatColor.RED + "Hello player, " + ChatColor.GREEN + player.getName()); that would send a player a message in red saying hello player <their name>
ARE YOU SERIOUS?! TheBCBroz makes the WORST tutorials that are outdated and he teaches bad code practices
@ElCreeperHD did you try this video ? @FisheyLP Pardon me for helping gosh EDIT by Moderator: merged posts, please use the edit button instead of double posting.
Thats true, they help only for specific things and in the practice they didn t help. a EDIT by Moderator: merged posts, please use the edit button instead of double posting.
http://stackoverflow.com/questions/9643610/java-including-variables-within-strings And please learn java before bukkit you don't even know the syntax you learn in the first hour when learning java
@ElCreeperHD Nobody is going to solve the problem for you. Learn java, then bukkit. Everyone has given you enough information to solve your problem.