当前位置: 首页>>代码示例>>Java>>正文


Java BanEntry类代码示例

本文整理汇总了Java中org.bukkit.BanEntry的典型用法代码示例。如果您正苦于以下问题:Java BanEntry类的具体用法?Java BanEntry怎么用?Java BanEntry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BanEntry类属于org.bukkit包,在下文中一共展示了BanEntry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: equals

import org.bukkit.BanEntry; //导入依赖的package包/类
@Override
public boolean equals(Object obj)
{
    if (this == obj)
    {
        return true;
    }
    else if (obj != null && obj instanceof BanEntry)
    {
        BanEntry banEntry = (BanEntry) obj;
        return target.equals(banEntry.getTarget()) && expires.equals(banEntry.getExpiration()) && reason.equals(banEntry.getReason())
                && source.equals(banEntry.getSource()) && created.equals(banEntry.getCreated()); 
    }
    else
    {
        return false;
    }
}
 
开发者ID:seeseemelk,项目名称:MockBukkit,代码行数:19,代码来源:MockBanList.java

示例2: addBan

import org.bukkit.BanEntry; //导入依赖的package包/类
@Override
public BanEntry addBan(String target, String reason, Date expires, String source)
{
    final BanEntry entry = new MockBanEntry(target, expires, reason, source);
    this.bans.put(target, entry);
    return entry;
}
 
开发者ID:seeseemelk,项目名称:MockBukkit,代码行数:8,代码来源:MockBanList.java

示例3: getBanEntries_OnePersonBanned_SetOfOnePerson

import org.bukkit.BanEntry; //导入依赖的package包/类
@Test
public void getBanEntries_OnePersonBanned_SetOfOnePerson()
{
    banList.addBan("target", "reason", new Date(), "source");
    Set<BanEntry> entries = banList.getBanEntries();
    assertEquals(1, entries.size());
    assertEquals("target", entries.iterator().next().getTarget());
}
 
开发者ID:seeseemelk,项目名称:MockBukkit,代码行数:9,代码来源:MockBanListTest.java

示例4: getExpirationLong

