Is there a function to convert data into a string so I can turn:block.getType() into a string value? Eg: player.sendMessage("You placed a ".. ); Just Getting started and would like to know the Ropes. Thanks in advance
Love ya, Thanks --- merged: Feb 24, 2011 9:07 PM --- Well, It appears to work; but I have no clue what this means: at org.bukkit.plugin.PluginDescriptionFile.<init>(PluginDescriptionFile.java:29) at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:60) at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:129) at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:94) at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:58) at net.minecraft.server.MinecraftServer.e(MinecraftServer.java:187) at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:174) at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:120) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:227) at net.minecraft.server.ThreadServerApplication.run(SourceFile:366) I assume I'm using an outdated source?
2011-02-24 21:05:25 [INFO] Starting minecraft server version Beta 1.3 2011-02-24 21:05:25 [WARNING] **** NOT ENOUGH RAM! 2011-02-24 21:05:25 [WARNING] To start the server with more ram, launch it as "java -Xmx1024M -Xms1024M -jar minecraft_server.jar" 2011-02-24 21:05:25 [INFO] Loading properties 2011-02-24 21:05:25 [INFO] Starting Minecraft server on *:2302 2011-02-24 21:05:25 [INFO] This server is running Craftbukkit version git-Bukkit-0.0.0-457-g434ce6d-b439jnks (MC: 1.3) 2011-02-24 21:05:25 [INFO] Preparing level "world" 2011-02-24 21:05:25 [INFO] Preparing start region 2011-02-24 21:05:26 [INFO] Preparing spawn area: 77% 2011-02-24 21:05:27 [SEVERE] java.lang.String cannot be cast to java.util.Map (Is it up to date?) java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map at org.bukkit.plugin.PluginDescriptionFile.<init>(PluginDescriptionFile.java:29) at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:60) at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:129) at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:94) at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:58) at net.minecraft.server.MinecraftServer.e(MinecraftServer.java:187) at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:174) at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:120) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:227) at net.minecraft.server.ThreadServerApplication.run(SourceFile:366) 2011-02-24 21:05:27 [INFO] Done (1316227640ns)! For help, type "help" or "?" --- merged: Feb 24, 2011 9:34 PM --- (It's probably something really stupid. I'm new to Java. )
Have you did that at the begin of the void?: Block block = event.getBlockPlaced(); And not forget the ";" at the end of player.sendMessage? Maybe try that? Code: Block block = event.getBlockPlaced(); player.sendMessage("You placed a " + block.getType());
The code you are hitting is: Code: loadMap((Map<String, Object>)yaml.load(stream)); Based on that, I am assuming you don't have your values configured properly in your plugin.yml file. These values MUST be name/value pairs such as: Code: name: SureFooting main: com.nohupgaming.minecraft.SureFooting version: 1.2 Also keep in mind that I believe the spacing is pertinent in the YAML format, so if you have blank spaces somewhere they shouldn't be you can throw everything off. Can you post the contents of your plugin.yml? Also, the toString on Material will return in all caps as there currently is no description attribute assigned in that enumeration. If you don't want it in all caps for now you can look at the standard String functions to manipulate case. Based on your example I would think you would just want something like: Code: player.sendMessage("You placed a " + block.getType().toString().toLowerCase());
my YML contents: name:Test main:com.bukkit.Celt.Basic.Basic version:1.0 I'm Using Samkio's Basic Script - but editing it partially if that's any help
using com.bukkit isn't allowed. http://forums.bukkit.org/threads/on-namespaces-please-do-not-use-bukkit-in-your-plugins.3732/
Oh- I'll Make sure not to do that again- Samkio Mislead me D: name:Test main:com.Celt.Celt.Basic.Basic version:1.00 No help? EDIT by Moderator: merged posts, please use the edit button instead of double posting.
a) make your name in the yml is "Basic" b) is your package "com.Celt.Celt.Basic" with the java file of your plugin named "Basic" if not then you will get no result, just an invalid plugin error.
Correct me if I am wrong, but I believe YAML requires the space between the : and the value. So rather than name:Test I believe it has to be name: Test
"2011-02-25 21:15:10 [INFO] Starting minecraft server version Beta 1.3 2011-02-25 21:15:10 [WARNING] **** NOT ENOUGH RAM! 2011-02-25 21:15:10 [WARNING] To start the server with more ram, launch it as "java -Xmx1024M -Xms1024M -jar minecraft_server.jar" 2011-02-25 21:15:10 [INFO] Loading properties 2011-02-25 21:15:10 [INFO] Starting Minecraft server on *:2302 2011-02-25 21:15:10 [INFO] This server is running Craftbukkit version git-Bukkit-0.0.0-457-g434ce6d-b439jnks (MC: 1.3) 2011-02-25 21:15:10 [INFO] Preparing level "world" 2011-02-25 21:15:10 [INFO] Preparing start region 2011-02-25 21:15:11 [INFO] Preparing spawn area: 97% 2011-02-25 21:15:11 [SEVERE] java.lang.String cannot be cast to java.util.Map (Is it up to date?) java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map at org.bukkit.plugin.PluginDescriptionFile.<init>(PluginDescriptionFile.java:29) at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:60) at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:129) at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:94) at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:58) at net.minecraft.server.MinecraftServer.e(MinecraftServer.java:187) at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:174) at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:120) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:227) at net.minecraft.server.ThreadServerApplication.run(SourceFile:366) 2011-02-25 21:15:11 [INFO] Done (1229480200ns)! For help, type "help" or "?" 2011-02-25 21:15:15 [INFO] CONSOLE: Stopping the server.. 2011-02-25 21:15:15 [INFO] Stopping server 2011-02-25 21:15:15 [INFO] Saving chunks"