Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved My Server Player cant chat

Comments in 'Plugin Development' started by Wleong, Oct 18, 2015.

  1. Wleong
    Offline

    Wleong New Member

    Joined:
    Sep 21, 2015
    Posts:
    25
    Minecraft User:
    WLeong
    Yesterday i have install level plugin to my server..afterthat my players cant chat,but OP can chat..what wrong with this code?
    Im using PHP5 PM1.6..

  2. Wleong
    Offline

    Wleong New Member

    Joined:
    Sep 21, 2015
    Posts:
    25
    Minecraft User:
    WLeong
    But it already have

    public function onChat(PlayerChatEvent $event) {
    $event->setCancelled();


    Sorry i very noob at coding
  3. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    What are you trying to achieve with this? Do you want to mute all players, or just regular players? Please be more specific.
    zombie_Power likes this.
  4. Wleong
    Offline

    Wleong New Member

    Joined:
    Sep 21, 2015
    Posts:
    25
    Minecraft User:
    WLeong

    I dont want mute any player..but after i install this plugin..my player cant chat
  5. zombie_Power
    Offline

    zombie_Power Active Member

    Joined:
    Sep 7, 2015
    Posts:
    239
    Minecraft User:
    Zombie_Power
    then why have you
    PHP:
    $event->setCancelled(); //cancels any $event
    As you have defined $event as PlayerChatEvent, you have cancelled, therefore, meaning that players wont be able to talk
  6. Wleong
    Offline

    Wleong New Member

    Joined:
    Sep 21, 2015
    Posts:
    25
    Minecraft User:
    WLeong
    It was a level plugin..let player able to up lv by mining
  7. HotFireyDeath
    Offline

    HotFireyDeath Notable Member Plugin Developer

    Joined:
    Mar 19, 2015
    Posts:
    328
    Plugins:
    1
    Minecraft User:
    HotFireyDeath
    He cancels the original player message event, and plans to broadcast it using broadcastMessage(); and in this way, doesn't cancel chat.
  8. zombie_Power
    Offline

    zombie_Power Active Member

    Joined:
    Sep 7, 2015
    Posts:
    239
    Minecraft User:
    Zombie_Power
    $event is defined as PlayerChatEvent, Anyways he doesn't want to mute the players, he hasn't really specified well enough, what he wants
  9. HotFireyDeath
    Offline

    HotFireyDeath Notable Member Plugin Developer

    Joined:
    Mar 19, 2015
    Posts:
    328
    Plugins:
    1
    Minecraft User:
    HotFireyDeath
    You asked why he is using $event->setCancelled(); and assumed that that was the error at hand.

    I pointed out to you that he was planning to cancel the original message with $event->setCancelled(); and broadcastMessage(); a custom message.

    Why did you suddenly point out $event is defined as PlayerChatEvent? That is completely unrelated to the topic.
  10. zombie_Power
    Offline

    zombie_Power Active Member

    Joined:
    Sep 7, 2015
    Posts:
    239
    Minecraft User:
    Zombie_Power
  11. zombie_Power
    Offline

    zombie_Power Active Member

    Joined:
    Sep 7, 2015
    Posts:
    239
    Minecraft User:
    Zombie_Power
    The only thing, I can assume is that, he either want the players with op to talk or that his plugin isn't doing what he wants, which is that the players cant talk, so I can be wrong.. until he really specifies, lets take my pathway ;)
  12. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    Use and else statement after isVip() and isSVip() to define the non op and non vip player's chat.
  13. Wleong
    Offline

    Wleong New Member

    Joined:
    Sep 21, 2015
    Posts:
    25
    Minecraft User:
    WLeong
    Ermm..i will explain it more details..
    I want my player able to chat..
    But after i install the plugin..my players chat wont pop out..
    After player type something and press enter..nothing come out..
  14. Wleong
    Offline

    Wleong New Member

    Joined:
    Sep 21, 2015
    Posts:
    25
    Minecraft User:
    WLeong
    If possible i need someone to correct the problem..cause i very poor at coding..
    I tried correct it yersterday..but not work
  15. zombie_Power
    Offline

    zombie_Power Active Member

    Joined:
    Sep 7, 2015
    Posts:
    239
    Minecraft User:
    Zombie_Power
    remove that^
  16. Wleong
    Offline

    Wleong New Member

    Joined:
    Sep 21, 2015
    Posts:
    25
    Minecraft User:
    WLeong
    Ok i try now
  17. Wleong
    Offline

    Wleong New Member

    Joined:
    Sep 21, 2015
    Posts:
    25
    Minecraft User:
    WLeong
    I have to remove the $event line?
  18. zombie_Power
    Offline

    zombie_Power Active Member

    Joined:
    Sep 7, 2015
    Posts:
    239
    Minecraft User:
    Zombie_Power
    only remove line 2- $event->setCancelled();
  19. Wleong
    Offline

    Wleong New Member

    Joined:
    Sep 21, 2015
    Posts:
    25
    Minecraft User:
    WLeong
    After correction what should it look like?
  20. Wleong
    Offline

    Wleong New Member

    Joined:
    Sep 21, 2015
    Posts:
    25
    Minecraft User:
    WLeong
    Ok i try

Share This Page

Advertisement