Patch illusion in nether, stop cobble generation, lower rune drop rate, make tnt time based and better function in water, make scorching not damage teammates or those in safezones, make runed pickaxe more effective

This commit is contained in:
AlexTheCoder 2016-10-14 17:14:47 -04:00 committed by Shaun Bennett
parent c21e71606d
commit 63ef68976c
12 changed files with 154 additions and 16 deletions

View File

@ -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);
}
}
}
}

View File

@ -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);
}
}
}
}
}

View File

@ -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<Location, NetherMinibossType> _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);
}

View File

@ -34,7 +34,7 @@ import org.bukkit.potion.PotionEffectType;
public class ArcherMiniboss extends NetherMiniBoss<Skeleton>
{
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)

View File

@ -31,7 +31,7 @@ public class GhastMiniboss extends NetherMiniBoss<Ghast>
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;

View File

@ -32,7 +32,7 @@ import org.bukkit.potion.PotionEffectType;
*/
public class WarriorMiniboss extends NetherMiniBoss<Zombie>
{
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;

View File

@ -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<Block> blocks = Lists.newArrayList();
List<String> 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))

View File

@ -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));

View File

@ -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));
}

View File

@ -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();
}
}
});
}

View File

@ -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());

View File

@ -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()
{