Java Code Examples for org.bukkit.OfflinePlayer

The following are top voted examples for showing how to use org.bukkit.OfflinePlayer. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: Warzone   File: SimpleAnvilTracker.java   Source Code and License 6 votes vote down vote up
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();
        }
    }
}
 
Example 2
Project: HCFCore   File: ReviveCommand.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 3
Project: HCFCore   File: FactionDemoteArgument.java   Source Code and License 6 votes vote down vote up
@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;
}
 
Example 4
Project: Warzone   File: DispensedProjectileDamageResolver.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 5
Project: HCFCore   File: StaffReviveCommand.java   Source Code and License 6 votes vote down vote up
@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);
}
 
Example 6
Project: Uranium   File: CraftServer.java   Source Code and License 6 votes vote down vote up
@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;
}
 
Example 7
Project: OnlineChecker-Spigot-SQL-Support   File: ActiveGUI.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 8
Project: HCFCore   File: LivesCheckDeathbanArgument.java   Source Code and License 6 votes vote down vote up
@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;
}
 
Example 9
Project: HCFCore   File: LivesReviveArgument.java   Source Code and License 6 votes vote down vote up
@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;
}
 
Example 10
Project: SamaGamesAPI   File: TeamHandler.java   Source Code and License 6 votes vote down vote up
/**
 * 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;
}
 
Example 11
Project: mczone   File: Arena.java   Source Code and License 5 votes vote down vote up
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;
}
 
Example 12
Project: HCFCore   File: FactionKickArgument.java   Source Code and License 5 votes vote down vote up
@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;
}
 
Example 13
Project: Warzone   File: SimpleScoreboard.java   Source Code and License 5 votes vote down vote up
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);
    }
}
 
Example 14
Project: Warzone   File: AnvilListener.java   Source Code and License 5 votes vote down vote up
@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()));
        }
    }
}
 
Example 15
Project: Warzone   File: AnvilListener.java   Source Code and License 5 votes vote down vote up
@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);
        }
    }
}
 
Example 16
Project: Warzone   File: SimpleAnvilTracker.java   Source Code and License 5 votes vote down vote up
@Nullable
public OfflinePlayer setPlacer(@Nonnull Block block, @Nonnull OfflinePlayer offlinePlayer) {
    Preconditions.checkNotNull(block, "block");
    Preconditions.checkNotNull(offlinePlayer, "player");

    return this.placedAnvils.put(block, offlinePlayer);
}
 
Example 17
Project: FactionsXL   File: FTeamWrapper.java   Source Code and License 5 votes vote down vote up
private void add(FScoreboard fboard) {
    Scoreboard board = fboard.getScoreboard();
    Team team = board.registerNewTeam(teamName);
    teams.put(fboard, team);

    for (OfflinePlayer player : getPlayers()) {
        team.addEntry(player.getName());
    }

    updatePrefix(fboard);
}
 
Example 18
Project: Warzone   File: SimpleDispenserTracker.java   Source Code and License 5 votes vote down vote up
public @Nullable
OfflinePlayer setOwner(@Nonnull Entity entity, @Nullable Player player) {
    Preconditions.checkNotNull(entity, "tnt entity");

    if(player != null) {
        return this.ownedEntitys.put(entity, player);
    } else {
        return this.ownedEntitys.remove(entity);
    }
}
 
Example 19
Project: Warzone   File: SimpleDispenserTracker.java   Source Code and License 5 votes vote down vote up
public @Nullable
OfflinePlayer setPlacer(@Nonnull Block block, @Nonnull Player player) {
    Preconditions.checkNotNull(block, "block");
    Preconditions.checkNotNull(player, "player");

    return this.placedDispensers.put(block, player.getPlayer());
}
 
Example 20
Project: HCFCore   File: LivesCheckDeathbanArgument.java   Source Code and License 5 votes vote down vote up
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    if (args.length < 2) {
        sender.sendMessage(ChatColor.RED + "Usage: " + getUsage(label));
        return true;
    }

    OfflinePlayer target = Bukkit.getOfflinePlayer(args[1]); // TODO: breaking

    if (!target.hasPlayedBefore() && !target.isOnline()) {
        sender.sendMessage(ChatColor.GOLD + "Player '" + ChatColor.WHITE + args[1] + ChatColor.GOLD + "' not found.");
        return true;
    }

    Deathban deathban = plugin.getUserManager().getUser(target.getUniqueId()).getDeathban();

    if (deathban == null || !deathban.isActive()) {
        sender.sendMessage(ChatColor.RED + target.getName() + " is not death-banned.");
        return true;
    }

    sender.sendMessage(ChatColor.DARK_AQUA + "Deathban cause of " + target.getName() + '.');
    sender.sendMessage(ChatColor.GRAY + " Time: " + DateTimeFormats.HR_MIN.format(deathban.getCreationMillis()));
    sender.sendMessage(ChatColor.GRAY + " Duration: " + DurationFormatUtils.formatDurationWords(deathban.getInitialDuration(), true, true));

    Location location = deathban.getDeathPoint();
    if (location != null) {
        sender.sendMessage(ChatColor.GRAY + " Location: (" + location.getBlockX() + ", " + location.getBlockY() + ", " + location.getBlockZ() + ") - " + location.getWorld().getName());
    }

    sender.sendMessage(ChatColor.GRAY + " Reason: [" + Strings.nullToEmpty(deathban.getReason()) + ChatColor.GREEN + "]");
    return true;
}
 
Example 21
Project: EchoPet   File: UUIDMigration.java   Source Code and License 5 votes vote down vote up
/**
 * Returns the identification for a given player
 *
 * @param player         player to fetch a UUID for
 * @param enableFetching if set to true, the UUID will be fetched from Mojang if {@code player} is offline
 * @return identification for the given player
 */
