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) { this(plotAreaManager, eventDispatcher, player, false, econHandler); } public BukkitPlayer(@Nonnull final PlotAreaManager plotAreaManager, @Nonnull final EventDispatcher eventDispatcher, @Nonnull final Player player, final boolean offline, @Nullable final EconHandler econHandler) { this(plotAreaManager, eventDispatcher, player, offline, true, econHandler); } public BukkitPlayer(@Nonnull final PlotAreaManager plotAreaManager, @Nonnull final EventDispatcher eventDispatcher, @Nonnull final Player player, final boolean offline, final boolean realPlayer, @Nullable final EconHandler econHandler) { super(plotAreaManager, eventDispatcher, econHandler); this.player = player; this.offline = offline; this.econHandler = econHandler; 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 public long getLastPlayed() { return this.player.getLastPlayed(); } @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; } @Override public void sendTitle(String title, String subtitle, int fadeIn, int stay, int fadeOut) { player.sendTitle(title, subtitle, fadeIn, stay, fadeOut); } 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 public boolean hasPermission(final String permission) { if (this.offline && this.econHandler != null) { return this.econHandler.hasPermission(getName(), permission); } return this.player.hasPermission(permission); } @Override public int hasPermissionRange(final String stub, final int range) { if (hasPermission(Captions.PERMISSION_ADMIN.getTranslated())) { 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 + Captions.PERMISSION_STAR.getTranslated())) { if (hasPermission(n + Captions.PERMISSION_STAR.getTranslated())) { 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