{"action":"created","issue":{"url":"https://api.github.com/repos/Nukkit/Nukkit/issues/197","labels_url":"https://api.github.com/repos/Nukkit/Nukkit/issues/197/labels{/name}","comments_url":"https://api.github.com/repos/Nukkit/Nukkit/issues/197/comments","events_url":"https://api.github.com/repos/Nukkit/Nukkit/issues/197/events","html_url":"https://github.com/Nukkit/Nukkit/issues/197","id":123181224,"number":197,"title":"PlayerCommandPreprocessEvent fires before PlayerChatEvent","user":{"login":"fromgate","id":1344181,"avatar_url":"https://avatars.githubusercontent.com/u/1344181?v=3","gravatar_id":"","url":"https://api.github.com/users/fromgate","html_url":"https://github.com/fromgate","followers_url":"https://api.github.com/users/fromgate/followers","following_url":"https://api.github.com/users/fromgate/following{/other_user}","gists_url":"https://api.github.com/users/fromgate/gists{/gist_id}","starred_url":"https://api.github.com/users/fromgate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fromgate/subscriptions","organizations_url":"https://api.github.com/users/fromgate/orgs","repos_url":"https://api.github.com/users/fromgate/repos","events_url":"https://api.github.com/users/fromgate/events{/privacy}","received_events_url":"https://api.github.com/users/fromgate/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-12-20T20:27:30Z","updated_at":"2015-12-21T06:05:28Z","closed_at":null,"body":"When you type message in chat it controlled by two kind of events:\r\n1st - PlayerCommandPreprocessEvent\r\n2nd - PlayerChatEvent\r\nIf you cancel  PlayerCommandPreprocessEvent you will find that PlayerChatEvent will not fire.\r\n\r\nI think this events must be separated: \r\n* PlayerChatEvent — for chat only\r\n* PlayerCommandPreprocessEvent — for commands only (messages started with \"/\").\r\n\r\nHow to reproduce:\r\n```\r\n    @EventHandler (priority = EventPriority.NORMAL)\r\n    public void onChat(PlayerChatEvent event){\r\n        event.getPlayer().sendMessage(\"PlayerChatEvent\");\r\n    }\r\n\r\n    @EventHandler (priority = EventPriority.NORMAL)\r\n    public void onCommandPre (PlayerCommandPreprocessEvent event){\r\n        event.getPlayer().sendMessage(\"PlayerCommandPreprocessEvent\");\r\n    }\r\n```\r\n\r\nRegister this event handlers, type something in chat and you will see messages:\r\n1. PlayerCommandPreprocessEvent\r\n2. PlayerChatEvent"},"comment":{"url":"https://api.github.com/repos/Nukkit/Nukkit/issues/comments/166211594","html_url":"https://github.com/Nukkit/Nukkit/issues/197#issuecomment-166211594","issue_url":"https://api.github.com/repos/Nukkit/Nukkit/issues/197","id":166211594,"user":{"login":"fromgate","id":1344181,"avatar_url":"https://avatars.githubusercontent.com/u/1344181?v=3","gravatar_id":"","url":"https://api.github.com/users/fromgate","html_url":"https://github.com/fromgate","followers_url":"https://api.github.com/users/fromgate/followers","following_url":"https://api.github.com/users/fromgate/following{/other_user}","gists_url":"https://api.github.com/users/fromgate/gists{/gist_id}","starred_url":"https://api.github.com/users/fromgate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fromgate/subscriptions","organizations_url":"https://api.github.com/users/fromgate/orgs","repos_url":"https://api.github.com/users/fromgate/repos","events_url":"https://api.github.com/users/fromgate/events{/privacy}","received_events_url":"https://api.github.com/users/fromgate/received_events","type":"User","site_admin":false},"created_at":"2015-12-21T06:05:28Z","updated_at":"2015-12-21T06:05:28Z","body":"I'm not sure that it's a correct. Looks like PlayerChatEvent became worthless.\r\n\r\nI think this tasks must be divided:\r\n1. All commands (messages started by \"/\") must be controlled by PlayerCommandPreprocessEvent\r\n2. All chat message (messages that started by any symbol except \"/\") must be controlled by PlayerChatEvent.\r\n\r\n"}}