本文整理汇总了Java中org.bukkit.entity.Player.sendMessage方法的典型用法代码示例。如果您正苦于以下问题:Java Player.sendMessage方法的具体用法?Java Player.sendMessage怎么用?Java Player.sendMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.entity.Player
的用法示例。
在下文中一共展示了Player.sendMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCommand
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Subcommand("perm|permission") @Syntax("<tag>")
public void onCommand(Player p, String ID){
if(DogTags.getTag(ID) != null){
DogTag dt = DogTags.getTag(ID);
if(dt.hasPermission()) p.sendMessage(TagLang.TAG_PERMISSION.get()
.replace("%id%", dt.getId())
.replace("%permission%", "dogtags.use."+dt.getId().toLowerCase()));
else p.sendMessage(TagLang.TAG_NO_PERMISSION.get().replace("%id%", dt.getId()));
return;
}else {
p.sendMessage(TagLang.INVALID_TAG.get());
return;
}
}
示例2: helpList
import org.bukkit.entity.Player; //导入方法依赖的package包/类
private void helpList(Player player) {
player.sendMessage(Lang.HEADERS_TRIBES.toString() + "Tribe Commands");
player.sendMessage(ChatColor.RED + "/tribe create <tribeName>" + ChatColor.GRAY + " - creates a tribe");
player.sendMessage(ChatColor.RED + "/tribe list" + ChatColor.GRAY + " - shows all tribes");
player.sendMessage(ChatColor.RED + "/tribe chat" + ChatColor.GRAY + " - sends message to tribe members");
player.sendMessage(ChatColor.RED + "/tribe leave" + ChatColor.GRAY + " - leaves tribe");
player.sendMessage(ChatColor.RED + "/tribe chest" + ChatColor.GRAY + " - opens commnunal chest");
player.sendMessage(ChatColor.RED + "/tribe sword" + ChatColor.GRAY + " - gives tribe sword to use skills");
player.sendMessage(ChatColor.RED + "/tribe info <*tribeName> " + ChatColor.GRAY + " - shows information of tribe");
player.sendMessage(ChatColor.RED + "/tribe description" + ChatColor.GRAY + " - displays tribe description");
player.sendMessage(ChatColor.RED + "/tribe description <description>" + ChatColor.GRAY + " - sets tribe description");
player.sendMessage(ChatColor.RED + "/tribe type" + ChatColor.GRAY + " - changes tribe type");
player.sendMessage(ChatColor.RED + "/tribe rankup" + ChatColor.GRAY + " - rankups tribe to next level");
player.sendMessage(ChatColor.RED + "/tribe invite <playerName>" + ChatColor.GRAY + " - invites player to tribe");
player.sendMessage(ChatColor.RED + "/tribe kick <playerName>" + ChatColor.GRAY + " - kicks player forom tribe");
player.sendMessage(ChatColor.RED + "/tribe promote <playerName>" + ChatColor.GRAY + " - sets player as tribe leader");
player.sendMessage(ChatColor.RED + "/tribe ally <tribeName>" + ChatColor.GRAY + " - offers tribe to become allies");
player.sendMessage(ChatColor.RED + "/tribe enemy <tribeName>" + ChatColor.GRAY + " - sets tribe as enemy");
player.sendMessage(ChatColor.RED + "/tribe neutral <tribeName>" + ChatColor.GRAY + " - offers to become neutral");
player.sendMessage(ChatColor.RED + "/tribe pay <*tribeName> <amount>" + ChatColor.GRAY + " - adds money to tribe's balance");
player.sendMessage(ChatColor.RED + "/tribe balance <tribeName>" + ChatColor.GRAY + " - displays tribe's balance");
player.sendMessage(ChatColor.RED + "* before argument means it's optional!");
}
示例3: createSF
import org.bukkit.entity.Player; //导入方法依赖的package包/类
/**
* ����һ���䷽
* @param player ���
* @param sfName �䷽��
* @param time ʱ��
* @return �Ƿ�ɹ�
*/
public static boolean createSF(Player player,String sfName,String time){
if(new File(rs.getDataFolder()+File.separator+"SyntheticFormula"+File.separator+sfName+".yml").exists()){
player.sendMessage("��9[RealSurvival] ��b�ϳɹ�ʽ������...");
return false;
}
long l=-1;
try{ l=Long.parseLong(time);}catch(Exception e){}
if(l<0){
player.sendMessage("��9[RealSurvival] ��b����ʱ�����!...");
return false;
}
player.openInventory(CraftItemGUI.createWorkbenchRecipeGUI(Items.createItemKey(Material.STAINED_GLASS_PANE, (short)15,sfName+":"+time)));
return true;
}
示例4: canUseBardEffect
import org.bukkit.entity.Player; //导入方法依赖的package包/类
private boolean canUseBardEffect(Player player, BardData bardData, BardEffect bardEffect, boolean sendFeedback) {
String errorFeedback = null;
double currentEnergy = bardData.getEnergy();
if (bardEffect.energyCost > currentEnergy) {
errorFeedback = ChatColor.RED + "You need at least " + ChatColor.BOLD + bardEffect.energyCost + ChatColor.RED + " energy to use this Bard buff, whilst you only have " + ChatColor.BOLD
+ currentEnergy + ChatColor.RED + '.';
}
long remaining = bardData.getRemainingBuffDelay();
if (remaining > 0L) {
errorFeedback = ChatColor.RED + "You cannot use this bard buff for another " + ChatColor.BOLD + DurationFormatter.getRemaining(remaining, true, false) + ChatColor.RED + '.';
}
Faction factionAt = plugin.getFactionManager().getFactionAt(player.getLocation());
if (factionAt.isSafezone()) {
errorFeedback = ChatColor.RED + "You may not use bard buffs in safe-zones.";
}
if (sendFeedback && errorFeedback != null) {
player.sendMessage(errorFeedback);
}
return errorFeedback == null;
}
示例5: onInventoryClick1
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler
public void onInventoryClick1(InventoryClickEvent event) {
Player player = (Player) event.getWhoClicked();
ItemStack is = event.getCurrentItem();
if ((event.getCurrentItem() != null) && (event.getCurrentItem().getType() != Material.AIR)) {
if (event.getInventory().getName().equals(ChatColor.DARK_GRAY + "Teleport Menu - Page 1")) {
event.setCancelled(true);
for (int i = 0; i < Bukkit.getOnlinePlayers().size(); i++) {
Player targetPlayer = (Player) Bukkit.getOnlinePlayers().toArray()[i];
Location location = player.getLocation();
if ((event.getCurrentItem().getType() == Material.SKULL_ITEM) && (is.hasItemMeta()) && (is.getItemMeta().getDisplayName().equals(ChatColor.YELLOW + "Teleport to " + ChatColor.GREEN + targetPlayer.getName()))) {
player.closeInventory();
player.teleport(targetPlayer);
player.sendMessage(ChatColor.YELLOW + "You've teleported to " + ChatColor.GREEN + targetPlayer.getDisplayName() + ChatColor.YELLOW + "!");
player.playSound(location, Sound.ENTITY_ENDERMEN_TELEPORT, 100, 1);
player.playEffect(location, Effect.ENDER_SIGNAL, 1);
targetPlayer.playEffect(location, Effect.ENDER_SIGNAL, 1);
}
}
}
}
}
示例6: onInventoryClick2
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler
public void onInventoryClick2(InventoryClickEvent event) {
Player player = (Player) event.getWhoClicked();
ItemStack is = event.getCurrentItem();
if ((event.getCurrentItem() != null) && (event.getCurrentItem().getType() != Material.AIR)) {
if (event.getInventory().getName().equals(ChatColor.DARK_GRAY + "Teleport Here Menu - Page 1")) {
event.setCancelled(true);
for (int i = 0; i < Bukkit.getOnlinePlayers().size(); i++) {
Player targetPlayer = (Player) Bukkit.getOnlinePlayers().toArray()[i];
Location location = player.getLocation();
if ((event.getCurrentItem().getType() == Material.SKULL_ITEM) && (is.hasItemMeta()) && (is.getItemMeta().getDisplayName().equals(ChatColor.YELLOW + "Teleport " + ChatColor.GREEN + targetPlayer.getName() + ChatColor.YELLOW + " to you."))) {
player.closeInventory();
targetPlayer.teleport(player);
player.sendMessage(ChatColor.YELLOW + "You've teleported " + ChatColor.GREEN + targetPlayer.getDisplayName() + ChatColor.YELLOW + " to you!");
player.playSound(location, Sound.ENTITY_ENDERMEN_TELEPORT, 100, 1);
player.playEffect(location, Effect.ENDER_SIGNAL, 1);
targetPlayer.playEffect(location, Effect.ENDER_SIGNAL, 1);
}
}
}
}
}
示例7: handle
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public boolean handle(CommandSender sender, String[] args) {
if (sender instanceof Player) {
Player player = (Player) sender;
if (!PocketPlayer.isPocketPlayer(player)) {
player.sendMessage(ProtocolSupportPocketStuff.PREFIX + "§cThis command can only be executed by PE players");
return true;
}
player.sendMessage(ProtocolSupportPocketStuff.PREFIX + "§aClient Random ID: §e" + PocketPlayer.getClientRandomId(player));
player.sendMessage(ProtocolSupportPocketStuff.PREFIX + "§aClient Version: §e" + PocketPlayer.getClientVersion(player));
player.sendMessage(ProtocolSupportPocketStuff.PREFIX + "§aDevice Model: §e" + PocketPlayer.getDeviceModel(player));
player.sendMessage(ProtocolSupportPocketStuff.PREFIX + "§aOperating System: §e" + PocketPlayer.getOperatingSystem(player));
} else {
sender.sendMessage(ProtocolSupportPocketStuff.PREFIX + "§cThis command can only be executed in game");
}
return true;
}
示例8: conformMinerInvisibility
import org.bukkit.entity.Player; //导入方法依赖的package包/类
/**
* Applies the {@link MinerClass} invisibility {@link PotionEffect} depending on the {@link Player}s {@link Location}.
*
* @param player
* the {@link Player} to apply for
* @param from
* the from {@link Location}
* @param to
* the to {@link Location}
*/
private void conformMinerInvisibility(Player player, Location from, Location to) {
int fromY = from.getBlockY();
int toY = to.getBlockY();
if (fromY != toY && plugin.getPvpClassManager().hasClassEquipped(player, this)) {
boolean isInvisible = player.hasPotionEffect(PotionEffectType.INVISIBILITY);
if (toY > INVISIBILITY_HEIGHT_LEVEL) {
if (fromY <= INVISIBILITY_HEIGHT_LEVEL && isInvisible) {
removeInvisibilitySafely(player);
}
} else {
if (!isInvisible) {
player.addPotionEffect(HEIGHT_INVISIBILITY, true);
player.sendMessage(ChatColor.AQUA + getName() + ChatColor.GRAY + " invisibility added.");
}
}
}
}
示例9: onFactionJoin
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void onFactionJoin(PlayerJoinFactionEvent event) {
Optional<Player> optional = event.getPlayer();
if (optional.isPresent()) {
Player player = optional.get();
long remaining = getRemaining(player);
if (remaining > 0L) {
event.setCancelled(true);
player.sendMessage(ChatColor.RED + "You cannot join factions whilst your " + getDisplayName() + ChatColor.RED + " timer is active [" + ChatColor.BOLD
+ DurationFormatter.getRemaining(getRemaining(player), true, false) + ChatColor.RED + " remaining]");
}
}
}
示例10: sendCenteredMessage
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static void sendCenteredMessage(Player player, String message) {
if (message == null || message.equals("")) return;
int messagePxSize = 0;
boolean previousCode = false;
boolean isBold = false;
for (char c : message.toCharArray()) {
if (c == '&') {
previousCode = true;
} else if (previousCode) {
previousCode = false;
isBold = c == 'l' || c == 'L';
} else {
DefaultFontInfo dFI = DefaultFontInfo.getDefaultFontInfo(c);
messagePxSize += isBold ? dFI.getBoldLength() : dFI.getLength();
messagePxSize++;
}
}
int halvedMessageSize = messagePxSize / 2;
int toCompensate = CENTER_PX - halvedMessageSize;
int spaceLength = DefaultFontInfo.SPACE.getLength() + 1;
int compensated = 0;
StringBuilder sb = new StringBuilder();
while (compensated < toCompensate) {
sb.append(" ");
compensated += spaceLength;
}
player.sendMessage(sb.toString().replace("&", "§") + message.replace("&", "§"));
}
示例11: cast
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public boolean cast(final Player p, PlayerDataRPG pd, int level) {
if (!pd.isStealthed()) {
p.sendMessage(ChatColor.RED + "Shadow Acrobat can only be used while in stealth.");
return false;
}
int durationSeconds = 0;
switch (level) {
case 1:
durationSeconds = 5;
break;
case 2:
durationSeconds = 7;
break;
case 3:
durationSeconds = 9;
break;
case 4:
durationSeconds = 11;
break;
case 5:
durationSeconds = 13;
break;
}
p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, RTicks.seconds(durationSeconds), 4, true, false));
p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, RTicks.seconds(durationSeconds), 2, true, false));
Spell.notify(p, "You feel extremely nimble.");
return true;
}
示例12: onChat
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST)
public void onChat(AsyncPlayerChatEvent evt) {
Player p = evt.getPlayer();
if (!isPlaying(p))
return;
evt.setCancelled(true);
if (currentWord != null) {
if (p.equals(currentPainter)) {
p.sendMessage(ChatColor.RED + "You cannot talk while it is your turn to draw.");
return;
}
if (MetadataManager.hasMetadata(p, "dmtCorrect")) {
p.sendMessage(ChatColor.RED + "You have already guessed the word this round.");
return;
} else if (currentWord.equalsIgnoreCase(evt.getMessage())) {
broadcastPlayers(ChatColor.GREEN.toString() + ChatColor.BOLD + evt.getPlayer().getName() + " guessed the word! +1 Point!");
setScore(p, getScore(p) + 1); // Increase score of guesser
setScore(currentPainter, getScore(currentPainter) + 1); // Increase score of drawer.
MetadataManager.setMetadata(p, "dmtCorrect", true);
return;
}
}
getPlayers().forEach(pl -> pl.sendMessage(ChatColor.YELLOW + p.getName() + ": " + ChatColor.GRAY + evt.getMessage()));
}
示例13: leaveMod
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static void leaveMod(Player p)
{
modMode.remove(p.getName());
p.setGameMode(GameMode.SURVIVAL);
p.getInventory().clear();
loadInventory(p);
p.sendMessage(" §6§ §rYou have §cdisabled §rModerator Mode!");
}
示例14: join
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public boolean join(Player player) {
if (canJoin()) {
getPlayers().add(player);
player.teleport(getLocation());
return true;
} else {
player.sendMessage("Cannot join minigame");
}
return false;
}
示例15: onPlayerTeleport
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler
public void onPlayerTeleport(PlayerTeleportEvent event) {
final Player p = event.getPlayer();
for (String s : BUILD_WORLD) {
if (!event.getFrom().getWorld().getName().equalsIgnoreCase(s) && event.getTo().getWorld().getName().equalsIgnoreCase(s)) {
if (WorldEditCommand.worldedit_pa.containsKey(p.getUniqueId())) {
WorldEditCommand.worldedit_pa.remove(p.getUniqueId()).unsetPermission("worldedit.*");
p.sendMessage("Removed worldedit perms due to worldchange into build world.");
}
}
}
BackCommand.lastLoc.put(p.getName(), event.getFrom());
}