public static Object getIdentificationFor(OfflinePlayer player, boolean enableFetching) {
    if (player instanceof Player) {
        if (supportsUuid()) {
            return player.getUniqueId();
        }
        return player.getName();
    } else {
        if (enableFetching) {
            return getIdentificationFor(player.getName());
        }
        return null;
    }
}
 
Example 22
Project: HCFCore   File: LivesCheckDeathbanArgument.java   Source Code and License 5 votes vote down vote up
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    if (args.length < 2) {
        sender.sendMessage(ChatColor.RED + "Usage: " + getUsage(label));
        return true;
    }

    OfflinePlayer target = Bukkit.getOfflinePlayer(args[1]); // TODO: breaking

    if (!target.hasPlayedBefore() && !target.isOnline()) {
        sender.sendMessage(ChatColor.GOLD + "Player '" + ChatColor.WHITE + args[1] + ChatColor.GOLD + "' not found.");
        return true;
    }

    Deathban deathban = plugin.getUserManager().getUser(target.getUniqueId()).getDeathban();

    if (deathban == null || !deathban.isActive()) {
        sender.sendMessage(ChatColor.RED + target.getName() + " is not death-banned.");
        return true;
    }

    sender.sendMessage(ChatColor.DARK_AQUA + "Deathban cause of " + target.getName() + '.');
    sender.sendMessage(ChatColor.GRAY + " Time: " + DateTimeFormats.HR_MIN.format(deathban.getCreationMillis()));
    sender.sendMessage(ChatColor.GRAY + " Duration: " + DurationFormatUtils.formatDurationWords(deathban.getInitialDuration(), true, true));

    Location location = deathban.getDeathPoint();
    if (location != null) {
        sender.sendMessage(ChatColor.GRAY + " Location: (" + location.getBlockX() + ", " + location.getBlockY() + ", " + location.getBlockZ() + ") - " + location.getWorld().getName());
    }

    sender.sendMessage(ChatColor.GRAY + " Reason: [" + Strings.nullToEmpty(deathban.getReason()) + ChatColor.GREEN + "]");
    return true;
}
 
