Spells Plugins! need help

Discussion in 'Plugin Development' started by Violence010, Mar 2, 2014.

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

    Violence010

    Okay, so for my spell plugin, it is harry potter based,

    So i have one package for my main class, that registers all of the events, and I have a package for spells with multiple spells class files, and for each spell, you must do (for example) /Stupefy. And it will launch an egg(the default projectile, on server it is retextured to be invisible), and then it will get the eggs location, and then cause firework effects, potion effects, etc. Would there be a way of Right Clicking? to scroll through All of the spells on a loop instead of having to do /(spell) for each time you want to cast a/the spell? and On the loop, if you stop on a spell, it will activate that class file? and then i can just go into each spell file, and change the casting method, to a left click air method, so i could just scroll with my right clicking? if somebody could tell me how to create a class file, or make one, to Tell you what spell/class file you're on? and then once you stop on it, it would activate that spell? please, if you can , i would be very gratefull, please commnet, and if you would like my skype, it's live:ethanborawski
     
  2. No idea what you're on about, break what your trying to do into steps.
     
  3. Offline

    Violence010

    Alright,
    i have a bunch of spell classes, but to cast them, you have to do /(spell)

    And i would like to be able to select, and cast spells, by scrolling through them
    via right clicking,

    So would there be a way, to link my spells to a class file, where whenever you right clicked, it would say:
    [Spells] Current Spell: (Spell)

    And, basically, when it said the spell, it would activate the class, so when you left clicked, to cast, it would only cast that spell.
     
  4. You can't modify the client's chat in anyway but what I'd do is use a modified blaze rod as a magic wand, then listen for any click events and check that the user is holding a special magic wand and change the title of that wand as the user right clicked e.g. ("Spell: Abracadabra"), then use an if or switch statement to execute the right spell when they left-clicked. :D
     
  5. Offline

    NathanWolf

    This sounds familiar! ;)

    Build an ArrayList of all your spell objects, and maintain an integer index for each player into that list, as their current spell. Use a HashMap<String, Integer> for that.

    On right click, increment the index. If it's >= the size of your list, set it to zero. On left click, cast the spell from your list that corresponds to that players' current spell index.
     
  6. hehe familiar to what? I just thought of it and wrote it because I've written a small plugin that was vaguely familiar but used teleportation, unless of course my subconscious mind remembered something :eek:.

    Lol just checked what plugins you've created and got what you meant by "This sounds familiar!".
     
    NathanWolf likes this.
  7. Offline

    Barinade

    Use an enum for your spells, a switch statement to get the spell by id, create classes with each spell effect with a constructor for the arguments required, you can use ternary to increment your spell
    Spell.fromId(playerSpell == highestSpellId ? playerSpell = 1, ++playerSpell);
    The above code will increment playerSpell until it reachest highestSpellId, then set it back to 1.
     
Thread Status:
Not open for further replies.

Share This Page