diff --git a/src/main/java/top/penowl/quidproquo/QuidProQuo.java b/src/main/java/top/penowl/quidproquo/QuidProQuo.java index 966f035..c8c57ca 100644 --- a/src/main/java/top/penowl/quidproquo/QuidProQuo.java +++ b/src/main/java/top/penowl/quidproquo/QuidProQuo.java @@ -31,28 +31,32 @@ public class QuidProQuo extends JavaPlugin { getServer().getPluginManager().registerEvents(new Events(), this); // register all rituals - rituals.add(new WoolingRitual()); - rituals.add(new FeedingRitual()); - rituals.add(new SnowmanRitual()); - rituals.add(new GetLuckyRitual()); rituals.add(new AnvilRitual()); - rituals.add(new FillerRitual()); - rituals.add(new LavaRitual()); - rituals.add(new HitRitual()); - rituals.add(new HerobrineRitual()); + rituals.add(new BatSpewRitual()); + rituals.add(new BlockShiftRitual()); rituals.add(new ChickenSpewRitual()); rituals.add(new ChugJugRitual()); rituals.add(new CreeperHissRitual()); - rituals.add(new RotateRitual()); - rituals.add(new HealRitual()); - rituals.add(new HardPenorRitual()); - rituals.add(new SoftPenorRitual()); - rituals.add(new QuicktimeRitual()); - rituals.add(new LightQuicktimeRitual()); - rituals.add(new WitherRitual()); - rituals.add(new DragonRitual()); rituals.add(new CrystalizationRtiual()); - rituals.add(new BatSpewRitual()); + rituals.add(new DragonRitual()); + rituals.add(new FakePlayerRitual()); + rituals.add(new FeedingRitual()); + rituals.add(new FillerRitual()); + rituals.add(new GetLuckyRitual()); + rituals.add(new HardPenorRitual()); + rituals.add(new HealRitual()); + rituals.add(new HerobrineRitual()); + rituals.add(new HitRitual()); + rituals.add(new LavaRitual()); + rituals.add(new LightningRitual()); + rituals.add(new LightQuicktimeRitual()); + rituals.add(new QuicktimeRitual()); + rituals.add(new RotateRitual()); + rituals.add(new SnowmanRitual()); + rituals.add(new SoftPenorRitual()); + rituals.add(new SoundRitual()); + rituals.add(new WitherRitual()); + rituals.add(new WoolingRitual()); // run ritual setup scripts for (Ritual ritual : rituals) { @@ -76,4 +80,4 @@ public class QuidProQuo extends JavaPlugin { } -} \ No newline at end of file +} diff --git a/src/main/java/top/penowl/quidproquo/rituals/AnvilRitual.java b/src/main/java/top/penowl/quidproquo/rituals/AnvilRitual.java index 92ac00a..badc2a1 100644 --- a/src/main/java/top/penowl/quidproquo/rituals/AnvilRitual.java +++ b/src/main/java/top/penowl/quidproquo/rituals/AnvilRitual.java @@ -23,7 +23,7 @@ public class AnvilRitual extends Ritual { @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); + FallingBlock block = target.getWorld().spawnFallingBlock(target.getLocation().clone().add(0, 20, 0), Material.ANVIL, (byte) 0); block.setHurtEntities(true); } diff --git a/src/main/java/top/penowl/quidproquo/rituals/BatSpewRitual.java b/src/main/java/top/penowl/quidproquo/rituals/BatSpewRitual.java index 18982d2..542d8a2 100644 --- a/src/main/java/top/penowl/quidproquo/rituals/BatSpewRitual.java +++ b/src/main/java/top/penowl/quidproquo/rituals/BatSpewRitual.java @@ -14,7 +14,6 @@ public class BatSpewRitual extends Ritual { addIngredient(Material.WHEAT, 64); addIngredient(Material.IRON_PICKAXE, 1); addSacrifice(EntityType.CHICKEN, 1); - health = 4; name = "bat spew"; backfire = 0.1; } @@ -22,7 +21,7 @@ public class BatSpewRitual extends Ritual { @Override public void execute(Player caster, Player target, Location location) { for (int i = 0; i < 20; i++) { - target.getLocation().getWorld().spawnEntity(target.getLocation(), EntityType.CHICKEN); + target.getWorld().spawnEntity(target.getLocation(), EntityType.CHICKEN); } } diff --git a/src/main/java/top/penowl/quidproquo/rituals/BlockShiftRitual.java b/src/main/java/top/penowl/quidproquo/rituals/BlockShiftRitual.java new file mode 100644 index 0000000..28199e8 --- /dev/null +++ b/src/main/java/top/penowl/quidproquo/rituals/BlockShiftRitual.java @@ -0,0 +1,56 @@ +package top.penowl.quidproquo.rituals; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import java.util.Random; + +import top.penowl.quidproquo.Ritual; + +public class BlockShiftRitual extends Ritual { + //possible mats + private static final Material[] pMat = { + Material.STONE, Material.GRASS, Material.DIRT, Material.COBBLESTONE, Material.WOOD, + Material.WATER, Material.LAVA, Material.SAND, Material.GRAVEL, Material.GOLD_ORE, + Material.IRON_ORE, Material.COAL_ORE, Material.LOG, Material.LEAVES, Material.SPONGE, + Material.GLASS, Material.LAPIS_ORE, Material.LAPIS_BLOCK, Material.SANDSTONE, + Material.WEB, Material.WOOL, Material.GOLD_BLOCK, Material.IRON_BLOCK, Material.BRICK, + Material.TNT, Material.BOOKSHELF, Material.MOSSY_COBBLESTONE, Material.OBSIDIAN, + Material.DIAMOND_ORE, Material.DIAMOND_BLOCK, Material.REDSTONE_ORE, Material.ICE, + Material.SNOW_BLOCK, Material.CLAY, Material.PUMPKIN, Material.NETHERRACK, + Material.SOUL_SAND, Material.GLOWSTONE, Material.JACK_O_LANTERN, Material.STAINED_GLASS, + Material.MONSTER_EGG, Material.SMOOTH_BRICK, Material.HUGE_MUSHROOM_1, + Material.HUGE_MUSHROOM_2, Material.MELON_BLOCK, Material.MYCEL, Material.NETHER_BRICK, + Material.ENDER_STONE, Material.EMERALD_ORE, Material.EMERALD_BLOCK, Material.REDSTONE_BLOCK, + Material.QUARTZ_ORE, Material.QUARTZ_BLOCK, Material.STAINED_CLAY, Material.LEAVES, + Material.LOG, Material.SLIME_BLOCK, Material.PRISMARINE, Material.SEA_LANTERN, + Material.HAY_BLOCK, Material.CLAY_BRICK, Material.COAL_BLOCK, Material.PACKED_ICE, + Material.RED_SANDSTONE + }; + @Override + public void setup() { + addIngredient(Material.RED_MUSHROOM, 32); + addIngredient(Material.BROWN_MUSHROOM, 32); + addIngredient(Material.WHEAT, 32); + addIngredient(Material.ENDER_PEARL, 4); + name = "block shift"; + } + + @Override + public void execute(Player caster, Player target, Location location) { + Random random = new Random(); + Material fromMat = pMat[random.nextInt(64)]; + Material toMat = pMat[random.nextInt(64)]; + for(int x = -5; x <= 5; x ++) { + for(int y = -5; y <= 5; y ++) { + for(int z = -5; z <= 5; z ++) { + Block testBlock = target.getLocation().getBlock().getRelative(x, y, z); + if(testBlock.getType() == fromMat) + testBlock.setType(toMat); + } + } + } + } + +} diff --git a/src/main/java/top/penowl/quidproquo/rituals/ChickenSpewRitual.java b/src/main/java/top/penowl/quidproquo/rituals/ChickenSpewRitual.java index 7625c76..6025a80 100644 --- a/src/main/java/top/penowl/quidproquo/rituals/ChickenSpewRitual.java +++ b/src/main/java/top/penowl/quidproquo/rituals/ChickenSpewRitual.java @@ -21,7 +21,7 @@ public class ChickenSpewRitual extends Ritual { @Override public void execute(Player caster, Player target, Location location) { for (int i = 0; i < 20; i++) { - target.getLocation().getWorld().spawnEntity(target.getLocation(), EntityType.CHICKEN); + target.getWorld().spawnEntity(target.getLocation(), EntityType.CHICKEN); } } diff --git a/src/main/java/top/penowl/quidproquo/rituals/CrystalizationRtiual.java b/src/main/java/top/penowl/quidproquo/rituals/CrystalizationRtiual.java index afbeb08..224d955 100644 --- a/src/main/java/top/penowl/quidproquo/rituals/CrystalizationRtiual.java +++ b/src/main/java/top/penowl/quidproquo/rituals/CrystalizationRtiual.java @@ -2,10 +2,8 @@ package top.penowl.quidproquo.rituals; import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.entity.EnderCrystal; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; import top.penowl.quidproquo.Ritual; diff --git a/src/main/java/top/penowl/quidproquo/rituals/DragonRitual.java b/src/main/java/top/penowl/quidproquo/rituals/DragonRitual.java index bef9218..4c9c2f7 100644 --- a/src/main/java/top/penowl/quidproquo/rituals/DragonRitual.java +++ b/src/main/java/top/penowl/quidproquo/rituals/DragonRitual.java @@ -1,7 +1,5 @@ package top.penowl.quidproquo.rituals; -import java.util.WeakHashMap; - import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.EntityType; diff --git a/src/main/java/top/penowl/quidproquo/rituals/FakePlayerRitual.java b/src/main/java/top/penowl/quidproquo/rituals/FakePlayerRitual.java new file mode 100644 index 0000000..6291bb5 --- /dev/null +++ b/src/main/java/top/penowl/quidproquo/rituals/FakePlayerRitual.java @@ -0,0 +1,44 @@ +package top.penowl.quidproquo.rituals; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Slime; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +import java.util.Random; + +import top.penowl.quidproquo.Ritual; + +public class FakePlayerRitual extends Ritual { + + @Override + public void setup() { + addIngredient(Material.WHEAT, 32); + addIngredient(Material.LEAVES, 32); + name = "player illusion"; + } + + @Override + public void execute(Player caster, Player target, Location location) { + Location loc = target.getLocation(); + Random random = new Random(); + int x = random.nextInt(51) - 25; + int y = random.nextInt(51) - 25; + int z = random.nextInt(51) - 25; + Entity fakePlayer = target.getWorld().spawnEntity(loc.clone().add(x, y, z), EntityType.SLIME); + fakePlayer.setCustomName(caster.getName()); + LivingEntity fp_livingEntity = (LivingEntity)fakePlayer; + fp_livingEntity.setMaxHealth(100.0); + fp_livingEntity.setHealth(100.0); + fp_livingEntity.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 200, 100)); + fp_livingEntity.addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 200, 1)); + Slime fpSlime = (Slime)fp_livingEntity; + fpSlime.setSize(1); + } + +} diff --git a/src/main/java/top/penowl/quidproquo/rituals/HardPenorRitual.java b/src/main/java/top/penowl/quidproquo/rituals/HardPenorRitual.java index 2ec62b5..2ecb63b 100644 --- a/src/main/java/top/penowl/quidproquo/rituals/HardPenorRitual.java +++ b/src/main/java/top/penowl/quidproquo/rituals/HardPenorRitual.java @@ -19,7 +19,7 @@ public class HardPenorRitual extends Ritual { @Override public void execute(Player caster, Player target, Location location) { - Block shaft = target.getLocation().getBlock(); + Block shaft = caster.getLocation().getBlock(); Block ball1 = shaft.getRelative(2, -1, 0); Block ball2 = shaft.getRelative(-2,-1,0); //TODO USE ELEGANT MATHEMATICS INSTEAD OF SCUFFED IF STATEMENTS diff --git a/src/main/java/top/penowl/quidproquo/rituals/LightQuicktimeRitual.java b/src/main/java/top/penowl/quidproquo/rituals/LightQuicktimeRitual.java index 4b1cef1..3edd6f5 100644 --- a/src/main/java/top/penowl/quidproquo/rituals/LightQuicktimeRitual.java +++ b/src/main/java/top/penowl/quidproquo/rituals/LightQuicktimeRitual.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 org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffect; diff --git a/src/main/java/top/penowl/quidproquo/rituals/LightningRitual.java b/src/main/java/top/penowl/quidproquo/rituals/LightningRitual.java new file mode 100644 index 0000000..69ed6f3 --- /dev/null +++ b/src/main/java/top/penowl/quidproquo/rituals/LightningRitual.java @@ -0,0 +1,31 @@ +package top.penowl.quidproquo.rituals; + +import java.util.List; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.World; +import org.bukkit.entity.Player; + +import top.penowl.quidproquo.Ritual; + +public class LightningRitual extends Ritual { + + @Override + public void setup() { + addIngredient(Material.WHEAT, 64); + addIngredient(Material.GLOWSTONE, 64); + name = "lightning location"; + } + + @Override + public void execute(Player caster, Player target, Location location) { + // Does this actually get the overworld? + World world = location.getWorld(); + List players = world.getPlayers(); + for(Player player : players) { + world.strikeLightningEffect(player.getLocation().clone().add(0, 1, 0)); + } + } + +} diff --git a/src/main/java/top/penowl/quidproquo/rituals/WoolingRitual.java b/src/main/java/top/penowl/quidproquo/rituals/WoolingRitual.java index 6c31022..0712215 100644 --- a/src/main/java/top/penowl/quidproquo/rituals/WoolingRitual.java +++ b/src/main/java/top/penowl/quidproquo/rituals/WoolingRitual.java @@ -21,7 +21,6 @@ public class WoolingRitual extends Ritual { @Override public void execute(Player caster, Player target, Location location) { - caster.setHealth(Math.min(caster.getMaxHealth(), caster.getHealth()+2.0)); } }