- Joined
- May 22, 2008
- Messages
- 95
- Reaction score
- 0
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.")); } } } }
Too lazy to read the whole thread, but when a player reconnects, are they unmuted?
Yes they are unmuted
Well, how about adding a field to the character table named "muted" and set default to 0, and when its set to 1 they can't talk. Just make it save on relog.
public int getMuted() {
return muted;
}
public void setMuted(int muted) {
this.muted = muted;
}
andCode:public int getMuted() { return muted; }
Woo! We're half way there!Code:public void setMuted(int muted) { this.muted = muted; }
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] + ".");
}
}
ALTER TABLE `characters` ADD COLUMN `muted` INTEGER UNSIGNED NOT NULL DEFAULT 0 AFTER `messengerposition`;
Hmm..
And the GeneralChatHandler.javaCode: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] + "."); } }
To view the content, you need to sign in or register
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.
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:
Place:Code:private boolean canDoor = true;
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:
To view the content, you need to sign in or register
That's it for GeneralChatHandler.
In your client->messages->commands folder, make a new file called PunishmentCommands.java.
In PunishmentCommands.java:
Paste this in:
To view the content, you need to sign in or register
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!
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.
To view the content, you need to sign in or register
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
Please do. I'm working on a number of other things right now (mail system, spectator mode for PvP, and a lot more). ;__;I can finish mine off if you want. O: