當前位置: 首頁>>代碼示例>>Java>>正文


Java OfflinePlayer類代碼示例

本文整理匯總了Java中org.bukkit.OfflinePlayer的典型用法代碼示例。如果您正苦於以下問題:Java OfflinePlayer類的具體用法?Java OfflinePlayer怎麽用?Java OfflinePlayer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


OfflinePlayer類屬於org.bukkit包,在下文中一共展示了OfflinePlayer類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: clear

import org.bukkit.OfflinePlayer; //導入依賴的package包/類
public void clear(@Nonnull World world) {
    // clear information about blocks in that world
    Iterator<Map.Entry<Block, OfflinePlayer>> blockIt = this.placedAnvils.entrySet().iterator();
    while(blockIt.hasNext()) {
        Block block = blockIt.next().getKey();
        if(block.getWorld().equals(world)) {
            blockIt.remove();
        }
    }

    // clear information about entitys in that world
    Iterator<Map.Entry<FallingBlock, OfflinePlayer>> entityIt = this.ownedAnvils.entrySet().iterator();
    while(entityIt.hasNext()) {
        Entity tnt = entityIt.next().getKey();
        if(tnt.getWorld().equals(world)) {
            entityIt.remove();
        }
    }
}
 
開發者ID:WarzoneMC,項目名稱:Warzone,代碼行數:20,代碼來源:SimpleAnvilTracker.java

示例2: onTabComplete

import org.bukkit.OfflinePlayer; //導入依賴的package包/類
public List<String> onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) {
    if (args.length != 1) {
        return Collections.emptyList();
    }
    final List<String> results = new ArrayList<String>();
    for (final FactionUser factionUser : this.plugin.getUserManager().getUsers().values()) {
        final Deathban deathban = factionUser.getDeathban();
        if (deathban != null && deathban.isActive()) {
            final OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(factionUser.getUserUUID());
            final String name = offlinePlayer.getName();
            if (name == null) {
                continue;
            }
            results.add(name);
        }
    }
    return BukkitUtils.getCompletions(args, results);
}
 
開發者ID:funkemunky,項目名稱:HCFCore,代碼行數:19,代碼來源:ReviveCommand.java

示例3: onTabComplete

import org.bukkit.OfflinePlayer; //導入依賴的package包/類
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
    if (args.length != 2 || !(sender instanceof Player)) {
        return Collections.emptyList();
    }

    Player player = (Player) sender;
    PlayerFaction playerFaction = plugin.getFactionManager().getPlayerFaction(player);
    if (playerFaction == null || (playerFaction.getMember(player.getUniqueId()).getRole() != Role.LEADER)) {
        return Collections.emptyList();
    }

    List<String> results = new ArrayList<>();
    Collection<UUID> keySet = playerFaction.getMembers().keySet();
    for (UUID entry : keySet) {
        OfflinePlayer target = Bukkit.getOfflinePlayer(entry);
        String targetName = target.getName();
        if (targetName != null && playerFaction.getMember(target.getUniqueId()).getRole() == Role.CAPTAIN) {
            results.add(targetName);
        }
    }

    return results;
}
 
開發者ID:funkemunky,項目名稱:HCFCore,代碼行數:25,代碼來源:FactionDemoteArgument.java

示例4: resolve

import org.bukkit.OfflinePlayer; //導入依賴的package包/類
public @Nullable
DamageInfo resolve(@Nonnull LivingEntity entity, @Nonnull Lifetime lifetime, @Nonnull EntityDamageEvent damageEvent) {
    if(damageEvent instanceof EntityDamageByEntityEvent) {
        EntityDamageByEntityEvent event = (EntityDamageByEntityEvent) damageEvent;

        if(event.getDamager() instanceof Projectile) {
            Projectile projectile = (Projectile) event.getDamager();
            Location launchLocation = this.projectileDistanceTracker.getLaunchLocation(projectile);
            Double projectileDistance = null;
            OfflinePlayer dispenserOwner = dispenserTracker.getOwner(projectile);


            if(launchLocation != null) projectileDistance = event.getEntity().getLocation().distance(launchLocation);

            if(projectile.getShooter() instanceof LivingEntity) {
                return new DispensedProjectileDamageInfo(projectile, (LivingEntity) projectile.getShooter(), projectileDistance, dispenserOwner);
            }
        }
    }
    return null;
}
 
開發者ID:WarzoneMC,項目名稱:Warzone,代碼行數:22,代碼來源:DispensedProjectileDamageResolver.java

示例5: onTabComplete

