mirror of
https://github.com/songoda/UltimateStacker.git
synced 2024-11-27 04:25:21 +01:00
Correct capitalization of class name UltimateStackerAPI
to -Api
This commit is contained in:
parent
3bb424d594
commit
f3dc65664f
@ -45,7 +45,7 @@
|
|||||||
<injections>
|
<injections>
|
||||||
<injection>
|
<injection>
|
||||||
<value>${project.version}</value>
|
<value>${project.version}</value>
|
||||||
<pointCut>com.craftaro.ultimatestacker.api.UltimateStackerAPI.getVersion</pointCut>
|
<pointCut>com.craftaro.ultimatestacker.api.UltimateStackerApi.getVersion</pointCut>
|
||||||
</injection>
|
</injection>
|
||||||
</injections>
|
</injections>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
@ -4,15 +4,14 @@ import com.craftaro.ultimatestacker.api.stack.block.BlockStackManager;
|
|||||||
import com.craftaro.ultimatestacker.api.stack.entity.EntityStackManager;
|
import com.craftaro.ultimatestacker.api.stack.entity.EntityStackManager;
|
||||||
import com.craftaro.ultimatestacker.api.stack.item.StackedItemManager;
|
import com.craftaro.ultimatestacker.api.stack.item.StackedItemManager;
|
||||||
import com.craftaro.ultimatestacker.api.stack.spawner.SpawnerStackManager;
|
import com.craftaro.ultimatestacker.api.stack.spawner.SpawnerStackManager;
|
||||||
import com.craftaro.core.hooks.stackers.UltimateStacker;
|
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The main class of the API
|
* The main class of the API
|
||||||
* <p>
|
* <p>
|
||||||
* <b>!! {@link UltimateStackerAPI#getVersion()} value is automatically replaced by maven don't change it !!</b>
|
* <b>!! {@link UltimateStackerApi#getVersion()} value is automatically replaced by maven don't change it !!</b>
|
||||||
*/
|
*/
|
||||||
public final class UltimateStackerAPI {
|
public final class UltimateStackerApi {
|
||||||
|
|
||||||
private static Plugin plugin;
|
private static Plugin plugin;
|
||||||
private static EntityStackManager entityStackManager;
|
private static EntityStackManager entityStackManager;
|
||||||
@ -20,22 +19,22 @@ public final class UltimateStackerAPI {
|
|||||||
private static SpawnerStackManager spawnerStackManager;
|
private static SpawnerStackManager spawnerStackManager;
|
||||||
private static BlockStackManager blockStackManager;
|
private static BlockStackManager blockStackManager;
|
||||||
private static Settings settings;
|
private static Settings settings;
|
||||||
private static UltimateStackerAPI instance;
|
private static UltimateStackerApi instance;
|
||||||
|
|
||||||
public UltimateStackerAPI(Plugin plugin, EntityStackManager entityStackManager, StackedItemManager itemStackManager, SpawnerStackManager spawnerStackManager, BlockStackManager blockStackManager, Settings settings) {
|
public UltimateStackerApi(Plugin plugin, EntityStackManager entityStackManager, StackedItemManager itemStackManager, SpawnerStackManager spawnerStackManager, BlockStackManager blockStackManager, Settings settings) {
|
||||||
if (UltimateStackerAPI.plugin != null || UltimateStackerAPI.entityStackManager != null || UltimateStackerAPI.stackedItemManager != null || UltimateStackerAPI.spawnerStackManager != null || UltimateStackerAPI.blockStackManager != null || UltimateStackerAPI.settings != null) {
|
if (UltimateStackerApi.plugin != null || UltimateStackerApi.entityStackManager != null || UltimateStackerApi.stackedItemManager != null || UltimateStackerApi.spawnerStackManager != null || UltimateStackerApi.blockStackManager != null || UltimateStackerApi.settings != null) {
|
||||||
throw new IllegalStateException("UltimateStackerAPI has already been initialized!");
|
throw new IllegalStateException("UltimateStackerAPI has already been initialized!");
|
||||||
}
|
}
|
||||||
UltimateStackerAPI.plugin = plugin;
|
UltimateStackerApi.plugin = plugin;
|
||||||
UltimateStackerAPI.entityStackManager = entityStackManager;
|
UltimateStackerApi.entityStackManager = entityStackManager;
|
||||||
UltimateStackerAPI.stackedItemManager = itemStackManager;
|
UltimateStackerApi.stackedItemManager = itemStackManager;
|
||||||
UltimateStackerAPI.spawnerStackManager = spawnerStackManager;
|
UltimateStackerApi.spawnerStackManager = spawnerStackManager;
|
||||||
UltimateStackerAPI.blockStackManager = blockStackManager;
|
UltimateStackerApi.blockStackManager = blockStackManager;
|
||||||
UltimateStackerAPI.settings = settings;
|
UltimateStackerApi.settings = settings;
|
||||||
instance = this;
|
instance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UltimateStackerAPI getInstance() {
|
public static UltimateStackerApi getInstance() {
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
package com.craftaro.ultimatestacker;
|
package com.craftaro.ultimatestacker;
|
||||||
|
|
||||||
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
|
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
|
||||||
import com.craftaro.ultimatestacker.api.UltimateStackerAPI;
|
import com.craftaro.ultimatestacker.api.UltimateStackerApi;
|
||||||
import com.craftaro.ultimatestacker.api.stack.block.BlockStack;
|
import com.craftaro.ultimatestacker.api.stack.block.BlockStack;
|
||||||
import com.craftaro.ultimatestacker.api.stack.block.BlockStackManager;
|
import com.craftaro.ultimatestacker.api.stack.block.BlockStackManager;
|
||||||
import com.craftaro.ultimatestacker.api.stack.entity.EntityStack;
|
import com.craftaro.ultimatestacker.api.stack.entity.EntityStack;
|
||||||
@ -51,7 +51,6 @@ import com.craftaro.ultimatestacker.utils.Async;
|
|||||||
import com.craftaro.core.SongodaCore;
|
import com.craftaro.core.SongodaCore;
|
||||||
import com.craftaro.core.SongodaPlugin;
|
import com.craftaro.core.SongodaPlugin;
|
||||||
import com.craftaro.core.commands.CommandManager;
|
import com.craftaro.core.commands.CommandManager;
|
||||||
import com.craftaro.core.compatibility.CompatibleMaterial;
|
|
||||||
import com.craftaro.core.compatibility.ServerVersion;
|
import com.craftaro.core.compatibility.ServerVersion;
|
||||||
import com.craftaro.core.configuration.Config;
|
import com.craftaro.core.configuration.Config;
|
||||||
import com.craftaro.core.database.DataManager;
|
import com.craftaro.core.database.DataManager;
|
||||||
@ -96,7 +95,7 @@ public class UltimateStacker extends SongodaPlugin {
|
|||||||
private CommandManager commandManager;
|
private CommandManager commandManager;
|
||||||
private CustomEntityManager customEntityManager;
|
private CustomEntityManager customEntityManager;
|
||||||
private StackingTask stackingTask;
|
private StackingTask stackingTask;
|
||||||
private UltimateStackerAPI API;
|
private UltimateStackerApi API;
|
||||||
|
|
||||||
public static UltimateStacker getInstance() {
|
public static UltimateStacker getInstance() {
|
||||||
return INSTANCE;
|
return INSTANCE;
|
||||||
@ -226,7 +225,7 @@ public class UltimateStacker extends SongodaPlugin {
|
|||||||
|
|
||||||
initDatabase(Arrays.asList(new _1_InitialMigration(), new _2_EntityStacks(), new _3_BlockStacks(), new _6_RemoveStackedEntityTable()));
|
initDatabase(Arrays.asList(new _1_InitialMigration(), new _2_EntityStacks(), new _3_BlockStacks(), new _6_RemoveStackedEntityTable()));
|
||||||
|
|
||||||
API = new UltimateStackerAPI(this, entityStackManager, stackedItemManager, spawnerStackManager, blockStackManager, new Settings());
|
API = new UltimateStackerApi(this, entityStackManager, stackedItemManager, spawnerStackManager, blockStackManager, new Settings());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -263,7 +262,7 @@ public class UltimateStacker extends SongodaPlugin {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public UltimateStackerAPI getAPI() {
|
public UltimateStackerApi getAPI() {
|
||||||
return API;
|
return API;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ package com.craftaro.ultimatestacker.convert;
|
|||||||
import com.bgsoftware.wildstacker.api.WildStackerAPI;
|
import com.bgsoftware.wildstacker.api.WildStackerAPI;
|
||||||
import com.bgsoftware.wildstacker.api.objects.StackedSpawner;
|
import com.bgsoftware.wildstacker.api.objects.StackedSpawner;
|
||||||
import com.craftaro.ultimatestacker.UltimateStacker;
|
import com.craftaro.ultimatestacker.UltimateStacker;
|
||||||
import com.craftaro.ultimatestacker.api.UltimateStackerAPI;
|
import com.craftaro.ultimatestacker.api.UltimateStackerApi;
|
||||||
import com.craftaro.ultimatestacker.api.stack.spawner.SpawnerStack;
|
import com.craftaro.ultimatestacker.api.stack.spawner.SpawnerStack;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.block.CreatureSpawner;
|
import org.bukkit.block.CreatureSpawner;
|
||||||
@ -42,7 +42,7 @@ public class WildStackerConvert implements Convert {
|
|||||||
@Override
|
@Override
|
||||||
public void convertSpawners() {
|
public void convertSpawners() {
|
||||||
for (StackedSpawner spawner : WildStackerAPI.getWildStacker().getSystemManager().getStackedSpawners()) {
|
for (StackedSpawner spawner : WildStackerAPI.getWildStacker().getSystemManager().getStackedSpawners()) {
|
||||||
SpawnerStack stack = UltimateStackerAPI.getSpawnerStackManager().getSpawner(spawner.getLocation());
|
SpawnerStack stack = UltimateStackerApi.getSpawnerStackManager().getSpawner(spawner.getLocation());
|
||||||
|
|
||||||
stack.setAmount(WildStackerAPI
|
stack.setAmount(WildStackerAPI
|
||||||
.getSpawnersAmount((CreatureSpawner) spawner.getLocation().getBlock().getState()));
|
.getSpawnersAmount((CreatureSpawner) spawner.getLocation().getBlock().getState()));
|
||||||
|
@ -2,7 +2,7 @@ package com.craftaro.ultimatestacker.listeners;
|
|||||||
|
|
||||||
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
|
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
|
||||||
import com.craftaro.ultimatestacker.UltimateStacker;
|
import com.craftaro.ultimatestacker.UltimateStacker;
|
||||||
import com.craftaro.ultimatestacker.api.UltimateStackerAPI;
|
import com.craftaro.ultimatestacker.api.UltimateStackerApi;
|
||||||
import com.craftaro.ultimatestacker.api.events.spawner.SpawnerBreakEvent;
|
import com.craftaro.ultimatestacker.api.events.spawner.SpawnerBreakEvent;
|
||||||
import com.craftaro.ultimatestacker.api.events.spawner.SpawnerPlaceEvent;
|
import com.craftaro.ultimatestacker.api.events.spawner.SpawnerPlaceEvent;
|
||||||
import com.craftaro.ultimatestacker.api.stack.block.BlockStack;
|
import com.craftaro.ultimatestacker.api.stack.block.BlockStack;
|
||||||
@ -12,7 +12,6 @@ import com.craftaro.ultimatestacker.settings.Settings;
|
|||||||
import com.craftaro.ultimatestacker.stackable.spawner.SpawnerStackImpl;
|
import com.craftaro.ultimatestacker.stackable.spawner.SpawnerStackImpl;
|
||||||
import com.craftaro.ultimatestacker.utils.Methods;
|
import com.craftaro.ultimatestacker.utils.Methods;
|
||||||
import com.craftaro.core.compatibility.CompatibleHand;
|
import com.craftaro.core.compatibility.CompatibleHand;
|
||||||
import com.craftaro.core.compatibility.CompatibleMaterial;
|
|
||||||
import com.craftaro.core.hooks.ProtectionManager;
|
import com.craftaro.core.hooks.ProtectionManager;
|
||||||
import com.craftaro.core.third_party.de.tr7zw.nbtapi.NBTItem;
|
import com.craftaro.core.third_party.de.tr7zw.nbtapi.NBTItem;
|
||||||
import org.apache.commons.lang.math.NumberUtils;
|
import org.apache.commons.lang.math.NumberUtils;
|
||||||
@ -180,7 +179,7 @@ public class BlockListeners implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
if (itemType == blockType) {
|
if (itemType == blockType) {
|
||||||
SpawnerStack stack = UltimateStackerAPI.getSpawnerStackManager().getSpawner(block);
|
SpawnerStack stack = UltimateStackerApi.getSpawnerStackManager().getSpawner(block);
|
||||||
if (player.isSneaking()) return;
|
if (player.isSneaking()) return;
|
||||||
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||||
if (stack.getAmount() == maxStackSize) return;
|
if (stack.getAmount() == maxStackSize) return;
|
||||||
@ -235,7 +234,7 @@ public class BlockListeners implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SpawnerStack stack = UltimateStackerAPI.getSpawnerStackManager().addSpawner(new SpawnerStackImpl(block.getLocation(), amount));
|
SpawnerStack stack = UltimateStackerApi.getSpawnerStackManager().addSpawner(new SpawnerStackImpl(block.getLocation(), amount));
|
||||||
plugin.getPluginDataManager().save(stack);
|
plugin.getPluginDataManager().save(stack);
|
||||||
|
|
||||||
cs.setSpawnedType(cs2.getSpawnedType());
|
cs.setSpawnedType(cs2.getSpawnedType());
|
||||||
@ -260,7 +259,7 @@ public class BlockListeners implements Listener {
|
|||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
ItemStack item = player.getInventory().getItemInHand();
|
ItemStack item = player.getInventory().getItemInHand();
|
||||||
|
|
||||||
SpawnerStack stack = UltimateStackerAPI.getSpawnerStackManager().getSpawner(block);
|
SpawnerStack stack = UltimateStackerApi.getSpawnerStackManager().getSpawner(block);
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
@ -282,7 +281,7 @@ public class BlockListeners implements Listener {
|
|||||||
if (remove) {
|
if (remove) {
|
||||||
event.setCancelled(false);
|
event.setCancelled(false);
|
||||||
plugin.removeHologram(stack);
|
plugin.removeHologram(stack);
|
||||||
SpawnerStack spawnerStack = UltimateStackerAPI.getSpawnerStackManager().removeSpawner(block.getLocation());
|
SpawnerStack spawnerStack = UltimateStackerApi.getSpawnerStackManager().removeSpawner(block.getLocation());
|
||||||
plugin.getPluginDataManager().delete(spawnerStack);
|
plugin.getPluginDataManager().delete(spawnerStack);
|
||||||
} else {
|
} else {
|
||||||
stack.setAmount(stack.getAmount() - 1);
|
stack.setAmount(stack.getAmount() - 1);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.craftaro.ultimatestacker.listeners;
|
package com.craftaro.ultimatestacker.listeners;
|
||||||
|
|
||||||
import com.craftaro.ultimatestacker.UltimateStacker;
|
import com.craftaro.ultimatestacker.UltimateStacker;
|
||||||
import com.craftaro.ultimatestacker.api.UltimateStackerAPI;
|
import com.craftaro.ultimatestacker.api.UltimateStackerApi;
|
||||||
import com.craftaro.ultimatestacker.api.stack.spawner.SpawnerStack;
|
import com.craftaro.ultimatestacker.api.stack.spawner.SpawnerStack;
|
||||||
import com.craftaro.ultimatestacker.api.stack.spawner.SpawnerStackManager;
|
import com.craftaro.ultimatestacker.api.stack.spawner.SpawnerStackManager;
|
||||||
import com.craftaro.ultimatestacker.settings.Settings;
|
import com.craftaro.ultimatestacker.settings.Settings;
|
||||||
@ -44,7 +44,7 @@ public class SpawnerListeners implements Listener {
|
|||||||
if (!plugin.spawnersEnabled()
|
if (!plugin.spawnersEnabled()
|
||||||
|| plugin.getStackingTask().isWorldDisabled(event.getLocation().getWorld())) return;
|
|| plugin.getStackingTask().isWorldDisabled(event.getLocation().getWorld())) return;
|
||||||
|
|
||||||
SpawnerStackManager spawnerStackManager = UltimateStackerAPI.getSpawnerStackManager();
|
SpawnerStackManager spawnerStackManager = UltimateStackerApi.getSpawnerStackManager();
|
||||||
if (!spawnerStackManager.isSpawner(event.getSpawner().getLocation())) return;
|
if (!spawnerStackManager.isSpawner(event.getSpawner().getLocation())) return;
|
||||||
|
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
@ -110,7 +110,7 @@ public class SpawnerListeners implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SpawnerStackManager manager = UltimateStackerAPI.getSpawnerStackManager();
|
SpawnerStackManager manager = UltimateStackerApi.getSpawnerStackManager();
|
||||||
|
|
||||||
SpawnerStack spawner = manager.isSpawner(block.getLocation())
|
SpawnerStack spawner = manager.isSpawner(block.getLocation())
|
||||||
? manager.getSpawner(block) : manager.addSpawner(new SpawnerStackImpl(block.getLocation(), 1));
|
? manager.getSpawner(block) : manager.addSpawner(new SpawnerStackImpl(block.getLocation(), 1));
|
||||||
|
@ -2,14 +2,13 @@ package com.craftaro.ultimatestacker.listeners.entity;
|
|||||||
|
|
||||||
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
|
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
|
||||||
import com.craftaro.ultimatestacker.UltimateStacker;
|
import com.craftaro.ultimatestacker.UltimateStacker;
|
||||||
import com.craftaro.ultimatestacker.api.UltimateStackerAPI;
|
import com.craftaro.ultimatestacker.api.UltimateStackerApi;
|
||||||
import com.craftaro.ultimatestacker.api.stack.entity.EntityStack;
|
import com.craftaro.ultimatestacker.api.stack.entity.EntityStack;
|
||||||
import com.craftaro.ultimatestacker.api.stack.entity.EntityStackManager;
|
import com.craftaro.ultimatestacker.api.stack.entity.EntityStackManager;
|
||||||
import com.craftaro.ultimatestacker.api.stack.item.StackedItem;
|
import com.craftaro.ultimatestacker.api.stack.item.StackedItem;
|
||||||
import com.craftaro.ultimatestacker.api.stack.spawner.SpawnerStack;
|
import com.craftaro.ultimatestacker.api.stack.spawner.SpawnerStack;
|
||||||
import com.craftaro.ultimatestacker.settings.Settings;
|
import com.craftaro.ultimatestacker.settings.Settings;
|
||||||
import com.craftaro.ultimatestacker.utils.Methods;
|
import com.craftaro.ultimatestacker.utils.Methods;
|
||||||
import com.craftaro.core.compatibility.CompatibleMaterial;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -73,7 +72,7 @@ public class EntityListeners implements Listener {
|
|||||||
if (amount < 1) return;
|
if (amount < 1) return;
|
||||||
item.setAmount(Math.min(amount, item.getMaxStackSize()));
|
item.setAmount(Math.min(amount, item.getMaxStackSize()));
|
||||||
if (amount > item.getMaxStackSize()) {
|
if (amount > item.getMaxStackSize()) {
|
||||||
StackedItem stackedItem = UltimateStackerAPI.getStackedItemManager().getStackedItem(event.getEntity());
|
StackedItem stackedItem = UltimateStackerApi.getStackedItemManager().getStackedItem(event.getEntity());
|
||||||
if (stackedItem != null) {
|
if (stackedItem != null) {
|
||||||
stackedItem.setAmount(amount - item.getMaxStackSize());
|
stackedItem.setAmount(amount - item.getMaxStackSize());
|
||||||
}
|
}
|
||||||
@ -105,7 +104,7 @@ public class EntityListeners implements Listener {
|
|||||||
public void onSpawn(CreatureSpawnEvent event) {
|
public void onSpawn(CreatureSpawnEvent event) {
|
||||||
event.getEntity().setMetadata("US_REASON", new FixedMetadataValue(plugin, event.getSpawnReason().name()));
|
event.getEntity().setMetadata("US_REASON", new FixedMetadataValue(plugin, event.getSpawnReason().name()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onBlow(EntityExplodeEvent event) {
|
public void onBlow(EntityExplodeEvent event) {
|
||||||
if (!plugin.spawnersEnabled()) return;
|
if (!plugin.spawnersEnabled()) return;
|
||||||
@ -120,7 +119,7 @@ public class EntityListeners implements Listener {
|
|||||||
|
|
||||||
Location spawnLocation = block.getLocation();
|
Location spawnLocation = block.getLocation();
|
||||||
|
|
||||||
SpawnerStack spawner = UltimateStackerAPI.getSpawnerStackManager().getSpawner(block);
|
SpawnerStack spawner = UltimateStackerApi.getSpawnerStackManager().getSpawner(block);
|
||||||
|
|
||||||
if (Settings.SPAWNERS_DONT_EXPLODE.getBoolean())
|
if (Settings.SPAWNERS_DONT_EXPLODE.getBoolean())
|
||||||
toCancel.add(block);
|
toCancel.add(block);
|
||||||
@ -138,7 +137,7 @@ public class EntityListeners implements Listener {
|
|||||||
ItemStack item = Methods.getSpawnerItem(blockType, spawner.getAmount());
|
ItemStack item = Methods.getSpawnerItem(blockType, spawner.getAmount());
|
||||||
spawnLocation.getWorld().dropItemNaturally(spawnLocation.clone().add(.5, 0, .5), item);
|
spawnLocation.getWorld().dropItemNaturally(spawnLocation.clone().add(.5, 0, .5), item);
|
||||||
|
|
||||||
SpawnerStack spawnerStack = UltimateStackerAPI.getSpawnerStackManager().removeSpawner(spawnLocation);
|
SpawnerStack spawnerStack = UltimateStackerApi.getSpawnerStackManager().removeSpawner(spawnLocation);
|
||||||
plugin.getPluginDataManager().delete(spawnerStack);
|
plugin.getPluginDataManager().delete(spawnerStack);
|
||||||
plugin.removeHologram(spawnerStack);
|
plugin.removeHologram(spawnerStack);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.craftaro.ultimatestacker.listeners.item;
|
package com.craftaro.ultimatestacker.listeners.item;
|
||||||
|
|
||||||
import com.craftaro.ultimatestacker.api.UltimateStackerAPI;
|
import com.craftaro.ultimatestacker.api.UltimateStackerApi;
|
||||||
import com.craftaro.ultimatestacker.api.stack.item.StackedItem;
|
import com.craftaro.ultimatestacker.api.stack.item.StackedItem;
|
||||||
import com.craftaro.ultimatestacker.settings.Settings;
|
import com.craftaro.ultimatestacker.settings.Settings;
|
||||||
import com.craftaro.ultimatestacker.utils.Methods;
|
import com.craftaro.ultimatestacker.utils.Methods;
|
||||||
@ -20,7 +20,7 @@ public class ItemCurrentListener implements Listener {
|
|||||||
// Amount here is not the total amount of item (32 if more than 32) but the amount of item the player can retrieve
|
// Amount here is not the total amount of item (32 if more than 32) but the amount of item the player can retrieve
|
||||||
// ie there is x64 diamonds blocks (so 32), the player pick 8 items so the amount is 8 and not 32
|
// ie there is x64 diamonds blocks (so 32), the player pick 8 items so the amount is 8 and not 32
|
||||||
|
|
||||||
StackedItem stackedItem = UltimateStackerAPI.getStackedItemManager().getStackedItem(event.getItem());
|
StackedItem stackedItem = UltimateStackerApi.getStackedItemManager().getStackedItem(event.getItem());
|
||||||
if (stackedItem == null) return;
|
if (stackedItem == null) return;
|
||||||
ItemStack stack = stackedItem.getItem().getItemStack();
|
ItemStack stack = stackedItem.getItem().getItemStack();
|
||||||
int amount = stackedItem.getAmount();
|
int amount = stackedItem.getAmount();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.craftaro.ultimatestacker.listeners.item;
|
package com.craftaro.ultimatestacker.listeners.item;
|
||||||
|
|
||||||
import com.craftaro.ultimatestacker.api.UltimateStackerAPI;
|
import com.craftaro.ultimatestacker.api.UltimateStackerApi;
|
||||||
import com.craftaro.ultimatestacker.settings.Settings;
|
import com.craftaro.ultimatestacker.settings.Settings;
|
||||||
import com.craftaro.ultimatestacker.utils.Methods;
|
import com.craftaro.ultimatestacker.utils.Methods;
|
||||||
import com.craftaro.core.compatibility.CompatibleSound;
|
import com.craftaro.core.compatibility.CompatibleSound;
|
||||||
@ -23,7 +23,7 @@ public class ItemLegacyListener implements Listener {
|
|||||||
|
|
||||||
Item item = event.getItem();
|
Item item = event.getItem();
|
||||||
ItemStack stack = item.getItemStack();
|
ItemStack stack = item.getItemStack();
|
||||||
int amount = UltimateStackerAPI.getStackedItemManager().getActualItemAmount(item);
|
int amount = UltimateStackerApi.getStackedItemManager().getActualItemAmount(item);
|
||||||
if (amount < (stack.getMaxStackSize() / 2)) return;
|
if (amount < (stack.getMaxStackSize() / 2)) return;
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
package com.craftaro.ultimatestacker.stackable.spawner;
|
package com.craftaro.ultimatestacker.stackable.spawner;
|
||||||
|
|
||||||
import com.craftaro.core.compatibility.CompatibleMaterial;
|
|
||||||
import com.craftaro.core.database.Data;
|
import com.craftaro.core.database.Data;
|
||||||
import com.craftaro.core.database.SerializedLocation;
|
import com.craftaro.core.database.SerializedLocation;
|
||||||
import com.craftaro.core.nms.world.SpawnedEntity;
|
import com.craftaro.core.nms.world.SpawnedEntity;
|
||||||
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
|
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
|
||||||
import com.craftaro.core.world.SSpawner;
|
import com.craftaro.core.world.SSpawner;
|
||||||
import com.craftaro.ultimatestacker.UltimateStacker;
|
import com.craftaro.ultimatestacker.UltimateStacker;
|
||||||
import com.craftaro.ultimatestacker.api.UltimateStackerAPI;
|
import com.craftaro.ultimatestacker.api.UltimateStackerApi;
|
||||||
import com.craftaro.ultimatestacker.api.stack.spawner.SpawnerStack;
|
import com.craftaro.ultimatestacker.api.stack.spawner.SpawnerStack;
|
||||||
import com.craftaro.ultimatestacker.settings.Settings;
|
import com.craftaro.ultimatestacker.settings.Settings;
|
||||||
import com.craftaro.ultimatestacker.utils.Methods;
|
import com.craftaro.ultimatestacker.utils.Methods;
|
||||||
@ -18,7 +17,6 @@ import org.bukkit.entity.EntityType;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -129,7 +127,7 @@ public class SpawnerStackImpl implements SpawnerStack {
|
|||||||
@Override
|
@Override
|
||||||
public String getHologramName() {
|
public String getHologramName() {
|
||||||
if (!(this.location.getBlock().getState() instanceof CreatureSpawner)) {
|
if (!(this.location.getBlock().getState() instanceof CreatureSpawner)) {
|
||||||
UltimateStackerAPI.getSpawnerStackManager().removeSpawner(this.location);
|
UltimateStackerApi.getSpawnerStackManager().removeSpawner(this.location);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
CreatureSpawner creatureSpawner = (CreatureSpawner) this.location.getBlock().getState();
|
CreatureSpawner creatureSpawner = (CreatureSpawner) this.location.getBlock().getState();
|
||||||
|
@ -2,11 +2,10 @@ package com.craftaro.ultimatestacker.utils;
|
|||||||
|
|
||||||
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
|
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
|
||||||
import com.craftaro.ultimatestacker.UltimateStacker;
|
import com.craftaro.ultimatestacker.UltimateStacker;
|
||||||
import com.craftaro.ultimatestacker.api.UltimateStackerAPI;
|
import com.craftaro.ultimatestacker.api.UltimateStackerApi;
|
||||||
import com.craftaro.ultimatestacker.api.stack.item.StackedItem;
|
import com.craftaro.ultimatestacker.api.stack.item.StackedItem;
|
||||||
import com.craftaro.ultimatestacker.settings.Settings;
|
import com.craftaro.ultimatestacker.settings.Settings;
|
||||||
import com.craftaro.ultimatestacker.stackable.entity.custom.CustomEntity;
|
import com.craftaro.ultimatestacker.stackable.entity.custom.CustomEntity;
|
||||||
import com.craftaro.core.compatibility.CompatibleMaterial;
|
|
||||||
import com.craftaro.core.third_party.de.tr7zw.nbtapi.NBTItem;
|
import com.craftaro.core.third_party.de.tr7zw.nbtapi.NBTItem;
|
||||||
import com.craftaro.core.utils.TextUtils;
|
import com.craftaro.core.utils.TextUtils;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -24,7 +23,7 @@ import java.util.Map;
|
|||||||
public class Methods {
|
public class Methods {
|
||||||
|
|
||||||
public static void updateInventory(Item item, Inventory inventory) {
|
public static void updateInventory(Item item, Inventory inventory) {
|
||||||
StackedItem stackedItem = UltimateStackerAPI.getStackedItemManager().getStackedItem(item);
|
StackedItem stackedItem = UltimateStackerApi.getStackedItemManager().getStackedItem(item);
|
||||||
int amount = stackedItem.getAmount();
|
int amount = stackedItem.getAmount();
|
||||||
ItemStack itemStack = item.getItemStack();
|
ItemStack itemStack = item.getItemStack();
|
||||||
final int maxStack = itemStack.getMaxStackSize();
|
final int maxStack = itemStack.getMaxStackSize();
|
||||||
|
Loading…
Reference in New Issue
Block a user