Console sender isn't working

Discussion in 'Spigot Help' started by BestPlugins312, Feb 22, 2020.

  1. Hello, I'm trying to send a message in console but I can't and it says this error I don't know what should I change in my java files, I searched google but still..Thanks for any help ! problem.png
     
  2. You’re trying to cast the console into a player, which it can’t. If you send the title alert code we can help more.
     
  3. send your titlealert.java
     
  4. You’re casting CommandSender to Player. Which will give an error when you do the command from console because the console isn’t a player.
     
  5. I'm trying to find a solution man I know what is but I don't know what to write now..
     
  6. I don’t really want to spoon feed you all of it but you can do things like:


    Code (Java):
    if (sender instanceof ConsoleCommandSender) {
      // stuff
    }

    if (sender instanceof Player) {
      // other stuff
    }
    I’m typing this from my phone so you might want to double check the spellings. Hope this helps
     
    #6 Broccolai, Feb 22, 2020
    Last edited: Feb 22, 2020