Please do not use this method. Instead use * BukkitUtil.getPlayer(Player), as it caches player objects.
* * @param player Bukkit player instance */ public BukkitPlayer(@Nonnull final PlotAreaManager plotAreaManager, @Nonnull final EventDispatcher eventDispatcher, @Nonnull final Player player, @Nullable final EconHandler econHandler, @Nonnull final PermissionHandler permissionHandler) { this(plotAreaManager, eventDispatcher, player, false, econHandler, permissionHandler); } public BukkitPlayer(@Nonnull final PlotAreaManager plotAreaManager, @Nonnull final EventDispatcher eventDispatcher, @Nonnull final Player player, final boolean realPlayer, @Nullable final EconHandler econHandler, @Nonnull final PermissionHandler permissionHandler) { super(plotAreaManager, eventDispatcher, econHandler, permissionHandler); this.player = player; this.setupPermissionProfile(); if (realPlayer) { super.populatePersistentMetaMap(); } } @Override public Actor toActor() { return BukkitAdapter.adapt(player); } @Override public Player getPlatformPlayer() { return this.player; } @Nonnull @Override public UUID getUUID() { if (Settings.UUID.OFFLINE) { if (Settings.UUID.FORCE_LOWERCASE) { return UUID.nameUUIDFromBytes(("OfflinePlayer:" + getName().toLowerCase()).getBytes(Charsets.UTF_8)); } else { return UUID.nameUUIDFromBytes(("OfflinePlayer:" + getName()).getBytes(Charsets.UTF_8)); } } return player.getUniqueId(); } @Override @Nonnegative public long getLastPlayed() { return this.player.getLastSeen(); } @Override public boolean canTeleport(@Nonnull final Location location) { final org.bukkit.Location to = BukkitUtil.adapt(location); final org.bukkit.Location from = player.getLocation(); PlayerTeleportEvent event = new PlayerTeleportEvent(player, from, to); callEvent(event); if (event.isCancelled() || !event.getTo().equals(to)) { return false; } event = new PlayerTeleportEvent(player, to, from); callEvent(event); return true; } private void callEvent(@Nonnull final Event event) { final RegisteredListener[] listeners = event.getHandlers().getRegisteredListeners(); for (final RegisteredListener listener : listeners) { if (listener.getPlugin().getName().equals(PlotSquared.platform().getPluginName())) { continue; } try { listener.callEvent(event); } catch (final EventException e) { e.printStackTrace(); } } } @Override @Nonnegative public int hasPermissionRange(@Nonnull final String stub, @Nonnegative final int range) { if (hasPermission(Permission.PERMISSION_ADMIN.toString())) { return Integer.MAX_VALUE; } final String[] nodes = stub.split("\\."); final StringBuilder n = new StringBuilder(); for (int i = 0; i < (nodes.length - 1); i++) { n.append(nodes[i]).append("."); if (!stub.equals(n + Permission.PERMISSION_STAR.toString())) { if (hasPermission(n + Permission.PERMISSION_STAR.toString())) { return Integer.MAX_VALUE; } } } if (hasPermission(stub + ".*")) { return Integer.MAX_VALUE; } int max = 0; if (CHECK_EFFECTIVE) { boolean hasAny = false; String stubPlus = stub + "."; final Set