mirror of
https://github.com/songoda/UltimateStacker.git
synced 2025-01-30 19:21:22 +01:00
Merge branch 'development'
This commit is contained in:
commit
f1c29edaf9
@ -4,7 +4,7 @@ stages:
|
||||
variables:
|
||||
name: "UltimateStacker"
|
||||
path: "/builds/$CI_PROJECT_PATH"
|
||||
version: "1.10.13"
|
||||
version: "1.10.14"
|
||||
|
||||
build:
|
||||
stage: build
|
||||
|
@ -1,5 +1,8 @@
|
||||
package com.songoda.ultimatestacker.entity;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public enum Check {
|
||||
|
||||
SPAWN_REASON(false),
|
||||
@ -35,7 +38,14 @@ public enum Check {
|
||||
PHANTOM_SIZE(true),
|
||||
CAT_TYPE(true);
|
||||
|
||||
private boolean isEnabledByDefault;
|
||||
private final boolean isEnabledByDefault;
|
||||
private final static Map<String, Check> checks = new HashMap();
|
||||
|
||||
static {
|
||||
for (Check c : values()) {
|
||||
checks.put(c.name(), c);
|
||||
}
|
||||
}
|
||||
|
||||
Check(boolean isEnabledByDefault) {
|
||||
this.isEnabledByDefault = isEnabledByDefault;
|
||||
@ -44,4 +54,8 @@ public enum Check {
|
||||
public boolean isEnabledByDefault() {
|
||||
return isEnabledByDefault;
|
||||
}
|
||||
|
||||
public static Check getCheck(String name) {
|
||||
return name != null ? checks.get(name.toUpperCase()) : null;
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ public class BlockListeners implements Listener {
|
||||
|
||||
if (overflowItem != null) {
|
||||
if (player.getInventory().firstEmpty() == -1)
|
||||
block.getLocation().getWorld().dropItemNaturally(block.getLocation().add(.5, 0, .5), overflowItem);
|
||||
block.getWorld().dropItemNaturally(block.getLocation().add(.5, 0, .5), overflowItem);
|
||||
else
|
||||
player.getInventory().addItem(overflowItem);
|
||||
}
|
||||
@ -180,8 +180,14 @@ public class BlockListeners implements Listener {
|
||||
plugin.updateHologram(stack);
|
||||
}
|
||||
|
||||
if (player.hasPermission("ultimatestacker.spawner.nosilkdrop") || item != null && item.getEnchantments().containsKey(Enchantment.SILK_TOUCH) && player.hasPermission("ultimatestacker.spawner.silktouch"))
|
||||
block.getWorld().dropItemNaturally(block.getLocation(), Methods.getSpawnerItem(blockType, amt));
|
||||
if (player.hasPermission("ultimatestacker.spawner.nosilkdrop") || item.getEnchantments().containsKey(Enchantment.SILK_TOUCH) && player.hasPermission("ultimatestacker.spawner.silktouch")) {
|
||||
ItemStack spawner = Methods.getSpawnerItem(blockType, amt);
|
||||
if (player.getInventory().firstEmpty() == -1 || !Settings.SPAWNERS_TO_INVENTORY.getBoolean())
|
||||
block.getWorld().dropItemNaturally(block.getLocation().add(.5, 0, .5), spawner);
|
||||
else
|
||||
player.getInventory().addItem(spawner);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private int getSpawnerAmount(ItemStack item) {
|
||||
|
@ -5,8 +5,6 @@ import com.songoda.core.configuration.ConfigSetting;
|
||||
import com.songoda.ultimatestacker.UltimateStacker;
|
||||
import com.songoda.ultimatestacker.entity.Check;
|
||||
import com.songoda.ultimatestacker.entity.Split;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
@ -15,7 +13,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
public class Settings {
|
||||
|
||||
static final Config config = UltimateStacker.getInstance().getConfig().getCoreConfig();
|
||||
static final Config config = UltimateStacker.getInstance().getCoreConfig();
|
||||
|
||||
public static final ConfigSetting STACK_SEARCH_TICK_SPEED = new ConfigSetting(config, "Main.Stack Search Tick Speed", 5,
|
||||
"The speed in which a new stacks will be created.",
|
||||
@ -217,6 +215,10 @@ public class Settings {
|
||||
"Should eggs convert spawners? If enabled you will",
|
||||
"still need to give perms for it to work.");
|
||||
|
||||
public static final ConfigSetting SPAWNERS_TO_INVENTORY = new ConfigSetting(config, "Spawners.Add Spawners To Inventory On Drop", false,
|
||||
"Should broken spawners be added directly to the players inventory?",
|
||||
"Alternatively they will drop to the ground?");
|
||||
|
||||
public static final ConfigSetting MAX_STACK_SPAWNERS = new ConfigSetting(config, "Spawners.Max Stack Size", 5,
|
||||
"What should the max a spawner can stack to be?");
|
||||
|
||||
|
@ -17,12 +17,12 @@ public class EntityUtils {
|
||||
|
||||
UltimateStacker plugin = UltimateStacker.getInstance();
|
||||
|
||||
private List<String> checks = Settings.STACK_CHECKS.getStringList();
|
||||
private boolean stackFlyingDown = Settings.ONLY_STACK_FLYING_DOWN.getBoolean();
|
||||
private boolean keepFire = Settings.KEEP_FIRE.getBoolean();
|
||||
private boolean keepPotion = Settings.KEEP_POTION.getBoolean();
|
||||
private boolean stackWholeChunk = Settings.STACK_WHOLE_CHUNK.getBoolean();
|
||||
private int searchRadius = Settings.SEARCH_RADIUS.getInt();
|
||||
private final List<String> checks = Settings.STACK_CHECKS.getStringList();
|
||||
private final boolean stackFlyingDown = Settings.ONLY_STACK_FLYING_DOWN.getBoolean();
|
||||
private final boolean keepFire = Settings.KEEP_FIRE.getBoolean();
|
||||
private final boolean keepPotion = Settings.KEEP_POTION.getBoolean();
|
||||
private final boolean stackWholeChunk = Settings.STACK_WHOLE_CHUNK.getBoolean();
|
||||
private final int searchRadius = Settings.SEARCH_RADIUS.getInt();
|
||||
|
||||
private final Map<CachedChunk, Entity[]> cachedChunks = new HashMap<>();
|
||||
|
||||
@ -251,7 +251,8 @@ public class EntityUtils {
|
||||
entityList.removeIf(entity -> entity.getLocation().getY() > initalEntity.getLocation().getY());
|
||||
|
||||
for (String checkStr : checks) {
|
||||
Check check = Check.valueOf(checkStr);
|
||||
Check check = Check.getCheck(checkStr);
|
||||
if (check == null) continue;
|
||||
switch (check) {
|
||||
case SPAWN_REASON: {
|
||||
if (initalEntity.hasMetadata("US_REASON"))
|
||||
|
Loading…
Reference in New Issue
Block a user