diff --git a/.gitignore b/.gitignore index 1b6985c..5dc6f0f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,4 @@ .gradle # Ignore Gradle build output directory -build +build \ No newline at end of file diff --git a/animalrp-common/bin/main/messages.json b/animalrp-common/bin/main/messages.json deleted file mode 100644 index 94d455b..0000000 --- a/animalrp-common/bin/main/messages.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "no_chat_command_enabled": "AnimalRP's chat modifications are now enabled for you.", - "no_chat_command_disabled": "AnimalRP's chat modifications are now disabled for you.", - "animal_not_set": "You do not have a animal set.", - "animal_removed": "You no longer have a animal set.", - "animal_set": "You are now an %s! ", - "your_options": "Your options are: ", - "invalid_animal": "Invalid animal!", - "tf_off": "Use /tf off to disable the changes.", - "only_animals": "Only animals can interact with other animals :(", - "no_console": "I'm sorry console.", - "no_self_argument": "You can't %1 yourself.", - "not_animal": "%1 is not an animal :(" -} \ No newline at end of file diff --git a/animalrp-common/bin/main/ovh/sad/animalrp/common/AnimalRP.class b/animalrp-common/bin/main/ovh/sad/animalrp/common/AnimalRP.class deleted file mode 100644 index 064246d..0000000 Binary files a/animalrp-common/bin/main/ovh/sad/animalrp/common/AnimalRP.class and /dev/null differ diff --git a/animalrp-common/bin/main/ovh/sad/animalrp/common/util/Animal.class b/animalrp-common/bin/main/ovh/sad/animalrp/common/util/Animal.class deleted file mode 100644 index 3952885..0000000 Binary files a/animalrp-common/bin/main/ovh/sad/animalrp/common/util/Animal.class and /dev/null differ diff --git a/animalrp-common/bin/main/ovh/sad/animalrp/common/util/Cooldown.class b/animalrp-common/bin/main/ovh/sad/animalrp/common/util/Cooldown.class deleted file mode 100644 index 2d63c8d..0000000 Binary files a/animalrp-common/bin/main/ovh/sad/animalrp/common/util/Cooldown.class and /dev/null differ diff --git a/animalrp-common/bin/main/ovh/sad/animalrp/common/util/HashmapStore.class b/animalrp-common/bin/main/ovh/sad/animalrp/common/util/HashmapStore.class deleted file mode 100644 index c186cb3..0000000 Binary files a/animalrp-common/bin/main/ovh/sad/animalrp/common/util/HashmapStore.class and /dev/null differ diff --git a/animalrp-common/bin/main/ovh/sad/animalrp/common/util/Messages.class b/animalrp-common/bin/main/ovh/sad/animalrp/common/util/Messages.class deleted file mode 100644 index b41a0ad..0000000 Binary files a/animalrp-common/bin/main/ovh/sad/animalrp/common/util/Messages.class and /dev/null differ diff --git a/animalrp-common/bin/main/ovh/sad/animalrp/common/util/Mood.class b/animalrp-common/bin/main/ovh/sad/animalrp/common/util/Mood.class deleted file mode 100644 index aafac6f..0000000 Binary files a/animalrp-common/bin/main/ovh/sad/animalrp/common/util/Mood.class and /dev/null differ diff --git a/animalrp-common/bin/main/ovh/sad/animalrp/common/util/TextDestroyer.class b/animalrp-common/bin/main/ovh/sad/animalrp/common/util/TextDestroyer.class deleted file mode 100644 index 1de041e..0000000 Binary files a/animalrp-common/bin/main/ovh/sad/animalrp/common/util/TextDestroyer.class and /dev/null differ diff --git a/animalrp-common/src/main/java/ovh/sad/animalrp/common/AnimalRP.java b/animalrp-common/src/main/java/ovh/sad/animalrp/common/AnimalRP.java index 9eba700..93b457a 100644 --- a/animalrp-common/src/main/java/ovh/sad/animalrp/common/AnimalRP.java +++ b/animalrp-common/src/main/java/ovh/sad/animalrp/common/AnimalRP.java @@ -4,7 +4,6 @@ import java.util.HashMap; import java.util.UUID; import ovh.sad.animalrp.common.util.Animal; -import ovh.sad.animalrp.common.util.HashmapStore; public interface AnimalRP { public static final String MOD_ID = "animal-rp"; @@ -23,7 +22,7 @@ public interface AnimalRP { furry animal mod by fucksophie rewritten for paper & fabric on October 5th - + development restarted November 29th """; diff --git a/animalrp-common/src/main/resources/messages.json b/animalrp-common/src/main/resources/messages.json index 94d455b..4ea2be8 100644 --- a/animalrp-common/src/main/resources/messages.json +++ b/animalrp-common/src/main/resources/messages.json @@ -10,5 +10,20 @@ "only_animals": "Only animals can interact with other animals :(", "no_console": "I'm sorry console.", "no_self_argument": "You can't %1 yourself.", - "not_animal": "%1 is not an animal :(" + "not_animal": "%1 is not an animal :(", + "include_user": "Include a user!", + "no_player_found": "I can't find this player :(", + + "headpats_to_target": "%s petted you! %s", + "headpats_to_self": "You petted %s! %s", + "kiss_to_target": "%s kissed you.. 0////0 %s", + "kiss_to_self": "You kissed %s.. 0////0 %s", + "bite_to_target": "%s bit you!! Σ(っ゚Д゚)っ %s", + "bite_to_self": "You bit %s! (○`д´)ノシ %s", + "scratch_to_target": "%s SCRATCHES YOU! Ow! %s", + "scratch_to_self": "You channel your inner evil, and scratch %s! %s", + "hug_to_target": "%s hugs you! How heartwarming. %s", + "hug_to_self": "You hug %s! How heartwarming. %s", + "cuddle_to_target": "%s cuddles with you. %s", + "cuddle_to_self": "You and %s start cuddling. How cute! %s" } \ No newline at end of file diff --git a/animalrp-fabric/bin/main/animalrp.mixins.json b/animalrp-fabric/bin/main/animalrp.mixins.json deleted file mode 100644 index a69c5d3..0000000 --- a/animalrp-fabric/bin/main/animalrp.mixins.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "required": true, - "package": "ovh.sad.animalrp.fabric.mixin", - "compatibilityLevel": "JAVA_21", - "server": [ - "DecoratedMessage", - "FoodEating", - "Sneaking" - ], - "injectors": { - "defaultRequire": 1 - } -} \ No newline at end of file diff --git a/animalrp-fabric/bin/main/fabric.mod.json b/animalrp-fabric/bin/main/fabric.mod.json deleted file mode 100644 index 7c2e952..0000000 --- a/animalrp-fabric/bin/main/fabric.mod.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "schemaVersion": 1, - "id": "animalrp", - "version": "${version}", - "name": "AnimalRP", - "description": "AnimalRP, an plugin for furry minecraft servers that mangles your text, adds specific types of animals that have different improvements and more!", - "authors": [ - "@fucksophie" - ], - "contact": { - "homepage": "https://sad.ovh", - "sources": "https://git.sad.ovh/sophie/animalrp2" - }, - "license": "CC0-1.0", - "icon": "assets/animal-rp/icon.png", - "environment": "*", - "entrypoints": { - "server": [ - "ovh.sad.animalrp.fabric.AnimalRPFabric" - ] - }, - "mixins": [ - "animal-rp.mixins.json" - ], - "depends": { - "fabricloader": ">=0.16.4", - "minecraft": "~1.21.1", - "java": ">=21", - "fabric-api": "*", - "placeholder-api": "*" - } -} \ No newline at end of file diff --git a/animalrp-fabric/bin/main/ovh/sad/animalrp/fabric/AnimalRPFabric$1.class b/animalrp-fabric/bin/main/ovh/sad/animalrp/fabric/AnimalRPFabric$1.class deleted file mode 100644 index a4f4fe9..0000000 Binary files a/animalrp-fabric/bin/main/ovh/sad/animalrp/fabric/AnimalRPFabric$1.class and /dev/null differ diff --git a/animalrp-fabric/bin/main/ovh/sad/animalrp/fabric/AnimalRPFabric.class b/animalrp-fabric/bin/main/ovh/sad/animalrp/fabric/AnimalRPFabric.class deleted file mode 100644 index e847a88..0000000 Binary files a/animalrp-fabric/bin/main/ovh/sad/animalrp/fabric/AnimalRPFabric.class and /dev/null differ diff --git a/animalrp-fabric/bin/main/ovh/sad/animalrp/fabric/animals/Bee$1.class b/animalrp-fabric/bin/main/ovh/sad/animalrp/fabric/animals/Bee$1.class deleted file mode 100644 index 7f77854..0000000 Binary files a/animalrp-fabric/bin/main/ovh/sad/animalrp/fabric/animals/Bee$1.class and /dev/null differ diff --git a/animalrp-fabric/bin/main/ovh/sad/animalrp/fabric/animals/Bee$Row.class b/animalrp-fabric/bin/main/ovh/sad/animalrp/fabric/animals/Bee$Row.class deleted file mode 100644 index f28dd74..0000000 Binary files a/animalrp-fabric/bin/main/ovh/sad/animalrp/fabric/animals/Bee$Row.class and /dev/null differ diff --git a/animalrp-fabric/bin/main/ovh/sad/animalrp/fabric/animals/Bee.class b/animalrp-fabric/bin/main/ovh/sad/animalrp/fabric/animals/Bee.class deleted file mode 100644 index 5f57255..0000000 Binary files a/animalrp-fabric/bin/main/ovh/sad/animalrp/fabric/animals/Bee.class and /dev/null differ diff --git a/animalrp-fabric/bin/main/ovh/sad/animalrp/fabric/animals/Cat.class b/animalrp-fabric/bin/main/ovh/sad/animalrp/fabric/animals/Cat.class deleted file mode 100644 index 0b6da51..0000000 Binary files a/animalrp-fabric/bin/main/ovh/sad/animalrp/fabric/animals/Cat.class and /dev/null differ diff --git a/animalrp-fabric/bin/main/ovh/sad/animalrp/fabric/animals/Dog.class b/animalrp-fabric/bin/main/ovh/sad/animalrp/fabric/animals/Dog.class deleted file mode 100644 index 4053d74..0000000 Binary files a/animalrp-fabric/bin/main/ovh/sad/animalrp/fabric/animals/Dog.class and /dev/null differ diff --git a/animalrp-fabric/bin/main/ovh/sad/animalrp/fabric/animals/Fox.class b/animalrp-fabric/bin/main/ovh/sad/animalrp/fabric/animals/Fox.class deleted file mode 100644 index 213d7a6..0000000 Binary files a/animalrp-fabric/bin/main/ovh/sad/animalrp/fabric/animals/Fox.class and /dev/null differ diff --git a/animalrp-fabric/bin/main/ovh/sad/animalrp/fabric/commands/InteractionCommand.class b/animalrp-fabric/bin/main/ovh/sad/animalrp/fabric/commands/InteractionCommand.class deleted file mode 100644 index 7d64ddc..0000000 Binary files a/animalrp-fabric/bin/main/ovh/sad/animalrp/fabric/commands/InteractionCommand.class and /dev/null differ diff --git a/animalrp-fabric/bin/main/ovh/sad/animalrp/fabric/commands/NoChatCommand.class b/animalrp-fabric/bin/main/ovh/sad/animalrp/fabric/commands/NoChatCommand.class deleted file mode 100644 index 3d6a22e..0000000 Binary files a/animalrp-fabric/bin/main/ovh/sad/animalrp/fabric/commands/NoChatCommand.class and /dev/null differ diff --git a/animalrp-fabric/bin/main/ovh/sad/animalrp/fabric/commands/TfCommand.class b/animalrp-fabric/bin/main/ovh/sad/animalrp/fabric/commands/TfCommand.class deleted file mode 100644 index ade3599..0000000 Binary files a/animalrp-fabric/bin/main/ovh/sad/animalrp/fabric/commands/TfCommand.class and /dev/null differ diff --git a/animalrp-fabric/bin/main/ovh/sad/animalrp/fabric/mixin/DecoratedMessage.class b/animalrp-fabric/bin/main/ovh/sad/animalrp/fabric/mixin/DecoratedMessage.class deleted file mode 100644 index 7a87662..0000000 Binary files a/animalrp-fabric/bin/main/ovh/sad/animalrp/fabric/mixin/DecoratedMessage.class and /dev/null differ diff --git a/animalrp-fabric/bin/main/ovh/sad/animalrp/fabric/mixin/FoodEating.class b/animalrp-fabric/bin/main/ovh/sad/animalrp/fabric/mixin/FoodEating.class deleted file mode 100644 index e6abfd9..0000000 Binary files a/animalrp-fabric/bin/main/ovh/sad/animalrp/fabric/mixin/FoodEating.class and /dev/null differ diff --git a/animalrp-fabric/bin/main/ovh/sad/animalrp/fabric/mixin/Sneaking.class b/animalrp-fabric/bin/main/ovh/sad/animalrp/fabric/mixin/Sneaking.class deleted file mode 100644 index 11492a2..0000000 Binary files a/animalrp-fabric/bin/main/ovh/sad/animalrp/fabric/mixin/Sneaking.class and /dev/null differ diff --git a/animalrp-fabric/src/main/java/ovh/sad/animalrp/fabric/AnimalRPFabric.java b/animalrp-fabric/src/main/java/ovh/sad/animalrp/fabric/AnimalRPFabric.java index cd60208..0615c86 100644 --- a/animalrp-fabric/src/main/java/ovh/sad/animalrp/fabric/AnimalRPFabric.java +++ b/animalrp-fabric/src/main/java/ovh/sad/animalrp/fabric/AnimalRPFabric.java @@ -13,15 +13,21 @@ import eu.pb4.placeholders.api.PlaceholderHandler; import eu.pb4.placeholders.api.PlaceholderResult; import eu.pb4.placeholders.api.Placeholders; import net.fabricmc.api.ModInitializer; +import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback; import net.fabricmc.loader.api.FabricLoader; import net.minecraft.util.Identifier; import ovh.sad.animalrp.common.AnimalRP; import ovh.sad.animalrp.common.util.Animal; import ovh.sad.animalrp.common.util.HashmapStore; +import ovh.sad.animalrp.common.util.Messages; +import ovh.sad.animalrp.common.util.Mood; import ovh.sad.animalrp.fabric.animals.Bee; import ovh.sad.animalrp.fabric.animals.Cat; import ovh.sad.animalrp.fabric.animals.Dog; import ovh.sad.animalrp.fabric.animals.Fox; +import ovh.sad.animalrp.fabric.commands.InteractionCommand; +import ovh.sad.animalrp.fabric.commands.NoChatCommand; +import ovh.sad.animalrp.fabric.commands.TfCommand; public class AnimalRPFabric implements ModInitializer, AnimalRP { public static ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor(); @@ -60,5 +66,50 @@ public class AnimalRPFabric implements ModInitializer, AnimalRP { return PlaceholderResult.value(animal.color); } }); + CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> { + (new TfCommand()).Command(dispatcher, registryAccess, environment); + (new NoChatCommand()).Command(dispatcher, registryAccess, environment); + new InteractionCommand( + "headpats", + Mood.HAPPY, + Messages.get("headpats_to_target"), + Messages.get("headpats_to_self") + ).Command(dispatcher, registryAccess, environment); + + new InteractionCommand( + "kiss", + Mood.CUTE, + Messages.get("kiss_to_target"), + Messages.get("kiss_to_self") + ).Command(dispatcher, registryAccess, environment); + + new InteractionCommand( + "bite", + Mood.ANGRY, + Messages.get("bite_to_target"), + Messages.get("bite_to_self") + ).Command(dispatcher, registryAccess, environment); + + new InteractionCommand( + "scratch", + Mood.ANGRY, + Messages.get("scratch_to_target"), + Messages.get("scratch_to_self") + ).Command(dispatcher, registryAccess, environment); + + new InteractionCommand( + "hug", + Mood.HAPPY, + Messages.get("hug_to_target"), + Messages.get("hug_to_self") + ).Command(dispatcher, registryAccess, environment); + + new InteractionCommand( + "cuddle", + Mood.CUTE, + Messages.get("cuddle_to_target"), + Messages.get("cuddle_to_self") + ).Command(dispatcher, registryAccess, environment); + }); } } diff --git a/animalrp-paper/bin/main/ovh/sad/animalrp/paper/AnimalRPPaper.class b/animalrp-paper/bin/main/ovh/sad/animalrp/paper/AnimalRPPaper.class deleted file mode 100644 index d7c0690..0000000 Binary files a/animalrp-paper/bin/main/ovh/sad/animalrp/paper/AnimalRPPaper.class and /dev/null differ diff --git a/animalrp-paper/bin/main/ovh/sad/animalrp/paper/animals/Bee$1.class b/animalrp-paper/bin/main/ovh/sad/animalrp/paper/animals/Bee$1.class deleted file mode 100644 index ab64ed4..0000000 Binary files a/animalrp-paper/bin/main/ovh/sad/animalrp/paper/animals/Bee$1.class and /dev/null differ diff --git a/animalrp-paper/bin/main/ovh/sad/animalrp/paper/animals/Bee$Row.class b/animalrp-paper/bin/main/ovh/sad/animalrp/paper/animals/Bee$Row.class deleted file mode 100644 index 49b4830..0000000 Binary files a/animalrp-paper/bin/main/ovh/sad/animalrp/paper/animals/Bee$Row.class and /dev/null differ diff --git a/animalrp-paper/bin/main/ovh/sad/animalrp/paper/animals/Bee.class b/animalrp-paper/bin/main/ovh/sad/animalrp/paper/animals/Bee.class deleted file mode 100644 index 8d2c38b..0000000 Binary files a/animalrp-paper/bin/main/ovh/sad/animalrp/paper/animals/Bee.class and /dev/null differ diff --git a/animalrp-paper/bin/main/ovh/sad/animalrp/paper/animals/Cat.class b/animalrp-paper/bin/main/ovh/sad/animalrp/paper/animals/Cat.class deleted file mode 100644 index 98b7674..0000000 Binary files a/animalrp-paper/bin/main/ovh/sad/animalrp/paper/animals/Cat.class and /dev/null differ diff --git a/animalrp-paper/bin/main/ovh/sad/animalrp/paper/animals/Dog.class b/animalrp-paper/bin/main/ovh/sad/animalrp/paper/animals/Dog.class deleted file mode 100644 index a2a2825..0000000 Binary files a/animalrp-paper/bin/main/ovh/sad/animalrp/paper/animals/Dog.class and /dev/null differ diff --git a/animalrp-paper/bin/main/ovh/sad/animalrp/paper/animals/Fox.class b/animalrp-paper/bin/main/ovh/sad/animalrp/paper/animals/Fox.class deleted file mode 100644 index 8334734..0000000 Binary files a/animalrp-paper/bin/main/ovh/sad/animalrp/paper/animals/Fox.class and /dev/null differ diff --git a/animalrp-paper/bin/main/ovh/sad/animalrp/paper/listeners/PlayerChat.class b/animalrp-paper/bin/main/ovh/sad/animalrp/paper/listeners/PlayerChat.class deleted file mode 100644 index 46837ee..0000000 Binary files a/animalrp-paper/bin/main/ovh/sad/animalrp/paper/listeners/PlayerChat.class and /dev/null differ diff --git a/animalrp-paper/src/main/java/ovh/sad/animalrp/paper/AnimalRPPaper.java b/animalrp-paper/src/main/java/ovh/sad/animalrp/paper/AnimalRPPaper.java index 1c4359b..d55cf28 100644 --- a/animalrp-paper/src/main/java/ovh/sad/animalrp/paper/AnimalRPPaper.java +++ b/animalrp-paper/src/main/java/ovh/sad/animalrp/paper/AnimalRPPaper.java @@ -5,11 +5,15 @@ import java.util.logging.Level; import org.bukkit.plugin.java.JavaPlugin; +import net.kyori.adventure.text.minimessage.MiniMessage; import ovh.sad.animalrp.common.AnimalRP; import ovh.sad.animalrp.common.util.HashmapStore; +import ovh.sad.animalrp.common.util.Messages; +import ovh.sad.animalrp.common.util.Mood; +import ovh.sad.animalrp.paper.commands.InteractionCommand; public class AnimalRPPaper extends JavaPlugin implements AnimalRP { - + public static MiniMessage mm = MiniMessage.miniMessage(); public static HashmapStore hashmapStore; @Override @@ -23,6 +27,26 @@ public class AnimalRPPaper extends JavaPlugin implements AnimalRP { hashmapStore.get("nochat.json").forEach((k, v) -> { noChat.put(UUID.fromString(k), Boolean.valueOf(v)); }); + + getCommand("headpats").setExecutor(new InteractionCommand( + Mood.HAPPY, Messages.get("headpats_to_target"), Messages.get("headpats_to_self"))); + + getCommand("kiss").setExecutor(new InteractionCommand( + Mood.CUTE, Messages.get("kiss_to_target"), Messages.get("kiss_to_self"))); + + getCommand("bite").setExecutor(new InteractionCommand( + Mood.ANGRY, Messages.get("bite_to_target"), Messages.get("bite_to_self"))); + + getCommand("scratch").setExecutor(new InteractionCommand( + Mood.ANGRY, Messages.get("scratch_to_target"), Messages.get("scratch_to_self"))); + + /* Contributed by Simo__28 */ + getCommand("hug").setExecutor(new InteractionCommand( + Mood.HAPPY, Messages.get("hug_to_target"), Messages.get("hug_to_self"))); + + getCommand("cuddle").setExecutor(new InteractionCommand( + Mood.CUTE, Messages.get("cuddle_to_target"), Messages.get("cuddle_to_self"))); + /* */ } @Override diff --git a/animalrp-paper/src/main/java/ovh/sad/animalrp/paper/commands/InteractionCommand.java b/animalrp-paper/src/main/java/ovh/sad/animalrp/paper/commands/InteractionCommand.java new file mode 100644 index 0000000..bd05926 --- /dev/null +++ b/animalrp-paper/src/main/java/ovh/sad/animalrp/paper/commands/InteractionCommand.java @@ -0,0 +1,75 @@ +package ovh.sad.animalrp.paper.commands; + +import org.bukkit.command.CommandExecutor; + +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import ovh.sad.animalrp.common.util.Animal; +import ovh.sad.animalrp.common.util.Messages; +import ovh.sad.animalrp.common.util.Mood; +import ovh.sad.animalrp.paper.AnimalRPPaper; + +public class InteractionCommand implements CommandExecutor { + String toThem; + String toYou; + Mood mood; + + public InteractionCommand(Mood mood, String toThem, String toYou) { + this.toThem = toThem; + this.toYou = toYou; + this.mood = mood; + } + + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if(!(sender instanceof Player)) { + sender.sendMessage(AnimalRPPaper.mm.deserialize("I'm sorry console. :(")); + return true; + } + + Player player = (Player)sender; + + @SuppressWarnings("unchecked") + Animal aplayer = (Animal) AnimalRPPaper.users.get(player.getUniqueId()); + + if(aplayer == null) { + player.sendMessage(AnimalRPPaper.mm.deserialize("" + Messages.get("only_animals"))); + return true; + } + + if(args.length == 0) { + player.sendMessage(AnimalRPPaper.mm.deserialize("" + Messages.get("include_user"))); + return true; + } + + Player splayer = Bukkit.getPlayer(args[0]); + + if(splayer == null) { + player.sendMessage(AnimalRPPaper.mm.deserialize("" + Messages.get("no_player_found"))); + return true; + } + + if(splayer.getName() == player.getName()) { + player.sendMessage(AnimalRPPaper.mm.deserialize("" + String.format(Messages.get("no_self_argument"), command))); + return true; + } + + @SuppressWarnings("unchecked") + Animal asplayer = (Animal) AnimalRPPaper.users.get(splayer.getUniqueId()); + + if(asplayer == null) { + player.sendMessage(AnimalRPPaper.mm.deserialize(""+String.format(Messages.get("not_animal"), splayer.getName()))); + return true; + } + + splayer.sendMessage(AnimalRPPaper.mm.deserialize(String.format(this.toThem, ""+player.getName()+"", ""+aplayer.catchphrase+""))); + player.sendMessage(AnimalRPPaper.mm.deserialize(String.format(this.toYou, ""+splayer.getName()+"", ""+asplayer.catchphrase+""))); + player.getWorld().playSound(splayer.getLocation(), asplayer.moodSounds.get(this.mood), 1F, 1); + return true; + } +} \ No newline at end of file diff --git a/animalrp-paper/src/main/java/ovh/sad/animalrp/paper/commands/TfCommand.java b/animalrp-paper/src/main/java/ovh/sad/animalrp/paper/commands/TfCommand.java new file mode 100644 index 0000000..fe282d9 --- /dev/null +++ b/animalrp-paper/src/main/java/ovh/sad/animalrp/paper/commands/TfCommand.java @@ -0,0 +1,73 @@ +package ovh.sad.animalrp.commands; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.Map.Entry; + +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import ovh.sad.animalrp.common.util.Animal; +import ovh.sad.animalrp.paper.AnimalRPPaper; + +public class TfCommand implements CommandExecutor { + public void options(Player player) { + ArrayList parts = new ArrayList(); + + for (Entry> entry : AnimalRPPaper.animals.entrySet()) { + parts.add("<"+entry.getValue().color+">"+entry.getKey()+""); + } + + player.sendMessage(AnimalRPPaper.mm.deserialize("" + Messages.get("your_options") + "\"" + String.join(", ", parts) + "\"")); + } + + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if(!(sender instanceof Player)) { + sender.sendMessage(AnimalRPPaper.mm.deserialize("I'm sorry, but you have to be a player to become an animal. :(")); + return true; + } + + Player player = (Player)sender; + + if(args.length == 0) { + if(AnimalRP.users.get(player.getUniqueId()) != null) { + Animal previous = AnimalRPPaper.users.get(player.getUniqueId()); + player.sendMessage(AnimalRPPaper.mm.deserialize("You start splitting apart, dropping your " + previous.name+"-like appearence..")); + AnimalRPPaper.users.remove(player.getUniqueId()); + if(AnimalRPPaper.isChatModOff.get(player.getUniqueId()) != null) + AnimalRPPaper.isChatModOff.remove(player.getUniqueId()); + return true; + } else { + options(player); return true; + + } + } + + String tf = args[0]; + + AnimalRPPaper animal = AnimalRPPaper.animals.get(tf); + + if(animal == null) { + options(player); return true; + } + + if(AnimalRP.users.get(player.getUniqueId()) != null) { + Animal previous = AnimalRP.users.get(player.getUniqueId()); + if(previous.name == animal.name) { + player.sendMessage(AnimalRP.mm.deserialize("You're " + previous.name + " already! " + animal.catchphrase)); + return true; + } + player.sendMessage(AnimalRP.mm.deserialize("You slowly transform, from " + previous.name + " to.. " + animal.name + ". "+ animal.catchphrase)); + } else { + player.sendMessage(AnimalRP.mm.deserialize("You slowly transform, to.. " + animal.name + ". "+ animal.catchphrase)); + } + + AnimalRP.users.put(player.getUniqueId(), animal); + return true; + } + +} \ No newline at end of file diff --git a/animalrp-paper/src/main/java/ovh/sad/animalrp/paper/listeners/PlayerChat.java b/animalrp-paper/src/main/java/ovh/sad/animalrp/paper/listeners/PlayerChat.java index 5be2d21..e40b56e 100644 --- a/animalrp-paper/src/main/java/ovh/sad/animalrp/paper/listeners/PlayerChat.java +++ b/animalrp-paper/src/main/java/ovh/sad/animalrp/paper/listeners/PlayerChat.java @@ -25,16 +25,25 @@ public abstract class PlayerChat implements Listener { return; @SuppressWarnings("unchecked") - Animal animal = (Animal) AnimalRPPaper.users.get(player.getUuid()); + Animal animal = (Animal) AnimalRPPaper.users.get(player.getUniqueId()); if (animal == null) return; if (random.nextDouble() < 0.08) { player.getWorld().playSound(player.getLocation(), animal.moodSounds.get(Mood.HAPPY), SoundCategory.PLAYERS, 10F, 1); } - event.message() + + // technically, this changes the WHOLE message, + // including the player's name and shit + // but i dgaf + // #SWAG - return original - .withUnsignedContent(Text.literal(animal.chatTransformations(original.getContent().getString()))); + event.message( + AnimalRPPaper.mm.deserialize( + animal.chatTransformations( + AnimalRPPaper.mm.serialize(event.message()) + ) + ) + ); } } diff --git a/animalrp-paper/src/main/resources/plugin.yml b/animalrp-paper/src/main/resources/plugin.yml new file mode 100644 index 0000000..2e7c418 --- /dev/null +++ b/animalrp-paper/src/main/resources/plugin.yml @@ -0,0 +1,25 @@ +name: animalrp +main: ovh.sad.animalrp.AnimalRP +version: 1.0.0 +api-version: 1.21 +commands: + tf: + usage: Become the animal of your dreams! + headpats: + aliases: [pats, pet] + usage: Pet someone! :3 + kiss: + usage: Kiss someone! :3 + bite: + aliases: lovebite + usage: Bite someone! (cutely) + disableanimalchat: + usage: Disable/enable the chat modification done by animals! + scratch: + usage: Scratch someone! Ow! + hug: + usage: Hug a person. + cuddle: + usage: Cuddle a person. + emote: + usage: Emote! \ No newline at end of file