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


Java Sponge.getScheduler方法代码示例

本文整理汇总了Java中org.spongepowered.api.Sponge.getScheduler方法的典型用法代码示例。如果您正苦于以下问题:Java Sponge.getScheduler方法的具体用法?Java Sponge.getScheduler怎么用?Java Sponge.getScheduler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.spongepowered.api.Sponge的用法示例。


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

示例1: gameStarted

import org.spongepowered.api.Sponge; //导入方法依赖的package包/类
@Listener
public void gameStarted(GameStartedServerEvent event){

    if(forceStop) {
        return;
    }

    HuskyCommandManager huskyCommandManager = new HuskyCommandManager();

    scheduler = Sponge.getScheduler();
    //genericCause = Cause.of(EventContext.);
    Sponge.getCommandManager().register(this, huskyCommandManager.getCrateSpec(), "hc","huskycrates");
    Sponge.getCommandManager().register(this, huskyCommandManager.getHuskySpec(), "husky");
    metrics.addCustomChart(new Metrics.SimplePie("huskyui_version", () -> HuskyUI.PLUGIN_VERSION));
    logger.info("Crates has been started.");
}
 
开发者ID:codeHusky,项目名称:HuskyCrates-Sponge,代码行数:17,代码来源:HuskyCrates.java

示例2: RouletteCrateView

import org.spongepowered.api.Sponge; //导入方法依赖的package包/类
public RouletteCrateView(HuskyCrates plugin, Player runner, VirtualCrate virtualCrate){
    this.plugin = plugin;
    vc = virtualCrate;
    ourplr = runner;
    items = vc.getItemSet();
    if(virtualCrate.scrambleRewards){
        scrambleRewards();
    }
    disp = Inventory.builder()
            .of(InventoryArchetypes.DISPENSER)
            .listener(InteractInventoryEvent.class, evt ->{
                if(!(evt instanceof InteractInventoryEvent.Open) && !(evt instanceof  InteractInventoryEvent.Close)){
                    evt.setCancelled(true);
                    if(!stopped && evt instanceof ClickInventoryEvent){
                        ourplr.playSound(SoundTypes.ENTITY_FIREWORK_LAUNCH,ourplr.getLocation().getPosition(),1);
                    }
                    stopped = true;
                }

            })
            .property(InventoryTitle.PROPERTY_NAME,InventoryTitle.of(TextSerializers.FORMATTING_CODE.deserialize(virtualCrate.displayName)))
            .build(plugin);
    updateInv(0);
    Scheduler scheduler = Sponge.getScheduler();
    Task.Builder taskBuilder = scheduler.createTaskBuilder();
    updater = taskBuilder.execute(this::updateTick).intervalTicks(1).submit(plugin);
}
 
开发者ID:codeHusky,项目名称:HuskyCrates-Sponge,代码行数:28,代码来源:RouletteCrateView.java

示例3: InstantGUIView

import org.spongepowered.api.Sponge; //导入方法依赖的package包/类
public InstantGUIView(HuskyCrates plugin, Player runner, VirtualCrate virtualCrate){
    //System.out.println("AA");
    this.plugin = plugin;
    vc = virtualCrate;
    ourplr = runner;
    items = vc.getItemSet();
    if(virtualCrate.scrambleRewards){
        scrambleRewards();
    }
    disp = Inventory.builder()
            .of(InventoryArchetypes.DISPENSER)
            .listener(InteractInventoryEvent.class, evt ->{
                if(!(evt instanceof InteractInventoryEvent.Open) && !(evt instanceof  InteractInventoryEvent.Close)){
                    evt.setCancelled(true);
                }

            })
            .property(InventoryTitle.PROPERTY_NAME,InventoryTitle.of(TextSerializers.FORMATTING_CODE.deserialize(virtualCrate.displayName)))
            .build(plugin);
    updateInv(0);
    Scheduler scheduler = Sponge.getScheduler();
    Task.Builder taskBuilder = scheduler.createTaskBuilder();
    updater = taskBuilder.execute(this::updateTick).intervalTicks(1).submit(plugin);
    scheduler.createTaskBuilder().execute(() -> {
        updater.cancel();
        ourplr.closeInventory();
        handleReward(holder);
        ourplr.playSound(SoundTypes.ENTITY_EXPERIENCE_ORB_PICKUP,ourplr.getLocation().getPosition(),1);
    }).delay(3, TimeUnit.SECONDS).submit(HuskyCrates.instance);
}
 
