use of net.minecraft.server.PlayerManager in project Rug by RubixDev.
the class PeekCommand method execute.
private static int execute(CommandContext<ServerCommandSource> context, boolean isEnderChest) throws CommandSyntaxException {
ServerCommandSource source = context.getSource();
PlayerManager playerManager = source.getServer().getPlayerManager();
GameProfile targetPlayerProfile = GameProfileArgumentType.getProfileArgument(context, "player").iterator().next();
ServerPlayerEntity targetPlayer = playerManager.getPlayer(targetPlayerProfile.getName());
ServerPlayerEntity executingPlayer = source.getPlayer();
if (targetPlayer == null) {
targetPlayer = playerManager.createPlayer(targetPlayerProfile);
NbtCompound targetPlayerData = playerManager.loadPlayerData(targetPlayer);
if (targetPlayerData == null) {
source.sendError(Text.of("Targeted player's data could not be found. Was he ever in this world?"));
return 0;
}
@SuppressWarnings("deprecation") ServerWorld world = source.getServer().getWorld(DimensionType.worldFromDimensionNbt(new Dynamic<>(NbtOps.INSTANCE, targetPlayerData.get("Dimension"))).result().orElseThrow());
if (world != null)
targetPlayer.setWorld(world);
}
if (isEnderChest) {
showEnderChest(executingPlayer, targetPlayer);
} else {
showInventory(executingPlayer, targetPlayer);
}
return 1;
}
use of net.minecraft.server.PlayerManager in project dynmap by webbukkit.
the class FabricServer method checkPlayerPermissions.
@Override
public Set<String> checkPlayerPermissions(String player, Set<String> perms) {
PlayerManager scm = server.getPlayerManager();
if (scm == null)
return Collections.emptySet();
BannedPlayerList bl = scm.getUserBanList();
if (bl == null)
return Collections.emptySet();
if (bl.contains(getProfileByName(player))) {
return Collections.emptySet();
}
Set<String> rslt = plugin.hasOfflinePermissions(player, perms);
if (rslt == null) {
rslt = new HashSet<String>();
if (plugin.isOp(player)) {
rslt.addAll(perms);
}
}
return rslt;
}
use of net.minecraft.server.PlayerManager in project dynmap by webbukkit.
the class FabricServer method checkPlayerPermissions.
@Override
public Set<String> checkPlayerPermissions(String player, Set<String> perms) {
PlayerManager scm = server.getPlayerManager();
if (scm == null)
return Collections.emptySet();
BannedPlayerList bl = scm.getUserBanList();
if (bl == null)
return Collections.emptySet();
if (bl.contains(getProfileByName(player))) {
return Collections.emptySet();
}
Set<String> rslt = plugin.hasOfflinePermissions(player, perms);
if (rslt == null) {
rslt = new HashSet<String>();
if (plugin.isOp(player)) {
rslt.addAll(perms);
}
}
return rslt;
}
use of net.minecraft.server.PlayerManager in project dynmap by webbukkit.
the class FabricServer method checkPlayerPermission.
@Override
public boolean checkPlayerPermission(String player, String perm) {
PlayerManager scm = server.getPlayerManager();
if (scm == null)
return false;
BannedPlayerList bl = scm.getUserBanList();
if (bl == null)
return false;
if (bl.contains(getProfileByName(player))) {
return false;
}
return plugin.hasOfflinePermission(player, perm);
}
use of net.minecraft.server.PlayerManager in project dynmap by webbukkit.
the class FabricServer method checkPlayerPermissions.
@Override
public Set<String> checkPlayerPermissions(String player, Set<String> perms) {
PlayerManager scm = server.getPlayerManager();
if (scm == null)
return Collections.emptySet();
BannedPlayerList bl = scm.getUserBanList();
if (bl == null)
return Collections.emptySet();
if (bl.contains(getProfileByName(player))) {
return Collections.emptySet();
}
Set<String> rslt = plugin.hasOfflinePermissions(player, perms);
if (rslt == null) {
rslt = new HashSet<String>();
if (plugin.isOp(player)) {
rslt.addAll(perms);
}
}
return rslt;
}
Aggregations