Java Code Examples for br.net.fabiozumbi12.RedProtect.Bukkit.Region#canSkill()
The following examples show how to use
br.net.fabiozumbi12.RedProtect.Bukkit.Region#canSkill() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: McMMOHook.java From RedProtect with GNU General Public License v3.0 | 6 votes |
@EventHandler public void onPlayerExperience(McMMOPlayerXpGainEvent event) { if (event.isCancelled()) { return; } RedProtect.get().logger.debug(LogLevel.DEFAULT, "McMMO McMMOPlayerXpGainEvent event. Skill " + event.getSkill().name()); Player player = event.getPlayer(); Region region = RedProtect.get().rm.getTopRegion(player.getLocation()); if (region == null) { return; } if (!region.canSkill(player)) { event.setCancelled(true); } if (RedProtect.get().config.configRoot().hooks.mcmmo.fix_acrobatics_fire_leveling && event.getSkill().equals(PrimarySkillType.ACROBATICS) && (!region.canFire() || !region.canDeath())) { event.setCancelled(true); } }
Example 2
Source File: McMMOHook.java From RedProtect with GNU General Public License v3.0 | 6 votes |
@EventHandler public void onPlayerActivateSecAbility(SubSkillRandomCheckEvent e) { RedProtect.get().logger.debug(LogLevel.DEFAULT, "McMMO SubSkillRandomCheckEvent event."); Player p = e.getPlayer(); Region r = RedProtect.get().rm.getTopRegion(p.getLocation()); if (r == null) { return; } if (!r.canSkill(p)) { e.setCancelled(true); } if (!r.canPVP(p, null) && (e.getSkill().equals(PrimarySkillType.SWORDS) || e.getSkill().equals(PrimarySkillType.UNARMED) || e.getSkill().equals(PrimarySkillType.AXES))) { e.setCancelled(true); } }
Example 3
Source File: McMMOHook.java From RedProtect with GNU General Public License v3.0 | 6 votes |
@EventHandler public void onPlayerUnarmed(McMMOPlayerDisarmEvent e) { RedProtect.get().logger.debug(LogLevel.DEFAULT, "McMMO McMMOPlayerDisarmEvent event."); Player p = e.getPlayer(); Region r = RedProtect.get().rm.getTopRegion(e.getDefender().getLocation()); if (r == null) { return; } if (!r.canSkill(p)) { e.setCancelled(true); } if (!r.canPVP(p, e.getDefender()) && (e.getSkill().equals(PrimarySkillType.SWORDS) || e.getSkill().equals(PrimarySkillType.UNARMED) || e.getSkill().equals(PrimarySkillType.AXES))) { e.setCancelled(true); } }
Example 4
Source File: McMMOHook.java From RedProtect with GNU General Public License v3.0 | 6 votes |
@EventHandler public void onSecondaryAbilityEvent(SubSkillEvent e) { RedProtect.get().logger.debug(LogLevel.DEFAULT, "McMMO SecondaryAbilityEvent event."); Player p = e.getPlayer(); Region r = RedProtect.get().rm.getTopRegion(e.getPlayer().getLocation()); if (r == null) { return; } if (!r.canSkill(p)) { e.setCancelled(true); } if (!r.canPVP(p, null) && (e.getSkill().equals(PrimarySkillType.SWORDS) || e.getSkill().equals(PrimarySkillType.UNARMED) || e.getSkill().equals(PrimarySkillType.AXES))) { e.setCancelled(true); } }
Example 5
Source File: SkillAPIHook.java From RedProtect with GNU General Public License v3.0 | 5 votes |
@EventHandler public void onPlayerExperience(PlayerExperienceGainEvent e) { if (e.isCancelled()) { return; } RedProtect.get().logger.debug(LogLevel.DEFAULT, "SkillAPI PlayerExperienceGainEvent event."); Player p = e.getPlayerData().getPlayer(); Region r = RedProtect.get().rm.getTopRegion(p.getLocation()); if (r != null && !r.canSkill(p)) { e.setCancelled(true); } }
Example 6
Source File: SkillAPIHook.java From RedProtect with GNU General Public License v3.0 | 5 votes |
@EventHandler public void onPlayerSkillGain(PlayerGainSkillPointsEvent e) { if (e.isCancelled()) { return; } RedProtect.get().logger.debug(LogLevel.DEFAULT, "SkillAPI PlayerGainSkillPointsEvent event."); Player p = e.getPlayerData().getPlayer(); Region r = RedProtect.get().rm.getTopRegion(p.getLocation()); if (r != null && !r.canSkill(p)) { e.setCancelled(true); } }
Example 7
Source File: SkillAPIHook.java From RedProtect with GNU General Public License v3.0 | 5 votes |
@EventHandler public void onPlayerManaGain(PlayerManaGainEvent e) { if (e.isCancelled()) { return; } RedProtect.get().logger.debug(LogLevel.DEFAULT, "SkillAPI PlayerManaGainEvent event."); Player p = e.getPlayerData().getPlayer(); Region r = RedProtect.get().rm.getTopRegion(p.getLocation()); if (r != null && !r.canSkill(p)) { e.setCancelled(true); } }
Example 8
Source File: McMMOHook.java From RedProtect with GNU General Public License v3.0 | 5 votes |
@EventHandler public void onPlayerActivateAbility(McMMOPlayerAbilityActivateEvent e) { if (e.isCancelled()) { return; } RedProtect.get().logger.debug(LogLevel.DEFAULT, "McMMO McMMOPlayerAbilityActivateEvent event."); Player p = e.getPlayer(); //try to fix invisibility on bersek if (RedProtect.get().config.configRoot().hooks.mcmmo.fix_berserk_invisibility && e.getAbility().equals(SuperAbilityType.BERSERK)) { p.damage(0); for (Entity ent : p.getNearbyEntities(10, 10, 10)) { if (ent instanceof LivingEntity) { ((LivingEntity) ent).damage(0); } } } Region r = RedProtect.get().rm.getTopRegion(p.getLocation()); if (r == null) { return; } if (!r.canSkill(p)) { p.sendMessage(RedProtect.get().lang.get("mcmmolistener.notallowed")); e.setCancelled(true); } if (!r.canPVP(p, null) && (e.getSkill().equals(PrimarySkillType.SWORDS) || e.getSkill().equals(PrimarySkillType.UNARMED))) { e.setCancelled(true); } }