1

PLUGIN: Made with WandMakerAPI, need cooldowns;d

FineFinn's Avatar FineFinn1/21/17 6:01 pm
1 emeralds 282
Hi .

I'm making a PvP Factions server, and I want to use magic in it.
Now, the players can earn ingame-money by voting, or kill mobs. With
this money they can buy spells for their Wands, only, I dont wan't them to be able to spam their spells but I want a cooldown counting 40 seconds . I found on some forums how to make cooldowns, but that's not using the WandMakerAPI . Is there a way to make cooldowns using this API?

Or do I have to make codes for this cooldown using the craftbukkit? Thnx !


Here's my main.class:
package me.finefinn.Wand;

import org.bukkit.Material;
import org.bukkit.plugin.java.JavaPlugin;

import net.bigteddy98.wandapi.Wand;
import net.bigteddy98.wandapi.WandMaker;

public class Main extends JavaPlugin{

@Override
public void onEnable() {
Wand w = WandMaker.registerWand("Wand", Material.STICK);
w.registerSpell(new Healtrail());
w.registerSpell(new Flametrail());
w.registerSpell(new Poisontrail());
w.registerSpell(new Confuse());
w.registerSpell(new SOS());
w.registerSpell(new Confusionwave());
w.registerSpell(new SmallSpark());
w.registerSpell(new BigSpark());
w.registerSpell(new HealSpark());
w.registerSpell(new SpeedSpark());
w.registerSpell(new Launch());
w.registerSpell(new Flameaura());
}
}



And this is one of my spells:
package me.finefinn.Wand;

import org.bukkit.Color;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffectType;

import net.bigteddy98.wandapi.Spell;
import net.bigteddy98.wandapi.WandMaker;

public class Confuse implements Spell {

@Override
public void castSpell(Player p) {
Location loc = WandMaker.getPlayerBlock(p, 25);
WandMaker.getHelper().makeSmokeField(loc, 4);
WandMaker.getHelper().potion(loc, PotionEffectType.CONFUSION, 150, 100);
WandMaker.getHelper().potion(loc, PotionEffectType.BLINDNESS, 150, 100);
WandMaker.playFirework(loc, Type.BURST, Color.PURPLE, Color.BLACK, false, true);
}

}



Does anybody knows how to add cooldowns to this spells? Thnx!
Posted by FineFinn's Avatar
FineFinn
Level 1 : New Miner
0

Create an account or sign in to comment.

Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome