Please do not use this method. Instead use * BukkitUtil.getPlayer(Player), as it caches player objects.
* * @param plotAreaManager PlotAreaManager instance * @param eventDispatcher EventDispatcher instance * @param player Bukkit player instance * @param permissionHandler PermissionHandler instance */ public BukkitPlayer( final @NonNull PlotAreaManager plotAreaManager, final @NonNull EventDispatcher eventDispatcher, final @NonNull Player player, final @NonNull PermissionHandler permissionHandler ) { this(plotAreaManager, eventDispatcher, player, false, permissionHandler); } public BukkitPlayer( final @NonNull PlotAreaManager plotAreaManager, final @NonNull EventDispatcher eventDispatcher, final @NonNull Player player, final boolean realPlayer, final @NonNull PermissionHandler permissionHandler ) { super(plotAreaManager, eventDispatcher, 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(final @NonNull 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; } @SuppressWarnings("CatchAndPrintStackTrace") private void callEvent(final @NonNull Event event) { final RegisteredListener[] listeners = event.getHandlers().getRegisteredListeners(); for (final RegisteredListener listener : listeners) { if (listener.getPlugin().getName().equals(PlotSquared.platform().pluginName())) { continue; } try { listener.callEvent(event); } catch (final EventException e) { e.printStackTrace(); } } } @SuppressWarnings("StringSplitter") @Override @NonNegative public int hasPermissionRange( final @NonNull 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