Store a location to use it later on?

Discussion in 'Plugin Development' started by WHQ, Oct 27, 2015.

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

    WHQ

    Simple question here:

    I have this plugin where i want to get the height at wich a player begins in an event, and store it somewhere to use it later in an oncommand method

    like for example:
    Code:
    @EventHandler
    
        public void JumpBlockevent(PlayerMoveEvent e){
           
    
            double startheight = p.getLocation().getY();
           
            if(blablabla){
                //get the current Y of the player and store it somehow
    }
    }
    
    public boolean onCommand(CommandSender sender, Command cmd, String label, String [] args)
             {
                if(!(sender instanceof Player))
                    return false;
                        if(label.equalsIgnoreCase("test")){
                {
                     if(args.length == 1)
                     {
                         if(args[0].equalsIgnoreCase("beginheight")){
                          p.sendMessage("Your height at the begin of the game was:" + //get the startingheight from the event )
                               
    
    Thanks
     
  2. Offline

    mine-care

    Short term, store it in a map associated with the name or even better hike of the player.
    On command check if the map contains the player characteristic (name or uuid) and if so get it and there you have it.
    Also follow naming conventions
     
  3. Offline

    WHQ

    @mine-care Thanks, will try this!
    oh, and about the naming conventions, i just wrote this piece of code as an example (the real plugin looks a lot different)
     
Thread Status:
Not open for further replies.

Share This Page