core update

This commit is contained in:
jascotty2 2019-09-09 11:08:04 -05:00
parent a75c65dbeb
commit 4779912462
10 changed files with 74 additions and 74 deletions

View File

@ -3,7 +3,7 @@ package com.songoda.ultimatestacker;
import com.songoda.core.SongodaCore;
import com.songoda.core.SongodaPlugin;
import com.songoda.core.commands.CommandManager;
import com.songoda.core.compatibility.LegacyMaterials;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.compatibility.ServerVersion;
import com.songoda.core.configuration.Config;
import com.songoda.core.database.DataMigrationManager;
@ -96,7 +96,7 @@ public class UltimateStacker extends SongodaPlugin {
@Override
public void onPluginEnable() {
// Run Songoda Updater
SongodaCore.registerPlugin(this, 16, LegacyMaterials.IRON_INGOT);
SongodaCore.registerPlugin(this, 16, CompatibleMaterial.IRON_INGOT);
// Setup Config
Setting.setupConfig();
@ -334,7 +334,7 @@ public class UltimateStacker extends SongodaPlugin {
// are holograms enabled?
if(!Setting.SPAWNER_HOLOGRAMS.getBoolean() || !HologramManager.getManager().isEnabled()) return;
// verify that this is a spawner stack
if (stack.getLocation().getBlock().getType() != LegacyMaterials.SPAWNER.getMaterial()) return;
if (stack.getLocation().getBlock().getType() != CompatibleMaterial.SPAWNER.getMaterial()) return;
// grab the spawner block
CreatureSpawner creatureSpawner = (CreatureSpawner) stack.getLocation().getBlock().getState();
String name = Methods.compileSpawnerName(creatureSpawner.getSpawnedType(), stack.getAmount());
@ -344,7 +344,7 @@ public class UltimateStacker extends SongodaPlugin {
public void updateHologram(Block block) {
// verify that this is a spawner
if (block.getType() != LegacyMaterials.SPAWNER.getMaterial()) return;
if (block.getType() != CompatibleMaterial.SPAWNER.getMaterial()) return;
// are holograms enabled?
if(!Setting.SPAWNER_HOLOGRAMS.getBoolean() || !HologramManager.getManager().isEnabled()) return;
// update this hologram in a tick
@ -448,7 +448,7 @@ public class UltimateStacker extends SongodaPlugin {
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)) {
return isMaterialBlacklisted(item.getType());
} else {
LegacyMaterials mat = LegacyMaterials.getMaterial(item);
CompatibleMaterial mat = CompatibleMaterial.getMaterial(item);
if (mat.usesData()) {
return isMaterialBlacklisted(mat.getMaterial(), mat.getData());
} else {

View File

@ -1,6 +1,6 @@
package com.songoda.ultimatestacker.entity;
import com.songoda.core.compatibility.LegacyMaterials;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.compatibility.ServerVersion;
import com.songoda.lootables.loot.Drop;
import com.songoda.ultimatestacker.UltimateStacker;
@ -140,7 +140,7 @@ public class EntityStack {
newEntity.getEquipment().clear();
if (killed.getType() == EntityType.PIG_ZOMBIE)
newEntity.getEquipment().setItemInHand(LegacyMaterials.GOLDEN_SWORD.getItem());
newEntity.getEquipment().setItemInHand(CompatibleMaterial.GOLDEN_SWORD.getItem());
if (Setting.CARRY_OVER_METADATA_ON_DEATH.getBoolean()) {
if (killed.hasMetadata("ES"))

View File

@ -1,6 +1,6 @@
package com.songoda.ultimatestacker.gui;
import com.songoda.core.compatibility.LegacyMaterials;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.gui.Gui;
import com.songoda.core.gui.GuiUtils;
import com.songoda.ultimatestacker.convert.StackMobConvert;
@ -15,12 +15,12 @@ public class GUIConvert extends Gui {
setRows(1);
int current = 0;
if (Bukkit.getPluginManager().isPluginEnabled("WildStacker")) {
this.setButton(current++, GuiUtils.createButtonItem(LegacyMaterials.STONE, ChatColor.GRAY + "WildStacker"),
this.setButton(current++, GuiUtils.createButtonItem(CompatibleMaterial.STONE, ChatColor.GRAY + "WildStacker"),
(event) -> event.manager.showGUI(event.player, new GUIConvertWhat(new WildStackerConvert(), this)));
}
if (Bukkit.getPluginManager().isPluginEnabled("StackMob")) {
this.setButton(current++, GuiUtils.createButtonItem(LegacyMaterials.STONE, ChatColor.GRAY + "StackMob"),
this.setButton(current++, GuiUtils.createButtonItem(CompatibleMaterial.STONE, ChatColor.GRAY + "StackMob"),
(event) -> event.manager.showGUI(event.player, new GUIConvertWhat(new StackMobConvert(), this)));
}

View File

@ -1,6 +1,6 @@
package com.songoda.ultimatestacker.gui;
import com.songoda.core.compatibility.LegacyMaterials;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.gui.Gui;
import com.songoda.core.gui.GuiUtils;
import com.songoda.ultimatestacker.convert.Convert;
@ -22,20 +22,20 @@ public class GUIConvertWhat extends Gui {
this.convertFrom = convertFrom;
if (convertFrom.canEntities()) {
this.setButton(0, GuiUtils.createButtonItem(LegacyMaterials.STONE,
this.setButton(0, GuiUtils.createButtonItem(CompatibleMaterial.STONE,
ChatColor.GRAY + "Stacked Entities",
entities ? ChatColor.GREEN + "Yes" : ChatColor.RED + "No"),
(event) -> toggleEntities());
}
if (convertFrom.canSpawners()) {
this.setButton(1, GuiUtils.createButtonItem(LegacyMaterials.STONE,
this.setButton(1, GuiUtils.createButtonItem(CompatibleMaterial.STONE,
ChatColor.GRAY + "Stacked Spawners",
spawners ? ChatColor.GREEN + "Yes" : ChatColor.RED + "No"),
(event) -> toggleSpawners());
}
this.setButton(8, GuiUtils.createButtonItem(LegacyMaterials.GREEN_WOOL, ChatColor.GREEN + "Run"),
this.setButton(8, GuiUtils.createButtonItem(CompatibleMaterial.GREEN_WOOL, ChatColor.GREEN + "Run"),
(event) -> run(event.player));
}

View File

@ -1,6 +1,6 @@
package com.songoda.ultimatestacker.listeners;
import com.songoda.core.compatibility.LegacyMaterials;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.ultimatestacker.UltimateStacker;
import com.songoda.ultimatestacker.events.SpawnerBreakEvent;
import com.songoda.ultimatestacker.events.SpawnerPlaceEvent;
@ -41,8 +41,8 @@ public class BlockListeners implements Listener {
ItemStack item = event.getPlayer().getInventory().getItemInHand();
if (block == null
|| block.getType() != LegacyMaterials.SPAWNER.getMaterial()
|| item.getType() != LegacyMaterials.SPAWNER.getMaterial()
|| block.getType() != CompatibleMaterial.SPAWNER.getMaterial()
|| item.getType() != CompatibleMaterial.SPAWNER.getMaterial()
|| event.getAction() == Action.LEFT_CLICK_BLOCK) return;
List<String> disabledWorlds = Setting.DISABLED_WORLDS.getStringList();
@ -106,7 +106,7 @@ public class BlockListeners implements Listener {
Player player = event.getPlayer();
if (!event.isCancelled()) {
if (block.getType() != LegacyMaterials.SPAWNER.getMaterial()
if (block.getType() != CompatibleMaterial.SPAWNER.getMaterial()
|| !plugin.spawnersEnabled())
return;
@ -136,7 +136,7 @@ public class BlockListeners implements Listener {
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onBlockBreak(BlockBreakEvent event) {
Block block = event.getBlock();
if (block.getType() != LegacyMaterials.SPAWNER.getMaterial()) return;
if (block.getType() != CompatibleMaterial.SPAWNER.getMaterial()) return;
if (!plugin.spawnersEnabled()) return;
event.setExpToDrop(0);

View File

@ -1,6 +1,6 @@
package com.songoda.ultimatestacker.listeners;
import com.songoda.core.compatibility.LegacyMaterials;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.ultimatestacker.UltimateStacker;
import com.songoda.ultimatestacker.entity.EntityStack;
import com.songoda.ultimatestacker.entity.EntityStackManager;
@ -83,7 +83,7 @@ public class EntityListeners implements Listener {
List<Block> toCancel = new ArrayList<>();
while (it.hasNext()) {
Block block = it.next();
if (block.getType() != LegacyMaterials.SPAWNER.getMaterial())
if (block.getType() != CompatibleMaterial.SPAWNER.getMaterial())
continue;
Location spawnLocation = block.getLocation();

View File

@ -1,6 +1,6 @@
package com.songoda.ultimatestacker.listeners;
import com.songoda.core.compatibility.LegacyMaterials;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.compatibility.ServerVersion;
import com.songoda.ultimatestacker.UltimateStacker;
import com.songoda.ultimatestacker.entity.EntityStack;
@ -83,27 +83,27 @@ public class InteractListeners implements Listener {
case "PIG":
return type == Material.CARROT || (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_9) && type == Material.BEETROOT) || type == Material.POTATO;
case "CHICKEN":
return type == LegacyMaterials.WHEAT_SEEDS.getMaterial()
return type == CompatibleMaterial.WHEAT_SEEDS.getMaterial()
|| type == Material.MELON_SEEDS
|| type == Material.BEETROOT_SEEDS
|| type == Material.PUMPKIN_SEEDS;
case "HORSE":
return (type == Material.GOLDEN_APPLE || type == Material.GOLDEN_CARROT) && ((Horse)entity).isTamed();
case "WOLF":
return type == LegacyMaterials.BEEF.getMaterial()
|| type == LegacyMaterials.CHICKEN.getMaterial()
|| type == LegacyMaterials.COD.getMaterial()
|| type == LegacyMaterials.MUTTON.getMaterial()
|| type == LegacyMaterials.PORKCHOP.getMaterial()
|| type == LegacyMaterials.RABBIT.getMaterial()
|| LegacyMaterials.SALMON.matches(is)
|| type == LegacyMaterials.COOKED_BEEF.getMaterial()
|| type == LegacyMaterials.COOKED_CHICKEN.getMaterial()
|| type == LegacyMaterials.COOKED_COD.getMaterial()
|| type == LegacyMaterials.COOKED_MUTTON.getMaterial()
|| type == LegacyMaterials.COOKED_PORKCHOP.getMaterial()
|| type == LegacyMaterials.COOKED_RABBIT.getMaterial()
|| LegacyMaterials.COOKED_SALMON.matches(is)
return type == CompatibleMaterial.BEEF.getMaterial()
|| type == CompatibleMaterial.CHICKEN.getMaterial()
|| type == CompatibleMaterial.COD.getMaterial()
|| type == CompatibleMaterial.MUTTON.getMaterial()
|| type == CompatibleMaterial.PORKCHOP.getMaterial()
|| type == CompatibleMaterial.RABBIT.getMaterial()
|| CompatibleMaterial.SALMON.matches(is)
|| type == CompatibleMaterial.COOKED_BEEF.getMaterial()
|| type == CompatibleMaterial.COOKED_CHICKEN.getMaterial()
|| type == CompatibleMaterial.COOKED_COD.getMaterial()
|| type == CompatibleMaterial.COOKED_MUTTON.getMaterial()
|| type == CompatibleMaterial.COOKED_PORKCHOP.getMaterial()
|| type == CompatibleMaterial.COOKED_RABBIT.getMaterial()
|| CompatibleMaterial.COOKED_SALMON.matches(is)
&& ((Wolf) entity).isTamed();
case "OCELOT":
return (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13)
@ -111,7 +111,7 @@ public class InteractListeners implements Listener {
|| type == Material.COD
|| type == Material.PUFFERFISH
|| type == Material.TROPICAL_FISH
: type == LegacyMaterials.COD.getMaterial()); // Now broken in 1.13 ((Ocelot) entity).isTamed()
: type == CompatibleMaterial.COD.getMaterial()); // Now broken in 1.13 ((Ocelot) entity).isTamed()
case "PANDA":
return (type == Material.BAMBOO);
case "FOX":

View File

@ -1,6 +1,6 @@
package com.songoda.ultimatestacker.listeners;
import com.songoda.core.compatibility.CompatibleSounds;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.core.compatibility.ServerVersion;
import com.songoda.core.utils.BlockUtils;
import com.songoda.ultimatestacker.UltimateStacker;
@ -86,7 +86,7 @@ public class ItemListeners implements Listener {
if (event.getItem().getItemStack().getAmount() < 32) return;
event.setCancelled(true);
event.getPlayer().playSound(event.getPlayer().getLocation(), CompatibleSounds.ENTITY_ITEM_PICKUP.getSound(), .2f, (float) (1 + Math.random()));
event.getPlayer().playSound(event.getPlayer().getLocation(), CompatibleSound.ENTITY_ITEM_PICKUP.getSound(), .2f, (float) (1 + Math.random()));
Methods.updateInventory(event.getItem(), event.getPlayer().getInventory());
}

View File

@ -1,6 +1,6 @@
package com.songoda.ultimatestacker.lootables;
import com.songoda.core.compatibility.LegacyMaterials;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.compatibility.ServerVersion;
import com.songoda.lootables.Lootables;
import com.songoda.lootables.Modify;
@ -211,8 +211,8 @@ public class LootablesManager {
Loot fish1 = new LootBuilder()
.addChildLoot(new LootBuilder()
.setMaterial(LegacyMaterials.COD.getMaterial())
.setBurnedMaterial(LegacyMaterials.COOKED_COD.getMaterial())
.setMaterial(CompatibleMaterial.COD.getMaterial())
.setBurnedMaterial(CompatibleMaterial.COOKED_COD.getMaterial())
.setChance(50).build(),
new LootBuilder()
.setMaterial(Material.PRISMARINE_CRYSTALS)
@ -222,23 +222,23 @@ public class LootablesManager {
Loot fish2 = new LootBuilder()
.setChance(2.5)
.addChildLoot(new LootBuilder()
.setMaterial(LegacyMaterials.COD.getMaterial())
.setData(LegacyMaterials.COD.getData())
.setMaterial(CompatibleMaterial.COD.getMaterial())
.setData(CompatibleMaterial.COD.getData())
.setChance(60)
.setAllowLootingEnchant(false).build(),
new LootBuilder()
.setMaterial(LegacyMaterials.SALMON.getMaterial())
.setData(LegacyMaterials.SALMON.getData())
.setMaterial(CompatibleMaterial.SALMON.getMaterial())
.setData(CompatibleMaterial.SALMON.getData())
.setChance(25)
.setAllowLootingEnchant(false).build(),
new LootBuilder()
.setMaterial(LegacyMaterials.PUFFERFISH.getMaterial())
.setData(LegacyMaterials.PUFFERFISH.getData())
.setMaterial(CompatibleMaterial.PUFFERFISH.getMaterial())
.setData(CompatibleMaterial.PUFFERFISH.getData())
.setChance(13)
.setAllowLootingEnchant(false).build(),
new LootBuilder()
.setMaterial(LegacyMaterials.TROPICAL_FISH.getMaterial())
.setData(LegacyMaterials.TROPICAL_FISH.getData())
.setMaterial(CompatibleMaterial.TROPICAL_FISH.getMaterial())
.setData(CompatibleMaterial.TROPICAL_FISH.getData())
.setChance(2)
.setAllowLootingEnchant(false).build())
.addOnlyDropFors(EntityType.PLAYER).build();
@ -307,8 +307,8 @@ public class LootablesManager {
.setMax(2).build()));
Loot witherSkull = new LootBuilder()
.setMaterial(LegacyMaterials.WITHER_SKELETON_SKULL.getMaterial())
.setData(LegacyMaterials.WITHER_SKELETON_SKULL.getData())
.setMaterial(CompatibleMaterial.WITHER_SKELETON_SKULL.getMaterial())
.setData(CompatibleMaterial.WITHER_SKELETON_SKULL.getData())
.setChance(2.5)
.addOnlyDropFors(EntityType.PLAYER).build();
@ -346,7 +346,7 @@ public class LootablesManager {
// Add Evoker.
lootManager.addLootable(new Lootable("EVOKER",
new LootBuilder()
.setMaterial(LegacyMaterials.TOTEM_OF_UNDYING.getMaterial())
.setMaterial(CompatibleMaterial.TOTEM_OF_UNDYING.getMaterial())
.setAllowLootingEnchant(false).build(),
new LootBuilder()
.setMaterial(Material.EMERALD)
@ -382,13 +382,13 @@ public class LootablesManager {
// Add Polar Bear.
lootManager.addLootable(new Lootable("POLAR_BEAR",
new LootBuilder()
.setMaterial(LegacyMaterials.COD.getMaterial())
.setMaterial(CompatibleMaterial.COD.getMaterial())
.setChance(75)
.setMin(0)
.setMax(2).build(),
new LootBuilder()
.setMaterial(LegacyMaterials.SALMON.getMaterial())
.setData(LegacyMaterials.SALMON.getData())
.setMaterial(CompatibleMaterial.SALMON.getMaterial())
.setData(CompatibleMaterial.SALMON.getData())
.setChance(25)
.setMin(0)
.setMax(2).build()));
@ -397,8 +397,8 @@ public class LootablesManager {
// Add Pig.
lootManager.addLootable(new Lootable("PIG",
new LootBuilder()
.setMaterial(LegacyMaterials.PORKCHOP.getMaterial())
.setBurnedMaterial(LegacyMaterials.COOKED_PORKCHOP.getMaterial())
.setMaterial(CompatibleMaterial.PORKCHOP.getMaterial())
.setBurnedMaterial(CompatibleMaterial.COOKED_PORKCHOP.getMaterial())
.setMin(1)
.setMax(3).build()));
@ -410,8 +410,8 @@ public class LootablesManager {
.setMin(0)
.setMax(2).build(),
new LootBuilder()
.setMaterial(LegacyMaterials.BEEF.getMaterial())
.setBurnedMaterial(LegacyMaterials.COOKED_BEEF.getMaterial())
.setMaterial(CompatibleMaterial.BEEF.getMaterial())
.setBurnedMaterial(CompatibleMaterial.COOKED_BEEF.getMaterial())
.setMin(1)
.setMax(3).build()));
@ -422,8 +422,8 @@ public class LootablesManager {
.setMin(0)
.setMax(2).build(),
new LootBuilder()
.setMaterial(LegacyMaterials.BEEF.getMaterial())
.setBurnedMaterial(LegacyMaterials.COOKED_BEEF.getMaterial())
.setMaterial(CompatibleMaterial.BEEF.getMaterial())
.setBurnedMaterial(CompatibleMaterial.COOKED_BEEF.getMaterial())
.setMin(1)
.setMax(3).build()));
@ -434,8 +434,8 @@ public class LootablesManager {
.setMin(0)
.setMax(2).build(),
new LootBuilder()
.setMaterial(LegacyMaterials.CHICKEN.getMaterial())
.setBurnedMaterial(LegacyMaterials.COOKED_CHICKEN.getMaterial()).build()));
.setMaterial(CompatibleMaterial.CHICKEN.getMaterial())
.setBurnedMaterial(CompatibleMaterial.COOKED_CHICKEN.getMaterial()).build()));
// Add Zombie.
lootManager.addLootable(new Lootable("ZOMBIE",
new LootBuilder()
@ -533,7 +533,7 @@ public class LootablesManager {
// Add Creeper.
lootManager.addLootable(new Lootable("CREEPER",
new LootBuilder()
.setMaterial(LegacyMaterials.GUNPOWDER.getMaterial())
.setMaterial(CompatibleMaterial.GUNPOWDER.getMaterial())
.setMin(0)
.setMax(2).build(),
discs));
@ -578,7 +578,7 @@ public class LootablesManager {
.setMin(0)
.setMax(2).build(),
new LootBuilder()
.setMaterial(LegacyMaterials.GUNPOWDER.getMaterial())
.setMaterial(CompatibleMaterial.GUNPOWDER.getMaterial())
.setChance(12.5)
.setMin(0)
.setMax(2).build(),
@ -597,14 +597,14 @@ public class LootablesManager {
.setMin(1)
.setMax(2).build(),
new LootBuilder()
.setMaterial(LegacyMaterials.WHITE_WOOL.getMaterial())
.setMaterial(CompatibleMaterial.WHITE_WOOL.getMaterial())
.setMin(2)
.setMax(2).build()));
// Add Squid.
lootManager.addLootable(new Lootable("SQUID",
new LootBuilder()
.setMaterial(LegacyMaterials.INK_SAC.getMaterial())
.setMaterial(CompatibleMaterial.INK_SAC.getMaterial())
.setMin(1)
.setMax(3).build()));
@ -671,7 +671,7 @@ public class LootablesManager {
// Add Snowman.
lootManager.addLootable(new Lootable("SNOWMAN",
new LootBuilder()
.setMaterial(LegacyMaterials.SNOWBALL.getMaterial())
.setMaterial(CompatibleMaterial.SNOWBALL.getMaterial())
.setMin(0)
.setMax(15).build()));
@ -690,7 +690,7 @@ public class LootablesManager {
// Add Iron Golem.
lootManager.addLootable(new Lootable("IRON_GOLEM",
new LootBuilder()
.setMaterial(LegacyMaterials.POPPY.getMaterial())
.setMaterial(CompatibleMaterial.POPPY.getMaterial())
.setMin(0)
.setMax(2).build(),
new LootBuilder()
@ -712,7 +712,7 @@ public class LootablesManager {
.setMin(0)
.setMax(1).build(),
new LootBuilder()
.setMaterial(LegacyMaterials.GUNPOWDER.getMaterial())
.setMaterial(CompatibleMaterial.GUNPOWDER.getMaterial())
.setMin(0)
.setMax(2).build()));

View File

@ -1,6 +1,6 @@
package com.songoda.ultimatestacker.utils;
import com.songoda.core.compatibility.LegacyMaterials;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.compatibility.ServerVersion;
import com.songoda.core.utils.TextUtils;
import com.songoda.ultimatestacker.UltimateStacker;
@ -164,7 +164,7 @@ public class Methods {
}
public static ItemStack getSpawnerItem(EntityType entityType, int amount) {
ItemStack item = LegacyMaterials.SPAWNER.getItem();
ItemStack item = CompatibleMaterial.SPAWNER.getItem();
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(Methods.compileSpawnerName(entityType, amount));
CreatureSpawner cs = (CreatureSpawner) ((BlockStateMeta) meta).getBlockState();