Search in sources :

Example 6 with PlayerManager

use of net.minecraft.server.PlayerManager in project dynmap by webbukkit.

the class FabricServer method isPlayerBanned.

@Override
public boolean isPlayerBanned(String pid) {
    PlayerManager scm = server.getPlayerManager();
    BannedPlayerList bl = scm.getUserBanList();
    try {
        return bl.contains(getProfileByName(pid).get());
    } catch (NoSuchElementException e) {
        /* If this profile doesn't exist, default to "banned" for good measure. */
        return true;
    }
}
Also used : BannedPlayerList(net.minecraft.server.BannedPlayerList) PlayerManager(net.minecraft.server.PlayerManager)

Example 7 with PlayerManager

use of net.minecraft.server.PlayerManager in project dynmap by webbukkit.

the class FabricServer method isPlayerBanned.

@Override
public boolean isPlayerBanned(String pid) {
    PlayerManager scm = server.getPlayerManager();
    BannedPlayerList bl = scm.getUserBanList();
    try {
        return bl.contains(getProfileByName(pid).get());
    } catch (NoSuchElementException e) {
        /* If this profile doesn't exist, default to "banned" for good measure. */
        return true;
    }
}
Also used : BannedPlayerList(net.minecraft.server.BannedPlayerList) PlayerManager(net.minecraft.server.PlayerManager)

Example 8 with PlayerManager

use of net.minecraft.server.PlayerManager in project FastAsyncWorldEdit by IntellectualSites.

the class FabricPlatform method getConnectedUsers.

@Override
public Collection<Actor> getConnectedUsers() {
    List<Actor> users = new ArrayList<>();
    PlayerManager scm = server.getPlayerManager();
    for (ServerPlayerEntity entity : scm.getPlayerList()) {
        if (entity != null) {
            users.add(new FabricPlayer(entity));
        }
    }
    return users;
}
Also used : PlayerManager(net.minecraft.server.PlayerManager) Actor(com.sk89q.worldedit.extension.platform.Actor) ArrayList(java.util.ArrayList) ServerPlayerEntity(net.minecraft.server.network.ServerPlayerEntity)

Example 9 with PlayerManager

use of net.minecraft.server.PlayerManager in project pingspam by BasiqueEvangelist.

the class ServerNetworkLogic method sendServerAnnouncement.

public static void sendServerAnnouncement(ServerPlayerEntity player, ClientConnection conn) {
    if (!ServerPlayNetworking.canSend(player, PingSpamPackets.ANNOUNCE))
        return;
    PlayerManager manager = player.server.getPlayerManager();
    PacketByteBuf newBuf = PacketByteBufs.create();
    newBuf.writeBoolean(Permissions.check(player, "pingspam.ping.everyone", 2));
    newBuf.writeBoolean(Permissions.check(player, "pingspam.ping.online", 2));
    newBuf.writeBoolean(Permissions.check(player, "pingspam.ping.offline", 2));
    newBuf.writeBoolean(Permissions.check(player, "pingspam.ping.player", true));
    List<String> possibleNames = NameLogic.listValidNames(manager);
    newBuf.writeVarInt(possibleNames.size());
    for (String possibleName : possibleNames) {
        newBuf.writeString(possibleName);
    }
    conn.send(ServerPlayNetworking.createS2CPacket(PingSpamPackets.ANNOUNCE, newBuf));
}
Also used : PlayerManager(net.minecraft.server.PlayerManager) PacketByteBuf(net.minecraft.network.PacketByteBuf)

Example 10 with PlayerManager

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);
}
Also used : BannedPlayerList(net.minecraft.server.BannedPlayerList) PlayerManager(net.minecraft.server.PlayerManager)

Aggregations

PlayerManager (net.minecraft.server.PlayerManager)13 BannedPlayerList (net.minecraft.server.BannedPlayerList)9 ServerPlayerEntity (net.minecraft.server.network.ServerPlayerEntity)3 ServerCommandSource (net.minecraft.server.command.ServerCommandSource)2 SettingsManager (carpet.settings.SettingsManager)1 GameProfile (com.mojang.authlib.GameProfile)1 CommandDispatcher (com.mojang.brigadier.CommandDispatcher)1 Message (com.mojang.brigadier.Message)1 StringArgumentType (com.mojang.brigadier.arguments.StringArgumentType)1 LiteralArgumentBuilder (com.mojang.brigadier.builder.LiteralArgumentBuilder)1 CommandSyntaxException (com.mojang.brigadier.exceptions.CommandSyntaxException)1 SimpleCommandExceptionType (com.mojang.brigadier.exceptions.SimpleCommandExceptionType)1 Dynamic (com.mojang.serialization.Dynamic)1 Actor (com.sk89q.worldedit.extension.platform.Actor)1 RugSettings (de.rubixdev.rug.RugSettings)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 CommandSource.suggestMatching (net.minecraft.command.CommandSource.suggestMatching)1 NbtCompound (net.minecraft.nbt.NbtCompound)1 MessageType (net.minecraft.network.MessageType)1