当前位置: 首页>>代码示例>>Java>>正文


Java Command类代码示例

本文整理汇总了Java中asg.cliche.Command的典型用法代码示例。如果您正苦于以下问题:Java Command类的具体用法?Java Command怎么用?Java Command使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Command类属于asg.cliche包,在下文中一共展示了Command类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setPluginConfig

import asg.cliche.Command; //导入依赖的package包/类
@Command
public String setPluginConfig(@Param(name = "plugin-name") String pluginName, @Param(name = "config") String config) {
    PluginType pluginType = MineCloud.instance().mongo()
            .repositoryBy(PluginType.class)
            .findFirst(pluginName);

    if (pluginType == null) {
        return "No found plugin by the name of " + pluginName;
    }

    if (!pluginType.configs().contains(config)) {
        return "No configs by the name of " + config + " was found!";
    }

    if (type.plugins() == null || !type.plugins().stream().anyMatch((p) -> p.name().equalsIgnoreCase(pluginName))) {
        return pluginName + " has not been added through add-plugin!";
    }

    type.plugins().stream()
            .filter((p) -> p.name().equalsIgnoreCase(pluginName))
            .findFirst().get()
            .setConfig(config);
    return "Successfully set config version to " + config;
}
 
开发者ID:mkotb,项目名称:MineCloud,代码行数:25,代码来源:ServerTypeHandler.java

示例2: push

import asg.cliche.Command; //导入依赖的package包/类
@Command
public String push() {
    if (type.dedicatedRam() == 0 ||
            type.maxPlayers() == 0 ||
            type.preferredNode() == null ||
            type.mod() == null ||
            type.defaultWorld() == null) {
        return "Required fields (dedicatedRam, maxPlayers, preferredNode, defaultWorld) have not been set by the user! " +
                "Unable to push modifications";
    }

    MineCloud.instance().mongo()
            .repositoryBy(ServerType.class)
            .save(type);
    return "Successfully pushed modifications to database!";
}
 
开发者ID:mkotb,项目名称:MineCloud,代码行数:17,代码来源:ServerTypeHandler.java

示例3: show

import asg.cliche.Command; //导入依赖的package包/类
@Command(name = "!show")
public List<String> show() {
    List<String> list = new ArrayList<>();
    list.add("Currently Modeling [Server Type] (" + type.name() + ")");
    list.add("===========================================");
    list.add("Listing Specifications...");
    list.add("- Maximum Amount of Players: " + type.maxPlayers());
    list.add("- Preferred Node: " + type.preferredNode().name());
    list.add("- Mod: " + type.mod());
    list.add("- Dedicated Ram (Per Server): " + type.dedicatedRam() + "MB");
    list.add("- Plugins: " + formatPlugins(type.plugins()));
    list.add("- Is Default: " + (type.defaultServer() ? "Yes" : "No"));
    list.add("- Default World: " + type.defaultWorld().name() + "(" + type.defaultWorld().version() + ")");
    list.add("- Worlds: " + formatWorlds(type.worlds()));
    list.add("- Timeout: " + type.timeOut());
    list.add("===========================================");
    list.add("If you're ready to go, type 'push'.");
    return list;
}
 
开发者ID:mkotb,项目名称:MineCloud,代码行数:20,代码来源:ServerTypeHandler.java

示例4: show

import asg.cliche.Command; //导入依赖的package包/类
@Command(name = "!show")
public List<String> show() {
    List<String> list = new ArrayList<>();
    list.add("Currently Modeling [Node Type] (" + type.name() + ")");
    list.add("===========================================");
    list.add("Listing Specifications...");
    list.add("- Ram: " + type.ram() + "MB");
    list.add("- CPU Specifications:");
    list.add("  Base Frequency: " + type.processor().baseFrequency());
    list.add("  Max Frequency: " + type.processor().maxFrequency());
    list.add("  Cores: " + type.processor().cores());
    list.add("  Threads: " + type.processor().threads());
    list.add("===========================================");
    list.add("If you're ready to go, type 'push'.");
    return list;
}
 
开发者ID:mkotb,项目名称:MineCloud,代码行数:17,代码来源:NodeTypeHandler.java

示例5: addBungee

import asg.cliche.Command; //导入依赖的package包/类
@Command
public String addBungee(@Param(name = "bungee-name") String bungeeName, @Param(name = "amount") int amount) {
    BungeeType bungeeType = MineCloud.instance().mongo()
            .repositoryBy(BungeeType.class)
            .findFirst(bungeeName);

    if (bungeeType == null) {
        return "No bungees found by the name of " + bungeeName;
    }

    if (type.bungeeMetadata() == null) {
        type.setBungees(new HashMap<>());
    }

    Map<BungeeType, Integer> bungeeTypes = type.bungeeMetadata();

    bungeeTypes.put(bungeeType, amount);
    type.setBungees(bungeeTypes);

    return "Successfully added " + bungeeName + " to Network";
}
 
