My plugin work but there is a problem

Discussion in 'Plugin Development' started by Iversen123, Dec 26, 2012.

?

I have a problem too. I started making a plugin called "Awnser" it corresponds players on standard q

Poll closed Feb 26, 2013.
  1. I don't know what this is :D

    100.0%
  2. And this too :D

    0 vote(s)
    0.0%
Multiple votes are allowed.
Thread Status:
Not open for further replies.
  1. Offline

    Iversen123

    I have a problem too. I started making a plugin called "Awnser" it corresponds players on standard questions like "unstick me!" and then says "Type / unstick to get out" I got it to work but it is not in what they have written but over? and it is there twice? Its like
    Type /unstick to get out!
    <Jeb> unstick me! and then its like <Jeb>
    Look my Eclipse project:

    Code:
     
     
    @EventHandler
    public void playerChat(AsyncPlayerChatEvent e){
    String inmessage = e.getMessage();
    if (inmessage.equalsIgnoreCase("unstick me")) {
    e.getPlayer().sendMessage("type /unstick to get out!");
     
     
    Can you help me please?
     
  2. Offline

    MP5K

    hello Iversen123,
    use:
    PHP:
    e.setCancelled(true);
     
  3. Offline

    Iversen123

    OPPS! is "e.setCancelled(true);" instead "inmessage.equalsIgnoreCase"?
     
  4. Offline

    MP5K

    no call it after "e.getPlayer().sendMessage("type /unstick to get out!");"
     
  5. Offline

    Iversen123

    Ok.. its under my question now, but its still say "Type /unstick to get out!" 2 times -,-
     
  6. Offline

    kingBS11

    Your getting the chat event but it's registering that the player is chatting more than once so it repeats the message. I'll come up with a code right now to fix that, gimme a minute.
     
  7. Offline

    MP5K

    try to add a return statement @ the end :D
    edit try: add : "if(e.isCancelled()) return;" at the beginning of your method
     
  8. Offline

    kingBS11

    Try this and see if it works.
    Code:
    @EventHandler
    public void playerChat(AsyncPlayerChatEvent e){
    String inmessage = e.getMessage();
    if (inmessage.equalsIgnoreCase("unstick me")) {
    Player p = e.getPlayer();
    p.sendMessage("type /unstick to get out!");
    e.setCancelled(true);
    return;
    He's right :D

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 30, 2016
  9. Offline

    Iversen123

    Ty! its working now :D
     
Thread Status:
Not open for further replies.

Share This Page