diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilInv.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilInv.java index aa0b8acb8..6a75d2e99 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilInv.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilInv.java @@ -413,4 +413,28 @@ public class UtilInv return newItem; } + + public static boolean HasSpace(Player player, Material material, int amount) + { + int slotsFree = 0; + + for (int slot = 0; slot < player.getInventory().getSize(); slot++) + { + if (player.getInventory().getItem(slot) == null) + { + slotsFree++; + + if (slotsFree >= amount / 64) + { + return true; + } + } + else if (player.getInventory().getItem(slot).getType().equals(material) && amount <= (64 - player.getInventory().getItem(slot).getAmount())) + { + return true; + } + } + + return false; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ShopPageBase.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ShopPageBase.java index 56fa078f7..e68b0c594 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ShopPageBase.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ShopPageBase.java @@ -23,15 +23,15 @@ import mineplex.core.shop.item.IButton; public abstract class ShopPageBase> extends CraftInventoryCustom implements Listener { - private PluginType _plugin; - private CoreClientManager _clientManager; - private DonationManager _donationManager; - private ShopType _shop; - private Player _player; - private CoreClient _client; - private CurrencyType _currencyType; - private NautHashMap _buttonMap; - private boolean _showCurrency = false; + protected PluginType _plugin; + protected CoreClientManager _clientManager; + protected DonationManager _donationManager; + protected ShopType _shop; + protected Player _player; + protected CoreClient _client; + protected CurrencyType _currencyType; + protected NautHashMap _buttonMap; + protected boolean _showCurrency = false; private int _currencySlot = 4; diff --git a/Plugins/Mineplex.Game.Clans.Core/src/mineplex/game/clans/core/repository/ClanRepository.java b/Plugins/Mineplex.Game.Clans.Core/src/mineplex/game/clans/core/repository/ClanRepository.java index 8e1d03737..0997a93c0 100644 --- a/Plugins/Mineplex.Game.Clans.Core/src/mineplex/game/clans/core/repository/ClanRepository.java +++ b/Plugins/Mineplex.Game.Clans.Core/src/mineplex/game/clans/core/repository/ClanRepository.java @@ -201,7 +201,7 @@ public class ClanRepository extends MinecraftRepository clan.Deaths = resultSet.getInt(9); clan.WarWins = resultSet.getInt(10); clan.WarLosses = resultSet.getInt(11); - clan.Generator = resultSet.getString(12); + clan.GeneratorBuyer = resultSet.getString(12); clan.GeneratorStock = resultSet.getInt(13); clan.DateCreated = resultSet.getTimestamp(14); clan.LastOnline = resultSet.getTimestamp(15); @@ -294,7 +294,7 @@ public class ClanRepository extends MinecraftRepository token.WarWins = resultSet.getInt(10); token.WarLosses = resultSet.getInt(11); - token.Generator = resultSet.getString(12); + token.GeneratorBuyer = resultSet.getString(12); token.GeneratorStock = resultSet.getInt(13); token.DateCreated = resultSet.getTimestamp(14); token.LastOnline = resultSet.getTimestamp(15); diff --git a/Plugins/Mineplex.Game.Clans.Core/src/mineplex/game/clans/core/repository/tokens/ClanToken.java b/Plugins/Mineplex.Game.Clans.Core/src/mineplex/game/clans/core/repository/tokens/ClanToken.java index 0df6165d1..64fc17224 100644 --- a/Plugins/Mineplex.Game.Clans.Core/src/mineplex/game/clans/core/repository/tokens/ClanToken.java +++ b/Plugins/Mineplex.Game.Clans.Core/src/mineplex/game/clans/core/repository/tokens/ClanToken.java @@ -18,7 +18,7 @@ public class ClanToken public int WarWins; public int WarLosses; public int EloRating; - public String Generator; + public String GeneratorBuyer; public int GeneratorStock; public Timestamp DateCreated; public Timestamp LastOnline; diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClanInfo.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClanInfo.java index a33523f0e..e03632ef6 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClanInfo.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClanInfo.java @@ -121,23 +121,6 @@ public class ClanInfo _bedStatus = BedStatus.DOESNT_EXIST; } - try - { - if (token.Generator != null && token.Generator.length() > 0) - { - Block block = UtilWorld.strToBlock(token.Generator); - if (block != null) - { - _generator = new TntGenerator(block); - _generator.setStock(token.GeneratorStock); - } - } - } - catch (Exception e) - { - - } - _energy = token.Energy; _admin = token.Admin; @@ -171,6 +154,39 @@ public class ClanInfo ClanWarData warData = warToken.WarData; _warOut.put(warData.getClanB(), warData); } + + try + { + if (token.GeneratorBuyer != null && token.GeneratorBuyer.length() > 0) + { + if (token.GeneratorBuyer.contains(",")) + { + // Convert to new generator format; + + for (ClanMemberToken memberToken : token.Members) + { + ClanRole role = ClanRole.valueOf(memberToken.ClanRole); + + if (role.equals(ClanRole.LEADER)) + { + token.GeneratorBuyer = memberToken.PlayerUUID.toString(); + break; + } + } + + System.out.println("Clans> Converted " + _name + "'s generator to the new format."); + } + + _generator = new TntGenerator(token.GeneratorBuyer); + _generator.setStock(token.GeneratorStock); + + Clans.getClanDataAccess().updateGenerator(this, null); + } + } + catch (Exception e) + { + + } } public int getClaims() diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansDataAccessLayer.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansDataAccessLayer.java index 9ca0714f1..616ed2213 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansDataAccessLayer.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansDataAccessLayer.java @@ -724,17 +724,17 @@ public class ClansDataAccessLayer public void updateGenerator(final ClanInfo clanInfo, final Callback callback) { TntGenerator generator = clanInfo.getGenerator(); - final String location; + final String creator; final int generatorStock; if (generator != null) { - location = UtilWorld.blockToStr(generator.getBlock()); + creator = generator.getCreator().toString(); generatorStock = generator.getStock(); } else { - location = ""; + creator = ""; generatorStock = 0; } @@ -743,7 +743,7 @@ public class ClansDataAccessLayer @Override public void run() { - final boolean ran = _repository.updateClanGenerator(clanInfo.getId(), location, generatorStock); + final boolean ran = _repository.updateClanGenerator(clanInfo.getId(), creator, generatorStock); runSync(new Runnable() { @Override @@ -751,9 +751,14 @@ public class ClansDataAccessLayer { if (callback != null) { - callback.run(ran); - } else { - if(!ran) System.out.println("Tnt Gen didn't save!"); + callback.run(Boolean.valueOf(ran)); + } + else + { + if (!ran) + { + System.out.println("Tnt Gen didn't save!"); + } } } }); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java index 7a924de7a..5b41d02ac 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java @@ -1074,7 +1074,7 @@ public class ClansManager extends MiniClientPluginimplements IRelati public void onJoin(PlayerLoginEvent event) { Rank rank = _clientManager.Get(event.getPlayer()).GetRank(); - if (!event.getPlayer().isWhitelisted() && !rank.has(Rank.LEGEND)) + if (!event.getPlayer().isOp() && !event.getPlayer().isWhitelisted() && !rank.has(Rank.LEGEND)) { event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "Clans is currently in Legend+ only Alpha!"); // event.setKickMessage("This server is whitelisted!"); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/page/ClanWhoPage.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/page/ClanWhoPage.java index dd417956c..6fe27d3ad 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/page/ClanWhoPage.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/page/ClanWhoPage.java @@ -99,7 +99,7 @@ public class ClanWhoPage extends ClanPageBase if (_lookupClan.equals(clanInfo)) { String clanHome = _lookupClan.getHome() == null ? "None" : UtilWorld.locToStrClean(_lookupClan.getHome()); - String generator = _lookupClan.getGenerator() == null ? "None" : UtilWorld.blockToStrClean(_lookupClan.getGenerator().getBlock()); + String generator = _lookupClan.getGenerator() == null ? "None" : "Yes"; lore.add(C.Reset + C.cYellow + "Clan Home " + C.cWhite + clanHome); lore.add(C.Reset + C.cYellow + "TNT Generator " + C.cWhite + generator); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/outpost/Outpost.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/outpost/Outpost.java index 9b46e54d9..19029c5af 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/outpost/Outpost.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/outpost/Outpost.java @@ -29,6 +29,7 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.ColorFader; import mineplex.core.common.util.EnclosedObject; import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.LoopIterator; import mineplex.core.common.util.RGBData; import mineplex.core.common.util.UtilAction; @@ -66,7 +67,7 @@ import net.minecraft.server.v1_8_R3.AxisAlignedBB; public class Outpost implements Listener { protected static final long MAX_LIFETIME = 30 * 60 * 1000; // 30 minutes - public static final ItemStack OUTPOST_ITEM = new ItemBuilder(Material.NETHERRACK, 1).setRawTitle(C.cBlue + "Outpost").setLore(C.cWhite + "It appears to be a contraption of some sort!").build(); + public static final ItemStack OUTPOST_ITEM = new ItemBuilder(Material.BEACON, 1).setRawTitle(C.cBlue + "Outpost").build(); public static final long PREP_TIME = 2 * 60 * 1000; @@ -575,7 +576,7 @@ public class Outpost implements Listener _blocks.values().stream().forEach(block -> { Material mat = Material.getMaterial(block.getId()); - if (UtilItem.isTranslucent(mat)) + if (UtilItem.isTranslucent(mat) || UtilMath.random.nextBoolean()) { block.restore(); return; diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/Cannon.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/Cannon.java index baebd36e6..8298be2be 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/Cannon.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/Cannon.java @@ -40,7 +40,7 @@ import mineplex.game.clans.clans.siege.weapon.util.WeaponStateInfo; public class Cannon extends SiegeWeapon { - public static final ItemStack CANNON_ITEM = new ItemBuilder(Material.IRON_BLOCK, 1).setRawTitle(C.cBlue + "Cannon").setLore(C.cWhite + "BOOM BABY!").build(); + public static final ItemStack CANNON_ITEM = new ItemBuilder(Material.SPONGE, 1).setData((byte) 1).setRawTitle(C.cBlue + "Cannon").build(); private int _firepower = 1; diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/tntGenerator/TntGenerator.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/tntGenerator/TntGenerator.java index 3712896f2..3206c834c 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/tntGenerator/TntGenerator.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/tntGenerator/TntGenerator.java @@ -1,16 +1,18 @@ package mineplex.game.clans.clans.tntGenerator; +import java.util.UUID; + import org.bukkit.block.Block; public class TntGenerator { - private Block _block; + private UUID _creator; private int _ticks; private int _stock; - public TntGenerator(Block block) + public TntGenerator(String data) { - _block = block; + _creator = UUID.fromString(data); } public int getTicks() @@ -38,8 +40,8 @@ public class TntGenerator _stock = stock; } - public Block getBlock() + public UUID getCreator() { - return _block; + return _creator; } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/tntGenerator/TntGeneratorManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/tntGenerator/TntGeneratorManager.java index b6f4edf09..2654c99b5 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/tntGenerator/TntGeneratorManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/tntGenerator/TntGeneratorManager.java @@ -1,40 +1,18 @@ package mineplex.game.clans.clans.tntGenerator; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; -import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; -import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.block.Action; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.event.block.BlockPlaceEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.java.JavaPlugin; -import net.minecraft.server.v1_8_R3.TileEntityBrewingStand; - import mineplex.core.MiniPlugin; -import mineplex.core.common.util.C; -import mineplex.core.common.util.Callback; import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilTextMiddle; -import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilWorld; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.game.clans.clans.ClanInfo; import mineplex.game.clans.clans.ClansManager; -import mineplex.game.clans.clans.event.ClanDeleteEvent; public class TntGeneratorManager extends MiniPlugin { - public static final Material GENERATOR_MATERIAL = Material.BREWING_STAND; - public static final Material GENERATOR_DROP_MATERIAL = Material.BREWING_STAND_ITEM; - public static final int SECONDS_PER_TNT = 60 * 60 * 10; // 10 Hours + public static final int SECONDS_PER_TNT = 1000 * 30;//60 * 60 * 10; // 10 Hours public static final int MAX_GENERATOR_STOCK = 3; private ClansManager _clansManager; @@ -57,26 +35,6 @@ public class TntGeneratorManager extends MiniPlugin TntGenerator generator = clanInfo.getGenerator(); if (generator != null) { - // Check that generator still exists - if (generator.getBlock().getType() != GENERATOR_MATERIAL) - { - clanInfo.setGenerator(null); - _clansManager.getClanDataAccess().updateGenerator(clanInfo, null); - continue; - } - - // Check that generator is still in clan territory - ClanInfo owner = _clansManager.getClanUtility().getOwner(generator.getBlock().getLocation()); - if (!clanInfo.equals(owner)) - { - _clansManager.messageClan(clanInfo, F.main("Clans", "Your " + F.elem("TNT Generator") + " has been destroyed due to the land no longer being claimed")); - destroyGenerator(generator); - clanInfo.setGenerator(null); - _clansManager.getClanDataAccess().updateGenerator(clanInfo, null); - continue; - } - - if (generator.getStock() >= MAX_GENERATOR_STOCK) { generator.setTicks(0); @@ -85,10 +43,9 @@ public class TntGeneratorManager extends MiniPlugin { if (generator.getTicks() >= SECONDS_PER_TNT) { - _clansManager.messageClan(clanInfo, F.main("Clans", "Your " + F.elem("TNT Generator") + " has a new TNT available")); + _clansManager.messageClan(clanInfo, F.main("Clans", "Your " + F.elem("TNT Generator") + " in the " + F.elem("PvP Shop") + " has a new TNT available")); generator.setStock(generator.getStock() + 1); generator.setTicks(0); - updateBrewingStand(generator); _clansManager.getClanDataAccess().updateGenerator(clanInfo, null); } @@ -97,202 +54,4 @@ public class TntGeneratorManager extends MiniPlugin } } } - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public void onPlace(BlockPlaceEvent event) - { - if (event.getBlockPlaced().getType() == GENERATOR_MATERIAL) - { - ClanInfo clan = _clansManager.getClan(event.getPlayer()); - - if (clan == null) - { - UtilPlayer.message(event.getPlayer(), F.main("Clans", "You must be in a clan to place a " + F.elem("TNT Generator"))); - event.setCancelled(true); - return; - } - - // Confirm they are placing in their own land - ClanInfo owner = _clansManager.getClanUtility().getOwner(event.getBlock().getLocation()); - if (!clan.equals(owner)) - { - UtilPlayer.message(event.getPlayer(), F.main("Clans", "You must place the " + F.elem("TNT Generator") + " on your own land")); - event.setCancelled(true); - return; - } - - TntGenerator oldGenerator = clan.getGenerator(); - - if (oldGenerator != null) - { - UtilPlayer.message(event.getPlayer(), F.main("Clans", "Your clan already has a " + F.elem("TNT Generator"))); - event.setCancelled(true); - return; - } - -// event.getBlockPlaced().setType(GENERATOR_MATERIAL); - - TntGenerator generator = new TntGenerator(event.getBlock()); - clan.setGenerator(generator); - _clansManager.getClanDataAccess().updateGenerator(clan, null); - - _clansManager.messageClan(clan, F.main("Clans", F.name(event.getPlayer().getName()) + " placed a " + F.elem("TNT Generator") + " at " + F.elem(UtilWorld.blockToStrClean(event.getBlock())))); - } - } - - @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) - public void onBreak(BlockBreakEvent event) - { - if (event.getBlock() != null && event.getBlock().getType() == GENERATOR_MATERIAL) - { - ClanInfo clan = getGenerator(event.getBlock()); - if (clan != null) - { - destroyGenerator(clan.getGenerator()); - clan.setGenerator(null); - _clansManager.getClanDataAccess().updateGenerator(clan, null); - _clansManager.messageClan(clan, F.main("Clans", "Your " + F.elem("TNT Generator") + " has been destroyed by " + F.elem(event.getPlayer().getName()))); - } - - clearStand(event.getBlock()); - event.getBlock().setTypeId(0); - event.setCancelled(true); - } - } - - @EventHandler - public void onInteract(final PlayerInteractEvent event) - { - if (event.getAction() == Action.RIGHT_CLICK_BLOCK && event.getClickedBlock() != null && event.getClickedBlock().getType() == GENERATOR_MATERIAL) - { - ClanInfo clan = getGenerator(event.getClickedBlock()); - if (clan != null) - { - interact(clan, event.getPlayer()); - }else { //fix tnt gen issues - //Can only place one of these in a clan location. so it must be a generator - ClanInfo owner = _clansManager.getClanUtility().getOwner(event.getClickedBlock().getLocation()); - if(owner == null) return; //Wilderness - TntGenerator generator = owner.getGenerator(); - System.out.println("Unable to find generator"); - //Create generator if not exist - if(generator == null || !generator.getBlock().equals(event.getClickedBlock())) { - generator = new TntGenerator(event.getClickedBlock()); - generator.setStock(2); - clan.setGenerator(generator); - _clansManager.getClanDataAccess().updateGenerator(clan, null); - } - interact(owner, event.getPlayer()); - } - - event.setCancelled(true); - } - } - - private void interact(ClanInfo clan, Player player) { - final TntGenerator generator = clan.getGenerator(); - final int stock = generator.getStock(); - - if (stock > 0) - { - generator.setStock(stock - 1); - _clansManager.getClanDataAccess().updateGenerator(clan, new Callback() - { - @Override - public void run(Boolean data) - { - if (data) - { - updateBrewingStand(generator); - dropItem(generator.getBlock(), new ItemStack(Material.TNT)); - } - else - { - // failed - generator.setStock(stock); - } - } - }); - } - else - { - int secondLeft = SECONDS_PER_TNT - generator.getTicks(); - int msLeft = secondLeft * 1000; - UtilTextMiddle.display("", C.cRed + "Next TNT in " + C.cGold + UtilTime.convertString(msLeft, 1, UtilTime.TimeUnit.FIT), player); - } - } - - @EventHandler - public void onDelete(ClanDeleteEvent event) - { - ClanInfo clan = event.getClanInfo(); - - if (clan != null && clan.getGenerator() != null) - { - clearStand(clan.getGenerator().getBlock()); - clan.getGenerator().getBlock().setTypeId(0); - } - } - - private void dropItem(Block dropLocation, ItemStack item) - { - dropLocation.getWorld().dropItemNaturally(dropLocation.getLocation().add(0.5, 0.5, 0.5), item); - } - - public ClanInfo getGenerator(Block block) - { - for (ClanInfo clanInfo : _clansManager.getClanMap().values()) - { - TntGenerator generator = clanInfo.getGenerator(); - - if (generator != null && block.equals(generator.getBlock())) - return clanInfo; - } - - return null; - } - - private void destroyGenerator(TntGenerator generator) - { - for (int i = 0; i < generator.getStock(); i++) - { - dropItem(generator.getBlock(), new ItemStack(Material.TNT)); - } - - generator.setStock(0); - dropItem(generator.getBlock(), new ItemStack(GENERATOR_DROP_MATERIAL)); - clearStand(generator.getBlock()); - generator.getBlock().setTypeId(0); - } - - private void clearStand(Block block) - { - TileEntityBrewingStand tileEntity = (TileEntityBrewingStand)((CraftWorld)block.getWorld()).getTileEntityAt(block.getX(), block.getY(), block.getZ()); - if (tileEntity != null) - { - for (int i = 0; i < 4; i++) - { - tileEntity.setItem(i, null); - } - } - } - - private void updateBrewingStand(TntGenerator generator) - { - Block block = generator.getBlock(); - - if (block != null && block.getType() == Material.BREWING_STAND) - { - TileEntityBrewingStand tileEntity = (TileEntityBrewingStand)((CraftWorld)block.getWorld()).getTileEntityAt(block.getX(), block.getY(), block.getZ()); - for (int i = 0; i < 3; i++) - { - ItemStack item = new ItemStack(Material.TNT); - net.minecraft.server.v1_8_R3.ItemStack nmsItem = CraftItemStack.asNMSCopy(item); - - int itemSlot = i; - tileEntity.setItem(i, (generator.getStock() > i) ? nmsItem : null); - } - tileEntity.update(); - } - } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/EventTerrainFinder.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/EventTerrainFinder.java index b815e652b..27d574419 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/EventTerrainFinder.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/EventTerrainFinder.java @@ -40,6 +40,12 @@ public class EventTerrainFinder { EnclosedObject loc = new EnclosedObject<>(); + if (_clansManager.getClanUtility().getClanByClanName("Borderlands") == null) + { + System.out.println("[WORLD EVENT] FATAL ERROR: CLAN BORDERLANDS NOT FOUND."); + break; + } + _clansManager.getClanUtility().getClanByClanName("Borderlands").getClaimSet().stream().filter(claim -> Math.random() > .5).filter(claim -> Math.random() > .5).filter(claim -> Math.random() > .3).filter(claim -> Math.random() > .7).limit(1).forEach(claim -> { Chunk chunk = UtilWorld.strToChunk(claim); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/ClansShopItem.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/ClansShopItem.java index 71edd59bf..3ba9eaff8 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/ClansShopItem.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/ClansShopItem.java @@ -3,6 +3,8 @@ package mineplex.game.clans.shop; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; +import mineplex.core.common.util.C; + public enum ClansShopItem { // PvP Shop @@ -75,7 +77,9 @@ public enum ClansShopItem NETHER_BRICK(50, 10, Material.NETHER_BRICK, 1), QUARTZ_BLOCK(75, 15, Material.QUARTZ_BLOCK, 1), CLAY(30, 6, Material.CLAY, 1), - GOLD_TOKEN(50000, 50000, Material.GOLD_RECORD, 1, (byte) 0, "Gold Token"); + GOLD_TOKEN(50000, 50000, Material.GOLD_RECORD, 1, (byte) 0, "Gold Token"), + OUTPOST(100000, 0, Material.BEACON, 1, (byte) 0, C.cBlue + "Outpost"), + CANNON(50000, 0, Material.SPONGE, 1, (byte) 1, C.cBlue + "Cannon"); private int _buyPrice; private int _sellPrice; diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/pvp/PvpPage.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/pvp/PvpPage.java index f06045627..bc19174c5 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/pvp/PvpPage.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/pvp/PvpPage.java @@ -1,10 +1,13 @@ package mineplex.game.clans.shop.pvp; import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.C; import mineplex.core.donation.DonationManager; +import mineplex.core.itemstack.ItemBuilder; import mineplex.game.clans.clans.ClansManager; -import mineplex.game.clans.shop.ClansShopPage; import mineplex.game.clans.shop.ClansShopItem; +import mineplex.game.clans.shop.ClansShopPage; +import mineplex.game.clans.shop.pvp.tnt.TNTGenShop; public class PvpPage extends ClansShopPage { @@ -54,9 +57,14 @@ public class PvpPage extends ClansShopPage addShopItem(33, ClansShopItem.BOW, "Standard Bow"); addShopItem(34, ClansShopItem.ARROW, (byte) 0, "Arrows", 16); + addShopItem(52 - 9, ClansShopItem.CANNON, "Cannon"); + addShopItem(53 - 9, ClansShopItem.OUTPOST, "Outpost"); + addShopItem(51, ClansShopItem.ENCHANTMENT_TABLE, "Class Shop"); addShopItem(52, ClansShopItem.TNT, "TNT"); - addShopItem(53, ClansShopItem.TNT_GENERATOR, "TNT Generator"); + addButton(53, new ItemBuilder(ClansShopItem.TNT_GENERATOR.getMaterial()).setTitle(C.cAqua + "Manage TNT Generator").build(), (player, click) -> + new TNTGenShop(_plugin, _clientManager, _donationManager).attemptShopOpen(player) + ); } }