diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java index e84d2de09..32a99bb48 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java @@ -49,7 +49,7 @@ public class Clans extends JavaPlugin { public static final String VERSION = "0.12"; private String WEB_CONFIG = "webServer"; - + // Modules private CoreClientManager _clientManager; private DonationManager _donationManager; @@ -64,49 +64,49 @@ public class Clans extends JavaPlugin saveConfig(); String webServerAddress = getConfig().getString(WEB_CONFIG); - + // Logger.initialize(this); - + // Static Modules CommandCenter.Initialize(this); _clientManager = new CoreClientManager(this, webServerAddress); CommandCenter.Instance.setClientManager(_clientManager); - + ItemStackFactory.Initialize(this, false); Recharge.Initialize(this); VisibilityManager.Initialize(this); // new ProfileCacheManager(this); - + _donationManager = new DonationManager(this, _clientManager, webServerAddress); new ServerConfiguration(this, _clientManager); PreferencesManager preferenceManager = new PreferencesManager(this, _clientManager, _donationManager); - + ServerStatusManager serverStatusManager = new ServerStatusManager(this, _clientManager, new LagMeter(this, _clientManager)); // TODO: Add spawn locations to a configuration file of some sort? new Spawn(this, serverStatusManager.getCurrentServerName()); Give.Initialize(this); - + Teleport teleport = new Teleport(this); Portal portal = new Portal(this, _clientManager, serverStatusManager.getCurrentServerName()); new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion()); - + Punish punish = new Punish(this, webServerAddress, _clientManager); AntiHack.Initialize(this, punish, portal, preferenceManager, _clientManager); AntiHack.Instance.setKick(false); - + BlockRestore blockRestore = new BlockRestore(this); - + IgnoreManager ignoreManager = new IgnoreManager(this, _clientManager, preferenceManager, portal); - + StatsManager statsManager = new StatsManager(this, _clientManager); AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, _donationManager); Chat chat = new Chat(this, _clientManager, preferenceManager, achievementManager, serverStatusManager.getCurrentServerName()); new MessageManager(this, _clientManager, preferenceManager, ignoreManager, punish, new FriendManager(this, _clientManager, preferenceManager, portal), chat); - + new MemoryFix(this); new FoodDupeFix(this); new Explosion(this, blockRestore); @@ -116,7 +116,7 @@ public class Clans extends JavaPlugin // Enable custom-gear related managers PacketHandler packetHandler = new PacketHandler(this); GearManager customGear = new GearManager(this, packetHandler, _clientManager, _donationManager); - + HologramManager hologram = new HologramManager(this); _clansManager = new ClansManager(this, serverStatusManager.getCurrentServerName(), packetHandler, _clientManager, _donationManager, preferenceManager, blockRestore, teleport, chat, customGear, hologram, webServerAddress); new Recipes(this); @@ -134,14 +134,14 @@ public class Clans extends JavaPlugin ((CraftWorld) world).getHandle().spigotConfig.itemMerge = 0; } - // Updates - getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1); + //Updates + new Updater(this); MinecraftServer.getServer().getPropertyManager().setProperty("debug", true); getServer().setWhitelist(false); // TODO: remove } - + public static String prettifyName(Material material) { String name = ""; @@ -155,7 +155,7 @@ public class Clans extends JavaPlugin return name; } - + @Override public void onDisable() { 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 043542af5..3e5e2e0a5 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 @@ -38,7 +38,7 @@ public class ClanInfo private String _name = ""; private String _desc = ""; private Location _home = null; - private int _energy = 1440; + private int _energy = 4320; // Stats private int _kills; @@ -545,14 +545,17 @@ public class ClanInfo { int warPoints = 0; - ClanWarData data = _warIn.get(against); - if (data != null) + if (against != null) { - warPoints = data.getClanBPoints(); - } - else if ((data = _warOut.get(against)) != null) - { - warPoints = data.getClanAPoints(); + ClanWarData data = _warIn.get(against.getName()); + if (data != null) + { + warPoints = data.getClanBPoints(); + } + else if ((data = _warOut.get(against.getName())) != null) + { + warPoints = data.getClanAPoints(); + } } return warPoints; @@ -630,7 +633,7 @@ public class ClanInfo public int getEnergyMax() { // 10080 = 7 days of minutes - return Math.max(1440, getEnergyCostPerMinute() * 60 * 24 * 3); + return Math.max(4320, getEnergyCostPerMinute() * 60 * 24 * 3); } public int getEnergyCostPerMinute() 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 eb627c0ab..fca50c3e4 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 @@ -144,7 +144,7 @@ public class ClansDataAccessLayer token.Description = "No Description"; token.Home = ""; token.Admin = admin; - token.Energy = 1440; + token.Energy = 4320; ClanCreatedEvent event = new ClanCreatedEvent(token, Bukkit.getPlayer(creator)); UtilServer.getServer().getPluginManager().callEvent(event); 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 3a7e60260..819153f12 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 @@ -832,7 +832,12 @@ public class ClansManager extends MiniClientPluginimplements IRelati { return _chat; } - + + public ClansScoreboardManager getScoreboard() + { + return _scoreboard; + } + /** * Get the timezone for this server. This may be used in the future if we * have clans servers with varying timezones. diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansPlayerComparator.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansPlayerComparator.java index cfa92407d..593109d42 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansPlayerComparator.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansPlayerComparator.java @@ -12,7 +12,7 @@ public class ClansPlayerComparator implements Comparator if (o1.isOnline() != o2.isOnline()) { - return o1.isOnline() ? 1 : -1; + return o1.isOnline() ? -1 : 1; } if (o1.getRole() != o2.getRole()) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/page/ClanMainPage.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/page/ClanMainPage.java index cf44fc3ff..a0de02304 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/page/ClanMainPage.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/gui/page/ClanMainPage.java @@ -242,6 +242,9 @@ public class ClanMainPage extends ClanPageBase for (int i = 0; i < 4 && descIterator.hasNext(); i++) { ClanWarData data = descIterator.next(); + if (data.getPoints(clanInfo.getName()) <= 0) + break; + int slot = 45 + i; addWarButton(slot, clanInfo, data); } @@ -249,6 +252,9 @@ public class ClanMainPage extends ClanPageBase for (int i = 0; i < 4 && ascIterator.hasNext(); i++) { ClanWarData data = ascIterator.next(); + if (data.getPoints(clanInfo.getName()) >= 0) + break; + int slot = 53 - i; addWarButton(slot, clanInfo, data); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/observer/ObserverManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/observer/ObserverManager.java index 9bbe6588f..e127a0d02 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/observer/ObserverManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/observer/ObserverManager.java @@ -10,6 +10,7 @@ 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.entity.EntityDamageByEntityEvent; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerPickupItemEvent; @@ -67,11 +68,17 @@ public class ObserverManager extends MiniPlugin private void restore(Player player, ObserverData data) { data.getSnapshot().applySnapshot(player); -// _conditionManager.Clean(player); + _conditionManager.Clean(player); player.setGameMode(GameMode.SURVIVAL); ((CraftPlayer) player).getHandle().spectating = false; } + @EventHandler + public void onDamage(EntityDamageByEntityEvent event) + { + if (_observerMap.containsKey(event.getDamager()) || _observerMap.containsKey(event.getEntity())) + event.setCancelled(true); + } @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onInteract(PlayerInteractEvent event) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/supplyDrop/SupplyDrop.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/supplyDrop/SupplyDrop.java index 91b2fe655..9aa27baff 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/supplyDrop/SupplyDrop.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/supplyDrop/SupplyDrop.java @@ -3,6 +3,7 @@ package mineplex.game.clans.clans.supplyDrop; import java.lang.reflect.Field; import java.util.Random; +import org.bukkit.Bukkit; import org.bukkit.Color; import org.bukkit.FireworkEffect; import org.bukkit.Material; @@ -27,7 +28,7 @@ import mineplex.game.clans.clans.ClansManager; public class SupplyDrop implements Listener { - private static int DROP_TICKS = 20 * 50; + private static int DROP_TICKS = 20 * 10; private static int REMOVE_TICKS = DROP_TICKS + (20 * 120); // 2 Minutes public static Material SUPPLY_DROP_MATERIAL = Material.BEACON; @@ -71,6 +72,7 @@ public class SupplyDrop implements Listener { if (getTicks() == 10) { + /* try { TileEntity tileEntity = ((CraftWorld) _block.getWorld()).getHandle().getTileEntity(new BlockPosition(_block.getX(), _block.getY(), _block.getZ())); @@ -91,6 +93,7 @@ public class SupplyDrop implements Listener { e.printStackTrace(); } + */ } if (getTicks() > 15 && getTicks() % 10 == 0) @@ -130,19 +133,27 @@ public class SupplyDrop implements Listener private void placeChest() { - getBlock().setType(Material.TRAPPED_CHEST); - Chest chest = (Chest) getBlock().getState(); + getBlock().setType(Material.CHEST); - Inventory inventory = chest.getBlockInventory(); - int slots = inventory.getSize(); - int drops = 5 + _random.nextInt(11); // 5 -> 15 - - for (int i = 0; i < drops; i++) + _clansManager.runSyncLater(new Runnable() { - int slot = _random.nextInt(slots); - ItemStack item = _clansManager.getLootManager().getRareItemStack(); - inventory.setItem(slot, item); - } + @Override + public void run() + { + Chest chest = (Chest) getBlock().getState(); + + Inventory inventory = chest.getBlockInventory(); + int slots = inventory.getSize(); + int drops = 5 + _random.nextInt(11); // 5 -> 15 + + for (int i = 0; i < drops; i++) + { + int slot = _random.nextInt(slots); + ItemStack item = _clansManager.getLootManager().getRareItemStack(); + inventory.setItem(slot, item); + } + } + }, 5); } private void finish() diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/war/WarManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/war/WarManager.java index f8db3fac2..b0d7a3d96 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/war/WarManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/war/WarManager.java @@ -115,7 +115,7 @@ public class WarManager extends MiniPlugin implements ScoreboardElement // } @EventHandler - public void handleDeath(ClansPlayerDeathEvent event) + public void handleDeath(final ClansPlayerDeathEvent event) { if (event.getPlayer() != null && event.getPlayer().getClan() != null) { @@ -139,7 +139,10 @@ public class WarManager extends MiniPlugin implements ScoreboardElement ClanInfo clanA = clan.getName().equals(war.getClanA()) ? clan : killerClan; ClanInfo clanB = clan.equals(clanA) ? killerClan : clan; _clansManager.getClanDataAccess().updateWar(clanA, clanB, war, null); - + + _clansManager.getScoreboard().refresh(killerClan); + _clansManager.getScoreboard().refresh(clan); + _clansManager.ClanTips.displayTip(TipType.DOMINANCE_RIP, event.getPlayer().getPlayer()); _clansManager.ClanTips.displayTip(TipType.DOMINANCE_NOOICE, event.getKiller().getPlayer()); } @@ -154,6 +157,12 @@ public class WarManager extends MiniPlugin implements ScoreboardElement ClansUtility.ClanRelation rel = _clansManager.getClanUtility().rel(clan, killerClan); _clansManager.messageClan(killerClan, F.main("Clans", "Your clan gained 1 War Point against " + rel.getColor(false) + clan.getName())); _clansManager.messageClan(clan, F.main("Clans", "Your clan lost 1 War Point against " + rel.getColor(false) + killerClan.getName())); + + _clansManager.getScoreboard().refresh(killerClan); + _clansManager.getScoreboard().refresh(clan); + + _clansManager.ClanTips.displayTip(TipType.DOMINANCE_RIP, event.getPlayer().getPlayer()); + _clansManager.ClanTips.displayTip(TipType.DOMINANCE_NOOICE, event.getKiller().getPlayer()); } }); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/GearManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/GearManager.java index 8e6c2f9c2..29141d926 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/GearManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/GearManager.java @@ -271,17 +271,23 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable { AttributeContainer attributes = new AttributeContainer(); generateAttributes(attributes, itemType, attributeCount); + + System.out.println("Generating attributes..."); + System.out.println("Remaining size: " + attributes.getRemainingTypes().size()); if (attributes.getSuperPrefix() != null) { + System.out.println("Set super prefix: " + attributes.getSuperPrefix().getClass()); factory.setSuperPrefix(attributes.getSuperPrefix().getClass()); } if (attributes.getPrefix() != null) { + System.out.println("Set prefix: " + attributes.getPrefix().getClass()); factory.setPrefix(attributes.getPrefix().getClass()); } if (attributes.getSuffix() != null) { + System.out.println("Set suffix: " + attributes.getSuffix().getClass()); factory.setSuffix(attributes.getSuffix().getClass()); } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/RareItemFactory.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/RareItemFactory.java index a5aba675b..04ae38ccd 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/RareItemFactory.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/RareItemFactory.java @@ -95,6 +95,15 @@ public class RareItemFactory } public ItemStack fabricate() + { + applyAttributes(); + + ItemStack item = _item.toItemStack(); + + return item; + } + + private void applyAttributes() { try { @@ -102,12 +111,12 @@ public class RareItemFactory { _item.getAttributes().addAttribute(_superPrefix.newInstance()); } - + if (_prefix != null) { _item.getAttributes().addAttribute(_prefix.newInstance()); } - + if (_suffix != null) { _item.getAttributes().addAttribute(_suffix.newInstance()); @@ -117,10 +126,6 @@ public class RareItemFactory { e.printStackTrace(); } - - ItemStack item = _item.toItemStack(); - - return item; } public ItemType getItemType() @@ -135,6 +140,7 @@ public class RareItemFactory public CustomItem getWrapper() { + applyAttributes(); return _item; } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/legendaries/GiantsBroadsword.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/legendaries/GiantsBroadsword.java index b01a40d95..0b059d11e 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/legendaries/GiantsBroadsword.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/legendaries/GiantsBroadsword.java @@ -53,7 +53,7 @@ public class GiantsBroadsword extends LegendaryItem private void buffPlayer(Player player) { - grantPotionEffect(player, PotionEffectType.SLOW, 4, 10); + grantPotionEffect(player, PotionEffectType.SLOW, 10, 10); grantPotionEffect(player, PotionEffectType.REGENERATION, 1, 10); } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/types/TutorialGettingStarted.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/types/TutorialGettingStarted.java index 49a724847..9d1d44dc6 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/types/TutorialGettingStarted.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/types/TutorialGettingStarted.java @@ -55,7 +55,7 @@ public class TutorialGettingStarted extends Tutorial _doScoreboard = true; _ghostMode = true; - _startOnJoin = true; + _startOnJoin = false; _uniqueId = "GettingStartedTutorial"; _friendlyName = "Getting Started"; diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClientClass.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClientClass.java index 57c9f51a6..aee8e5b48 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClientClass.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClientClass.java @@ -461,13 +461,21 @@ public class ClientClass { return _gameClass; } - - public boolean IsGameClass(ClassType type) + + public boolean IsGameClass(ClassType... types) { if (GetGameClass() == null) return false; - return GetGameClass().GetType() == type; + for (ClassType type : types) + { + if (type == GetGameClass().GetType()) + { + return true; + } + } + + return false; } public Collection GetSkills() diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/PvpClass.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/PvpClass.java index 8be18e9d1..4c28f55eb 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/PvpClass.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/PvpClass.java @@ -196,11 +196,12 @@ public class PvpClass implements IPvpClass continue; } - if (_classes.getGadgetManager().getActive(cur, GadgetType.Costume) != null) + if (_classes.getGadgetManager() != null && _classes.getGadgetManager().getActive(cur, GadgetType.Costume) != null) continue; Equip(cur, _classes.getMessageSuppressedCallback(cur.getName()) == null); - _classes.getMessageSuppressedCallback(cur.getName()).run(cur.getName()); + Callback callback = _classes.getMessageSuppressedCallback(cur.getName()); + if (callback != null) callback.run(cur.getName()); } } } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/BlockToss.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/BlockToss.java index 94cdc9b3d..135c0278b 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/BlockToss.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/BlockToss.java @@ -37,6 +37,8 @@ import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.minecraft.game.classcombat.Skill.SkillCharge; import mineplex.minecraft.game.classcombat.Skill.SkillFactory; +import mineplex.minecraft.game.classcombat.Skill.event.BlockTossExpireEvent; +import mineplex.minecraft.game.classcombat.Skill.event.BlockTossLandEvent; import mineplex.minecraft.game.classcombat.Skill.event.SkillEvent; import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; @@ -46,6 +48,22 @@ public class BlockToss extends SkillCharge implements IThrown private HashMap _holding = new HashMap(); private HashMap _falling = new HashMap(); + private Material[] _blacklist = new Material[] + { + Material.TNT, + Material.IRON_DOOR, + Material.IRON_DOOR_BLOCK, + Material.WOOD_DOOR, + Material.WOODEN_DOOR, + Material.ENCHANTMENT_TABLE, + Material.CHEST, + Material.FURNACE, + Material.BURNING_FURNACE, + Material.WORKBENCH, + Material.WATER, + Material.LAVA + }; + public BlockToss(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) { super(skills, name, classType, skillType, cost, levels, @@ -105,6 +123,15 @@ public class BlockToss extends SkillCharge implements IThrown Block grab = event.getClickedBlock(); + //Blacklist + for (Material mat : _blacklist) + if (mat == grab.getType()) + return; + + //Usable + if (UtilBlock.usable(grab)) + return; + //Door and Banner if (grab.getRelative(BlockFace.UP).getTypeId() == 64 || grab.getRelative(BlockFace.UP).getTypeId() == 71 || grab.getRelative(BlockFace.UP).getType() == Material.STANDING_BANNER) { @@ -137,7 +164,7 @@ public class BlockToss extends SkillCharge implements IThrown } } - if (Factory.BlockRestore().Contains(grab)) + if (Factory.BlockRestore().contains(grab)) { UtilPlayer.message(player, F.main(GetName(), "You cannot grab this block.")); return; @@ -306,7 +333,13 @@ public class BlockToss extends SkillCharge implements IThrown fallIter.remove(); - createBlock(fall, fall.getLocation().getBlock()); + Block block = fall.getLocation().getBlock(); + + // Call and trigger block expiry event + BlockTossExpireEvent expireEvent = new BlockTossExpireEvent(block); + Bukkit.getServer().getPluginManager().callEvent(expireEvent); + + if (!expireEvent.isCancelled()) createBlock(fall, block); } } @@ -321,12 +354,30 @@ public class BlockToss extends SkillCharge implements IThrown if (id == 13) id = Material.STONE.getId(); //Block Replace - Factory.BlockRestore().Add(block, id, (byte)0, 10000); + Factory.BlockRestore().add(block, id, (byte)0, 10000); //Effect block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId()); } + @EventHandler + public void onBlockLand(EntityChangeBlockEvent event) + { + if (event.getEntity() instanceof FallingBlock) + { + if (!event.getBlock().getType().isSolid()) // Falling block is landing and turning block from air to type + { + BlockTossLandEvent landEvent = new BlockTossLandEvent(event.getBlock()); + Bukkit.getServer().getPluginManager().callEvent(landEvent); + + if (landEvent.isCancelled()) + { + event.setCancelled(true); + } + } + } + } + @EventHandler public void ItemSpawn(ItemSpawnEvent event) { diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillFactory.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillFactory.java index a5d442044..7fd52db63 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillFactory.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillFactory.java @@ -654,6 +654,11 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory System.out.println("Skill Factory: Removed " + remove.GetName() + " from SkillMap."); } + public void removeSkill(String skillName) + { + RemoveSkill(skillName, null); + } + @Override public List GetGlobalSkillsFor(IPvpClass gameClass) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/ctf_data/Flag.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/ctf_data/Flag.java index 1d52aa217..2774de9e1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/ctf_data/Flag.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/ctf_data/Flag.java @@ -275,7 +275,7 @@ public class Flag loc.add(0, 1, 0); _flagBlock = loc.getBlock(); - _host.getArcadeManager().getClassManager().GetSkillFactory().BlockRestore().Restore(_flagBlock); + _host.getArcadeManager().getClassManager().GetSkillFactory().BlockRestore().restore(_flagBlock); _priorBlock = loc.getBlock().getType();