!mutemap command

Newbie Spellweaver
Joined
Jan 29, 2009
Messages
7
Reaction score
0
Ok, um.. second release but this isn't tested sorry... I'm not a GM or admin in any server so i can't really test it properly.

Anyway, this command basically mutes everyone in the map. This is useful for events and stuff when you don't want people spamming. If this way works, it also saves coders a lot of time. I know another way to do this is to create a new table in the SQL and stuff but yeah... Here it is:

Code:
        } else if (splitted[0].equals("!mutemap")) {
            for (MapleCharacter mch : c.getPlayer().getMap().getCharacters()) {
            mch.canPartyChat(!mch.getCanPartyChat());
            mch.canTalk(!mch.getCanTalk());
            mch.canSmega(!mch.getCanSmega());
            mch.canGuildChat(!mch.getCanGuildChat());
            mch.canWhisper(!mch.getCanWhisper());
            mc.dropMessage("Map muted.");
                }
 
Ok, um.. second release but this isn't tested sorry... I'm not a GM or admin in any server so i can't really test it properly.

Anyway, this command basically mutes everyone in the map. This is useful for events and stuff when you don't want people spamming. If this way works, it also saves coders a lot of time. I know another way to do this is to create a new table in the SQL and stuff but yeah... Here it is:

Code:
        } else if (splitted[0].equals("!mutemap")) {
            for (MapleCharacter mch : c.getPlayer().getMap().getCharacters()) {
            mch.canPartyChat(!mch.getCanPartyChat());
            mch.canTalk(!mch.getCanTalk());
            mch.canSmega(!mch.getCanSmega());
            mch.canGuildChat(!mch.getCanGuildChat());
            mch.canWhisper(!mch.getCanWhisper());
            mc.dropMessage("Map muted.");
                }

You should make it when they go to another map they are unmuted.
 
This command is good for events, when players won't listen.

You should make a command that enables the players again.

Other then taht 5 stars.
 
PHP:
private boolean aretehplayersmutedomg = false;

public void setAreTehPlayersMutedOmg(boolean yesno) {
    this.aretehplayersmutedomg = yesno;
}

public boolean getAreTehPlayersMutedOmg() {
    return aretehplayersmutedomg;
}

PHP:
if (c.getPlayer().getMap().getAreTehPlayersMutedOmg()) {
    // can't talk, don't feel like doing this now
}
 
MapleMap.java
Code:
private boolean isModerated = false;
    private List<String> vipList = new ArrayList<String>();
Code:
public void setModerated() {
        if (!isModerated) {
            isModerated = true;
        } else {
            isModerated = false;
            vipList.clear();
        }
    }

    public boolean isModerated() {
        return isModerated;
    }

    public void giveVIP(String name) {
        vipList.add(name);
    }

    public void takeVIP(String name) {
        vipList.remove(name);
    }

    public boolean isVIP(String name) {
        if (vipList.contains(name)) {
            return true;
        }
        return false;
    }

GMCommands.java
Code:
if (command.equalsIgnoreCase("!moderate")) {
            if (!player.getMap().isModerated()) {
                player.getMap().setModerated();

                for (MapleCharacter chr : player.getMap().getCharacters()) {
                    chr.dropMessage("[Notice] " + player.getName() + " has set this map's status to moderated.");
                }
            } else {
                player.getMap().setModerated();

                for (MapleCharacter chr : player.getMap().getCharacters()) {
                    chr.dropMessage("[Notice] " + player.getName() + " has set this map's status to not moderated.");
                }
            }
        } else if (command.equalsIgnoreCase("!givevip")) {
            if (splitted.length < 2) {
                player.dropMessage(5, "The !givevip command has the following syntax : !givevip CharacterName");
            } else {
                MapleCharacter victim = cserv.getPlayerStorage().getCharacterByName(splitted[1]);

                if (!player.getMap().isVIP(victim.getName())) {
                    player.getMap().giveVIP(victim.getName());
                    victim.dropMessage(player.getName() + " has given the VIP status to you.");
                    player.dropMessage("You have given the VIP status to " + victim.getName() + ".");
                } else {
                    player.dropMessage(5, victim.getName() + " already has the VIP status.");
                }
            }
        } else if (command.equalsIgnoreCase("!takevip")) {
            if (splitted.length < 2) {
                player.dropMessage(5, "The !takevip command has the following syntax : !takevip CharacterName");
            } else {
                MapleCharacter victim = cserv.getPlayerStorage().getCharacterByName(splitted[1]);

                if (player.getMap().isVIP(victim.getName())) {
                    player.getMap().giveVIP(victim.getName());
                    victim.dropMessage(player.getName() + " has taken the VIP status from you.");
                    player.dropMessage("You have taken the VIP status from " + victim.getName() + ".");
                } else {
                    player.dropMessage(5, victim.getName() + " does not have the VIP status.");
                }
            }
        }
Code:
new CommandDefinition("moderate", ": Switches this map's status to moderated / not moderated.", 1),
            new CommandDefinition("givevip", "CharacterName : Gives the VIP status to the player with the given name.", 1),
            new CommandDefinition("takevip", "CharacterName : Takes the VIP status from the player with the given name.", 1),

GeneralchatHandler.java
Code:
if (c.getPlayer().getMap().isModerated() && !c.getPlayer().getMap().isVIP(c.getPlayer().getName())) {
                    c.getPlayer().dropMessage(1, "You can not chat in a moderated map without having the VIP status.");
                    return;
                }

You maybe have to change it a bit to make it working with your source.
 
:D my releases werent as bad as i thought! Pity i've got gcses coming up... No more releases until june...

Well, your version was bad.
If you use your version the persons you muted do not get unmuted and they are muted in all channels. Even if you make a !unmutemap command they stay muted if they changed map or logged out. That's why I used a list only for the map (in the channel).
 
Well, your version was bad.
If you use your version the persons you muted do not get unmuted and they are muted in all channels. Even if you make a !unmutemap command they stay muted if they changed map or logged out. That's why I used a list only for the map (in the channel).

You could make an event npc which unmutes the players... Or you can add a player command which allows them to unmute themselves in a special map after they lost an event and get warped out.
 
Back