Package org.bukkit

Examples of org.bukkit.OfflinePlayer


        String namespace = sign.getLine(0).trim();

        if(CraftBookPlugin.inst().getConfiguration().convertNamesToCBID
                && namespace.startsWith("~") && CraftBookPlugin.inst().getUUIDMappings().getUUID(namespace.replace("~", "")) == null) {
            OfflinePlayer player = Bukkit.getOfflinePlayer(namespace.replace("~", ""));
            if(player.hasPlayedBefore()) {
                String originalNamespace = namespace;

                try {
                    ProfileService resolver = HttpRepositoryService.forMinecraft();
                    Profile profile = resolver.findByName("player.getName()"); // May be null
View Full Code Here


        band = getSign().getLine(2);
        if (!getLine(3).trim().isEmpty()) {
            if(CraftBookPlugin.inst().getConfiguration().convertNamesToCBID && CraftBookPlugin.inst().getUUIDMappings().getUUID(getLine(3)) == null) {
                String line3 = getLine(3);
                OfflinePlayer player = Bukkit.getOfflinePlayer(getLine(3));
                if(player.hasPlayedBefore()) {
                    try {
                        ProfileService resolver = HttpRepositoryService.forMinecraft();
                        Profile profile = resolver.findByName(player.getName()); // May be null

                        UUID uuid = profile.getUniqueId();
                        band = CraftBookPlugin.inst().getUUIDMappings().getCBID(uuid);
                        getSign().setLine(3, line3);
                        getSign().update(false);
View Full Code Here

        band = getSign().getLine(2);
        if (!getLine(3).trim().isEmpty()) {
            if(CraftBookPlugin.inst().getConfiguration().convertNamesToCBID && CraftBookPlugin.inst().getUUIDMappings().getUUID(getLine(3)) == null) {
                String line3 = getLine(3);
                OfflinePlayer player = Bukkit.getOfflinePlayer(getLine(3));
                if(player.hasPlayedBefore()) {
                    try {
                        ProfileService resolver = HttpRepositoryService.forMinecraft();
                        Profile profile = resolver.findByName(player.getName()); // May be null

                        UUID uuid = profile.getUniqueId();
                        band = CraftBookPlugin.inst().getUUIDMappings().getCBID(uuid);
                        getSign().setLine(3, line3);
                        getSign().update(false);
View Full Code Here

  }
 
  @Override
  public Long getFirstPlayed(String senderId)
  {
    OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(senderId);
    Long ret = offlinePlayer.getFirstPlayed();
    if (ret == 0) ret = null;
    return ret;
  }
View Full Code Here

  /**
   * デバッグ用 syamnがオンラインならメッセージを送る
   * @param msg
   */
  public static void debug(String msg){
    OfflinePlayer syamn = Bukkit.getServer().getOfflinePlayer("syamn");
    if (syamn.isOnline()){
      Actions.message(null, (Player) syamn, msg);
    }
  }
View Full Code Here

                usage = "[-p page] [player]", desc = "Tell information about a player",
                flags = "op:", min = 0, max = 1)
        @CommandPermissions({"commandbook.whois"})
        public void whois(CommandContext args, CommandSender sender) throws CommandException {

            OfflinePlayer offline;

            if (args.argsLength() == 0) {
                offline = PlayerUtil.checkPlayer(sender);
            } else {
                try {
                    offline = InputUtil.PlayerParser.matchSinglePlayer(sender, args.getString(0));
                } catch (CommandException e) {
                    if (args.hasFlag('o')) {
                        offline = CommandBook.server().getOfflinePlayer(args.getString(0));
                    } else {
                        throw e;
                    }
                }

                if (offline != sender) {
                    CommandBook.inst().checkPermission(sender, "commandbook.whois.other");
                }
            }

            PlayerWhoisEvent event = new PlayerWhoisEvent(offline, sender);

            event.addWhoisInformation("UUID", offline.getUniqueId());
            if (offline instanceof Player) {
                Player player = (Player) offline;
                event.addWhoisInformation("Display name", player.getDisplayName());
                event.addWhoisInformation("Entity ID #", player.getEntityId());
                event.addWhoisInformation("Current vehicle", player.getVehicle());


                if (CommandBook.inst().hasPermission(sender, "commandbook.ip-address")) {
                    event.addWhoisInformation("Address", player.getAddress().toString());
                }
                event.addWhoisInformation("Game mode", player.getGameMode());
            }

            Location bedSpawn = offline.getBedSpawnLocation();
            if (bedSpawn != null) {
                event.addWhoisInformation("Bed spawn location",
                        ChatUtil.toFriendlyString(bedSpawn));
            } else {
                event.addWhoisInformation(null, "No bed spawn location");
            }

            if (offline.hasPlayedBefore()) {
                event.addWhoisInformation(null, "First joined: " + dateFormat.format(offline.getFirstPlayed())
                        + "; Last joined: " + dateFormat.format(offline.getLastPlayed()));
            }


            CommandBook.callEvent(event);

            List<String> results = new ArrayList<String>(event.getTaglessWhoisInformation());
            for (Map.Entry<String, String> entry : event.getTaggedWhoisInformation().entrySet()) {
                results.add(entry.getKey() + ": " + entry.getValue());
            }

            new PaginatedResult<String>("Name: " + offline.getName()) {

                @Override
                public String format(String entry) {
                    return entry;
                }
View Full Code Here

import java.util.UUID;

public class UUIDUtil {

    public static UUID convert(String playerName) {
        OfflinePlayer player = CommandBook.server().getOfflinePlayer(playerName);
        return player != null ? player.getUniqueId() : null;
    }
View Full Code Here

    // - Migration Functions
    private boolean migrate(String commander, File dest) {
        boolean result = false;
        try {
            // Try to parse the commander as a player's UUID
            OfflinePlayer player = Bukkit.getOfflinePlayer(UUID.fromString(commander));
            if (player != null) {
                // A player was found, see if they have an old file based on their name to migrate
                File oldUserFile = new File(sessionsDir.getPath() + File.separator + player.getName() + ".yml");
                if (oldUserFile.exists()) {
                    // Move the file, and print an error if the move operation failed
                    result = oldUserFile.renameTo(dest);
                    if (!result) {
                        CommandBook.logger().warning("Could not update a player's session file to use UUID: " + commander);
View Full Code Here

            ex.printStackTrace();
        }
    }

    private void bukkitBan(final boolean flag){
        OfflinePlayer target = plugin.getServer().getOfflinePlayer(playerName);
        if (target == null){
            return;
        }
        if (flag){
            if (!target.isBanned()){
                target.setBanned(true);
                this.kickPlayer(playerName, playerUUID, _("localBanPlayer", I18n.PLAYER, playerName, I18n.SENDER, senderName, I18n.REASON, reason, I18n.IP, playerIP));
            }
        }else{
            if (target.isBanned()){
                target.setBanned(false);
            }
        }
    }
View Full Code Here

                    if(response.has("actions")){
                        if (response.getJSONArray("actions").length() > 0) {
                            for (int v = 0; v < response.getJSONArray("actions").length(); v++) {
                              JSONObject plyer = response.getJSONArray("actions").getJSONObject(v);
                              //plugin.act( plyer.getString("do"), plyer.getString("uuid"));
                              OfflinePlayer d = plugin.getServer().getOfflinePlayer(plyer.getString("name"));
                            if (d != null){
                              if(d.isBanned()){
                                    if(plyer.getString("do").equals("unban")){
                                        d.setBanned(false);
                                    }
                                }else{
                                    if(plyer.getString("do").equals("ban")){
                                        d.setBanned(true);
                                    }
                                }
                            }
                            }
                        }
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.