Solved Global Muting

Discussion in 'Plugin Development' started by UnbreakingIV, Mar 28, 2014.

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

    UnbreakingIV

  2. Offline

    Zwander

    In OnChat, all you need to have is
    Code:java
    1.  
    2. //Check if global mute is true
    3. if (globalmute){
    4. //Check if the player has the permission to bypass
    5. if (e.getPlayer.hasPermission("bannamute.bypass")){
    6. //Return breaks the method before cancelling, thus the event isnt cancelled if the player can bypass
    7. return;
    8. }
    9. //Cancels the event so that chat isnt sent
    10. e.setCancelled(true);
    11. }


    Also, note:
    • Methods should start with a lowercase, ie: onChat
    • Variables names should be capitalized at the start of each word (except the first), ie: globalMute
    These make no real difference, but are just the standard convention
     
  3. Offline

    Wolfey

    UnbreakingIV What's funny, is your cancelling the event if the player is an op, but you're letting the normal players speak.
     
  4. Offline

    Zwander

    That^, and why do you force the player to perform that command every time they chat?
     
  5. Offline

    Brett Basinger

    How does he plan on unmuting them?

    Zwander do you agree?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  6. Offline

    Zwander

    Brett Basinger He/she has got that sorted, the command is a toggle.
     
  7. Offline

    Brett Basinger

Thread Status:
Not open for further replies.

Share This Page