當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。