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


Java PortalCreateEvent类代码示例

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


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

示例1: onPortalCreateEvent

import org.bukkit.event.world.PortalCreateEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPortalCreateEvent(PortalCreateEvent event)
{
	for(Block block : event.getBlocks())
	{
		//Unable to get the player who created it....
		
		ApplicableRegionSet regions = WorldGuardExtraFlagsPlugin.getWorldGuardPlugin().getRegionContainer().createQuery().getApplicableRegions(block.getLocation());
		if (regions.queryValue(null, FlagUtils.NETHER_PORTALS) == State.DENY)
		{
			event.setCancelled(true);
			break;
		}
	}
}
 
开发者ID:isokissa3,项目名称:WorldGuardExtraFlagsPlugin,代码行数:16,代码来源:EntityListener.java

示例2: onPortalCreation

import org.bukkit.event.world.PortalCreateEvent; //导入依赖的package包/类
@HookHandler(priority = Priority.CRITICAL, ignoreCanceled = true)
public void onPortalCreation(final PortalCreateHook hook) {
    PortalCreateEvent event = new PortalCreateEvent(null, new CanaryWorld(hook.getWorld()), null);
    event.setCancelled(hook.isCanceled());
    server.getPluginManager().callEvent(event);
    if (event.isCancelled()) {
        hook.setCanceled();
    }
}
 
开发者ID:CanaryBukkitTeam,项目名称:CanaryBukkit,代码行数:10,代码来源:CanaryWorldListener.java

示例3: onPortalCreate

import org.bukkit.event.world.PortalCreateEvent; //导入依赖的package包/类
@EventHandler
public void onPortalCreate(PortalCreateEvent e){   
	List<Block> blocks = e.getBlocks();
	for (Block b:blocks){
		Region r = RedProtect.get().rm.getTopRegion(b.getLocation());
		if (r != null && !r.canCreatePortal()){
			e.setCancelled(true);
			break;
		}
	}    	
}
 
开发者ID:FabioZumbi12,项目名称:RedProtect,代码行数:12,代码来源:RPPlayerListener.java

示例4: getEventClassAssociations

import org.bukkit.event.world.PortalCreateEvent; //导入依赖的package包/类
private static HashMap<String, Class> getEventClassAssociations()
	{
		HashMap<String, Class> classHashMap = new HashMap<String, Class>();
		classHashMap.put("block-break", BlockBreakEvent.class);
		classHashMap.put("block-place", BlockPlaceEvent.class);

//		classHashMap.put("entity-leash", PlayerLeashEntityEvent.class);
		classHashMap.put("entity-kill", EntityDeathEvent.class);
		classHashMap.put("entity-shear", PlayerShearEntityEvent.class);

		classHashMap.put("item-brew", BrewEvent.class);
		classHashMap.put("item-enchant", EnchantItemEvent.class);
		classHashMap.put("item-furnace", FurnaceExtractEvent.class);

		classHashMap.put("painting-create", HangingPlaceEvent.class);

		classHashMap.put("player-regenerate", EntityRegainHealthEvent.class);
		classHashMap.put("player-shoot", EntityShootBowEvent.class);
		classHashMap.put("player-chat", AsyncPlayerChatEvent.class);
		classHashMap.put("player-death", PlayerDeathEvent.class);
		classHashMap.put("player-sleep", PlayerBedEnterEvent.class);
		classHashMap.put("player-author", PlayerEditBookEvent.class);
		classHashMap.put("player-egg", PlayerEggThrowEvent.class);
		classHashMap.put("player-fish", PlayerFishEvent.class);
		classHashMap.put("player-eat", PlayerItemConsumeEvent.class);
		classHashMap.put("player-join", PlayerJoinEvent.class);
		classHashMap.put("player-move", PlayerMoveEvent.class);

		classHashMap.put("portal-create", PortalCreateEvent.class);

		classHashMap.put("vehicle-move", VehicleMoveEvent.class);

		classHashMap.put("world-change", PlayerChangedWorldEvent.class);

		return classHashMap;
	}
 
