本文整理匯總了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();
}
}
示例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();
}
}
示例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();
}
}