๐ณ๏ธClass API
Creating your own class
WizardClasses.injectClass(Class<? extends WizardClass> clazz, String name, String fileName);import com.floodeer.wizards.Wizards;
import com.floodeer.wizards.game.GamePlayer;
import com.floodeer.wizards.game.classes.WizardClass;
import com.floodeer.wizards.particles.ParticleEffect;
import com.floodeer.wizards.script.ScriptManager;
import com.floodeer.wizards.util.ItemFactory;
import com.floodeer.wizards.util.LocationUtils;
import com.floodeer.wizards.util.Util;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import java.io.File;
public class Reaper extends WizardClass {
public Reaper(String name, File configFile) {
super(name, configFile);
}
@Override
public void give(Player player) {
player.getInventory().addItem(ItemFactory.unbreakable(getWeapon()));
player.getInventory().setHelmet(ItemFactory.unbreakable(getHelmet()));
player.getInventory().setChestplate(ItemFactory.unbreakable(getChesplate()));
player.getInventory().setLeggings(ItemFactory.unbreakable(getLeggings()));
player.getInventory().setBoots(ItemFactory.unbreakable(getBoots()));
}
@Override
public void onInteract(Player player) {
GamePlayer gp = GamePlayer.get(player.getUniqueId());
if (gp.getMana() < getManaCost()) { //Mana Manager
if(!Wizards.get().getMessages().enoughMana.isEmpty())
gp.getP().sendMessage(Util.colorString(Wizards.get().getMessages().enoughMana.replaceAll("%prefix%", Wizards.get().getMessages().prefix)));
if(!Wizards.get().getOptions().enoughMana.isEmpty())
Util.playSound(gp.getP(), Wizards.get().getOptions().enoughMana);
} else {
ScriptManager.run(gp, getScript()); //Script system, if enabled
gp.setMana(gp.getMana() - getManaCost()); //Remove player mana
//Skill start
Location location = player.getLocation();
//Skill Particle Effect
LocationUtils.getCircle(location.clone().add(0.0D, 1.0D, 0.0D), 5.0D, 40).forEach(l -> {
ParticleEffect.CRIT_MAGIC.display(0.0F, 0.0F, 0.0F, 0.1F, 3, l, 126);
ParticleEffect.CLOUD.display(0.0F, 0.0F, 0.0F, 0.01F, 1, l, 126);
});
//Apply skill damage and effects
Util.filterAreaDamage(player, getDamage(), location, getAreaDamage(), false, Wizards.get().getMessages().magic).forEach(target -> {
ScriptManager.run(gp, GamePlayer.get(target), getTargetScript());
GamePlayer targetgp = GamePlayer.get(target);
targetgp.setMana(0);
target.sendMessage(Util.colorString("&cYour mana has been devoured by &4" + player.getName() + "&c!"));
});
//Skill end
}
}
}Last updated