Useful Methods from Bukkit

  1. ChatColor.[ColorCode]
    Change the color of the following chat.
    Reminding: what follows after with a “+” and must be a String. Even if it getLogger().info or print will automatically change non-String objects into string with the toString method, this one won’t work. We need to manually use object.toString if it’s after this method and connect with “+”.

  2. Block.setType(Material.material)
    Use Material.air to set to blank.
    Use Location.getBlock to get Block or Bukkit.getBlock to get block.

  3. playEffect(Location loc, Effect effect, int data)

  4. List<Entity> near = location.getWorld().getEntities();
    Get all entities in the world

  5. e.getLocation().distance(location) <= radius
    Get distance between two location

  6. entity.setVelocity(new Vector(5.0D, e.getBlock().getLocation().getY(), 5.0D));
    Push entity

  7. for(Entity entity : e.getPlayer().getNearbyEntities(20.0D, 20.0D, 20.0D))
    A cycle for each entity nearby

  8. ((CraftPlayer) player).getHandle().a(true, false, false)
    Eject player from a bed by opening a box to him.