當前位置: 首頁>>代碼示例>>Java>>正文


Java CommandType類代碼示例

本文整理匯總了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);
	}
}
 
開發者ID:ergothvs,項目名稱:Lucid2.0,代碼行數:33,代碼來源:GeneralChatHandler.java

示例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;
    }
}
 
開發者ID:ergothvs,項目名稱:Lucid2.0,代碼行數:14,代碼來源:CommandProcessor.java

示例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;
    }
}
 
開發者ID:ergothvs,項目名稱:Lucid2.0,代碼行數:75,代碼來源:ChatHandler.java

示例4: getType

import constants.ServerConstants.CommandType; //導入依賴的package包/類
public CommandType getType() {
    return exe.getType();
}
 
開發者ID:ergothvs,項目名稱:Lucid2.0,代碼行數:4,代碼來源:MapleCommand.java

示例5: getType

import constants.ServerConstants.CommandType; //導入依賴的package包/類
public CommandType getType() {
    return CommandType.NORMAL;
}
 
開發者ID:ergothvs,項目名稱:Lucid2.0,代碼行數:4,代碼來源:CommandExecute.java

示例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."));
        }
    }
}
 
開發者ID:skorch37,項目名稱:Asteria,代碼行數:46,代碼來源:ChatHandler.java

示例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;
    }
}
 
開發者ID:skorch37,項目名稱:Asteria,代碼行數:81,代碼來源:ChatHandler.java


注:本文中的constants.ServerConstants.CommandType類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。