From a68178d0a8aa78edca97264513e8d14708f5fd0c Mon Sep 17 00:00:00 2001 From: yourfriendoss <81387799+yourfriendoss@users.noreply.github.com> Date: Mon, 17 Apr 2023 18:41:11 +0300 Subject: [PATCH] Start work on Phantom, write specification, fix sex. --- readme.md | 2 + src/main/java/lv/pi/animalrp/AnimalRP.java | 2 +- .../java/lv/pi/animalrp/animals/Phantom.java | 50 +++++++++++++++++++ .../lv/pi/animalrp/commands/SexCommand.java | 2 + .../lv/pi/animalrp/listeners/AntiElytra.java | 7 +++ 5 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 src/main/java/lv/pi/animalrp/animals/Phantom.java diff --git a/readme.md b/readme.md index 3267ab1..44c061d 100644 --- a/readme.md +++ b/readme.md @@ -7,6 +7,8 @@ Doubleclicking shift you will float (levitation 5 for 1 second), allowing for be You take significantly less damage when falling (5 hearts). You can still die, don't count on your cat-powers catching you every time. **Your superfood is all types of eatable fish.** 3. Fox You do more damage to mobs (25%). **Your superfood is all types of berry.** +4. Phantom +You can use elytras, however you burn in daylight and your elytra speed is capped at half of the normal one. **Your superfoods are all uncooked meats.** ## **Chat** Chat while you are a animal is very different. When you speak, your words will become furry-ified and every time you talk you'll have animal sounds come out of you. diff --git a/src/main/java/lv/pi/animalrp/AnimalRP.java b/src/main/java/lv/pi/animalrp/AnimalRP.java index 6429721..ce212aa 100644 --- a/src/main/java/lv/pi/animalrp/AnimalRP.java +++ b/src/main/java/lv/pi/animalrp/AnimalRP.java @@ -113,7 +113,7 @@ public class AnimalRP extends JavaPlugin { animals.put("cat", new Cat()); animals.put("fox", new Fox()); animals.put("bee", new Bee()); - + // animals.put("phantom", new Phantom()); // finish Phantom animals.forEach((z,b) -> { pm.registerEvents(b, this); }); diff --git a/src/main/java/lv/pi/animalrp/animals/Phantom.java b/src/main/java/lv/pi/animalrp/animals/Phantom.java new file mode 100644 index 0000000..24a630c --- /dev/null +++ b/src/main/java/lv/pi/animalrp/animals/Phantom.java @@ -0,0 +1,50 @@ +package lv.pi.animalrp.animals; + +import java.util.Random; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; + +import lv.pi.animalrp.util.Mood; +import lv.pi.animalrp.util.TextDestroyer; + +public class Phantom extends Animal { + TextDestroyer destroyer = new TextDestroyer(new String[]{ + "*shows wings*", + "*flap flap*", + "*screech*", + ":3" + }, new String[][]{ + {"you", "u"}, + {"o", "sho"}, + {"i", "ish"}, + {"!", "! "}, + {"?", "? "} + }); + Random rand = new Random(); + + public Phantom() { + super("phantom", "~screech~", "#FF8000"); + this.moodSounds.put(Mood.HAPPY, Sound.ENTITY_PHANTOM_FLAP); + this.moodSounds.put(Mood.CUTE, Sound.ENTITY_PHANTOM_SWOOP); + this.moodSounds.put(Mood.SAD, Sound.ENTITY_PHANTOM_SWOOP); + this.moodSounds.put(Mood.STRESSED, Sound.ENTITY_PHANTOM_HURT); + this.moodSounds.put(Mood.ANGRY, Sound.ENTITY_PHANTOM_BITE); + + this.superfoods.add(Material.CHICKEN); + this.superfoods.add(Material.BEEF); + this.superfoods.add(Material.PORKCHOP); + } + + @Override + public String chatTransformations(String message) { + return this.destroyer.destroy(message); + } + + @Override + public Location movementTransformations(Location location) { + return location; + } + +} \ No newline at end of file diff --git a/src/main/java/lv/pi/animalrp/commands/SexCommand.java b/src/main/java/lv/pi/animalrp/commands/SexCommand.java index 5532eb8..94087e2 100644 --- a/src/main/java/lv/pi/animalrp/commands/SexCommand.java +++ b/src/main/java/lv/pi/animalrp/commands/SexCommand.java @@ -58,9 +58,11 @@ class SexModel { asl.add(SexCommand.getVector(this.yaw, 0.2)); as.teleport(asl); } + if(this.sexTicks == 30) { player.sendMessage(AnimalRP.mm.deserialize("<#FFC0CB>I'm about to..")); } + if(this.sexTicks == 50) { player.sendMessage(AnimalRP.mm.deserialize("<#FFC0CB>cum!!")); player.getWorld().spawnParticle(Particle.END_ROD, player.getLocation(), 999, 0, 0, 0); diff --git a/src/main/java/lv/pi/animalrp/listeners/AntiElytra.java b/src/main/java/lv/pi/animalrp/listeners/AntiElytra.java index 33e4934..3720b5d 100644 --- a/src/main/java/lv/pi/animalrp/listeners/AntiElytra.java +++ b/src/main/java/lv/pi/animalrp/listeners/AntiElytra.java @@ -16,6 +16,7 @@ import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.scheduler.BukkitRunnable; import lv.pi.animalrp.AnimalRP; +import lv.pi.animalrp.animals.Animal; public class AntiElytra implements Listener { @@ -53,6 +54,12 @@ public class AntiElytra implements Listener { } private void dequipElytra(Player player) { + Animal animal = AnimalRP.users.get(player.getUniqueId()); + + if(animal != null) { + if(animal.name == "phantom") return; // phantom-ians can use elytra + } + PlayerInventory i = player.getInventory(); if (!( (i.getChestplate() != null) && i.getChestplate().getType().equals(Material.ELYTRA))) return; if(player.getGameMode() == GameMode.CREATIVE) return;