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


Java JavaPlugin类代码示例

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


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

示例1: onEnable

import org.bukkit.plugin.java.JavaPlugin; //导入依赖的package包/类
public void onEnable() {
	// Console sender
	getServer().getConsoleSender().sendMessage(ChatColor.GREEN + "|----------|");
	getServer().getConsoleSender().sendMessage(ChatColor.AQUA + "Starting Mortuus Terra chat.");

	core = JavaPlugin.getPlugin(MortuusTerraCore.class);

	frequencyManager = new FrequencyManager();
	fileManager = new FileManager();
	playerManager = new PlayerManager();
	textMessageManager = new TextMessageManager();
	messageScrambler = new MessageScrambler();

	getFileManager().loadFiles();

	registerCommands();
	registerListeners();
	
	// Console sender
	getServer().getConsoleSender().sendMessage(ChatColor.AQUA + "Mortuus Terra chat ready.");
	getServer().getConsoleSender().sendMessage(ChatColor.GREEN + "|----------|");
}
 
开发者ID:kadeska,项目名称:MT_Communication,代码行数:23,代码来源:MortuusTerraChat.java

示例2: SignsConfig

import org.bukkit.plugin.java.JavaPlugin; //导入依赖的package包/类
public SignsConfig(JavaPlugin 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) {
                    Block block = loc.getWorld().getBlockAt(loc);
                    if (block.getState() instanceof Sign) {
                        signs.add(new DonorSign(Utils.getInt(key), block));
                    }
                }
            }
            donorSigns.put(Utils.getInt(key), signs);
        }
    }
}
 
开发者ID:MinecraftMarket,项目名称:MinecraftMarket-Plugin,代码行数:19,代码来源:SignsConfig.java

示例3: getLibraryResolver

import org.bukkit.plugin.java.JavaPlugin; //导入依赖的package包/类
@Override
public LibraryResolver getLibraryResolver(Object realm) {
    if (!(realm instanceof JavaPlugin))
        throw new IllegalArgumentException("Only realms of type " + JavaPlugin.class.getName() + " are supported");
    JavaPlugin plugin = (JavaPlugin) realm;
    ClassLoader classLoader = plugin.getClass().getClassLoader();
    if (!(classLoader instanceof URLClassLoader))
        throw new UnsupportedOperationException("Plugin " + plugin.getName() + " was not loaded by a URLClassLoader");
    return libraryResolvers.computeIfAbsent(plugin.getName(), name -> new ClassLoaderLibraryResolver(
            repositorySystem,
            createSession(),
            remoteRepositorySupplier,
            (URLClassLoader) classLoader,
            plugin.getLogger()
    ));
}
 
开发者ID:MCCityVille,项目名称:libmanager,代码行数:17,代码来源:BukkitLibraryManager.java

示例4: getInstance

import org.bukkit.plugin.java.JavaPlugin; //导入依赖的package包/类
public JavaPlugin getInstance() {
    if (plugin == null)
        try {
            throw new Exception();
        } catch (Exception e) {
            e.printStackTrace();
        }
    return plugin;
}
 
开发者ID:Chazmondo,项目名称:RankVouchers,代码行数:10,代码来源:UserManager.java

示例5: ConfigAPI

import org.bukkit.plugin.java.JavaPlugin; //导入依赖的package包/类
public ConfigAPI(File file, JavaPlugin plugin) {
 	if (!file.exists()) {
try {
	file.getParentFile().mkdirs();
	file.createNewFile();
} catch (IOException e) {
	e.printStackTrace();
}
 	}
     this.config = YamlConfiguration.loadConfiguration(file);
 }
 
开发者ID:thekeenant,项目名称:mczone,代码行数:12,代码来源:ConfigAPI.java

示例6: Config

import org.bukkit.plugin.java.JavaPlugin; //导入依赖的package包/类
/**
 * Creates new PluginFile, with defaults
 * @param plugin - Your plugin
 * @param fileName - Name of the file
 * @param defaultsName - Name of the defaults
 */
public Config(JavaPlugin plugin, String fileName, String defaultsName) {
    this.plugin = plugin;
    this.defaults = defaultsName;
    this.file = new File(plugin.getDataFolder(), fileName);
    reload();
}
 
开发者ID:DiscowZombie,项目名称:UltimateTs,代码行数:13,代码来源:Config.java

