Search in sources :

Example 1 with ServerOpList

use of net.minecraft.server.players.ServerOpList in project Denizen-For-Bukkit by DenizenScript.

the class PlayerHelperImpl method setTemporaryOp.

@Override
public void setTemporaryOp(Player player, boolean op) {
    MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
    GameProfile profile = ((CraftPlayer) player).getProfile();
    ServerOpList opList = server.getPlayerList().getOps();
    if (op) {
        int permLevel = server.getOperatorUserPermissionLevel();
        opList.add(new ServerOpListEntry(profile, permLevel, opList.canBypassPlayerLimit(profile)));
    } else {
        opList.remove(profile);
    }
    player.recalculatePermissions();
}
Also used : GameProfile(com.mojang.authlib.GameProfile) CraftPlayer(org.bukkit.craftbukkit.v1_17_R1.entity.CraftPlayer) CraftServer(org.bukkit.craftbukkit.v1_17_R1.CraftServer) ServerOpListEntry(net.minecraft.server.players.ServerOpListEntry) MinecraftServer(net.minecraft.server.MinecraftServer) ServerOpList(net.minecraft.server.players.ServerOpList)

Example 2 with ServerOpList

use of net.minecraft.server.players.ServerOpList in project Denizen-For-Bukkit by DenizenScript.

the class PlayerHelperImpl method setTemporaryOp.

@Override
public void setTemporaryOp(Player player, boolean op) {
    MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
    GameProfile profile = ((CraftPlayer) player).getProfile();
    ServerOpList opList = server.getPlayerList().getOps();
    if (op) {
        int permLevel = server.getOperatorUserPermissionLevel();
        opList.add(new ServerOpListEntry(profile, permLevel, opList.canBypassPlayerLimit(profile)));
    } else {
        opList.remove(profile);
    }
    player.recalculatePermissions();
}
Also used : GameProfile(com.mojang.authlib.GameProfile) CraftPlayer(org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer) CraftServer(org.bukkit.craftbukkit.v1_18_R1.CraftServer) ServerOpListEntry(net.minecraft.server.players.ServerOpListEntry) MinecraftServer(net.minecraft.server.MinecraftServer) ServerOpList(net.minecraft.server.players.ServerOpList)

Aggregations

GameProfile (com.mojang.authlib.GameProfile)2 MinecraftServer (net.minecraft.server.MinecraftServer)2 ServerOpList (net.minecraft.server.players.ServerOpList)2 ServerOpListEntry (net.minecraft.server.players.ServerOpListEntry)2 CraftServer (org.bukkit.craftbukkit.v1_17_R1.CraftServer)1 CraftPlayer (org.bukkit.craftbukkit.v1_17_R1.entity.CraftPlayer)1 CraftServer (org.bukkit.craftbukkit.v1_18_R1.CraftServer)1 CraftPlayer (org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer)1