Can now cancel friend requesting + can no longer friend yourself

This commit is contained in:
Aria 2019-09-08 02:14:18 +02:00
parent 63e63083f0
commit e0c22dfc1e
3 changed files with 6 additions and 2 deletions

View File

@ -16,6 +16,7 @@ public class ChatInput extends PlayerInput {
player.closeInventory(); player.closeInventory();
player.sendMessage(MMOCore.plugin.configManager.getSimpleMessage("player-input.chat." + type.getLowerCaseName())); player.sendMessage(MMOCore.plugin.configManager.getSimpleMessage("player-input.chat." + type.getLowerCaseName()));
player.sendMessage(MMOCore.plugin.configManager.getSimpleMessage("player-input.chat.cancel"));
} }
@Override @Override
@ -28,6 +29,8 @@ public class ChatInput extends PlayerInput {
if (event.getPlayer().equals(getPlayer())) { if (event.getPlayer().equals(getPlayer())) {
close(); close();
event.setCancelled(true); event.setCancelled(true);
if(!event.getMessage().equals("cancel"))
Bukkit.getScheduler().scheduleSyncDelayedTask(MMOCore.plugin, () -> output(event.getMessage())); Bukkit.getScheduler().scheduleSyncDelayedTask(MMOCore.plugin, () -> output(event.getMessage()));
} }
} }

View File

@ -218,7 +218,7 @@ public class EditableFriendList extends EditableInventory {
} }
if (playerData.getUniqueId().equals(target.getUniqueId())) { 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); player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1);
open(); open();
return; return;

View File

@ -39,6 +39,7 @@ player-input:
chat: chat:
friend-request: '&eWrite in the chat the player name.' friend-request: '&eWrite in the chat the player name.'
party-invite: '&eWrite in the chat the player you want to invite.' party-invite: '&eWrite in the chat the player you want to invite.'
cancel: '&eWrite &c''cancel'' &eto cancel.'
# Spell Casting # Spell Casting
casting: casting: