PlayerMap.java

net.minecraft.server.level.PlayerMap

信息

  • 全限定名:net.minecraft.server.level.PlayerMap
  • 类型:public final class
  • 包:net.minecraft.server.level
  • 源码路径:src/main/java/net/minecraft/server/level/PlayerMap.java
  • 起始行号:L7
  • 职责:

    TODO

字段/常量

  • players
    • 类型: Object2BooleanMap<ServerPlayer>
    • 修饰符: private final
    • 源码定位: L8
    • 说明:

      TODO

内部类/嵌套类型

构造器

方法

下面的方法块按源码顺序生成。

public Set<ServerPlayer> getAllPlayers() @ L10

  • 方法名:getAllPlayers
  • 源码定位:L10
  • 返回类型:Set
  • 修饰符:public

参数:

说明:

TODO

public void addPlayer(ServerPlayer player, boolean ignored) @ L14

  • 方法名:addPlayer
  • 源码定位:L14
  • 返回类型:void
  • 修饰符:public

参数:

  • player: ServerPlayer
  • ignored: boolean

说明:

TODO

public void removePlayer(ServerPlayer player) @ L18

  • 方法名:removePlayer
  • 源码定位:L18
  • 返回类型:void
  • 修饰符:public

参数:

  • player: ServerPlayer

说明:

TODO

public void ignorePlayer(ServerPlayer player) @ L22

  • 方法名:ignorePlayer
  • 源码定位:L22
  • 返回类型:void
  • 修饰符:public

参数:

  • player: ServerPlayer

说明:

TODO

public void unIgnorePlayer(ServerPlayer player) @ L26

  • 方法名:unIgnorePlayer
  • 源码定位:L26
  • 返回类型:void
  • 修饰符:public

参数:

  • player: ServerPlayer

说明:

TODO

public boolean ignoredOrUnknown(ServerPlayer player) @ L30

  • 方法名:ignoredOrUnknown
  • 源码定位:L30
  • 返回类型:boolean
  • 修饰符:public

参数:

  • player: ServerPlayer

说明:

TODO

public boolean ignored(ServerPlayer player) @ L34

  • 方法名:ignored
  • 源码定位:L34
  • 返回类型:boolean
  • 修饰符:public

参数:

  • player: ServerPlayer

说明:

TODO

代码

public final class PlayerMap {
    private final Object2BooleanMap<ServerPlayer> players = new Object2BooleanOpenHashMap<>();
 
    public Set<ServerPlayer> getAllPlayers() {
        return this.players.keySet();
    }
 
    public void addPlayer(ServerPlayer player, boolean ignored) {
        this.players.put(player, ignored);
    }
 
    public void removePlayer(ServerPlayer player) {
        this.players.removeBoolean(player);
    }
 
    public void ignorePlayer(ServerPlayer player) {
        this.players.replace(player, true);
    }
 
    public void unIgnorePlayer(ServerPlayer player) {
        this.players.replace(player, false);
    }
 
    public boolean ignoredOrUnknown(ServerPlayer player) {
        return this.players.getOrDefault(player, true);
    }
 
    public boolean ignored(ServerPlayer player) {
        return this.players.getBoolean(player);
    }
}

引用的其他类