[FUN] Reagent v0.4 - Give your players magic... at a price [953]

Discussion in 'Inactive/Unsupported Plugins' started by pr0f1x, Apr 30, 2011.

  1. Offline

    pr0f1x

    Reagent - Give your players magic... at a price!
    Version: v0.4

    A reagent is a "substance or compound that is added to a system in order to bring about a chemical reaction or is added to see if a reaction occurs."

    Reagent is a plugin for CraftBukkit servers that adds the ability for players to cast magic spells. What makes Reagent unique is that when a player casts a spell a configurable amount of materials are consumed. Of course, if the server administrator wishes they could make all spells free but I think that defeats the purpose.

    I wanted to create a magic system that had capability to restrict the usage of the spells as to not totally destroy the "Minecraftness" of the game. IMHO, making spells expensive to use makes them more interesting, makes them used less and keeps the immersion of Minecraft by using mined materials as a sort of "cost" to cast the spells.

    When using Reagent, players need to pay more attention to when they should cast a spell since the cost of casting could be quite substantial depending on how the server is configured.

    This is my first plugin and I made it because I thought it was a cool idea. I'm putting it here in the hopes someone else will enjoy it as well!

    Features:
    • Cast 16 different magic spells.
    • Magic spell costs are configurable via config file. Any combination of materials is possible.
    • Spells can be cast via an item or by command line.
    Links:
    Download v0.4
    Source Code
    More Information

    Usage:
    To use the plugin just use the /reagent <spell> command. For example, /reagent teleport would initialize the teleport spell if you have enough materials to do so. The materials will then be removed from your inventory and a message will be displayed telling you so.

    Once the spell is initialized, RIGHT clicking (depending on the spell) on a block will cast the spell.

    Known Problems:
    For some reason if you are empty handed Bukkit will not call the proper method to cast the spell beyond a certain distance. In order to cast spells over a larger distance than a few blocks, you must have something in your hand.

    Example:
    By default, in order to cast teleport, a player must have 8 redstone in their inventory...

    Current Spells:
    fire, bolt, storm, timebomb, teleport, teleportspawn, heal, arrowstorm, stonewall, firewall, skeleton, zombie, timetravel, megabolt, scan, tree

    Changelog:
    Version 0.4
    • It is now possible to cast spells using an item. (EXPERIMENTAL)
    Version 0.3
    • Fixed bug where sometimes the materials would not be consumed if you had multiple small stacks of the same material.
    • Removed the air spell. (Never worked)
    • Added 4 new spells.
    View Older Versions (open)

    Version 0.2
    • Spells now have a configurable cool down timer.
    • If not using permissions all players now must pay for spells. (Ops included)
    Version 0.1
    • Initial Release
     
    Noppoly, Pinkpixels and Calcifero like this.
  2. Offline

    alfskan

    omg..

    I know the reason.

    I didnt save the config file..

    idiot!

    thanks and sorry :'(
     
  3. Offline

    Multitallented

    2011-07-14 11:36:33 [SEVERE] Could not pass event PLAYER_INTERACT to Reagent
    java.lang.NullPointerException

    It crashed my server. Please fix.
     
  4. Offline

    pr0f1x

    If you can give more more information on how to reproduce the problem I would be glad to fix it.
     
  5. Offline

    Eclipse54

    If you have this and other magic plugins, will they all work?
     
  6. Offline

    Multitallented

    Code:
    2011-07-15 18:37:30 [SEVERE] Could not pass event PLAYER_INTERACT to Reagent
    java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
        at java.util.LinkedList.entry(Unknown Source)
        at java.util.LinkedList.get(Unknown Source)
        at net.hpxn.reagent.ReagentPlayerListener.getNextSpell(ReagentPlayerListener.java:98)
        at net.hpxn.reagent.ReagentPlayerListener.onPlayerInteract(ReagentPlayerListener.java:56)
        at org.bukkit.plugin.java.JavaPluginLoader$10.execute(JavaPluginLoader.java:307)
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:58)
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:321)
        at org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:168)
        at net.minecraft.server.ItemInWorldManager.interact(ItemInWorldManager.java:210)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:552)
        at net.minecraft.server.Packet15Place.a(SourceFile:57)
        at net.minecraft.server.NetworkManager.b(NetworkManager.java:226)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:84)
        at net.minecraft.server.NetworkListenThread.a(SourceFile:105)
        at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:451)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:361)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
    Sorry I didn't include a stack trace. I just saw it in my logs and I have no idea who or what was going on. I don't think it crashed my server after all, but it might still be helpful.

    Code:
    2011-07-15 20:25:15 [SEVERE] Could not pass event PLAYER_INTERACT to Reagent
    java.lang.NullPointerException
        at net.hpxn.reagent.ReagentPlayerListener.getSelectedSpell(ReagentPlayerListener.java:75)
        at net.hpxn.reagent.ReagentPlayerListener.onPlayerInteract(ReagentPlayerListener.java:62)
        at org.bukkit.plugin.java.JavaPluginLoader$10.execute(JavaPluginLoader.java:307)
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:58)
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:321)
        at org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:168)
        at net.minecraft.server.ItemInWorldManager.dig(ItemInWorldManager.java:63)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:457)
        at net.minecraft.server.Packet14BlockDig.a(SourceFile:42)
        at net.minecraft.server.NetworkManager.b(NetworkManager.java:226)
        at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:84)
        at net.minecraft.server.NetworkListenThread.a(SourceFile:105)
        at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:451)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:361)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
    I just found this too.

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

    pr0f1x

    Usually when this happens you have an error somewhere in your configuration file. Try to look over the file and make sure you have everything exactly right. YML is very picky about spacing.

    You can also paste your config here and I can take a look.

    They should... but I can't really guarantee that since I have not tested this will all the other magic plugins. I guess if you don't use the same item to cast with for all the plugins it should work ok.

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

    Eclipse54

    okay thanks
     
  9. Offline

    qazz42

    I am having a problem with megabolt, it seems not to work. I use up the reagents, and then, after, I right click to cast it. It says I cast megabolt, but I see no difference and pretty much nothing happens. I get no error message on the console. Here is my config
    Code:
    # Reagent Configuration
    # Spells: fire, bolt, storm, timebomb, teleport, teleportspawn, heal,
    #         arrowstorm, stonewall, firewall, skeleton, zombie, timetravel,
    #         megabolt, scan, tree
    #
    # Info: https://github.com/pr0f1x/reagent
    
    # Broadcast to all players when someone casts a spell.
    broadcast: true
    
    # Give players hints on what materials they are missing.
    hint: true
    
    # Allow players to cast spells with the command line.
    command: true
    
    # Allow players to cast spells with an item.
    item: book
    
    # List of spells. Configure each spells cost.
    spells:
      tree:
        cooldown: 6
        materials:
          bone: 1
          sapling: 1
      scan:
        cooldown: 6
        materials:
          redstone: 2
      megabolt:
        cooldown: 6
        materials:
          redstone: 2
      fire:
        cooldown: 5
        materials:
          redstone: 2
      bolt:
        cooldown: 5
        materials:
          redstone: 2
      storm:
        cooldown: 5
        materials:
          redstone: 2
      timebomb:
        cooldown: 5
        materials:
          redstone: 4
          flint: 2
      teleport:
        cooldown: 5
        materials:
          redstone: 8
      teleportspawn:
        cooldown: 30
        materials:
          redstone: 5
      heal:
        cooldown: 3
        materials:
          redstone: 5
      arrowstorm:
        cooldown: 20
        materials:
          redstone: 5
      stonewall:
        cooldown: 30
        materials:
          redstone: 5
      skeleton:
        cooldown: 60
        materials:
          bone: 2
      zombie:
        cooldown: 60
        materials:
          pork: 2
      firewall:
        cooldown: 30
        materials:
          redstone: 6
      timetravel:
        cooldown: 60
        materials:
          watch: 2
          redstone: 5
    
    what am I doing wrong? Or is it a bug? I really wanna see megabolt....
     
  10. Offline

    EricDownz

    I saw this plugin and it looked cool and I want to use it for my server but I only want admins to use it and no materials to cast a spell, I just don't want random people going around saying spells and destroying the server.
    So... yes! :D
     
  11. Offline

    pr0f1x

    Megabolt auto targets monsters that are in your area. It won't work if there are no monsters around. Find an area with a bunch of monsters swarming you and cast it. You should see them being hit my lightning once each once per second.

    If it doesn't work let me know and I will test it out myself and fix it if required.
     
  12. Offline

    qazz42

    aaah, I see. Ok, it works fine, thanks for helping me :D (would it be possible to make it so that, in future releases, you can use megabolt on anything?)
     
  13. Offline

    pr0f1x

    It's possible. I guess it could just throw a bunch of lightning bolts around randomly just for fun! :p
     
  14. Offline

    qazz42

    haha, it could be that you have it so that the surrounding 5x5 area has lightning strike it.
     
  15. Offline

    Multitallented

    Thanks for your help. I ran it through a parser and it looks fine to me, but I could be wrong.
    http://pastebin.com/rypXq6kK
     
  16. Offline

    qazz42

    also, how does timebomb work? I cant figure that out either... nothing happens ;.;
     
  17. Offline

    pr0f1x

    Click on a block that is within I think 100 blocks of you. That block should turn into TNT and the top of the TNT should be ignited by fire. If it doesn't work let me know. Thanks.
     
  18. Offline

    qazz42

    er
    Code:
    groups:
        Guests:
            default: true
            info:
                prefix: '&2'
                suffix: '&f'
                build: false
            permissions:
        Members:
            default: false
            info:
                prefix: '&2'
                suffix: '&f'
                build: true
            permissions:
            - reagent.spells.*
            - dd.teleport
            - OwnBlocks.use
            - dreamland.fly
        Moderators:
            default: false
            info:
                prefix: '&b'
                suffix: '&f'
                build: true
            inheritance:
            - Default
            permissions:
            - admincmd.player.kill
            - admincmd.player.kick
            - admincmd.item.add
            - reagent.spells.*
            - dd.teleport
            - OwnBlocks.use
            - admincmd.time.set
            - dreamland.fly
            - OwnBlocks.ignoreOwnership
        Admins:
            default: false
            info:
                prefix: '&4'
                suffix: '&f'
                build: true
            permissions:
            - '*'
        Default:
            permissions:
            inheritance:
    track:
    - Guests
    - Members
    - Moderators
    - Admins
    
    is my group config after tracks, but for some reason I (an Admin) do not get to cast spells for free, I had a change of heart and want to cast them for free. what should I change?
     
  19. Offline

    pr0f1x

    You should be getting them free already... try adding:
    Code:
    - 'reagent.free'
    
    To your Admin permissions.
     
  20. Offline

    qazz42

    strange, a server reboot now lets me have it free.. again.. I will add that when it happens again, thanks :D
     
  21. Offline

    Multitallented

    If I could request anything, I'd ask you to make firewall, fire, tree, and stonewall to undo themselves after a certain time (to prevent griefing). I would love to use these spells, but they can and have been used to grief even protected areas. Either that or make it so the game recognizes who created the fire, tree, wall, etc and checks for protection or at least shows who cast it in the block log.
     
  22. Offline

    pr0f1x

    Thanks. I will try and look into this.
     
  23. Offline

    Multitallented

    Also, if you could make the heal spell heal the person you're targeting instead of just yourself, then that would be awesome.

    I've successfully made firewall and timebomb undo themselves after 6 and 45 seconds respectively! I'm working on making tree non-random, and undoing itself also. Fire is almost done. I added a creeper, pig, and chicken spell too. I made teleport have a max-distance of 10 and leave fire behind you that undoes itself in 6 seconds. I also made megabolt strike all at once (to avoid friendly fire). This is my first time really messing with any plugins at all, and I'm really happy with the result! I'll share with you when finished if you'd like.

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

    Multitallented

    I've had a lot of success! I made tree undo itself after a set time, as well as every other spell that creates blocks. No more griefing problems I hope. Also, I was able to change Heal to heal all players within a 3 block radius of the target block. I also changed timebomb to create a pit of tnt that is 2 deep (which is still hard to hit with, but is insta-kill if it does). I think I'll go add my own spells now ^_^

    If you'd like to see what I did, I'll be happy to share.
     
  25. Offline

    pr0f1x

    I would love to see it and to add it into Reagent. If you know how to use github you can make a pull request and I can check it out that way.

    Thanks :)
     
  26. Offline

    Multitallented

    ok, I'm familiar with git, but not pull requests. I'll look into it. I've changed sooo much of your SpellManager.java file, it's grown to over 1500 lines. This is my first attempt at cracking open a plugin so my code may be sub-optimal, but I am using the bukkit scheduler instead of just creating new threads like you were.

    Using the scheduler, I was able to add animation to fire and tree (and the victim isn't auto-screwed as he has a second to react if the aim is off by a block or two). I added a new random spell that basically redirects to other spells. I love it cause you could accidentally heal your opponent, or trap them in a pit with 4 armed tnt.

    I added a lot of random elements to spells using Math.random(). For instance, bolt has a 20% chance to strike twice (1/20th of a second apart). Arrowstorm now has a random rate of fire (2 - 10 per minute) and a random number of arrows it shoots!

    I'm working a mammoth of a new spell though that I love so much. I call it glassshield, and it creates a 5x5 sphere of glass and air that is constantly changing and moving with you. It lasts anywhere from 10-30 and it looks amazing! I can't wait to share! Once I put this on my server, I'll get video footage up!
     
  27. Offline

    pr0f1x

    Awesome. You should get used to github. I will add you as a collaborator or even give you the project. I haven't had much time to work on it lately and I don't want to see it die.

    The code might not be optimal but at least it's progressing. :)
     
  28. Offline

    brentsky96

    can you teach ppl spells?
     
  29. Offline

    Maiko

    Would becool if it could be made without cht commands but by eating certain potions or food :)
    As in you need a magic craft table to craft those items to eat so u can right click to eat it and then it wil cast.

    Greets, Maiko.
     

Share This Page