com.alessiodp.parties.api.interfaces.PartyPlayer Java Examples

The following examples show how to use com.alessiodp.parties.api.interfaces.PartyPlayer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PartyImpl.java    From Parties with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public void rename(@NonNull String newName) {
	lock.lock();
	String oldName = getName();
	plugin.getPartyManager().getListParties().remove(oldName.toLowerCase(Locale.ENGLISH)); // Remove from online list
	
	plugin.getDatabaseManager().renameParty(oldName, newName); // Rename via database
	
	// For each online player rename the party
	for (PartyPlayer partyPlayer : getOnlineMembers(true)) {
		partyPlayer.setPartyName(newName);
	}
	
	this.name = newName; // Change name
	
	plugin.getPartyManager().getListParties().put(newName.toLowerCase(Locale.ENGLISH), this); // Insert into online list
	callChange();
	lock.unlock();
	
	plugin.getLoggerManager().logDebug(PartiesConstants.DEBUG_PARTY_RENAME
			.replace("{party}", oldName)
			.replace("{name}", getName()), true);
}
 
Example #2
Source File: BukkitPartiesPlayerPostLeaveEvent.java    From Parties with GNU Affero General Public License v3.0 5 votes vote down vote up
public BukkitPartiesPlayerPostLeaveEvent(PartyPlayer player, Party party, boolean isKicked, PartyPlayer kickedBy) {
	super(true);
	this.player = player;
	this.party = party;
	this.isKicked = isKicked;
	this.kickedBy = kickedBy;
}
 
Example #3
Source File: PartiesAdapter.java    From DungeonsXL with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Party getExternalGroup(Player member) {
    PartyPlayer pPlayer = getPartyPlayer(member);
    if (pPlayer == null) {
        return null;
    }
    return partiesAPI.getParty(pPlayer.getPartyName());
}
 
Example #4
Source File: PartyImpl.java    From Parties with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Send a broadcast message to the party without format it.
 *
 * @param dispatchBetweenServers Is used by sub classes
 */
public void broadcastDirectMessage(String message, boolean dispatchBetweenServers) {
	if (message == null || message.isEmpty())
		return;
	
	for (PartyPlayer player : getOnlineMembers(true)) {
		((PartyPlayerImpl) player).sendMessage(message, this);
	}
	
	plugin.getSpyManager().sendSpyMessage(new SpyMessage(plugin)
			.setType(SpyMessage.SpyType.BROADCAST)
			.setMessage(message)
			.setParty(this)
			.setPlayer(null));
}
 
Example #5
Source File: BukkitPartiesPartyPreDeleteEvent.java    From Parties with GNU Affero General Public License v3.0 5 votes vote down vote up
public BukkitPartiesPartyPreDeleteEvent(Party party, DeleteCause cause, PartyPlayer kickedPlayer, PartyPlayer commandSender) {
	super(false);
	this.party = party;
	this.cause = cause;
	this.kickedPlayer = kickedPlayer;
	this.commandSender = commandSender;
}
 
Example #6
Source File: PartyImpl.java    From Parties with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void broadcastMessage(@Nullable String message, @Nullable PartyPlayer partyPlayer) {
	if (message == null || message.isEmpty())
		return;
	
	String formattedMessage = ConfigParties.GENERAL_CHAT_FORMAT_BROADCAST
			.replace("%message%", message);
	if (partyPlayer != null)
		formattedMessage = plugin.getMessageUtils().convertAllPlaceholders(formattedMessage, this, (PartyPlayerImpl) partyPlayer);
	formattedMessage = plugin.getColorUtils().convertColors(formattedMessage);
	
	broadcastDirectMessage(formattedMessage, true);
}
 
