Question Player Score

Discussion in 'Bukkit Help' started by Spadax, Feb 11, 2017.

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

    Spadax

    Hello, I would like create a score for : "when the player execute command /jjoin, we add 1 to JumpScore". With this score, I would like detect than if the player has a score in JumpScore and it equal to 1, as soon as the player walk on the block of dirt he is teleport.

    My code for the moment:

    Code:
    public class Main extends JavaPlugin implements Listener{
       
        public void onEnable(){
            Bukkit.getServer().getPluginManager().registerEvents(this, this);
        }
       
        @Override
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
            Player p = (Player) sender;
            ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
           
            if(cmd.getName().equalsIgnoreCase("jjoin")){
                p.sendMessage("§8[§b§lY§fJump§8] §6§oTéléportation au jump ! Le compteur est lancé !");
                Bukkit.dispatchCommand(console, "warp Jump "+p.getName());
           
            }
           
           
           
           
           
           
            return false;
        }
       
       
        @EventHandler
        public void onFinish(PlayerMoveEvent e){
            Player p = e.getPlayer();
            Location loc = new Location(p.getWorld(), p.getLocation().getBlockX(), p.getLocation().getBlockY() -1, p.getLocation().getBlockZ());
            ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
           
           
            if(p.getWorld().getBlockAt(loc).getType() == Material.
                Bukkit.dispatchCommand(console, "warp Jump "+p.getName());
            }
        }
    
    }
    

    Thanks for your replies. (I am a french for info)
     
  2. Offline

    Zombie_Striker

    @Spadax
    What is your issue? What do you mean by score? Do you mean the score for a scoreboard, or just some other value? What have you tried already?
     
  3. Offline

    Spadax

    My problem is that I have no idea how to do that, i didn't find a internet page or a video on this subject. I would like a value to detect if the player is in the jump.
     
  4. Offline

    Zombie_Striker

    @Spadax
    1. Create an arraylist. The keys will be UUIDs. This represents all the players with a "Jumpscore".
    2. When a player issues that command, add their UUID to the arraylist.
    3. When a player moves over dirt, check if they are in the arraylist. If so, teleport them.
     
  5. Offline

    Spadax

    Hello, It's work. Thanks !
     
Thread Status:
Not open for further replies.

Share This Page