示例7: fatal

import org.bukkit.plugin.java.JavaPlugin; //导入依赖的package包/类
public static void fatal(final String prefix, final String context, final JavaPlugin plugin) {
    Bukkit.getScheduler().runTaskTimer(plugin, new Runnable(){
    	@Override
        public void run(){
    		Bukkit.getLogger().severe(prefix + context);
    	}
    }, 0L, TimeUnit.SECONDS.toMillis(30));
}
 
开发者ID:GelandiAssociation,项目名称:EscapeLag,代码行数:9,代码来源:AzureAPI.java

示例8: initAll

import org.bukkit.plugin.java.JavaPlugin; //导入依赖的package包/类
void initAll(JavaPlugin plugin) {
    armorstandLocationsFile = new ArmorstandLocationsFile(plugin);
    endercrystalLocationsFile = new EndercrystalLocationsFile(plugin);
    playerLocationsFile = new PlayerLocationsFile(plugin);
    itemLocationsFile = new ItemLocationsFile(plugin);
    mobLocationsFile = new MobLocationsFile(plugin);
    bigItemLocationsFile = new BigItemLocationsFile(plugin);
    xpOrbLocationsFile = new XPOrbLocationsFile(plugin);
}
 
开发者ID:AlphaHelixDev,项目名称:AlphaLibary,代码行数:10,代码来源:FakeRegister.java

示例9: show

import org.bukkit.plugin.java.JavaPlugin; //导入依赖的package包/类
public AdvancementAPI show(JavaPlugin plugin, Player... players) {
    add();
    grant(players);
    Bukkit.getScheduler().runTaskLater(plugin, () -> {
        revoke(players);
        remove();
    }, 20L);
    return this;
}
 
开发者ID:ArcadiaPlugins,项目名称:Arcadia-Spigot,代码行数:10,代码来源:AdvancementAPI.java

示例10: playParticleEffectForPipeline

import org.bukkit.plugin.java.JavaPlugin; //导入依赖的package包/类
public static void playParticleEffectForPipeline(Location location, ParticleEffectMeta particleEffectMeta, PetBlock petBlock) {
    if (ConfigPet.getInstance().areParticlesForOtherPlayersVisible()) {
        for (final Player player : location.getWorld().getPlayers()) {
            Bukkit.getServer().getScheduler().runTaskAsynchronously(JavaPlugin.getPlugin(PetBlocksPlugin.class), () -> ((ParticleEffectData) particleEffectMeta).applyTo(location, player));
        }
    } else {
        Bukkit.getServer().getScheduler().runTaskAsynchronously(JavaPlugin.getPlugin(PetBlocksPlugin.class), () -> ((ParticleEffectData) particleEffectMeta).applyTo(location, (Player) petBlock.getPlayer()));
    }
}
 
开发者ID:Shynixn,项目名称:PetBlocks,代码行数:10,代码来源:PetBlockHelper.java

示例11: registerAll

import org.bukkit.plugin.java.JavaPlugin; //导入依赖的package包/类
public static void registerAll() {
    RegisterHelper.PREFIX = PetBlocksPlugin.PREFIX_CONSOLE;
    RegisterHelper.register("WorldGuard", "com.sk89q.worldguard.protection.ApplicableRegionSet", '5');
    RegisterHelper.register("WorldGuard", "com.sk89q.worldguard.protection.ApplicableRegionSet", '6');
    if (RegisterHelper.register("ClearLag")) {
        try {
            new ClearLagListener((JavaPlugin) Bukkit.getPluginManager().getPlugin("PetBlocks"));
        } catch (final Exception ex) {
            Bukkit.getServer().getConsoleSender().sendMessage(PetBlocksPlugin.PREFIX_CONSOLE + ChatColor.DARK_RED + "Manual hook failed. No interacting with [ClearLag.]");
        }
    }
}
 
开发者ID:Shynixn,项目名称:PetBlocks,代码行数:13,代码来源:NMSRegistry.java

示例12: undoOperation

import org.bukkit.plugin.java.JavaPlugin; //导入依赖的package包/类
/**
 * Undos an operation
 *
 * @param player player
 */
boolean undoOperation(Player player) {
    if (!this.hasSelection(player))
        return false;
    if (!this.operations.containsKey(player))
        this.operations.put(player, new Operation[this.maxUndoAmount]);
    final Operation operation = this.operations.get(player)[0];
    if (operation != null) {
        if (operation.getType() == OperationType.MIRROR) {
            this.getSelection(player).mirror();
        } else if (operation.getType() == OperationType.FLIP) {
            this.getSelection(player).flip();
        } else if (operation.getType() == OperationType.UPSIDEDOWN) {
            this.getSelection(player).upSideDown();
        } else if (operation.getType() == OperationType.UNCOMBINE) {
            this.getSelection(player).join();
        } else if (operation.getType() == OperationType.COMBINE) {
            this.getSelection(player).tearApart();
        } else if (operation.getType() == OperationType.ROTATE) {
            this.selections.get(player).unSecureRotate((Double) operation.getOperationData());
        } else if (operation.getType() == OperationType.ANGLES) {
            this.getSelection(player).setBlockAngle((EulerAngle) operation.getOperationData());
        } else if (operation.getType() == OperationType.PLACE || operation.getType() == OperationType.CONVERTOBLOCKS) {
            final List<Container> containers = (List<Container>) operation.getOperationData();
            Bukkit.getServer().getScheduler().runTask(JavaPlugin.getPlugin(AstralEditPlugin.class), () -> this.placeUndoCalc(0, containers.get(0), containers, 0));
        } else if (operation.getType() == OperationType.MOVE) {
            this.selections.get(player).teleport((Location) operation.getOperationData());
        }
        this.removeOperation(player);
        return true;
    }
    return false;
}
 
开发者ID:Shynixn,项目名称:AstralEdit,代码行数:38,代码来源:SelectionManager.java

示例13: load

import org.bukkit.plugin.java.JavaPlugin; //导入依赖的package包/类
/**
 * Loads and enables a plugin for mocking.
 * 
 * @param class1 The plugin to load for mocking.
 */
@SuppressWarnings("unchecked")
public static <T extends JavaPlugin> T load(Class<T> plugin)
{
	if (mock != null)
	{
		JavaPlugin instance = mock.getPluginManager().loadPlugin(plugin);
		mock.getPluginManager().enablePlugin(instance);
		return (T) instance;
	}
	else
	{
		throw new IllegalStateException("Not mocking");
	}
}
 
开发者ID:seeseemelk,项目名称:MockBukkit,代码行数:20,代码来源:MockBukkit.java

示例14: registerAll

import org.bukkit.plugin.java.JavaPlugin; //导入依赖的package包/类
public static void registerAll() {
    try {
        LightRegistry.RABBIT.register("com.github.shynixn.blockball.business.bukkit.nms.VERSION.CustomRabbit");
        RegisterHelper.PREFIX = BlockBallPlugin.PREFIX_CONSOLE;
        RegisterHelper.register("WorldGuard", "com.sk89q.worldguard.protection.ApplicableRegionSet", '5');
        RegisterHelper.register("WorldGuard", "com.sk89q.worldguard.protection.ApplicableRegionSet", '6');
        RegisterHelper.register("BossBarAPI");
        RegisterHelper.register("Vault");
        if (RegisterHelper.register("PlaceholderAPI")) {
            PlaceHolderApiConnection.init((JavaPlugin) Bukkit.getPluginManager().getPlugin("BlockBall"));
        }
    } catch (final Error ex) {
        Bukkit.getConsoleSender().sendMessage(BlockBallPlugin.PREFIX_CONSOLE + ChatColor.DARK_RED + "Failed to register the last dependency.");
    }
}
 
开发者ID:Shynixn,项目名称:BlockBall,代码行数:16,代码来源:NMSRegistry.java

示例15: GameController

import org.bukkit.plugin.java.JavaPlugin; //导入依赖的package包/类
public GameController() {
    super(JavaPlugin.getPlugin(BlockBallPlugin.class));
    this.arenaManager = ArenaController.createArenaController(this);
    new EventCommandExecutor(this);
    if (Config.getInstance().getGlobalJoinCommand().isEnabled())
        new GlobalJoinCommandExecutor(this);
    if (Config.getInstance().getGlobalLeaveCommand().isEnabled())
        new GlobalLeaveCommandExecutor(this);
    new GameListener(this);
    this.run();
}
 
开发者ID:Shynixn,项目名称:BlockBall,代码行数:12,代码来源:GameController.java


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