use of com.denizenscript.denizen.npc.traits.FishingTrait in project Denizen-For-Bukkit by DenizenScript.
the class FishCommand method execute.
@Override
public void execute(ScriptEntry scriptEntry) {
LocationTag location = scriptEntry.getObjectTag("location");
ElementTag catchtype = scriptEntry.getElement("catch");
ElementTag stop = scriptEntry.getElement("stop");
ElementTag percent = scriptEntry.getElement("percent");
if (scriptEntry.dbCallShouldDebug()) {
Debug.report(scriptEntry, getName(), location, catchtype, percent, stop);
}
NPCTag npc = Utilities.getEntryNPC(scriptEntry);
FishingTrait trait = npc.getFishingTrait();
if (stop.asBoolean()) {
trait.stopFishing();
return;
}
npc.getEquipmentTrait().set(0, new ItemStack(Material.FISHING_ROD));
trait.setCatchPercent(percent.asInt());
trait.setCatchType(FishingHelper.CatchType.valueOf(catchtype.asString().toUpperCase()));
trait.startFishing(location);
}
Aggregations