Java 类net.minecraft.server.GameProfileBanEntry 实例源码

项目:CraftBukkit    文件:CraftProfileBanList.java   
@Override
public org.bukkit.BanEntry getBanEntry(String target) {
    Validate.notNull(target, "Target cannot be null");

    GameProfile profile = MinecraftServer.getServer().getUserCache().getProfile(target);
    if (profile == null) {
        return null;
    }

    GameProfileBanEntry entry = (GameProfileBanEntry) list.get(profile);
    if (entry == null) {
        return null;
    }

    return new CraftProfileBanEntry(profile, entry, list);
}
项目:CraftBukkit    文件:CraftProfileBanList.java   
@Override
public org.bukkit.BanEntry addBan(String target, String reason, Date expires, String source) {
    Validate.notNull(target, "Ban target cannot be null");

    GameProfile profile = MinecraftServer.getServer().getUserCache().getProfile(target);
    if (profile == null) {
        return null;
    }

    GameProfileBanEntry entry = new GameProfileBanEntry(profile, new Date(),
            StringUtils.isBlank(source) ? null : source, expires,
            StringUtils.isBlank(reason) ? null : reason);

    list.add(entry);

    try {
        list.save();
    } catch (IOException ex) {
        MinecraftServer.getLogger().error("Failed to save banned-players.json, " + ex.getMessage());
    }

    return new CraftProfileBanEntry(profile, entry, list);
}
项目:Craftbukkit    文件:CraftProfileBanList.java   
@Override
public org.bukkit.BanEntry getBanEntry(String target) {
    Validate.notNull(target, "Target cannot be null");

    GameProfile profile = MinecraftServer.getServer().getUserCache().getProfile(target);
    if (profile == null) {
        return null;
    }

    GameProfileBanEntry entry = (GameProfileBanEntry) list.get(profile);
    if (entry == null) {
        return null;
    }

    return new CraftProfileBanEntry(profile, entry, list);
}
项目:Craftbukkit    文件:CraftProfileBanList.java   
@Override
public org.bukkit.BanEntry addBan(String target, String reason, Date expires, String source) {
    Validate.notNull(target, "Ban target cannot be null");

    GameProfile profile = MinecraftServer.getServer().getUserCache().getProfile(target);
    if (profile == null) {
        return null;
    }

    GameProfileBanEntry entry = new GameProfileBanEntry(profile, new Date(),
            StringUtils.isBlank(source) ? null : source, expires,
            StringUtils.isBlank(reason) ? null : reason);

    list.add(entry);

    try {
        list.save();
    } catch (IOException ex) {
        Bukkit.getLogger().log(Level.SEVERE, "Failed to save banned-players.json, {0}", ex.getMessage());
    }

    return new CraftProfileBanEntry(profile, entry, list);
}
项目:Tweakkit-Server    文件:CraftProfileBanList.java   
@Override
public org.bukkit.BanEntry getBanEntry(String target) {
    Validate.notNull(target, "Target cannot be null");

    GameProfile profile = MinecraftServer.getServer().getUserCache().getProfile(target);
    if (profile == null) {
        return null;
    }

    GameProfileBanEntry entry = (GameProfileBanEntry) list.get(profile);
    if (entry == null) {
        return null;
    }

    return new CraftProfileBanEntry(profile, entry, list);
}
项目:Tweakkit-Server    文件:CraftProfileBanList.java   
@Override
public org.bukkit.BanEntry addBan(String target, String reason, Date expires, String source) {
    Validate.notNull(target, "Ban target cannot be null");

    GameProfile profile = MinecraftServer.getServer().getUserCache().getProfile(target);
    if (profile == null) {
        return null;
    }

    GameProfileBanEntry entry = new GameProfileBanEntry(profile, new Date(),
            StringUtils.isBlank(source) ? null : source, expires,
            StringUtils.isBlank(reason) ? null : reason);

    list.add(entry);

    try {
        list.save();
    } catch (IOException ex) {
        MinecraftServer.getLogger().error("Failed to save banned-players.json, " + ex.getMessage());
    }

    return new CraftProfileBanEntry(profile, entry, list);
}
项目:SpigotSource    文件:CraftProfileBanList.java   
@Override
public org.bukkit.BanEntry getBanEntry(String target) {
    Validate.notNull(target, "Target cannot be null");

    GameProfile profile = MinecraftServer.getServer().getUserCache().getProfile(target);
    if (profile == null) {
        return null;
    }

    GameProfileBanEntry entry = (GameProfileBanEntry) list.get(profile);
    if (entry == null) {
        return null;
    }

    return new CraftProfileBanEntry(profile, entry, list);
}
项目:SpigotSource    文件:CraftProfileBanList.java   
@Override
public org.bukkit.BanEntry addBan(String target, String reason, Date expires, String source) {
    Validate.notNull(target, "Ban target cannot be null");

    GameProfile profile = MinecraftServer.getServer().getUserCache().getProfile(target);
    if (profile == null) {
        return null;
    }

    GameProfileBanEntry entry = new GameProfileBanEntry(profile, new Date(),
            StringUtils.isBlank(source) ? null : source, expires,
            StringUtils.isBlank(reason) ? null : reason);

    list.add(entry);

    try {
        list.save();
    } catch (IOException ex) {
        Bukkit.getLogger().log(Level.SEVERE, "Failed to save banned-players.json, {0}", ex.getMessage());
    }

    return new CraftProfileBanEntry(profile, entry, list);
}
项目:CraftBukkit    文件:CraftProfileBanEntry.java   
public CraftProfileBanEntry(GameProfile profile, GameProfileBanEntry entry, GameProfileBanList list) {
    this.list = list;
    this.profile = profile;
    this.created = entry.getCreated() != null ? new Date(entry.getCreated().getTime()) : null;
    this.source = entry.getSource();
    this.expiration = entry.getExpires() != null ? new Date(entry.getExpires().getTime()) : null;
    this.reason = entry.getReason();
}
项目:CraftBukkit    文件:CraftProfileBanEntry.java   
@Override
public void save() {
    GameProfileBanEntry entry = new GameProfileBanEntry(profile, this.created, this.source, this.expiration, this.reason);
    this.list.add(entry);
    try {
        this.list.save();
    } catch (IOException ex) {
        MinecraftServer.getLogger().error("Failed to save banned-players.json, " + ex.getMessage());
    }
}
项目:CraftBukkit    文件:CraftProfileBanList.java   
@Override
public Set<org.bukkit.BanEntry> getBanEntries() {
    ImmutableSet.Builder<org.bukkit.BanEntry> builder = ImmutableSet.builder();
    for (JsonListEntry entry : list.getValues()) {
        GameProfile profile = (GameProfile) entry.getKey();
        builder.add(new CraftProfileBanEntry(profile, (GameProfileBanEntry) entry, list));
    }

    return builder.build();
}
项目:Craftbukkit    文件:CraftProfileBanEntry.java   
public CraftProfileBanEntry(GameProfile profile, GameProfileBanEntry entry, GameProfileBanList list) {
    this.list = list;
    this.profile = profile;
    this.created = entry.getCreated() != null ? new Date(entry.getCreated().getTime()) : null;
    this.source = entry.getSource();
    this.expiration = entry.getExpires() != null ? new Date(entry.getExpires().getTime()) : null;
    this.reason = entry.getReason();
}
项目:Craftbukkit    文件:CraftProfileBanEntry.java   
@Override
public void save() {
    GameProfileBanEntry entry = new GameProfileBanEntry(profile, this.created, this.source, this.expiration, this.reason);
    this.list.add(entry);
    try {
        this.list.save();
    } catch (IOException ex) {
        Bukkit.getLogger().log(Level.SEVERE, "Failed to save banned-players.json, {0}", ex.getMessage());
    }
}
项目:Craftbukkit    文件:CraftProfileBanList.java   
@Override
public Set<org.bukkit.BanEntry> getBanEntries() {
    ImmutableSet.Builder<org.bukkit.BanEntry> builder = ImmutableSet.builder();

    for (JsonListEntry entry : list.getValues()) {
        GameProfile profile = (GameProfile) entry.getKey();
        builder.add(new CraftProfileBanEntry(profile, (GameProfileBanEntry) entry, list));
    }

    return builder.build();
}
项目:Tweakkit-Server    文件:CraftProfileBanEntry.java   
public CraftProfileBanEntry(GameProfile profile, GameProfileBanEntry entry, GameProfileBanList list) {
    this.list = list;
    this.profile = profile;
    this.created = entry.getCreated() != null ? new Date(entry.getCreated().getTime()) : null;
    this.source = entry.getSource();
    this.expiration = entry.getExpires() != null ? new Date(entry.getExpires().getTime()) : null;
    this.reason = entry.getReason();
}
项目:Tweakkit-Server    文件:CraftProfileBanEntry.java   
@Override
public void save() {
    GameProfileBanEntry entry = new GameProfileBanEntry(profile, this.created, this.source, this.expiration, this.reason);
    this.list.add(entry);
    try {
        this.list.save();
    } catch (IOException ex) {
        MinecraftServer.getLogger().error("Failed to save banned-players.json, " + ex.getMessage());
    }
}
项目:Tweakkit-Server    文件:CraftProfileBanList.java   
@Override
public Set<org.bukkit.BanEntry> getBanEntries() {
    ImmutableSet.Builder<org.bukkit.BanEntry> builder = ImmutableSet.builder();
    for (JsonListEntry entry : list.getValues()) {
        GameProfile profile = (GameProfile) entry.getKey();
        builder.add(new CraftProfileBanEntry(profile, (GameProfileBanEntry) entry, list));
    }

    return builder.build();
}
项目:SpigotSource    文件:CraftProfileBanEntry.java   
public CraftProfileBanEntry(GameProfile profile, GameProfileBanEntry entry, GameProfileBanList list) {
    this.list = list;
    this.profile = profile;
    this.created = entry.getCreated() != null ? new Date(entry.getCreated().getTime()) : null;
    this.source = entry.getSource();
    this.expiration = entry.getExpires() != null ? new Date(entry.getExpires().getTime()) : null;
    this.reason = entry.getReason();
}
项目:SpigotSource    文件:CraftProfileBanEntry.java   
@Override
public void save() {
    GameProfileBanEntry entry = new GameProfileBanEntry(profile, this.created, this.source, this.expiration, this.reason);
    this.list.add(entry);
    try {
        this.list.save();
    } catch (IOException ex) {
        Bukkit.getLogger().log(Level.SEVERE, "Failed to save banned-players.json, {0}", ex.getMessage());
    }
}
项目:SpigotSource    文件:CraftProfileBanList.java   
@Override
public Set<org.bukkit.BanEntry> getBanEntries() {
    ImmutableSet.Builder<org.bukkit.BanEntry> builder = ImmutableSet.builder();

    for (JsonListEntry entry : list.getValues()) {
        GameProfile profile = (GameProfile) entry.getKey();
        builder.add(new CraftProfileBanEntry(profile, (GameProfileBanEntry) entry, list));
    }

    return builder.build();
}