[Solved] Unexpected trouble with PlayerChat

Discussion in 'Plugin Development' started by HotelManager24, Dec 23, 2011.

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

    HotelManager24

    Hey! I'm trying to develop another plugin at the moment. But I'm having a really dum situation. I'm attempting to see when a player sends a chat message. I know you can do the same but with commands like so:

    Code:
    public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
    
    
    if (event.getMessage()) {
    
    }
    
    }
    Well, how do I check for player chat? I think I may have hit "Writers Block" except for programming.. :mad:
     
  2. Offline

    Chiller

    p
    public void onPlayerChat(PlayerChatEvent event)
     
  3. Offline

    HotelManager24

    Yes, I have been using this:
    Code:
    public void onPlayerChat(PlayerChatEvent playerchatting) {
    
     
    		}
    But it isn't helping. The IDE I am using is giving me the error:
    I use Eclipse as my IDE. Please help!

    @Chiller
     
  4. Offline

    theguynextdoor

    For checking things when people chat, i use.
    Code:java
    1. public class GreenPlayerListener extends PlayerListener {
    2.  
    3. public static GreenChat plugin;
    4.  
    5. public GreenPlayerListener(GreenChat instance) {
    6. plugin = instance;
    7. }
    8.  
    9. public void onPlayerChat(PlayerChatEvent event) {
    10. String msg = event.getMessage();
    11.  
    12. if (msg.startsWith(">")) {
    13. msg = ChatColor.GREEN + msg;
    14. }
    15. event.setMessage(msg);
    16.  
    17. }

    That is just an example of how i use it
     
    HotelManager24 likes this.
  5. Offline

    nisovin

    Post the entire class. It looks like you're probably trying to declare a method inside another method.
     
  6. Offline

    HotelManager24

    Nevermind, I got it fixed. Thanks anyways.
     
Thread Status:
Not open for further replies.

Share This Page