本文整理汇总了Java中org.bukkit.BanList.Type类的典型用法代码示例。如果您正苦于以下问题:Java Type类的具体用法?Java Type怎么用?Java Type使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Type类属于org.bukkit.BanList包,在下文中一共展示了Type类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPlayerDeath
import org.bukkit.BanList.Type; //导入依赖的package包/类
@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 ) ) );
}
}
示例2: getBanList
import org.bukkit.BanList.Type; //导入依赖的package包/类
@Override
public BanList getBanList(Type type)
{
switch (type)
{
case IP:
return playerList.getIPBans();
case NAME:
default:
return playerList.getProfileBans();
}
}
示例3: getExpirationLong
import org.bukkit.BanList.Type; //导入依赖的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();
}
示例4: getExpirationDate
import org.bukkit.BanList.Type; //导入依赖的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();
}
示例5: getReason
import org.bukkit.BanList.Type; //导入依赖的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();
}
示例6: isBanned
import org.bukkit.BanList.Type; //导入依赖的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;
}
示例7: processEvent
import org.bukkit.BanList.Type; //导入依赖的package包/类
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;
}
示例8: getIPBans
import org.bukkit.BanList.Type; //导入依赖的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;
}
示例9: isTempBanned
import org.bukkit.BanList.Type; //导入依赖的package包/类
@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;
}
示例10: setTempbanned
import org.bukkit.BanList.Type; //导入依赖的package包/类
@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();
}
示例11: isTempBanned
import org.bukkit.BanList.Type; //导入依赖的package包/类
@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;
}
示例12: getBanList
import org.bukkit.BanList.Type; //导入依赖的package包/类
@Override
public BanList getBanList(Type arg0) {
// TODO Auto-generated method stub
return null;
}
示例13: getBanList
import org.bukkit.BanList.Type; //导入依赖的package包/类
@Override
public BanList getBanList(Type type) {
return null;
}
示例14: getBanList
import org.bukkit.BanList.Type; //导入依赖的package包/类
@Override
public BanList getBanList(Type arg0) {
throw Pokkit.unsupported();
}
示例15: banIP
import org.bukkit.BanList.Type; //导入依赖的package包/类
public void banIP(String address) {
Preconditions.checkNotNull(address, "address");
this.getBanList(Type.IP).addBan(address, null, null, null);
}