3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-25 10:30:04 +01:00

Just use instanceof

Dieser Commit ist enthalten in:
Jesse Boyd 2019-04-11 02:17:45 +10:00
Ursprung f0d646a9a1
Commit 2e1b7676eb
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 59F1DE6293AF6E1F
2 geänderte Dateien mit 8 neuen und 11 gelöschten Zeilen

Datei anzeigen

@ -74,17 +74,10 @@ public abstract class FawePlayer<T> extends Metadatable {
}
if (obj instanceof Player) {
Player actor = LocationMaskedPlayerWrapper.unwrap((Player) obj);
if (obj.getClass().getName().endsWith("PlayerProxy")) {
try {
Field fieldBasePlayer = actor.getClass().getDeclaredField("basePlayer");
fieldBasePlayer.setAccessible(true);
Player player = (Player) fieldBasePlayer.get(actor);
FawePlayer<Object> result = wrap(player);
return (FawePlayer<V>) (result == null ? wrap(player.getName()) : result);
} catch (Throwable e) {
MainUtil.handleError(e);
return Fawe.imp().wrap(actor.getName());
}
if (obj instanceof PlayerProxy) {
Player player = ((PlayerProxy) obj).getBasePlayer();
FawePlayer<Object> result = wrap(player);
return (FawePlayer<V>) (result == null ? wrap(player.getName()) : result);
} else if (obj instanceof PlayerWrapper) {
return wrap(((PlayerWrapper) obj).getParent());
} else {

Datei anzeigen

@ -189,5 +189,9 @@ public class PlayerProxy extends AbstractPlayerActor {
public <B extends BlockStateHolder<B>> void sendFakeBlock(BlockVector3 pos, B block) {
basePlayer.sendFakeBlock(pos, block);
}
public Player getBasePlayer() {
return basePlayer;
}
}