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


Java InvalidDescriptionException类代码示例

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


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

示例1: run

import org.bukkit.plugin.InvalidDescriptionException; //导入依赖的package包/类
@Override
public void run() {
	while (true) {
		try (Socket socket = serverSocket.accept(); DataInputStream inputStream = new DataInputStream(socket.getInputStream())) {
			String name = inputStream.readUTF();
			if (!Objects.equals(pluginName, name)) continue;
			Util.unloadPlugin(Bukkit.getPluginManager().getPlugin(pluginName));
			Bukkit.getConsoleSender().sendMessage("[Debugger] Unload Plugin");
			File file = new File(pluginsFolder, pluginName + ".jar");
			byte[] buffer = new byte[512];
			FileOutputStream fileOutputStream = new FileOutputStream(file);
			int fLength;
			while ((fLength = inputStream.read(buffer)) > 0) {
				fileOutputStream.write(buffer, 0, fLength);
			}
			fileOutputStream.flush();
			fileOutputStream.close();
			Bukkit.getConsoleSender().sendMessage("[Debugger] File Reserved");
			Util.loadPlugin(file);
			Bukkit.getConsoleSender().sendMessage("[Debugger] LoadComplete: " + pluginName);
		} catch (IOException | InvalidDescriptionException | InvalidPluginException e) {
			e.printStackTrace();
		}
	}
}
 
开发者ID:syuchan1005,项目名称:MCPluginDebuggerforMC,代码行数:26,代码来源:SocketRunnable.java

示例2: onCommand

import org.bukkit.plugin.InvalidDescriptionException; //导入依赖的package包/类
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
	switch (cmd.getName().toLowerCase()) {
		case "unload":
			Util.unloadPlugin(Bukkit.getPluginManager().getPlugin(args[0]));
			sender.sendMessage("Unloaded");
			break;
		case "load":
			try {
				Util.loadPlugin(new File(this.getDataFolder().getParent(), args[0] + ".jar"));
				sender.sendMessage("Loaded");
			} catch (InvalidDescriptionException | InvalidPluginException e) {
				e.printStackTrace();
			}
			break;
		default:
			return false;
	}
	return true;
}
 
开发者ID:syuchan1005,项目名称:MCPluginDebuggerforMC,代码行数:20,代码来源:MCPluginDebugger.java

示例3: init

import org.bukkit.plugin.InvalidDescriptionException; //导入依赖的package包/类
/**
 * Register all systems.
 */
@SuppressWarnings("ConstantConditions")
public void init() {
    OMGCommand.omgpi_register();
    if (mainfig.contains("mysql"))
        new MySQL(mainfig.getString("mysql.hostname"), mainfig.getString("mysql.port"), mainfig.getString("mysql.database"), mainfig.getString("mysql.username"), mainfig.getString("mysql.password"));
    iLog("Loading games...");
    OMGList<String> games = new OMGList<>();
    File gdir = new File(getDataFolder() + File.separator + "games");
    if (!gdir.exists() && gdir.mkdir()) iLog("Created games folder.");
    String[] files = gdir.list();
    if (files != null && files.length > 0) Collections.addAll(games, files);
    iLog("Games folder: " + Strings.join(games, ", "));
    games.removeIf(s -> !s.endsWith(".jar"));
    if (games.isEmpty()) {
        wLog("No game jars found in games folder. Please add GameName.jar file to /plugins/OMGPI/games/.");
        return;
    }
    String game = mainfig.getString("selectedGame", "random");
    try {
        if (game == null || !games.contains(game + ".jar")) loadGame(null);
        else loadGame(game);
    } catch (InvalidDescriptionException | InvalidPluginException e) {
        e.printStackTrace();
    }
}
 
开发者ID:BurnyDaKath,项目名称:OMGPI,代码行数:29,代码来源:OMGPI.java

示例4: loadGame

import org.bukkit.plugin.InvalidDescriptionException; //导入依赖的package包/类
/**
 * Load game from name.
 *
 * @param game Name of a game.
 * @return Module plugin.
 * @throws InvalidDescriptionException Plugin.yml is wrong
 * @throws InvalidPluginException      Plugin cannot be loaded
 */
