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


Java Command.testPermissionSilent方法代碼示例

本文整理匯總了Java中cn.nukkit.command.Command.testPermissionSilent方法的典型用法代碼示例。如果您正苦於以下問題:Java Command.testPermissionSilent方法的具體用法?Java Command.testPermissionSilent怎麽用?Java Command.testPermissionSilent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在cn.nukkit.command.Command的用法示例。


在下文中一共展示了Command.testPermissionSilent方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: sendCommandData

import cn.nukkit.command.Command; //導入方法依賴的package包/類
public void sendCommandData() {
    AvailableCommandsPacket pk = new AvailableCommandsPacket();
    Map<String, CommandDataVersions> data = new HashMap<>();
    int count = 0;
    for (Command command : this.server.getCommandMap().getCommands().values()) {
        if (!command.testPermissionSilent(this)) {
            continue;
        }
        ++count;
        CommandDataVersions data0 = command.generateCustomCommandData(this);
        data.put(command.getName(), data0);
    }
    if (count > 0) {
        //TODO: structure checking
        pk.commands = data;
        int identifier = this.dataPacket(pk, true); // We *need* ACK so we can be sure that the client received the packet or not
        Thread t = new Thread() {
            public void run() {
                // We are going to wait 3 seconds, if after 3 seconds we didn't receive a reply from the client, resend the packet.
                try {
                    Thread.sleep(3000);
                    boolean status = needACK.get(identifier);
                    if (!status && isOnline()) {
                        sendCommandData();
                        return;
                    }
                } catch (InterruptedException e) {
                }
            }
        };
        t.start();
    }
}
 
開發者ID:Rsplwe,項目名稱:Nukkit-Java9,代碼行數:34,代碼來源:Player.java

示例2: sendCommandData

import cn.nukkit.command.Command; //導入方法依賴的package包/類
public void sendCommandData() {
    AvailableCommandsPacket pk = new AvailableCommandsPacket();
    Map<String, CommandDataVersions> data = new HashMap<>();
    int count = 0;
    for (Command command : this.server.getCommandMap().getCommands().values()) {
        if (!command.testPermissionSilent(this)) {
            continue;
        }
        ++count;
        CommandDataVersions data0 = command.generateCustomCommandData(this);
        data.put(command.getName(), data0);
    }
    if (count > 0) {
        //TODO: structure checking
        pk.commands = data;
        int identifier = this.dataPacket(pk, true); // We *need* ACK so we can be sure that the client received the packet or not
        Thread t = new Thread() {
            public void run() {
                // We are going to wait 3 seconds, if after 3 seconds we didn't receive a reply from the client, resend the packet.
                try {
                    Thread.sleep(3000);
                    boolean status = needACK.get(identifier);
                    if (!status && isOnline()) {
                        sendCommandData();
                        return;
                    }
                } catch (InterruptedException e) {}
            }
        };
        t.start();
    }
}
 
開發者ID:JupiterDevelopmentTeam,項目名稱:Jupiter,代碼行數:33,代碼來源:Player.java

示例3: sendCommandData

import cn.nukkit.command.Command; //導入方法依賴的package包/類
public void sendCommandData() {
    AvailableCommandsPacket pk = new AvailableCommandsPacket();
    Map<String, CommandDataVersions> data = new HashMap<>();
    int count = 0;
    for (Command command : this.server.getCommandMap().getCommands().values()) {
        if (!command.testPermissionSilent(this)) {
            continue;
        }
        ++count;
        CommandDataVersions data0 = command.generateCustomCommandData(this);
        data.put(command.getName(), data0);
    }
    if (count > 0) {
        //TODO: structure checking
        pk.commands = new Gson().toJson(data);
        int identifier = this.dataPacket(pk, true); // We *need* ACK so we can be sure that the client received the packet or not
        Thread t = new Thread() {
            public void run() {
                // We are going to wait 3 seconds, if after 3 seconds we didn't receive a reply from the client, resend the packet.
                try {
                    Thread.sleep(3000);
                    boolean status = needACK.get(identifier);
                    if (!status && isOnline()) {
                        sendCommandData();
                        return;
                    }
                } catch (InterruptedException e) {}
            }
        };
        t.start();
    }
}
 
開發者ID:FrontierDevs,項目名稱:Jenisys3,代碼行數:33,代碼來源:Player.java


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