From c54f2a354b6c20fd0c2f0e8f459dfb8e21f9f489 Mon Sep 17 00:00:00 2001 From: Edith Boles Date: Fri, 1 Oct 2021 17:53:46 -0700 Subject: [PATCH 1/3] Fix hitritual --- src/main/java/top/penowl/quidproquo/QuidProQuo.java | 1 + .../java/top/penowl/quidproquo/rituals/AnvilRitual.java | 5 +++-- .../java/top/penowl/quidproquo/rituals/FeedingRitual.java | 5 ++--- .../java/top/penowl/quidproquo/rituals/FillerRitual.java | 3 ++- .../top/penowl/quidproquo/rituals/GetLuckyRitual.java | 3 ++- .../java/top/penowl/quidproquo/rituals/HealRitual.java | 5 +++-- .../java/top/penowl/quidproquo/rituals/HitRitual.java | 8 +++++--- .../java/top/penowl/quidproquo/rituals/LavaRitual.java | 4 ++-- .../java/top/penowl/quidproquo/rituals/SnowmanRitual.java | 5 +++-- 9 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/main/java/top/penowl/quidproquo/QuidProQuo.java b/src/main/java/top/penowl/quidproquo/QuidProQuo.java index 2704bab..82c3cda 100644 --- a/src/main/java/top/penowl/quidproquo/QuidProQuo.java +++ b/src/main/java/top/penowl/quidproquo/QuidProQuo.java @@ -39,6 +39,7 @@ public class QuidProQuo extends JavaPlugin { rituals.add(new AnvilRitual()); rituals.add(new FillerRitual()); rituals.add(new LavaRitual()); + rituals.add(new HitRitual()); // 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 41f6ac8..3f60ab5 100644 --- a/src/main/java/top/penowl/quidproquo/rituals/AnvilRitual.java +++ b/src/main/java/top/penowl/quidproquo/rituals/AnvilRitual.java @@ -12,8 +12,9 @@ public class AnvilRitual extends Ritual { @Override public void setup() { addIngredient(Material.ANVIL, 1); - addIngredient(Material.ENDER_PEARL, 2); - addIngredient(Material.ROTTEN_FLESH, 32); + addIngredient(Material.ENDER_PEARL, 1); + addIngredient(Material.ROTTEN_FLESH, 1); + addIngredient(Material.WHEAT, 32); name = "anviling"; health = 5; backfire = 0.5; diff --git a/src/main/java/top/penowl/quidproquo/rituals/FeedingRitual.java b/src/main/java/top/penowl/quidproquo/rituals/FeedingRitual.java index 08ec3a2..ad4c19f 100644 --- a/src/main/java/top/penowl/quidproquo/rituals/FeedingRitual.java +++ b/src/main/java/top/penowl/quidproquo/rituals/FeedingRitual.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.Player; import top.penowl.quidproquo.Ritual; @@ -11,8 +10,8 @@ public class FeedingRitual extends Ritual { @Override public void setup() { - addSacrifice(EntityType.PIG, 1); - addIngredient(Material.WOOD_SWORD, 1); + addIngredient(Material.WOOD_HOE, 1); + addIngredient(Material.WHEAT, 16); health = 1; name = "feeding"; } diff --git a/src/main/java/top/penowl/quidproquo/rituals/FillerRitual.java b/src/main/java/top/penowl/quidproquo/rituals/FillerRitual.java index 0fad70f..5ee1c06 100644 --- a/src/main/java/top/penowl/quidproquo/rituals/FillerRitual.java +++ b/src/main/java/top/penowl/quidproquo/rituals/FillerRitual.java @@ -15,8 +15,9 @@ public class FillerRitual extends Ritual { @Override public void setup() { - addIngredient(Material.LOG, 64); + addIngredient(Material.LOG, 1); addSacrifice(EntityType.PIG, 1); + addIngredient(Material.WHEAT, 128); name = "trolling"; health = 2; backfire = 0.2; diff --git a/src/main/java/top/penowl/quidproquo/rituals/GetLuckyRitual.java b/src/main/java/top/penowl/quidproquo/rituals/GetLuckyRitual.java index 9a75979..68ab2f2 100644 --- a/src/main/java/top/penowl/quidproquo/rituals/GetLuckyRitual.java +++ b/src/main/java/top/penowl/quidproquo/rituals/GetLuckyRitual.java @@ -11,8 +11,9 @@ public class GetLuckyRitual extends Ritual { @Override public void setup() { - addIngredient(Material.GOLD_BLOCK, 3); + addIngredient(Material.GOLD_BLOCK, 1); addIngredient(Material.TNT, 1); + addIngredient(Material.WHEAT, 256); health = 3; lightning = true; name = "daring"; diff --git a/src/main/java/top/penowl/quidproquo/rituals/HealRitual.java b/src/main/java/top/penowl/quidproquo/rituals/HealRitual.java index c280370..a1d44dd 100644 --- a/src/main/java/top/penowl/quidproquo/rituals/HealRitual.java +++ b/src/main/java/top/penowl/quidproquo/rituals/HealRitual.java @@ -10,13 +10,14 @@ public class HealRitual extends Ritual { @Override public void setup() { - addIngredient(Material.REDSTONE, 9); + addIngredient(Material.REDSTONE, 1); + addIngredient(Material.WHEAT, 16); name = "healing"; } @Override public void execute(Player caster, Player target, Location location) { - caster.setHealth(Math.min(caster.getMaxHealth(), caster.getHealth()+2.0)); + caster.setHealth(Math.min(caster.getMaxHealth(), caster.getHealth()+8.0)); } } diff --git a/src/main/java/top/penowl/quidproquo/rituals/HitRitual.java b/src/main/java/top/penowl/quidproquo/rituals/HitRitual.java index d8c5810..00b7407 100644 --- a/src/main/java/top/penowl/quidproquo/rituals/HitRitual.java +++ b/src/main/java/top/penowl/quidproquo/rituals/HitRitual.java @@ -11,14 +11,16 @@ public class HitRitual extends Ritual { @Override public void setup() { addIngredient(Material.IRON_SWORD, 1); - addIngredient(Material.HAY_BLOCK, 1); + addIngredient(Material.IRON_INGOT, 1); + addIngredient(Material.WHEAT, 9); name = "shadow hit"; - health = 2; + health = 1; } @Override public void execute(Player caster, Player target, Location location) { - target.playSound(target.getLocation(), Sound.SUCCESSFUL_HIT, 1, 1); + target.playSound(target.getLocation(), Sound.HURT_FLESH, 1, 1); + //target.damage(1.0); } } diff --git a/src/main/java/top/penowl/quidproquo/rituals/LavaRitual.java b/src/main/java/top/penowl/quidproquo/rituals/LavaRitual.java index 9e2c6ef..624c30a 100644 --- a/src/main/java/top/penowl/quidproquo/rituals/LavaRitual.java +++ b/src/main/java/top/penowl/quidproquo/rituals/LavaRitual.java @@ -12,13 +12,13 @@ public class LavaRitual extends Ritual { addIngredient(Material.LAVA_BUCKET, 1); addIngredient(Material.DIAMOND, 1); addIngredient(Material.WHEAT, 64); - backfire = 0.50; + backfire = 0.10; name = "combustion"; } @Override public void execute(Player caster, Player target, Location location) { - target.setFireTicks(60); + target.setFireTicks(250); } } diff --git a/src/main/java/top/penowl/quidproquo/rituals/SnowmanRitual.java b/src/main/java/top/penowl/quidproquo/rituals/SnowmanRitual.java index 8597cb4..63a41ce 100644 --- a/src/main/java/top/penowl/quidproquo/rituals/SnowmanRitual.java +++ b/src/main/java/top/penowl/quidproquo/rituals/SnowmanRitual.java @@ -12,8 +12,9 @@ public class SnowmanRitual extends Ritual { @Override public void setup() { addIngredient(Material.STICK, 64); - addIngredient(Material.DIAMOND, 2); - addSacrifice(EntityType.SHEEP, 3); + addIngredient(Material.DIAMOND, 1); + addSacrifice(EntityType.SHEEP, 1); + addIngredient(Material.WHEAT, 32); health = 10; name = "snowing"; } From dcead186736d8eee3644bf207ba9d8ef2b3f0405 Mon Sep 17 00:00:00 2001 From: Edith Boles Date: Fri, 1 Oct 2021 17:56:55 -0700 Subject: [PATCH 2/3] Clean up warnings --- src/main/java/top/penowl/quidproquo/rituals/AnvilRitual.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/top/penowl/quidproquo/rituals/AnvilRitual.java b/src/main/java/top/penowl/quidproquo/rituals/AnvilRitual.java index 3f60ab5..92ac00a 100644 --- a/src/main/java/top/penowl/quidproquo/rituals/AnvilRitual.java +++ b/src/main/java/top/penowl/quidproquo/rituals/AnvilRitual.java @@ -7,6 +7,7 @@ import org.bukkit.entity.Player; import top.penowl.quidproquo.Ritual; +@SuppressWarnings("deprecation") public class AnvilRitual extends Ritual { @Override From 52c9c592ddf4469c3444a42b3a4a2a0239fa997a Mon Sep 17 00:00:00 2001 From: Edith Boles Date: Fri, 1 Oct 2021 18:17:37 -0700 Subject: [PATCH 3/3] Start adding commands --- .../java/top/penowl/quidproquo/Commands.java | 32 +++++++++++++++++++ .../top/penowl/quidproquo/QuidProQuo.java | 3 ++ 2 files changed, 35 insertions(+) create mode 100644 src/main/java/top/penowl/quidproquo/Commands.java diff --git a/src/main/java/top/penowl/quidproquo/Commands.java b/src/main/java/top/penowl/quidproquo/Commands.java new file mode 100644 index 0000000..15f12d5 --- /dev/null +++ b/src/main/java/top/penowl/quidproquo/Commands.java @@ -0,0 +1,32 @@ +package top.penowl.quidproquo; + +import java.util.HashMap; +import java.util.List; + +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; + +public class Commands implements CommandExecutor { + + HashMap recipes = new HashMap(); + + public Commands(List rituals) { + for (Ritual ritual : rituals) { + recipes.put(ritual.name.toUpperCase(), ritual); + } + } + + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if (args.length < 1) { + // display help + return true; + } else if (recipes.containsKey(args[0].toUpperCase())) { + // display recipe info + return true; + } + return false; + } + +} diff --git a/src/main/java/top/penowl/quidproquo/QuidProQuo.java b/src/main/java/top/penowl/quidproquo/QuidProQuo.java index 82c3cda..778a2e0 100644 --- a/src/main/java/top/penowl/quidproquo/QuidProQuo.java +++ b/src/main/java/top/penowl/quidproquo/QuidProQuo.java @@ -30,6 +30,9 @@ public class QuidProQuo extends JavaPlugin { getLogger().info("Loading rituals..."); getServer().getPluginManager().registerEvents(new Events(), this); + // register command handler + getCommand("ritual").setExecutor(new Commands(rituals)); + // register all rituals rituals.add(new HealRitual()); rituals.add(new WoolingRitual());