fix bin files being commited, continue working on porting..
This commit is contained in:
parent
2f5a4bc647
commit
93e55984a5
41 changed files with 280 additions and 68 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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()
|
||||
|
||||
// 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())
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
25
animalrp-paper/src/main/resources/plugin.yml
Normal file
25
animalrp-paper/src/main/resources/plugin.yml
Normal 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!
|
||||
Loading…
Add table
Add a link
Reference in a new issue