Search in sources :

Example 51 with OfflinePlayer

use of org.bukkit.OfflinePlayer in project Glowstone by GlowstoneMC.

the class GlowTeam method getPlayers.

@Override
@Deprecated
public Set<OfflinePlayer> getPlayers() throws IllegalStateException {
    Set<OfflinePlayer> playerObjectSet = new HashSet<>(players.size());
    playerObjectSet.addAll(players.stream().map(s -> new GlowOfflinePlayer((GlowServer) Bukkit.getServer(), s)).collect(Collectors.toList()));
    return playerObjectSet;
}
Also used : GlowOfflinePlayer(net.glowstone.GlowOfflinePlayer) OfflinePlayer(org.bukkit.OfflinePlayer) GlowOfflinePlayer(net.glowstone.GlowOfflinePlayer) GlowServer(net.glowstone.GlowServer) HashSet(java.util.HashSet)

Example 52 with OfflinePlayer

use of org.bukkit.OfflinePlayer in project Essentials by drtshock.

the class Commandunban method run.

@Override
public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception {
    if (args.length < 1) {
        throw new NotEnoughArgumentsException();
    }
    String name;
    try {
        final User user = getPlayer(server, args, 0, true, true);
        name = user.getName();
        ess.getServer().getBanList(BanList.Type.NAME).pardon(name);
    } catch (NoSuchFieldException e) {
        final OfflinePlayer player = server.getOfflinePlayer(args[0]);
        name = player.getName();
        if (!player.isBanned()) {
            throw new Exception(tl("playerNotFound"), e);
        }
        ess.getServer().getBanList(BanList.Type.NAME).pardon(name);
    }
    final String senderName = sender.isPlayer() ? sender.getPlayer().getDisplayName() : Console.NAME;
    server.getLogger().log(Level.INFO, tl("playerUnbanned", senderName, name));
    ess.broadcastMessage("essentials.ban.notify", tl("playerUnbanned", senderName, name));
}
Also used : User(com.earth2me.essentials.User) OfflinePlayer(org.bukkit.OfflinePlayer)

Aggregations

OfflinePlayer (org.bukkit.OfflinePlayer)52 Player (org.bukkit.entity.Player)19 JobsPlayer (com.gamingmesh.jobs.container.JobsPlayer)10 Job (com.gamingmesh.jobs.container.Job)8 InvocationTargetException (java.lang.reflect.InvocationTargetException)8 File (java.io.File)5 ArrayList (java.util.ArrayList)5 Test (org.junit.Test)5 HashSet (java.util.HashSet)4 World (org.bukkit.World)4 CommandSender (org.bukkit.command.CommandSender)4 Matchers.containsString (org.hamcrest.Matchers.containsString)4 JobProgression (com.gamingmesh.jobs.container.JobProgression)2 IOException (java.io.IOException)2 UUID (java.util.UUID)2 net.aufdemrand.denizen.objects.dWorld (net.aufdemrand.denizen.objects.dWorld)2 Element (net.aufdemrand.denizencore.objects.Element)2 GlowOfflinePlayer (net.glowstone.GlowOfflinePlayer)2 User (com.earth2me.essentials.User)1 ImmutableList (com.google.common.collect.ImmutableList)1