开发者ID:BitLimit,项目名称:Bits,代码行数:37,代码来源:ConfigurationManager.java

示例5: onCreatePortal

import org.bukkit.event.world.PortalCreateEvent; //导入依赖的package包/类
@EventHandler
public void onCreatePortal(PortalCreateEvent e) {
	Block block = e.getBlocks().get(0);
	Player p = ExtractPlayerFromLocation(block.getLocation());
	if(p instanceof Player) {
		if(!p.hasPermission(PermissionKey.IS_ADMIN.getPermission())) {
			e.setCancelled(true);
			sendMessage(p, ChatColor.RED + "portal creation has been disabled on the server!");
		}
	}
}
 
开发者ID:xEssentials,项目名称:xEssentials-deprecated-bukkit,代码行数:12,代码来源:DisablePortalCreationEvent.java

示例6: onPortalCreate

import org.bukkit.event.world.PortalCreateEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPortalCreate(final PortalCreateEvent event) {
    cancelAlways(event, event.getWorld());
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:5,代码来源:EventFilterMatchModule.java

示例7: onPortalCreate

import org.bukkit.event.world.PortalCreateEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPortalCreate(PortalCreateEvent event) {
    event.setCancelled(true);
}
 
开发者ID:ShootGame,项目名称:Arcade2,代码行数:5,代码来源:GeneralListeners.java

示例8: onPortalCreate

import org.bukkit.event.world.PortalCreateEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST) 
public void onPortalCreate(PortalCreateEvent event) {
	event.setCancelled(true);
}
 
开发者ID:netizen539,项目名称:civcraft,代码行数:5,代码来源:PlayerListener.java

示例9: o_

