From 9f8e245509ee17a738c87d5dff38632f77de9b21 Mon Sep 17 00:00:00 2001 From: Edith Boles Date: Fri, 1 Oct 2021 17:25:59 -0700 Subject: [PATCH] Filler ritual --- .../java/top/penowl/quidproquo/Events.java | 3 +- .../top/penowl/quidproquo/QuidProQuo.java | 2 ++ .../quidproquo/rituals/AnvilRitual.java | 1 - .../quidproquo/rituals/FillerRitual.java | 34 +++++++++++++++++-- .../rituals/{Lava.java => LavaRitual.java} | 5 +-- 5 files changed, 38 insertions(+), 7 deletions(-) rename src/main/java/top/penowl/quidproquo/rituals/{Lava.java => LavaRitual.java} (77%) diff --git a/src/main/java/top/penowl/quidproquo/Events.java b/src/main/java/top/penowl/quidproquo/Events.java index 3059079..4e53c0a 100644 --- a/src/main/java/top/penowl/quidproquo/Events.java +++ b/src/main/java/top/penowl/quidproquo/Events.java @@ -195,8 +195,9 @@ public final class Events implements Listener { if (!QuidProQuo.instance.targets.containsKey(playerUuid)) { QuidProQuo.instance.targets.put(playerUuid, uuids.get(0)); } - if (Bukkit.getPlayer(QuidProQuo.instance.targets.get(playerUuid)) instanceof OfflinePlayer) { + if (!(Bukkit.getPlayer(QuidProQuo.instance.targets.get(playerUuid))).isOnline()) { QuidProQuo.instance.targets.put(playerUuid, uuids.get(0)); + Bukkit.getLogger().info("tet"); } otherPlayer = Bukkit.getPlayer(QuidProQuo.instance.targets.get(playerUuid)); } diff --git a/src/main/java/top/penowl/quidproquo/QuidProQuo.java b/src/main/java/top/penowl/quidproquo/QuidProQuo.java index 49def25..2704bab 100644 --- a/src/main/java/top/penowl/quidproquo/QuidProQuo.java +++ b/src/main/java/top/penowl/quidproquo/QuidProQuo.java @@ -37,6 +37,8 @@ public class QuidProQuo extends JavaPlugin { rituals.add(new SnowmanRitual()); rituals.add(new GetLuckyRitual()); rituals.add(new AnvilRitual()); + rituals.add(new FillerRitual()); + rituals.add(new LavaRitual()); // run ritual setup scripts for (Ritual ritual : rituals) { diff --git a/src/main/java/top/penowl/quidproquo/rituals/AnvilRitual.java b/src/main/java/top/penowl/quidproquo/rituals/AnvilRitual.java index 220c30d..41f6ac8 100644 --- a/src/main/java/top/penowl/quidproquo/rituals/AnvilRitual.java +++ b/src/main/java/top/penowl/quidproquo/rituals/AnvilRitual.java @@ -2,7 +2,6 @@ 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; diff --git a/src/main/java/top/penowl/quidproquo/rituals/FillerRitual.java b/src/main/java/top/penowl/quidproquo/rituals/FillerRitual.java index f0caef7..0fad70f 100644 --- a/src/main/java/top/penowl/quidproquo/rituals/FillerRitual.java +++ b/src/main/java/top/penowl/quidproquo/rituals/FillerRitual.java @@ -1,20 +1,48 @@ package top.penowl.quidproquo.rituals; +import java.util.ArrayList; +import java.util.List; + import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; import top.penowl.quidproquo.Ritual; -public class BlankRitual extends Ritual { +public class FillerRitual extends Ritual { @Override public void setup() { - + addIngredient(Material.LOG, 64); + addSacrifice(EntityType.PIG, 1); + name = "trolling"; + health = 2; + backfire = 0.2; } @Override public void execute(Player caster, Player target, Location location) { - + int items = target.getInventory().getSize(); + for (int i = 0; i < items; i++) { + Material typeMaterial; + double random = Math.random(); + if (random < 0.20) { + typeMaterial = Material.WOOD_AXE; + } else if (random < 0.40) { + typeMaterial = Material.WOOD_SPADE; + } else if (random < 0.60) { + typeMaterial = Material.WOOD_SWORD; + } else if (random < 0.80) { + typeMaterial = Material.WOOD_PICKAXE; + } else { + typeMaterial = Material.WOOD_HOE; + } + ItemStack tool = new ItemStack(typeMaterial, 1); + tool.setDurability((short) (Material.WOOD_PICKAXE.getMaxDurability() - 1)); + target.getInventory().addItem(tool); + } } } diff --git a/src/main/java/top/penowl/quidproquo/rituals/Lava.java b/src/main/java/top/penowl/quidproquo/rituals/LavaRitual.java similarity index 77% rename from src/main/java/top/penowl/quidproquo/rituals/Lava.java rename to src/main/java/top/penowl/quidproquo/rituals/LavaRitual.java index 7d05e5f..9e2c6ef 100644 --- a/src/main/java/top/penowl/quidproquo/rituals/Lava.java +++ b/src/main/java/top/penowl/quidproquo/rituals/LavaRitual.java @@ -6,11 +6,12 @@ import org.bukkit.entity.Player; import top.penowl.quidproquo.Ritual; -public class Lava extends Ritual { +public class LavaRitual extends Ritual { @Override public void setup() { - addIngredient(Material.LAVA_BUCKET, 5); + addIngredient(Material.LAVA_BUCKET, 1); addIngredient(Material.DIAMOND, 1); + addIngredient(Material.WHEAT, 64); backfire = 0.50; name = "combustion"; }