import org.bukkit.OfflinePlayer; //導入依賴的package包/類
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
    if (args.length != 1) {
        return Collections.emptyList();
    }

    List<String> results = new ArrayList<>();
    for (FactionUser factionUser : plugin.getUserManager().getUsers().values()) {
        Deathban deathban = factionUser.getDeathban();
        if (deathban != null && deathban.isActive()) {
            OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(factionUser.getUserUUID());
            String name = offlinePlayer.getName();
            if (name != null) {
                results.add(name);
            }
        }
    }

    return BukkitUtils.getCompletions(args, results);
}
 
開發者ID:funkemunky,項目名稱:HCFCore,代碼行數:21,代碼來源:StaffReviveCommand.java

示例6: getOfflinePlayer

import org.bukkit.OfflinePlayer; //導入依賴的package包/類
@Override
public OfflinePlayer getOfflinePlayer(UUID id) {
    Validate.notNull(id, "UUID cannot be null");

    OfflinePlayer result = getPlayer(id);
    if (result == null) {
        result = offlinePlayers.get(id);
        if (result == null) {
            result = new CraftOfflinePlayer(this, new GameProfile(id, null));
            offlinePlayers.put(id, result);
        }
    } else {
        offlinePlayers.remove(id);
    }

    return result;
}
 
開發者ID:UraniumMC,項目名稱:Uranium,代碼行數:18,代碼來源:CraftServer.java

示例7: addItems

import org.bukkit.OfflinePlayer; //導入依賴的package包/類
private ActiveGUI addItems(boolean active, Inventory inv){
	List<String> lissie = new ArrayList<>(sortedList(active).keySet());
			
	for (int i=0;i<18;i++)
		inv.setItem(i, UtilItem.create(Material.STAINED_GLASS_PANE, (byte)4, " "));
	
	int ia = 0;
	for (int place : places){
		if (ia<lissie.size()){
			OfflinePlayer op = Bukkit.getOfflinePlayer(UUID.fromString(lissie.get(ia)));
			ItemStack skull = null;
			try {
				skull = ActiveManager.getManager().createItem(op);
			} catch (Exception e) {
				e.printStackTrace();
			}
			inv.setItem(place, skull);
		}else inv.setItem(place, UtilItem.create(Material.STAINED_GLASS_PANE, (byte)7, " "));
		ia++;
	}
	return this;
}
 
開發者ID:jusjus112,項目名稱:OnlineChecker-Spigot-SQL-Support,代碼行數:23,代碼來源:ActiveGUI.java

示例8: onTabComplete

import org.bukkit.OfflinePlayer; //導入依賴的package包/類
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
    if (args.length != 2) {
        return Collections.emptyList();
    }

    List<String> results = new ArrayList<>();
    for (FactionUser factionUser : plugin.getUserManager().getUsers().values()) {
        Deathban deathban = factionUser.getDeathban();
        if (deathban != null && deathban.isActive()) {
            OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(factionUser.getUserUUID());
            String name = offlinePlayer.getName();
            if (name != null) {
                results.add(name);
            }
        }
    }

    return results;
}
 
開發者ID:funkemunky,項目名稱:HCFCore,代碼行數:21,代碼來源:LivesCheckDeathbanArgument.java

示例9: onTabComplete

import org.bukkit.OfflinePlayer; //導入依賴的package包/類
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
    if (args.length != 2) {
        return Collections.emptyList();
    }

    List<String> results = new ArrayList<>();
    Collection<FactionUser> factionUsers = plugin.getUserManager().getUsers().values();
    for (FactionUser factionUser : factionUsers) {
        Deathban deathban = factionUser.getDeathban();
        if (deathban == null || !deathban.isActive())
            continue;

        OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(factionUser.getUserUUID());
        String offlineName = offlinePlayer.getName();
        if (offlineName != null) {
            results.add(offlinePlayer.getName());
        }
    }

    return results;
}
 
開發者ID:funkemunky,項目名稱:HCFCore,代碼行數:23,代碼來源:LivesReviveArgument.java

示例10: addPlayerToTeam

import org.bukkit.OfflinePlayer; //導入依賴的package包/類
/**
 * Add a given player to the given team
 *
 * @param p Player
 * @param team Team
 *
 * @return {@code true} is success
 */
public boolean addPlayerToTeam(String p, VTeam team)
{
    while(this.removeFromAllTeams(p)) {}

    team.addPlayer(p);

    for(OfflinePlayer offlinePlayer : this.receivers)
    {
        if(!offlinePlayer.isOnline())
            continue;

        RawTeam.addPlayerToTeam(offlinePlayer.getPlayer(), team, p);
    }

    return true;
}
 