public Game loadGame(String game) throws InvalidDescriptionException, InvalidPluginException {
    iLog("Loading game " + game + "...");
    Plugin p;
    if (game == null) {
        OMGList<String> games = new OMGList<>();
        String[] list = new File(getDataFolder() + File.separator + "games").list();
        if (list != null) Collections.addAll(games, list);
        games.removeIf(s -> !s.endsWith(".jar"));
        iLog("Last game: " + mainfig.getString("lastGame"));
        if (games.size() > 1 && mainfig.contains("lastGame"))
            games.removeIf(s -> mainfig.getString("lastGame").equals(s.replaceAll("\\.jar", "")));
        iLog("List of runnable games: " + Strings.join(games, ", "));
        String gameName = games.get(new Random().nextInt(games.size()));
        p = Bukkit.getPluginManager().loadPlugin(new File(getDataFolder() + File.separator + "games" + File.separator + gameName));
        mainfig.set("lastGame", gameName.replaceAll("\\.jar", ""));
        mainfig.save();
    } else {
        p = Bukkit.getPluginManager().loadPlugin(new File(getDataFolder() + File.separator + "games" + File.separator + game + ".jar"));
        mainfig.set("lastGame", game);
        mainfig.save();
    }
    g = (Game) p;
    getServer().getPluginManager().enablePlugin(p);
    return (Game) p;
}
 
开发者ID:BurnyDaKath,项目名称:OMGPI,代码行数:34,代码来源:OMGPI.java

示例5: TestPlugin

import org.bukkit.plugin.InvalidDescriptionException; //导入依赖的package包/类
public TestPlugin(final Class<T> clazz) throws Exception {
	this.clazz = clazz;
	
	// Make sure the class is loaded
	getClass().getClassLoader().loadClass(clazz.getName());
	
	try {
		description = new PluginDescriptionFile(getResource("plugin.yml"));
	} catch (Exception ex) {
		throw new  InvalidDescriptionException(ex);
	}
	
       final InputStream configStream = getResource("config.yml");
       if (configStream == null) {
           return;
       }
       config = YamlConfiguration.loadConfiguration(new InputStreamReader(configStream, Charsets.UTF_8));
}
 
开发者ID:DevotedMC,项目名称:ExilePearl,代码行数:19,代码来源:TestPlugin.java

示例6: getPluginFileName

import org.bukkit.plugin.InvalidDescriptionException; //导入依赖的package包/类
public static String getPluginFileName(String name)
{
	File pluginDir = Phantom.getDataFolder().getParentFile();

	for(File f : pluginDir.listFiles())
	{
		if(f.getName().endsWith(".jar"))
		{
			try
			{
				PluginDescriptionFile desc = Phantom.getPluginLoader().getPluginDescription(f);
				if(desc.getName().equalsIgnoreCase(name))
				{
					return f.getName();
				}
			}

			catch(InvalidDescriptionException e)
			{

			}
		}
	}

	return null;
}
 
开发者ID:PhantomAPI,项目名称:Phantom,代码行数:27,代码来源:PluginUtil.java

示例7: getPluginFileNameUnsafe

import org.bukkit.plugin.InvalidDescriptionException; //导入依赖的package包/类
public static String getPluginFileNameUnsafe(String name, Plugin ins)
{
	File pluginDir = ins.getDataFolder().getParentFile();

	for(File f : pluginDir.listFiles())
	{
		if(f.getName().endsWith(".jar"))
		{
			try
			{
				PluginDescriptionFile desc = ins.getPluginLoader().getPluginDescription(f);
				if(desc.getName().equalsIgnoreCase(name))
				{
					return f.getName();
				}
			}

			catch(InvalidDescriptionException e)
			{

			}
		}
	}

	return null;
}
 
开发者ID:PhantomAPI,项目名称:Phantom,代码行数:27,代码来源:PluginUtil.java

示例8: FakePlugin