开发者ID:mkotb,项目名称:MineCloud,代码行数:22,代码来源:NetworkTypeHandler.java

示例6: addServer

import asg.cliche.Command; //导入依赖的package包/类
@Command
public String addServer(@Param(name = "server-name") String name, @Param(name = "min") int min, @Param(name = "max") int max) {
    ServerType serverType = MineCloud.instance().mongo()
            .repositoryBy(ServerType.class)
            .findFirst(name);

    if (serverType == null) {
        return "No server types found by the name of " + name;
    }

    if (type.serverMetadata() == null) {
        type.setServerMetadata(new ArrayList<>());
    }

    List<ServerNetworkMetadata> metadata = type.serverMetadata();
    ServerNetworkMetadata md = new ServerNetworkMetadata();

    md.setType(serverType);
    md.setMaximumAmount(max);
    md.setMinimumAmount(min);

    metadata.add(md);

    return "Successfully added " + name + " to Network!";
}
 
开发者ID:mkotb,项目名称:MineCloud,代码行数:26,代码来源:NetworkTypeHandler.java

示例7: removeBungee

import asg.cliche.Command; //导入依赖的package包/类
@Command
public String removeBungee(@Param(name = "bungee-name") String bungee) {
    BungeeType bungeeType = MineCloud.instance().mongo()
            .repositoryBy(BungeeType.class)
            .findFirst(bungee);

    if (bungeeType == null) {
        return "No bungees found by the name of " + bungee;
    }

    if (type.bungeeMetadata() == null) {
        type.setBungees(new HashMap<>());
    }

    Map<BungeeType, Integer> bungeeTypes = type.bungeeMetadata();

    if (!bungeeTypes.keySet().stream()
            .anyMatch((bt) -> bt.name().equalsIgnoreCase(bungeeType.name()))) {
        return bungee + " is not on the network";
    }

    new HashSet<>(bungeeTypes.keySet()).stream()
            .filter((bt) -> bt.name().equalsIgnoreCase(bungeeType.name()))
            .forEach(bungeeTypes::remove);
    return bungee + " has been removed from the network!";
}
 
开发者ID:mkotb,项目名称:MineCloud,代码行数:27,代码来源:NetworkTypeHandler.java

示例8: removeServer

import asg.cliche.Command; //导入依赖的package包/类
@Command
public String removeServer(@Param(name = "server-name") String name) {
    ServerType serverType = MineCloud.instance().mongo()
            .repositoryBy(ServerType.class)
            .findFirst(name);

    if (serverType == null) {
        return "No server types found by the name of " + name;
    }

    if (type.serverMetadata() == null) {
        type.setServerMetadata(new ArrayList<>());
    }

    List<ServerNetworkMetadata> metadata = type.serverMetadata();
    Optional<ServerNetworkMetadata> optional = metadata.stream()
            .filter((sm) -> sm.type().name().equals(serverType.name()))
            .findFirst();

    if (!optional.isPresent()) {
        return name + " is not on the network!";
    }

    metadata.remove(optional.get());
    return name + " has been removed from the network!";
}
 
开发者ID:mkotb,项目名称:MineCloud,代码行数:27,代码来源:NetworkTypeHandler.java

示例9: changeDirectory

import asg.cliche.Command; //导入依赖的package包/类
@Command(description = "Change the current directory")
public void changeDirectory(
        @Param(name = "index", description = "Index of folder you want to switch to, OR '..' to go back")
        String index) throws IOException, OneDriveException {

    OneFolder newCurrentFolder;
    if (index.equals("..")) {
        newCurrentFolder = currentFolder.getParentFolder();
    } else {
        newCurrentFolder = currentFolderFolders.get(index);
    }

    if (newCurrentFolder != null) {
        currentFolder = newCurrentFolder;
    }

    System.out.println("Changing folder to: " + currentFolder.getName());
}
 
开发者ID:tawalaya,项目名称:OneDriveJavaSDK,代码行数:19,代码来源:ConsoleClient.java

示例10: listSubItems

import asg.cliche.Command; //导入依赖的package包/类
@Command(name = "list children", abbrev = "ls")
public void listSubItems() throws IOException, OneDriveException {
    System.out.println("Listing children");

    this.currentFolderFiles = new HashMap<>();
    this.currentFolderFolders = new HashMap<>();
    this.currentFolderItems = convertToMap(currentFolder.getChildren(), OneFile.class);

    for (String s : this.currentFolderItems.keySet()) {
        OneItem item = this.currentFolderItems.get(s);
        if (item.isFile())
            this.currentFolderFiles.put(s, (OneFile) item);
        if (item.isFolder())
            this.currentFolderFolders.put(s, (OneFolder) item);
    }

    printItemList(currentFolderItems);
}
 