Example 23
Project: ZorahPractice   File: VariableSetRatingArgument.java   Source Code and License 5 votes vote down vote up
public void onCommand(CommandSender sender, String[] args) throws CommandException {
    if (args.length < 4) {
        throw new CommandException(Collections.singletonList("Usage: /var sr <player> <ladder> <elo>"));
    }

    OfflinePlayer target = Bukkit.getOfflinePlayer(args[1]);

    if (target == null) {
        throw new CommandException(Collections.singletonList("That player is not registered."));
    }

    Ladder ladder = ManagerHandler.getLadderManager().getLadderByName(args[2]);

    if (ladder == null) {
        throw new CommandException(Collections.singletonList("That ladder does not exist."));
    }

    if (!args[3].chars().allMatch(Character::isDigit)) {
        throw new CommandException(Collections.singletonList("You must specify an integer as the ELO argument."));
    }

    int rating = Integer.valueOf(args[3]);

    MessageUtils.sendStaffMessage(ChatColor.GRAY + ChatColor.ITALIC.toString() + "[" + sender.getName() + ": Set " + ChatColor.GREEN + ChatColor.ITALIC + target.getName() + ChatColor.GRAY + ChatColor.ITALIC + "'s " + ladder.getName() + " rating to " + ChatColor.GREEN + ChatColor.ITALIC + rating + ChatColor.GRAY + ChatColor.ITALIC + "]");

    DataAccessor.setRating(target.getUniqueId(), ladder, rating, new GenericCallback() {
        @Override
        public void call(boolean result) {
            if (result) {
                sender.sendMessage(ChatColor.GREEN + "✓ Set player's rating.");
            }
            else {
                sender.sendMessage(ChatColor.RED + "✗ Failed to set player's rating.");
            }
        }
    });
}
 
Example 24
Project: Debuggery   File: OutputFormatterTest.java   Source Code and License 5 votes vote down vote up
@Test
public void testOfflinePlayer() {
    String name = "TestUser";
    UUID uuid = UUID.fromString("6c780b81-d087-485e-8786-b0a500d7c224");

    OfflinePlayer player = new TestOfflinePlayer(name, uuid);

    String out = OutputFormatter.getOutput(player);

    assertNotNull(out);
    assertTrue(out.contains(name));
    assertTrue(out.contains(uuid.toString()));
}
 
Example 25
Project: Uranium   File: CraftServer.java   Source Code and License 5 votes vote down vote up
@Override
public Set<OfflinePlayer> getWhitelistedPlayers() {
    Set<OfflinePlayer> result = new LinkedHashSet<OfflinePlayer>();

    for (UserListEntry entry : playerList.func_152599_k().getValues()) {
        result.add(getOfflinePlayer((GameProfile) entry.func_152640_f())); // Should be getKey
    }

    return result;
}
 
Example 26
Project: FactionsXL   File: FPlayerCache.java   Source Code and License 5 votes vote down vote up
/**
 * @return
 * the FPlayer that represents the player
 */
public FPlayer getByPlayer(OfflinePlayer player) {
    for (FPlayer fPlayer : fPlayers) {
        if (player.equals(fPlayer.getPlayer())) {
            return fPlayer;
        }
    }

    if (hasPlayedBefore(player)) {
        return new FPlayer(player.getUniqueId());
    } else {
        return null;
    }
}
 
Example 27
Project: Uranium   File: CraftScoreboard.java   Source Code and License 5 votes vote down vote up
public ImmutableSet<Score> getScores(OfflinePlayer player) throws IllegalArgumentException {
    Validate.notNull(player, "OfflinePlayer cannot be null");

    ImmutableSet.Builder<Score> scores = ImmutableSet.builder();
    for (CraftObjective objective : objectives.values()) {
        scores.add(objective.getScore(player));
    }
    return scores.build();
}
 
Example 28
Project: Uranium   File: CraftTeam.java   Source Code and License 5 votes vote down vote up
public Set<OfflinePlayer> getPlayers() throws IllegalStateException {
    CraftScoreboard scoreboard = checkState();

    ImmutableSet.Builder<OfflinePlayer> players = ImmutableSet.builder();
    for (Object o : team.getMembershipCollection()) {
        players.add(Bukkit.getOfflinePlayer(o.toString()));
    }
    return players.build();
}
 
