Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @EventHandler
- public void addPlayerToList(EntityDamageByEntityEvent e) {
- ApplicableRegionSet set = WGBukkit.getRegionManager(Bukkit.getWorld(Config.getWorld)).getApplicableRegions(e.getEntity().getLocation());
- if (!e.getEntity().getWorld().getName().equalsIgnoreCase(Config.getWorld)) return;
- if (e.getEntity().getType() != EntityType.PLAYER) return;
- if (e.getDamager().getType() != EntityType.PLAYER) return;
- if (e.getEntity().getLastDamageCause().getCause() != EntityDamageEvent.DamageCause.ENTITY_ATTACK) return;
- if (e.getDamager().getLastDamageCause().getCause() != EntityDamageEvent.DamageCause.ENTITY_ATTACK) return;
- Player damager = (Player) e.getEntity();
- Player attacker = (Player) e.getDamager();
- for (ProtectedRegion reg : set) {
- if (!reg.getId().equalsIgnoreCase(Config.getRegion)) return;
- if (!battle.containsKey(damager.getName())) for (String s : Config.addPlayerinList) {
- damager.sendMessage(C.c(s));
- }
- if (!battle.containsKey(attacker.getName())) for (String s : Config.addPlayerinList) {
- attacker.sendMessage(C.c(s));
- }
- battle.put(damager.getName(), Config.getTime);
- battle.put(attacker.getName(), Config.getTime);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement