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


Java PluginBase类代码示例

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


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

示例1: SignsConfig

import cn.nukkit.plugin.PluginBase; //导入依赖的package包/类
public SignsConfig(PluginBase plugin) {
    super(plugin, "signs");

    for (String key : config.getKeys(false)) {
        if (Utils.isInt(key)) {
            Set<DonorSign> signs = new HashSet<>();
            for (Location loc : stringsToLocArray(config.getStringList(key))) {
                if (loc != null) {
                    BlockEntity block = loc.getLevel().getBlockEntity(loc);
                    if (block != null && block instanceof BlockEntitySign) {
                        signs.add(new DonorSign(Utils.getInt(key), block.getBlock()));
                    }
                }
            }
            donorSigns.put(Utils.getInt(key), signs);
        }
    }
}
 
开发者ID:MinecraftMarket,项目名称:MinecraftMarket-Plugin,代码行数:19,代码来源:SignsConfig.java

示例2: ConfigFile

import cn.nukkit.plugin.PluginBase; //导入依赖的package包/类
public ConfigFile(PluginBase plugin, String name) {
    super(plugin.getDataFolder(), name + ".yml");

    if (!plugin.getDataFolder().exists()) {
        plugin.getDataFolder().mkdirs();
    }

    if (!exists()) {
        try {
            if (plugin.getResource(name + ".yml") != null) {
                plugin.saveResource(name + ".yml", true);
            } else {
                createNewFile();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    config = new Config(this, Config.YAML);
}
 
开发者ID:MinecraftMarket,项目名称:MinecraftMarket-Plugin,代码行数:22,代码来源:ConfigFile.java

示例3: onLoad

import cn.nukkit.plugin.PluginBase; //导入依赖的package包/类
public void onLoad(PluginBase plugin) {

		File pluginFolder = new File(plugin.getDataFolder(), "bukkitPlugins");
		if (!pluginFolder.exists()) {
			pluginFolder.mkdirs();
		}

		Logger logger = new PokkitLogger(plugin.getLogger());
		LogManager.getLogManager().addLogger(logger);

		loadVersionNumbers(logger);

		CraftServer server = new CraftServer(plugin.getServer(), logger, pluginFolder);
		Bukkit.setServer(server);

		// Load the services
		services.forEach(service -> service.onLoad(plugin));
	}
 
开发者ID:rutgerkok,项目名称:Pokkit,代码行数:19,代码来源:Pokkit.java

示例4: MainConfig

import cn.nukkit.plugin.PluginBase; //导入依赖的package包/类
public MainConfig(PluginBase plugin) {
    super(plugin, "nukkitConfig");

    apiKey = config.getString("APIKey", "");
    checkInterval = config.getInt("CheckInterval", 1);
    useSigns = config.getBoolean("UseSigns", true);
    dateFormat = config.getString("DateFormat", "yyyy-MM-dd");
    statistics = config.getBoolean("Statistics", true);
    lang = config.getString("Lang", "en");
    debug = config.getBoolean("Debug", false);
}
 
开发者ID:MinecraftMarket,项目名称:MinecraftMarket-Plugin,代码行数:12,代码来源:MainConfig.java

示例5: SkyBlockAPI

import cn.nukkit.plugin.PluginBase; //导入依赖的package包/类
public SkyBlockAPI(PluginBase plugin) {
    this.executor = plugin;
    SkyBlockAPI.list.add(plugin);
    if (plugin instanceof ASkyBlock) {
        hasPermissionToAccessAll = true;
    }
}
 
开发者ID:TheSolidCrafter,项目名称:ASkyBlock-Nukkit,代码行数:8,代码来源:SkyBlockAPI.java

示例6: init

import cn.nukkit.plugin.PluginBase; //导入依赖的package包/类
public static void init(PluginBase plg) {
    plugin = plg;

    //Perm command
    addNewCommand(PermHelp.class);
    addNewCommand(PermReload.class);
    addNewCommand(PermRefresh.class);
    addNewCommand(PermCheck.class);
    addNewCommand(PermExport.class);
    addNewCommand(PermImport.class);

    // Group command
    addNewCommand(GroupInfo.class);
    addNewCommand(GroupCreate.class);
    addNewCommand(GroupRemove.class);
    addNewCommand(GroupRemovePerm.class);
    addNewCommand(GroupSetPerm.class);
    addNewCommand(GroupSetGroup.class);
    addNewCommand(GroupAddGroup.class);
    addNewCommand(GroupRemoveGroup.class);
    addNewCommand(GroupSetPrefix.class);
    addNewCommand(GroupSetSuffix.class);

    //User command
    addNewCommand(UserInfo.class);
    addNewCommand(UserRemove.class);
    addNewCommand(UserAddGroup.class);
    addNewCommand(UserRemoveGroup.class);
    addNewCommand(UserRemovePerm.class);
    addNewCommand(UserSetGroup.class);
    addNewCommand(UserSetPerm.class);
    addNewCommand(UserSetPrefix.class);
    addNewCommand(UserSetSuffix.class);
}
 
开发者ID:fromgate,项目名称:Multipass,代码行数:35,代码来源:Commander.java

示例7: DefaultManager

import cn.nukkit.plugin.PluginBase; //导入依赖的package包/类
public DefaultManager(PluginBase plugin){
	this.plugin = plugin;
	
	attachments = new HashMap<>();
	this.provider = new YamlProvider(plugin);
	
	//this.plugin.getServer().getScheduler().scheduleDelayedRepeatingTask(task = new SendTipTask(plugin), 10, 10);
}
 
开发者ID:onebone,项目名称:GateKeeper,代码行数:9,代码来源:DefaultManager.java

示例8: onDisable

import cn.nukkit.plugin.PluginBase; //导入依赖的package包/类
@Override
public void onDisable() {
	try {
		pokkit.getClass().getMethod("onDisable", PluginBase.class).invoke(pokkit, this);
	} catch (Throwable t) {
		this.getLogger().error("Error disabling plugin", t);
	}
}
 
开发者ID:rutgerkok,项目名称:Pokkit,代码行数:9,代码来源:NukkitHook.java

示例9: onEnable

import cn.nukkit.plugin.PluginBase; //导入依赖的package包/类
@Override
public void onEnable() {
	try {
		pokkit.getClass().getMethod("onEnable", PluginBase.class).invoke(pokkit, this);
	} catch (Throwable t) {
		this.getLogger().error("Error disabling plugin", t);
	}
}
 
开发者ID:rutgerkok,项目名称:Pokkit,代码行数:9,代码来源:NukkitHook.java

示例10: onLoad

import cn.nukkit.plugin.PluginBase; //导入依赖的package包/类
@Override
public void onLoad() {
	try {
		PluginClassLoader nukkitLoader = (PluginClassLoader) getClass().getClassLoader();
		@SuppressWarnings("resource")
		UrlFirstClassLoader classLoader = new UrlFirstClassLoader(nukkitLoader.getURLs(), nukkitLoader);

		pokkit = classLoader.loadClass("nl.rutgerkok.pokkit.Pokkit").newInstance();
		pokkit.getClass().getMethod("onLoad", PluginBase.class).invoke(pokkit, this);
	} catch (Throwable t) {
		this.getLogger().error("Error loading plugin", t);
	}
}
 
开发者ID:rutgerkok,项目名称:Pokkit,代码行数:14,代码来源:NukkitHook.java

示例11: onDisable

import cn.nukkit.plugin.PluginBase; //导入依赖的package包/类
@Override
public void onDisable(PluginBase pokkit) {
	YamlConfiguration scoreboardConfig = new YamlConfiguration();
	persister.saveScoreboard(scoreboardConfig, Bukkit.getScoreboardManager().getMainScoreboard());
	scoreboardConfig.options().header("This is the scoreboard data of the main scoreboard.");
	try {
		scoreboardConfig.save(getScoreboardFile(pokkit));
	} catch (IOException e) {
		Bukkit.getLogger().log(Level.SEVERE, "Error saving " + getScoreboardFile(pokkit).getName(), e);
	}
}
 
开发者ID:rutgerkok,项目名称:Pokkit,代码行数:12,代码来源:MainScoreboardService.java

示例12: SignsLayoutConfig

import cn.nukkit.plugin.PluginBase; //导入依赖的package包/类
public SignsLayoutConfig(PluginBase plugin) {
    super(plugin, "signsLayout");

    activeLayout = Colors.colorList(config.getStringList("Active"));
    waitingLayout = Colors.colorList(config.getStringList("Waiting"));
}
 
开发者ID:MinecraftMarket,项目名称:MinecraftMarket-Plugin,代码行数:7,代码来源:SignsLayoutConfig.java

示例13: PluginCertificateTask

import cn.nukkit.plugin.PluginBase; //导入依赖的package包/类
public PluginCertificateTask(PluginBase plugin) {
    this.plugin = plugin;
}
 
开发者ID:FrontierDevs,项目名称:Jenisys3,代码行数:4,代码来源:PluginCertificateTask.java

示例14: list

import cn.nukkit.plugin.PluginBase; //导入依赖的package包/类
public List<String> list() throws IOException {
    List<String> result = new ArrayList<>();

    // Check if the locale folder exists
    File localeDir = new File(plugin.getDataFolder(), FOLDERPATH);
    if (localeDir.exists()) {
        FilenameFilter ymlFilter = (File dir, String name) -> {
            String lowercaseName = name.toLowerCase();
            return lowercaseName.endsWith(".yml");
        };
        for (String fileName : localeDir.list(ymlFilter)) {
            result.add(fileName.replace(".yml", ""));
        }
        if (!result.isEmpty()) {
            return result;
        }
    }
    // Else look in the JAR
    File jarfile = null;

    /**
     * Get the jar file from the plugin.
     */
    try {
        Method method = PluginBase.class.getDeclaredMethod("getFile");
        method.setAccessible(true);

        jarfile = (File) method.invoke(this.plugin);
    } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
        throw new IOException(e);
    }

    /**
     * Loop through all the entries.
     */
    try (JarFile jar = new JarFile(jarfile)) {
        /**
         * Loop through all the entries.
         */
        Enumeration<JarEntry> entries = jar.entries();
        while (entries.hasMoreElements()) {
            JarEntry entry = entries.nextElement();
            String path = entry.getName();

            /**
             * Not in the folder.
             */
            if (!path.startsWith(FOLDERPATH)) {
                continue;
            }

            if (entry.getName().endsWith(".yml")) {
                result.add((entry.getName().replace(".yml", "")).replace("locale/", ""));
            }

        }
    }
    return result;
}
 
开发者ID:TheSolidCrafter,项目名称:ASkyBlock-Nukkit,代码行数:60,代码来源:FileLister.java

示例15: getPlugin

import cn.nukkit.plugin.PluginBase; //导入依赖的package包/类
public static PluginBase getPlugin() {
    return plugin;
}
 
开发者ID:fromgate,项目名称:Multipass,代码行数:4,代码来源:Commander.java


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