Example 29
Project: FactionsXL   File: FactionMap.java   Source Code and License 5 votes vote down vote up
public Set<String> createPlayerset(Faction faction) {
    if (faction == null) {
        return null;
    }
    Set<String> ret = new HashSet<>();

    for (OfflinePlayer player : faction.getMembers().getOfflinePlayers()) {
        // NOTE: We add both UUID and name. This might be a good idea for future proofing.
        ret.add(player.getUniqueId().toString());
        ret.add(player.getName());
    }

    return ret;
}
 
Example 30
Project: HCFCore   File: MedicCommand.java   Source Code and License 5 votes vote down vote up
public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
    final Player p = (Player)sender;
    if (args.length < 2) {
        sender.sendMessage(ChatColor.RED + "Usage: " + this.getUsage(label));
        return true;
    }
    if (Cooldowns.isOnCooldown("medic_cooldown", p)) {
        p.sendMessage(ChatColor.RED + "You still have a " + ChatColor.DARK_GRAY + ChatColor.BOLD + "Titanium" + ChatColor.RED + " cooldown for another " + (Cooldowns.getCooldownForPlayerLong("medic_cooldown", p)) + ChatColor.RED + '.');
        return true;
    }
    final OfflinePlayer target = Bukkit.getOfflinePlayer(args[1]);
    if (!target.hasPlayedBefore() && !target.isOnline()) {
        sender.sendMessage(ChatColor.RED + target.getName() + " is not online.");
        return true;
    }
    final UUID targetUUID = target.getUniqueId();
    final FactionUser factionTarget = this.plugin.getUserManager().getUser(targetUUID);
    final Deathban deathban = factionTarget.getDeathban();
    if (deathban == null || !deathban.isActive()) {
        sender.sendMessage(ChatColor.RED + target.getName() + " is not death-banned.");
        return true;
    }
    Relation relation = Relation.ENEMY;
    if (sender instanceof Player) {
        final Player player = (Player)sender;
        final UUID playerUUID = player.getUniqueId();
        final int selfLives = this.plugin.getDeathbanManager().getLives(playerUUID);
        Cooldowns.addCooldown("medic_cooldown", p, 5400);
        final PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(player);
        relation = ((playerFaction == null) ? Relation.ENEMY : playerFaction.getFactionRelation(this.plugin.getFactionManager().getPlayerFaction(targetUUID)));
        sender.sendMessage(ChatColor.YELLOW + "You have revived " + relation.toChatColour() + target.getName() + ChatColor.YELLOW + '.');
        Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&',"&8&l" + p.getName().toUpperCase() + " &7has used their Titanium Rank &eto revive &8&l" + target.getName().toUpperCase() + "&7."));
    }
    factionTarget.removeDeathban();
    return true;
}
 
Example 31
Project: AntiCheat   File: KillauraCheatLog.java   Source Code and License 5 votes vote down vote up
protected KillauraCheatLog(OfflinePlayer player, Map<LocationWrapper, LocationWrapper> targetsHits, int numberTouched, int displayedCount)
{
    super(player, EnumCheat.KILLAURA);

    this.targetsHits = targetsHits;
    this.displayedCount = displayedCount;
    this.hitCount = numberTouched;
}
 
Example 32
Project: AntiCheat   File: BasicCheatLog.java   Source Code and License 5 votes vote down vote up
public BasicCheatLog(OfflinePlayer player, EnumCheat cheat)
{
    this.server = SamaGamesAPI.get().getServerName();
    this.date = new Date();
    this.playerID = player.getUniqueId();
    this.playerName = player.getName();

    double[] tab = MinecraftServer.getServer().recentTps;
    this.serverTps = tab[0];

    this.playerLag = ((CraftPlayer) player).getHandle().ping;
    this.cheat = cheat;
}
 