import org.bukkit.event.world.PortalCreateEvent; //导入依赖的package包/类
public boolean o_(World world, int i, int j, int k) {
    byte b0 = 0;
    byte b1 = 0;

    if (world.getTypeId(i - 1, j, k) == Block.OBSIDIAN.id || world.getTypeId(i + 1, j, k) == Block.OBSIDIAN.id) {
        b0 = 1;
    }

    if (world.getTypeId(i, j, k - 1) == Block.OBSIDIAN.id || world.getTypeId(i, j, k + 1) == Block.OBSIDIAN.id) {
        b1 = 1;
    }

    if (b0 == b1) {
        return false;
    } else {
        // CraftBukkit start
        java.util.Collection<org.bukkit.block.Block> blocks = new java.util.HashSet<org.bukkit.block.Block>();
        org.bukkit.World bworld = world.getWorld();
        // CraftBukkit end

        if (world.getTypeId(i - b0, j, k - b1) == 0) {
            i -= b0;
            k -= b1;
        }

        int l;
        int i1;

        for (l = -1; l <= 2; ++l) {
            for (i1 = -1; i1 <= 3; ++i1) {
                boolean flag = l == -1 || l == 2 || i1 == -1 || i1 == 3;

                if (l != -1 && l != 2 || i1 != -1 && i1 != 3) {
                    int j1 = world.getTypeId(i + b0 * l, j + i1, k + b1 * l);

                    if (flag) {
                        if (j1 != Block.OBSIDIAN.id) {
                            return false;
                        } else { // CraftBukkit
                            blocks.add(bworld.getBlockAt(i + b0 * l, j + i1, k + b1 * l)); // CraftBukkit
                        }
                    } else if (j1 != 0 && j1 != Block.FIRE.id) {
                        return false;
                    }
                }
            }
        }

        // CraftBukkit start
        for (l = 0; l < 2; ++l) {
            for (i1 = 0; i1 < 3; ++i1) {
                blocks.add(bworld.getBlockAt(i + b0 * l, j + i1, k + b1 * l));
            }
        }

        PortalCreateEvent event = new PortalCreateEvent(blocks, bworld, PortalCreateEvent.CreateReason.FIRE);
        world.getServer().getPluginManager().callEvent(event);

        if (event.isCancelled()) {
            return false;
        }
        // CraftBukkit end

        for (l = 0; l < 2; ++l) {
            for (i1 = 0; i1 < 3; ++i1) {
                world.setTypeIdAndData(i + b0 * l, j + i1, k + b1 * l, Block.PORTAL.id, 0, 2);
            }
        }

        return true;
    }
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:73,代码来源:BlockPortal.java

示例10: PortalCreateEvent

import org.bukkit.event.world.PortalCreateEvent; //导入依赖的package包/类
public PortalCreateEvent(Collection<Block> blocks, World world, PortalCreateEvent.CreateReason reason) {
       super(world);
}
 
开发者ID:deathcap,项目名称:BedrockAPI,代码行数:4,代码来源:PortalCreateEvent.java

示例11: getReason

import org.bukkit.event.world.PortalCreateEvent; //导入依赖的package包/类
public PortalCreateEvent.CreateReason getReason() {
	return null;
}
 
开发者ID:deathcap,项目名称:BedrockAPI,代码行数:4,代码来源:PortalCreateEvent.java

示例12: PortalSizeCheck

import org.bukkit.event.world.PortalCreateEvent; //导入依赖的package包/类
@EventHandler
public void PortalSizeCheck(PortalCreateEvent e) {
	if(e.getBlocks().size() > 6) {
		e.setCancelled(true);
	}
}
 
开发者ID:xEssentials,项目名称:xEssentials-deprecated-bukkit,代码行数:7,代码来源:PortalSizeEvent.java

示例13: n_

import org.bukkit.event.world.PortalCreateEvent; //导入依赖的package包/类
public boolean n_(World world, int i, int j, int k) {
    byte b0 = 0;
    byte b1 = 0;

    if (world.getTypeId(i - 1, j, k) == Block.OBSIDIAN.id || world.getTypeId(i + 1, j, k) == Block.OBSIDIAN.id) {
        b0 = 1;
    }

    if (world.getTypeId(i, j, k - 1) == Block.OBSIDIAN.id || world.getTypeId(i, j, k + 1) == Block.OBSIDIAN.id) {
        b1 = 1;
    }

    if (b0 == b1) {
        return false;
    } else {
        // CraftBukkit start
        java.util.Collection<org.bukkit.block.Block> blocks = new java.util.HashSet<org.bukkit.block.Block>();
        org.bukkit.World bworld = world.getWorld();
        // CraftBukkit end

        if (world.getTypeId(i - b0, j, k - b1) == 0) {
            i -= b0;
            k -= b1;
        }

        int l;
        int i1;

        for (l = -1; l <= 2; ++l) {
            for (i1 = -1; i1 <= 3; ++i1) {
                boolean flag = l == -1 || l == 2 || i1 == -1 || i1 == 3;

                if (l != -1 && l != 2 || i1 != -1 && i1 != 3) {
                    int j1 = world.getTypeId(i + b0 * l, j + i1, k + b1 * l);

                    if (flag) {
                        if (j1 != Block.OBSIDIAN.id) {
                            return false;
                        } else { // CraftBukkit
                            blocks.add(bworld.getBlockAt(i + b0 * l, j + i1, k + b1 * l)); // CraftBukkit
                        }
                    } else if (j1 != 0 && j1 != Block.FIRE.id) {
                        return false;
                    }
                }
            }
        }

        // CraftBukkit start
        for (l = 0; l < 2; ++l) {
            for (i1 = 0; i1 < 3; ++i1) {
                blocks.add(bworld.getBlockAt(i + b0 * l, j + i1, k + b1 * l));
            }
        }

        PortalCreateEvent event = new PortalCreateEvent(blocks, bworld, PortalCreateEvent.CreateReason.FIRE);
        world.getServer().getPluginManager().callEvent(event);

        if (event.isCancelled()) {
            return false;
        }
        // CraftBukkit end

        for (l = 0; l < 2; ++l) {
            for (i1 = 0; i1 < 3; ++i1) {
                world.setTypeIdAndData(i + b0 * l, j + i1, k + b1 * l, Block.PORTAL.id, 0, 2);
            }
        }

        return true;
    }
}
 
开发者ID:didoupimpon,项目名称:Craft-city,代码行数:73,代码来源:BlockPortal.java


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