Solved onJoin

Discussion in 'Plugin Development' started by glory_fades, Jan 2, 2015.

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

    glory_fades

    so for my server i have this custom join event but when i join the server it does not show up.

    Code:
    @EventHandler(priority=EventPriority.NORMAL)
      public void onJoin(PlayerJoinEvent e)
      {
        Player p = e.getPlayer();
        KitHandler.delKit(e.getPlayer());
        p.getInventory().clear();
        p.getInventory().addItem(new ItemStack[] { Gui.guiItem });
        p.getInventory().addItem(new ItemStack[] { Gui.shopItem });
        p.getInventory().addItem(new ItemStack[] { Gui.donateItem });
        p.getInventory().addItem(new ItemStack[] { Gui.funItem });
        if(p.hasPlayedBefore()) {
          Bukkit.broadcastMessage(ChatColor.YELLOW + "" + ChatColor.BOLD + "Welcome " + p.getName() + " to ParadiseKits!");
        }
        p.sendMessage("");
        p.sendMessage("");
        p.sendMessage("");
        p.sendMessage("");
        p.sendMessage("");
        p.sendMessage("");
        p.sendMessage("");
        p.sendMessage("");
        p.sendMessage("");
        p.sendMessage("");
        p.sendMessage("");
        p.sendMessage("");
        p.sendMessage("");
        p.sendMessage("");
        p.sendMessage("");
        p.sendMessage("");
        p.sendMessage("");
        p.sendMessage("");
        p.sendMessage(ChatColor.GRAY + "" + ChatColor.BOLD + "---------= Welcome to " + ChatColor.YELLOW + ChatColor.BOLD + "ParadiseKits! " + ChatColor.GRAY + ChatColor.BOLD + "=---------");
        p.sendMessage(ChatColor.YELLOW + "Website: " + ChatColor.GRAY + "COMING SOON");
        p.sendMessage(ChatColor.YELLOW + "Donate: " + ChatColor.GRAY + "http://paradisekits.buycraft.net/");
        p.sendMessage(ChatColor.GRAY + "" + ChatColor.BOLD + "---------= Welcome to " + ChatColor.YELLOW + ChatColor.BOLD + "ParadiseKits! " + ChatColor.GRAY + ChatColor.BOLD + "=---------");
        e.setJoinMessage(ChatColor.YELLOW + "[" + ChatColor.GRAY + "+" + ChatColor.YELLOW + "] " + ChatColor.GRAY + p.getName());
        p.removePotionEffect(PotionEffectType.SPEED);
        p.removePotionEffect(PotionEffectType.INCREASE_DAMAGE);
        p.removePotionEffect(PotionEffectType.SLOW);
        p.removePotionEffect(PotionEffectType.BLINDNESS);
        p.removePotionEffect(PotionEffectType.POISON);
        p.removePotionEffect(PotionEffectType.INVISIBILITY);
        KitHandler.delKit(e.getPlayer());
        p.teleport(Bukkit.getWorld("world").getSpawnLocation());
      }
     
  2. Offline

    nverdier

    Did you register the listener in the onEnable?
     
  3. Offline

    Skionz

    @glory_fades Post all relevant classes. Using a for loop would be much better as well.
     
  4. Offline

    LuckehPickle

    Is that class implementing Listener? You also must registerEvents() in your onEnable()
     
  5. Offline

    glory_fades

    i did register the events, that onjoin is in a whole class of events and thats just one of them, they all work except for the onjoin.
     
  6. Offline

    Skionz

     
  7. Offline

    Cycryl

    are there any errors in the console?
     
  8. Offline

    nopvpgamer

    1. Remove all:
    Code:
    p.sendMessage ("");
    replace it with:
    Code:
    for (int i = 1; i != 20; i++){
         p.sendMessage ("");
         }
    
     
  9. Offline

    nverdier

    @nopvpgamer This gives us really no context. Please post all relevant classes (entire classes!).

    EDIT: Whoops, thought you were the OP for some reason...
     
    Last edited by a moderator: Jan 4, 2015
  10. Offline

    moo3oo3oo3

    Are you sure it's send sending the player the message before he actually get on the server
     
  11. Offline

    glory_fades

  12. Offline

    teej107

    @glory_fades
     
  13. Offline

    glory_fades

    ah well i actually just fixed it 10 minutes ago :) forgot to change it to solved
     
Thread Status:
Not open for further replies.

Share This Page