import org.bukkit.BanEntry; //导入依赖的package包/类
/**
 * 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();
}
 
开发者ID:NJDaeger,项目名称:EssentialCommands,代码行数:13,代码来源:BanAPI.java

示例5: getExpirationDate

import org.bukkit.BanEntry; //导入依赖的package包/类
/**
 * 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();
}
 
开发者ID:NJDaeger,项目名称:EssentialCommands,代码行数:13,代码来源:BanAPI.java

示例6: getReason

import org.bukkit.BanEntry; //导入依赖的package包/类
/**
 * 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();
}
 
开发者ID:NJDaeger,项目名称:EssentialCommands,代码行数:13,代码来源:BanAPI.java

示例7: isBanned

import org.bukkit.BanEntry; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:NJDaeger,项目名称:EssentialCommands,代码行数:15,代码来源:BanAPI.java

示例8: execute

import org.bukkit.BanEntry; //导入依赖的package包/类
@Override
public boolean execute(CommandSender sender, String currentAlias, String[] args) {
    if (!testPermission(sender)) return true;

    BanList.Type banType = BanList.Type.NAME;
    if (args.length > 0) {
        if (args[0].equalsIgnoreCase("ips")) {
            banType = BanList.Type.IP;
        } else if (!args[0].equalsIgnoreCase("players")) {
            sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage);
            return false;
        }
    }

    StringBuilder message = new StringBuilder();
    BanEntry[] banlist = Bukkit.getBanList(banType).getBanEntries().toArray(new BanEntry[0]);

    for (int x = 0; x < banlist.length; x++) {
        if (x != 0) {
            if (x == banlist.length - 1) {
                message.append(" and ");
            } else {
                message.append(", ");
            }
        }

        message.append(banlist[x].getTarget());
    }

    sender.sendMessage("There are " + banlist.length + " total banned players:");
    sender.sendMessage(message.toString());
    return true;
}
 
开发者ID:CyberdyneCC,项目名称:Thermos-Bukkit,代码行数:34,代码来源:BanListCommand.java

示例9: getBanEntry

import org.bukkit.BanEntry; //导入依赖的package包/类
@Override
public BanEntry getBanEntry(String target) {
    BanEntry entry = null;
    for (Ban ban : this.banManager.getAllBans()) {
        if (ban.getSubject().equalsIgnoreCase(target) && (ban.isIpBan() == isIpBan)) {
            entry = new CanaryBanEntry(ban);
        }
    }
    return entry;
}
 
开发者ID:CanaryBukkitTeam,项目名称:CanaryBukkit,代码行数:11,代码来源:CanaryBanList.java

示例10: addBan

import org.bukkit.BanEntry; //导入依赖的package包/类
@Override
public BanEntry addBan(String target, String reason, Date expires, String source) {
    Ban ban = new Ban(Canary.getServer().getPlayer(target), reason, this.isIpBan);
    ban.setBanningPlayer(source);
    this.banManager.issueBan(ban);
    return this.getBanEntry(target);
}
 
开发者ID:CanaryBukkitTeam,项目名称:CanaryBukkit,代码行数:8,代码来源:CanaryBanList.java

示例11: getBanEntries

import org.bukkit.BanEntry; //导入依赖的package包/类
@Override
public Set<BanEntry> getBanEntries() {
    Set<BanEntry> bans = Sets.newHashSet();
    for (Ban ban : this.banManager.getAllBans()) {
        if (ban.isIpBan() == this.isIpBan) {
            bans.add(new CanaryBanEntry(ban));
        }
    }
    return bans;
}
 
开发者ID:CanaryBukkitTeam,项目名称:CanaryBukkit,代码行数:11,代码来源:CanaryBanList.java

示例12: getIPBans

import org.bukkit.BanEntry; //导入依赖的package包/类
public Set<String> getIPBans() {
    Set<String> ipBans = new HashSet<String>();

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

    return ipBans;
}
 
开发者ID:CanaryBukkitTeam,项目名称:CanaryBukkit,代码行数:10,代码来源:CanaryServer.java

示例13: getBannedIps

import org.bukkit.BanEntry; //导入依赖的package包/类
/**
 * {@inheritDoc}
 *
 * @see com.blockhaus2000.ipm.minecraft.IpBanlist#getBannedIps()
 */
@Override
public Set<String> getBannedIps() {
    final Set<String> result = new HashSet<String>();
    for (final BanEntry banEntry : Bukkit.getServer().getBanList(BanList.Type.IP).getBanEntries()) {
        result.add(banEntry.getTarget());
    }
    return result;
}
 
开发者ID:Blockhaus2000,项目名称:InternalPluginManager,代码行数:14,代码来源:BukkitIpBanlist.java

示例14: getBannedPlayers

import org.bukkit.BanEntry; //导入依赖的package包/类
/**
 * {@inheritDoc}
 *
 * @see com.blockhaus2000.ipm.minecraft.Banlist#getBannedPlayers()
 */
@SuppressWarnings("deprecation")
@Override
public Set<OfflinePlayer> getBannedPlayers() {
    final Set<OfflinePlayer> result = new HashSet<OfflinePlayer>();
    for (final BanEntry banEntry : Bukkit.getServer().getBanList(BanList.Type.NAME).getBanEntries()) {
        result.add(InternalPluginManager.getServer().getPlayerManager().getOfflinePlayer(banEntry.getTarget()));
    }
    return result;
}
 
开发者ID:Blockhaus2000,项目名称:InternalPluginManager,代码行数:15,代码来源:BukkitBanlist.java

示例15: addBan

import org.bukkit.BanEntry; //导入依赖的package包/类
@Override
public BanEntry addBan(String target, String reason, Date expires, String source) {
    try {
        BanEntry entry = cache.get(target, () -> new PoreBanEntry(target, this));
        entry.setCreated(new Date());
        entry.setReason(reason);
        entry.setExpiration(expires);
        entry.setSource(source);
        entry.save();
        return entry;
    } catch (ExecutionException e) {
        throw Throwables.propagate(e.getCause());
    }
}
 
开发者ID:LapisBlue,项目名称:Pore,代码行数:15,代码来源:PoreBanList.java


注:本文中的org.bukkit.BanEntry类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。