From 9b1ac1c8388c0d3f0da52d1fe760ec2cf51944c5 Mon Sep 17 00:00:00 2001 From: Nicooow <46629108+Nicooow@users.noreply.github.com> Date: Thu, 16 Apr 2020 02:10:21 +0200 Subject: [PATCH] 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 --- src/main/java/fr/leomelki/loupgarou/roles/RCupidon.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/fr/leomelki/loupgarou/roles/RCupidon.java b/src/main/java/fr/leomelki/loupgarou/roles/RCupidon.java index 1d559e2..320b800 100644 --- a/src/main/java/fr/leomelki/loupgarou/roles/RCupidon.java +++ b/src/main/java/fr/leomelki/loupgarou/roles/RCupidon.java @@ -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().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().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); } }