more changes..

This commit is contained in:
Soph :3 2024-12-21 16:54:08 +02:00
parent d715042bc7
commit fa79090614
Signed by: sophie
GPG key ID: EDA5D222A0C270F2
2 changed files with 18 additions and 12 deletions

View file

@ -36,6 +36,8 @@ public class TfCommand {
AnimalRPFabric.users.remove(entity.getUuid());
context.getSource().sendFeedback(
() -> Text.literal(Messages.get("animal_removed")), false);
AnimalRPFabric.hashmapStore.save("users.json", AnimalRPFabric.users);
return 0;
}

View file

@ -11,6 +11,7 @@ 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.paper.AnimalRPPaper;
public class TfCommand implements CommandExecutor {
@ -24,22 +25,25 @@ public class TfCommand implements CommandExecutor {
player.sendMessage(AnimalRPPaper.mm.deserialize("<green>" + Messages.get("your_options") + "<dark_green>\"" + String.join(", ", parts) + "\"<green>"));
}
@SuppressWarnings("rawtypes")
@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. :("));
sender.sendMessage(AnimalRPPaper.mm.deserialize("<gray>" + Messages.get("no_console")));
return true;
}
Player player = (Player)sender;
if(args.length == 0) {
if(AnimalRP.users.get(player.getUniqueId()) != null) {
if(AnimalRPPaper.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());
if(AnimalRPPaper.noChat.get(player.getUniqueId()) != nul)
AnimalRPPaper.noChat.remove(player.getUniqueId());
return true;
} else {
options(player); return true;
@ -49,24 +53,24 @@ public class TfCommand implements CommandExecutor {
String tf = args[0];
AnimalRPPaper animal = AnimalRPPaper.animals.get(tf);
Animal 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(AnimalRPPaper.users.get(player.getUniqueId()) != null) {
Animal previous = AnimalRPPaper.users.get(player.getUniqueId());
if(previous.name == animal.name) {
player.sendMessage(AnimalRP.mm.deserialize("<gray>You're <blue>" + previous.name + "</blue> already! " + animal.catchphrase));
player.sendMessage(AnimalRPPaper.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));
player.sendMessage(AnimalRPPaper.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));
player.sendMessage(AnimalRPPaper.mm.deserialize("<green>You slowly transform, to.. <blue>" + animal.name + "<green>. "+ animal.catchphrase));
}
AnimalRP.users.put(player.getUniqueId(), animal);
AnimalRPPaper.users.put(player.getUniqueId(), animal);
return true;
}