Java 类org.bukkit.BanList.Type 实例源码

项目:NewHorizonsServerCore    文件:TrialKick.java   
@EventHandler
public void onPlayerDeath( PlayerDeathEvent pEvent )
{
  Player tPlayer = pEvent.getEntity();
  if( tPlayer != null )
  {
    incDeathCounter( tPlayer );

    if( tPlayer.hasPermission( GTNH_PERM_FULL_MEMBER ) )
      return;

    int tDeathCount = getDeathCounter( tPlayer );
    if( tDeathCount >= _mMaxDeathCount )
    {
      Bukkit.getBanList( Type.NAME ).addBan( tPlayer.getName(), "Trial period expired. Contact an Admin", null, null );
      tPlayer.kickPlayer( ChatColor.translateAlternateColorCodes( '&', _mMain.mConfig.getString( "Messages.KickMessage" ) ) );
    }
    else
      tPlayer.sendMessage( ChatColor.translateAlternateColorCodes( '&', String.format( _mMain.mConfig.getString( "Messages.TrialWarning" ), tDeathCount, _mMaxDeathCount ) ) );
  }
}
项目:MockBukkit    文件:ServerMock.java   
@Override
public BanList getBanList(Type type)
{
    switch (type)
    {
        case IP:
            return playerList.getIPBans();
        case NAME:
        default:
            return playerList.getProfileBans();
    }
}
项目:EssentialCommands    文件:BanAPI.java   
/**
 * Gets the expiration date from a ban entry.
 * 
 * @param target Target to get the expiration date from.
 * @return Returns the expiration date as a long in milliseconds.
 */
public long getExpirationLong(String target) {
    Validate.notNull(target, "Target cannot be null.");
    final BanEntry entry = Bukkit.getBanList(Type.NAME).getBanEntry(target);
    Validate.notNull(entry, "Cannot find BanList entry \"" + target + "\"");
    return entry.getExpiration().getTime();
}
项目:EssentialCommands    文件:BanAPI.java   
/**
 * Gets the expiration date from a ban entry.
 * 
 * @param target Target top get the expiration date from.
 * @return Returns the expiration date as a long in proper format.
 */
public Date getExpirationDate(String target) {
    Validate.notNull(target, "Target cannot be null.");
    final BanEntry entry = Bukkit.getBanList(Type.NAME).getBanEntry(target);
    Validate.notNull(entry, "Cannot find BanList entry \"" + target + "\"");
    return entry.getExpiration();
}
项目:EssentialCommands    文件:BanAPI.java   
/**
 * Gets the reason for the ban.
 * 
 * @param target The target to get the ban reason from.
 * @return Returns the reason for the ban.
 */
public String getReason(String target) {
    Validate.notNull(target, "Target cannot be null.");
    final BanEntry entry = Bukkit.getBanList(Type.NAME).getBanEntry(target);
    Validate.notNull(entry, "Cannot find BanList entry \"" + target + "\"");
    return entry.getReason();
}
项目:EssentialCommands    文件:BanAPI.java   
/**
 * Checks if the BanList contains an entry.
 * 
 * @param target The target to find in the list.
 * @return True if list contains target, false otherwise.
 */
