Merge branch 'main' of https://github.com/Lucanius69/BedWars
This commit is contained in:
commit
fb7c67b4ce
@ -7,6 +7,7 @@ import org.bukkit.event.player.AsyncPlayerChatEvent;
|
|||||||
import rip.tilly.bedwars.BedWars;
|
import rip.tilly.bedwars.BedWars;
|
||||||
import rip.tilly.bedwars.managers.party.Party;
|
import rip.tilly.bedwars.managers.party.Party;
|
||||||
import rip.tilly.bedwars.playerdata.PlayerData;
|
import rip.tilly.bedwars.playerdata.PlayerData;
|
||||||
|
import rip.tilly.bedwars.playerdata.PlayerSettings;
|
||||||
import rip.tilly.bedwars.utils.CC;
|
import rip.tilly.bedwars.utils.CC;
|
||||||
|
|
||||||
public class PartyChatListener implements Listener {
|
public class PartyChatListener implements Listener {
|
||||||
@ -18,17 +19,23 @@ public class PartyChatListener implements Listener {
|
|||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
Party party = this.plugin.getPartyManager().getParty(player.getUniqueId());
|
Party party = this.plugin.getPartyManager().getParty(player.getUniqueId());
|
||||||
PlayerData playerData = this.plugin.getPlayerDataManager().getPlayerData(player.getUniqueId());
|
PlayerData playerData = this.plugin.getPlayerDataManager().getPlayerData(player.getUniqueId());
|
||||||
|
PlayerSettings settings = playerData.getPlayerSettings();
|
||||||
|
|
||||||
|
if (party == null && !settings.isPartyChatEnabled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
String chatMessage = event.getMessage();
|
String chatMessage = event.getMessage();
|
||||||
if (party != null) {
|
if (party != null) {
|
||||||
if (playerData.getPlayerSettings().isPartyChatEnabled()) {
|
if (settings.isPartyChatEnabled()) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
String message = CC.translate("&9Party > &d" + player.getDisplayName() + "&f: " + chatMessage);
|
String message = CC.translate("&9Party > &d" + player.getDisplayName() + "&f: " + chatMessage);
|
||||||
party.broadcast(message);
|
party.broadcast(message);
|
||||||
}
|
}
|
||||||
} else if (playerData.getPlayerSettings().isPartyChatEnabled()) {
|
} else if (settings.isPartyChatEnabled()) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
player.sendMessage(CC.translate("&cSince you are not in a party we toggled your party chat to false!"));
|
player.sendMessage(CC.translate("&cSince you are not in a party we toggled your party chat to false!"));
|
||||||
playerData.getPlayerSettings().setPartyChatEnabled(!playerData.getPlayerSettings().isPartyChatEnabled());
|
settings.setPartyChatEnabled(!settings.isPartyChatEnabled());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user