Package org.bukkit

Examples of org.bukkit.OfflinePlayer


        if (args.length < 3) {
            sendUsage(sender, "grantxp");
            return true;
        }
       
        OfflinePlayer offlinePlayer = Bukkit.getServer().getOfflinePlayer(args[0]);
        JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayerOffline(offlinePlayer);
       
        Job job = Jobs.getJob(args[1]);
        if (job == null) {
            sender.sendMessage(ChatColor.RED + Language.getMessage("command.error.job"));
            return true;
        }
        double xpGained;
        try {
            xpGained = Double.parseDouble(args[2]);
        } catch (Exception e) {
            sender.sendMessage(ChatColor.RED + Language.getMessage("command.admin.error"));
            return true;
        }
        if (xpGained <= 0) {
            sender.sendMessage(ChatColor.RED + Language.getMessage("command.admin.error"));
            return true;
        }
        // check if player already has the job
        if (jPlayer.isInJob(job)) {
            Jobs.getPlayerManager().addExperience(jPlayer, job, xpGained);

            Player player = Bukkit.getServer().getPlayer(offlinePlayer.getUniqueId());
            if (player != null) {
                String message = Language.getMessage("command.grantxp.output.target");
                message = message.replace("%jobname%", job.getChatColor() + job.getName() + ChatColor.WHITE);
                message = message.replace("%xpgained%", Double.valueOf(xpGained).toString());
                player.sendMessage(message);
View Full Code Here


        if (args.length < 3) {
            sendUsage(sender, "removexp");
            return true;
        }
       
        OfflinePlayer offlinePlayer = Bukkit.getServer().getOfflinePlayer(args[0]);
        JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayerOffline(offlinePlayer);
       
        Job job = Jobs.getJob(args[1]);
        if (job == null) {
            sender.sendMessage(ChatColor.RED + Language.getMessage("command.error.job"));
            return true;
        }
        double xpLost;
        try {
            xpLost = Double.parseDouble(args[2]);
        } catch (Exception e) {
            sender.sendMessage(ChatColor.RED + Language.getMessage("command.admin.error"));
            return true;
        }
        if (xpLost <= 0) {
            sender.sendMessage(ChatColor.RED + Language.getMessage("command.admin.error"));
            return true;
        }
        // check if player already has the job
        if (jPlayer.isInJob(job)) {
            Jobs.getPlayerManager().removeExperience(jPlayer, job, xpLost);

            Player player = Bukkit.getServer().getPlayer(offlinePlayer.getUniqueId());
            if (player != null) {
                String message = Language.getMessage("command.removexp.output.target");
                message = message.replace("%jobname%", job.getChatColor() + job.getName() + ChatColor.WHITE);
                message = message.replace("%xplost%", Double.valueOf(xpLost).toString());
                player.sendMessage(message);
View Full Code Here

        if (args.length < 3) {
            sendUsage(sender, "transfer");
            return true;
        }
       
        OfflinePlayer offlinePlayer = Bukkit.getServer().getOfflinePlayer(args[0]);
        JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayerOffline(offlinePlayer);
       
        Job oldjob = Jobs.getJob(args[1]);
        Job newjob = Jobs.getJob(args[2]);
        if (oldjob == null) {
            sender.sendMessage(ChatColor.RED + Language.getMessage("command.error.job"));
            return true;
        }
        if (newjob == null) {
            sender.sendMessage(ChatColor.RED + Language.getMessage("command.error.job"));
            return true;
        }
        try {
            if(jPlayer.isInJob(oldjob) && !jPlayer.isInJob(newjob)) {
                Jobs.getPlayerManager().transferJob(jPlayer, oldjob, newjob);

                Player player = Bukkit.getServer().getPlayer(offlinePlayer.getUniqueId());
                if (player != null) {
                    String message = Language.getMessage("command.transfer.output.target");
                    message = message.replace("%oldjobname%", oldjob.getChatColor() + oldjob.getName() + ChatColor.WHITE);
                    message = message.replace("%newjobname%", newjob.getChatColor() + newjob.getName() + ChatColor.WHITE);
                    player.sendMessage(message);
View Full Code Here

        return g != null && g.removePermission(world, permission);
    }

    @Override
    public boolean playerInGroup(String world, String player, String group) {
        OfflinePlayer p = Bukkit.getOfflinePlayer(player);
        Group g = privs.getGroupManager().getGroup(p);
        return g != null && g.isMemberOf(group);
    }
View Full Code Here

        return g != null && playerAddGroup(world, player, g.getName());
    }

    @Override
    public String[] getPlayerGroups(String world, String player) {
        OfflinePlayer p = Bukkit.getOfflinePlayer(player);
        if (p == null) {
            throw new UnsupportedOperationException("Privileges does not support offline players.");
        }
        Group g = privs.getGroupManager().getGroup(p);
        return g != null ? g.getGroupTree().toArray(new String[g.getGroupTree().size()]) : null;
View Full Code Here

        return g != null ? g.getGroupTree().toArray(new String[g.getGroupTree().size()]) : null;
    }

    @Override
    public String getPrimaryGroup(String world, String player) {
        OfflinePlayer p = Bukkit.getOfflinePlayer(player);
        Group g = privs.getGroupManager().getGroup(p);
        return g != null ? g.getName() : null;
    }
View Full Code Here

        return name;
    }

    @Override
    public String[] getPlayerGroups(String world, String player) {
        OfflinePlayer op = Bukkit.getOfflinePlayer(player);
        GroupSet set = perms.getGroupManager().getWorldSet(Bukkit.getWorld(world));
        User user = set.getUser(op);

        Set<Group> children = user.getChildren(true);
        List<String> groups = new ArrayList<String>();
View Full Code Here

        return groups.toArray(new String[groups.size()]);
    }

    @Override
    public String getPrimaryGroup(String world, String player) {
        OfflinePlayer op = Bukkit.getOfflinePlayer(player);
        GroupSet set = perms.getGroupManager().getWorldSet(Bukkit.getWorld(world));
        User user = set.getUser(op);

        Set<Group> children = user.getChildren(false);
        if (!children.isEmpty()) {
View Full Code Here

        return perms != null && perms.isEnabled();
    }

    @Override
    public boolean playerAdd(String world, String player, String permission) {
        OfflinePlayer op = Bukkit.getOfflinePlayer(player);
        GroupSet set = perms.getGroupManager().getWorldSet(Bukkit.getWorld(world));
        User user = set.getUser(op);

        boolean value = !permission.startsWith("^");
        permission = value ? permission : permission.substring(1);
View Full Code Here

        return true;
    }

    @Override
    public boolean playerAddGroup(String world, String player, String group) {
        OfflinePlayer op = Bukkit.getOfflinePlayer(player);
        GroupSet set = perms.getGroupManager().getWorldSet(Bukkit.getWorld(world));
        User user = set.getUser(op);

        if (set.hasGroup(group)) {
            Group g = set.getGroup(group);
View Full Code Here

TOP

Related Classes of org.bukkit.OfflinePlayer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.