Filled Pumpkin head

Discussion in 'Archived: Plugin Requests' started by klosjaarrr, Oct 11, 2014.

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

    klosjaarrr

    Plugin category: Fun

    Suggested name: HalloweenHead

    What I want: I'd like to see a plugin that equips a random online player with a pumpkin head (the one you can already equip in vanilla Minecraft) every x time (config?). Keep in mind the current equiped helmet should be put in the inventory of the player, unless it is full (choose a different online player). If possible, make a configurable message being sent to the player being tricked.

    So an idea for the config would be:


    Code:
    time: 15m
    message: "&6[Plugin] &eTrick or treat!"
    Ideas for commands: No commands needed for this plugin.

    Ideas for permissions: player.exempt - does not get a pumpkin equipped

    When I'd like it by: 25 October
     
  2. Offline

    pie_flavor

    klosjaarrr
    I will make this.

    klosjaarrr
    Here you go.
    Please inform me of any bugs.
    A currently known bug is that if everyone on the server has a full inventory, it will lag out.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 14, 2016
    klosjaarrr likes this.
  3. Offline

    klosjaarrr

    Will test it tomorrow, thanks! What about storing all players in a List, checking them in a for loop and if nobody has an inventory spot left, return and wait for the next time interval? Or wouldnt that work?
     
  4. Offline

    pie_flavor

    klosjaarrr Didn't think about it. I'll try it as soon as I finish dinner. Also, I don't need them to be in a list, I already get them from an array from getOnlinePlayers().

    klosjaarrr Aaaaand there we go. Redownload it for the updated version.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 14, 2016
  5. Offline

    klosjaarrr


    What Java version was the plugin written for? Because it seems I'm not on the correct version:

    Code:
    [12:29:54 ERROR]: Could not load 'plugins\HalloweenHead.jar' in folder 'plugins'
     
    org.bukkit.plugin.InvalidPluginException: java.lang.UnsupportedClassVersionError
    : plugin/HeadMain : Unsupported major.minor version 52.0
            at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.j
    ava:131) ~[Craftbukkit.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
            at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.
    java:328) ~[Craftbukkit.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
            at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager
    .java:251) [Craftbukkit.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
            at org.bukkit.craftbukkit.v1_7_R3.CraftServer.loadPlugins(CraftServer.ja
    va:366) [Craftbukkit.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
            at org.bukkit.craftbukkit.v1_7_R3.CraftServer.<init>(CraftServer.java:32
    8) [Craftbukkit.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
            at net.minecraft.server.v1_7_R3.PlayerList.<init>(PlayerList.java:68) [C
    raftbukkit.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
            at net.minecraft.server.v1_7_R3.DedicatedPlayerList.<init>(SourceFile:14
    ) [Craftbukkit.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
            at net.minecraft.server.v1_7_R3.DedicatedServer.init(DedicatedServer.jav
    a:126) [Craftbukkit.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
            at net.minecraft.server.v1_7_R3.MinecraftServer.run(MinecraftServer.java
    :436) [Craftbukkit.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
            at net.minecraft.server.v1_7_R3.ThreadServerApplication.run(SourceFile:6
    28) [Craftbukkit.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
    Caused by: java.lang.UnsupportedClassVersionError: plugin/HeadMain : Unsupported
    major.minor version 52.0
            at java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.7.0_45]
            at java.lang.ClassLoader.defineClass(Unknown Source) ~[?:1.7.0_45]
            at java.security.SecureClassLoader.defineClass(Unknown Source) ~[?:1.7.0
    _45]
            at java.net.URLClassLoader.defineClass(Unknown Source) ~[?:1.7.0_45]
            at java.net.URLClassLoader.access$100(Unknown Source) ~[?:1.7.0_45]
            at java.net.URLClassLoader$1.run(Unknown Source) ~[?:1.7.0_45]
            at java.net.URLClassLoader$1.run(Unknown Source) ~[?:1.7.0_45]
            at java.security.AccessController.doPrivileged(Native Method) ~[?:1.7.0_
    45]
            at java.net.URLClassLoader.findClass(Unknown Source) ~[?:1.7.0_45]
            at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.
    java:77) ~[Craftbukkit.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
            at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.
    java:62) ~[Craftbukkit.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
            at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_45]
            at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_45]
            at java.lang.Class.forName0(Native Method) ~[?:1.7.0_45]
            at java.lang.Class.forName(Unknown Source) ~[?:1.7.0_45]
            at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.jav
    a:40) ~[Craftbukkit.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
            at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.j
    ava:127) ~[Craftbukkit.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
            ... 9 more
     
  6. Offline

    simgar98

    Looks more like a wrong java version to me ;)
     
  7. Offline

    klosjaarrr


    Isn't that exactly what I said? :p
     
  8. Offline

    simgar98

    pardon me, I read server version, derp xD
     
    klosjaarrr likes this.
  9. Offline

    timtower Administrator Administrator Moderator

    pie_flavor I am pretty sure that you compiled with java 8 again.
     
  10. Offline

    klosjaarrr


    Probably, most servers are on Java 7 nowaways.
     
  11. Offline

    timtower Administrator Administrator Moderator

    I am very aware of that.
     
  12. Offline

    pie_flavor

  13. Offline

    klosjaarrr


    Don't worry, happens to the best of us :p Thanks anyway, it seems to work: Going to test it more in depth tonight :)


    Actually, the plugin loads now, but it just fills up my inventory with stacks of dirt, instead of giving me a pumpkin head :p

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 14, 2016
  14. Offline

    pie_flavor

    klosjaarrr Hmm.
    My current method for figuring out if someone has an empty inventory space is to give them a stack of dirt, then see if it made it and if it did, clear it from their inventory.

    klosjaarrr Lel, forgot to clear the dirt back out during the serverwide check. Redownload.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 14, 2016
  15. Offline

    klosjaarrr


    Code:
    [23:20:38] [Server thread/WARN]: [HalloweenHead] Task #2 for HalloweenHead vlulz generated an exception
    java.lang.NullPointerException
        at org.bukkit.craftbukkit.v1_7_R3.inventory.CraftInventory.removeItem(CraftInventory.java:336) ~[Craftbukkit.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
        at plugin.PumpkinCarver.run(PumpkinCarver.java:38) ~[?:?]
        at org.bukkit.craftbukkit.v1_7_R3.scheduler.CraftTask.run(CraftTask.java:53) ~[Craftbukkit.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
        at org.bukkit.craftbukkit.v1_7_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:345) [Craftbukkit.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
        at net.minecraft.server.v1_7_R3.MinecraftServer.v(MinecraftServer.java:600) [Craftbukkit.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
        at net.minecraft.server.v1_7_R3.DedicatedServer.v(DedicatedServer.java:260) [Craftbukkit.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
        at net.minecraft.server.v1_7_R3.MinecraftServer.u(MinecraftServer.java:558) [Craftbukkit.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
        at net.minecraft.server.v1_7_R3.MinecraftServer.run(MinecraftServer.java:469) [Craftbukkit.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
        at net.minecraft.server.v1_7_R3.ThreadServerApplication.run(SourceFile:628) [Craftbukkit.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
    The console is spamming this a lot
     
  16. Offline

    pie_flavor

    klosjaarrr You can just ignore it, it's nothing serious. Or you can redownload it again.
     
  17. Offline

    klosjaarrr


    It seems it is still not working onfortunately :( Getting the same error, dirt is spacy all the time and I don't get equiped with a head :( Thanks for trying anyway, not sure why it does this so weirdly.
     
  18. Offline

    pie_flavor

  19. Offline

    Watto

    pie_flavor

    By the way if you wanted to know, you can check if a player has a spare inventory space by calling 'player.getInventory().firstEmpty()' if it returns -1 then there is no space.
     
  20. Offline

    pie_flavor

    Watto I can't believe I didn't catch that. Thanks.
     
  21. Offline

    drpk

    klosjaarrr I took this up and it's done
    <Edit by Moderator: Redacted mediafire url>
    NOTE: Time is in seconds and you can use & in the message in the config.
     
    Last edited by a moderator: Nov 1, 2016
    klosjaarrr likes this.
  22. Offline

    klosjaarrr

    [quote uid=90998657 name="pie_flavor" post=2844872]klosjaarrr Sorry for failing. I tried. :'([/quote]


    Haha don't worry, I'm glad you tried! Thanks anyway!

    [quote uid=90968162 name="drpk" post=2845819]klosjaarrr I took this up and it's done
    <Edit by Moderator: Redacted mediafire url>
    NOTE: Time is in seconds and you can use & in the message in the config.[/quote]


    Seems to work great, thank you very much!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Nov 1, 2016
  23. Offline

    drpk

  24. Offline

    klosjaarrr


    Could you maybe send the source code as well? Mainly because I am interested in bukkit development myself, and I would love to see a working easy example of using config files :)
     
  25. Offline

    drpk

  26. Offline

    klosjaarrr

    drpk likes this.
Thread Status:
Not open for further replies.

Share This Page