3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-07 12:00:07 +01:00

Allow nullable BukkitPlayers for whatever reason WorldGuard needs them for I guess? (#706)

Dieser Commit ist enthalten in:
dordsor21 2020-10-14 19:56:16 +01:00 committet von GitHub
Ursprung b86e452b80
Commit 5508b415c9
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -67,6 +67,7 @@ import java.util.Locale;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class BukkitPlayer extends AbstractPlayerActor {
@ -74,19 +75,29 @@ public class BukkitPlayer extends AbstractPlayerActor {
private final Player player;
private final WorldEditPlugin plugin;
private final PermissionAttachment permAttachment;
public BukkitPlayer(Player player) {
super(getExistingMap(WorldEditPlugin.getInstance(), player));
/**
* This constructs a new {@link BukkitPlayer} for the given {@link Player}.
*
* @param player The corresponding {@link Player} or null if you need a null WorldEdit player for some reason.
*/
public BukkitPlayer(@Nullable Player player) {
super(player != null ? getExistingMap(WorldEditPlugin.getInstance(), player) : new ConcurrentHashMap<>());
this.plugin = WorldEditPlugin.getInstance();
this.player = player;
this.permAttachment = plugin.getPermissionAttachmentManager().getOrAddAttachment(player);
}
public BukkitPlayer(WorldEditPlugin plugin, Player player) {
/**
* This constructs a new {@link BukkitPlayer} for the given {@link Player}.
*
* @param plugin The running instance of {@link WorldEditPlugin}
* @param player The corresponding {@link Player} or null if you need a null WorldEdit player for some reason.
*/
public BukkitPlayer(@Nonnull WorldEditPlugin plugin, @Nullable Player player) {
this.plugin = plugin;
this.player = player;
this.permAttachment = plugin.getPermissionAttachmentManager().getOrAddAttachment(player);
if (Settings.IMP.CLIPBOARD.USE_DISK) {
if (player != null && Settings.IMP.CLIPBOARD.USE_DISK) {
loadClipboardFromDisk();
}
}