本文整理汇总了Java中org.bukkit.event.world.PortalCreateEvent.setCancelled方法的典型用法代码示例。如果您正苦于以下问题:Java PortalCreateEvent.setCancelled方法的具体用法?Java PortalCreateEvent.setCancelled怎么用?Java PortalCreateEvent.setCancelled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.event.world.PortalCreateEvent
的用法示例。
在下文中一共展示了PortalCreateEvent.setCancelled方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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!");
}
}
}
示例2: 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;
}
}
}
示例3: 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();
}
}
示例4: 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;
}
}
}
示例5: onPortalCreate
import org.bukkit.event.world.PortalCreateEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPortalCreate(PortalCreateEvent event) {
event.setCancelled(true);
}
示例6: onPortalCreate
import org.bukkit.event.world.PortalCreateEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST)
public void onPortalCreate(PortalCreateEvent event) {
event.setCancelled(true);
}
示例7: PortalSizeCheck
import org.bukkit.event.world.PortalCreateEvent; //导入方法依赖的package包/类
@EventHandler
public void PortalSizeCheck(PortalCreateEvent e) {
if(e.getBlocks().size() > 6) {
e.setCancelled(true);
}
}