Example 33
Project: PA   File: PASurvival.java   Source Code and License 5 votes vote down vote up
public static SurvivalUser getPlayer(OfflinePlayer p) {
    for (SurvivalUser pl : players) {
        if (pl.getName() == null) continue;
        if (pl.getName().equalsIgnoreCase(p.getName())) return pl;
    }
    SurvivalUser us = new SurvivalUser(p.getName());
    if (us.isOnline()) players.add(us);
    return us;
}
 
Example 34
Project: KevsPermissions   File: KevsPermissions.java   Source Code and License 5 votes vote down vote up
public static PermissionsPlayer getPlayer(OfflinePlayer op) {
	if (op == null)
		throw new IllegalArgumentException("OfflinePlayer is not supposed to be null.");
	for (PermissionsPlayer permissionsPlayer : players) {
		if (permissionsPlayer.getUniqueId().equals(op.getUniqueId()))
			return permissionsPlayer;
	}
	return null;
}
 
Example 35
Project: KevsPermissions   File: ConfigDataManger.java   Source Code and License 5 votes vote down vote up
@Override
public void deletePlayerRecord(OfflinePlayer op) {
	if (op.isOnline())
		return;
	config.set("players." + op.getUniqueId(), null);
	PermissionsPlugin.getPlugin(PermissionsPlugin.class).saveConfig();
	KevsPermissions.reload();
}
 
Example 36
Project: PA   File: TOA.java   Source Code and License 5 votes vote down vote up
public static TOAUser getPlayer(OfflinePlayer p) {
    for (TOAUser pl : users) {
        if (pl.getName() == null || p.getName() == null) continue;
        if (pl.getName().equalsIgnoreCase(p.getName())) return pl;
    }
    TOAUser us = new TOAUser(p.getName());
    if (us.isOnline()) users.add(us);
    return us;
}
 
Example 37
Project: PA   File: RageGames.java   Source Code and License 5 votes vote down vote up
public static RagePlayer getPlayer(OfflinePlayer p) {
    for (RagePlayer pl : players) {
        if (pl.getName() == null) continue;
        if (pl.getName().equalsIgnoreCase(p.getName())) return pl;
    }
    RagePlayer us = new RagePlayer(p.getName());
    if (us.isOnline()) players.add(us);
    return us;
}
 
Example 38
Project: SamaGamesAPI   File: Game.java   Source Code and License 5 votes vote down vote up
/**
 * Override this to execute something when a disconnected player can no longer join
 * the game.
 *
 * You need to call the {@code super} method at the beginning of your own one.
 *
 * @param player The player who can no longer rejoin the game.
 * @param silent Display a message
 */
public void handleReconnectTimeOut(OfflinePlayer player, boolean silent)
{
    if (this.gameManager.isFreeMode())
        throw new UnsupportedOperationException("You can't use this method while using the free mode!");

    if (this.gamePlayers.containsKey(player.getUniqueId()))
        this.gamePlayers.remove(player.getUniqueId());

    this.gameManager.refreshArena();

    if (!silent)
        this.gameManager.getCoherenceMachine().getMessageManager().writePlayerReconnectTimeOut(player);
}
 
Example 39
Project: Ourtown   File: OurTown.java   Source Code and License 5 votes vote down vote up
public void setPlayerSpawn(OfflinePlayer player, SpawnLocation loc) {
    config.playerConfig.playerSpawn.put(player.getUniqueId(), loc.getName());
    if (config.save_interval_ticks <= 0) {
        config.save();
    }
    if (player.isOnline()) {
        Bukkit.getPlayer(player.getUniqueId()).sendMessage(I18n.format("user.select.set", loc.getName()));
    }
    getLogger().info(I18n.format("log.select", player.getName(), loc.getName()));
}
 
Example 40
Project: AlphaLibary   File: PlayerStatistic.java   Source Code and License 5 votes vote down vote up
public PlayerStatistic(OfflinePlayer player, GameStatistic... array) {
    final UUID[] id = new UUID[1];
    UUIDFetcher.getUUID(player, id1 -> id[0] = id1);

    this.player = id[0];
    for (GameStatistic gameStatistic : array) {
        this.statistics.put(gameStatistic.getName(), gameStatistic);
    }
}