Anvil ritual

This commit is contained in:
Edith Boles 2021-10-01 16:52:22 -07:00
parent 9e684a260d
commit a62c19efad
4 changed files with 55 additions and 2 deletions

View File

@ -72,7 +72,6 @@ public final class Events implements Listener {
} else { } else {
QuidProQuo.instance.targets.put(playerUuid, uuids.get(0)); QuidProQuo.instance.targets.put(playerUuid, uuids.get(0));
} }
player.sendMessage(ChatColor.YELLOW + "Switched target to " + Bukkit.getPlayer(QuidProQuo.instance.targets.get(playerUuid)));
} }
// friendly message // friendly message
@ -120,9 +119,11 @@ public final class Events implements Listener {
for (Item item : matches) { for (Item item : matches) {
matchCount += item.getItemStack().getAmount(); matchCount += item.getItemStack().getAmount();
} }
if (matchCount >= count) { if (matchCount > count) {
possibleItems.add(matches); possibleItems.add(matches);
byproducts.add(new ItemStack(material, matchCount - count)); byproducts.add(new ItemStack(material, matchCount - count));
} else if (matchCount == count) {
possibleItems.add(matches);
} else { } else {
failed = true; failed = true;
break; break;

View File

@ -36,11 +36,14 @@ public class QuidProQuo extends JavaPlugin {
rituals.add(new FeedingRitual()); rituals.add(new FeedingRitual());
rituals.add(new SnowmanRitual()); rituals.add(new SnowmanRitual());
rituals.add(new GetLuckyRitual()); rituals.add(new GetLuckyRitual());
rituals.add(new AnvilRitual());
// run ritual setup scripts // run ritual setup scripts
for (Ritual ritual : rituals) { for (Ritual ritual : rituals) {
getLogger().info("Loading " + ritual.getClass().toString() + "..."); getLogger().info("Loading " + ritual.getClass().toString() + "...");
ritual.setup(); ritual.setup();
getLogger().info("Ingredients: " + ritual.ingredients.toString());
getLogger().info("Sacrifices: " + ritual.sacrifices.toString());
getLogger().info("Loaded a " + ritual.name + " ritual."); getLogger().info("Loaded a " + ritual.name + " ritual.");
} }

View File

@ -0,0 +1,29 @@
package top.penowl.quidproquo.rituals;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Player;
import top.penowl.quidproquo.Ritual;
public class AnvilRitual extends Ritual {
@Override
public void setup() {
addIngredient(Material.ANVIL, 1);
addIngredient(Material.ENDER_PEARL, 2);
addIngredient(Material.ROTTEN_FLESH, 32);
name = "anviling";
health = 5;
backfire = 0.5;
}
@Override
public void execute(Player caster, Player target, Location location) {
FallingBlock block = target.getLocation().getWorld().spawnFallingBlock(target.getLocation().clone().add(0, 20, 0), Material.ANVIL, (byte) 0);
block.setHurtEntities(true);
}
}

View File

@ -0,0 +1,20 @@
package top.penowl.quidproquo.rituals;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import top.penowl.quidproquo.Ritual;
public class BlankRitual extends Ritual {
@Override
public void setup() {
}
@Override
public void execute(Player caster, Player target, Location location) {
}
}