public boolean isBanned(String target) {
    Validate.notNull(target, "Target cannot be null.");
    final BanEntry entry = Bukkit.getBanList(Type.NAME).getBanEntry(target);
    if (entry == null) {
        return false;
    }
    return true;
}
项目:AntiExploit    文件:ExploitManager.java   
public static void processEvent(Player player, String exploit) {
    if (!exploitData.containsKey(exploit.toLowerCase())) {
        exploitData.put(exploit.toLowerCase(), 0);
    }

    exploitData.put(exploit.toLowerCase(), Math.addExact(exploitData.get(exploit.toLowerCase()), 1));

    if (AntiExploit.config.getBoolean("AntiExploit.Exploits." + exploit + ".Broadcast") == true) {
        Bukkit.getServer().broadcastMessage(getMessage(player.getName(), exploit, "Broadcast"));
    }

    if (AntiExploit.config.getBoolean("AntiExploit.Exploits." + exploit + ".AlertStaff") == true) {
        for (Player onlineplayer : Bukkit.getOnlinePlayers()) {
            if (onlineplayer.hasPermission("AntiExploit.AlertStaff")) {
                onlineplayer.sendMessage(getMessage(player.getName(), exploit, "AlertStaff"));
            }
        }
    }

    if (AntiExploit.config.getDouble("AntiExploit.Exploits." + exploit + ".Damage") > 0D) {
        player.damage(AntiExploit.config.getDouble("AntiExploit.Exploits." + exploit + ".Damage"));
    }

    if (AntiExploit.config.getBoolean("AntiExploit.Exploits." + exploit + ".Ban") == true) {
        Bukkit.getBanList(Type.NAME).addBan(player.getName(), getMessage(player.getName(), exploit, "Ban"), null, "AntiExploit");
    }

    if (AntiExploit.config.getBoolean("AntiExploit.Exploits." + exploit + ".Ban") == true || AntiExploit.config.getBoolean("AntiExploit.Exploits." + exploit + ".Kick") == true) {
        player.kickPlayer(getMessage(player.getName(), exploit, "Kick"));
    }
    return;
}
项目:CanaryBukkit    文件:CanaryServer.java   
public Set<String> getIPBans() {
    Set<String> ipBans = new HashSet<String>();

    for (BanEntry entry : this.getBanList(Type.IP).getBanEntries()) {
        ipBans.add(entry.getTarget());
    }

    return ipBans;
}
项目:xEssentials-deprecated-bukkit    文件:xEssentialsOfflinePlayer.java   
@Override
public boolean isTempBanned() {
    if(Bukkit.getBanList(Type.NAME).isBanned(player)) {
        Date date = Bukkit.getServer().getBanList(Type.NAME).getBanEntry(player).getExpiration();
        if(date != null) {
            return true;
        } else {
            return false;
        }
    }
    return false;
}
项目:xEssentials-deprecated-bukkit    文件:xEssentialsOfflinePlayer.java   
@Override
public void setTempbanned(Long time, String reason, String who) {
    Date date = new Date(time);
    Bukkit.getServer().getBanList(Type.NAME).addBan(player, reason, date, who).save();
    con.set("tempbanned.isBanned", true);
    save();
}
项目:xEssentials-deprecated-bukkit    文件:xEssentialsPlayer.java   
@Override
public boolean isTempBanned() {
    if(Bukkit.getBanList(Type.NAME).isBanned(player.getName())) {
        Date date = Bukkit.getServer().getBanList(Type.NAME).getBanEntry(player.getName()).getExpiration();
        if(date != null) {
            return true;
        } else {
            return false;
        }
    }
    return false;
}
项目:netherrack    文件:NetherServer.java   
@Override
public BanList getBanList(Type arg0) {
    // TODO Auto-generated method stub
    return null;
}
项目:ExilePearl    文件:TestServer.java   
@Override
public BanList getBanList(Type type) {
    return null;
}
项目:Pokkit    文件:CraftServer.java   
@Override
public BanList getBanList(Type arg0) {
    throw Pokkit.unsupported();

}
项目:CanaryBukkit    文件:CanaryServer.java   
public void banIP(String address) {
    Preconditions.checkNotNull(address, "address");

    this.getBanList(Type.IP).addBan(address, null, null, null);
}
项目:CanaryBukkit    文件:CanaryServer.java   
public BanList getBanList(BanList.Type type) {
    Preconditions.checkNotNull(type, "type");

    return new CanaryBanList(Canary.bans(), type);
}
项目:BedrockAPI    文件:Bukkit.java   
public static BanList getBanList(BanList.Type type) {
    return null;
}
项目:xEssentials-deprecated-bukkit    文件:xEssentialsOfflinePlayer.java   
@Override
public boolean isPermBanned() {
    return Bukkit.getServer().getBanList(Type.NAME).isBanned(player);
}
项目:xEssentials-deprecated-bukkit    文件:xEssentialsOfflinePlayer.java   
@Override
public void setPermBanned(String reason, String who) {
    Bukkit.getServer().getBanList(Type.NAME).addBan(player, reason, null, who).save();
    con.set("banned.isBanned", true);
    save();
}
项目:xEssentials-deprecated-bukkit    文件:xEssentialsOfflinePlayer.java   
@Override
public String getBanMessage() {
    return Bukkit.getServer().getBanList(Type.NAME).getBanEntry(player).getReason();
}
项目:xEssentials-deprecated-bukkit    文件:xEssentialsOfflinePlayer.java   
@Override
public String getTempBanMessage() {
    return Bukkit.getServer().getBanList(Type.NAME).getBanEntry(player).getReason();
}
项目:xEssentials-deprecated-bukkit    文件:xEssentialsOfflinePlayer.java   
@Override
public void unban() {
    Bukkit.getServer().getBanList(Type.NAME).pardon(player);
}
项目:xEssentials-deprecated-bukkit    文件:xEssentialsOfflinePlayer.java   
@Override
public Long getTempbanRemaining() {
    return Bukkit.getServer().getBanList(Type.NAME).getBanEntry(player).getExpiration().getTime();
}
项目:xEssentials-deprecated-bukkit    文件:xEssentialsPlayer.java   
@Override
public boolean isPermBanned() {
    return Bukkit.getServer().getBanList(Type.NAME).isBanned(player.getName());
}
项目:xEssentials-deprecated-bukkit    文件:xEssentialsPlayer.java   
@Override
public void setPermBanned(String reason, String who) {
    Bukkit.getServer().getBanList(Type.NAME).addBan(player.getName(), reason, null, who).save();
    con.set("banned.isBanned", true);
}
项目:xEssentials-deprecated-bukkit    文件:xEssentialsPlayer.java   
@Override
public String getBanMessage() {
    return Bukkit.getServer().getBanList(Type.NAME).getBanEntry(player.getName()).getReason();
}
项目:xEssentials-deprecated-bukkit    文件:xEssentialsPlayer.java   
@Override
public void setTempbanned(Long time, String reason, String who) {
    Date date = new Date(time);
    Bukkit.getServer().getBanList(Type.NAME).addBan(player.getName(), reason, date, who).save();
    con.set("tempbanned.isBanned", true);
}
项目:xEssentials-deprecated-bukkit    文件:xEssentialsPlayer.java   
@Override
public String getTempBanMessage() {
    return Bukkit.getServer().getBanList(Type.NAME).getBanEntry(player.getName()).getReason();
}
项目:xEssentials-deprecated-bukkit    文件:xEssentialsPlayer.java   
@Override
public void unban() {
    Bukkit.getServer().getBanList(Type.NAME).pardon(player.getName());
}
项目:xEssentials-deprecated-bukkit    文件:xEssentialsPlayer.java   
@Override
public Long getTempbanRemaining() {
    return Bukkit.getServer().getBanList(Type.NAME).getBanEntry(player.getName()).getExpiration().getTime();
}
项目:EssentialCommands    文件:BanAPI.java   
/**
 * Unbans a player.
 * 
 * @param target This is the player to unban.
 * 
 *            <p>
 *            - Note: Add a check in your command method to see if the
 *            banlist contains the target.
 *            </p>
 */
public void unban(String target) {
    Validate.notNull(target, "Target cannot be null.");
    final BanList list = Bukkit.getBanList(Type.NAME);
    Validate.notNull(list.getBanEntry(target), "Cannot find BanList entry \"" + target + "\"");
    list.pardon(target);
}
项目:EssentialCommands    文件:BanAPI.java   
/**
 * Checks if a target is still banned or not.
 * 
 * @param target This is the player that is being checked for the ban
 *            expire.
 * @return Returns false if still banned, true otherwise.
 * 
 *         <p>
 *         - Note: Use this method in a login event. To check if a player is
 *         still banned.
 *         </p>
 */
public boolean isBanExpired(String target) {
    Validate.notNull(target, "Target cannot be null.");
    final BanEntry entry = Bukkit.getBanList(Type.NAME).getBanEntry(target);
    Validate.notNull(entry, "Cannot find BanList entry \"" + target + "\"");
    final long currentTime = System.currentTimeMillis(); //Gets the current time
    if (getExpirationLong(target) > currentTime) {
        return false;
    }
    return true;
}
项目:BedrockAPI    文件:Server.java   
BanList getBanList(BanList.Type type);