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

The following examples show how to use org.bukkit.entity.Player#hideTitle() . 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: MatchAnnouncer.java    From PGM with GNU Affero General Public License v3.0 5 votes vote down vote up
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void clearTitle(PlayerJoinMatchEvent event) {
  final Player player = event.getPlayer().getBukkit();

  player.hideTitle();

  // Bukkit assumes a player's locale is "en_US" before it receives a player's setting packet.
  // Thus, we delay sending this prominent message, so it is more likely its in the right locale.
  event
      .getPlayer()
      .getMatch()
      .getExecutor(MatchScope.LOADED)
      .schedule(() -> sendWelcomeMessage(event.getPlayer()), 500, TimeUnit.MILLISECONDS);
}
 
Example 2
Source File: Utils.java    From ProjectAres with GNU Affero General Public License v3.0 5 votes vote down vote up
public static void resetPlayer(Player player) {
    player.getInventory().clear();
    player.getInventory().setChestplate(new ItemBuilder().material(Material.ELYTRA).unbreakable(true).get());
    player.setGameMode(GameMode.ADVENTURE);
    player.setAllowFlight(player.hasPermission("lobby.fly"));
    player.setWalkSpeed(0.2f);
    player.setFlySpeed(0.1f);
    player.setPotionParticles(false);
    player.hideTitle();
    player.getWorld().spawnParticle(Particle.CLOUD, player.getLocation(), 15, 0.5, 0.5, 0.5, 0);
}
 
Example 3
Source File: FreezeModule.java    From CardinalPGM with MIT License 5 votes vote down vote up
private void unfreezePlayer(Player player, CommandSender freezer) {
    if (!frozenPlayers.contains(player)) return;
    player.sendMessage(ChatColor.GREEN + new LocalizedChatMessage(ChatConstant.GENERIC_UNFROZEN_BY, Players.getName(freezer)).getMessage(player.getLocale()));
    ChatUtil.getAdminChannel().sendLocalizedMessage(new UnlocalizedChatMessage(AdminChannel.getPrefix() + "{0}", new LocalizedChatMessage(ChatConstant.GENERIC_UNFROZE, Players.getName(freezer) + ChatColor.RED, player.getDisplayName())));
    player.playSound(player.getLocation(), Sound.ENTITY_ENDERDRAGON_GROWL, 1, 2);
    titleRespawn.destroyArmorStandPacket(player);
    player.hideTitle();
    frozenPlayers.remove(player);
}
 
Example 4
Source File: Players.java    From CardinalPGM with MIT License 5 votes vote down vote up
public static void resetPlayer(Player player, boolean heal) {
    if (heal) player.setHealth(player.getMaxHealth());
    player.setFoodLevel(20);
    player.setSaturation(20);
    player.getInventory().clear();
    player.getInventory().setArmorContents(new ItemStack[]{new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR)});
    for (PotionEffect effect : player.getActivePotionEffects()) {
        try {
            player.removePotionEffect(effect.getType());
        } catch (NullPointerException ignored) {
        }
    }
    player.setTotalExperience(0);
    player.setExp(0);
    player.setLevel(0);
    player.setPotionParticles(false);
    player.setWalkSpeed(0.2F);
    player.setFlySpeed(0.1F);
    player.setKnockbackReduction(0);
    player.setArrowsStuck(0);

    player.hideTitle();

    player.setFastNaturalRegeneration(false);

    for (Attribute attribute : Attribute.values()) {
        if (player.getAttribute(attribute) == null) continue;
        for (AttributeModifier modifier : player.getAttribute(attribute).getModifiers()) {
            player.getAttribute(attribute).removeModifier(modifier);
        }
    }
    player.getAttribute(Attribute.GENERIC_ATTACK_SPEED).addModifier(new AttributeModifier(UUID.randomUUID(), "generic.attackSpeed", 4.001D, AttributeModifier.Operation.ADD_SCALAR));
    player.getAttribute(Attribute.ARROW_ACCURACY).addModifier(new AttributeModifier(UUID.randomUUID(), "sportbukkit.arrowAccuracy", -1D, AttributeModifier.Operation.ADD_NUMBER));
    player.getAttribute(Attribute.ARROW_VELOCITY_TRANSFER).addModifier(new AttributeModifier(UUID.randomUUID(), "sportbukkit.arrowVelocityTransfer", -1D, AttributeModifier.Operation.ADD_NUMBER));
}