Mute a player

Re: [Release] Mute a player

Use mine

GeneralChatHandler.java
Code:
/*
    This file is part of the OdinMS Maple Story Server
    Copyright (C) 2008 Patrick Huy <[email protected]> 
                       Matthias Butz <[email protected]>
                       Jan Christian Meyer <[email protected]>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License version 3
    as published by the Free Software Foundation. You may not use, modify
    or distribute this program under any other version of the
    GNU Affero General Public License.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

package net.sf.odinms.net.channel.handler;

import net.sf.odinms.client.MapleClient;
import net.sf.odinms.client.messages.CommandProcessor;
import net.sf.odinms.net.AbstractMaplePacketHandler;
import net.sf.odinms.tools.MaplePacketCreator;
import net.sf.odinms.tools.StringUtil;
import net.sf.odinms.tools.data.input.SeekableLittleEndianAccessor;

public class GeneralchatHandler extends AbstractMaplePacketHandler {
    @Override
    public void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
        String text = slea.readMapleAsciiString();
                boolean warning;

        if (!CommandProcessor.processCommand(c, text)) {
            if (StringUtil.countCharacters(text, '@') > 4 || StringUtil.countCharacters(text, '%') > 4 ||
                StringUtil.countCharacters(text, '+') > 6 || StringUtil.countCharacters(text, '$') > 6 ||
                StringUtil.countCharacters(text, '&') > 6 || StringUtil.countCharacters(text, '~') > 6 ||
                StringUtil.countCharacters(text, 'W') > 6) {
                text = "DISREGARD THAT I SUCK COCK.";
            }
                        if (c.getPlayer().getCanTalk() == true) {
                            c.getPlayer().getMap().broadcastMessage(MaplePacketCreator.getChatText(c.getPlayer().getId(), text, c.getPlayer().isGM() ? 1 : 0));
                        } else {
                            c.getPlayer().getClient().getChannelServer().broadcastPacket(MaplePacketCreator.serverNotice(6, "You have been muted and therefore unable to talk."));
                        }
        }
    }
}

kk lets see if yours works =)
 
Re: [Release] Mute a player

Code:
	public int getMuted() {
		return muted;
	}
and
Code:
	public void setMuted(int muted) {
            this.muted = muted; 
        }
Woo! We're half way there!
 
Re: [Release] Mute a player

Hmm..
Code:
else if (splitted[0].equals("!stfu")) {
                    try {
                    int set = Integer.parseInt(splitted[2]);
                    MapleCharacter d = c.getPlayer().getClient().getChannelServer().getPlayerStorage().getCharacterByName(splitted[1]);
                    
                    if (set == 1) {
                        if (d.getCanTalk() == true) {
                            d.canTalk(false);
							d.setMuted(1);
                            d.getClient().getChannelServer().broadcastPacket(MaplePacketCreator.serverNotice(6, "You have been muted."));
                            mc.dropMessage(d.getName() + " has been muted.");
                        } else {
                            mc.dropMessage(d.getName() + " has already been muted");
                        }
                    }
                    if (set == 0) {
                        if (d.getCanTalk() == false) {
                            d.canTalk(true);
							d.setMuted(0);
                            d.getClient().getChannelServer().broadcastPacket(MaplePacketCreator.serverNotice(6, "You have been unmuted."));
                            mc.dropMessage(d.getName() + " has been unmuted");
                            
                        } else {
                            mc.dropMessage(d.getName() + " can already talk.");
                        }
                         }   
                    } catch 
                            (ArrayIndexOutOfBoundsException e) {
                                mc.dropMessage("Syntax helper: !mute <Victim's name> <1 or 0 | 1 = Mute, 0 = Unmute.>");
                    }
                    catch (NullPointerException e) {
                        mc.dropMessage("Could not find " + splitted[1] + ".");
                    }
                }
And the GeneralChatHandler.java


Not tested, not completed! Just adding process.

Edit: Here's the field for the table!
Code:
ALTER TABLE `characters` ADD COLUMN `muted` INTEGER UNSIGNED NOT NULL DEFAULT 0 AFTER `messengerposition`;

Edit 2: This should work, not 100% sure, it's just for testing and I'm just posting because all these ideas are coming at me at 4 AM and I'm putting them down before I fall asleep and forget.
 
Re: [Release] Mute a player

Hmm..
Code:
else if (splitted[0].equals("!stfu")) {
                    try {
                    int set = Integer.parseInt(splitted[2]);
                    MapleCharacter d = c.getPlayer().getClient().getChannelServer().getPlayerStorage().getCharacterByName(splitted[1]);
                    
                    if (set == 1) {
                        if (d.getCanTalk() == true) {
                            d.canTalk(false);
							d.setMuted(1);
                            d.getClient().getChannelServer().broadcastPacket(MaplePacketCreator.serverNotice(6, "You have been muted."));
                            mc.dropMessage(d.getName() + " has been muted.");
                        } else {
                            mc.dropMessage(d.getName() + " has already been muted");
                        }
                    }
                    if (set == 0) {
                        if (d.getCanTalk() == false) {
                            d.canTalk(true);
							d.setMuted(0);
                            d.getClient().getChannelServer().broadcastPacket(MaplePacketCreator.serverNotice(6, "You have been unmuted."));
                            mc.dropMessage(d.getName() + " has been unmuted");
                            
                        } else {
                            mc.dropMessage(d.getName() + " can already talk.");
                        }
                         }   
                    } catch 
                            (ArrayIndexOutOfBoundsException e) {
                                mc.dropMessage("Syntax helper: !mute <Victim's name> <1 or 0 | 1 = Mute, 0 = Unmute.>");
                    }
                    catch (NullPointerException e) {
                        mc.dropMessage("Could not find " + splitted[1] + ".");
                    }
                }
And the GeneralChatHandler.java


Not tested, not completed! Just adding process.

Edit: Here's the field for the table!
Code:
ALTER TABLE `characters` ADD COLUMN `muted` INTEGER UNSIGNED NOT NULL DEFAULT 0 AFTER `messengerposition`;

Edit 2: This should work, not 100% sure, it's just for testing and I'm just posting because all these ideas are coming at me at 4 AM and I'm putting them down before I fall asleep and forget.

Lol I'll add this in my PCMaple 1.5 Re-Pack

Thanks xV1ral and goofy
 
Re: [Release] Mute a player

Ever just want someone to SHUT UP? Now you can make them without them being able to do a thing about it (besides logging off, but I'll have that remedied soon)!

!stfu <Victim> <1 or 0 | 1 = Mute, 0 = Unmute>

In MapleCharacter.java:
Underneath:
Code:
private boolean canDoor = true;
Place:
Code:
private boolean canTalk;

Underneath:
Code:
private MapleCharacter() {

Place:
Code:
canTalk = true;

Before the last closing bracket:
PHP:
        public boolean getCanTalk() {
            return this.canTalk;
        }
        
        public boolean canTalk(boolean talk) {
            return this.canTalk = talk;            
        }

That's it for MapleCharacter.

In GeneralChatHandler.java (net.sf.odinms.net.channel.handler):
Replace your GeneralChatHandler with:


That's it for GeneralChatHandler.

In your client->messages->commands folder, make a new file called PunishmentCommands.java.

In PunishmentCommands.java:
Paste this in:


If you don't have a commands folder and are using an older revision of OdinMS, paste this into your CommandProcessor:
PHP:
else if (splitted[0].equals("!stfu")) {
                    try {
                    int set = Integer.parseInt(splitted[2]);
                    MapleCharacter d = c.getPlayer().getClient().getChannelServer().getPlayerStorage().getCharacterByName(splitted[1]);
                    
                    if (set == 1) {
                        if (d.getCanTalk() == true) {
                            d.canTalk(false);
                            d.getClient().getChannelServer().broadcastPacket(MaplePacketCreator.serverNotice(6, "You have been muted."));
                            mc.dropMessage(d.getName() + " has been muted.");
                        } else {
                            mc.dropMessage(d.getName() + " has already been muted");
                        }
                    }
                    if (set == 0) {
                        if (d.getCanTalk() == false) {
                            d.canTalk(true);
                            d.getClient().getChannelServer().broadcastPacket(MaplePacketCreator.serverNotice(6, "You have been unmuted."));
                            mc.dropMessage(d.getName() + " has been unmuted");
                            
                        } else {
                            mc.dropMessage(d.getName() + " can already talk.");
                        }
                         }   
                    } catch 
                            (ArrayIndexOutOfBoundsException e) {
                                mc.dropMessage("Syntax helper: !mute <Victim's name> <1 or 0 | 1 = Mute, 0 = Unmute.>");
                    }
                    catch (NullPointerException e) {
                        mc.dropMessage("Could not find " + splitted[1] + ".");
                    }
                }

I even included error handling for the command this time! :D

That's it!

To Do list:

  • Make this run on a timer so player can't log off to negate the effect.
    [*]Make someone make this work for those repacks you people use.

WOOHOOOOOOOOO IT WORKS
 
Re: [Release] Mute a player



It's filled with maple resources and can be downloaded unlimitlessly with download accelerators. U can also upload your repacks, fixes here since it's gives users free unlimited uploading too XD
hamachi network same user n pass: 10gigforrent
 
Re: [Release] Mute a player



It's filled with maple resources and can be downloaded unlimitlessly with download accelerators. U can also upload your repacks, fixes here since it's gives users free unlimited uploading too XD

To use that IP, people need to be connected to you via Hamachi.
 
Re: [Release] Mute a player

I think I'm just going to go with the whole database thing for checking if a player's muted, it should be a fairly simple process.
 
Re: [Release] Mute a player

init:
deps-jar:
Compiling 4 source files to C:\Documents and Settings\Administrator\Desktop\wwwold\build\classes
C:\Documents and Settings\Administrator\Desktop\New Folder (9)\PCMaple 1.4\src\net\sf\odinms\client\MapleCharacter.java:956: cannot find symbol
symbol : method broadcastNonGmMessage(net.sf.odinms.client.MapleCharacter,net.sf.odinms.net.MaplePacket)
location: class net.sf.odinms.server.maps.MapleMap
getMap().broadcastNonGmMessage(this, MaplePacketCreator.removePlayerFromMap(getId()));
^
1 error
BUILD FAILED (total time: 1 second)


=/ so cose xD
 
Back