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>
|
||||
<injection>
|
||||
<value>${project.version}</value>
|
||||
<pointCut>com.craftaro.ultimatestacker.api.UltimateStackerAPI.getVersion</pointCut>
|
||||
<pointCut>com.craftaro.ultimatestacker.api.UltimateStackerApi.getVersion</pointCut>
|
||||
</injection>
|
||||
</injections>
|
||||
</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.item.StackedItemManager;
|
||||
import com.craftaro.ultimatestacker.api.stack.spawner.SpawnerStackManager;
|
||||
import com.craftaro.core.hooks.stackers.UltimateStacker;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* The main class of the API
|
||||
* <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 EntityStackManager entityStackManager;
|
||||
@ -20,22 +19,22 @@ public final class UltimateStackerAPI {
|
||||
private static SpawnerStackManager spawnerStackManager;
|
||||
private static BlockStackManager blockStackManager;
|
||||
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) {
|
||||
if (UltimateStackerAPI.plugin != null || UltimateStackerAPI.entityStackManager != null || UltimateStackerAPI.stackedItemManager != null || UltimateStackerAPI.spawnerStackManager != null || UltimateStackerAPI.blockStackManager != null || UltimateStackerAPI.settings != null) {
|
||||
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) {
|
||||
throw new IllegalStateException("UltimateStackerAPI has already been initialized!");
|
||||
}
|
||||
UltimateStackerAPI.plugin = plugin;
|
||||
UltimateStackerAPI.entityStackManager = entityStackManager;
|
||||
UltimateStackerAPI.stackedItemManager = itemStackManager;
|
||||
UltimateStackerAPI.spawnerStackManager = spawnerStackManager;
|
||||
UltimateStackerAPI.blockStackManager = blockStackManager;
|
||||
UltimateStackerAPI.settings = settings;
|
||||
UltimateStackerApi.plugin = plugin;
|
||||
UltimateStackerApi.entityStackManager = entityStackManager;
|
||||
UltimateStackerApi.stackedItemManager = itemStackManager;
|
||||
UltimateStackerApi.spawnerStackManager = spawnerStackManager;
|
||||
UltimateStackerApi.blockStackManager = blockStackManager;
|
||||
UltimateStackerApi.settings = settings;
|
||||
instance = this;
|
||||
}
|
||||
|
||||
public static UltimateStackerAPI getInstance() {
|
||||
public static UltimateStackerApi getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.craftaro.ultimatestacker;
|
||||
|
||||
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.BlockStackManager;
|
||||
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.SongodaPlugin;
|
||||
import com.craftaro.core.commands.CommandManager;
|
||||
import com.craftaro.core.compatibility.CompatibleMaterial;
|
||||
import com.craftaro.core.compatibility.ServerVersion;
|
||||
import com.craftaro.core.configuration.Config;
|
||||
import com.craftaro.core.database.DataManager;
|
||||
@ -96,7 +95,7 @@ public class UltimateStacker extends SongodaPlugin {
|
||||
private CommandManager commandManager;
|
||||
private CustomEntityManager customEntityManager;
|
||||
private StackingTask stackingTask;
|
||||
private UltimateStackerAPI API;
|
||||
private UltimateStackerApi API;
|
||||
|
||||
public static UltimateStacker getInstance() {
|
||||
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()));
|
||||
|
||||
API = new UltimateStackerAPI(this, entityStackManager, stackedItemManager, spawnerStackManager, blockStackManager, new Settings());
|
||||
API = new UltimateStackerApi(this, entityStackManager, stackedItemManager, spawnerStackManager, blockStackManager, new Settings());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -263,7 +262,7 @@ public class UltimateStacker extends SongodaPlugin {
|
||||
});
|
||||
}
|
||||
|
||||
public UltimateStackerAPI getAPI() {
|
||||
public UltimateStackerApi getAPI() {
|
||||
return API;
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@ package com.craftaro.ultimatestacker.convert;
|
||||
import com.bgsoftware.wildstacker.api.WildStackerAPI;
|
||||
import com.bgsoftware.wildstacker.api.objects.StackedSpawner;
|
||||
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 org.bukkit.Bukkit;
|
||||
import org.bukkit.block.CreatureSpawner;
|
||||
@ -42,7 +42,7 @@ public class WildStackerConvert implements Convert {
|
||||
@Override
|
||||
public void convertSpawners() {
|
||||
for (StackedSpawner spawner : WildStackerAPI.getWildStacker().getSystemManager().getStackedSpawners()) {
|
||||
SpawnerStack stack = UltimateStackerAPI.getSpawnerStackManager().getSpawner(spawner.getLocation());
|
||||
SpawnerStack stack = UltimateStackerApi.getSpawnerStackManager().getSpawner(spawner.getLocation());
|
||||
|
||||
stack.setAmount(WildStackerAPI
|
||||
.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.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.SpawnerPlaceEvent;
|
||||
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.utils.Methods;
|
||||
import com.craftaro.core.compatibility.CompatibleHand;
|
||||
import com.craftaro.core.compatibility.CompatibleMaterial;
|
||||
import com.craftaro.core.hooks.ProtectionManager;
|
||||
import com.craftaro.core.third_party.de.tr7zw.nbtapi.NBTItem;
|
||||
import org.apache.commons.lang.math.NumberUtils;
|
||||
@ -180,7 +179,7 @@ public class BlockListeners implements Listener {
|
||||
event.setCancelled(true);
|
||||
|
||||
if (itemType == blockType) {
|
||||
SpawnerStack stack = UltimateStackerAPI.getSpawnerStackManager().getSpawner(block);
|
||||
SpawnerStack stack = UltimateStackerApi.getSpawnerStackManager().getSpawner(block);
|
||||
if (player.isSneaking()) return;
|
||||
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||
if (stack.getAmount() == maxStackSize) return;
|
||||
@ -235,7 +234,7 @@ public class BlockListeners implements Listener {
|
||||
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);
|
||||
|
||||
cs.setSpawnedType(cs2.getSpawnedType());
|
||||
@ -260,7 +259,7 @@ public class BlockListeners implements Listener {
|
||||
Player player = event.getPlayer();
|
||||
ItemStack item = player.getInventory().getItemInHand();
|
||||
|
||||
SpawnerStack stack = UltimateStackerAPI.getSpawnerStackManager().getSpawner(block);
|
||||
SpawnerStack stack = UltimateStackerApi.getSpawnerStackManager().getSpawner(block);
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
@ -282,7 +281,7 @@ public class BlockListeners implements Listener {
|
||||
if (remove) {
|
||||
event.setCancelled(false);
|
||||
plugin.removeHologram(stack);
|
||||
SpawnerStack spawnerStack = UltimateStackerAPI.getSpawnerStackManager().removeSpawner(block.getLocation());
|
||||
SpawnerStack spawnerStack = UltimateStackerApi.getSpawnerStackManager().removeSpawner(block.getLocation());
|
||||
plugin.getPluginDataManager().delete(spawnerStack);
|
||||
} else {
|
||||
stack.setAmount(stack.getAmount() - 1);
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.craftaro.ultimatestacker.listeners;
|
||||
|
||||
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.SpawnerStackManager;
|
||||
import com.craftaro.ultimatestacker.settings.Settings;
|
||||
@ -44,7 +44,7 @@ public class SpawnerListeners implements Listener {
|
||||
if (!plugin.spawnersEnabled()
|
||||
|| plugin.getStackingTask().isWorldDisabled(event.getLocation().getWorld())) return;
|
||||
|
||||
SpawnerStackManager spawnerStackManager = UltimateStackerAPI.getSpawnerStackManager();
|
||||
SpawnerStackManager spawnerStackManager = UltimateStackerApi.getSpawnerStackManager();
|
||||
if (!spawnerStackManager.isSpawner(event.getSpawner().getLocation())) return;
|
||||
|
||||
Entity entity = event.getEntity();
|
||||
@ -110,7 +110,7 @@ public class SpawnerListeners implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
SpawnerStackManager manager = UltimateStackerAPI.getSpawnerStackManager();
|
||||
SpawnerStackManager manager = UltimateStackerApi.getSpawnerStackManager();
|
||||
|
||||
SpawnerStack spawner = manager.isSpawner(block.getLocation())
|
||||
? 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.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.EntityStackManager;
|
||||
import com.craftaro.ultimatestacker.api.stack.item.StackedItem;
|
||||
import com.craftaro.ultimatestacker.api.stack.spawner.SpawnerStack;
|
||||
import com.craftaro.ultimatestacker.settings.Settings;
|
||||
import com.craftaro.ultimatestacker.utils.Methods;
|
||||
import com.craftaro.core.compatibility.CompatibleMaterial;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -73,7 +72,7 @@ public class EntityListeners implements Listener {
|
||||
if (amount < 1) return;
|
||||
item.setAmount(Math.min(amount, item.getMaxStackSize()));
|
||||
if (amount > item.getMaxStackSize()) {
|
||||
StackedItem stackedItem = UltimateStackerAPI.getStackedItemManager().getStackedItem(event.getEntity());
|
||||
StackedItem stackedItem = UltimateStackerApi.getStackedItemManager().getStackedItem(event.getEntity());
|
||||
if (stackedItem != null) {
|
||||
stackedItem.setAmount(amount - item.getMaxStackSize());
|
||||
}
|
||||
@ -105,7 +104,7 @@ public class EntityListeners implements Listener {
|
||||
public void onSpawn(CreatureSpawnEvent event) {
|
||||
event.getEntity().setMetadata("US_REASON", new FixedMetadataValue(plugin, event.getSpawnReason().name()));
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void onBlow(EntityExplodeEvent event) {
|
||||
if (!plugin.spawnersEnabled()) return;
|
||||
@ -120,7 +119,7 @@ public class EntityListeners implements Listener {
|
||||
|
||||
Location spawnLocation = block.getLocation();
|
||||
|
||||
SpawnerStack spawner = UltimateStackerAPI.getSpawnerStackManager().getSpawner(block);
|
||||
SpawnerStack spawner = UltimateStackerApi.getSpawnerStackManager().getSpawner(block);
|
||||
|
||||
if (Settings.SPAWNERS_DONT_EXPLODE.getBoolean())
|
||||
toCancel.add(block);
|
||||
@ -138,7 +137,7 @@ public class EntityListeners implements Listener {
|
||||
ItemStack item = Methods.getSpawnerItem(blockType, spawner.getAmount());
|
||||
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.removeHologram(spawnerStack);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
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.settings.Settings;
|
||||
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
|
||||
// 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;
|
||||
ItemStack stack = stackedItem.getItem().getItemStack();
|
||||
int amount = stackedItem.getAmount();
|
||||
|
@ -1,6 +1,6 @@
|
||||
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.utils.Methods;
|
||||
import com.craftaro.core.compatibility.CompatibleSound;
|
||||
@ -23,7 +23,7 @@ public class ItemLegacyListener implements Listener {
|
||||
|
||||
Item item = event.getItem();
|
||||
ItemStack stack = item.getItemStack();
|
||||
int amount = UltimateStackerAPI.getStackedItemManager().getActualItemAmount(item);
|
||||
int amount = UltimateStackerApi.getStackedItemManager().getActualItemAmount(item);
|
||||
if (amount < (stack.getMaxStackSize() / 2)) return;
|
||||
event.setCancelled(true);
|
||||
|
||||
|
@ -1,13 +1,12 @@
|
||||
package com.craftaro.ultimatestacker.stackable.spawner;
|
||||
|
||||
import com.craftaro.core.compatibility.CompatibleMaterial;
|
||||
import com.craftaro.core.database.Data;
|
||||
import com.craftaro.core.database.SerializedLocation;
|
||||
import com.craftaro.core.nms.world.SpawnedEntity;
|
||||
import com.craftaro.core.third_party.com.cryptomorin.xseries.XMaterial;
|
||||
import com.craftaro.core.world.SSpawner;
|
||||
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.settings.Settings;
|
||||
import com.craftaro.ultimatestacker.utils.Methods;
|
||||
@ -18,7 +17,6 @@ import org.bukkit.entity.EntityType;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
@ -129,7 +127,7 @@ public class SpawnerStackImpl implements SpawnerStack {
|
||||
@Override
|
||||
public String getHologramName() {
|
||||
if (!(this.location.getBlock().getState() instanceof CreatureSpawner)) {
|
||||
UltimateStackerAPI.getSpawnerStackManager().removeSpawner(this.location);
|
||||
UltimateStackerApi.getSpawnerStackManager().removeSpawner(this.location);
|
||||
return null;
|
||||
}
|
||||
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.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.settings.Settings;
|
||||
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.utils.TextUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -24,7 +23,7 @@ import java.util.Map;
|
||||
public class Methods {
|
||||
|
||||
public static void updateInventory(Item item, Inventory inventory) {
|
||||
StackedItem stackedItem = UltimateStackerAPI.getStackedItemManager().getStackedItem(item);
|
||||
StackedItem stackedItem = UltimateStackerApi.getStackedItemManager().getStackedItem(item);
|
||||
int amount = stackedItem.getAmount();
|
||||
ItemStack itemStack = item.getItemStack();
|
||||
final int maxStack = itemStack.getMaxStackSize();
|
||||
|
Loading…
Reference in New Issue
Block a user