Added support for most protection plugins.

This commit is contained in:
songoda 2019-06-22 05:15:24 -04:00
parent 8775e9e370
commit d254b491bc
9 changed files with 21 additions and 14 deletions

View File

@ -4,7 +4,7 @@ stages:
variables:
name: "UltimateStacker"
path: "/builds/$CI_PROJECT_PATH"
version: "1.5"
version: "1.5.1"
build:
stage: build

View File

@ -35,7 +35,7 @@ public class BlockListeners implements Listener {
this.instance = instance;
}
@EventHandler
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onSpawnerInteract(PlayerInteractEvent event) {
Block block = event.getClickedBlock();
Player player = event.getPlayer();
@ -104,7 +104,7 @@ public class BlockListeners implements Listener {
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(instance, () -> instance.getHologram().processChange(block), 10L);
}
@EventHandler
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onSpawnerPlace(BlockPlaceEvent event) {
Block block = event.getBlock();
Player player = event.getPlayer();
@ -138,7 +138,7 @@ public class BlockListeners implements Listener {
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(instance, () -> instance.getHologram().processChange(block), 1L);
}
@EventHandler(priority = EventPriority.HIGHEST)
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onBlockBreak(BlockBreakEvent event) {
Block block = event.getBlock();
if (block.getType() != (instance.isServerVersionAtLeast(ServerVersion.V1_13) ? Material.SPAWNER : Material.valueOf("MOB_SPAWNER"))) return;

View File

@ -3,6 +3,7 @@ package com.songoda.ultimatestacker.listeners;
import com.songoda.ultimatestacker.UltimateStacker;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityBreedEvent;
import org.bukkit.metadata.FixedMetadataValue;
@ -15,7 +16,7 @@ public class BreedListeners implements Listener {
this.instance = instance;
}
@EventHandler
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onBread(EntityBreedEvent event) {
Bukkit.getScheduler().scheduleSyncDelayedTask(instance, () -> {
event.getFather().removeMetadata("breedCooldown", instance);

View File

@ -35,7 +35,7 @@ public class EntityListeners implements Listener {
this.instance = instance;
}
@EventHandler
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onSpawn(CreatureSpawnEvent event) {
LivingEntity entity = event.getEntity();
entity.setMetadata("US_REASON", new FixedMetadataValue(instance, event.getSpawnReason().name()));
@ -49,7 +49,7 @@ public class EntityListeners implements Listener {
}
@EventHandler
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onEgg(ItemSpawnEvent event) {
if (event.getEntity().getItemStack().getType() != Material.EGG) return;

View File

@ -10,6 +10,7 @@ import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.*;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.SheepDyeWoolEvent;
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
@ -27,7 +28,7 @@ public class InteractListeners implements Listener {
this.instance = instance;
}
@EventHandler
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onInteract(PlayerInteractAtEntityEvent event) {
if (!(event.getRightClicked() instanceof LivingEntity)) return;
Player player = event.getPlayer();

View File

@ -8,6 +8,7 @@ import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Item;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.ItemMergeEvent;
import org.bukkit.event.entity.ItemSpawnEvent;
@ -49,21 +50,22 @@ public class ItemListeners implements Listener {
updateAmount(item, newAmount);
event.getEntity().remove();
}
@EventHandler
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onInvPickup(InventoryPickupItemEvent event) {
event.setCancelled(true);
updateInventory(event.getItem(), event.getInventory());
}
@EventHandler
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onDispense(ItemSpawnEvent event) {
if (!Setting.STACK_ITEMS.getBoolean()) return;
updateAmount(event.getEntity(), event.getEntity().getItemStack().getAmount());
}
@EventHandler
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onPickup(PlayerPickupItemEvent event) {
if (event.getItem().getItemStack().getAmount() < 32) return;
event.setCancelled(true);

View File

@ -11,6 +11,7 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerShearEntityEvent;
import org.bukkit.util.Vector;
@ -25,7 +26,7 @@ public class ShearListeners implements Listener {
this.instance = instance;
}
@EventHandler
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onShear(PlayerShearEntityEvent event) {
Entity entity = event.getEntity();

View File

@ -9,6 +9,7 @@ import com.songoda.ultimatestacker.utils.settings.Setting;
import org.bukkit.Material;
import org.bukkit.entity.*;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.SheepDyeWoolEvent;
import org.bukkit.event.player.PlayerShearEntityEvent;
@ -26,7 +27,7 @@ public class SheepDyeListeners implements Listener {
this.instance = instance;
}
@EventHandler
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onDye(SheepDyeWoolEvent event) {
LivingEntity entity = event.getEntity();

View File

@ -8,6 +8,7 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Tameable;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityTameEvent;
import org.bukkit.util.Vector;
@ -22,7 +23,7 @@ public class TameListeners implements Listener {
this.instance = instance;
}
@EventHandler
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onTame(EntityTameEvent event) {
Entity entity = event.getEntity();