本文整理汇总了Java中constants.ServerConstants.CommandType类的典型用法代码示例。如果您正苦于以下问题:Java CommandType类的具体用法?Java CommandType怎么用?Java CommandType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CommandType类属于constants.ServerConstants包,在下文中一共展示了CommandType类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handle
import constants.ServerConstants.CommandType; //导入依赖的package包/类
@PacketHandler(opcode = RecvPacketOpcode.GENERAL_CHAT)
public static void handle(MapleClient c, LittleEndianAccessor slea){
if (c.getPlayer() == null || c.getPlayer().getMap() == null){
return;
}
slea.skip(4); // update tick
String text = slea.readMapleAsciiString();
byte balloon = slea.readByte();
if (CommandProcessor.processCommand(c, text, CommandType.NORMAL)){
return;
}
if (text.length() < 1 || (!c.getPlayer().isIntern() && text.length() >= 80)) {
return;
}
if (!c.getPlayer().getCanTalk()){
c.getSession().write(CWvsContext.broadcastMsg(6, "You have been muted and are therefore unable to talk."));
return;
}
if (!c.getPlayer().isHidden()){
c.getPlayer().getMap().broadcastMessage(CField.getChatText(c.getPlayer().getId(), text, false, balloon));
c.getPlayer().getMap().broadcastMessage(CField.getChatText(c.getPlayer().getId(), text, c.getPlayer().isSuperGM(), 1));
return;
}
// Note: This patch is needed to prevent chat packet from being broadcast to people who might be packet sniffing.
if (c.getPlayer().isIntern() && !c.getPlayer().isSuperGM() && balloon == 0) {
c.getPlayer().getMap().broadcastGMMessage(c.getPlayer(), CField.getChatText(c.getPlayer().getId(), text, c.getPlayer().isSuperGM(), (byte) 1), true);
c.getPlayer().getMap().broadcastGMMessage(c.getPlayer(), CWvsContext.broadcastMsg(2, c.getPlayer().getName() + " : " + text), true);
} else {
c.getPlayer().getMap().broadcastGMMessage(c.getPlayer(), CField.getChatText(c.getPlayer().getId(), text, c.getPlayer().isSuperGM(), balloon), true);
}
}
示例2: sendDisplayMessage
import constants.ServerConstants.CommandType; //导入依赖的package包/类
private static void sendDisplayMessage(MapleClient c, String msg, CommandType type) {
if (c.getPlayer() == null) {
return;
}
switch (type) {
case NORMAL:
c.getPlayer().dropMessage(6, msg);
break;
case TRADE:
c.getPlayer().dropMessage(-2, "Error : " + msg);
break;
}
}
示例3: Others
import constants.ServerConstants.CommandType; //导入依赖的package包/类
public static void Others(final LittleEndianAccessor slea, final MapleClient c, final MapleCharacter chr) {
final int type = slea.readByte();
final byte numRecipients = slea.readByte();
if (numRecipients <= 0) {
return;
}
int recipients[] = new int[numRecipients];
for (byte i = 0; i < numRecipients; i++) {
recipients[i] = slea.readInt();
}
final String chattext = slea.readMapleAsciiString();
if (chr == null || !chr.getCanTalk()) {
c.getSession().write(CWvsContext.broadcastMsg(6, "You have been muted and are therefore unable to talk."));
return;
}
if (c.isMonitored()) {
String chattype = "Unknown";
switch (type) {
case 0:
chattype = "Buddy";
break;
case 1:
chattype = "Party";
break;
case 2:
chattype = "Guild";
break;
case 3:
chattype = "Alliance";
break;
case 4:
chattype = "Expedition";
break;
}
World.Broadcast.broadcastGMMessage(
CWvsContext.broadcastMsg(6, "[GM Message] " + MapleCharacterUtil.makeMapleReadable(chr.getName())
+ " said (" + chattype + "): " + chattext));
}
if (chattext.length() <= 0 || CommandProcessor.processCommand(c, chattext, CommandType.NORMAL)) {
return;
}
switch (type) {
case 0:
World.Buddy.buddyChat(recipients, chr.getId(), chr.getName(), chattext);
break;
case 1:
if (chr.getParty() == null) {
break;
}
World.Party.partyChat(chr.getParty().getId(), chattext, chr.getName());
break;
case 2:
if (chr.getGuildId() <= 0) {
break;
}
World.Guild.guildChat(chr.getGuildId(), chr.getName(), chr.getId(), chattext);
break;
case 3:
if (chr.getGuildId() <= 0) {
break;
}
World.Alliance.allianceChat(chr.getGuildId(), chr.getName(), chr.getId(), chattext);
break;
case 4:
if (chr.getParty().getExpeditionId() <= 0) {
break;
}
World.Party.expedChat(chr.getParty().getExpeditionId(), chattext, chr.getName());
break;
}
}
示例4: getType
import constants.ServerConstants.CommandType; //导入依赖的package包/类
public CommandType getType() {
return exe.getType();
}
示例5: getType
import constants.ServerConstants.CommandType; //导入依赖的package包/类
public CommandType getType() {
return CommandType.NORMAL;
}
示例6: GeneralChat
import constants.ServerConstants.CommandType; //导入依赖的package包/类
public static 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, CommandType.NORMAL)) {
if (!chr.isIntern() && text.length() >= 80) {
return;
}
if (!isApproved(text)) {
chr.dropMessage(5, "Please talk in a proper language."); //I dont wanna ban them, too lazy to make a new mute function :P
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, c.getPlayer().isSuperGM(), (byte) 1), true);
if (unk == 0) {
chr.getMap().broadcastGMMessage(chr, CWvsContext.broadcastMsg(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());
chr.getMap().broadcastMessage(ColourChat(chr, text, unk, chr.getChatType()));
chr.getMap().broadcastMessage(CField.getChatText(chr.getId(), text, c.getPlayer().isSuperGM(), 1));
/*if (unk == 0) {
//chr.getMap().broadcastMessage(CWvsContext.broadcastMsg(2, chr.getName() + " : " + text), c.getPlayer().getTruePosition());
chr.getMap().broadcastMessage(ColourChat(chr, text, unk, chr.getChatType()));
chr.getMap().broadcastMessage(CField.getChatText(chr.getId(), text, false, 1));
}*/
} else {
//chr.getMap().broadcastMessage(CField.getChatText(chr.getId(), text, c.getPlayer().isSuperGM(), unk), c.getPlayer().getTruePosition());
chr.getMap().broadcastMessage(ColourChat(chr, text, unk, chr.getChatType()));
chr.getMap().broadcastMessage(CField.getChatText(chr.getId(), text, c.getPlayer().isSuperGM(), 0));//was1
}
}
if (text.equalsIgnoreCase(c.getChannelServer().getServerName() + " rocks")) {
chr.finishAchievement(11);
}
} else {
c.getSession().write(CWvsContext.broadcastMsg(6, "You have been muted and are therefore unable to talk."));
}
}
}
示例7: Others
import constants.ServerConstants.CommandType; //导入依赖的package包/类
public static void Others(final LittleEndianAccessor slea, final MapleClient c, final MapleCharacter chr) {
final int type = slea.readByte();
final byte numRecipients = slea.readByte();
if (numRecipients <= 0) {
return;
}
int recipients[] = new int[numRecipients];
for (byte i = 0; i < numRecipients; i++) {
recipients[i] = slea.readInt();
}
final String chattext = slea.readMapleAsciiString();
if (chr == null || !chr.getCanTalk()) {
c.getSession().write(CWvsContext.broadcastMsg(6, "You have been muted and are therefore unable to talk."));
return;
}
if (!isApproved(chattext)) {
chr.dropMessage(5, "Please talk in a proper language."); //I dont wanna ban them, too lazy to make a new mute function :P
return;
}
if (c.isMonitored()) {
String chattype = "Unknown";
switch (type) {
case 0:
chattype = "Buddy";
break;
case 1:
chattype = "Party";
break;
case 2:
chattype = "Guild";
break;
case 3:
chattype = "Alliance";
break;
case 4:
chattype = "Expedition";
break;
}
World.Broadcast.broadcastGMMessage(
CWvsContext.broadcastMsg(6, "[GM Message] " + MapleCharacterUtil.makeMapleReadable(chr.getName())
+ " said (" + chattype + "): " + chattext));
}
if (chattext.length() <= 0 || CommandProcessor.processCommand(c, chattext, CommandType.NORMAL)) {
return;
}
chr.getCheatTracker().checkMsg();
switch (type) {
case 0:
World.Buddy.buddyChat(recipients, chr.getId(), chr.getName(), chattext);
break;
case 1:
if (chr.getParty() == null) {
break;
}
World.Party.partyChat(chr.getParty().getId(), chattext, chr.getName());
break;
case 2:
if (chr.getGuildId() <= 0) {
break;
}
World.Guild.guildChat(chr.getGuildId(), chr.getName(), chr.getId(), chattext);
break;
case 3:
if (chr.getGuildId() <= 0) {
break;
}
World.Alliance.allianceChat(chr.getGuildId(), chr.getName(), chr.getId(), chattext);
break;
case 4:
if (chr.getParty().getExpeditionId() <= 0) {
break;
}
World.Party.expedChat(chr.getParty().getExpeditionId(), chattext, chr.getName());
break;
}
}