开发者ID:tawalaya,项目名称:OneDriveJavaSDK,代码行数:19,代码来源:ConsoleClient.java

示例11: deleteItem

import asg.cliche.Command; //导入依赖的package包/类
@Command(name = "remove",abbrev = "rm",description = "Deletes a file")
public void deleteItem(
        @Param(name = "index", description = "Index of file you want to delete")
        String index) throws IOException, OneDriveException {
    OneItem item = null;

    if (this.currentFolderFiles.containsKey(index))
        item = (OneItem) this.currentFolderFiles.get(index);

    if (this.currentFolderFolders.containsKey(index))
        item = (OneItem) this.currentFolderFolders.get(index);

    if (item != null) {
        System.out.println(String.format("Deleting %s", item.getName()));
        item.delete();
    } else {
        System.out.println("Can not find item with index '" + index + "'");
    }
}
 
开发者ID:tawalaya,项目名称:OneDriveJavaSDK,代码行数:20,代码来源:ConsoleClient.java

示例12: invokeObject

import asg.cliche.Command; //导入依赖的package包/类
@Command(name="invoke-object", abbrev="run")
public void invokeObject(int id, long param) throws NoSuchMethodException, SecurityException,
	IllegalAccessException, IllegalArgumentException, InvocationTargetException {
	
	if(!objects.containsKey(id)) {
		System.out.println("-- Unknown object --");
		return;
	}
	
	current = objects.get(id);
	runParam = param;
	
	new Thread() {
		
		@Override
		public void run() {
			current.run(runParam);
		}
		
	}.start();
	
	System.out.println("-- Done --");
	
}
 
开发者ID:xLeitix,项目名称:jcloudscale,代码行数:25,代码来源:CLIDemoClientBackend.java

示例13: help

import asg.cliche.Command; //导入依赖的package包/类
@Command
public void help() {
	System.out.println("Available commands are:");
	System.out.println("set <property> <value>");
	System.out.println("\t srchost <hostname:port>\t\t\t- address of the source server");
	System.out.println("\t tgthost <hostname:port>\t\t\t- address of the target server");
	System.out.println("\t loghost <hostname:port>\t\t\t- address of the log server");
	System.out.println("\t namespace <database.collection>\t- source collection namespace");
	System.out.println("\t targetns <database.collection>\t\t- target collection namespace");
	System.out.println("\t secondary <true/false>\t\t- use delayed secondaries for copy");
	System.out.println("\t reshard <true/false>\t\t\t- shard target collection on copy");
	System.out.println("\t key <shard key>\t\t\t- new shard key for clone");
	System.out.println("\t readBatch <integer>\t\t\t- number of documents to read per batch");
	System.out.println("\t writeBatch <integer>\t\t\t- number of documents to write per batch");
	System.out.println();
	System.out.println("conf\t\t\t\t\t\t- print current configuration");
	System.out.println("execute\t\t\t\t\t\t- run current configuration");
	System.out.println("shutdown\t\t\t\t\t- stop source/target synchronization");
}
 
开发者ID:rhoulihan,项目名称:resharder,代码行数:20,代码来源:Shell.java

示例14: open

import asg.cliche.Command; //导入依赖的package包/类
@Command(abbrev = "o", description = "opens a existing run")
public ShellView open(@Param(name = "name", description = "the run name") String name) {
	ShellView rv = new ShellView();

	String path = rootDirectory + File.separator + name;

	unload(rv);

	if (runManager.exists(path)) {
		rv.addMsg("opened: " + name);
		run = name;
	} else {
		rv.addErr("failed to open run");
	}

	return rv;
}
 
开发者ID:rdouyere,项目名称:taukari,代码行数:18,代码来源:Shell.java

示例15: create

import asg.cliche.Command; //导入依赖的package包/类
@Command
public ShellView create(String name) {
	ShellView rv = new ShellView();

	String path = rootDirectory + File.separator + name;

	unload(rv);

	// check
	if (runManager.exists(path)) {
		rv.addErr("already existing run");
	} else {
		run = name;
		runManager.create(path);
		rv.addMsg("created: " + run);
		rv.addMsg("opened: " + run);
	}

	return rv;
}
 
开发者ID:rdouyere,项目名称:taukari,代码行数:21,代码来源:Shell.java


注:本文中的asg.cliche.Command类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。