Tell me why this wont work?

Discussion in 'Plugin Development' started by stelar7, Sep 11, 2011.

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

    stelar7

  2. Offline

    feildmaster

    >.> Because nowhere in your code are you "getting" the messages from the log.

    BTW: this plugin is heavily flawed. Even if you do manage to get all the messages in the log... You can't see but the latest messages.

    Otherwise... good job on messy code.

    also, you need.
    Code:
    if(!(sender instanceof Player)) return;
     
  3. Offline

    stelar7

    @Adamki11s

    No, the PM part is working...

    What i want is that when someone uses I.E "/mlog player1" they spy on whatever he sends in a PM

    It's not getting the code from the logg, its getting it in realtime...

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 19, 2016
  4. Then just catch the onPlayerChat event and if the player name is equal to who is being spied on send that player the chat.
     
  5. Offline

    feildmaster

    well you aren't listening to the "spying" correctly.

    1- You shouldn't save it as "Player, Player." That limits it to one spy.
    2- You're looking if "contains" player. That's wrong as well.
    3- Look at the source for some of my chat plugins, see if that helps you.

    Wrong, he wants to listen to commands. Which would work fine in onCommand, he's just trying to process the data incorrectly.

    IE: (this is completely wrong)
    Code:
    if (players.containsValue(player)) {
    	op.sendMessage(ChatColor.BLUE + "[" + msender
    		+ "] Til [" + player.getName() + "] : " + temp);
    }
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 19, 2016
  6. Offline

    stelar7

    How should i save it then?
    why?
     
  7. Offline

    stelar7

  8. Offline

    feildmaster

    I've given my input, I'm not going to just hand you the fixes.

    Store it as:
    Player, List<Player>

    You need to loop through all players to see if they are spying that player. And I tell you, Quantum Connectors, ChannelChat, IgnoreChat, and I think PailPlus all have examples of doing it.
     
Thread Status:
Not open for further replies.

Share This Page