import org.bukkit.plugin.InvalidDescriptionException; //导入依赖的package包/类
public FakePlugin(Plugin parent) {
    this.parent = parent;

    plugins = Reflection.getField(Reflection.makeField(SimplePluginManager.class, "plugins"), parent.getServer().getPluginManager());
    lookupNames = Reflection.getField(Reflection.makeField( SimplePluginManager.class, "lookupNames"), parent.getServer().getPluginManager());

    StringWriter write = new StringWriter();
    parent.getDescription().save(write);
    String yaml = write.toString().replaceAll(parent.getName(), getFakeName());

    try {
        description = new PluginDescriptionFile(new StringReader(yaml));
    } catch (InvalidDescriptionException ex) {
        Throwables.propagate(ex);
    }

    plugins.add(this);
    lookupNames.put(getName(), this);
}
 
开发者ID:TechzoneMC,项目名称:TagTabAPI,代码行数:20,代码来源:FakePlugin.java

示例9: loadGameType

import org.bukkit.plugin.InvalidDescriptionException; //导入依赖的package包/类
/**
 * Loads a game type by name
 * @param name name of game type
 * @return game type object
 * @throws InvalidGameException if could not load
 */
public GameType loadGameType(String name) throws InvalidGameException {
    File file = new File(directory, name + ".jar");
    if (!file.exists()) {
        throw new InvalidGameException("Game jar does not exist");
    }
    
    GameDescriptionFile description = null;
    try {
        description = gameLoader.getGameDescription(file);
    } catch (InvalidDescriptionException e) {
        throw new InvalidGameException(e);
    }
    
    if (!isDependLoaded(description.getDepend())) {
        throw new InvalidGameException("One or more dependencies are not yet loaded");
    }
    
    gameLoader.loadGameType(file, description, true);
    GameType type = GameType.get(description.getName());
    gameLoader.loadEvents(type);
    loadedGameTypes.add(type);
    loadGames(type);
    return type;
}
 
开发者ID:Lactem,项目名称:GameDispenser,代码行数:31,代码来源:GameManager.java

示例10: setupForTesting

import org.bukkit.plugin.InvalidDescriptionException; //导入依赖的package包/类
public void setupForTesting(final Server server) throws IOException, InvalidDescriptionException
{
	testing = true;
	final File dataFolder = File.createTempFile("essentialstest", "");
	if (!dataFolder.delete())
	{
		throw new IOException();
	}
	if (!dataFolder.mkdir())
	{
		throw new IOException();
	}

	logger.log(Level.INFO, _("Using temp folder for testing:"));
	logger.log(Level.INFO, dataFolder.toString());
	storageQueue.setEnabled(true);
	settings = new SettingsHolder(this);
	i18n.updateLocale("en");
	userMap = new UserMap(this);
	economy = new Economy(this);
}
 
开发者ID:Curtis3321,项目名称:Essentials,代码行数:22,代码来源:Essentials.java

示例11: TagAPI

import org.bukkit.plugin.InvalidDescriptionException; //导入依赖的package包/类
public TagAPI(iTag parent)
{
    this.parent = parent;

    plugins = (List<Plugin>) getObj( SimplePluginManager.class, parent.getServer().getPluginManager(), "plugins" );
    lookupNames = (Map<String, Plugin>) getObj( SimplePluginManager.class, parent.getServer().getPluginManager(), "lookupNames" );

    StringWriter write = new StringWriter();
    parent.getDescription().save( write );
    String yaml = write.toString().replaceAll( "iTag", "TagAPI" );

    try
    {
        description = new PluginDescriptionFile( new StringReader( yaml ) );
    } catch ( InvalidDescriptionException ex )
    {
        throw Throwables.propagate( ex );
    }

    plugins.add( this );
    lookupNames.put( getName(), this );
}
 
开发者ID:md-5,项目名称:iTag,代码行数:23,代码来源:TagAPI.java

示例12: onCustomSubChannelMessageReceive