开发者ID:codeHusky,项目名称:HuskyCrates-Sponge,代码行数:31,代码来源:InstantGUIView.java

示例4: startParticleEffects

import org.spongepowered.api.Sponge; //导入方法依赖的package包/类
public void startParticleEffects(){
    if(runner != null){
        runner.cancel();
    }
    Scheduler scheduler = Sponge.getScheduler();
    Task.Builder taskBuilder = scheduler.createTaskBuilder();
    runner = taskBuilder.execute(this::particleRunner).intervalTicks(1).submit(plugin);
}
 
开发者ID:codeHusky,项目名称:HuskyCrates-Sponge,代码行数:9,代码来源:CrateUtilities.java

示例5: SpinnerCrateView

import org.spongepowered.api.Sponge; //导入方法依赖的package包/类
public SpinnerCrateView(HuskyCrates plugin, Player runner, VirtualCrate virtualCrate){
    this.vc = virtualCrate;
    ourplr = runner;
    this.plugin = plugin;

    items = virtualCrate.getItemSet();
    if(virtualCrate.scrambleRewards){
        scrambleRewards();
    }

    if(virtualCrate.getOptions().containsKey("dampening")) {
        dampening = (double) virtualCrate.getOptions().get("dampening");
        //HuskyCrates.instance.logger.info("dampening override: " + dampening);
    }
    if(virtualCrate.getOptions().containsKey("maxClicks")) {
        maxClicks = (int) virtualCrate.getOptions().get("maxClicks");
        //HuskyCrates.instance.logger.info("maxClicks override: " + maxClicks);
    }
    if(virtualCrate.getOptions().containsKey("minClickModifier") || virtualCrate.getOptions().containsKey("maxClickModifier")){
        int min = (int)virtualCrate.getOptions().get("minClickModifier");
        int max = (int)virtualCrate.getOptions().get("maxClickModifier");
        Random rand = new Random();
        maxClicks += Math.round((max*rand.nextDouble())+(min*rand.nextDouble()));
    }
    try {
        clicks = itemIndexSelected() - (maxClicks % items.size());
    }catch (RandomItemSelectionFailureException e){
        HuskyCrates.initError();
        System.out.println("--------------------------------");
        System.out.println("--------------------------------");
        System.out.println("ERROR WHEN INITING RANDOM ITEM FOR " + vc.displayName);
        System.out.println("--------------------------------");
        System.out.println("--------------------------------");
    }
    disp = Inventory.builder()
            .of(InventoryArchetypes.CHEST)
            .listener(InteractInventoryEvent.class, evt ->{
                if(!(evt instanceof InteractInventoryEvent.Open) && !(evt instanceof  InteractInventoryEvent.Close)){
                    evt.setCancelled(true);
                }
                //System.out.println(evt.getClass());
            })
            .property(InventoryTitle.PROPERTY_NAME,InventoryTitle.of(TextSerializers.FORMATTING_CODE.deserialize(virtualCrate.displayName)))
            .build(plugin);
    updateInv(0);
    Scheduler scheduler = Sponge.getScheduler();
    Task.Builder taskBuilder = scheduler.createTaskBuilder();
    updater = taskBuilder.execute(this::updateTick).intervalTicks(1).submit(plugin);


}
 
开发者ID:codeHusky,项目名称:HuskyCrates-Sponge,代码行数:52,代码来源:SpinnerCrateView.java


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