Anti devo avec les messages de couple '!' (#41)

* Anti devo avec les messages de couple '!'

* Added warning message & replaced spaces with tabs

If you attempt to send a message starting with an exclamation mark and you're not in love, you will receive a warning message telling you that your message has not been sent because you're not in love.

Co-authored-by: leomelki
This commit is contained in:
Nicooow 2020-04-16 02:10:21 +02:00 committed by GitHub
parent b66cf7ec17
commit 9b1ac1c838
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -255,9 +255,12 @@ public class RCupidon extends Role{
public void onChat(AsyncPlayerChatEvent e) {
LGPlayer player = LGPlayer.thePlayer(e.getPlayer());
if(player.getGame() == getGame()) {
if(e.getMessage().startsWith("!") && player.getCache().has("inlove")) {
player.sendMessage("§d\u2764 "+player.getName()+" §6» §f"+e.getMessage().substring(1));
player.getCache().<LGPlayer>get("inlove").sendMessage("§d\u2764 "+player.getName()+" §6» §f"+e.getMessage().substring(1));
if(e.getMessage().startsWith("!")) {
if(player.getCache().has("inlove")){
player.sendMessage("§d\u2764 "+player.getName()+" §6» §f"+e.getMessage().substring(1));
player.getCache().<LGPlayer>get("inlove").sendMessage("§d\u2764 "+player.getName()+" §6» §f"+e.getMessage().substring(1));
}else
player.sendMessage("§4Erreur : §cVous n'êtes pas en couple !");
e.setCancelled(true);
}
}