Merge pull request #155 from sekwah41/dev

Small tweaks to events
This commit is contained in:
sekwah41 2019-06-03 03:15:37 +01:00 committed by GitHub
commit 28ea9d1f8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 18 additions and 61 deletions

View File

@ -5,7 +5,10 @@ import com.sekwah.advancedportals.api.portaldata.PortalArg;
import com.sekwah.advancedportals.listeners.Listeners;
import com.sekwah.advancedportals.portals.AdvancedPortal;
import com.sekwah.advancedportals.portals.Portal;
import org.bukkit.*;
import org.bukkit.DyeColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;

View File

@ -10,8 +10,6 @@ import com.sekwah.advancedportals.portals.Portal;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.*;
public class AdvancedPortalsPlugin extends JavaPlugin {
public CraftBukkit compat = null;

View File

@ -4,13 +4,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
/**
* Created by on 29/03/2016.
* <p>
* TODO add all the normal tags then add the extradata tags
*
* @author sekwah41
*/
public class PortalTags {
// TODO create a list or hashmap of tags to check for.

View File

@ -7,11 +7,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
/**
* Created by on 25/07/2016.
*
* @author sekwah41
*/
public class TagRegistry {
private final AdvancedPortalsPlugin plugin;

View File

@ -2,11 +2,6 @@ package com.sekwah.advancedportals.api.warphandler;
import com.sekwah.advancedportals.portals.Portal;
/**
* Created by on 30/07/2016.
*
* @author sekwah41
*/
public class ActivationData {
private boolean warpAllowed = true;

View File

@ -2,11 +2,6 @@ package com.sekwah.advancedportals.api.warphandler;
import org.bukkit.entity.Player;
/**
* Created by on 30/07/2016.
*
* @author sekwah41
*/
public class TagHandler {
public interface Creation{

View File

@ -2,8 +2,6 @@ package com.sekwah.advancedportals.compat;
import com.sekwah.advancedportals.AdvancedPortalsPlugin;
import com.sekwah.advancedportals.reflection.ReflectionHelper;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import java.lang.reflect.Constructor;
@ -11,14 +9,6 @@ import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/**
* Created by on 02/08/2016.
*
* I don't think there will be any others supported other than bukkit but if there are its not just the compat that will
* need to change unless it has a different package for the minecraft server parts
*
* @author sekwah41 maxqia
*/
public class CraftBukkit {
private final AdvancedPortalsPlugin plugin;

View File

@ -1,12 +1,5 @@
package com.sekwah.advancedportals.destinations;
/**
* Created by on 04/08/2016.
*
* TODO load the destinations into memory rather than constantly reading from the yml.
*
* @author sekwah41
*/
public class PortalWarp {
}

View File

@ -6,11 +6,6 @@ import com.sekwah.advancedportals.AdvancedPortalsPlugin;
import org.bukkit.entity.Player;
import org.bukkit.plugin.messaging.PluginMessageListener;
/**
* Created by on 29/03/2016.
*
* @author sekwah41
*/
public class BungeeListener implements PluginMessageListener {
private AdvancedPortalsPlugin plugin;

View File

@ -71,19 +71,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 +93,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 +172,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 +205,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

View File

@ -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;

View File

@ -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;

View File

@ -4,7 +4,10 @@ import com.sekwah.advancedportals.api.portaldata.PortalArg;
import org.bukkit.Location;
import org.bukkit.Material;
import java.util.*;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
public class AdvancedPortal {