Scoreboard Help

Discussion in 'Plugin Development' started by coolmonkeyguy, Apr 2, 2014.

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

    coolmonkeyguy

    Ok so I have a plugin I'm working on and i need help setting up a scoreboard for a specific player in a game of tag
    now what I would want it to do is when player hits player1 player1's name get put on a side bar scoreboard and player's name get removed from the scoreboard
    And when that player hits someone it removes their name and adds the person they hit onto the scoreboard.

    Here is my code:

    Code:
    @EventHandler
        public void entityDamageEntity(EntityDamageByEntityEvent e) {
            if (!(e.getDamager() instanceof Player));
            {
               
            Player player1 = (Player)e.getEntity();
            if (e.getEntity() instanceof Player);
            {
                Player player = (Player)e.getDamager();
                if (!player.getGameMode().equals(GameMode.CREATIVE)) return;
                Bukkit.getServer().broadcastMessage(ChatColor.LIGHT_PURPLE + "/" + ChatColor.AQUA + "Magic Touch" + ChatColor.LIGHT_PURPLE + "/ " + ChatColor.RED + player.getDisplayName() + ChatColor.DARK_GREEN +  " Killed " + ChatColor.RED + player1.getDisplayName());   
            teleportInword(player1, 401, 4, -806); //Change these values to match the arena map!
            Bukkit.getServer().broadcastMessage(ChatColor.LIGHT_PURPLE + "/" + ChatColor.AQUA + "Magic Touch" + ChatColor.LIGHT_PURPLE + "/ " + ChatColor.RED + player1.getDisplayName() + ChatColor.DARK_GREEN + " is now the it!");
            player.setGameMode(GameMode.SURVIVAL);
            player1.setGameMode(GameMode.CREATIVE);
            ItemStack block = new ItemStack(Material.REDSTONE_BLOCK, 1);
            ItemStack air = new ItemStack(Material.AIR, 1);
            player1.getInventory().setHelmet(block);
            player.getInventory().setHelmet(air);
            player1.setAllowFlight(false);
           
            }
            }
        }
     
  2. Offline

    Timbo_KZ

    coolmonkeyguy
    I hope you know that this part here does nothing:
    Code:java
    1. if (!(e.getDamager() instanceof Player));
    2. {

    It should be this instead:
    Code:java
    1. if (e.getDamager() instanceof Player)
    2. {


    And also here:
    Code:java
    1. teleportInword(player1, 401, 4, -806); //Change these values to match the arena map!

    you can change it to:
    Code:java
    1. teleportInword(player1, 401, 4, -806); // TODO: Change these values to match the arena map!

    so your IDE will add this task to your todo list (if your IDE has such functionality)

    And about your question. In your code I can't even a slightest attempt to create a scoreboard yourself. At least try it first, then come back and ask questions.
     
Thread Status:
Not open for further replies.

Share This Page