From e0c22dfc1e745ca5bb89ca6fe0d70f7c79ccefa2 Mon Sep 17 00:00:00 2001 From: Aria Date: Sun, 8 Sep 2019 02:14:18 +0200 Subject: [PATCH] Can now cancel friend requesting + can no longer friend yourself --- src/main/java/net/Indyuce/mmocore/api/input/ChatInput.java | 5 ++++- .../mmocore/gui/social/friend/EditableFriendList.java | 2 +- src/main/resources/default/messages.yml | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/api/input/ChatInput.java b/src/main/java/net/Indyuce/mmocore/api/input/ChatInput.java index 7d69460c..c4bfecb1 100644 --- a/src/main/java/net/Indyuce/mmocore/api/input/ChatInput.java +++ b/src/main/java/net/Indyuce/mmocore/api/input/ChatInput.java @@ -16,6 +16,7 @@ public class ChatInput extends PlayerInput { player.closeInventory(); player.sendMessage(MMOCore.plugin.configManager.getSimpleMessage("player-input.chat." + type.getLowerCaseName())); + player.sendMessage(MMOCore.plugin.configManager.getSimpleMessage("player-input.chat.cancel")); } @Override @@ -28,7 +29,9 @@ public class ChatInput extends PlayerInput { if (event.getPlayer().equals(getPlayer())) { close(); event.setCancelled(true); - Bukkit.getScheduler().scheduleSyncDelayedTask(MMOCore.plugin, () -> output(event.getMessage())); + + if(!event.getMessage().equals("cancel")) + Bukkit.getScheduler().scheduleSyncDelayedTask(MMOCore.plugin, () -> output(event.getMessage())); } } diff --git a/src/main/java/net/Indyuce/mmocore/gui/social/friend/EditableFriendList.java b/src/main/java/net/Indyuce/mmocore/gui/social/friend/EditableFriendList.java index 94119a8d..d24a9b42 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/social/friend/EditableFriendList.java +++ b/src/main/java/net/Indyuce/mmocore/gui/social/friend/EditableFriendList.java @@ -218,7 +218,7 @@ public class EditableFriendList extends EditableInventory { } if (playerData.getUniqueId().equals(target.getUniqueId())) { - player.sendMessage(MMOCore.plugin.configManager.getSimpleMessage("yourself", "player", target.getName())); + player.sendMessage(MMOCore.plugin.configManager.getSimpleMessage("cant-request-to-yourself")); player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1); open(); return; diff --git a/src/main/resources/default/messages.yml b/src/main/resources/default/messages.yml index 8fe6edc9..04976ad5 100644 --- a/src/main/resources/default/messages.yml +++ b/src/main/resources/default/messages.yml @@ -39,6 +39,7 @@ player-input: chat: friend-request: '&eWrite in the chat the player name.' party-invite: '&eWrite in the chat the player you want to invite.' + cancel: '&eWrite &c''cancel'' &eto cancel.' # Spell Casting casting: