mirror of
https://github.com/songoda/UltimateStacker.git
synced 2024-12-26 10:27:52 +01:00
Added support for most protection plugins.
This commit is contained in:
parent
8775e9e370
commit
d254b491bc
@ -4,7 +4,7 @@ stages:
|
||||
variables:
|
||||
name: "UltimateStacker"
|
||||
path: "/builds/$CI_PROJECT_PATH"
|
||||
version: "1.5"
|
||||
version: "1.5.1"
|
||||
|
||||
build:
|
||||
stage: build
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user