Java Code Examples for org.bukkit.entity.Player#chat()

The following examples show how to use org.bukkit.entity.Player#chat() . 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: SlimefunGuideListener.java    From Slimefun4 with GNU General Public License v3.0 6 votes vote down vote up
@EventHandler(priority = EventPriority.LOWEST)
public void onInteract(PlayerRightClickEvent e) {
    Player p = e.getPlayer();

    if (openGuide(e, SlimefunGuideLayout.BOOK) == Result.ALLOW) {
        if (p.isSneaking()) {
            SlimefunGuideSettings.openSettings(p, e.getItem());
        }
        else {
            SlimefunGuide.openGuide(p, SlimefunGuideLayout.BOOK);
        }
    }
    else if (openGuide(e, SlimefunGuideLayout.CHEST) == Result.ALLOW) {
        if (p.isSneaking()) {
            SlimefunGuideSettings.openSettings(p, e.getItem());
        }
        else {
            SlimefunGuide.openGuide(p, SlimefunGuideLayout.CHEST);
        }
    }
    else if (openGuide(e, SlimefunGuideLayout.CHEAT_SHEET) == Result.ALLOW) {
        // We rather just run the command here,
        // all necessary permission checks will be handled there.
        p.chat("/sf cheat");
    }
}
 
Example 2
Source File: EffMakeSay.java    From Skript with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void execute(Event e) {
	for (Player player : players.getArray(e)) {
		for (String message : messages.getArray(e)) {
			player.chat(message);
		}
	}
}
 
Example 3
Source File: ChatEvent.java    From BetonQuest with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected Void execute(String playerID) {
    Player player = PlayerConverter.getPlayer(playerID);
    for (String message : messages)
        player.chat(message.replace("%player%", player.getName()));
    return null;
}
 
Example 4
Source File: OpIconCommand.java    From ChestCommands with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void execute(Player player) {

	if (player.isOp()) {
		player.chat("/" + getParsedCommand(player));

	} else {
		player.setOp(true);
		player.chat("/" + getParsedCommand(player));
		player.setOp(false);
	}
}
 
Example 5
Source File: ChannelMemberPlayer.java    From LunaChat with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * 指定されたメッセージの内容を発言する
 * @param message メッセージ
 * @see com.github.ucchyocean.lc3.member.ChannelMember#chat(java.lang.String)
 */
public void chat(String message) {
    Player player = getPlayer();
    if ( player != null ) {
        player.chat(message);
    }
}
 
Example 6
Source File: PlayerIconCommand.java    From ChestCommands with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void execute(Player player) {
	player.chat('/' + getParsedCommand(player));
}
 
Example 7
Source File: MarriageManager.java    From MarriageMaster with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void marry(@NotNull MarriagePlayer player1, @NotNull MarriagePlayer player2, @NotNull MarriagePlayer priest, String surname)
{
	if(priest.isOnline() && marryOnlineTest(priest.getPlayerOnline(), player1.getPlayer(), player2.getPlayer()) && marrySurnameTest(priest.getPlayerOnline(), surname))
	{
		if(player1.equals(priest) || player2.equals(priest)) // Self marry
		{
			if(plugin.isSelfMarriageAllowed() && priest.hasPermission(Permissions.SELF_MARRY))
			{
				MarriagePlayer otherPlayer = (player1.equals(priest)) ? player2 : player1;
				if(player1.equals(player2))
				{
					priest.send(messageNotYourself);
				}
				else if(!plugin.isInRangeSquared(player1, player2, rangeMarrySquared))
				{
					priest.send(messageSelfNotInRange, rangeMarry);
				}
				else if(!plugin.areMultiplePartnersAllowed() && (player1.isMarried() || player2.isMarried()))
				{
					if(priest.isMarried())
					{
						priest.send(messageSelfAlreadyMarried, priest.getPartner().getName(), priest.getPartner().getDisplayName());
					}
					if(otherPlayer.isMarried())
					{
						priest.send(messageSelfOtherAlreadyMarried, otherPlayer.getName(), otherPlayer.getDisplayName());
					}
				}
				else if(priest.getOpenRequest() != null || priest.getRequestsToCancel().size() > 0)
				{
					priest.send(messageSelfAlreadyOpenRequest);
				}
				else if(otherPlayer.getOpenRequest() != null || otherPlayer.getRequestsToCancel().size() > 0)
				{
					priest.send(messageAlreadyOpenRequest, otherPlayer.getName(), otherPlayer.getDisplayName());
				}
				else
				{
					otherPlayer.send(messageSelfConfirm, priest.getName(), priest.getDisplayName());
					priest.send(messageSelfMarryRequestSent);
					plugin.getCommandManager().registerAcceptPendingRequest(new SelfMarryAcceptRequest(this, otherPlayer, priest, surname));
				}
			}
			else
			{
				priest.send(messageSelfNotOnYourOwn);
			}
		}
		else // Player priest
		{
			if(priest.isPriest())
			{
				Player bPriest = priest.getPlayerOnline();
				if(marryPriestTestCanMarry(player1, player2, bPriest))
				{
					if(priest.hasPermission(Permissions.BYPASS_RANGELIMIT) || (plugin.isInRangeSquared(player1, player2, rangeMarrySquared) && plugin.isInRangeSquared(priest, player1, rangeMarrySquared) &&
							plugin.isInRangeSquared(priest, player2, rangeMarrySquared)))
					{
						if(!confirm)
						{
							marryPriestFinish(player1, player2, bPriest, surname);
						}
						else
						{
							if(player1.getOpenRequest() != null || player1.getRequestsToCancel().size() > 0)
							{
								priest.send(messageAlreadyOpenRequest, player1.getName(), player1.getDisplayName());
							}
							else if(player2.getOpenRequest() != null || player2.getRequestsToCancel().size() > 0)
							{
								priest.send(messageAlreadyOpenRequest, player2.getName(), player2.getDisplayName());
							}
							else
							{
								if(autoDialog)
								{
									bPriest.chat(String.format(dialogDoYouWant, player1.getName(), player1.getDisplayName(), player2.getName(), player2.getDisplayName()));
								}
								plugin.getCommandManager().registerAcceptPendingRequest(new PriestMarryAcceptRequest(this, player1, player2, priest, surname, true));
							}
						}
					}
					else
					{
						priest.send(messageNotInRange, rangeMarry);
					}
				}
			}
			else
			{
				priest.send(plugin.messageNoPermission);
			}
		}
	}
}