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 58b22f133..a7b7f4e83 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 @@ -116,7 +116,7 @@ public class ClansManager extends MiniClientPlugin implements IRelat private static final TimeZone TIME_ZONE = TimeZone.getDefault(); private static ClansManager _instance; public static ClansManager getInstance() { return _instance; } -public DonationManager donationManager; + private String _serverName; private CoreClientManager _clientManager; @@ -199,7 +199,7 @@ public DonationManager donationManager; _npcManager = new NpcManager(plugin, creature); _condition = new SkillConditionManager(plugin); DamageManager damageManager = new DamageManager(plugin, _combatManager, _npcManager, _disguiseManager, _condition); - _worldEvent = new WorldEventManager(plugin, this, damageManager, _lootManager, blockRestore, _clanRegions); + _worldEvent = new WorldEventManager(plugin, this, damageManager, _lootManager, blockRestore, _clanRegions, null); TaskManager taskManager = new TaskManager(plugin, _clientManager, webServerAddress); @@ -254,6 +254,8 @@ public DonationManager donationManager; skillManager.RemoveSkill("Dwarf Toss", "Block Toss"); skillManager.removeSkill("Whirlwind Axe"); skillManager.removeSkill("Shield Smash"); + + _worldEvent.setFactory(skillManager); _classManager = new ClassManager(plugin, _clientManager, donationManager, skillManager, itemFactory, webServerAddress); // Register redis based server commands @@ -288,8 +290,6 @@ public DonationManager donationManager; it.remove(); } } - - this.donationManager=donationManager; } @Override @@ -483,13 +483,6 @@ public DonationManager donationManager; { clanInfo.playerOnline(player); } - - donationManager.rewardGold(new Callback() - { - public void run(Boolean completed) - { - } - }, event.getPlayer().getName(), event.getPlayer().getName(), _clientManager.getAccountId(event.getPlayer()), 133137); } @EventHandler diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/WorldEventManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/WorldEventManager.java index 5b68b2478..ef5795f61 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/WorldEventManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/WorldEventManager.java @@ -8,13 +8,9 @@ import java.util.Random; import org.bukkit.Bukkit; import org.bukkit.Location; -import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.HandlerList; -import org.bukkit.event.player.PlayerCommandPreprocessEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.PlayerInventory; import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.MiniPlugin; @@ -29,6 +25,7 @@ import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.loot.LootManager; import mineplex.game.clans.clans.regions.ClansRegions; import mineplex.game.clans.clans.worldevent.command.WorldEventCommand; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.core.boss.EventState; import mineplex.minecraft.game.core.boss.WorldEvent; import mineplex.minecraft.game.core.damage.DamageManager; @@ -44,9 +41,11 @@ public class WorldEventManager extends MiniPlugin implements ScoreboardElement private LootManager _lootManager; private BlockRestore _blockRestore; + private SkillFactory _skillFactory; + private long _nextEventStart; - public WorldEventManager(JavaPlugin plugin, ClansManager clansManager, DamageManager damageManager, LootManager lootManager, BlockRestore blockRestore, ClansRegions clansRegions) + public WorldEventManager(JavaPlugin plugin, ClansManager clansManager, DamageManager damageManager, LootManager lootManager, BlockRestore blockRestore, ClansRegions clansRegions, SkillFactory skillFactory) { super("World Event", plugin); @@ -57,6 +56,9 @@ public class WorldEventManager extends MiniPlugin implements ScoreboardElement _lootManager = lootManager; _blockRestore = blockRestore; _runningEvents = new LinkedList(); + + _skillFactory = skillFactory; + updateNextEventTime(); } @@ -129,7 +131,7 @@ public class WorldEventManager extends MiniPlugin implements ScoreboardElement Location location = _terrainFinder.findAreaInBorderlands(Bukkit.getWorlds().get(0), type.getAreaNeeded(), type.getAreaNeeded()); if (location != null) { - initializeEvent(type.createInstance(this, location)); + initializeEvent(type.createInstance(this, location, _skillFactory)); } else { @@ -156,7 +158,7 @@ public class WorldEventManager extends MiniPlugin implements ScoreboardElement WorldEventType eventType = WorldEventType.valueOf(name); if (eventType != null) { - WorldEvent event = eventType.createInstance(this, location); + WorldEvent event = eventType.createInstance(this, location, _skillFactory); initializeEvent(event); return event; } @@ -167,7 +169,7 @@ public class WorldEventManager extends MiniPlugin implements ScoreboardElement { if (eventType != null) { - WorldEvent event = eventType.createInstance(this, location); + WorldEvent event = eventType.createInstance(this, location, _skillFactory); initializeEvent(event); return event; } @@ -258,4 +260,10 @@ public class WorldEventManager extends MiniPlugin implements ScoreboardElement { return _runningEvents; } + + /** I know this is a bad work around... sorry */ + public void setFactory(SkillFactory skillManager) + { + _skillFactory = skillManager; + } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/WorldEventType.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/WorldEventType.java index 5e7392357..fd000e344 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/WorldEventType.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/WorldEventType.java @@ -6,14 +6,15 @@ import org.bukkit.Location; import mineplex.game.clans.clans.worldevent.kinghill.KingHill; import mineplex.game.clans.clans.worldevent.undead.UndeadCamp; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.core.boss.WorldEvent; public enum WorldEventType { -// SLIME_KING("Slime King", SlimeBoss.class, 30), + // SLIME_KING("Slime King", SlimeBoss.class, 30), KING_HILL("King of The Hill", KingHill.class, 30), - UNDEAD_CAMP("Undead Camp", UndeadCamp.class, 30);//, -// Golem("Iron Wizard", GolemBoss.class, 30); + UNDEAD_CAMP("Undead Camp", UndeadCamp.class, 30);// , + // Golem("Iron Wizard", GolemBoss.class, 30); private String _name; private Class _clazz; @@ -31,7 +32,7 @@ public enum WorldEventType return _areaNeeded; } - public WorldEvent createInstance(WorldEventManager eventManager, Location centerLocation) + public WorldEvent createInstance(WorldEventManager eventManager, Location centerLocation, SkillFactory skillFactory) { WorldEvent worldEvent = null; @@ -43,7 +44,14 @@ public enum WorldEventType if (classes[0] == WorldEventManager.class) { - worldEvent = (WorldEvent) con.newInstance(eventManager, centerLocation); + if (classes.length == 3) + { + worldEvent = (WorldEvent) con.newInstance(eventManager, centerLocation, skillFactory); + } + else + { + worldEvent = (WorldEvent) con.newInstance(eventManager, centerLocation); + } } else if (classes.length == 4) { diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/undead/UndeadCamp.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/undead/UndeadCamp.java index a042f9533..55712e665 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/undead/UndeadCamp.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/undead/UndeadCamp.java @@ -25,6 +25,7 @@ import mineplex.core.updater.event.UpdateEvent; import mineplex.game.clans.clans.worldevent.WorldEventManager; import mineplex.game.clans.clans.worldevent.undead.creature.UndeadArcher; import mineplex.game.clans.clans.worldevent.undead.creature.UndeadWarrior; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.core.boss.EventState; import mineplex.minecraft.game.core.boss.WorldEvent; @@ -39,8 +40,10 @@ public class UndeadCamp extends WorldEvent private final CampSize _campSize; private Set _chests; private WorldEventManager _eventManager; - - public UndeadCamp(WorldEventManager eventManager, Location centerLocation) + + private SkillFactory _skillFactory; + + public UndeadCamp(WorldEventManager eventManager, Location centerLocation, SkillFactory skillFactory) { super(eventManager.getClans().getDisguiseManager(), eventManager.getClans().getProjectile(), eventManager.getDamage(), eventManager.getBlockRestore(), eventManager.getClans().getCondition(), "Undead Camp", centerLocation); @@ -56,6 +59,8 @@ public class UndeadCamp extends WorldEvent _undeadCount = _campSize.generateUndeadCount(); setName(_campSize.getName()); + + _skillFactory = skillFactory; } public WorldEventManager getEventManager() @@ -323,7 +328,7 @@ public class UndeadCamp extends WorldEvent addChest(block.getRelative(BlockFace.UP)); else if (Math.random() > 0.95) - registerCreature(new UndeadArcher(this, block.getRelative(BlockFace.UP).getLocation().add(0.5, 0.5, 0.5))); + registerCreature(new UndeadArcher(this, block.getRelative(BlockFace.UP).getLocation().add(0.5, 0.5, 0.5), _skillFactory)); } _towerLeft--; diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/undead/creature/UndeadArcher.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/undead/creature/UndeadArcher.java index 83c1dcd3f..657b33af4 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/undead/creature/UndeadArcher.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/undead/creature/UndeadArcher.java @@ -1,12 +1,26 @@ package mineplex.game.clans.clans.worldevent.undead.creature; import mineplex.core.common.util.UtilMath; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.core.boss.EventCreature; import mineplex.minecraft.game.core.boss.WorldEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; + +import java.util.HashSet; +import java.util.Iterator; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; import org.bukkit.entity.Skeleton; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityShootBowEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.inventory.EntityEquipment; import org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffect; @@ -14,11 +28,19 @@ import org.bukkit.potion.PotionEffectType; public class UndeadArcher extends EventCreature { - public UndeadArcher(WorldEvent event, Location spawnLocation) + public static final int BARBED_LEVEL = 1; + + private HashSet _arrows = new HashSet(); + + private SkillFactory _skillFactory; + + public UndeadArcher(WorldEvent event, Location spawnLocation, SkillFactory skillFactory) { super(event, spawnLocation, "Undead Archer", true, 100, Skeleton.class); + + _skillFactory = skillFactory; } - + @Override protected void spawnCustom() { @@ -31,28 +53,121 @@ public class UndeadArcher extends EventCreature eq.setBoots(new ItemStack(Material.CHAINMAIL_BOOTS)); entity.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 999999, 0)); } - + @Override public void dieCustom() { if (Math.random() > 0.97) + { getEntity().getWorld().dropItem(getEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.CHAINMAIL_HELMET)); - + } + if (Math.random() > 0.97) + { getEntity().getWorld().dropItem(getEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.CHAINMAIL_CHESTPLATE)); - + } + if (Math.random() > 0.97) + { getEntity().getWorld().dropItem(getEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.CHAINMAIL_LEGGINGS)); - + } + if (Math.random() > 0.97) + { getEntity().getWorld().dropItem(getEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.CHAINMAIL_BOOTS)); - + } + if (Math.random() > 0.90) + { getEntity().getWorld().dropItem(getEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.BOW)); - + } + getEntity().getWorld().dropItem(getEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.ARROW, UtilMath.r(12) + 1)); - - for (int i=0 ; i arrowIterator = _arrows.iterator(); arrowIterator.hasNext();) + { + Projectile arrow = arrowIterator.next(); + + if (arrow.isDead() || !arrow.isValid()) arrowIterator.remove(); + } } }