本文整理汇总了Java中org.bukkit.entity.Player.playEffect方法的典型用法代码示例。如果您正苦于以下问题:Java Player.playEffect方法的具体用法?Java Player.playEffect怎么用?Java Player.playEffect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.entity.Player
的用法示例。
在下文中一共展示了Player.playEffect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
}
}
}
示例2: 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);
}
}
}
}
}
示例3: 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);
}
}
}
}
}
示例4: 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);
}
}
}
}
}
示例5: removePlayer
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void removePlayer(Player player)
{
super.removePlayer(player);
this.expected.remove(player.getUniqueId());
player.setResourcePack("http://resources.samagames.net/samareset.zip");
player.playEffect(player.getLocation(), Effect.RECORD_PLAY, 0);
}
示例6: onCommand
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (sender instanceof ConsoleCommandSender) {
return true;
}
Player player = (Player) sender;
Location location = player.getLocation();
if (label.equalsIgnoreCase("tphere")) {
if (!(args.length == 0)) {
if (args.length == 0) {
player.sendMessage(ChatColor.RED + "Please specify the player you want to teleport to or use /teleport help for more info.");
TeleportHereMenu.newInventory(sender);
return true;
}
if (!sender.hasPermission("core.tp")) {
player.sendMessage(ChatColor.RED + "Sorry, you need core.tp permission to execute /tphere.");
return true;
}
if (args[0].equals(player.getName())) {
player.sendMessage(ChatColor.RED + "Lol, you cannot teleport to yourself dummy.");
return true;
}
Player target1 = Bukkit.getServer().getPlayer(args[1]);
if (target1 == null) {
player.sendMessage(ChatColor.RED + "Can't find user specified.");
return true;
}
target1.teleport(player);
player.sendMessage(ChatColor.YELLOW + "You've teleported " + ChatColor.GREEN + target1.getDisplayName() + ChatColor.YELLOW + " to you!");
player.playSound(location, Sound.ENTITY_ENDERMEN_TELEPORT, 100, 1);
player.playEffect(location, Effect.ENDER_SIGNAL, 1);
target1.playEffect(location, Effect.ENDER_SIGNAL, 1);
return true;
}
}
return false;
}
示例7: onCommand
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@SuppressWarnings("unused")
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (sender instanceof ConsoleCommandSender) {
return true;
}
Player player = (Player) sender;
Location location = player.getLocation();
if (label.equalsIgnoreCase("tppos")) {
if (args.length == 0) {
player.sendMessage(ChatColor.RED + "Please specify the location you want to teleport to or use /teleport help for more info.");
return true;
}
if (!sender.hasPermission("core.tp")) {
player.sendMessage(ChatColor.RED + "Sorry, you need core.tp permission to execute /teleport.");
return true;
}
Location loc = new Location(player.getLocation().getWorld(), Integer.parseInt(args[0]), Integer.parseInt(args[1]), Integer.parseInt(args[2]));
if (loc == null) {
player.sendMessage(ChatColor.RED + "Location invalid or not typed correctly do /teleport help or contact an admin for help");
return true;
}
player.teleport(loc);
player.sendMessage(ChatColor.YELLOW + "You have been teleported to: " + ChatColor.GREEN + "X: " + args[0] + ", Y: " + args[1] + ", Z: " + args[2]);
player.playSound(location, Sound.ENTITY_ENDERMEN_TELEPORT, 100, 1);
player.playEffect(location, Effect.ENDER_SIGNAL, 1);
return true;
}
return false;
}
示例8: onCommand
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (sender instanceof ConsoleCommandSender) {
return true;
}
Player player = (Player) sender;
Location location = player.getLocation();
if (label.equalsIgnoreCase("tphere")) {
if (!(args.length == 0)) {
if (args.length == 0) {
player.sendMessage(ChatColor.RED + "Please specify the player you want to teleport to or use /teleport help for more info.");
TeleportHereMenu.newInventory(sender);
return true;
}
if (!sender.hasPermission("core.tp")) {
player.sendMessage(ChatColor.RED + "Sorry, you need core.tp permission to execute /tphere.");
return true;
}
if (args[0].equals(player.getName())) {
player.sendMessage(ChatColor.RED + "Lol, you cannot teleport to yourself dummy.");
return true;
}
Player target1 = Bukkit.getServer().getPlayer(args[1]);
if (target1 == null) {
player.sendMessage(ChatColor.RED + "Can't find user specified.");
return true;
}
target1.teleport(player);
player.sendMessage(ChatColor.YELLOW + "You've teleported " + ChatColor.GREEN + target1.getDisplayName() + ChatColor.YELLOW + " to you!");
player.playSound(location, Sound.ENTITY_ENDERMEN_TELEPORT, 100, 1);
player.playEffect(location, Effect.ENDER_SIGNAL, 1);
target1.playEffect(location, Effect.ENDER_SIGNAL, 1);
return true;
}
}
return false;
}
示例9: onCommand
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@SuppressWarnings("unused")
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (sender instanceof ConsoleCommandSender) {
return true;
}
Player player = (Player) sender;
Location location = player.getLocation();
if (label.equalsIgnoreCase("tppos")) {
if (args.length == 0) {
player.sendMessage(ChatColor.RED + "Please specify the location you want to teleport to or use /teleport help for more info.");
return true;
}
if (!sender.hasPermission("core.tp")) {
player.sendMessage(ChatColor.RED + "Sorry, you need core.tp permission to execute /teleport.");
return true;
}
Location loc = new Location(player.getLocation().getWorld(), Integer.parseInt(args[0]), Integer.parseInt(args[1]), Integer.parseInt(args[2]));
if (loc == null) {
player.sendMessage(ChatColor.RED + "Location invalid or not typed correctly do /teleport help or contact an admin for help");
return true;
}
player.teleport(loc);
player.sendMessage(ChatColor.YELLOW + "You have been teleported to: " + ChatColor.GREEN + "X: " + args[0] + ", Y: " + args[1] + ", Z: " + args[2]);
player.playSound(location, Sound.ENTITY_ENDERMEN_TELEPORT, 100, 1);
player.playEffect(location, Effect.ENDER_SIGNAL, 1);
return true;
}
return false;
}
示例10: takeOff
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static void takeOff(Player observer, Location loc) {
for(int i = 0; i < GizmoConfig.SMOKE_COUNT; i++) {
double angle = 2 * Math.PI * i / GizmoConfig.SMOKE_COUNT;
Location base = loc.clone().add(new Vector(GizmoConfig.SMOKE_RADIUS * Math.cos(angle), 0, GizmoConfig.SMOKE_RADIUS * Math.sin(angle)));
for(int j = 0; j <= 8; j++) {
observer.playEffect(base, Effect.SMOKE, j);
}
}
}
示例11: spawnEffect
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static void spawnEffect(Player player, Location location, Effect effect) {
player.playEffect(location, effect, null);
}
示例12: particle
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public static void particle(Location l, Entity e, Effect ef, Material param) {
for (Player p : e.getWorld().getPlayers()) {
p.playEffect(l, ef, param);
}
}
示例13: onChat
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@EventHandler(priority = EventPriority.LOW)
public void onChat(AsyncPlayerChatEvent event) {
if (AddMin.fchat.containsKey(event.getPlayer())) {
event.setCancelled(true);
SuperiorCraft.plugin.onChat(new AsyncPlayerChatEvent(true, AddMin.fchat.get(event.getPlayer()), event.getMessage(), event.getRecipients()));
}
/*if (getConfig().get("players." + event.getPlayer().getName() + ".muted") == "yes") {
event.setCancelled(true);
return;
}
if (!event.getPlayer().isOp()) {
event.setFormat(ChatColor.LIGHT_PURPLE + "%s" + ChatColor.DARK_AQUA + " > " + ChatColor.GREEN + "%s");
}
else */if (event.getPlayer().isOp()) {
//System.out.println();
for (String url : WebUtil.extractUrls(event.getMessage())) {
//System.out.println(arg0);
event.setMessage(event.getMessage().replace(url, WebUtil.getPageTitle(url) + " [ " + url + " ]"));
}
//event.setFormat(ChatColor.LIGHT_PURPLE + getConfig().getString("players." + event.getPlayer().getName() + ".name") + ChatColor.DARK_AQUA + getConfig().getString("players." + event.getPlayer().getName() + ".suffix") + "> " + ChatColor.GREEN + event.getMessage());
//event.setCancelled(true);
//return;
}
for (PlayerData data : AntiCheat.data) {
if (data.getPlayer().equals(event.getPlayer())) {
HashMap<String, String> replacements = new HashMap<String, String>();
replacements.put("%playername%", event.getPlayer().getDisplayName());
replacements.put("%rankname%", data.getRank().getRankName());
event.setFormat(StringUtil.replaceAll(replacements, ChatColor.translateAlternateColorCodes('&', data.getRank().getPlayerPrefix())) + " " + StringUtil.replaceAll(replacements, ChatColor.translateAlternateColorCodes('&', data.getRank().getPlayerName())) + "�r" + ChatColor.AQUA + " > " + event.getMessage());
}
}
if (!event.isCancelled()) {
for (Player pl : event.getRecipients()) {
//pl.play
pl.playEffect(pl.getLocation(), Effect.CLICK2, 50);
pl.sendMessage(event.getFormat());
}
}
event.setCancelled(true);
}
示例14: teleport
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void teleport(Player player)
{
super.teleport(player);
player.playEffect(player.getLocation(), Effect.RECORD_PLAY, this.coverId);
}
示例15: playMusic
import org.bukkit.entity.Player; //导入方法依赖的package包/类
private void playMusic(Player player)
{
player.playEffect(player.getLocation(), Effect.RECORD_PLAY, Material.GREEN_RECORD.getId());
}