Spells is a minecraft plugin that replicates the wizard world! Please be aware some of this code is used directly from here and this version will hopefully contain more contribution updates rather than creator updates.
- HarryPotterSpells | Project Creator
- Steamworks | Contributor / Repository Owner
- Download the jar from releases
- Put the jar in your server.
- Edit the configuration files to your liking. (NOTE The spells have defaulted parameters hard-coded but are mostly configurable.)
You can access our events from our me.steamworks.api.event.impl
folder, and you can view all other api related files in me.steamworks.api
This example shows how to listen to when spells are cast.
package me.padfoot.hooks;
import me.steamworks.api.event.impl.SpellPostCastEvent;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
class SpellsHook implements Listener {
@EventHandler
public void onSpellCastEvent(SpellPostCastEvent event) {
System.out.printf("%s has casted the spell %s!%n", event.getCaster().getName(), event.getSpell().getName());
}
}
This example shows you how to create your own spell (NOTE Correct packaging will be judged and noted on during a PR request, please make sure you put the spell in the correct category, e.g. charms, curses, hexes or modifiers.)
package me.steamworks.spells.impl.curse;
import me.steamworks.SpellPlugin;
import me.steamworks.Targeter;
import me.steamworks.spells.Spell;
import me.steamworks.spells.SpellInfo;
import me.steamworks.utils.WrappedParticle;
import org.bukkit.Color;
import org.bukkit.Particle;
import org.bukkit.block.Block;
import org.bukkit.entity.LivingEntity;
@SpellInfo(
name = "Avada Kedavra",
description = "Three make a whole.",
cooldown = 120
)
public class AvadaKedavra extends Spell {
// This example shows if you wish to target a specific block or entity, and you can view the different methods for summoning effects or fireworks.
@Override
public boolean cast(final Player player) {
SpellPlugin.getInstance().getTargeter().register(player, new Targeter.SpellHitEvent() {
@Override
public void block(Block block) {
player.sendMessage("pfft you can only use this on entities!");
}
@Override
public void entity(LivingEntity entity) {
entity.setHealth(0);
}
}, 1, 0.5, 2, new WrappedParticle(Particle.REDSTONE, new Particle.DustOptions(Color.GREEN, 1)));
return true;
}
// This example shows if you don't want to have a target and just run the spell against the caster.
// @Override
// public boolean cast(final Player player) {
// player.setHealth(0);
// return true;
// }
}