Skip to content

steamworksmc/spells

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spells

Java Apache Maven IntelliJ IDEA

Stars Badge Forks Badge Pull Requests Badge Issues Badge GitHub contributors License Badge

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.

Contributors

Contact

Installing

  1. Download the jar from releases
  2. Put the jar in your server.
  3. Edit the configuration files to your liking. (NOTE The spells have defaulted parameters hard-coded but are mostly configurable.)

API

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

Usage

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;
    //    }

}

Views