本文整理了Java中org.spongepowered.api.event.Listener.<init>()
方法的一些代码示例,展示了Listener.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Listener.<init>()
方法的具体详情如下:
包路径:org.spongepowered.api.event.Listener
类名称:Listener
方法名:<init>
暂无
代码示例来源:origin: EngineHub/WorldEdit
@Listener
public void postInit(GamePostInitializationEvent event) {
logger.info("WorldEdit for Sponge (version " + getInternalVersion() + ") is loaded");
}
代码示例来源:origin: EngineHub/WorldEdit
@Listener
public void init(GameInitializationEvent event) {
CUIChannelHandler.init();
}
代码示例来源:origin: EngineHub/WorldEdit
@Listener
public void serverStopping(GameStoppingServerEvent event) {
WorldEdit worldEdit = WorldEdit.getInstance();
worldEdit.getSessionManager().unload();
worldEdit.getPlatformManager().unregister(platform);
}
代码示例来源:origin: EngineHub/WorldEdit
@Listener
public void serverStarted(GameStartedServerEvent event) {
WorldEdit.getInstance().getEventBus().post(new PlatformReadyEvent());
loadAdapter();
}
代码示例来源:origin: EngineHub/WorldEdit
@Listener
public void preInit(GamePreInitializationEvent event) {
// Load configuration
config.load();
Task.builder().interval(30, TimeUnit.SECONDS).execute(ThreadSafeCache.getInstance()).submit(this);
}
代码示例来源:origin: EngineHub/WorldEdit
@Listener
public void serverAboutToStart(GameAboutToStartServerEvent event) {
if (this.platform != null) {
logger.warn("GameAboutToStartServerEvent occurred when GameStoppingServerEvent hasn't");
WorldEdit.getInstance().getPlatformManager().unregister(platform);
}
this.platform = new SpongePlatform(this);
this.provider = new SpongePermissionsProvider();
for (BlockType blockType : Sponge.getRegistry().getAllOf(BlockType.class)) {
// TODO Handle blockstate stuff
String id = blockType.getId();
if (!com.sk89q.worldedit.world.block.BlockType.REGISTRY.keySet().contains(id)) {
com.sk89q.worldedit.world.block.BlockTypes.register(new com.sk89q.worldedit.world.block.BlockType(id));
}
}
for (ItemType itemType : Sponge.getRegistry().getAllOf(ItemType.class)) {
String id = itemType.getId();
if (!com.sk89q.worldedit.world.item.ItemType.REGISTRY.keySet().contains(id)) {
ItemTypes.register(new com.sk89q.worldedit.world.item.ItemType(id));
}
}
WorldEdit.getInstance().getPlatformManager().register(platform);
}
代码示例来源:origin: EngineHub/WorldEdit
@Listener
public void onPlayerInteract(InteractBlockEvent event, @Root Player spongePlayer) {
if (platform == null) {
代码示例来源:origin: PEXPlugins/PermissionsEx
@Listener
public void onReload(GameReloadEvent event) {
if (this.manager != null) {
this.manager.reload();
}
}
代码示例来源:origin: MylesIsCool/ViaVersion
@Listener
public void onServerStart(GameAboutToStartServerEvent event) {
// Inject!
logger.info("ViaVersion is injecting!");
Via.getManager().init();
}
代码示例来源:origin: EngineHub/CraftBook
@Listener
public void onBlockUpdate(NotifyNeighborBlockEvent event, @First LocatableBlock source) {
event.getNeighbors().entrySet().stream()
.map((directionBlockStateEntry -> source.getLocation().getRelative(directionBlockStateEntry.getKey())))
.forEach(this::checkForPhysics);
}
代码示例来源:origin: EngineHub/CraftBook
@Listener
public void onServerStopping(GameStoppingServerEvent event) {
saveConfig();
disableMechanics();
}
代码示例来源:origin: EngineHub/CraftBook
@Listener
public void onBlockBreak(ChangeBlockEvent.Break event) {
event.getTransactions().stream().map(transaction -> transaction.getOriginal().getLocation().get()).forEach(location -> {
if (loadedICs.containsKey(location)) {
IC ic = loadedICs.remove(location);
ic.unload();
if (ic instanceof SelfTriggeringIC) {
((SpongeSelfTriggerManager) CraftBookPlugin.inst().getSelfTriggerManager().get()).unregister(this, location);
}
}
});
}
代码示例来源:origin: PEXPlugins/PermissionsEx
@Listener
public void disable(GameStoppedServerEvent event) {
logger.debug(t("Disabling %s", PomData.NAME));
PermissionsEx manager = this.manager;
if (manager != null) {
manager.close();
}
}
代码示例来源:origin: EngineHub/CraftBook
@Listener
public void onVehicleCollide(CollideEntityEvent event, @First ChestMinecart chestMinecart) {
event.getEntities().stream().filter(entity -> entity.getType() == EntityTypes.ITEM).filter(item -> !item.isRemoved()).forEach(item -> {
Collection<ItemStackSnapshot> rejects = chestMinecart.getInventory().offer(item.get(Keys.REPRESENTED_ITEM).get().createStack()).getRejectedItems();
if (rejects.isEmpty()) {
item.remove();
}
});
}
代码示例来源:origin: MylesIsCool/ViaVersion
@Listener
public void onInteract(InteractEvent event, @Root Player player) {
if (player.getItemInHand(HandTypes.MAIN_HAND).isPresent()) {
if (ArmorType.isArmor(player.getItemInHand(HandTypes.MAIN_HAND).get().getItem().getId()))
sendDelayedArmorUpdate(player);
}
}
代码示例来源:origin: PEXPlugins/PermissionsEx
@Listener
public void cacheUserAsync(ClientConnectionEvent.Auth event) {
try {
getManager().getSubjects(PermissionsEx.SUBJECTS_USER).get(event.getProfile().getUniqueId().toString());
} catch (Exception e) {
logger.warn(t("Error while loading data for user %s/%s during prelogin: %s", event.getProfile().getName(), event.getProfile().getUniqueId().toString(), e.getMessage()), e);
}
}
代码示例来源:origin: EngineHub/CraftBook
@Listener
public void onChangeBlock(ChangeBlockEvent event, @First LocatableBlock dispenser) {
if (dispenser.getBlockState().getType() != BlockTypes.DISPENSER) {
return;
}
Dispenser dispenserTile = (Dispenser) dispenser.getLocation().getTileEntity().get();
if (handleDispenserAction(dispenserTile)) {
event.setCancelled(true);
}
}
代码示例来源:origin: MylesIsCool/ViaVersion
@Listener
public void onWorldChange(MoveEntityEvent.Teleport e) {
if (!(e.getTargetEntity() instanceof Player)) return;
if (!e.getFromTransform().getExtent().getUniqueId().equals(e.getToTransform().getExtent().getUniqueId())) {
sendArmorUpdate((Player) e.getTargetEntity());
}
}
代码示例来源:origin: MylesIsCool/ViaVersion
@Listener
public void onWorldChange(DisplaceEntityEvent.Teleport e) {
if (!(e.getTargetEntity() instanceof Player)) return;
if (!e.getFromTransform().getExtent().getUniqueId().equals(e.getToTransform().getExtent().getUniqueId())) {
sendArmorUpdate((Player) e.getTargetEntity());
}
}
代码示例来源:origin: EngineHub/CraftBook
@Listener
public void onBlockUpdate(NotifyNeighborBlockEvent event, @First LocatableBlock source) {
if(isValid(source.getLocation())) {
PoweredProperty poweredProperty = source.getLocation().getProperty(PoweredProperty.class).orElse(null);
if(poweredProperty.getValue() != null && poweredProperty.getValue())
performPipeAction(source.getLocation());
}
}
内容来源于网络,如有侵权,请联系作者删除!