@Override public MCLocation getBedSpawnLocation() { Location loc = p.getBedSpawnLocation(); if(loc == null) { return null; } return new BukkitMCLocation(loc); }
@EventHandler public void onPlayerRespawn(PlayerRespawnEvent e) { Player player = e.getPlayer(); Location bedSpawn = player.getBedSpawnLocation(); //Null if there is no spawn if (bedSpawn == null) { player.teleport(l); } }
/** * {@inheritDoc} */ @Override public Location getLocation(Entity entity) { if (entity instanceof Player) { if (this.playername.isEmpty()) this.knownBedLoc = this.plugin.getBlockSafety().getSafeBedSpawn(((Player) entity).getBedSpawnLocation()); else this.knownBedLoc = this.plugin.getBlockSafety().getSafeBedSpawn(Bukkit.getOfflinePlayer(this.playername).getBedSpawnLocation()); if (this.knownBedLoc == null) { ((Player) entity).sendMessage("The bed was " + ChatColor.RED + "invalid or blocked" + ChatColor.RESET + ". Sorry."); } return this.knownBedLoc; } return null; }
castMessage = getMessage("cast_home"); failMessage = getMessage("no_target_home"); return player == null ? null : player.getBedSpawnLocation(); case WAND: List<LostWand> lostWands = mage.getLostWands();
public boolean run( CommandSender sender, Command cmd, String label, String[] args, Player player) { if (player.getBedSpawnLocation() != null && !player.hasMetadata("teleporting")) { World world = Bukkit.getWorld("world"); final Location spawn = player.getBedSpawnLocation();
Location bedspawn = player.getBedSpawnLocation();
public static void chimaeraExecuteTeleport() { Player player = mcMMOPlayer.getPlayer(); if (Config.getInstance().getChimaeraUseBedSpawn() && player.getBedSpawnLocation() != null) { player.teleport(player.getBedSpawnLocation()); } else { Location spawnLocation = player.getWorld().getSpawnLocation(); if (spawnLocation.getBlock().getType() == Material.AIR) { player.teleport(spawnLocation); } else { player.teleport(player.getWorld().getHighestBlockAt(spawnLocation).getLocation()); } } player.getInventory().setItemInMainHand(new ItemStack(getChimaeraWing(player.getInventory().getItemInMainHand().getAmount() - Config.getInstance().getChimaeraUseCost()))); player.updateInventory(); mcMMOPlayer.actualizeChimeraWingLastUse(); mcMMOPlayer.setTeleportCommenceLocation(null); if (Config.getInstance().getChimaeraSoundEnabled()) { SoundManager.sendSound(player, location, SoundType.CHIMAERA_WING); } NotificationManager.sendPlayerInformation(player, NotificationType.ITEM_MESSAGE, "Item.ChimaeraWing.Pass"); }
private PowerResult<Double> rescue(Player target, ItemStack stack, EntityDamageEvent event, boolean canceled) { if (!checkCooldown(this, target, cooldown, true, true)) return PowerResult.cd(); if (!getItem().consumeDurability(stack, cost)) return PowerResult.cost(); target.sendMessage(I18n.format("power.rescue.info")); DamageCause cause = event.getCause(); if (!canceled) { target.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 2, 255)); target.setHealth(healthTrigger + event.getDamage()); } else { event.setCancelled(true); } target.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 200, 10), true); target.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 400, 2), true); target.addPotionEffect(new PotionEffect(PotionEffectType.SATURATION, 400, 2), true); target.getWorld().playSound(target.getLocation(), Sound.BLOCK_ENCHANTMENT_TABLE_USE, 10, 1); if (inPlace && cause != DamageCause.DRAGON_BREATH && cause != DamageCause.DROWNING && cause != DamageCause.SUFFOCATION && cause != DamageCause.VOID) { target.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, 160, 10)); } else if (useBed && target.getBedSpawnLocation() != null) target.teleport(target.getBedSpawnLocation()); else target.teleport(target.getWorld().getSpawnLocation()); return PowerResult.ok(0.0); } }
return new Waypoint(type, controller.getTownLocation(player), context.getMessage("title_town", "Town"), context.getMessage("cast_town"), context.getMessage("no_target_town"), context.getMessage("description_town", ""), getIcon(context, parameters, "icon_town"), false); case HOME: Location bedLocation = player == null ? null : player.getBedSpawnLocation(); if (bedLocation != null) { bedLocation.setX(bedLocation.getX() + 0.5);