Making commands send error msgs to the console

Discussion in 'Plugin Development' started by CrypticByte, Sep 14, 2016.

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

    CrypticByte

    Hello, my name is CrypticByte. Lately I have been watching tutorials, and have had people help me with plugin development. But I have come across a problem I just cant fix, If anyone would like to help I would appreciate it. - Cryptic

    -------------------------------------------------------------------------------------------------------------------------------
    The Problem:
    -------------------------------------------------------------------------------------------------------------------------------

    So In the photo below in the command prompt is the problem. I'm trying to get it where when you send a command threw the command prompt/console it will show a error msg. cause it isn't a player but I don't exactly know how. I have tried GetLoggers and Senders but I keeps happening, and I'm not sure how to fix it. If anyone would mind telling me another way/how to fix it I would be so thankful. - Cryptic

    -------------------------------------------------------------------------------------------------------------------------------
    Console Error:
    -------------------------------------------------------------------------------------------------------------------------------

    [​IMG]

    -------------------------------------------------------------------------------------------------------------------------------
    Code:
    -------------------------------------------------------------------------------------------------------------------------------

    [​IMG]

    ------------------------------------------------------------------------------------------------------------------------------
    - Eclipse
    -------------------------------------------------------------------------------------------------------------------------------
     
  2. Offline

    timtower Administrator Administrator Moderator

    @CrypticByte You cast to a player before you check if it is a player.
     
    Stipess1 likes this.
  3. Offline

    Zombie_Striker

    @CrypticByte
    Don't blindly cast. Consoles are not players. Plugins are not players. You have to create the player variable AFTER you do the instanceof checks.

    Also, you are checking if sender is a player twice. Remove one of the checks and make sure the one check covers both commands .
     
Thread Status:
Not open for further replies.

Share This Page