QueuedCommand qc = new QueuedCommand(commandObject.get("id").getAsInt(), commandObject.get("payment").getAsInt(), packageId,
public String doReplace(QueuedPlayer player, QueuedCommand command) { String c = command.getCommand(); for (Placeholder placeholder : placeholderList) { c = placeholder.replace(c, player, command); } return c; } }
public boolean canExecute(IBuycraftPlatform platform) { Integer requiredSlots = command.getConditions().get("slots"); if (requiredSlots != null || requireOnline) { if (!platform.isPlayerOnline(player)) { return false; } } if (requiredSlots != null) { int free = platform.getFreeSlots(player); if (free < requiredSlots) { return false; } } Integer delay = command.getConditions().get("delay"); return !(delay != null && delay > 0 && System.currentTimeMillis() - queueTime < TimeUnit.SECONDS.toMillis(delay)); } }
if(queuedCommandIds.contains(command.getCommand().getId())){ removeSet.add(command); continue; queuedCommandIds.add(command.getCommand().getId()); if(completedCommandsTask.getRetained().contains(command.getCommand().getId())){ synchronized (commandQueue) { commandQueue.remove(command); try { platform.dispatchCommand(finalCommand); completedCommandsTask.add(command.getCommand().getId()); } catch (Exception e) { platform.log(Level.SEVERE, String.format("Could not dispatch command '%s' for player '%s'. " +
@Override public void run() { if (platform.getApiClient() == null) { return; // no API client } QueueInformation information; try { // Retrieve offline command queue. information = platform.getApiClient().retrieveOfflineQueue(); } catch (IOException | ApiException e) { platform.log(Level.SEVERE, "Could not fetch command queue", e); return; } // Queue commands for later. for (QueuedCommand command : information.getCommands()) { platform.getExecutor().queue(new ToRunQueuedCommand(command.getPlayer(), command, false)); } } }
QueuedCommand qc = new QueuedCommand(commandObject.get("id").getAsInt(), commandObject.get("payment").getAsInt(), packageId,
QueuedCommand qc = new QueuedCommand(commandObject.get("id").getAsInt(), commandObject.get("payment").getAsInt(), packageId,