mirror of
https://github.com/songoda/UltimateStacker.git
synced 2024-11-23 18:45:39 +01:00
Settings
This commit is contained in:
parent
1fd965c369
commit
c0bc2d8cf3
@ -27,7 +27,7 @@ import com.songoda.ultimatestacker.hook.StackerHook;
|
||||
import com.songoda.ultimatestacker.hook.hooks.JobsHook;
|
||||
import com.songoda.ultimatestacker.listeners.*;
|
||||
import com.songoda.ultimatestacker.lootables.LootablesManager;
|
||||
import com.songoda.ultimatestacker.settings.Setting;
|
||||
import com.songoda.ultimatestacker.settings.Settings;
|
||||
import com.songoda.ultimatestacker.spawner.SpawnerStack;
|
||||
import com.songoda.ultimatestacker.spawner.SpawnerStackManager;
|
||||
import com.songoda.ultimatestacker.storage.Storage;
|
||||
@ -99,10 +99,10 @@ public class UltimateStacker extends SongodaPlugin {
|
||||
SongodaCore.registerPlugin(this, 16, LegacyMaterials.IRON_INGOT);
|
||||
|
||||
// Setup Config
|
||||
Setting.setupConfig();
|
||||
this.setLocale(Setting.LANGUGE_MODE.getString(), false);
|
||||
whitelist = Setting.ITEM_WHITELIST.getStringList();
|
||||
blacklist = Setting.ITEM_BLACKLIST.getStringList();
|
||||
Settings.setupConfig();
|
||||
this.setLocale(Settings.LANGUGE_MODE.getString(), false);
|
||||
whitelist = Settings.ITEM_WHITELIST.getStringList();
|
||||
blacklist = Settings.ITEM_BLACKLIST.getStringList();
|
||||
|
||||
// Setup plugin commands
|
||||
this.commandManager = new CommandManager(this);
|
||||
@ -165,7 +165,7 @@ public class UltimateStacker extends SongodaPlugin {
|
||||
pluginManager.registerEvents(new SpawnerListeners(this), this);
|
||||
pluginManager.registerEvents(new SheepDyeListeners(this), this);
|
||||
|
||||
if (Setting.CLEAR_LAG.getBoolean() && pluginManager.isPluginEnabled("ClearLag"))
|
||||
if (Settings.CLEAR_LAG.getBoolean() && pluginManager.isPluginEnabled("ClearLag"))
|
||||
pluginManager.registerEvents(new ClearLagListeners(this), this);
|
||||
|
||||
// Register Hooks
|
||||
@ -203,13 +203,13 @@ public class UltimateStacker extends SongodaPlugin {
|
||||
|
||||
// Database stuff, go!
|
||||
try {
|
||||
if (Setting.MYSQL_ENABLED.getBoolean()) {
|
||||
String hostname = Setting.MYSQL_HOSTNAME.getString();
|
||||
int port = Setting.MYSQL_PORT.getInt();
|
||||
String database = Setting.MYSQL_DATABASE.getString();
|
||||
String username = Setting.MYSQL_USERNAME.getString();
|
||||
String password = Setting.MYSQL_PASSWORD.getString();
|
||||
boolean useSSL = Setting.MYSQL_USE_SSL.getBoolean();
|
||||
if (Settings.MYSQL_ENABLED.getBoolean()) {
|
||||
String hostname = Settings.MYSQL_HOSTNAME.getString();
|
||||
int port = Settings.MYSQL_PORT.getInt();
|
||||
String database = Settings.MYSQL_DATABASE.getString();
|
||||
String username = Settings.MYSQL_USERNAME.getString();
|
||||
String password = Settings.MYSQL_PASSWORD.getString();
|
||||
boolean useSSL = Settings.MYSQL_USE_SSL.getBoolean();
|
||||
|
||||
this.databaseConnector = new MySQLConnector(this, hostname, port, database, username, password, useSSL);
|
||||
this.getLogger().info("Data handler connected using MySQL.");
|
||||
@ -228,7 +228,7 @@ public class UltimateStacker extends SongodaPlugin {
|
||||
this.dataMigrationManager.runMigrations();
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(this, () -> {
|
||||
final boolean useHolo = Setting.SPAWNER_HOLOGRAMS.getBoolean();
|
||||
final boolean useHolo = Settings.SPAWNER_HOLOGRAMS.getBoolean();
|
||||
this.dataManager.getSpawners((spawners) -> {
|
||||
this.spawnerStackManager.addSpawners(spawners);
|
||||
if (useHolo)
|
||||
@ -250,8 +250,8 @@ public class UltimateStacker extends SongodaPlugin {
|
||||
|
||||
@Override
|
||||
public void onConfigReload() {
|
||||
whitelist = Setting.ITEM_WHITELIST.getStringList();
|
||||
blacklist = Setting.ITEM_BLACKLIST.getStringList();
|
||||
whitelist = Settings.ITEM_WHITELIST.getStringList();
|
||||
blacklist = Settings.ITEM_BLACKLIST.getStringList();
|
||||
|
||||
this.setLocale(getConfig().getString("System.Language Mode"), true);
|
||||
this.locale.reloadMessages();
|
||||
@ -268,7 +268,7 @@ public class UltimateStacker extends SongodaPlugin {
|
||||
}
|
||||
|
||||
public boolean spawnersEnabled() {
|
||||
return !this.getServer().getPluginManager().isPluginEnabled("EpicSpawners") && Setting.SPAWNERS_ENABLED.getBoolean();
|
||||
return !this.getServer().getPluginManager().isPluginEnabled("EpicSpawners") && Settings.SPAWNERS_ENABLED.getBoolean();
|
||||
}
|
||||
|
||||
public CommandManager getCommandManager() {
|
||||
@ -332,7 +332,7 @@ public class UltimateStacker extends SongodaPlugin {
|
||||
|
||||
public void updateHologram(SpawnerStack stack) {
|
||||
// are holograms enabled?
|
||||
if(!Setting.SPAWNER_HOLOGRAMS.getBoolean() || !HologramManager.getManager().isEnabled()) return;
|
||||
if(!Settings.SPAWNER_HOLOGRAMS.getBoolean() || !HologramManager.getManager().isEnabled()) return;
|
||||
// verify that this is a spawner stack
|
||||
if (stack.getLocation().getBlock().getType() != LegacyMaterials.SPAWNER.getMaterial()) return;
|
||||
// grab the spawner block
|
||||
@ -346,7 +346,7 @@ public class UltimateStacker extends SongodaPlugin {
|
||||
// verify that this is a spawner
|
||||
if (block.getType() != LegacyMaterials.SPAWNER.getMaterial()) return;
|
||||
// are holograms enabled?
|
||||
if(!Setting.SPAWNER_HOLOGRAMS.getBoolean() || !HologramManager.getManager().isEnabled()) return;
|
||||
if(!Settings.SPAWNER_HOLOGRAMS.getBoolean() || !HologramManager.getManager().isEnabled()) return;
|
||||
// update this hologram in a tick
|
||||
SpawnerStack spawner = getSpawnerStackManager().getSpawner(block);
|
||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this, () -> updateHologram(spawner), 10L);
|
||||
@ -387,10 +387,10 @@ public class UltimateStacker extends SongodaPlugin {
|
||||
}
|
||||
item.setItemStack(itemStack);
|
||||
|
||||
if ((blacklisted && !Setting.ITEM_HOLOGRAM_BLACKLIST.getBoolean())
|
||||
if ((blacklisted && !Settings.ITEM_HOLOGRAM_BLACKLIST.getBoolean())
|
||||
|| !INSTANCE.getItemFile().getBoolean("Items." + material + ".Has Hologram")
|
||||
|| !Setting.ITEM_HOLOGRAMS.getBoolean()
|
||||
|| newAmount == 1 && !Setting.ITEM_HOLOGRAM_SINGLE.getBoolean())
|
||||
|| !Settings.ITEM_HOLOGRAMS.getBoolean()
|
||||
|| newAmount == 1 && !Settings.ITEM_HOLOGRAM_SINGLE.getBoolean())
|
||||
return;
|
||||
|
||||
item.setCustomName(name);
|
||||
|
@ -4,7 +4,7 @@ import com.songoda.core.compatibility.LegacyMaterials;
|
||||
import com.songoda.core.compatibility.ServerVersion;
|
||||
import com.songoda.lootables.loot.Drop;
|
||||
import com.songoda.ultimatestacker.UltimateStacker;
|
||||
import com.songoda.ultimatestacker.settings.Setting;
|
||||
import com.songoda.ultimatestacker.settings.Settings;
|
||||
import com.songoda.ultimatestacker.utils.DropUtils;
|
||||
import com.songoda.ultimatestacker.utils.Methods;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -39,14 +39,14 @@ public class EntityStack {
|
||||
}
|
||||
|
||||
public void updateStack() {
|
||||
if (!Setting.ENTITY_HOLOGRAMS.getBoolean()) return;
|
||||
if (!Settings.ENTITY_HOLOGRAMS.getBoolean()) return;
|
||||
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(UltimateStacker.getInstance(), () -> {
|
||||
Entity entit = getEntityByUniqueId(this.entity);
|
||||
if (entit == null ||
|
||||
!UltimateStacker.getInstance().getEntityStackManager().isStacked(entity)) return;
|
||||
|
||||
entit.setCustomNameVisible(!Setting.HOLOGRAMS_ON_LOOK_ENTITY.getBoolean());
|
||||
entit.setCustomNameVisible(!Settings.HOLOGRAMS_ON_LOOK_ENTITY.getBoolean());
|
||||
entit.setCustomName(Methods.compileEntityName(entit, amount));
|
||||
}, entity == null ? 1L : 0L);
|
||||
|
||||
@ -142,7 +142,7 @@ public class EntityStack {
|
||||
if (killed.getType() == EntityType.PIG_ZOMBIE)
|
||||
newEntity.getEquipment().setItemInHand(LegacyMaterials.GOLDEN_SWORD.getItem());
|
||||
|
||||
if (Setting.CARRY_OVER_METADATA_ON_DEATH.getBoolean()) {
|
||||
if (Settings.CARRY_OVER_METADATA_ON_DEATH.getBoolean()) {
|
||||
if (killed.hasMetadata("ES"))
|
||||
newEntity.setMetadata("ES", killed.getMetadata("ES").get(0));
|
||||
|
||||
@ -169,20 +169,20 @@ public class EntityStack {
|
||||
killed.setCustomNameVisible(true);
|
||||
killed.setCustomName(Methods.formatText("&7"));
|
||||
|
||||
boolean killWholeStack = Setting.KILL_WHOLE_STACK_ON_DEATH.getBoolean()
|
||||
boolean killWholeStack = Settings.KILL_WHOLE_STACK_ON_DEATH.getBoolean()
|
||||
|| plugin.getMobFile().getBoolean("Mobs." + killed.getType().name() + ".Kill Whole Stack");
|
||||
|
||||
if (killWholeStack && getAmount() != 1) {
|
||||
handleWholeStackDeath(killed, drops, custom, droppedExp);
|
||||
} else if (getAmount() != 1) {
|
||||
List<String> reasons = Setting.INSTANT_KILL.getStringList();
|
||||
List<String> reasons = Settings.INSTANT_KILL.getStringList();
|
||||
EntityDamageEvent lastDamageCause = killed.getLastDamageCause();
|
||||
|
||||
if (lastDamageCause != null) {
|
||||
EntityDamageEvent.DamageCause cause = lastDamageCause.getCause();
|
||||
for (String s : reasons) {
|
||||
if (!cause.name().equalsIgnoreCase(s)) continue;
|
||||
handleWholeStackDeath(killed, drops, custom, Setting.NO_EXP_INSTANT_KILL.getBoolean() ? 0 : droppedExp);
|
||||
handleWholeStackDeath(killed, drops, custom, Settings.NO_EXP_INSTANT_KILL.getBoolean() ? 0 : droppedExp);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -192,7 +192,7 @@ public class EntityStack {
|
||||
|
||||
public void updateHealth(LivingEntity entity) {
|
||||
if (entity == null) return;
|
||||
entity.setHealth(Setting.STACK_ENTITY_HEALTH.getBoolean()
|
||||
entity.setHealth(Settings.STACK_ENTITY_HEALTH.getBoolean()
|
||||
&& !this.health.isEmpty() ? this.health.removeFirst() : entity.getMaxHealth());
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ import com.songoda.core.compatibility.LegacyMaterials;
|
||||
import com.songoda.ultimatestacker.UltimateStacker;
|
||||
import com.songoda.ultimatestacker.events.SpawnerBreakEvent;
|
||||
import com.songoda.ultimatestacker.events.SpawnerPlaceEvent;
|
||||
import com.songoda.ultimatestacker.settings.Setting;
|
||||
import com.songoda.ultimatestacker.settings.Settings;
|
||||
import com.songoda.ultimatestacker.spawner.SpawnerStack;
|
||||
import com.songoda.ultimatestacker.utils.Methods;
|
||||
import org.apache.commons.lang.math.NumberUtils;
|
||||
@ -45,7 +45,7 @@ public class BlockListeners implements Listener {
|
||||
|| item.getType() != LegacyMaterials.SPAWNER.getMaterial()
|
||||
|| event.getAction() == Action.LEFT_CLICK_BLOCK) return;
|
||||
|
||||
List<String> disabledWorlds = Setting.DISABLED_WORLDS.getStringList();
|
||||
List<String> disabledWorlds = Settings.DISABLED_WORLDS.getStringList();
|
||||
if (disabledWorlds.stream().anyMatch(worldStr -> event.getPlayer().getWorld().getName().equalsIgnoreCase(worldStr))) return;
|
||||
|
||||
if (!plugin.spawnersEnabled()) return;
|
||||
@ -57,7 +57,7 @@ public class BlockListeners implements Listener {
|
||||
|
||||
int itemAmount = getSpawnerAmount(item);
|
||||
int specific = plugin.getSpawnerFile().getInt("Spawners." + cs.getSpawnedType().name() + ".Max Stack Size");
|
||||
int maxStackSize = specific == -1 ? Setting.MAX_STACK_SPAWNERS.getInt() : specific;
|
||||
int maxStackSize = specific == -1 ? Settings.MAX_STACK_SPAWNERS.getInt() : specific;
|
||||
|
||||
cs = (CreatureSpawner) block.getState();
|
||||
|
||||
@ -155,7 +155,7 @@ public class BlockListeners implements Listener {
|
||||
int amt = 1;
|
||||
boolean remove = false;
|
||||
|
||||
if (player.isSneaking() && Setting.SNEAK_FOR_STACK.getBoolean()) {
|
||||
if (player.isSneaking() && Settings.SNEAK_FOR_STACK.getBoolean()) {
|
||||
amt = stack.getAmount();
|
||||
remove = true;
|
||||
} else if (stack.getAmount() <= 1) {
|
||||
|
@ -5,7 +5,7 @@ import com.songoda.core.compatibility.ServerVersion;
|
||||
import com.songoda.lootables.loot.Drop;
|
||||
import com.songoda.ultimatestacker.UltimateStacker;
|
||||
import com.songoda.ultimatestacker.entity.EntityStack;
|
||||
import com.songoda.ultimatestacker.settings.Setting;
|
||||
import com.songoda.ultimatestacker.settings.Settings;
|
||||
import com.songoda.ultimatestacker.utils.DropUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
@ -40,7 +40,7 @@ public class DeathListeners implements Listener {
|
||||
public void onEntityDeath(EntityDeathEvent event) {
|
||||
if (event.getEntity() instanceof Player) return;
|
||||
|
||||
boolean custom = Setting.CUSTOM_DROPS.getBoolean();
|
||||
boolean custom = Settings.CUSTOM_DROPS.getBoolean();
|
||||
List<Drop> drops = custom ? instance.getLootablesManager().getDrops(event.getEntity()) : new ArrayList<>();
|
||||
|
||||
if (!custom) {
|
||||
@ -112,7 +112,7 @@ public class DeathListeners implements Listener {
|
||||
if (!instance.getEntityStackManager().isStacked(event.getEntity())) return;
|
||||
EntityStack stack = instance.getEntityStackManager().getStack(event.getEntity());
|
||||
|
||||
if (Setting.KILL_WHOLE_STACK_ON_DEATH.getBoolean() && Setting.REALISTIC_DAMAGE.getBoolean()) {
|
||||
if (Settings.KILL_WHOLE_STACK_ON_DEATH.getBoolean() && Settings.REALISTIC_DAMAGE.getBoolean()) {
|
||||
Player player = (Player) event.getDamager();
|
||||
ItemStack tool = player.getInventory().getItemInMainHand();
|
||||
if (tool.getType().getMaxDurability() < 1 || (tool.getItemMeta() != null && (tool.getItemMeta().isUnbreakable()
|
||||
|
@ -4,7 +4,7 @@ import com.songoda.core.compatibility.LegacyMaterials;
|
||||
import com.songoda.ultimatestacker.UltimateStacker;
|
||||
import com.songoda.ultimatestacker.entity.EntityStack;
|
||||
import com.songoda.ultimatestacker.entity.EntityStackManager;
|
||||
import com.songoda.ultimatestacker.settings.Setting;
|
||||
import com.songoda.ultimatestacker.settings.Settings;
|
||||
import com.songoda.ultimatestacker.spawner.SpawnerStack;
|
||||
import com.songoda.ultimatestacker.utils.Methods;
|
||||
import java.util.ArrayList;
|
||||
@ -90,14 +90,14 @@ public class EntityListeners implements Listener {
|
||||
|
||||
SpawnerStack spawner = plugin.getSpawnerStackManager().getSpawner(block);
|
||||
|
||||
if (Setting.SPAWNERS_DONT_EXPLODE.getBoolean())
|
||||
if (Settings.SPAWNERS_DONT_EXPLODE.getBoolean())
|
||||
toCancel.add(block);
|
||||
else {
|
||||
String chance = "";
|
||||
if (event.getEntity() instanceof Creeper)
|
||||
chance = Setting.EXPLOSION_DROP_CHANCE_TNT.getString();
|
||||
chance = Settings.EXPLOSION_DROP_CHANCE_TNT.getString();
|
||||
else if (event.getEntity() instanceof TNTPrimed)
|
||||
chance = Setting.EXPLOSION_DROP_CHANCE_CREEPER.getString();
|
||||
chance = Settings.EXPLOSION_DROP_CHANCE_CREEPER.getString();
|
||||
int ch = Integer.parseInt(chance.replace("%", ""));
|
||||
double rand = Math.random() * 100;
|
||||
if (rand - ch < 0 || ch == 100) {
|
||||
|
@ -5,7 +5,7 @@ import com.songoda.core.compatibility.ServerVersion;
|
||||
import com.songoda.ultimatestacker.UltimateStacker;
|
||||
import com.songoda.ultimatestacker.entity.EntityStack;
|
||||
import com.songoda.ultimatestacker.entity.Split;
|
||||
import com.songoda.ultimatestacker.settings.Setting;
|
||||
import com.songoda.ultimatestacker.settings.Settings;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Ageable;
|
||||
@ -46,9 +46,9 @@ public class InteractListeners implements Listener {
|
||||
|
||||
if (stack.getAmount() <= 1
|
||||
|| item.getType() == Material.NAME_TAG
|
||||
&& Setting.SPLIT_CHECKS.getStringList().stream().noneMatch(line -> Split.valueOf(line) == Split.NAME_TAG)
|
||||
&& Settings.SPLIT_CHECKS.getStringList().stream().noneMatch(line -> Split.valueOf(line) == Split.NAME_TAG)
|
||||
|| item.getType() != Material.NAME_TAG
|
||||
&& Setting.SPLIT_CHECKS.getStringList().stream().noneMatch(line -> Split.valueOf(line) == Split.ENTITY_BREED))
|
||||
&& Settings.SPLIT_CHECKS.getStringList().stream().noneMatch(line -> Split.valueOf(line) == Split.ENTITY_BREED))
|
||||
return;
|
||||
|
||||
if (item.getType() == Material.NAME_TAG)
|
||||
|
@ -4,7 +4,7 @@ import com.songoda.core.compatibility.CompatibleSounds;
|
||||
import com.songoda.core.compatibility.ServerVersion;
|
||||
import com.songoda.core.utils.BlockUtils;
|
||||
import com.songoda.ultimatestacker.UltimateStacker;
|
||||
import com.songoda.ultimatestacker.settings.Setting;
|
||||
import com.songoda.ultimatestacker.settings.Settings;
|
||||
import com.songoda.ultimatestacker.utils.Methods;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.block.BlockState;
|
||||
@ -28,8 +28,8 @@ public class ItemListeners implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onMerge(ItemMergeEvent event) {
|
||||
int maxItemStackSize = Setting.MAX_STACK_ITEMS.getInt();
|
||||
if (!Setting.STACK_ITEMS.getBoolean()) return;
|
||||
int maxItemStackSize = Settings.MAX_STACK_ITEMS.getInt();
|
||||
if (!Settings.STACK_ITEMS.getBoolean()) return;
|
||||
|
||||
Item item = event.getTarget();
|
||||
ItemStack itemStack = item.getItemStack();
|
||||
@ -58,7 +58,7 @@ public class ItemListeners implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onInvPickup(InventoryPickupItemEvent event) {
|
||||
if (!Setting.STACK_ITEMS.getBoolean() || !Methods.hasCustomAmount(event.getItem())) return;
|
||||
if (!Settings.STACK_ITEMS.getBoolean() || !Methods.hasCustomAmount(event.getItem())) return;
|
||||
event.setCancelled(true);
|
||||
|
||||
Methods.updateInventory(event.getItem(), event.getInventory());
|
||||
@ -68,7 +68,7 @@ public class ItemListeners implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onExist(ItemSpawnEvent event) {
|
||||
if (!Setting.STACK_ITEMS.getBoolean()) return;
|
||||
if (!Settings.STACK_ITEMS.getBoolean()) return;
|
||||
|
||||
ItemStack itemStack = event.getEntity().getItemStack();
|
||||
|
||||
@ -82,7 +82,7 @@ public class ItemListeners implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onPickup(PlayerPickupItemEvent event) {
|
||||
if (!Setting.STACK_ITEMS.getBoolean()) return;
|
||||
if (!Settings.STACK_ITEMS.getBoolean()) return;
|
||||
if (event.getItem().getItemStack().getAmount() < 32) return;
|
||||
event.setCancelled(true);
|
||||
|
||||
|
@ -3,7 +3,7 @@ package com.songoda.ultimatestacker.listeners;
|
||||
import com.songoda.ultimatestacker.UltimateStacker;
|
||||
import com.songoda.ultimatestacker.entity.EntityStackManager;
|
||||
import com.songoda.ultimatestacker.entity.Split;
|
||||
import com.songoda.ultimatestacker.settings.Setting;
|
||||
import com.songoda.ultimatestacker.settings.Settings;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
@ -29,9 +29,9 @@ public class ShearListeners implements Listener {
|
||||
if (!stackManager.isStacked(entity)) return;
|
||||
|
||||
if (event.getEntity().getType() == EntityType.SHEEP
|
||||
&& Setting.SPLIT_CHECKS.getStringList().stream().noneMatch(line -> Split.valueOf(line) == Split.SHEEP_SHEAR)
|
||||
&& Settings.SPLIT_CHECKS.getStringList().stream().noneMatch(line -> Split.valueOf(line) == Split.SHEEP_SHEAR)
|
||||
|| event.getEntity().getType() == EntityType.MUSHROOM_COW
|
||||
&& Setting.SPLIT_CHECKS.getStringList().stream().noneMatch(line -> Split.valueOf(line) == Split.MUSHROOM_SHEAR))
|
||||
&& Settings.SPLIT_CHECKS.getStringList().stream().noneMatch(line -> Split.valueOf(line) == Split.MUSHROOM_SHEAR))
|
||||
return;
|
||||
|
||||
plugin.getEntityUtils().splitFromStack((LivingEntity)entity);
|
||||
|
@ -3,7 +3,7 @@ package com.songoda.ultimatestacker.listeners;
|
||||
import com.songoda.ultimatestacker.UltimateStacker;
|
||||
import com.songoda.ultimatestacker.entity.EntityStackManager;
|
||||
import com.songoda.ultimatestacker.entity.Split;
|
||||
import com.songoda.ultimatestacker.settings.Setting;
|
||||
import com.songoda.ultimatestacker.settings.Settings;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -25,7 +25,7 @@ public class SheepDyeListeners implements Listener {
|
||||
EntityStackManager stackManager = plugin.getEntityStackManager();
|
||||
if (!stackManager.isStacked(entity)) return;
|
||||
|
||||
if (Setting.SPLIT_CHECKS.getStringList().stream().noneMatch(line -> Split.valueOf(line) == Split.SHEEP_DYE))
|
||||
if (Settings.SPLIT_CHECKS.getStringList().stream().noneMatch(line -> Split.valueOf(line) == Split.SHEEP_DYE))
|
||||
return;
|
||||
|
||||
plugin.getEntityUtils().splitFromStack(entity);
|
||||
|
@ -3,7 +3,7 @@ package com.songoda.ultimatestacker.listeners;
|
||||
import com.songoda.core.compatibility.ServerVersion;
|
||||
import com.songoda.ultimatestacker.UltimateStacker;
|
||||
import com.songoda.ultimatestacker.entity.EntityStack;
|
||||
import com.songoda.ultimatestacker.settings.Setting;
|
||||
import com.songoda.ultimatestacker.settings.Settings;
|
||||
import com.songoda.ultimatestacker.spawner.SpawnerStack;
|
||||
import com.songoda.ultimatestacker.spawner.SpawnerStackManager;
|
||||
import com.songoda.ultimatestacker.utils.Methods;
|
||||
@ -33,7 +33,7 @@ public class SpawnerListeners implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onSpawn(SpawnerSpawnEvent event) {
|
||||
if (!Setting.STACK_ENTITIES.getBoolean()
|
||||
if (!Settings.STACK_ENTITIES.getBoolean()
|
||||
|| !plugin.spawnersEnabled()
|
||||
|| plugin.getStackingTask().isWorldDisabled(event.getLocation().getWorld())) return;
|
||||
SpawnerStackManager spawnerStackManager = plugin.getSpawnerStackManager();
|
||||
@ -67,7 +67,7 @@ public class SpawnerListeners implements Listener {
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
if (!Setting.EGGS_CONVERT_SPAWNERS.getBoolean()
|
||||
if (!Settings.EGGS_CONVERT_SPAWNERS.getBoolean()
|
||||
|| (event.getItem().hasItemMeta() && event.getItem().getItemMeta().hasDisplayName())) {
|
||||
return;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import com.songoda.lootables.Lootables;
|
||||
import com.songoda.lootables.Modify;
|
||||
import com.songoda.lootables.loot.*;
|
||||
import com.songoda.ultimatestacker.UltimateStacker;
|
||||
import com.songoda.ultimatestacker.settings.Setting;
|
||||
import com.songoda.ultimatestacker.settings.Settings;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.*;
|
||||
@ -41,7 +41,7 @@ public class LootablesManager {
|
||||
? entity.getKiller().getItemInHand().getEnchantmentLevel(Enchantment.LOOT_BONUS_MOBS)
|
||||
: 0;
|
||||
|
||||
int rerollChance = Setting.REROLL.getBoolean() ? looting / (looting + 1) : 0;
|
||||
int rerollChance = Settings.REROLL.getBoolean() ? looting / (looting + 1) : 0;
|
||||
|
||||
for (Loot loot : lootable.getRegisteredLoot())
|
||||
toDrop.addAll(runLoot(entity, loot, rerollChance, looting));
|
||||
|
@ -1,251 +1,251 @@
|
||||
package com.songoda.ultimatestacker.settings;
|
||||
|
||||
import com.songoda.core.configuration.Config;
|
||||
import com.songoda.core.configuration.ConfigSetting;
|
||||
import com.songoda.ultimatestacker.UltimateStacker;
|
||||
import com.songoda.ultimatestacker.entity.Check;
|
||||
import com.songoda.ultimatestacker.entity.Split;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class Setting {
|
||||
|
||||
static final Config config = UltimateStacker.getInstance().getConfig().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.",
|
||||
"It is advised to keep this number low.");
|
||||
|
||||
public static final ConfigSetting DISABLED_WORLDS = new ConfigSetting(config, "Main.Disabled Worlds", Arrays.asList("World1", "World2", "World3"),
|
||||
"Worlds that stacking doesn't happen in.");
|
||||
|
||||
// Note: this setting is also referenced in EpicSpawners
|
||||
public static final ConfigSetting STACK_ENTITIES = new ConfigSetting(config, "Entities.Enabled", true,
|
||||
"Should entities be stacked?");
|
||||
|
||||
public static final ConfigSetting NAME_FORMAT_ENTITY = new ConfigSetting(config, "Entities.Name Format", "&f{TYPE} &6{AMT}x",
|
||||
"The text displayed above an entities head where {TYPE} refers to",
|
||||
"The entities type and {AMT} is the amount currently stacked.");
|
||||
|
||||
public static final ConfigSetting SEARCH_RADIUS = new ConfigSetting(config, "Entities.Search Radius", 5,
|
||||
"The distance entities must be to each other in order to stack.");
|
||||
|
||||
public static final ConfigSetting MAX_STACK_ENTITIES = new ConfigSetting(config, "Entities.Max Stack Size", 15,
|
||||
"The max amount of entities in a single stack.");
|
||||
|
||||
// Note: this setting is also referenced in EpicSpawners
|
||||
public static final ConfigSetting MIN_STACK_ENTITIES = new ConfigSetting(config, "Entities.Min Stack Amount", 5,
|
||||
"The minimum amount required before a stack can be formed.",
|
||||
"Do not set this to lower than 2.");
|
||||
|
||||
public static final ConfigSetting MAX_PER_TYPE_STACKS_PER_CHUNK = new ConfigSetting(config, "Entities.Max Per Type Stacks Per Chunk", -1,
|
||||
"The maximum amount of each entity type stack allowed in a chunk.");
|
||||
|
||||
public static final ConfigSetting STACK_WHOLE_CHUNK = new ConfigSetting(config, "Entities.Stack Whole Chunk", false,
|
||||
"Should all qualifying entities in each chunk be stacked?",
|
||||
"This will override the stacking radius.");
|
||||
|
||||
public static final ConfigSetting ENTITY_HOLOGRAMS = new ConfigSetting(config, "Entities.Holograms Enabled", true,
|
||||
"Should holograms be displayed above stacked entities?");
|
||||
|
||||
public static final ConfigSetting HOLOGRAMS_ON_LOOK_ENTITY = new ConfigSetting(config, "Entities.Only Show Holograms On Look", false,
|
||||
"Only show nametags above an entities head when looking directly at them.");
|
||||
|
||||
public static final ConfigSetting CUSTOM_DROPS = new ConfigSetting(config, "Entities.Custom Drops.Enabled", true,
|
||||
"Should custom drops be enabled?");
|
||||
|
||||
public static final ConfigSetting REROLL = new ConfigSetting(config, "Entities.Custom Drops.Reroll", true,
|
||||
"Increases chance of uncommon drops by making a second attempt to",
|
||||
"drop if the original attempt failed (Requires the looting enchantment).",
|
||||
"This is a default Minecraft mechanic.");
|
||||
|
||||
public static final ConfigSetting KILL_WHOLE_STACK_ON_DEATH = new ConfigSetting(config, "Entities.Kill Whole Stack On Death", false,
|
||||
"Should killing a stack of entities kill the whole stack or",
|
||||
"just one out of the stack? If you want only certain entities to be",
|
||||
"effected by this you can configure it in the entities.yml");
|
||||
|
||||
public static final ConfigSetting CLEAR_LAG = new ConfigSetting(config, "Entities.Clear Lag", false,
|
||||
"When enabled, the plugin will hook into ClearLag and extend the",
|
||||
"clear task to include stacked entities from this plugin. If this is enabled",
|
||||
"the built in task will not run.");
|
||||
|
||||
public static final ConfigSetting INSTANT_KILL = new ConfigSetting(config, "Entities.Instant Kill", Arrays.asList("FALL", "DROWNING", "LAVA", "VOID"),
|
||||
"Events that will trigger an entire stack to be killed.",
|
||||
"It should be noted that this is useless if the above setting is true.",
|
||||
"Any of the following can be added to the list:",
|
||||
"CONTACT, ENTITY_ATTACK, ENTITY_SWEEP_ATTACK, PROJECTILE",
|
||||
"SUFFOCATION, FALL, FIRE, FIRE_TICK",
|
||||
"MELTING, LAVA, DROWNING, BLOCK_EXPLOSION",
|
||||
"ENTITY_EXPLOSION, VOID, LIGHTNING, SUICIDE",
|
||||
"STARVATION, POISON, MAGIC, WITHER",
|
||||
"FALLING_BLOCK, THORNS, DRAGON_BREATH, CUSTOM",
|
||||
"FLY_INTO_WALL, HOT_FLOOR, CRAMMING, DRYOUT");
|
||||
|
||||
public static final ConfigSetting NO_EXP_INSTANT_KILL = new ConfigSetting(config, "Entities.No Exp For Instant Kills", false,
|
||||
"Should no experience be dropped when an instant kill is performed?");
|
||||
|
||||
public static final ConfigSetting STACK_CHECKS = new ConfigSetting(config, "Entities.Stack Checks", Arrays.asList(Check.values()).stream()
|
||||
.filter(Check::isEnabledByDefault).map(Check::name).collect(Collectors.toList()),
|
||||
"These are checks that are processed before an entity is stacked.",
|
||||
"You can add and remove from the list at will.",
|
||||
"The acceptable check options are:",
|
||||
"SPAWN_REASON, NERFED, AGE, TICK_AGE, PHANTOM_SIZE",
|
||||
"IS_TAMED, ANIMAL_OWNER, SKELETON_TYPE",
|
||||
"ZOMBIE_BABY, SLIME_SIZE, PIG_SADDLE, SHEEP_SHEERED",
|
||||
"SHEEP_COLOR, WOLF_COLLAR_COLOR, OCELOT_TYPE, HORSE_COLOR",
|
||||
"HORSE_STYLE, HORSE_CARRYING_CHEST, HORSE_HAS_ARMOR",
|
||||
"HORSE_HAS_SADDLE, HORSE_JUMP, RABBIT_TYPE, VILLAGER_PROFESSION",
|
||||
"LLAMA_COLOR, LLAMA_STRENGTH, PARROT_TYPE, PUFFERFISH_STATE",
|
||||
"TROPICALFISH_PATTERN, TROPICALFISH_BODY_COLOR, TROPICALFISH_PATTERN_COLOR");
|
||||
|
||||
public static final ConfigSetting SPLIT_CHECKS = new ConfigSetting(config, "Entities.Split Checks", Arrays.asList(Split.values()).stream()
|
||||
.map(Split::name).collect(Collectors.toList()),
|
||||
"These are checks that when achieved will break separate a single entity",
|
||||
"from a stack.");
|
||||
|
||||
public static final ConfigSetting KEEP_FIRE = new ConfigSetting(config, "Entities.Keep Fire", true,
|
||||
"Should fire ticks persist to the next entity when an entity dies?");
|
||||
|
||||
public static final ConfigSetting KEEP_POTION = new ConfigSetting(config, "Entities.Keep Potion Effects", true,
|
||||
"Should potion effects persist to the next entity when an entity dies?");
|
||||
|
||||
public static final ConfigSetting CARRY_OVER_LOWEST_HEALTH = new ConfigSetting(config, "Entities.Carry Over Lowest Health", false,
|
||||
"Should the lowest health be carried over when stacked?",
|
||||
"This should not be used in collaboration with 'Stack Entity Health'.",
|
||||
"If it is used this setting will be overrode.");
|
||||
|
||||
public static final ConfigSetting ONLY_STACK_FROM_SPAWNERS = new ConfigSetting(config, "Entities.Only Stack From Spawners", false,
|
||||
"Should entities only be stacked if they originate from a spawner?",
|
||||
"It should be noted that the identifier that tells the plugin",
|
||||
"if the entity originated from a spawner or not is wiped on",
|
||||
"server restart.");
|
||||
|
||||
public static final ConfigSetting STACK_REASONS = new ConfigSetting(config, "Entities.Stack Reasons", Arrays.asList(),
|
||||
"This will limit mob stacking to mobs who spawned via the listed reasons.",
|
||||
"This list is ignored if Only Stack From Spawners = true.",
|
||||
"The following reasons can be added to the list:",
|
||||
"NATURAL, JOCKEY, CHUNK_GEN, SPAWNER, EGG, SPAWNER_EGG, LIGHTNING, BUILD_SNOWMAN, ",
|
||||
"BUILD_IRONGOLEM, BUILD_WITHER, VILLAGE_DEFENSE, VILLAGE_INVASION, BREEDING,",
|
||||
"SLIME_SPLIT, REINFORCEMENTS, NETHER_PORTAL, DISPENSE_EGG, INFECTION,",
|
||||
"CURED, OCELOT_BABY, SILVERFISH_BLOCK, MOUNT, TRAP, ENDER_PEARL, ",
|
||||
"SHOULDER_ENTITY, DROWNED, SHEARED, EXPLOSION"
|
||||
);
|
||||
|
||||
public static final ConfigSetting CARRY_OVER_METADATA_ON_DEATH = new ConfigSetting(config, "Entities.Carry Over Metadata On Death", true,
|
||||
"With this enabled any metadata assigned from supported plugins such",
|
||||
"as EpicSpawners and mcMMO will be preserved when the entity is killed.");
|
||||
|
||||
public static final ConfigSetting ONLY_STACK_ON_SURFACE = new ConfigSetting(config, "Entities.Only Stack On Surface", true,
|
||||
"Should entities only be stacked if they are touching the ground",
|
||||
"or swimming? This does not effect flying entities.");
|
||||
|
||||
public static final ConfigSetting STACK_ENTITY_HEALTH = new ConfigSetting(config, "Entities.Stack Entity Health", true,
|
||||
"Should entity health be stacked? When enabled Entity stacks will",
|
||||
"remember the health of all entities inside of the stack. This",
|
||||
"works the best with 'Only Stack On Surface enabled' as entities",
|
||||
"falling out of grinders may stack before hitting the ground.");
|
||||
|
||||
public static final ConfigSetting ONLY_STACK_FLYING_DOWN = new ConfigSetting(config, "Entities.Only Stack Flying Down", true,
|
||||
"Should entities that fly only stack with entities that are lower on the",
|
||||
"Y axis. This is important for grinders so that flying entities don't continuously",
|
||||
"stack upwards to a higher up entity.");
|
||||
|
||||
public static final ConfigSetting REALISTIC_DAMAGE = new ConfigSetting(config, "Entities.Use Realistic Weapon Damage", true,
|
||||
"Should weapons take damage based on the amount of entites in the stack?");
|
||||
|
||||
public static final ConfigSetting STACK_ITEMS = new ConfigSetting(config, "Items.Enabled", true,
|
||||
"Should items be stacked?");
|
||||
|
||||
public static final ConfigSetting ITEM_HOLOGRAMS = new ConfigSetting(config, "Items.Holograms Enabled", true,
|
||||
"Should holograms be displayed above stacked items?");
|
||||
|
||||
public static final ConfigSetting ITEM_HOLOGRAM_SINGLE = new ConfigSetting(config, "Items.Show Hologram For Single", true,
|
||||
"Should holograms be displayed above items when there is only a single",
|
||||
"item in the stack?");
|
||||
|
||||
public static final ConfigSetting ITEM_HOLOGRAM_BLACKLIST = new ConfigSetting(config, "Items.Show Holograms For Blacklisted Items", true,
|
||||
"Should items that are blacklisted display holograms?");
|
||||
|
||||
public static final ConfigSetting MAX_STACK_ITEMS = new ConfigSetting(config, "Items.Max Stack Size", 512,
|
||||
"The max stack size for items.",
|
||||
"Currently this can only be set to a max of 120.");
|
||||
|
||||
public static final ConfigSetting NAME_FORMAT_ITEM = new ConfigSetting(config, "Items.Name Format", "&f{TYPE} &r[&6{AMT}x]",
|
||||
"The text displayed above a dropped item.");
|
||||
|
||||
public static final ConfigSetting NAME_FORMAT_RESET = new ConfigSetting(config, "Items.Name Format Reset", true,
|
||||
"Should color codes in dropped item names be removed?",
|
||||
"This is added only because it looks smoother in game. This is only visual and",
|
||||
"doesn't actually effect the item.");
|
||||
|
||||
public static final ConfigSetting ITEM_BLACKLIST = new ConfigSetting(config, "Items.Blacklist", Collections.singletonList("EGG"),
|
||||
"Items included in this list will stack to default Minecraft amounts.",
|
||||
"Material list: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html",
|
||||
"Leave this empty by using \"blacklist: []\" if you do not wish to disable",
|
||||
"stacking for any items.");
|
||||
|
||||
public static final ConfigSetting ITEM_WHITELIST = new ConfigSetting(config, "Items.Whitelist", Collections.EMPTY_LIST,
|
||||
"Items included in this whitelist will be stacked.",
|
||||
"Material list: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html",
|
||||
"Leave this empty by using \"whitelist: []\" if you want everything to be stacked.",
|
||||
"Items not in this list will act as if they are blacklisted.");
|
||||
|
||||
public static final ConfigSetting SHOW_STACK_SIZE_SINGLE = new ConfigSetting(config, "Items.Show Stack Size For Single", false,
|
||||
"When enabled stack sizes for a stack with a single item will",
|
||||
"not display the stack size. The stack size will be added",
|
||||
"for stacks containing two or more items.");
|
||||
|
||||
public static final ConfigSetting SPAWNERS_ENABLED = new ConfigSetting(config, "Spawners.Enabled", true,
|
||||
"Should spawners be stacked?");
|
||||
|
||||
public static final ConfigSetting SPAWNER_HOLOGRAMS = new ConfigSetting(config, "Spawners.Holograms Enabled", true,
|
||||
"Should holograms be displayed above stacked spawners?");
|
||||
|
||||
public static final ConfigSetting EGGS_CONVERT_SPAWNERS = new ConfigSetting(config, "Spawners.Eggs Convert Spawners", true,
|
||||
"Should eggs convert spawners? If enabled you will",
|
||||
"still need to give perms for it to work.");
|
||||
|
||||
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?");
|
||||
|
||||
public static final ConfigSetting SNEAK_FOR_STACK = new ConfigSetting(config, "Spawners.Sneak To Receive A Stacked Spawner", true,
|
||||
"Toggle ability to receive a stacked spawner when breaking a spawner while sneaking.");
|
||||
|
||||
public static final ConfigSetting SPAWNERS_DONT_EXPLODE = new ConfigSetting(config, "Spawners.Prevent Spawners From Exploding", false,
|
||||
"Should spawners not break when blown up?");
|
||||
|
||||
public static final ConfigSetting EXPLOSION_DROP_CHANCE_TNT = new ConfigSetting(config, "Spawners.Chance On TNT Explosion", "100%",
|
||||
"Chance of a TNT explosion dropping a spawner.");
|
||||
|
||||
public static final ConfigSetting EXPLOSION_DROP_CHANCE_CREEPER = new ConfigSetting(config, "Spawners.Chance On Creeper Explosion", "100%",
|
||||
"Chance of a creeper explosion dropping a spawner.");
|
||||
|
||||
public static final ConfigSetting NAME_FORMAT_SPAWNER = new ConfigSetting(config, "Spawners.Name Format", "&f{TYPE} Spawner &6{AMT}x",
|
||||
"The text displayed above a stacked spawner where {TYPE} refers to",
|
||||
"The entities type and {AMT} is the amount currently stacked.");
|
||||
|
||||
public static final ConfigSetting LANGUGE_MODE = new ConfigSetting(config, "System.Language Mode", "en_US",
|
||||
"The enabled language file.",
|
||||
"More language files (if available) can be found in the plugins data folder.");
|
||||
|
||||
public static final ConfigSetting MYSQL_ENABLED = new ConfigSetting(config, "MySQL.Enabled", false,
|
||||
"Set to 'true' to use MySQL instead of SQLite for data storage.");
|
||||
public static final ConfigSetting MYSQL_HOSTNAME = new ConfigSetting(config, "MySQL.Hostname", "localhost");
|
||||
public static final ConfigSetting MYSQL_PORT = new ConfigSetting(config, "MySQL.Port", 3306);
|
||||
public static final ConfigSetting MYSQL_DATABASE = new ConfigSetting(config, "MySQL.Database", "your-database");
|
||||
public static final ConfigSetting MYSQL_USERNAME = new ConfigSetting(config, "MySQL.Username", "user");
|
||||
public static final ConfigSetting MYSQL_PASSWORD = new ConfigSetting(config, "MySQL.Password", "pass");
|
||||
public static final ConfigSetting MYSQL_USE_SSL = new ConfigSetting(config, "MySQL.Use SSL", false);
|
||||
|
||||
/**
|
||||
* In order to set dynamic economy comment correctly, this needs to be
|
||||
* called after EconomyManager load
|
||||
*/
|
||||
public static void setupConfig() {
|
||||
config.load();
|
||||
config.setAutoremove(true).setAutosave(true);
|
||||
|
||||
config.saveChanges();
|
||||
}
|
||||
}
|
||||
package com.songoda.ultimatestacker.settings;
|
||||
|
||||
import com.songoda.core.configuration.Config;
|
||||
import com.songoda.core.configuration.ConfigSetting;
|
||||
import com.songoda.ultimatestacker.UltimateStacker;
|
||||
import com.songoda.ultimatestacker.entity.Check;
|
||||
import com.songoda.ultimatestacker.entity.Split;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class Settings {
|
||||
|
||||
static final Config config = UltimateStacker.getInstance().getConfig().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.",
|
||||
"It is advised to keep this number low.");
|
||||
|
||||
public static final ConfigSetting DISABLED_WORLDS = new ConfigSetting(config, "Main.Disabled Worlds", Arrays.asList("World1", "World2", "World3"),
|
||||
"Worlds that stacking doesn't happen in.");
|
||||
|
||||
// Note: this setting is also referenced in EpicSpawners
|
||||
public static final ConfigSetting STACK_ENTITIES = new ConfigSetting(config, "Entities.Enabled", true,
|
||||
"Should entities be stacked?");
|
||||
|
||||
public static final ConfigSetting NAME_FORMAT_ENTITY = new ConfigSetting(config, "Entities.Name Format", "&f{TYPE} &6{AMT}x",
|
||||
"The text displayed above an entities head where {TYPE} refers to",
|
||||
"The entities type and {AMT} is the amount currently stacked.");
|
||||
|
||||
public static final ConfigSetting SEARCH_RADIUS = new ConfigSetting(config, "Entities.Search Radius", 5,
|
||||
"The distance entities must be to each other in order to stack.");
|
||||
|
||||
public static final ConfigSetting MAX_STACK_ENTITIES = new ConfigSetting(config, "Entities.Max Stack Size", 15,
|
||||
"The max amount of entities in a single stack.");
|
||||
|
||||
// Note: this setting is also referenced in EpicSpawners
|
||||
public static final ConfigSetting MIN_STACK_ENTITIES = new ConfigSetting(config, "Entities.Min Stack Amount", 5,
|
||||
"The minimum amount required before a stack can be formed.",
|
||||
"Do not set this to lower than 2.");
|
||||
|
||||
public static final ConfigSetting MAX_PER_TYPE_STACKS_PER_CHUNK = new ConfigSetting(config, "Entities.Max Per Type Stacks Per Chunk", -1,
|
||||
"The maximum amount of each entity type stack allowed in a chunk.");
|
||||
|
||||
public static final ConfigSetting STACK_WHOLE_CHUNK = new ConfigSetting(config, "Entities.Stack Whole Chunk", false,
|
||||
"Should all qualifying entities in each chunk be stacked?",
|
||||
"This will override the stacking radius.");
|
||||
|
||||
public static final ConfigSetting ENTITY_HOLOGRAMS = new ConfigSetting(config, "Entities.Holograms Enabled", true,
|
||||
"Should holograms be displayed above stacked entities?");
|
||||
|
||||
public static final ConfigSetting HOLOGRAMS_ON_LOOK_ENTITY = new ConfigSetting(config, "Entities.Only Show Holograms On Look", false,
|
||||
"Only show nametags above an entities head when looking directly at them.");
|
||||
|
||||
public static final ConfigSetting CUSTOM_DROPS = new ConfigSetting(config, "Entities.Custom Drops.Enabled", true,
|
||||
"Should custom drops be enabled?");
|
||||
|
||||
public static final ConfigSetting REROLL = new ConfigSetting(config, "Entities.Custom Drops.Reroll", true,
|
||||
"Increases chance of uncommon drops by making a second attempt to",
|
||||
"drop if the original attempt failed (Requires the looting enchantment).",
|
||||
"This is a default Minecraft mechanic.");
|
||||
|
||||
public static final ConfigSetting KILL_WHOLE_STACK_ON_DEATH = new ConfigSetting(config, "Entities.Kill Whole Stack On Death", false,
|
||||
"Should killing a stack of entities kill the whole stack or",
|
||||
"just one out of the stack? If you want only certain entities to be",
|
||||
"effected by this you can configure it in the entities.yml");
|
||||
|
||||
public static final ConfigSetting CLEAR_LAG = new ConfigSetting(config, "Entities.Clear Lag", false,
|
||||
"When enabled, the plugin will hook into ClearLag and extend the",
|
||||
"clear task to include stacked entities from this plugin. If this is enabled",
|
||||
"the built in task will not run.");
|
||||
|
||||
public static final ConfigSetting INSTANT_KILL = new ConfigSetting(config, "Entities.Instant Kill", Arrays.asList("FALL", "DROWNING", "LAVA", "VOID"),
|
||||
"Events that will trigger an entire stack to be killed.",
|
||||
"It should be noted that this is useless if the above setting is true.",
|
||||
"Any of the following can be added to the list:",
|
||||
"CONTACT, ENTITY_ATTACK, ENTITY_SWEEP_ATTACK, PROJECTILE",
|
||||
"SUFFOCATION, FALL, FIRE, FIRE_TICK",
|
||||
"MELTING, LAVA, DROWNING, BLOCK_EXPLOSION",
|
||||
"ENTITY_EXPLOSION, VOID, LIGHTNING, SUICIDE",
|
||||
"STARVATION, POISON, MAGIC, WITHER",
|
||||
"FALLING_BLOCK, THORNS, DRAGON_BREATH, CUSTOM",
|
||||
"FLY_INTO_WALL, HOT_FLOOR, CRAMMING, DRYOUT");
|
||||
|
||||
public static final ConfigSetting NO_EXP_INSTANT_KILL = new ConfigSetting(config, "Entities.No Exp For Instant Kills", false,
|
||||
"Should no experience be dropped when an instant kill is performed?");
|
||||
|
||||
public static final ConfigSetting STACK_CHECKS = new ConfigSetting(config, "Entities.Stack Checks", Arrays.asList(Check.values()).stream()
|
||||
.filter(Check::isEnabledByDefault).map(Check::name).collect(Collectors.toList()),
|
||||
"These are checks that are processed before an entity is stacked.",
|
||||
"You can add and remove from the list at will.",
|
||||
"The acceptable check options are:",
|
||||
"SPAWN_REASON, NERFED, AGE, TICK_AGE, PHANTOM_SIZE",
|
||||
"IS_TAMED, ANIMAL_OWNER, SKELETON_TYPE",
|
||||
"ZOMBIE_BABY, SLIME_SIZE, PIG_SADDLE, SHEEP_SHEERED",
|
||||
"SHEEP_COLOR, WOLF_COLLAR_COLOR, OCELOT_TYPE, HORSE_COLOR",
|
||||
"HORSE_STYLE, HORSE_CARRYING_CHEST, HORSE_HAS_ARMOR",
|
||||
"HORSE_HAS_SADDLE, HORSE_JUMP, RABBIT_TYPE, VILLAGER_PROFESSION",
|
||||
"LLAMA_COLOR, LLAMA_STRENGTH, PARROT_TYPE, PUFFERFISH_STATE",
|
||||
"TROPICALFISH_PATTERN, TROPICALFISH_BODY_COLOR, TROPICALFISH_PATTERN_COLOR");
|
||||
|
||||
public static final ConfigSetting SPLIT_CHECKS = new ConfigSetting(config, "Entities.Split Checks", Arrays.asList(Split.values()).stream()
|
||||
.map(Split::name).collect(Collectors.toList()),
|
||||
"These are checks that when achieved will break separate a single entity",
|
||||
"from a stack.");
|
||||
|
||||
public static final ConfigSetting KEEP_FIRE = new ConfigSetting(config, "Entities.Keep Fire", true,
|
||||
"Should fire ticks persist to the next entity when an entity dies?");
|
||||
|
||||
public static final ConfigSetting KEEP_POTION = new ConfigSetting(config, "Entities.Keep Potion Effects", true,
|
||||
"Should potion effects persist to the next entity when an entity dies?");
|
||||
|
||||
public static final ConfigSetting CARRY_OVER_LOWEST_HEALTH = new ConfigSetting(config, "Entities.Carry Over Lowest Health", false,
|
||||
"Should the lowest health be carried over when stacked?",
|
||||
"This should not be used in collaboration with 'Stack Entity Health'.",
|
||||
"If it is used this setting will be overrode.");
|
||||
|
||||
public static final ConfigSetting ONLY_STACK_FROM_SPAWNERS = new ConfigSetting(config, "Entities.Only Stack From Spawners", false,
|
||||
"Should entities only be stacked if they originate from a spawner?",
|
||||
"It should be noted that the identifier that tells the plugin",
|
||||
"if the entity originated from a spawner or not is wiped on",
|
||||
"server restart.");
|
||||
|
||||
public static final ConfigSetting STACK_REASONS = new ConfigSetting(config, "Entities.Stack Reasons", Arrays.asList(),
|
||||
"This will limit mob stacking to mobs who spawned via the listed reasons.",
|
||||
"This list is ignored if Only Stack From Spawners = true.",
|
||||
"The following reasons can be added to the list:",
|
||||
"NATURAL, JOCKEY, CHUNK_GEN, SPAWNER, EGG, SPAWNER_EGG, LIGHTNING, BUILD_SNOWMAN, ",
|
||||
"BUILD_IRONGOLEM, BUILD_WITHER, VILLAGE_DEFENSE, VILLAGE_INVASION, BREEDING,",
|
||||
"SLIME_SPLIT, REINFORCEMENTS, NETHER_PORTAL, DISPENSE_EGG, INFECTION,",
|
||||
"CURED, OCELOT_BABY, SILVERFISH_BLOCK, MOUNT, TRAP, ENDER_PEARL, ",
|
||||
"SHOULDER_ENTITY, DROWNED, SHEARED, EXPLOSION"
|
||||
);
|
||||
|
||||
public static final ConfigSetting CARRY_OVER_METADATA_ON_DEATH = new ConfigSetting(config, "Entities.Carry Over Metadata On Death", true,
|
||||
"With this enabled any metadata assigned from supported plugins such",
|
||||
"as EpicSpawners and mcMMO will be preserved when the entity is killed.");
|
||||
|
||||
public static final ConfigSetting ONLY_STACK_ON_SURFACE = new ConfigSetting(config, "Entities.Only Stack On Surface", true,
|
||||
"Should entities only be stacked if they are touching the ground",
|
||||
"or swimming? This does not effect flying entities.");
|
||||
|
||||
public static final ConfigSetting STACK_ENTITY_HEALTH = new ConfigSetting(config, "Entities.Stack Entity Health", true,
|
||||
"Should entity health be stacked? When enabled Entity stacks will",
|
||||
"remember the health of all entities inside of the stack. This",
|
||||
"works the best with 'Only Stack On Surface enabled' as entities",
|
||||
"falling out of grinders may stack before hitting the ground.");
|
||||
|
||||
public static final ConfigSetting ONLY_STACK_FLYING_DOWN = new ConfigSetting(config, "Entities.Only Stack Flying Down", true,
|
||||
"Should entities that fly only stack with entities that are lower on the",
|
||||
"Y axis. This is important for grinders so that flying entities don't continuously",
|
||||
"stack upwards to a higher up entity.");
|
||||
|
||||
public static final ConfigSetting REALISTIC_DAMAGE = new ConfigSetting(config, "Entities.Use Realistic Weapon Damage", true,
|
||||
"Should weapons take damage based on the amount of entites in the stack?");
|
||||
|
||||
public static final ConfigSetting STACK_ITEMS = new ConfigSetting(config, "Items.Enabled", true,
|
||||
"Should items be stacked?");
|
||||
|
||||
public static final ConfigSetting ITEM_HOLOGRAMS = new ConfigSetting(config, "Items.Holograms Enabled", true,
|
||||
"Should holograms be displayed above stacked items?");
|
||||
|
||||
public static final ConfigSetting ITEM_HOLOGRAM_SINGLE = new ConfigSetting(config, "Items.Show Hologram For Single", true,
|
||||
"Should holograms be displayed above items when there is only a single",
|
||||
"item in the stack?");
|
||||
|
||||
public static final ConfigSetting ITEM_HOLOGRAM_BLACKLIST = new ConfigSetting(config, "Items.Show Holograms For Blacklisted Items", true,
|
||||
"Should items that are blacklisted display holograms?");
|
||||
|
||||
public static final ConfigSetting MAX_STACK_ITEMS = new ConfigSetting(config, "Items.Max Stack Size", 512,
|
||||
"The max stack size for items.",
|
||||
"Currently this can only be set to a max of 120.");
|
||||
|
||||
public static final ConfigSetting NAME_FORMAT_ITEM = new ConfigSetting(config, "Items.Name Format", "&f{TYPE} &r[&6{AMT}x]",
|
||||
"The text displayed above a dropped item.");
|
||||
|
||||
public static final ConfigSetting NAME_FORMAT_RESET = new ConfigSetting(config, "Items.Name Format Reset", true,
|
||||
"Should color codes in dropped item names be removed?",
|
||||
"This is added only because it looks smoother in game. This is only visual and",
|
||||
"doesn't actually effect the item.");
|
||||
|
||||
public static final ConfigSetting ITEM_BLACKLIST = new ConfigSetting(config, "Items.Blacklist", Collections.singletonList("EGG"),
|
||||
"Items included in this list will stack to default Minecraft amounts.",
|
||||
"Material list: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html",
|
||||
"Leave this empty by using \"blacklist: []\" if you do not wish to disable",
|
||||
"stacking for any items.");
|
||||
|
||||
public static final ConfigSetting ITEM_WHITELIST = new ConfigSetting(config, "Items.Whitelist", Collections.EMPTY_LIST,
|
||||
"Items included in this whitelist will be stacked.",
|
||||
"Material list: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html",
|
||||
"Leave this empty by using \"whitelist: []\" if you want everything to be stacked.",
|
||||
"Items not in this list will act as if they are blacklisted.");
|
||||
|
||||
public static final ConfigSetting SHOW_STACK_SIZE_SINGLE = new ConfigSetting(config, "Items.Show Stack Size For Single", false,
|
||||
"When enabled stack sizes for a stack with a single item will",
|
||||
"not display the stack size. The stack size will be added",
|
||||
"for stacks containing two or more items.");
|
||||
|
||||
public static final ConfigSetting SPAWNERS_ENABLED = new ConfigSetting(config, "Spawners.Enabled", true,
|
||||
"Should spawners be stacked?");
|
||||
|
||||
public static final ConfigSetting SPAWNER_HOLOGRAMS = new ConfigSetting(config, "Spawners.Holograms Enabled", true,
|
||||
"Should holograms be displayed above stacked spawners?");
|
||||
|
||||
public static final ConfigSetting EGGS_CONVERT_SPAWNERS = new ConfigSetting(config, "Spawners.Eggs Convert Spawners", true,
|
||||
"Should eggs convert spawners? If enabled you will",
|
||||
"still need to give perms for it to work.");
|
||||
|
||||
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?");
|
||||
|
||||
public static final ConfigSetting SNEAK_FOR_STACK = new ConfigSetting(config, "Spawners.Sneak To Receive A Stacked Spawner", true,
|
||||
"Toggle ability to receive a stacked spawner when breaking a spawner while sneaking.");
|
||||
|
||||
public static final ConfigSetting SPAWNERS_DONT_EXPLODE = new ConfigSetting(config, "Spawners.Prevent Spawners From Exploding", false,
|
||||
"Should spawners not break when blown up?");
|
||||
|
||||
public static final ConfigSetting EXPLOSION_DROP_CHANCE_TNT = new ConfigSetting(config, "Spawners.Chance On TNT Explosion", "100%",
|
||||
"Chance of a TNT explosion dropping a spawner.");
|
||||
|
||||
public static final ConfigSetting EXPLOSION_DROP_CHANCE_CREEPER = new ConfigSetting(config, "Spawners.Chance On Creeper Explosion", "100%",
|
||||
"Chance of a creeper explosion dropping a spawner.");
|
||||
|
||||
public static final ConfigSetting NAME_FORMAT_SPAWNER = new ConfigSetting(config, "Spawners.Name Format", "&f{TYPE} Spawner &6{AMT}x",
|
||||
"The text displayed above a stacked spawner where {TYPE} refers to",
|
||||
"The entities type and {AMT} is the amount currently stacked.");
|
||||
|
||||
public static final ConfigSetting LANGUGE_MODE = new ConfigSetting(config, "System.Language Mode", "en_US",
|
||||
"The enabled language file.",
|
||||
"More language files (if available) can be found in the plugins data folder.");
|
||||
|
||||
public static final ConfigSetting MYSQL_ENABLED = new ConfigSetting(config, "MySQL.Enabled", false,
|
||||
"Set to 'true' to use MySQL instead of SQLite for data storage.");
|
||||
public static final ConfigSetting MYSQL_HOSTNAME = new ConfigSetting(config, "MySQL.Hostname", "localhost");
|
||||
public static final ConfigSetting MYSQL_PORT = new ConfigSetting(config, "MySQL.Port", 3306);
|
||||
public static final ConfigSetting MYSQL_DATABASE = new ConfigSetting(config, "MySQL.Database", "your-database");
|
||||
public static final ConfigSetting MYSQL_USERNAME = new ConfigSetting(config, "MySQL.Username", "user");
|
||||
public static final ConfigSetting MYSQL_PASSWORD = new ConfigSetting(config, "MySQL.Password", "pass");
|
||||
public static final ConfigSetting MYSQL_USE_SSL = new ConfigSetting(config, "MySQL.Use SSL", false);
|
||||
|
||||
/**
|
||||
* In order to set dynamic economy comment correctly, this needs to be
|
||||
* called after EconomyManager load
|
||||
*/
|
||||
public static void setupConfig() {
|
||||
config.load();
|
||||
config.setAutoremove(true).setAutosave(true);
|
||||
|
||||
config.saveChanges();
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@ package com.songoda.ultimatestacker.spawner;
|
||||
|
||||
import com.songoda.core.compatibility.ServerVersion;
|
||||
import com.songoda.ultimatestacker.UltimateStacker;
|
||||
import com.songoda.ultimatestacker.settings.Setting;
|
||||
import com.songoda.ultimatestacker.settings.Settings;
|
||||
import com.songoda.ultimatestacker.utils.Reflection;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
@ -34,7 +34,7 @@ public class SpawnerStack {
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(plugin, () -> {
|
||||
if (!(location.getBlock().getState() instanceof CreatureSpawner)) return;
|
||||
int count = Setting.STACK_ENTITIES.getBoolean()
|
||||
int count = Settings.STACK_ENTITIES.getBoolean()
|
||||
&& !plugin.getStackingTask().isWorldDisabled(location.getWorld()) ? 1 : calculateSpawnCount();
|
||||
int maxNearby = amount > 6 ? amount + 3 : 6;
|
||||
CreatureSpawner creatureSpawner = (CreatureSpawner) location.getBlock().getState();
|
||||
|
@ -3,7 +3,7 @@ package com.songoda.ultimatestacker.tasks;
|
||||
import com.songoda.ultimatestacker.UltimateStacker;
|
||||
import com.songoda.ultimatestacker.entity.EntityStack;
|
||||
import com.songoda.ultimatestacker.entity.EntityStackManager;
|
||||
import com.songoda.ultimatestacker.settings.Setting;
|
||||
import com.songoda.ultimatestacker.settings.Settings;
|
||||
import com.songoda.ultimatestacker.utils.Methods;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
@ -25,23 +25,23 @@ public class StackingTask extends BukkitRunnable {
|
||||
|
||||
private List<UUID> processed = new ArrayList<>();
|
||||
|
||||
private int maxEntityStackSize = Setting.MAX_STACK_ENTITIES.getInt();
|
||||
private int minEntityStackSize = Setting.MIN_STACK_ENTITIES.getInt();
|
||||
private int maxEntityStackSize = Settings.MAX_STACK_ENTITIES.getInt();
|
||||
private int minEntityStackSize = Settings.MIN_STACK_ENTITIES.getInt();
|
||||
|
||||
private int maxPerTypeStacksPerChunk = Setting.MAX_PER_TYPE_STACKS_PER_CHUNK.getInt();
|
||||
private int maxPerTypeStacksPerChunk = Settings.MAX_PER_TYPE_STACKS_PER_CHUNK.getInt();
|
||||
|
||||
public StackingTask(UltimateStacker plugin) {
|
||||
this.plugin = plugin;
|
||||
this.stackManager = plugin.getEntityStackManager();
|
||||
|
||||
// Start stacking task.
|
||||
runTaskTimer(plugin, 0, Setting.STACK_SEARCH_TICK_SPEED.getInt());
|
||||
runTaskTimer(plugin, 0, Settings.STACK_SEARCH_TICK_SPEED.getInt());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
// Should entities be stacked?
|
||||
if (!Setting.STACK_ENTITIES.getBoolean()) return;
|
||||
if (!Settings.STACK_ENTITIES.getBoolean()) return;
|
||||
|
||||
// Loop through each world.
|
||||
for (World world : Bukkit.getWorlds()) {
|
||||
@ -76,7 +76,7 @@ public class StackingTask extends BukkitRunnable {
|
||||
}
|
||||
|
||||
public boolean isWorldDisabled(World world) {
|
||||
List<String> disabledWorlds = Setting.DISABLED_WORLDS.getStringList();
|
||||
List<String> disabledWorlds = Settings.DISABLED_WORLDS.getStringList();
|
||||
return disabledWorlds.stream().anyMatch(worldStr -> world.getName().equalsIgnoreCase(worldStr));
|
||||
}
|
||||
|
||||
@ -96,11 +96,11 @@ public class StackingTask extends BukkitRunnable {
|
||||
// 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;
|
||||
List<String> stackReasons;
|
||||
if (Setting.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 (!"SPAWNER".equals(spawnReason))
|
||||
return false;
|
||||
} else if (!(stackReasons = Setting.STACK_REASONS.getStringList()).isEmpty() && !stackReasons.contains(spawnReason))
|
||||
} else if (!(stackReasons = Settings.STACK_REASONS.getStringList()).isEmpty() && !stackReasons.contains(spawnReason))
|
||||
// Only stack if on the list of events to stack
|
||||
return false;
|
||||
|
||||
@ -108,7 +108,7 @@ public class StackingTask extends BukkitRunnable {
|
||||
LivingEntity livingEntity = (LivingEntity) entity;
|
||||
|
||||
// If only stack on surface is enabled make sure the entity is on a surface then entity is stackable.
|
||||
return !Setting.ONLY_STACK_ON_SURFACE.getBoolean()
|
||||
return !Settings.ONLY_STACK_ON_SURFACE.getBoolean()
|
||||
|| Methods.canFly(livingEntity)
|
||||
|| entity.getType().name().equals("SHULKER")
|
||||
|| (livingEntity.isOnGround() || location.getBlock().isLiquid());
|
||||
@ -169,7 +169,7 @@ public class StackingTask extends BukkitRunnable {
|
||||
|
||||
|
||||
fixHealth(entity, livingEntity);
|
||||
if (Setting.STACK_ENTITY_HEALTH.getBoolean())
|
||||
if (Settings.STACK_ENTITY_HEALTH.getBoolean())
|
||||
entity.setHealth(entity.getMaxHealth() < livingEntity.getHealth()
|
||||
? entity.getMaxHealth() : livingEntity.getHealth());
|
||||
|
||||
@ -183,7 +183,7 @@ public class StackingTask extends BukkitRunnable {
|
||||
&& isStack
|
||||
&& (stack.getAmount() + 1) <= maxEntityStackSize
|
||||
&& Methods.canFly(entity)
|
||||
&& Setting.ONLY_STACK_FLYING_DOWN.getBoolean()
|
||||
&& Settings.ONLY_STACK_FLYING_DOWN.getBoolean()
|
||||
&& location.getY() > entity.getLocation().getY()) {
|
||||
|
||||
// Create a new stack with the current stacks amount and add one to it.
|
||||
@ -193,7 +193,7 @@ public class StackingTask extends BukkitRunnable {
|
||||
newStack.mergeHealth(stack);
|
||||
newStack.addHealth(livingEntity.getHealth());
|
||||
fixHealth(livingEntity, entity);
|
||||
if (Setting.STACK_ENTITY_HEALTH.getBoolean())
|
||||
if (Settings.STACK_ENTITY_HEALTH.getBoolean())
|
||||
entity.setHealth(entity.getHealth());
|
||||
|
||||
// Remove our entities stack from the stack manager.
|
||||
@ -259,7 +259,7 @@ public class StackingTask extends BukkitRunnable {
|
||||
}
|
||||
|
||||
private void updateHealth(EntityStack stack) {
|
||||
if (Setting.STACK_ENTITY_HEALTH.getBoolean())
|
||||
if (Settings.STACK_ENTITY_HEALTH.getBoolean())
|
||||
stack.updateHealth(stack.getEntity());
|
||||
}
|
||||
|
||||
@ -285,7 +285,7 @@ public class StackingTask extends BukkitRunnable {
|
||||
|
||||
|
||||
private void fixHealth(LivingEntity entity, LivingEntity initialEntity) {
|
||||
if (!Setting.STACK_ENTITY_HEALTH.getBoolean() && Setting.CARRY_OVER_LOWEST_HEALTH.getBoolean() && initialEntity.getHealth() < entity.getHealth())
|
||||
if (!Settings.STACK_ENTITY_HEALTH.getBoolean() && Settings.CARRY_OVER_LOWEST_HEALTH.getBoolean() && initialEntity.getHealth() < entity.getHealth())
|
||||
entity.setHealth(initialEntity.getHealth());
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ import com.songoda.core.compatibility.ServerVersion;
|
||||
import com.songoda.ultimatestacker.UltimateStacker;
|
||||
import com.songoda.ultimatestacker.entity.Check;
|
||||
import com.songoda.ultimatestacker.entity.EntityStack;
|
||||
import com.songoda.ultimatestacker.settings.Setting;
|
||||
import com.songoda.ultimatestacker.settings.Settings;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
@ -17,12 +17,12 @@ public class EntityUtils {
|
||||
|
||||
UltimateStacker plugin = UltimateStacker.getInstance();
|
||||
|
||||
private List<String> checks = Setting.STACK_CHECKS.getStringList();
|
||||
private boolean stackFlyingDown = Setting.ONLY_STACK_FLYING_DOWN.getBoolean();
|
||||
private boolean keepFire = Setting.KEEP_FIRE.getBoolean();
|
||||
private boolean keepPotion = Setting.KEEP_POTION.getBoolean();
|
||||
private boolean stackWholeChunk = Setting.STACK_WHOLE_CHUNK.getBoolean();
|
||||
private int searchRadius = Setting.SEARCH_RADIUS.getInt();
|
||||
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 Map<CachedChunk, Entity[]> cachedChunks = new HashMap<>();
|
||||
|
||||
|
@ -4,7 +4,7 @@ import com.songoda.core.compatibility.LegacyMaterials;
|
||||
import com.songoda.core.compatibility.ServerVersion;
|
||||
import com.songoda.core.utils.TextUtils;
|
||||
import com.songoda.ultimatestacker.UltimateStacker;
|
||||
import com.songoda.ultimatestacker.settings.Setting;
|
||||
import com.songoda.ultimatestacker.settings.Settings;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@ -91,18 +91,18 @@ public class Methods {
|
||||
}
|
||||
|
||||
public static String compileItemName(ItemStack item, int amount) {
|
||||
String nameFormat = Setting.NAME_FORMAT_ITEM.getString();
|
||||
String nameFormat = Settings.NAME_FORMAT_ITEM.getString();
|
||||
String displayName = Methods.formatText(UltimateStacker.getInstance().getItemFile()
|
||||
.getString("Items." + item.getType().name() + ".Display Name"));
|
||||
|
||||
if (item.hasItemMeta() && item.getItemMeta().hasDisplayName())
|
||||
displayName = Setting.NAME_FORMAT_RESET.getBoolean() ?
|
||||
displayName = Settings.NAME_FORMAT_RESET.getBoolean() ?
|
||||
ChatColor.stripColor(item.getItemMeta().getDisplayName()) : item.getItemMeta().getDisplayName();
|
||||
|
||||
nameFormat = nameFormat.replace("{TYPE}", displayName);
|
||||
nameFormat = nameFormat.replace("{AMT}", Integer.toString(amount));
|
||||
|
||||
if (amount == 1 && !Setting.SHOW_STACK_SIZE_SINGLE.getBoolean()) {
|
||||
if (amount == 1 && !Settings.SHOW_STACK_SIZE_SINGLE.getBoolean()) {
|
||||
nameFormat = nameFormat.replaceAll("\\[.*?]", "");
|
||||
} else {
|
||||
nameFormat = nameFormat.replace("[", "").replace("]", "");
|
||||
@ -141,7 +141,7 @@ public class Methods {
|
||||
}
|
||||
|
||||
public static String compileEntityName(Entity entity, int amount) {
|
||||
String nameFormat = Setting.NAME_FORMAT_ENTITY.getString();
|
||||
String nameFormat = Settings.NAME_FORMAT_ENTITY.getString();
|
||||
String displayName = Methods.formatText(UltimateStacker.getInstance().getMobFile().getString("Mobs." + entity.getType().name() + ".Display Name"));
|
||||
|
||||
nameFormat = nameFormat.replace("{TYPE}", displayName);
|
||||
|
Loading…
Reference in New Issue
Block a user