mirror of
https://github.com/sekwah41/Advanced-Portals.git
synced 2024-11-21 18:16:03 +01:00
commit
4392d60b26
@ -6,7 +6,11 @@ import com.sekwah.advancedportals.PluginMessages;
|
||||
import com.sekwah.advancedportals.api.events.WarpEvent;
|
||||
import com.sekwah.advancedportals.portals.AdvancedPortal;
|
||||
import com.sekwah.advancedportals.portals.Portal;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.Axis;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.Orientable;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -71,19 +75,19 @@ public class Listeners implements Listener {
|
||||
Portal.cooldown.put(event.getPlayer().getName(), System.currentTimeMillis());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onTeleportEvent(PlayerTeleportEvent event) {
|
||||
Portal.cooldown.put(event.getPlayer().getName(), System.currentTimeMillis());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void spawnMobEvent(CreatureSpawnEvent event) {
|
||||
if(event.getSpawnReason() == CreatureSpawnEvent.SpawnReason.NETHER_PORTAL && Portal.inPortalRegion(event.getLocation(), Portal.getPortalProtectionRadius())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onLeaveEvent(PlayerQuitEvent event) {
|
||||
Portal.cooldown.remove(event.getPlayer().getName());
|
||||
|
||||
@ -93,7 +97,7 @@ public class Listeners implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onMoveEvent(PlayerMoveEvent event) {
|
||||
// will check if the player is in the portal or not.
|
||||
if (!Portal.portalsActive || event.isCancelled()) {
|
||||
@ -172,22 +176,22 @@ public class Listeners implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onCombustEntityEvent(EntityCombustEvent event) {
|
||||
if (Portal.inPortalTriggerRegion(event.getEntity().getLocation()))
|
||||
if (event.getEntity() instanceof Player && Portal.inPortalTriggerRegion(event.getEntity().getLocation()))
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onDamEvent(EntityDamageEvent event) {
|
||||
if (event.getCause() == EntityDamageEvent.DamageCause.LAVA || event.getCause() == EntityDamageEvent.DamageCause.FIRE || event.getCause() == EntityDamageEvent.DamageCause.FIRE_TICK) {
|
||||
if (event.getEntity() instanceof Player && (event.getCause() == EntityDamageEvent.DamageCause.LAVA || event.getCause() == EntityDamageEvent.DamageCause.FIRE || event.getCause() == EntityDamageEvent.DamageCause.FIRE_TICK)) {
|
||||
if (event.getEntity().hasMetadata("lavaWarped") | Portal.inPortalTriggerRegion(event.getEntity().getLocation()))
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onPortalEvent(PlayerPortalEvent event) {
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
@ -205,7 +209,7 @@ public class Listeners implements Listener {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onItemInteract(PlayerInteractEvent event) {
|
||||
|
||||
// will detect if the player is using an axe so the points of a portal can be set
|
||||
|
@ -3,10 +3,8 @@ package com.sekwah.advancedportals.listeners;
|
||||
import com.sekwah.advancedportals.AdvancedPortalsPlugin;
|
||||
import com.sekwah.advancedportals.ConfigAccessor;
|
||||
import com.sekwah.advancedportals.portals.Portal;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
|
@ -4,7 +4,6 @@ import com.sekwah.advancedportals.AdvancedPortalsPlugin;
|
||||
import com.sekwah.advancedportals.ConfigAccessor;
|
||||
import com.sekwah.advancedportals.PluginMessages;
|
||||
import com.sekwah.advancedportals.portals.Portal;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
@ -8,7 +8,13 @@ import com.sekwah.advancedportals.PluginMessages;
|
||||
import com.sekwah.advancedportals.api.portaldata.PortalArg;
|
||||
import com.sekwah.advancedportals.destinations.Destination;
|
||||
import com.sekwah.advancedportals.effects.WarpEffects;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.PermissionAttachment;
|
||||
|
Loading…
Reference in New Issue
Block a user