開發者ID:SamaGames,項目名稱:SamaGamesAPI,代碼行數:25,代碼來源:TeamHandler.java

示例11: getPlayers

import org.bukkit.OfflinePlayer; //導入依賴的package包/類
public List<Player> getPlayers() {
	List<Player> list = new ArrayList<Player>();
	for (Team team : scoreboard.getTeams())
		for (OfflinePlayer p : team.getPlayers())
			if (p.isOnline())
				list.add(p.getPlayer());
	return list;
}
 
開發者ID:thekeenant,項目名稱:mczone,代碼行數:9,代碼來源:Arena.java

示例12: onTabComplete

import org.bukkit.OfflinePlayer; //導入依賴的package包/類
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
    if (args.length != 2 || !(sender instanceof Player)) {
        return Collections.emptyList();
    }

    Player player = (Player) sender;
    PlayerFaction playerFaction = plugin.getFactionManager().getPlayerFaction(player);
    if (playerFaction == null) {
        return Collections.emptyList();
    }

    Role memberRole = playerFaction.getMember(player.getUniqueId()).getRole();
    if (memberRole == Role.MEMBER) {
        return Collections.emptyList();
    }

    List<String> results = new ArrayList<>();
    for (UUID entry : playerFaction.getMembers().keySet()) {
        Role targetRole = playerFaction.getMember(entry).getRole();
        if (targetRole == Role.LEADER || (targetRole == Role.CAPTAIN && memberRole != Role.LEADER)) {
            continue;
        }

        OfflinePlayer target = Bukkit.getOfflinePlayer(entry);
        String targetName = target.getName();
        if (targetName != null && !results.contains(targetName)) {
            results.add(targetName);
        }
    }

    return results;
}
 
開發者ID:funkemunky,項目名稱:HCFCore,代碼行數:34,代碼來源:FactionKickArgument.java

示例13: applyText

import org.bukkit.OfflinePlayer; //導入依賴的package包/類
private void applyText(Team team, String text, OfflinePlayer result) {
    Iterator<String> iterator = Splitter.fixedLength(16).split(text).iterator();
    String prefix = iterator.next();

    team.setPrefix(prefix);

    if (!team.hasEntry(result.getName()))
        team.addEntry(result.getName());

    if (text.length() > 16) {
        String prefixColor = ChatColor.getLastColors(prefix);
        String suffix = iterator.next();

        //TODO Change to the symbols

        if (prefix.endsWith("nn")) {
            prefix = prefix.substring(0, prefix.length() - 1);
            team.setPrefix(prefix);
            prefixColor = ChatColor.getByChar(suffix.charAt(0)).toString();
            suffix = suffix.substring(1);
        }

        if (prefixColor == null)
            prefixColor = "";

        if (suffix.length() > 16) {
            suffix = suffix.substring(0, (13 - prefixColor.length())); // cut off suffix, done if text is over 30 characters
        }

        team.setSuffix((prefixColor.equals("") ? ChatColor.RESET : prefixColor) + suffix);
    }
}
 
開發者ID:WarzoneMC,項目名稱:Warzone,代碼行數:33,代碼來源:SimpleScoreboard.java

示例14: onAnvilFall

import org.bukkit.OfflinePlayer; //導入依賴的package包/類
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onAnvilFall(BlockFallEvent event) {
    if (!this.tracker.isEnabled(event.getEntity().getWorld())) return;

    if (event.getBlock().getType() == Material.ANVIL) {
        OfflinePlayer placer = tracker.getPlacer(event.getBlock());

        if (placer != null) {
            tracker.setOwner(event.getEntity(), tracker.getPlacer(event.getBlock()));
        }
    }
}
 
開發者ID:WarzoneMC,項目名稱:Warzone,代碼行數:13,代碼來源:AnvilListener.java

示例15: onAnvilLand

import org.bukkit.OfflinePlayer; //導入依賴的package包/類
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onAnvilLand(EntityChangeBlockEvent event) {
    if (!this.tracker.isEnabled(event.getEntity().getWorld())) return;

    if (event.getEntityType() == EntityType.FALLING_BLOCK && event.getTo() == Material.ANVIL) {
        OfflinePlayer owner = tracker.getOwner((FallingBlock) event.getEntity());
        if(owner != null) {
            tracker.setPlacer(event.getBlock(), tracker.getOwner((FallingBlock) event.getEntity()));
            tracker.setOwner((FallingBlock) event.getEntity(), null);
        }
    }
}
 
開發者ID:WarzoneMC,項目名稱:Warzone,代碼行數:13,代碼來源:AnvilListener.java


注:本文中的org.bukkit.OfflinePlayer類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。