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


Java Cause.of方法代码示例

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


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

示例1: reload

import org.spongepowered.api.event.cause.Cause; //导入方法依赖的package包/类
public void reload() {
    deleteHolograms();
    created_managers.clear();
    config.reload();
    language_config.reload();
    virtual_cases_config.reload();
    virtual_keys_config.reload();
    timed_cases_delays_config.reload();
    timed_keys_delays_config.reload();
    saved_super_objects_config.reload();
    super_objects.clear();
    saved_super_objects.clear();
    loadConfigValues();
    default_cause = Cause.of(EventContext.empty(), plugin_container);
    register();
    optional_economy_service = Optional.empty();
    optional_holograms_service = Optional.empty();
    loadEconomy();
    loadHologramsService();
    loadSavedSuperObjects();
    loadManagers();
    if (check_updates) {
        checkUpdates();
    }
    logger.info("Plugin has been reloaded.");
}
 
开发者ID:GreWeMa,项目名称:gwm_Crates,代码行数:27,代码来源:GWMCrates.java

示例2: execute

import org.spongepowered.api.event.cause.Cause; //导入方法依赖的package包/类
@Override
public CommandResult execute(CommandSource src, CommandContext args)
        throws CommandException {
    if (!(src instanceof LocatedSource)) {
        src.sendMessage(Texts
                .of("Must be an in-world source to use this command."));
        return CommandResult.success();
    }
    Cause cause = Cause.of(src,
            // SpawnCause.builder().type(SpawnTypes.PLUGIN).build(),
            APlugin.getInstance());
    Location<World> loc = ((LocatedSource) src).getLocation();
    int count = args.<Integer> getOne(TIMES).orElse(1);
    Object groupKey = new Object();
    startGroup(groupKey, count, src);
    IntStream.range(0, count)
            .forEach(x -> createExplosion(groupKey, x, cause, loc));
    return CommandResult.success();
}
 
开发者ID:kenzierocks,项目名称:Annointment,代码行数:20,代码来源:EasterEggCommand.java

示例3: preventExplosion

import org.spongepowered.api.event.cause.Cause; //导入方法依赖的package包/类
private void preventExplosion(ExplosionEvent.Pre event) {
    //"Clone" explosion, as we cannot change the existing one?
    Explosion old = event.getExplosion();
    Explosion newExplosion = Explosion.builder()
            .from(old)
            .shouldBreakBlocks(config.BREAK_BLOCKS)
            .shouldPlaySmoke(config.SHOW_PARTICLES)
            .sourceExplosive(null) //Do not check for a creeper in next Event listener Iteration
            .build();

    //Cancel default event...
    event.setCancelled(true);
    //...but trigger new event
    Cause genericCause = Cause.of(NamedCause.owner(container));
    newExplosion.getWorld().triggerExplosion(newExplosion, genericCause);

    //Remove the creeper (as the default event is canceled);
    ((Creeper) event.getCause().root()).remove();
}
 
开发者ID:Felfio,项目名称:treepers-sponge,代码行数:20,代码来源:Treepers.java

示例4: ClanCreateEvent

import org.spongepowered.api.event.cause.Cause; //导入方法依赖的package包/类
public ClanCreateEvent(String clanTag, String clanName, ClanPlayer owner) {
    super("Clan creation cancelled by an external plugin", Cause.of(NamedCause.owner(owner)));

    this.clanTag = clanTag;
    this.clanName = clanName;
    this.owner = owner;
}
 
开发者ID:iLefty,项目名称:mcClans,代码行数:8,代码来源:ClanCreateEvent.java

示例5: commandSuicide

import org.spongepowered.api.event.cause.Cause; //导入方法依赖的package包/类
private CompletableFuture<Boolean> commandSuicide(final EPlayer player) {
	// Event cancel
	if(!player.setHealth(0)) {
		EEMessages.SUICIDE_CANCEL.sender()
			.replace("{player}", player.getName())
			.sendTo(player);
		return CompletableFuture.completedFuture(false);
	}
	
	final MessageEvent.MessageFormatter formatter = new MessageEvent.MessageFormatter();
       MessageChannel originalChannel;
       MessageChannel channel;
       boolean messageCancelled = false;

       originalChannel = player.getMessageChannel();
       channel = player.getMessageChannel();

       messageCancelled = !EEMessages.SUICIDE_DEATH_MESSAGE.getMessage().getChat().isPresent();
       
       formatter.getBody().add(new MessageEvent.DefaultBodyApplier(EEMessages.SUICIDE_DEATH_MESSAGE.getFormat().toText(player.getReplaces())));
       
       List<NamedCause> causes = new ArrayList<NamedCause>();
       causes.add(NamedCause.of("Command", "kill"));
       causes.add(NamedCause.owner(player));
       Cause cause = Cause.of(causes);
       
       DestructEntityEvent.Death event = SpongeEventFactory.createDestructEntityEventDeath(cause, originalChannel, Optional.of(channel), formatter, player, messageCancelled);
       this.plugin.getGame().getEventManager().post(event);

   	if (!event.isMessageCancelled() && !event.getMessage().isEmpty()) {
   		event.getChannel().ifPresent(eventChannel -> eventChannel.send(player, event.getMessage()));
   	} else {
   		EEMessages.SUICIDE_PLAYER.sender()
   			.replace("{player}", player.getName())
   			.sendTo(player);
   	}
   	return CompletableFuture.completedFuture(true);
}
 
