Open Inventory Code?

Discussion in 'Plugin Development' started by stantheman68, Oct 4, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    stantheman68

    Hey Bukkit,

    I was going to make a plugin where you could view other players inventory's even when there offline. But i'm stuck on how to do it. Here is my code / command.
    Code:
    public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
            if(commandLabel.equalsIgnoreCase("invsee")) {
                Player player = (Player) sender;
                player.getOpenInventory().convertSlot(0);
    Thanks
     
  2. Offline

    SirTyler

    If they are Offline then it's an instance of an OfflinePlayer class, not the Player class as that is online.
     
  3. Offline

    stantheman68

    Wait would I use this code?

    Code:
    public interface OfflinePlayer extends ServerOperator, AnimalTamer, ConfigurationSerializable {
        public boolean isOnline();
     
  4. Offline

    one4me

    For the most part, a way of getting information about a player who is offline isn't include in the API.

    So to get around this you'll probably end up having to load the players file to an entity so that you can more easily access the data, or read the players file directly.

    If you want to read the file directly, you may find this useful [LIB/TUT] Improved Offline Player - NBT Editing made easy!, the method used for getting and setting a players inventory from the file does work, however information in books is not saved as I've been holding off until Bukkit adds support for them (which, as far as I know, has not already been added).
     
  5. Offline

    stantheman68

    Mood:
    Confused :S
    Please help I don't really understand that code.

    Can someone please help me? I still have not figured it out.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 29, 2016
Thread Status:
Not open for further replies.

Share This Page