import org.bukkit.plugin.InvalidDescriptionException; //导入依赖的package包/类
@Override
public void onCustomSubChannelMessageReceive(String channel, String message, Document document)
{
    Bukkit.getPluginManager().callEvent(new BukkitSubChannelMessageEvent(channel, message, document));

    if (channel.equalsIgnoreCase("cloudnet_internal"))
    {
        if (message.equalsIgnoreCase("install_plugin"))
        {
            String url = document.getString("url");
            try
            {
                URLConnection urlConnection = new URL(url).openConnection();
                urlConnection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11");
                urlConnection.connect();
                Files.copy(urlConnection.getInputStream(), Paths.get("plugins/" + document.getString("name") + ".jar"));
                File file = new File("plugins/" + document.getString("name") + ".jar");

                Plugin plugin = Bukkit.getPluginManager().loadPlugin(file);
                Bukkit.getPluginManager().enablePlugin(plugin);
            } catch (IOException | InvalidDescriptionException | InvalidPluginException e)
            {
                e.printStackTrace();
            }
        }
    }

}
 
开发者ID:Dytanic,项目名称:CloudNet,代码行数:29,代码来源:CloudServer.java

示例13: loadPlugin

import org.bukkit.plugin.InvalidDescriptionException; //导入依赖的package包/类
/**
 * Load a plugin from a class. It will use the system resource
 * {@code plugin.yml} as the resource file.
 * 
 * @param class1 The plugin to load.
 * @return The loaded plugin.
 */
public JavaPlugin loadPlugin(Class<? extends JavaPlugin> class1)
{
	try
	{
		return loadPlugin(class1, new PluginDescriptionFile(ClassLoader.getSystemResourceAsStream("plugin.yml")));
	}
	catch (InvalidDescriptionException e)
	{
		throw new RuntimeException(e);
	}
}
 
开发者ID:seeseemelk,项目名称:MockBukkit,代码行数:19,代码来源:PluginManagerMock.java

示例14: loadPlugin

import org.bukkit.plugin.InvalidDescriptionException; //导入依赖的package包/类
public Plugin loadPlugin(CommandSender sender, File f, ArrayList<Plugin> loaded) {
	Plugin pl = null;
	for (Plugin pll : loaded) {
		if (pll.getName().equals(f.getName().replaceAll(".jar", ""))) {
			return null;
		}
	}
	try {
		pl = Bukkit.getPluginManager().loadPlugin(f);
	} catch (UnknownDependencyException | InvalidPluginException | InvalidDescriptionException e) {
		if (e instanceof UnknownDependencyException) {
			sender.sendMessage("[UnlimitedPlugins] Tried to load the jar, " + f.getName()
					+ " but failed because the required dependencies wheren't found.");
		} else if (e instanceof InvalidPluginException) {
			sender.sendMessage("[UnlimitedPlugins] Tried to load the jar, " + f.getName()
					+ " but failed because the jar was invalid.");
		} else if (e instanceof InvalidDescriptionException) {
			sender.sendMessage("[UnlimitedPlugins] Tried to load the jar, " + f.getName()
					+ " but failed because the plugin.yml was invalid.");
		} else {
			sender.sendMessage("[UnlimitedPlugins] Tried to load the jar, " + f.getName()
					+ " but failed because an unknown error occurred.");
		}
		return null;
	}
	if (pl != null) {
		Bukkit.getPluginManager().enablePlugin(pl);
	}
	return pl;
}
 
开发者ID:Struck713,项目名称:UnlimitedPlugins,代码行数:31,代码来源:UnlimitedPlugins.java

示例15: createDescription

import org.bukkit.plugin.InvalidDescriptionException; //导入依赖的package包/类
public PluginDescriptionFile createDescription(JavaPlugin plugin) throws InvalidDescriptionException {
	for (TestPlugin<?> p : pluginsToLoad) {
		if (p.getPluginClass() == plugin.getClass()) {
			return p.getDescription();
		}
	}
	return null;
}
 
开发者ID:DevotedMC,项目名称:ExilePearl,代码行数:9,代码来源:TestPluginManager.java


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