v116.1 Lithium Mute & MuteMap Command

Results 1 to 8 of 8
  1. #1
    Member Calvin Yang is offline
    MemberRank
    Jan 2013 Join Date
    Honolulu, HawaiLocation
    69Posts

    v116.1 Lithium Mute & MuteMap Command

    Some of you may have this and I know most of you don't so I will be releasing this.

    public static class Mute extends CommandExecute {

    @Override
    public int execute(MapleClient c, String[] splitted) {
    MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(splitted[1]);
    if (victim == null) {
    victim.canTalk(false);
    victim.dropMessage(5, "Your chatting ability is now " + (victim.getCanTalk() ? "on" : "off"));
    c.getPlayer().dropMessage(6, "Player's chatting ability is now set to " + victim.getCanTalk());
    return 0;
    } else {
    c.getPlayer().dropMessage(6, "Player not found");
    }
    return 1;
    }
    }

    public static class unMute extends CommandExecute {


    @Override
    public int execute(MapleClient c, String[] splitted) {
    MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(splitted[1]);
    if (victim == null) {
    victim.canTalk(true);
    victim.dropMessage(5, "Your chatting ability is now " + (victim.getCanTalk() ? "on" : "off"));
    c.getPlayer().dropMessage(6, "Player's chatting ability is now set to " + victim.getCanTalk());
    return 0;
    } else {
    c.getPlayer().dropMessage(6, "Player not found");
    }
    return 1;
    }
    }

    public static class MuteMap extends CommandExecute {


    @Override
    public int execute(MapleClient c, String[] splitted) {
    MapleCharacter Map = c.getChannelServer().getPlayerStorage().getCharacterByName(splitted[1]);
    if (Map == null) {
    Map.canTalk(false);
    c.getPlayer().dropMessage(6, "Map is now muted");
    return 0;
    } else {
    c.getPlayer().dropMessage(6, "Player not found");
    }
    return 1;
    }
    }

    public static class unMuteMap extends CommandExecute {


    @Override
    public int execute(MapleClient c, String[] splitted) {
    MapleCharacter Map = c.getChannelServer().getPlayerStorage().getCharacterByName(splitted[1]);
    if (Map == null) {
    Map.canTalk(true);
    c.getPlayer().dropMessage(6, "Map is now unmuted");
    return 0;
    } else {
    c.getPlayer().dropMessage(6, "Player not found");
    }
    return 1;
    }
    }
    Last edited by Calvin Yang; 25-02-13 at 08:15 AM.


  2. #2
    Grand Master edwinkbs is offline
    Grand MasterRank
    Apr 2009 Join Date
    MalaysiaLocation
    831Posts

    Re: v116.1 Lithium Mute & MuteMap Command

    With this, people still can talk. You should provide more function like generalchat etc.

  3. #3
    Grand Master AristoCat is offline
    Grand MasterRank
    Apr 2012 Join Date
    947Posts

    Re: v116.1 Lithium Mute & MuteMap Command

    You should make a boolean for each character, and save it to database.

  4. #4
    Member Calvin Yang is offline
    MemberRank
    Jan 2013 Join Date
    Honolulu, HawaiLocation
    69Posts

    Re: v116.1 Lithium Mute & MuteMap Command

    This is all I can think of, I tried to convert the Mute commands from a v83 source into Lithium.

  5. #5
    Have Fun! SuPeR SoNiC is offline
    Grand MasterRank
    Nov 2008 Join Date
    509Posts

    Re: v116.1 Lithium Mute & MuteMap Command

    You should add something like this in your general chat handler:

    PHP Code:
    if (!c.get player().canTalk()) {
       
    c.getPlayer().message("You are muted and thus cannot chat ");
       return;

    Only then it will work.

    EDIT: oh. I see you also made a map wide mute. Add this too then:

    PHP Code:
    if (!c.get player().getMap().canTalk()) {
       
    c.getPlayer().message("You cannot chat in this map as it was muted by a GM.");
       return;

    -Sent from my mobile-
    Last edited by SuPeR SoNiC; 25-02-13 at 11:37 AM.

  6. #6
    Grand Master AristoCat is offline
    Grand MasterRank
    Apr 2012 Join Date
    947Posts

    Re: v116.1 Lithium Mute & MuteMap Command

    Map Mute can mean two things, mute the map itself, or mute the characters in map.

  7. #7
    Have Fun! SuPeR SoNiC is offline
    Grand MasterRank
    Nov 2008 Join Date
    509Posts

    Re: v116.1 Lithium Mute & MuteMap Command

    Quote Originally Posted by AristoCat View Post
    Map Mute can mean two things, mute the map itself, or mute the characters in map.
    That's also right. If you only mute the map, it means this map only is muted. However, if you mute all characters in it, they will stay muted even if they change map. It just depends on what you want to do with it.

    -Sent from my mobile-

  8. #8
    Member Calvin Yang is offline
    MemberRank
    Jan 2013 Join Date
    Honolulu, HawaiLocation
    69Posts

    Re: v116.1 Lithium Mute & MuteMap Command

    Quote Originally Posted by SuPeR SoNiC View Post
    You should add something like this in your general chat handler:

    PHP Code:
    if (!c.get player().canTalk()) {
       
    c.getPlayer().message("You are muted and thus cannot chat ");
       return;

    Only then it will work.

    EDIT: oh. I see you also made a map wide mute. Add this too then:

    PHP Code:
    if (!c.get player().getMap().canTalk()) {
       
    c.getPlayer().message("You cannot chat in this map as it was muted by a GM.");
       return;

    -Sent from my mobile-

    I think I have that in the ChatHandler.java already
    public class ChatHandler {

    public static final void GeneralChat(final String text, final byte unk, final MapleClient c, final MapleCharacter chr) {
    if (text.length() > 0 && chr != null && chr.getMap() != null && !CommandProcessor.processCommand(c, text, chr.getBattle() == null ? CommandType.NORMAL : CommandType.POKEMON)) {
    if (!chr.isIntern() && text.length() >= 80) {
    return;
    }
    if (chr.getCanTalk() || chr.isStaff()) {
    //Note: This patch is needed to prevent chat packet from being broadcast to people who might be packet sniffing.
    if (chr.isHidden()) {
    if (chr.isIntern() && !chr.isSuperGM() && unk == 0) {
    chr.getMap().broadcastGMMessage(chr, CField.getChatText(chr.getId(), text, false, (byte) 1), true);
    if (unk == 0) {
    chr.getMap().broadcastGMMessage(chr, CWvsContext.serverNotice(2, chr.getName() + " : " + text), true);
    }
    } else {
    chr.getMap().broadcastGMMessage(chr, CField.getChatText(chr.getId(), text, c.getPlayer().isSuperGM(), unk), true);
    }
    } else {
    chr.getCheatTracker().checkMsg();
    if (chr.isIntern() && !chr.isSuperGM() && unk == 0) {
    chr.getMap().broadcastMessage(CField.getChatText(chr.getId(), text, false, (byte) 1), c.getPlayer().getTruePosition());
    if (unk == 0) {
    chr.getMap().broadcastMessage(CWvsContext.serverNotice(2, chr.getName() + " : " + text), c.getPlayer().getTruePosition());
    }
    } else {
    chr.getMap().broadcastMessage(CField.getChatText(chr.getId(), text, c.getPlayer().isSuperGM(), unk), c.getPlayer().getTruePosition());
    }
    }
    if (text.equalsIgnoreCase(c.getChannelServer().getServerName() + " rocks")) {
    chr.finishAchievement(11);
    }
    } else {
    c.getSession().write(CWvsContext.serverNotice(6, "You have been muted and are therefore unable to talk."));
    }
    }
    }
    Quote Originally Posted by AristoCat View Post
    Map Mute can mean two things, mute the map itself, or mute the characters in map.
    The command that I posted was to mute the map itself, I haven't really tested so I don't know if it works or not.



Advertisement