當前位置: 首頁>>代碼示例>>Java>>正文


Java Player.sendMessage方法代碼示例

本文整理匯總了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;
   }
}
 
開發者ID:Chazmondo,項目名稱:DogTags,代碼行數:17,代碼來源:PermCommand.java

示例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!");
}
 
開發者ID:benNek,項目名稱:AsgardAscension,代碼行數:24,代碼來源:TribeCommand.java

示例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;
}
 
開發者ID:SchoolUniform,項目名稱:RealSurvival,代碼行數:23,代碼來源:WorkbenchCMD.java

示例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;
}
 
開發者ID:funkemunky,項目名稱:HCFCore,代碼行數:25,代碼來源:BardClass.java

示例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);
                }
            }
        }
    }
}
 
開發者ID:SlamTheHam,項目名稱:UltraCore,代碼行數:23,代碼來源:Events.java

示例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);
                }
            }
        }
    }
}
 
開發者ID:SlamTheHam,項目名稱:UltraCore,代碼行數:23,代碼來源:Events.java

示例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;
}
 
開發者ID:ProtocolSupport,項目名稱:ProtocolSupportPocketStuff,代碼行數:19,代碼來源:PocketInfoSubCommand.java

示例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.");
            }
        }
    }
}
 
開發者ID:funkemunky,項目名稱:HCFCore,代碼行數:28,代碼來源:MinerClass.java

示例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]");
        }
    }
}
 
開發者ID:funkemunky,項目名稱:HCFCore,代碼行數:14,代碼來源:CombatTimer.java

示例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("&", "§"));
}
 
開發者ID:AlphaHelixDev,項目名稱:AlphaLibary,代碼行數:32,代碼來源:MessageUtil.java

示例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;
}
 
開發者ID:edasaki,項目名稱:ZentrelaRPG,代碼行數:30,代碼來源:ShadowAcrobat.java

示例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()));
}
 
開發者ID:Kneesnap,項目名稱:Kineticraft,代碼行數:28,代碼來源:Pictionary.java

示例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!");
}
 
開發者ID:funkemunky,項目名稱:HCFCore,代碼行數:9,代碼來源:ModeratorMode.java

示例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;
}
 
開發者ID:GigaGamma,項目名稱:SuperiorCraft,代碼行數:11,代碼來源:Minigame.java

示例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());
}
 
開發者ID:edasaki,項目名稱:ZentrelaRPG,代碼行數:14,代碼來源:EnvironmentManager.java


注:本文中的org.bukkit.entity.Player.sendMessage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。