Example #7
Source File: PartyImpl.java    From Parties with GNU Affero General Public License v3.0 5 votes vote down vote up
public void dispatchChatMessage(PartyPlayerImpl sender, String message, boolean dispatchBetweenServers) {
	if (message == null || message.isEmpty())
		return;
	
	for (PartyPlayer player : getOnlineMembers(true)) {
		((PartyPlayerImpl) player).sendMessage(message, this);
	}
}
 
Example #8
Source File: BukkitPartiesPlayerPostJoinEvent.java    From Parties with GNU Affero General Public License v3.0 5 votes vote down vote up
public BukkitPartiesPlayerPostJoinEvent(PartyPlayer player, Party party, boolean isInvited, UUID invitedBy) {
	super(true);
	this.player = player;
	this.party = party;
	this.isInvited = isInvited;
	this.invitedBy = invitedBy;
}
 
Example #9
Source File: BukkitPartiesPlayerPreJoinEvent.java    From Parties with GNU Affero General Public License v3.0 5 votes vote down vote up
public BukkitPartiesPlayerPreJoinEvent(PartyPlayer player, Party party, boolean isInvited, UUID invitedBy) {
	super(false);
	this.player = player;
	this.party = party;
	this.isInvited = isInvited;
	this.invitedBy = invitedBy;
}
 
Example #10
Source File: PartiesAdapter.java    From DungeonsXL with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean removeExternalGroupMember(Party eGroup, Player member) {
    PartyPlayer pPlayer = getPartyPlayer(member);
    if (pPlayer == null) {
        return false;
    }
    if (eGroup == null) {
        return false;
    }
    eGroup.removeMember(pPlayer);
    if (eGroup.getMembers().isEmpty()) {
        eGroup.delete();
    }
    return true;
}
 
Example #11
Source File: PartyImpl.java    From Parties with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void removeMember(@NonNull PartyPlayer partyPlayer) {
	lock.lock();
	members.remove(partyPlayer.getPlayerUUID());
	onlineMembers.remove(partyPlayer);
	
	((PartyPlayerImpl) partyPlayer).removeFromParty(true);
	
	updateParty();
	callChange();
	lock.unlock();
}
 
Example #12
Source File: BungeePartiesPartyPostCreateEvent.java    From Parties with GNU Affero General Public License v3.0 4 votes vote down vote up
public BungeePartiesPartyPostCreateEvent(PartyPlayer player, Party party) {
	this.player = player;
	this.party = party;
}
 
Example #13
Source File: BungeePartiesPartyRenameEvent.java    From Parties with GNU Affero General Public License v3.0 4 votes vote down vote up
public BungeePartiesPartyRenameEvent(Party party, String newName, PartyPlayer player, boolean isAdmin) {
	this.party = party;
	this.newName = newName;
	this.player = player;
	this.isAdmin = isAdmin;
}
 
Example #14
Source File: BungeePartiesPartyRenameEvent.java    From Parties with GNU Affero General Public License v3.0 4 votes vote down vote up
@NonNull
@Override
public PartyPlayer getPartyPlayer() {
	return player;
}
 
Example #15
Source File: BungeePartiesPlayerPostLeaveEvent.java    From Parties with GNU Affero General Public License v3.0 4 votes vote down vote up
public BungeePartiesPlayerPostLeaveEvent(PartyPlayer player, Party party, boolean isKicked, PartyPlayer kickedBy) {
	this.player = player;
	this.party = party;
	this.isKicked = isKicked;
	this.kickedBy = kickedBy;
}
 
Example #16
Source File: BungeeEventManager.java    From Parties with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public IPartyPreDeleteEvent preparePartyPreDeleteEvent(Party party, DeleteCause cause, PartyPlayer kickedPlayer, PartyPlayer commandSender) {
	return new BungeePartiesPartyPreDeleteEvent(party, cause, kickedPlayer, commandSender);
}
 
Example #17
Source File: BungeePartiesPartyPreDeleteEvent.java    From Parties with GNU Affero General Public License v3.0 4 votes vote down vote up
@Nullable
@Override
public PartyPlayer getKickedPlayer() {
	return kickedPlayer;
}
 
