fix bin files being commited, continue working on porting..

This commit is contained in:
Soph :3 2024-12-01 16:46:39 +02:00
parent 2f5a4bc647
commit 93e55984a5
Signed by: sophie
GPG key ID: EDA5D222A0C270F2
41 changed files with 280 additions and 68 deletions

View file

@ -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 :("
}

View file

@ -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
""";

View file

@ -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"
}

View file

@ -1,13 +0,0 @@
{
"required": true,
"package": "ovh.sad.animalrp.fabric.mixin",
"compatibilityLevel": "JAVA_21",
"server": [
"DecoratedMessage",
"FoodEating",
"Sneaking"
],
"injectors": {
"defaultRequire": 1
}
}

View file

@ -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": "*"
}
}

View file

@ -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);
});
}
}

View file

@ -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

View file

@ -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("<gray>I'm sorry console. :(</gray>"));
return true;
}
Player player = (Player)sender;
@SuppressWarnings("unchecked")
Animal<Sound, Material> aplayer = (Animal<Sound, Material>) AnimalRPPaper.users.get(player.getUniqueId());
if(aplayer == null) {
player.sendMessage(AnimalRPPaper.mm.deserialize("<gray>" + Messages.get("only_animals")));
return true;
}
if(args.length == 0) {
player.sendMessage(AnimalRPPaper.mm.deserialize("<gray>" + Messages.get("include_user")));
return true;
}
Player splayer = Bukkit.getPlayer(args[0]);
if(splayer == null) {
player.sendMessage(AnimalRPPaper.mm.deserialize("<gray>" + Messages.get("no_player_found")));
return true;
}
if(splayer.getName() == player.getName()) {
player.sendMessage(AnimalRPPaper.mm.deserialize("<gray>" + String.format(Messages.get("no_self_argument"), command)));
return true;
}
@SuppressWarnings("unchecked")
Animal<Sound, Material> asplayer = (Animal<Sound, Material>) AnimalRPPaper.users.get(splayer.getUniqueId());
if(asplayer == null) {
player.sendMessage(AnimalRPPaper.mm.deserialize("<gray>"+String.format(Messages.get("not_animal"), splayer.getName())));
return true;
}
splayer.sendMessage(AnimalRPPaper.mm.deserialize(String.format(this.toThem, "<light_purple>"+player.getName()+"</light_purple>", "<italic><gray>"+aplayer.catchphrase+"</italic>")));
player.sendMessage(AnimalRPPaper.mm.deserialize(String.format(this.toYou, "<light_purple>"+splayer.getName()+"</light_purple>", "<italic><gray>"+asplayer.catchphrase+"</italic>")));
player.getWorld().playSound(splayer.getLocation(), asplayer.moodSounds.get(this.mood), 1F, 1);
return true;
}
}

View file

@ -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<String> parts = new ArrayList<String>();
for (Entry<String,Animal<?,?>> entry : AnimalRPPaper.animals.entrySet()) {
parts.add("<"+entry.getValue().color+">"+entry.getKey()+"</"+entry.getValue().color+">");
}
player.sendMessage(AnimalRPPaper.mm.deserialize("<green>" + Messages.get("your_options") + "<dark_green>\"" + String.join(", ", parts) + "\"<green>"));
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(!(sender instanceof Player)) {
sender.sendMessage(AnimalRPPaper.mm.deserialize("<gray>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("<green>You start splitting apart, dropping your <blue>" + previous.name+"-like<green> 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("<gray>You're <blue>" + previous.name + "</blue> already! " + animal.catchphrase));
return true;
}
player.sendMessage(AnimalRP.mm.deserialize("<green>You slowly transform, from <blue>" + previous.name + "<green> to.. <blue>" + animal.name + ". "+ animal.catchphrase));
} else {
player.sendMessage(AnimalRP.mm.deserialize("<green>You slowly transform, to.. <blue>" + animal.name + "<green>. "+ animal.catchphrase));
}
AnimalRP.users.put(player.getUniqueId(), animal);
return true;
}
}

View file

@ -25,16 +25,25 @@ public abstract class PlayerChat implements Listener {
return;
@SuppressWarnings("unchecked")
Animal<Sound, Material> animal = (Animal<Sound, Material>) AnimalRPPaper.users.get(player.getUuid());
Animal<Sound, Material> animal = (Animal<Sound, Material>) 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()
return original
.withUnsignedContent(Text.literal(animal.chatTransformations(original.getContent().getString())));
// technically, this changes the WHOLE message,
// including the player's name and shit
// but i dgaf
// #SWAG
event.message(
AnimalRPPaper.mm.deserialize(
animal.chatTransformations(
AnimalRPPaper.mm.serialize(event.message())
)
)
);
}
}

View file

@ -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!