PlayJoinEvent - disallowing it

Discussion in 'Plugin Development' started by Otisdiver, Dec 24, 2013.

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

    Otisdiver

    This line is giving me compilation errors, API Docs and Doxygen and Google have yielded no answers.
    Code:java
    1. event.disallow(result, kick); // what do I put for result..

    I've tried strings, objects, and so many things. Eclipse doesn't like it.
    I don't know what to put as result.
    (side note; all of my other codeis correct. kick is a string I defined- don't worry about it.)
    Probably the closest I think I've gotten is
    Code:java
    1. event.disallow(PlayerLoginEvent.Result.KICK_OTHER, kick);


    Am I missing something? (basically I want to kick them, and prevent them from logging in)
     
  2. Offline

    Gater12

  3. Offline

    Otisdiver

    Still getting this error:
    "The method disallow(PlayerLoginEvent.Result, String) is undefined for the type PlayerJoinEvent"
    with the code
    Code:java
    1. else { // occurs if they aren't white-listed
    2. String kick = ChatColor.RED + "" + ChatColor.ITALIC + "Sorry, you aren't whitelisted!";
    3. event.disallow(PlayerLoginEvent.Result.KICK_OTHER, kick);
    4. }

    :/
     
  4. Offline

    BajanAmerican

    Use PlayerLoginEvent, not PlayerJoinEvent
    Otisdiver
     
  5. Offline

    xTigerRebornx

    Otisdiver You are using PlayerJoinEvent, use PlayerLoginEvent instead

    Edit: Got ninjad -cries-
     
  6. Offline

    Otisdiver

    Huh? My code says (PlayerLoginEvent.Result.KICK_OTHER, kick)
    never mind - see other post

    oohh you guys are psychic, I typed the wrong event in the listener. Thanks!
    previous code;
    Code:java
    1. public class EventListener implements Listener{
    2. @EventHandler(priority = EventPriority.HIGH)
    3. public void onJoin(PlayerJoinEvent event){

    changed to;
    Code:java
    1. public class EventListener implements Listener{
    2. @EventHandler(priority = EventPriority.HIGH)
    3. public void onJoin(PlayerLoginEvent event) // (wrong event)


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

Share This Page