Example #18
Source File: BungeePartiesPartyPreDeleteEvent.java    From Parties with GNU Affero General Public License v3.0 4 votes vote down vote up
@Nullable
@Override
public PartyPlayer getCommandSender() {
	return commandSender;
}
 
Example #19
Source File: BungeePartiesPartyPostCreateEvent.java    From Parties with GNU Affero General Public License v3.0 4 votes vote down vote up
@NonNull
@Override
public PartyPlayer getCreator() {
	return player;
}
 
Example #20
Source File: BungeePartiesPlayerPostJoinEvent.java    From Parties with GNU Affero General Public License v3.0 4 votes vote down vote up
public BungeePartiesPlayerPostJoinEvent(PartyPlayer player, Party party, boolean isInvited, UUID invitedBy) {
	this.player = player;
	this.party = party;
	this.isInvited = isInvited;
	this.invitedBy = invitedBy;
}
 
Example #21
Source File: BungeePartiesPlayerPreJoinEvent.java    From Parties with GNU Affero General Public License v3.0 4 votes vote down vote up
@NonNull
@Override
public PartyPlayer getPartyPlayer() {
	return player;
}
 
Example #22
Source File: BungeePartiesPartyPostDeleteEvent.java    From Parties with GNU Affero General Public License v3.0 4 votes vote down vote up
@Nullable
@Override
public PartyPlayer getCommandSender() {
	return commandSender;
}
 
Example #23
Source File: BungeePartiesChatEvent.java    From Parties with GNU Affero General Public License v3.0 4 votes vote down vote up
public BungeePartiesChatEvent(PartyPlayer player, Party party, String message) {
	this.player = player;
	this.party = party;
	this.message = message;
}
 
Example #24
Source File: BungeePartiesChatEvent.java    From Parties with GNU Affero General Public License v3.0 4 votes vote down vote up
@NonNull
@Override
public PartyPlayer getPartyPlayer() {
	return player;
}
 
Example #25
Source File: BungeePartiesPlayerPreLeaveEvent.java    From Parties with GNU Affero General Public License v3.0 4 votes vote down vote up
public BungeePartiesPlayerPreLeaveEvent(PartyPlayer player, Party party, boolean isKicked, PartyPlayer kickedBy) {
	this.player = player;
	this.party = party;
	this.isKicked = isKicked;
	this.kickedBy = kickedBy;
}
 
Example #26
Source File: BungeePartiesPlayerPreLeaveEvent.java    From Parties with GNU Affero General Public License v3.0 4 votes vote down vote up
@NonNull
@Override
public PartyPlayer getPartyPlayer() {
	return player;
}
 
Example #27
Source File: BungeeEventManager.java    From Parties with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public IPartyPostDeleteEvent preparePartyPostDeleteEvent(String party, DeleteCause cause, PartyPlayer kickedPlayer, PartyPlayer commandSender) {
	return new BungeePartiesPartyPostDeleteEvent(party, cause, kickedPlayer, commandSender);
}
 
Example #28
Source File: BukkitPartiesPlayerPreJoinEvent.java    From Parties with GNU Affero General Public License v3.0 4 votes vote down vote up
@NonNull
@Override
public PartyPlayer getPartyPlayer() {
	return player;
}
 
Example #29
Source File: BungeeEventManager.java    From Parties with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public IPartyRenameEvent preparePartyRenameEvent(Party party, String newName, PartyPlayer player, boolean isAdmin) {
	return new BungeePartiesPartyRenameEvent(party, newName, player, isAdmin);
}
 
Example #30
Source File: PartiesAdapter.java    From DungeonsXL with GNU General Public License v3.0 4 votes vote down vote up
private PartyPlayer getPartyPlayer(Player player) {
    return partiesAPI.getPartyPlayer(player.getUniqueId());
}