diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansGame.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansGame.java index e1bf068c2..fafbc49fe 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansGame.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansGame.java @@ -20,6 +20,8 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.block.Action; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockBurnEvent; +import org.bukkit.event.block.BlockDispenseEvent; +import org.bukkit.event.block.BlockFromToEvent; import org.bukkit.event.block.BlockIgniteEvent; import org.bukkit.event.block.BlockIgniteEvent.IgniteCause; import org.bukkit.event.block.BlockPistonExtendEvent; @@ -61,6 +63,7 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.game.clans.clans.ClansUtility.ClanRelation; +import mineplex.game.clans.clans.event.ClansWaterPlaceEvent; import mineplex.game.clans.clans.siege.weapon.projectile.event.CraterExplodeEvent; import mineplex.game.clans.core.repository.ClanTerritory; import mineplex.minecraft.game.core.damage.CustomDamageEvent; @@ -968,4 +971,55 @@ public class ClansGame extends MiniPlugin event.getInventory().addItem(new ItemBuilder(Material.TRAPPED_CHEST).setAmount(stack.getAmount()).setTitle(C.cDGray + "Safe").build()); } } + + @EventHandler(ignoreCancelled=true) + public void onBlockDispense(BlockDispenseEvent event) + { + if (event.getItem().getType() == Material.WATER_BUCKET || event.getItem().getType() == Material.LAVA_BUCKET || event.getItem().getType() == Material.BUCKET) + { + event.setCancelled(true); + } + } + + @EventHandler + public void noMonsterLava(BlockFromToEvent event) + { + Block block = event.getBlock(); + if (block.getType() == Material.LAVA || block.getType() == Material.STATIONARY_LAVA || block.getType() == Material.WATER || block.getType() == Material.STATIONARY_WATER) + { + Block next = event.getToBlock(); + for (BlockFace bf : BlockFace.values()) + { + if (!next.getRelative(bf).equals(block)) + { + if (block.getType().toString().contains("LAVA")) + { + if (next.getRelative(bf).getType().toString().contains("WATER")) + { + event.setCancelled(true); + } + } + if (block.getType().toString().contains("WATER")) + { + if (next.getRelative(bf).getType().toString().contains("LAVA")) + { + event.setCancelled(true); + } + } + } + } + } + } + + @EventHandler + public void onUseWater(ClansWaterPlaceEvent event) + { + for (BlockFace bf : BlockFace.values()) + { + if (event.getBlock().getRelative(bf).getType().toString().contains("LAVA")) + { + event.setCancelled(true); + } + } + } } \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/NetherManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/NetherManager.java index a14a74b58..dbf3a3a91 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/NetherManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/NetherManager.java @@ -3,6 +3,7 @@ package mineplex.game.clans.clans.nether; import java.util.Comparator; import java.util.HashMap; import java.util.List; +import java.util.Random; import org.bukkit.Bukkit; import org.bukkit.GameMode; @@ -20,6 +21,7 @@ import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.entity.EntityPortalEvent; import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerDropItemEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerPortalEvent; @@ -529,4 +531,29 @@ public class NetherManager extends MiniPlugin spawnBossPortal(event.getCreature().getEvent().getCenterLocation().clone().subtract(0, 1, 0)); } } + + @EventHandler + public void onCommand(PlayerCommandPreprocessEvent event) + { + if (event.getMessage().toUpperCase().startsWith("/TRYDOUBLES") && event.getPlayer().isOp()) + { + int mult = 1; + if (event.getMessage().toUpperCase().equalsIgnoreCase("/TRYDOUBLES 2")) + { + mult = 2; + } + if (event.getMessage().toUpperCase().equalsIgnoreCase("/TRYDOUBLES 3")) + { + mult = 3; + } + for (int i = 0; i < 100 * mult; i++) + { + double d = new Random().nextDouble(); + if (d <= 0.075) + { + Bukkit.broadcastMessage("FOUND ONE - " + d); + } + } + } + } } \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/miniboss/NetherMinibossManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/miniboss/NetherMinibossManager.java index 5f28115a4..3909e69c5 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/miniboss/NetherMinibossManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/miniboss/NetherMinibossManager.java @@ -4,12 +4,6 @@ import java.util.Comparator; import java.util.HashMap; import java.util.List; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilTime; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.game.clans.clans.nether.NetherManager; - import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.entity.LivingEntity; @@ -21,6 +15,13 @@ import org.bukkit.event.world.ChunkUnloadEvent; import com.google.common.collect.Lists; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilTime; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.game.clans.clans.nether.NetherManager; +import mineplex.minecraft.game.classcombat.event.ClassCombatCreatureAllowSpawnEvent; + /** * Manager to handle miniboss spawning in the nether */ @@ -31,6 +32,7 @@ public class NetherMinibossManager implements Listener private HashMap _spawns = new HashMap<>(); private long _lastSpawned; private boolean _allowSpawn = false; + private boolean _allowSpawnEvent = false; public NetherMinibossManager(NetherManager manager) { @@ -83,12 +85,21 @@ public class NetherMinibossManager implements Listener _allowSpawn = false; } + @EventHandler + public void onAllowSpawn(ClassCombatCreatureAllowSpawnEvent event) + { + if (event.getWorldName().equalsIgnoreCase(_manager.getNetherWorld().getName())) + { + _allowSpawnEvent = event.getAllowed(); + } + } + @EventHandler public void onSpawnNormal(EntitySpawnEvent event) { if (event.getEntity() instanceof LivingEntity && _manager.getNetherWorld().equals(event.getLocation().getWorld())) { - if (!_allowSpawn) + if (!_allowSpawn && !_allowSpawnEvent) { event.setCancelled(true); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/miniboss/bosses/ArcherMiniboss.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/miniboss/bosses/ArcherMiniboss.java index 72ce7c439..380a95964 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/miniboss/bosses/ArcherMiniboss.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/miniboss/bosses/ArcherMiniboss.java @@ -34,7 +34,7 @@ import org.bukkit.potion.PotionEffectType; public class ArcherMiniboss extends NetherMiniBoss { private static final int BARBED_LEVEL = 1; - private static final double RUNE_DROP_CHANCE = .1; + private static final double RUNE_DROP_CHANCE = .075; private static final int MAX_DIAMOND_DROPS = 5; public ArcherMiniboss(String displayName, Double maxHealth, Location spawn, EntityType type) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/miniboss/bosses/GhastMiniboss.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/miniboss/bosses/GhastMiniboss.java index 45133db1c..6edd6a985 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/miniboss/bosses/GhastMiniboss.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/miniboss/bosses/GhastMiniboss.java @@ -31,7 +31,7 @@ public class GhastMiniboss extends NetherMiniBoss private static final long MAIN_FIREBALL_COOLDOWN = 5000; private static final long FIREBALL_LAUNCH_RATE = 500; private static final int FIREBALLS_PER_USE = 5; - private static final double RUNE_DROP_CHANCE = .1; + private static final double RUNE_DROP_CHANCE = .075; private static final int MAX_DIAMOND_DROPS = 5; private static final double MAX_TARGET_RANGE = 25; private long _lastFireballUse; diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/miniboss/bosses/WarriorMiniboss.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/miniboss/bosses/WarriorMiniboss.java index df682506a..6140e43e0 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/miniboss/bosses/WarriorMiniboss.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/miniboss/bosses/WarriorMiniboss.java @@ -32,7 +32,7 @@ import org.bukkit.potion.PotionEffectType; */ public class WarriorMiniboss extends NetherMiniBoss { - private static final double RUNE_DROP_CHANCE = .1; + private static final double RUNE_DROP_CHANCE = .075; private static final int MAX_DIAMOND_DROPS = 5; private static final double LEAP_CHANCE = .9; private static final double LEAP_MIN_DIST = 3; diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/projectile/Crater.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/projectile/Crater.java index d3c8049af..0b78bfa26 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/projectile/Crater.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/projectile/Crater.java @@ -3,7 +3,6 @@ package mineplex.game.clans.clans.siege.weapon.projectile; import java.util.HashMap; import java.util.List; -import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; @@ -44,7 +43,7 @@ public class Crater { List blocks = Lists.newArrayList(); List noRepeats = Lists.newArrayList(); - for (Block block : UtilBlock.getExplosionBlocks(_origin, 2.6f, false)) + for (Block block : UtilBlock.getInRadius(_origin, 3).keySet()) { String locID = block.getLocation().getX() + " " + block.getLocation().getY() + " " + block.getLocation().getZ(); if (noRepeats.contains(locID)) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/projectile/WeaponProjectile.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/projectile/WeaponProjectile.java index a305dfd20..75cd73e49 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/projectile/WeaponProjectile.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/siege/weapon/projectile/WeaponProjectile.java @@ -74,7 +74,7 @@ public abstract class WeaponProjectile implements Listener boolean moving = Math.abs(_projectileEntity.getVelocity().getX()) > 0.01 || Math.abs(_projectileEntity.getVelocity().getZ()) > 0.01; // Some rough collision detection. Not perfect, but the best I could conjure up myself. - if (!moving && !UtilBlock.boundless(_projectileEntity.getLocation(), 2)) + if ((!moving && !UtilBlock.boundless(_projectileEntity.getLocation(), 2)) || (_projectileEntity instanceof TNTPrimed && _projectileEntity.getTicksLived() >= 80)) { SiegeWeaponExplodeEvent newEvent = UtilServer.CallEvent(new SiegeWeaponExplodeEvent(_weapon, this)); diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/attributes/bow/ScorchingAttribute.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/attributes/bow/ScorchingAttribute.java index daa299754..c8bcfb635 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/attributes/bow/ScorchingAttribute.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/attributes/bow/ScorchingAttribute.java @@ -33,6 +33,10 @@ public class ScorchingAttribute extends AttackAttribute @Override public void triggerAttack(Entity attacker, Entity defender) { + if (isTeammate(attacker, defender)) + { + return; + } defender.setFireTicks((int) (_fireDuration * 20)); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/rares/RunedPickaxe.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/rares/RunedPickaxe.java index 9072d0dfe..70837d017 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/rares/RunedPickaxe.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/rares/RunedPickaxe.java @@ -1,13 +1,19 @@ package mineplex.game.clans.items.rares; +import java.util.HashSet; + import org.bukkit.Effect; import org.bukkit.Material; import org.bukkit.Sound; +import org.bukkit.block.Block; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; +import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockDamageEvent; import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; import mineplex.core.common.util.C; import mineplex.core.common.util.F; @@ -35,6 +41,7 @@ public class RunedPickaxe extends RareItem { UtilServer.RegisterEvents(new Listener() { + @SuppressWarnings("deprecation") @EventHandler public void update(UpdateEvent event) { @@ -65,6 +72,11 @@ public class RunedPickaxe extends RareItem pick._enabled = false; } + + if (!pick._enabled) + { + player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 20 * 2, 100)); + } }); } @@ -105,6 +117,31 @@ public class RunedPickaxe extends RareItem event.getPlayer().playSound(event.getBlock().getLocation(), Sound.LAVA_POP, 1.f, 1.f); } } + + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) + public void blockDamage(BlockBreakEvent event) + { + PlayerGear gear = ClansManager.getInstance().getGearManager().getPlayerGear(event.getPlayer()); + + if (!(gear.getWeapon() instanceof RunedPickaxe)) + { + return; + } + + RunedPickaxe pick = (RunedPickaxe) gear.getWeapon(); + + if (ClansManager.getInstance().getNetherManager().getNetherWorld().equals(event.getBlock().getWorld())) + return; + + if (ClansManager.getInstance().getBlockRestore().contains(event.getBlock())) + return; + + if (!pick._enabled) + { + event.setCancelled(true); + event.getBlock().breakNaturally(); + } + } }); } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Illusion.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Illusion.java index 8c7fe10d2..43b9624ec 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Illusion.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Illusion.java @@ -90,7 +90,7 @@ public class Illusion extends SkillActive public void Skill(Player player, int level) { //Spawn - ClassCombatCreatureAllowSpawnEvent enableEvent = new ClassCombatCreatureAllowSpawnEvent(true); + ClassCombatCreatureAllowSpawnEvent enableEvent = new ClassCombatCreatureAllowSpawnEvent(player.getWorld().getName(), true); UtilServer.getServer().getPluginManager().callEvent(enableEvent); Skeleton skel = player.getWorld().spawn(player.getLocation(), Skeleton.class); @@ -101,7 +101,7 @@ public class Illusion extends SkillActive skel.setMaxHealth(14); skel.setHealth(14); - ClassCombatCreatureAllowSpawnEvent disableEvent = new ClassCombatCreatureAllowSpawnEvent(false); + ClassCombatCreatureAllowSpawnEvent disableEvent = new ClassCombatCreatureAllowSpawnEvent(player.getWorld().getName(), false); UtilServer.getServer().getPluginManager().callEvent(disableEvent); skel.getEquipment().setHelmet(player.getInventory().getHelmet()); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/event/ClassCombatCreatureAllowSpawnEvent.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/event/ClassCombatCreatureAllowSpawnEvent.java index 97ccfe772..b21eee5c0 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/event/ClassCombatCreatureAllowSpawnEvent.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/event/ClassCombatCreatureAllowSpawnEvent.java @@ -7,12 +7,18 @@ public class ClassCombatCreatureAllowSpawnEvent extends Event { private static final HandlerList handlers = new HandlerList(); + private String _worldName; private boolean _allow; - public ClassCombatCreatureAllowSpawnEvent(boolean allow) + public ClassCombatCreatureAllowSpawnEvent(String worldName, boolean allow) { _allow = allow; } + + public String getWorldName() + { + return _worldName; + } public HandlerList getHandlers() {