开发者ID:EverCraft,项目名称:EverEssentials,代码行数:39,代码来源:EESuicide.java

示例6: BlockOperation

import org.spongepowered.api.event.cause.Cause; //导入方法依赖的package包/类
public BlockOperation(ICachedWorld world, Vector3i min, Vector3i max) {
    super(null);

    this.blockService = WebAPI.getBlockService();
    this.uuid = UUID.randomUUID();
    this.world = world;
    this.min = min;
    this.max = max;
    this.size = max.sub(min).add(1, 1, 1);
    this.cause = Cause.of(EventContext.empty(), WebAPI.getContainer());
    this.totalBlocks = size.getX() * size.getY() * size.getZ();
}
 
开发者ID:Valandur,项目名称:Web-API,代码行数:13,代码来源:BlockOperation.java

示例7: ClanPlayerKillEvent

import org.spongepowered.api.event.cause.Cause; //导入方法依赖的package包/类
public ClanPlayerKillEvent(ClanPlayerImpl killer, ClanPlayerImpl victim) {
    super(Cause.of(NamedCause.source(killer)));
    this.killer = killer;
    this.victim = victim;
}
 
开发者ID:iLefty,项目名称:mcClans,代码行数:6,代码来源:ClanPlayerKillEvent.java

示例8: ClanDisbandEvent

import org.spongepowered.api.event.cause.Cause; //导入方法依赖的package包/类
private ClanDisbandEvent(Clan clan) {
    super("Clan disband cancelled by an external plugin", Cause.of(NamedCause.owner(clan.getOwner())));
    this.clan = clan;
}
 
开发者ID:iLefty,项目名称:mcClans,代码行数:5,代码来源:ClanDisbandEvent.java

示例9: ClanMemberLeaveEvent

import org.spongepowered.api.event.cause.Cause; //导入方法依赖的package包/类
private ClanMemberLeaveEvent(Clan clan, ClanPlayer clanMember) {
    super("Member leaving the clan cancelled by an external plugin", Cause.of(NamedCause.source(clanMember)));
    this.clan = clan;
    this.clanMember = clanMember;
}
 
开发者ID:iLefty,项目名称:mcClans,代码行数:6,代码来源:ClanMemberLeaveEvent.java

示例10: ClanOwnerChangeEvent

import org.spongepowered.api.event.cause.Cause; //导入方法依赖的package包/类
private ClanOwnerChangeEvent(Clan clan, ClanPlayer previousOwner, ClanPlayer newOwner) {
    super("Clan owner change cancelled by an external plugin", Cause.of(NamedCause.owner(newOwner)));
    this.clan = clan;
    this.previousOwner = previousOwner;
    this.newOwner = newOwner;
}
 
开发者ID:iLefty,项目名称:mcClans,代码行数:7,代码来源:ClanOwnerChangeEvent.java

示例11: ClanHomeTeleportEvent

import org.spongepowered.api.event.cause.Cause; //导入方法依赖的package包/类
public ClanHomeTeleportEvent(Clan clan, ClanPlayer clanPlayer) {
    super("Clan home teleport cancelled by an external plugin", Cause.of(NamedCause.owner(clanPlayer)));
    this.clan = clan;
    this.clanPlayer = clanPlayer;
}
 
开发者ID:iLefty,项目名称:mcClans,代码行数:6,代码来源:ClanHomeTeleportEvent.java

示例12: User

import org.spongepowered.api.event.cause.Cause; //导入方法依赖的package包/类
public User(ClanPlayer clanPlayer, Clan clan, Location<World> location) {
    super(Cause.of(NamedCause.source(clanPlayer)), clan, location);

    this.clanPlayer = clanPlayer;
}
 
开发者ID:iLefty,项目名称:mcClans,代码行数:6,代码来源:ClanSetHomeEvent.java

示例13: Admin

import org.spongepowered.api.event.cause.Cause; //导入方法依赖的package包/类
public Admin(CommandSource commandSource, Clan clan, Location<World> location) {
    super(Cause.of(NamedCause.source(commandSource)), clan, location);
}
 
开发者ID:iLefty,项目名称:mcClans,代码行数:4,代码来源:ClanSetHomeEvent.java

示例14: Plugin

import org.spongepowered.api.event.cause.Cause; //导入方法依赖的package包/类
public Plugin(Clan clan, Location<World> location) {
    super(Cause.of(NamedCause.source(location)), clan, location);
}
 
开发者ID:iLefty,项目名称:mcClans,代码行数:4,代码来源:ClanSetHomeEvent.java

示例15: ClanMemberJoinEvent

import org.spongepowered.api.event.cause.Cause; //导入方法依赖的package包/类
public ClanMemberJoinEvent(Clan clan, ClanPlayer clanMember) {
    super("Member joining the clan cancelled by an external plugin", Cause.of(NamedCause.source(clanMember)));
    this.clan = clan;
    this.clanMember = clanMember;
}
 
开发者ID:iLefty,项目名称:mcClans,代码行数:6,代码来源:ClanMemberJoinEvent.java


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