本文整理汇总了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;
}
}
}
示例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();
}
}
示例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;
}
}
}
示例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;
}
示例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!");
}
}
}
示例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());
}
示例7: onPortalCreate
import org.bukkit.event.world.PortalCreateEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPortalCreate(PortalCreateEvent event) {
event.setCancelled(true);
}
示例8: onPortalCreate
import org.bukkit.event.world.PortalCreateEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST)
public void onPortalCreate(PortalCreateEvent event) {
event.setCancelled(true);
}
示例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;
}
}
示例10: PortalCreateEvent
import org.bukkit.event.world.PortalCreateEvent; //导入依赖的package包/类
public PortalCreateEvent(Collection<Block> blocks, World world, PortalCreateEvent.CreateReason reason) {
super(world);
}
示例11: getReason
import org.bukkit.event.world.PortalCreateEvent; //导入依赖的package包/类
public PortalCreateEvent.CreateReason getReason() {
return null;
}
示例12: PortalSizeCheck
import org.bukkit.event.world.PortalCreateEvent; //导入依赖的package包/类
@EventHandler
public void PortalSizeCheck(PortalCreateEvent e) {
if(e.getBlocks().size() > 6) {
e.setCancelled(true);
}
}
示例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;
}
}