mirror of
https://github.com/songoda/UltimateStacker.git
synced 2025-01-29 10:41:25 +01:00
Merge branch 'development'
This commit is contained in:
commit
ca93964e37
@ -4,7 +4,7 @@ stages:
|
|||||||
variables:
|
variables:
|
||||||
name: "UltimateStacker"
|
name: "UltimateStacker"
|
||||||
path: "/builds/$CI_PROJECT_PATH"
|
path: "/builds/$CI_PROJECT_PATH"
|
||||||
version: "1.10.19"
|
version: "1.10.20"
|
||||||
|
|
||||||
build:
|
build:
|
||||||
stage: build
|
stage: build
|
||||||
|
@ -25,6 +25,7 @@ import org.bukkit.metadata.FixedMetadataValue;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class EntityListeners implements Listener {
|
public class EntityListeners implements Listener {
|
||||||
|
|
||||||
@ -50,11 +51,13 @@ public class EntityListeners implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||||
public void onEgg(ItemSpawnEvent event) {
|
public void onEgg(ItemSpawnEvent event) {
|
||||||
if (event.getEntity().getItemStack().getType() != Material.EGG) return;
|
Material material = event.getEntity().getItemStack().getType();
|
||||||
|
if (material != Material.EGG
|
||||||
|
&& !material.name().equalsIgnoreCase("SCUTE")) return;
|
||||||
|
|
||||||
Location location = event.getLocation();
|
Location location = event.getLocation();
|
||||||
|
|
||||||
List<Entity> entities = new ArrayList<>(location.getWorld().getNearbyEntities(location, .1, .5, .1));
|
List<Entity> entities = new ArrayList<>(location.getWorld().getNearbyEntities(location, .1, 1, .1));
|
||||||
|
|
||||||
if (entities.isEmpty()) return;
|
if (entities.isEmpty()) return;
|
||||||
|
|
||||||
|
@ -96,7 +96,8 @@ public class StackingTask extends BukkitRunnable {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Allow spawn if stackreasons are set and match, or if from a spawner
|
// Allow spawn if stackreasons are set and match, or if from a spawner
|
||||||
final String spawnReason = entity.hasMetadata("US_REASON") ? entity.getMetadata("US_REASON").get(0).asString() : null;
|
final String spawnReason = entity.hasMetadata("US_REASON") && !entity.getMetadata("US_REASON").isEmpty()
|
||||||
|
? entity.getMetadata("US_REASON").get(0).asString() : null;
|
||||||
List<String> stackReasons;
|
List<String> stackReasons;
|
||||||
if (Settings.ONLY_STACK_FROM_SPAWNERS.getBoolean()) {
|
if (Settings.ONLY_STACK_FROM_SPAWNERS.getBoolean()) {
|
||||||
// If only stack from spawners is enabled, make sure the entity spawned from a spawner.
|
// If only stack from spawners is enabled, make sure the entity spawned from a spawner.
|
||||||
|
Loading…
Reference in New Issue
Block a user