Yeah, Need some help.

Discussion in 'Plugin Development' started by Celt, Feb 24, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    Celt

    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
     
  2. Offline

    Edward Hand

    Code:
    player.sendMessage("You placed a "+block.getType())
    should work I think. Doesn't it?
     
  3. Offline

    Binder News

    the toString() method?
     
  4. Offline

    Celt

    Love ya, Thanks :D
    --- 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?
     
  5. Offline

    Edward Hand

    You chopped of the top few lines (which are the important ones). Can you show the whole thing?
     
  6. Offline

    Celt

    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. :confused:)
     
  7. Offline

    SunShe

    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());
     
  8. Offline

    Nohup

    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());
     
  9. Offline

    Celt


    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
     
  10. Offline

    Edward Hand

  11. Offline

    Celt

    Last edited by a moderator: May 10, 2016
  12. Offline

    darknesschaos

    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.
     
  13. Offline

    Celt

    The package IS com.Celt.Celt.Basic and there IS a java file called 'Basic.java' So...
     
  14. Offline

    Nohup

    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
     
  15. Offline

    Celt

    "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"
     
Thread Status:
Not open for further replies.

Share This Page