>.< Updates

This commit is contained in:
Chiss 2013-08-31 13:15:16 +10:00
parent 606f631559
commit e17368a9ac
67 changed files with 892 additions and 4105 deletions

View File

@ -1,5 +1,6 @@
package me.chiss.Core.Modules;
import java.util.HashMap;
import java.util.HashSet;
import mineplex.core.MiniPlugin;
@ -21,7 +22,7 @@ import org.bukkit.util.Vector;
public class Blood extends MiniPlugin
{
private HashSet<Item> _blood = new HashSet<Item>();
private HashMap<Item, Integer> _blood = new HashMap<Item, Integer>();
public Blood(JavaPlugin plugin)
{
@ -36,6 +37,12 @@ public class Blood extends MiniPlugin
public void Effects(Location loc, int particles, double velMult, Sound sound,
float soundVol, float soundPitch, Material type, byte data, boolean bloodStep)
{
Effects(loc, particles, velMult, sound, soundVol, soundPitch, type, data, 10, bloodStep);
}
public void Effects(Location loc, int particles, double velMult, Sound sound,
float soundVol, float soundPitch, Material type, byte data, int ticks, boolean bloodStep)
{
for (int i = 0 ; i < particles ; i++)
{
@ -44,7 +51,7 @@ public class Blood extends MiniPlugin
item.setVelocity(new Vector((Math.random() - 0.5)*velMult,Math.random()*velMult,(Math.random() - 0.5)*velMult));
_blood.add(item);
_blood.put(item, ticks);
}
if (bloodStep)
@ -61,8 +68,8 @@ public class Blood extends MiniPlugin
HashSet<Item> expire = new HashSet<Item>();
for (Item cur : _blood)
if (cur.getTicksLived() > 10 || !cur.isValid())
for (Item cur : _blood.keySet())
if (cur.getTicksLived() > _blood.get(cur) || !cur.isValid())
expire.add(cur);
for (Item cur : expire)
@ -70,7 +77,6 @@ public class Blood extends MiniPlugin
cur.remove();
_blood.remove(cur);
}
}
@EventHandler
@ -79,7 +85,7 @@ public class Blood extends MiniPlugin
if (event.isCancelled())
return;
if (_blood.contains(event.getItem()))
if (_blood.containsKey(event.getItem()))
event.setCancelled(true);
}
@ -89,7 +95,7 @@ public class Blood extends MiniPlugin
if (event.isCancelled())
return;
if (_blood.contains(event.getItem()))
if (_blood.containsKey(event.getItem()))
event.setCancelled(true);
}
}

View File

@ -121,6 +121,14 @@ public class BlockRestore extends MiniPlugin
if (block.getRelative(BlockFace.DOWN).getTypeId() == 79)
return;
//No Snow on Slabs
if (block.getRelative(BlockFace.DOWN).getTypeId() == 44 || block.getRelative(BlockFace.DOWN).getTypeId() == 126)
return;
//No Snow on Stairs
if (block.getRelative(BlockFace.DOWN).getType().toString().contains("STAIRS"))
return;
//No Snow on Fence
if (block.getRelative(BlockFace.DOWN).getTypeId() == 85)
return;
@ -131,7 +139,7 @@ public class BlockRestore extends MiniPlugin
//Limit Build Height
if (block.getTypeId() == 78)
if (block.getData() >= (byte)heightMax)
if (block.getData() >= (byte)(heightMax-1))
heightAdd = 0;
//Snow

View File

@ -5,10 +5,14 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import mineplex.core.MiniPlugin;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.disguise.DisguiseManager;
import mineplex.core.npc.NpcManager;
import mineplex.minecraft.game.core.combat.CombatManager;
import mineplex.minecraft.game.core.damage.compatibility.NpcProtectListener;
@ -37,17 +41,19 @@ import org.bukkit.util.Vector;
public class DamageManager extends MiniPlugin
{
private CombatManager _combatManager;
private DisguiseManager _disguiseManager;
protected Field _lastDamageByPlayerTime;
protected Method _k;
public boolean UseDefaultWeaponDamage = false;
public DamageManager(JavaPlugin plugin, CombatManager combatManager, NpcManager npcManager)
public DamageManager(JavaPlugin plugin, CombatManager combatManager, NpcManager npcManager, DisguiseManager disguiseManager)
{
super("Damage Manager", plugin);
_combatManager = combatManager;
_disguiseManager = disguiseManager;
try
{
_lastDamageByPlayerTime = EntityLiving.class.getDeclaredField("lastDamageByPlayerTime");
@ -59,10 +65,10 @@ public class DamageManager extends MiniPlugin
{
System.out.println("Problem getting access to EntityLiving: " + e.getMessage());
}
RegisterEvents(new NpcProtectListener(npcManager));
}
@EventHandler(priority = EventPriority.HIGHEST)
public void StartDamageEvent(EntityDamageEvent event)
{
@ -77,7 +83,7 @@ public class DamageManager extends MiniPlugin
LivingEntity damagee = GetDamageeEntity(event);
LivingEntity damager = GetDamagerEntity(event, true);
Projectile projectile = GetProjectile(event);
if (projectile instanceof Fish)
return;
@ -89,7 +95,7 @@ public class DamageManager extends MiniPlugin
//event.setDamage(0);
//if (GoldPower(damager))
event.setCancelled(true);
event.setCancelled(true);
}
/*
@ -100,10 +106,10 @@ public class DamageManager extends MiniPlugin
Player player = (Player)damager;
if (!Util().Gear().isGold(player.getItemInHand()))
return false;
if (!player.getInventory().contains(Material.GOLD_NUGGET))
return false;
UtilInv.remove(player, Material.GOLD_NUGGET, (byte)0, 1);
return true;
}
@ -252,6 +258,7 @@ public class DamageManager extends MiniPlugin
trajectory, 0.2 + trajectory.length() * 0.8, false, 0, Math.abs(0.2 * knockback), 0.4 + (0.04 * knockback), true);
}
DisplayDamage(event);
}
catch (IllegalAccessException e)
{
@ -267,6 +274,33 @@ public class DamageManager extends MiniPlugin
}
}
private void DisplayDamage(CustomDamageEvent event)
{
for (Player player : UtilServer.getPlayers())
{
if (!UtilGear.isMat(player.getItemInHand(), Material.BOOK))
continue;
for (DamageChange cur : event.GetDamageMod())
UtilPlayer.message(player, F.elem("Mod ") + cur.GetDamage() + " - " + cur.GetReason() + " by " + cur.GetSource());
for (DamageChange cur : event.GetDamageMult())
UtilPlayer.message(player, F.elem("Mult ") + cur.GetDamage() + " - " + cur.GetReason() + " by " + cur.GetSource());
for (String cur : event.GetKnockback().keySet())
UtilPlayer.message(player, F.elem("Knockback ") + cur + " = " + event.GetKnockback().get(cur));
for (String cur : event.GetCancellers())
UtilPlayer.message(player, F.elem("Cancel ") + cur);
UtilPlayer.message(player, F.elem("Damager ") + UtilEnt.getName(event.GetDamagerEntity(true)));
UtilPlayer.message(player, F.elem("Damagee ") + UtilEnt.getName(event.GetDamageeEntity()));
UtilPlayer.message(player, F.elem("Reason ") + event.GetReason());
UtilPlayer.message(player, F.elem("Damage ") + event.GetDamage());
UtilPlayer.message(player, F.elem("Damage Initial ") + event.GetDamageInitial());
}
}
private void HandleDamage(LivingEntity damagee, LivingEntity damager, DamageCause cause, float damage, boolean ignoreArmor) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException
{
EntityLiving entityDamagee = ((CraftLivingEntity)damagee).getHandle();
@ -329,26 +363,29 @@ public class DamageManager extends MiniPlugin
//Damagee
LivingEntity damagee = event.GetDamageeEntity();
if (damagee == null) return;
//if (_disguiseManager.isDisguised(damagee))
// _disguiseManager.getDisguise(damagee).playHurtSound();
//Sound
Sound sound = Sound.HURT_FLESH;
float vol = 1f;
float pitch = 1f;
//Armor Sound
if (damagee instanceof Player)
{
Player player = (Player)damagee;
double r = Math.random();
ItemStack stack = null;
if (r > 0.50) stack = player.getInventory().getChestplate();
else if (r > 0.25) stack = player.getInventory().getLeggings();
else if (r > 0.10) stack = player.getInventory().getHelmet();
else stack = player.getInventory().getBoots();
if (stack != null)
{
if (stack.getType().toString().contains("LEATHER_"))
@ -383,10 +420,10 @@ public class DamageManager extends MiniPlugin
{
UtilEnt.PlayDamageSound(damagee);
}
damagee.getWorld().playSound(damagee.getLocation(), sound, vol, pitch);
}
private void ApplyDamage(EntityLiving entityLiving, float damage, boolean ignoreArmor) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException
{
if (!ignoreArmor)
@ -415,8 +452,8 @@ public class DamageManager extends MiniPlugin
private void WeaponDamage(EntityDamageEvent event, LivingEntity ent)
{
if (!(ent instanceof Player))
return;
@ -424,15 +461,15 @@ public class DamageManager extends MiniPlugin
return;
Player damager = (Player)ent;
if (UseDefaultWeaponDamage)
{
if (event.getDamage() > 1)
event.setDamage(event.getDamage() - 1);
if (damager.getItemInHand().getType().name().contains("GOLD_"))
event.setDamage(event.getDamage() + 2);
return;
}
@ -460,7 +497,7 @@ public class DamageManager extends MiniPlugin
return null;
EntityDamageByEntityEvent eventEE = (EntityDamageByEntityEvent)event;
//Get Damager
if (eventEE.getDamager() instanceof LivingEntity)
return (LivingEntity)eventEE.getDamager();

View File

@ -1,505 +0,0 @@
package mineplex.minecraft.game.core.damage;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import mineplex.core.MiniPlugin;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilGear;
import mineplex.core.npc.NpcManager;
import mineplex.minecraft.game.core.combat.CombatManager;
import mineplex.minecraft.game.core.damage.compatibility.NpcProtectListener;
import net.minecraft.server.v1_6_R2.DamageSource;
import net.minecraft.server.v1_6_R2.EntityHuman;
import net.minecraft.server.v1_6_R2.EntityLiving;
import org.bukkit.EntityEffect;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_6_R2.entity.CraftLivingEntity;
import org.bukkit.entity.Fish;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
public class DamageManager extends MiniPlugin
{
private CombatManager _combatManager;
protected Field _lastDamageByPlayerTime;
protected Method _k;
public boolean UseDefaultWeaponDamage = false;
public DamageManager(JavaPlugin plugin, CombatManager combatManager, NpcManager npcManager)
{
super("Damage Manager", plugin);
_combatManager = combatManager;
try
{
_lastDamageByPlayerTime = EntityLiving.class.getDeclaredField("lastDamageByPlayerTime");
_lastDamageByPlayerTime.setAccessible(true);
_k = EntityLiving.class.getDeclaredMethod("h", float.class);
_k.setAccessible(true);
}
catch (final Exception e)
{
System.out.println("Problem getting access to EntityLiving: " + e.getMessage());
}
RegisterEvents(new NpcProtectListener(npcManager));
}
@EventHandler(priority = EventPriority.HIGHEST)
public void StartDamageEvent(EntityDamageEvent event)
{
boolean preCancel = false;
if (event.isCancelled())
preCancel = true;
if (!(event.getEntity() instanceof LivingEntity))
return;
//Get Data
LivingEntity damagee = GetDamageeEntity(event);
LivingEntity damager = GetDamagerEntity(event, true);
Projectile projectile = GetProjectile(event);
if (projectile instanceof Fish)
return;
//Pre-Event Modifications
WeaponDamage(event, damager);
//New Event
NewDamageEvent(damagee, damager, projectile, event.getCause(), event.getDamage(), true, false, false, null, null, preCancel);
//event.setDamage(0);
//if (GoldPower(damager))
event.setCancelled(true);
}
/*
private boolean GoldPower(LivingEntity damager)
{
try
{
Player player = (Player)damager;
if (!Util().Gear().isGold(player.getItemInHand()))
return false;
if (!player.getInventory().contains(Material.GOLD_NUGGET))
return false;
UtilInv.remove(player, Material.GOLD_NUGGET, (byte)0, 1);
return true;
}
catch (Exception e)
{
return false;
}
}
*/
public void NewDamageEvent(LivingEntity damagee, LivingEntity damager, Projectile proj,
DamageCause cause, double damage, boolean knockback, boolean ignoreRate, boolean ignoreArmor,
String source, String reason)
{
NewDamageEvent(damagee, damager, proj,
cause, damage, knockback, ignoreRate, ignoreArmor,
source, reason, false);
}
public void NewDamageEvent(LivingEntity damagee, LivingEntity damager, Projectile proj,
DamageCause cause, double damage, boolean knockback, boolean ignoreRate, boolean ignoreArmor,
String source, String reason, boolean cancelled)
{
_plugin.getServer().getPluginManager().callEvent(
new CustomDamageEvent(damagee, damager, proj, cause, damage,
knockback, ignoreRate, ignoreArmor,
source, reason, cancelled));
}
@EventHandler(priority = EventPriority.LOW)
public void CancelDamageEvent(CustomDamageEvent event)
{
if (event.GetDamageeEntity().getHealth() <= 0)
{
event.SetCancelled("0 Health");
return;
}
if (event.GetDamageePlayer() != null)
{
Player damagee = event.GetDamageePlayer();
//Not Survival
if (damagee.getGameMode() != GameMode.SURVIVAL)
{
event.SetCancelled("Damagee in Creative");
return;
}
//Limit World Damage Rate
if (!event.IgnoreRate())
{
if (!_combatManager.Get(damagee.getName()).CanBeHurtBy(event.GetDamagerEntity(true)))
{
event.SetCancelled("Damage Rate");
return;
}
}
}
if (event.GetDamagerPlayer(true) != null)
{
Player damager = event.GetDamagerPlayer(true);
//Not Survival
if (damager.getGameMode() != GameMode.SURVIVAL)
{
event.SetCancelled("Damager in Creative");
return;
}
//Damage Rate
if (!event.IgnoreRate())
if (!_combatManager.Get(damager.getName()).CanHurt(event.GetDamageeEntity()))
{
event.SetCancelled("Damage Rate");
return;
}
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void EndDamageEvent(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
if (event.GetDamage() < 1)
return;
Damage(event);
}
private void Damage(CustomDamageEvent event)
{
if (event.GetDamageeEntity().getHealth() <= 0)
return;
//Player Conditions
if (event.GetDamageePlayer() != null)
{
//Register Damage (must happen before damage)
_combatManager.AddAttack(event);
}
if (event.GetDamagerPlayer(true) != null)
{
//Display Damage to Damager
if (event.GetCause() != DamageCause.THORNS)
event.GetDamagerPlayer(true).setLevel((int)event.GetDamage());
}
try
{
int bruteBonus = 0;
if (event.IsBrute() &&
(
event.GetCause() == DamageCause.ENTITY_ATTACK ||
event.GetCause() == DamageCause.PROJECTILE ||
event.GetCause() == DamageCause.CUSTOM
) && event.GetDamage() > 2)
bruteBonus = 10;
//Do Damage
HandleDamage(event.GetDamageeEntity(), event.GetDamagerEntity(true), event.GetCause(), (int)event.GetDamage() + bruteBonus, event.IgnoreArmor());
//Effect
event.GetDamageeEntity().playEffect(EntityEffect.HURT);
//Knockback
double knockback = event.GetDamage();
if (knockback < 1) knockback = 1;
knockback = Math.log10(knockback);
for (double cur : event.GetKnockback().values())
knockback = knockback * cur;
if (event.IsKnockback())
if (event.GetDamagerEntity(true) != null)
{
Vector trajectory = UtilAlg.getTrajectory2d(event.GetDamagerEntity(true), event.GetDamageeEntity());
trajectory.multiply(0.6 * knockback);
trajectory.setY(Math.abs(trajectory.getY()));
UtilAction.velocity(event.GetDamageeEntity(),
trajectory, 0.2 + trajectory.length() * 0.8, false, 0, Math.abs(0.2 * knockback), 0.4 + (0.04 * knockback), true);
}
}
catch (IllegalAccessException e)
{
e.printStackTrace();
}
catch (IllegalArgumentException e)
{
e.printStackTrace();
}
catch (InvocationTargetException e)
{
e.printStackTrace();
}
}
private void HandleDamage(LivingEntity damagee, LivingEntity damager, DamageCause cause, float damage, boolean ignoreArmor) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException
{
EntityLiving entityDamagee = ((CraftLivingEntity)damagee).getHandle();
EntityLiving entityDamager = null;
if (damager != null)
entityDamager= ((CraftLivingEntity)damager).getHandle();
entityDamagee.aG = 1.5F;
if ((float) entityDamagee.noDamageTicks > (float) entityDamagee.maxNoDamageTicks / 2.0F)
{
if (damage <= entityDamagee.lastDamage)
{
return;
}
ApplyDamage(entityDamagee, damage - entityDamagee.lastDamage, ignoreArmor);
entityDamagee.lastDamage = damage;
}
else
{
entityDamagee.lastDamage = damage;
entityDamagee.ax = entityDamagee.getHealth();
//entityDamagee.noDamageTicks = entityDamagee.maxNoDamageTicks;
ApplyDamage(entityDamagee, damage, ignoreArmor);
//entityDamagee.hurtTicks = entityDamagee.aW = 10;
}
if (entityDamager != null)
entityDamagee.b(entityDamager);
_lastDamageByPlayerTime.setInt(entityDamagee, 60);
if (entityDamager != null)
if (entityDamager instanceof EntityHuman)
entityDamagee.killer = (EntityHuman)entityDamager;
if (entityDamagee.getHealth() <= 0)
{
if (entityDamager != null)
{
if (entityDamager instanceof EntityHuman) entityDamagee.die(DamageSource.playerAttack((EntityHuman)entityDamager));
else if (entityDamager instanceof EntityLiving) entityDamagee.die(DamageSource.mobAttack((EntityLiving)entityDamager));
else entityDamagee.die(DamageSource.GENERIC);
}
else
entityDamagee.die(DamageSource.GENERIC);
}
}
@EventHandler
public void DamageSound(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
if (event.GetCause() != DamageCause.ENTITY_ATTACK && event.GetCause() != DamageCause.PROJECTILE)
return;
//Damagee
LivingEntity damagee = event.GetDamageeEntity();
if (damagee == null) return;
//Sound
Sound sound = Sound.HURT_FLESH;
float vol = 1f;
float pitch = 1f;
//Armor Sound
if (damagee instanceof Player)
{
Player player = (Player)damagee;
double r = Math.random();
ItemStack stack = null;
if (r > 0.50) stack = player.getInventory().getChestplate();
else if (r > 0.25) stack = player.getInventory().getLeggings();
else if (r > 0.10) stack = player.getInventory().getHelmet();
else stack = player.getInventory().getBoots();
if (stack != null)
{
if (stack.getType().toString().contains("LEATHER_"))
{
sound = Sound.SHOOT_ARROW;
pitch = 2f;
}
else if (stack.getType().toString().contains("CHAINMAIL_"))
{
sound = Sound.ITEM_BREAK;
pitch = 1.4f;
}
else if (stack.getType().toString().contains("GOLD_"))
{
sound = Sound.ITEM_BREAK;
pitch = 1.8f;
}
else if (stack.getType().toString().contains("IRON_"))
{
sound = Sound.BLAZE_HIT;
pitch = 0.7f;
}
else if (stack.getType().toString().contains("DIAMOND_"))
{
sound = Sound.BLAZE_HIT;
pitch = 0.9f;
}
}
}
//Animal Sound
else
{
UtilEnt.PlayDamageSound(damagee);
}
damagee.getWorld().playSound(damagee.getLocation(), sound, vol, pitch);
}
private void ApplyDamage(EntityLiving entityLiving, float damage, boolean ignoreArmor) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException
{
if (!ignoreArmor)
{
int j = 25 - entityLiving.aP();
float k = damage * (float)j;
_k.invoke(entityLiving, damage);
damage = k / 25.0f;
}
/**
if (entityLiving.hasEffect(MobEffectList.RESISTANCE))
{
int j = (entityLiving.getEffect(MobEffectList.RESISTANCE).getAmplifier() + 1) * 5;
int k = 25 - j;
int l = damage * k + _aS.getInt(entityLiving);
damage = l / 25;
_aS.setInt(entityLiving, l % 25);
}
**/
entityLiving.setHealth(entityLiving.getHealth() - damage);
}
private void WeaponDamage(EntityDamageEvent event, LivingEntity ent)
{
if (!(ent instanceof Player))
return;
if (event.getCause() != DamageCause.ENTITY_ATTACK)
return;
Player damager = (Player)ent;
if (UseDefaultWeaponDamage)
{
if (event.getDamage() > 1)
event.setDamage(event.getDamage() - 1);
if (damager.getItemInHand().getType().name().contains("GOLD_"))
event.setDamage(event.getDamage() + 3);
return;
}
if (damager.getItemInHand() == null || !UtilGear.isWeapon(damager.getItemInHand()))
{
event.setDamage(1);
return;
}
Material mat = damager.getItemInHand().getType();
int damage = 6;
if (mat.name().contains("WOOD")) damage -= 3;
else if (mat.name().contains("STONE")) damage -= 2;
else if (mat.name().contains("DIAMOND")) damage += 0;
else if (mat.name().contains("GOLD")) damage += 1;
event.setDamage(damage);
}
private LivingEntity GetDamagerEntity(EntityDamageEvent event, boolean ranged)
{
if (!(event instanceof EntityDamageByEntityEvent))
return null;
EntityDamageByEntityEvent eventEE = (EntityDamageByEntityEvent)event;
//Get Damager
if (eventEE.getDamager() instanceof LivingEntity)
return (LivingEntity)eventEE.getDamager();
if (!ranged)
return null;
if (!(eventEE.getDamager() instanceof Projectile))
return null;
Projectile projectile = (Projectile)eventEE.getDamager();
if (projectile.getShooter() == null)
return null;
if (!(projectile.getShooter() instanceof LivingEntity))
return null;
return (LivingEntity)projectile.getShooter();
}
private LivingEntity GetDamageeEntity(EntityDamageEvent event)
{
if (event.getEntity() instanceof LivingEntity)
return (LivingEntity)event.getEntity();
return null;
}
private Projectile GetProjectile(EntityDamageEvent event)
{
if (!(event instanceof EntityDamageByEntityEvent))
return null;
EntityDamageByEntityEvent eventEE = (EntityDamageByEntityEvent)event;
if (eventEE.getDamager() instanceof Projectile)
return (Projectile)eventEE.getDamager();
return null;
}
}

View File

@ -10,11 +10,13 @@ import java.io.InputStreamReader;
import me.chiss.Core.Config.Config;
import mineplex.core.account.CoreClientManager;
import mineplex.core.antistack.AntiStack;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.command.CommandCenter;
import mineplex.core.common.util.FileUtil;
import mineplex.core.common.util.UtilServer;
import mineplex.core.creature.Creature;
import mineplex.core.disguise.DisguiseManager;
import mineplex.core.donation.DonationManager;
import mineplex.core.energy.Energy;
import mineplex.core.itemstack.ItemStackFactory;
@ -96,19 +98,21 @@ public class Arcade extends JavaPlugin implements INautilusPlugin, IPlugin
Recharge.Initialize(this);
ConditionManager conditionManager = new ConditionManager(this);
new MessageManager(this, _clientManager);
GetBlood();
new AntiStack(this);
GetCreature();
GetSpawn();
GetTeleport();
DisguiseManager disguiseManager = new DisguiseManager(this, new PacketHandler(this));
_damageManager = new DamageManager(this, new CombatManager(this), new NpcManager(this, GetCreature()));
_damageManager = new DamageManager(this, new CombatManager(this), new NpcManager(this, GetCreature()), disguiseManager);
//Arcade Manager
_gameManager = new ArcadeManager(this, ReadServerConfig(), _clientManager, _donationManager, conditionManager, _damageManager, GetCreature(), new PacketHandler(this));
_gameManager = new ArcadeManager(this, ReadServerConfig(), _clientManager, _donationManager, conditionManager, _damageManager, disguiseManager, GetCreature(), GetBlood(), new PacketHandler(this));
//Unreferenced Modules
//new AntiStack();

View File

@ -1,452 +0,0 @@
package nautilus.game.arcade;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.InputStreamReader;
import me.chiss.Core.Config.Config;
import mineplex.core.account.CoreClientManager;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.command.CommandCenter;
import mineplex.core.common.util.FileUtil;
import mineplex.core.common.util.UtilServer;
import mineplex.core.creature.Creature;
import mineplex.core.donation.DonationManager;
import mineplex.core.energy.Energy;
import mineplex.core.explosion.Explosion;
import mineplex.core.itemstack.ItemStackFactory;
import me.chiss.Core.Loot.LootFactory;
import me.chiss.Core.Module.ModuleManager;
import me.chiss.Core.Modules.*;
import me.chiss.Core.Plugin.IPlugin;
import me.chiss.Core.Scheduler.Scheduler;
import mineplex.core.message.MessageManager;
import mineplex.core.npc.NpcManager;
import mineplex.core.packethandler.PacketHandler;
import mineplex.core.pet.PetManager;
import mineplex.core.projectile.ProjectileManager;
import mineplex.core.punish.Punish;
import mineplex.core.recharge.Recharge;
import mineplex.core.spawn.Spawn;
import mineplex.core.teleport.Teleport;
import mineplex.core.updater.Updater;
import mineplex.minecraft.game.core.combat.CombatManager;
import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.minecraft.game.core.damage.DamageManager;
import mineplex.minecraft.game.core.fire.Fire;
import nautilus.game.arcade.game.GameServerConfig;
import nautilus.minecraft.core.INautilusPlugin;
import org.bukkit.Location;
import org.bukkit.Server;
import org.bukkit.entity.Player;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
public class Arcade extends JavaPlugin implements INautilusPlugin, IPlugin
{
private String WEB_CONFIG = "webServer";
//Modules
private ModuleManager _moduleManager;
private Config _config;
private CoreClientManager _clientManager;
private DonationManager _donationManager;
private DamageManager _damageManager;
private Utility _utility;
private BlockRegenerate _blockRegenerate;
private BlockRestore _blockRestore;
private Blood _blood;
private ConditionManager _condition;
private Creature _creature;
private Fire _fire;
private Logger _logger;
private LootFactory _lootFactory;
private Observer _observer;
private PetManager _petManager;
private me.chiss.Core.Server.Server _serverModule;
private Spawn _spawn;
private Teleport _teleport;
private ProjectileManager _throw;
private ArcadeManager _gameManager;
@Override
public void onEnable()
{
//Delete Old Games Folders
DeleteFolders();
//Configs
getConfig().addDefault(WEB_CONFIG, "http://api.mineplex.com/");
getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG));
saveConfig();
//Init Modules
GetModules();
_clientManager = CoreClientManager.Initialize(this, GetWebServerAddress());
_donationManager = new DonationManager(this, GetWebServerAddress());
CommandCenter.Initialize(this, _clientManager);
ItemStackFactory.Initialize(this, false);
Recharge.Initialize(this);
ConditionManager conditionManager = new ConditionManager(this);
Explosion explosion = new Explosion(this, new BlockRestore(this));
explosion.SetDebris(false);
new MessageManager(this, _clientManager);
GetBlood();
GetCreature();
GetSpawn();
GetTeleport();
_damageManager = new DamageManager(this, new CombatManager(this), new NpcManager(this, GetCreature()));
//Arcade Manager
_gameManager = new ArcadeManager(this, ReadServerConfig(), _clientManager, _donationManager, conditionManager, _damageManager, GetCreature(), new PacketHandler(this));
//Unreferenced Modules
//new AntiStack();
Scheduler.Initialize(this);
//new Information(this);
new Punish(this, GetWebServerAddress());
//Updates
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1);
}
@Override
public void onDisable()
{
GetModules().onDisable();
for (Player player : UtilServer.getPlayers())
player.kickPlayer("Server Shutdown");
if (_gameManager.GetGame() != null)
if (_gameManager.GetGame().WorldData != null)
_gameManager.GetGame().WorldData.Uninitialize();
}
public GameServerConfig ReadServerConfig()
{
GameServerConfig config = new GameServerConfig();
//Load Track Data
String line = null;
try
{
File file = new File("ArcadeSettings.config");
if (!file.exists())
WriteServerConfig(GetDefaultConfig());
FileInputStream fstream = new FileInputStream("ArcadeSettings.config");
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
while ((line = br.readLine()) != null)
{
String[] tokens = line.split("=");
if (tokens.length < 2)
continue;
if (tokens[0].equals("SERVER_TYPE"))
{
config.ServerType = tokens[1];
}
else if (tokens[0].equals("PLAYERS_MIN"))
{
config.MinPlayers = Integer.parseInt(tokens[1]);
}
else if (tokens[0].equals("PLAYERS_MAX"))
{
config.MaxPlayers = Integer.parseInt(tokens[1]);
}
//Games
else
{
try
{
GameType type = GameType.valueOf(tokens[0]);
boolean enabled = Boolean.valueOf(tokens[1]);
if (enabled)
config.GameList.add(type);
}
catch (Exception e)
{
}
}
}
in.close();
}
catch (Exception e)
{
}
if (!config.IsValid())
config = GetDefaultConfig();
WriteServerConfig(config);
return config;
}
public GameServerConfig GetDefaultConfig()
{
GameServerConfig config = new GameServerConfig();
config.ServerType = "Minigames";
config.MinPlayers = 8;
config.MaxPlayers = 16;
return config;
}
public void WriteServerConfig(GameServerConfig config)
{
try
{
FileWriter fstream = new FileWriter("ArcadeSettings.config");
BufferedWriter out = new BufferedWriter(fstream);
out.write("SERVER_TYPE=" + config.ServerType + "\n");
out.write("PLAYERS_MIN=" + config.MinPlayers + "\n");
out.write("PLAYERS_MAX=" + config.MaxPlayers + "\n");
out.write("\n\nGames List;\n");
for (GameType type : GameType.values())
{
out.write(type.toString() + "=" + config.GameList.contains(type) + "\n");
}
out.close();
}
catch (Exception e)
{
}
}
private void DeleteFolders()
{
File curDir = new File(".");
File[] filesList = curDir.listFiles();
for(File file : filesList)
{
if (!file.isDirectory())
continue;
if (file.getName().length() < 4)
continue;
if (!file.getName().substring(0, 4).equalsIgnoreCase("Game"))
continue;
FileUtil.DeleteFolder(file);
System.out.println("Deleted Old Game: " + file.getName());
}
}
@Override
public JavaPlugin GetPlugin()
{
return this;
}
@Override
public String GetWebServerAddress()
{
String webServerAddress = getConfig().getString(WEB_CONFIG);
return webServerAddress;
}
@Override
public Server GetRealServer()
{
return getServer();
}
@Override
public PluginManager GetPluginManager()
{
return GetRealServer().getPluginManager();
}
@Override
public void Log(String moduleName, String data)
{
System.out.println(moduleName + " : " + data);
}
@Override
public ModuleManager GetModules()
{
if (_moduleManager == null)
_moduleManager = new ModuleManager();
return _moduleManager;
}
@Override
public Config GetConfig()
{
if (_config == null)
_config = new Config(this);
return _config;
}
@Override
public Utility GetUtility()
{
if (_utility == null)
_utility = new Utility(this);
return _utility;
}
@Override
public BlockRegenerate GetBlockRegenerate()
{
if (_blockRegenerate == null)
_blockRegenerate = new BlockRegenerate(this);
return _blockRegenerate;
}
@Override
public BlockRestore GetBlockRestore()
{
if (_blockRestore == null)
_blockRestore = new BlockRestore(this);
return _blockRestore;
}
@Override
public Blood GetBlood()
{
if (_blood == null)
_blood = new Blood(this);
return _blood;
}
@Override
public Creature GetCreature()
{
if (_creature == null)
_creature = new Creature(this);
return _creature;
}
@Override
public Fire GetFire()
{
if (_fire == null)
_fire = new Fire(this, _condition, _damageManager);
return _fire;
}
@Override
public Logger GetLogger()
{
if (_logger == null)
_logger = new Logger(this);
return _logger;
}
@Override
public LootFactory GetLoot()
{
if (_lootFactory == null)
_lootFactory = new LootFactory(this);
return _lootFactory;
}
@Override
public Observer GetObserver()
{
if (_observer == null)
_observer = new Observer(this);
return _observer;
}
@Override
public me.chiss.Core.Server.Server GetServer()
{
if (_serverModule == null)
_serverModule = new me.chiss.Core.Server.Server(this, _clientManager);
return _serverModule;
}
@Override
public Spawn GetSpawn()
{
if (_spawn == null)
_spawn = new Spawn(this);
return _spawn;
}
@Override
public Teleport GetTeleport()
{
if (_teleport == null)
_teleport = new Teleport(this, _clientManager, GetSpawn());
return _teleport;
}
@Override
public ProjectileManager GetThrow()
{
if (_throw == null)
_throw = new ProjectileManager(this);
return _throw;
}
@Override
public Location GetSpawnLocation()
{
return null;
}
@Override
public PetManager GetPetManager()
{
return _petManager;
}
@Override
public Energy GetEnergy()
{
return null;
}
}

View File

@ -35,6 +35,7 @@ import mineplex.minecraft.game.core.fire.Fire;
import me.chiss.Core.Chat.Chat;
import mineplex.core.MiniPlugin;
import mineplex.core.itemstack.ItemStackFactory;
import me.chiss.Core.Modules.Blood;
import me.chiss.Core.Plugin.IChat;
import mineplex.core.account.CoreClientManager;
import mineplex.core.blockrestore.BlockRestore;
@ -51,6 +52,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation, IChat
{
//Modules
private BlockRestore _blockRestore;
private Blood _blood;
private Chat _chat;
private CoreClientManager _clientManager;
private DisguiseManager _disguiseManager;
@ -81,7 +83,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation, IChat
//Games
private Game _game;
public ArcadeManager(JavaPlugin plugin, GameServerConfig serverConfig, CoreClientManager clientManager, DonationManager donationManager, ConditionManager conditionManager, DamageManager damageManager, Creature creature, PacketHandler packetHandler)
public ArcadeManager(JavaPlugin plugin, GameServerConfig serverConfig, CoreClientManager clientManager, DonationManager donationManager, ConditionManager conditionManager, DamageManager damageManager, DisguiseManager disguiseManager, Creature creature, Blood blood, PacketHandler packetHandler)
{
super("Game Manager", plugin);
@ -90,6 +92,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation, IChat
//Modules
_blockRestore = new BlockRestore(plugin);
_blood = blood;
_explosionManager = new Explosion(plugin, _blockRestore);
_explosionManager.SetDebris(false);
@ -104,7 +108,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation, IChat
_damageManager = damageManager;
_damageManager.UseDefaultWeaponDamage = true;
_disguiseManager = new DisguiseManager(plugin, packetHandler);
_disguiseManager = disguiseManager;
_donationManager = donationManager;
@ -156,6 +160,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation, IChat
{
return GetServerConfig().GameList;
}
public Blood GetBlood()
{
return _blood;
}
public Chat GetChat()
{
@ -374,7 +383,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation, IChat
public void HubClock(Player player)
{
player.getInventory().setItem(1, ItemStackFactory.Instance.CreateStack(Material.WATCH, (byte)0, 1, (short)0, C.cGreen + "Return to Hub",
player.getInventory().setItem(8, ItemStackFactory.Instance.CreateStack(Material.WATCH, (byte)0, 1, (short)0, C.cGreen + "Return to Hub",
new String[] {"", ChatColor.RESET + "Click while holding this", ChatColor.RESET + "to return to the Hub."}));
}

View File

@ -1,436 +0,0 @@
package nautilus.game.arcade;
import java.io.File;
import java.util.ArrayList;
import nautilus.game.arcade.addons.*;
import nautilus.game.arcade.command.*;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.GameServerConfig;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.managers.*;
import nautilus.game.arcade.shop.ArcadeShop;
import nautilus.game.arcade.world.FireworkHandler;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.server.ServerListPingEvent;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.minecraft.game.core.IRelation;
import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.DamageManager;
import mineplex.minecraft.game.core.fire.Fire;
import me.chiss.Core.Chat.Chat;
import mineplex.core.MiniPlugin;
import mineplex.core.itemstack.ItemStackFactory;
import me.chiss.Core.Plugin.IChat;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.*;
import mineplex.core.creature.Creature;
import mineplex.core.disguise.DisguiseManager;
import mineplex.core.donation.DonationManager;
import mineplex.core.packethandler.PacketHandler;
import mineplex.core.portal.Portal;
public class ArcadeManager extends MiniPlugin implements IRelation, IChat
{
//Modules
private Chat _chat;
private CoreClientManager _clientManager;
private DisguiseManager _disguiseManager;
private DonationManager _donationManager;
private ConditionManager _conditionManager;
private Creature _creature;
private DamageManager _damageManager;
private Fire _fire;
private FireworkHandler _firework;
private Portal _portal;
private ArcadeShop _arcadeShop;
//Managers
private GameFactory _gameFactory;
private GameChatManager _gameChatManager;
private GameCreationManager _gameCreationManager;
private GameGemManager _gameGemManager;
private GameManager _gameManager;
private GameLobbyManager _gameLobbyManager;
private GameWorldManager _gameWorldManager;
//Server Games
private GameServerConfig _serverConfig;
//Games
private Game _game;
public ArcadeManager(JavaPlugin plugin, GameServerConfig serverConfig, CoreClientManager clientManager, DonationManager donationManager, ConditionManager conditionManager, DamageManager damageManager, Creature creature, PacketHandler packetHandler)
{
super("Game Manager", plugin);
_serverConfig = serverConfig;
//Modules
_conditionManager = conditionManager;
_clientManager = clientManager;
_chat = new Chat(plugin, _clientManager, this);
_creature = creature;
_damageManager = damageManager;
_damageManager.UseDefaultWeaponDamage = true;
_disguiseManager = new DisguiseManager(plugin, packetHandler);
_donationManager = donationManager;
_firework = new FireworkHandler();
_fire = new Fire(plugin, conditionManager, damageManager);
_portal = new Portal(plugin);
//Shop
_arcadeShop = new ArcadeShop(this, clientManager, donationManager);
//Game Factory
_gameFactory = new GameFactory(this);
//Managers
System.out.println("WOOF");
_gameChatManager = new GameChatManager(this);
_gameCreationManager = new GameCreationManager(this);
_gameGemManager = new GameGemManager(this);
_gameManager = new GameManager(this);
_gameLobbyManager = new GameLobbyManager(this, packetHandler);
new GameFlagManager(this);
new GamePlayerManager(this);
_gameWorldManager = new GameWorldManager(this);
new MiscManager(this);
//Game Addons
new CompassAddon(plugin, this);
new SoupAddon(plugin, this);
}
@Override
public void AddCommands()
{
AddCommand(new GameCommand(this));
AddCommand(new ParseCommand(this));
AddCommand(new GemCommand(this));
AddCommand(new WriteCommand(this));
}
public GameServerConfig GetServerConfig()
{
return _serverConfig;
}
public ArrayList<GameType> GetGameList()
{
return GetServerConfig().GameList;
}
public Chat GetChat()
{
return _chat;
}
public CoreClientManager GetClients()
{
return _clientManager;
}
public ConditionManager GetCondition()
{
return _conditionManager;
}
public Creature GetCreature()
{
return _creature;
}
public DisguiseManager GetDisguise()
{
return _disguiseManager;
}
public DamageManager GetDamage()
{
return _damageManager;
}
public DonationManager GetDonation()
{
return _donationManager;
}
public Fire GetFire()
{
return _fire;
}
public FireworkHandler GetFirework()
{
return _firework;
}
public GameLobbyManager GetLobby()
{
return _gameLobbyManager;
}
public ArcadeShop GetShop()
{
return _arcadeShop;
}
public GameCreationManager GetGameCreationManager()
{
return _gameCreationManager;
}
public GameFactory GetGameFactory()
{
return _gameFactory;
}
public GameManager GetGameManager()
{
return _gameManager;
}
public GameGemManager GetGameGemManager()
{
return _gameGemManager;
}
public GameWorldManager GetGameWorldManager()
{
return _gameWorldManager;
}
public ChatColor GetColor(Player player)
{
if (_game == null)
return ChatColor.GRAY;
GameTeam team = _game.GetTeam(player);
if (team == null)
return ChatColor.GRAY;
return team.GetColor();
}
@Override
public void HandleChat(AsyncPlayerChatEvent event, String filteredMessage)
{
_gameChatManager.HandleChat(event, filteredMessage);
}
@Override
public boolean CanHurt(String a, String b)
{
return CanHurt(UtilPlayer.searchExact(a), UtilPlayer.searchExact(b));
}
public boolean CanHurt(Player pA, Player pB)
{
if (pA == null || pB == null)
return false;
if (!_game.Damage)
return false;
if (!_game.DamagePvP)
return false;
//Self Damage
if (pA.equals(pB))
return _game.DamageSelf;
GameTeam tA = _game.GetTeam(pA);
if (tA == null)
return false;
GameTeam tB = _game.GetTeam(pB);
if (tB == null)
return false;
if (tA.equals(tB) && !_game.DamageTeamSelf)
return false;
if (!tA.equals(tB) && !_game.DamageTeamOther)
return false;
return true;
}
@Override
public boolean IsSafe(Player player)
{
if (_game == null)
return true;
if (_game.IsPlaying(player))
return false;
return true;
}
@EventHandler
public void MessageMOTD(ServerListPingEvent event)
{
if (_game == null || _game.GetState() == GameState.Recruit)
{
if (_game != null && _game.GetCountdown() != -1)
{
event.setMotd(ChatColor.GREEN + "Starting in " + _game.GetCountdown() + " Seconds");
}
else
{
event.setMotd(ChatColor.GREEN + "Recruiting");
}
}
else
{
event.setMotd(ChatColor.YELLOW + "In Progress");
}
}
@EventHandler
public void MessageJoin(PlayerJoinEvent event)
{
event.setJoinMessage(F.sys("Join", event.getPlayer().getName()));
}
@EventHandler
public void MessageQuit(PlayerQuitEvent event)
{
event.setQuitMessage(F.sys("Quit", GetColor(event.getPlayer()) + event.getPlayer().getName()));
}
public Game GetGame()
{
return _game;
}
public void SetGame(Game game)
{
_game = game;
}
public int GetPlayerMin()
{
return GetServerConfig().MinPlayers;
}
public int GetPlayerFull()
{
return GetServerConfig().MaxPlayers;
}
public void HubClock(Player player)
{
player.getInventory().setItem(1, ItemStackFactory.Instance.CreateStack(Material.WATCH, (byte)0, 1, (short)0, C.cGreen + "Return to Hub",
new String[] {"", ChatColor.RESET + "Click while holding this", ChatColor.RESET + "to return to the Hub."}));
}
@EventHandler(priority = EventPriority.LOWEST)
public void HubClockInteract(PlayerInteractEvent event)
{
Player player = event.getPlayer();
if (player.getItemInHand() == null)
return;
if (player.getItemInHand().getType() != Material.WATCH)
return;
if (_game != null && _game.IsAlive(player))
return;
_portal.SendPlayerToServer(player, "Lobby");
}
public boolean IsAlive(Player player)
{
if (_game == null)
return false;
return _game.IsAlive(player);
}
public void Clear(Player player)
{
player.setGameMode(GameMode.SURVIVAL);
UtilInv.Clear(player);
player.setFoodLevel(20);
player.setHealth(20);
player.setFireTicks(0);
player.setFallDistance(0);
player.setLevel(0);
player.setExp(0f);
((CraftPlayer)player).getHandle().spectating = false;
((CraftPlayer)player).getHandle().m = true;
GetCondition().EndCondition(player, ConditionType.CLOAK, "Spectator");
HubClock(player);
GetDisguise().Undisguise(player);
}
public ArrayList<String> LoadFiles(String gameName)
{
File folder = new File("maps" + File.separatorChar + gameName);
if (!folder.exists()) folder.mkdirs();
ArrayList<String> maps = new ArrayList<String>();
System.out.println("Searching Maps in: " + folder);
for (File file : folder.listFiles())
{
if (!file.isFile())
continue;
String name = file.getName();
if (name.length() < 5)
continue;
name = name.substring(name.length()-4, name.length());
if (file.getName().equals(".zip"))
continue;
maps.add(file.getName().substring(0, file.getName().length()-4));
}
for (String map : maps)
System.out.println("Found Map: " + map);
return maps;
}
}

View File

@ -1,896 +0,0 @@
package nautilus.game.arcade.game;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import nautilus.game.arcade.ArcadeFormat;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerStateChangeEvent;
import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.world.WorldData;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.scoreboard.DisplaySlot;
import org.bukkit.scoreboard.Objective;
import org.bukkit.scoreboard.Score;
import org.bukkit.scoreboard.Scoreboard;
import org.bukkit.scoreboard.Team;
import org.bukkit.util.Vector;
public abstract class Game implements Listener
{
public enum GameState
{
Loading,
Recruit,
Prepare,
Live,
End,
Dead
}
public ArcadeManager Manager;
//Game
private GameType _gameType;
private String[] _gameDesc;
//Map
private ArrayList<String> _files;
//State
private GameState _gameState = GameState.Loading;
private long _gameStateTime = System.currentTimeMillis();
private int _countdown = -1;
private boolean _countdownForce = false;
private int _playerCount = 0;
private String _customWinLine = "";
//Kits
private Kit[] _kits;
//Teams
private ArrayList<GameTeam> _teamList = new ArrayList<GameTeam>();
//Player Preferences
private NautHashMap<Player, Kit> _playerKit = new NautHashMap<Player, Kit>();
private NautHashMap<GameTeam, ArrayList<Player>> _teamPreference = new NautHashMap<GameTeam, ArrayList<Player>>();
private NautHashMap<Player, HashMap<String,GemData>> _gemCount = new NautHashMap<Player, HashMap<String,GemData>>();
//Scoreboard
private Scoreboard _scoreboard;
private Objective _sideObjective;
//Loaded from Map Config
public WorldData WorldData = null;
//Gameplay Flags
public boolean Damage = true;
public boolean DamagePvP = true;
public boolean DamagePvE = true;
public boolean DamageEvP = true;
public boolean DamageSelf = true;
public boolean DamageTeamSelf = false;
public boolean DamageTeamOther = true;
public boolean BlockBreak = false;
public HashSet<Integer> BlockBreakAllow = new HashSet<Integer>();
public HashSet<Integer> BlockBreakDeny = new HashSet<Integer>();
public boolean BlockPlace = false;
public HashSet<Integer> BlockPlaceAllow = new HashSet<Integer>();
public HashSet<Integer> BlockPlaceDeny = new HashSet<Integer>();
public boolean ItemPickup = false;
public HashSet<Integer> ItemPickupAllow = new HashSet<Integer>();
public HashSet<Integer> ItemPickupDeny = new HashSet<Integer>();
public boolean ItemDrop = false;
public HashSet<Integer> ItemDropAllow = new HashSet<Integer>();
public HashSet<Integer> ItemDropDeny = new HashSet<Integer>();
public boolean PrivateBlocks = false;
public boolean DeathOut = true;
public boolean DeathDropItems = true;
public boolean CreatureAllow = false;
public boolean CreatureAllowOverride = false;
public int WorldTimeSet = -1;
public int WorldHeightLimit = 0;
public int HungerSet = -1;
public int HealthSet = -1;
public int SpawnDistanceRequirement = 1;
public boolean PrepareFreeze = true;
public int WaterDamage = 0;
public boolean RepairWeapons = true;
//Addons
public boolean CompassEnabled = false;
public boolean SoupEnabled = true;
//Gameplay Data
public HashMap<Location, Player> PrivateBlockMap = new HashMap<Location, Player>();
public HashMap<String, Integer> PrivateBlockCount = new HashMap<String, Integer>();
public Location SpectatorSpawn = null;
public boolean FirstKill = true;
public String Winner = "Nobody";
public GameTeam WinnerTeam = null;
public Game(ArcadeManager manager, GameType gameType, Kit[] kits, String[] gameDesc)
{
Manager = manager;
//Game
_gameType = gameType;
_gameDesc = gameDesc;
//Kits
_kits = kits;
//Scoreboard
_scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
_sideObjective = _scoreboard.registerNewObjective("Obj"+UtilMath.r(999999999), "dummy");
_sideObjective.setDisplaySlot(DisplaySlot.SIDEBAR);
_sideObjective.setDisplayName(C.Bold + GetName());
//Map
_files = Manager.LoadFiles(GetName());
WorldData = new WorldData(this);
System.out.println("Loading " + GetName() + "...");
}
public ArrayList<String> GetFiles()
{
return _files;
}
public String GetName()
{
return _gameType.GetName();
}
public GameType GetType()
{
return _gameType;
}
public String[] GetDesc()
{
return _gameDesc;
}
public void SetCustomWinLine(String line)
{
_customWinLine = line;
}
public Scoreboard GetScoreboard()
{
return _scoreboard;
}
public Objective GetObjectiveSide()
{
return _sideObjective;
}
public ArrayList<GameTeam> GetTeamList()
{
return _teamList;
}
public int GetCountdown()
{
return _countdown;
}
public void SetCountdown(int time)
{
_countdown = time;
}
public boolean GetCountdownForce()
{
return _countdownForce;
}
public void SetCountdownForce(boolean value)
{
_countdownForce = value;
}
public int GetPlayerCountAtStart()
{
return _playerCount;
}
public void SetPlayerCountAtStart(int count)
{
_playerCount = count;
}
public NautHashMap<GameTeam, ArrayList<Player>> GetTeamPreferences()
{
return _teamPreference;
}
public NautHashMap<Player, Kit> GetPlayerKits()
{
return _playerKit;
}
public NautHashMap<Player, HashMap<String,GemData>> GetPlayerGems()
{
return _gemCount;
}
public GameState GetState()
{
return _gameState;
}
public void SetState(GameState state)
{
_gameState = state;
_gameStateTime = System.currentTimeMillis();
//Event
GameStateChangeEvent stateEvent = new GameStateChangeEvent(this, state);
UtilServer.getServer().getPluginManager().callEvent(stateEvent);
System.out.println(GetName() + " state set to " + state.toString());
}
public long GetStateTime()
{
return _gameStateTime;
}
public boolean InProgress()
{
return GetState() == GameState.Prepare || GetState() == GameState.Live;
}
public boolean IsLive()
{
return _gameState == GameState.Live;
}
public void AddTeam(GameTeam team)
{
//Add
GetTeamList().add(team);
//Set Spawn Data
team.SetSpawnRequirement(this.SpawnDistanceRequirement);
System.out.println("Created Team: " + team.GetName());
}
public boolean HasTeam(GameTeam team)
{
for (GameTeam cur : GetTeamList())
if (cur.equals(team))
return true;
return false;
}
public void CreateScoreboardTeams()
{
System.out.println("Creating Scoreboard Teams.");
//Base Groups
for (Rank rank : Rank.values())
{
//Spectator
if (rank == Rank.ALL)
{
_scoreboard.registerNewTeam(rank.Name + "SPEC").setPrefix(ChatColor.GRAY + "");
}
else
{
_scoreboard.registerNewTeam(rank.Name + "SPEC").setPrefix(rank.Color + C.Bold + rank.Name.toUpperCase() + ChatColor.RESET + " " + ChatColor.GRAY);
}
}
//Team Groups
for (GameTeam team : GetTeamList())
{
for (Rank rank : Rank.values())
{
if (rank == Rank.ALL)
{
_scoreboard.registerNewTeam(rank.Name + team.GetName().toUpperCase()).setPrefix(team.GetColor() + "");
}
else
{
_scoreboard.registerNewTeam(rank.Name + team.GetName().toUpperCase()).setPrefix(rank.Color + C.Bold + rank.Name.toUpperCase() + ChatColor.RESET + " " + team.GetColor());
}
}
}
}
public void RestrictKits()
{
//Null Default
}
public void RegisterKits()
{
for (Kit kit : _kits)
{
UtilServer.getServer().getPluginManager().registerEvents(kit, Manager.GetPlugin());
for (Perk perk : kit.GetPerks())
UtilServer.getServer().getPluginManager().registerEvents(perk, Manager.GetPlugin());
}
}
public void DeregisterKits()
{
for (Kit kit : _kits)
{
HandlerList.unregisterAll(kit);
for (Perk perk : kit.GetPerks())
HandlerList.unregisterAll(perk);
}
}
public void ParseData()
{
//Nothing by default,
//Use this to parse in extra location data from maps
}
public void SetPlayerTeam(Player player, GameTeam team)
{
//Clean Old Team
GameTeam pastTeam = this.GetTeam(player);
if (pastTeam != null)
{
pastTeam.RemovePlayer(player);
}
team.AddPlayer(player);
//Ensure Valid Kit
ValidateKit(player, team);
//Game Scoreboard
SetPlayerScoreboardTeam(player, team.GetName().toUpperCase());
//Lobby Scoreboard
Manager.GetLobby().AddPlayerToScoreboards(player, team.GetName().toUpperCase());
}
public void SetPlayerScoreboardTeam(Player player, String teamName)
{
for (Team team : GetScoreboard().getTeams())
team.removePlayer(player);
if (teamName == null)
teamName = "";
GetScoreboard().getTeam(Manager.GetClients().Get(player).GetRank().Name + teamName).addPlayer(player);
}
public GameTeam ChooseTeam(Player player)
{
GameTeam team = null;
//Random Team
for (int i=0 ; i<_teamList.size() ; i++)
{
if (team == null || _teamList.get(i).GetSize() < team.GetSize())
{
team = _teamList.get(i);
}
}
return team;
}
public double GetKillsGems(Player killer, Player killed, boolean assist)
{
if (!DeathOut)
{
return 0.5;
}
if (!assist)
{
return 4;
}
else
{
return 1;
}
}
public HashMap<String, GemData> GetGems(Player player)
{
if (!_gemCount.containsKey(player))
_gemCount.put(player, new HashMap<String, GemData>());
return _gemCount.get(player);
}
public void AddGems(Player player, double gems, String reason, boolean countAmount)
{
if (!countAmount && gems < 1)
gems = 1;
if (GetGems(player).containsKey(reason))
{
GetGems(player).get(reason).AddGems(gems);
}
else
{
GetGems(player).put(reason, new GemData(gems, countAmount));
}
}
public void ValidateKit(Player player, GameTeam team)
{
//Kit
if (GetKit(player) == null || !team.KitAllowed(GetKit(player)))
{
for (Kit kit : _kits)
{
if (kit.GetAvailability() == KitAvailability.Hide ||
kit.GetAvailability() == KitAvailability.Null)
continue;
if (team.KitAllowed(kit))
{
SetKit(player, kit, false);
break;
}
}
}
}
public void SetKit(Player player, Kit kit, boolean announce)
{
GameTeam team = GetTeam(player);
if (team != null)
{
if (!team.KitAllowed(kit))
{
player.playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 0.5f);
UtilPlayer.message(player, F.main("Kit", F.elem(team.GetFormattedName()) + " cannot use " + F.elem(kit.GetFormattedName() + " Kit") + "."));
return;
}
}
_playerKit.put(player, kit);
if (announce)
{
player.playSound(player.getLocation(), Sound.ORB_PICKUP, 2f, 1f);
UtilPlayer.message(player, F.main("Kit", "You equipped " + F.elem(kit.GetFormattedName() + " Kit") + "."));
}
}
public Kit GetKit(Player player)
{
return _playerKit.get(player);
}
public Kit[] GetKits()
{
return _kits;
}
public boolean HasKit(Kit kit)
{
for (Kit cur : GetKits())
if (cur.equals(kit))
return true;
return false;
}
public boolean SetPlayerState(Player player, PlayerState state)
{
GetScoreboard().resetScores(player);
GameTeam team = GetTeam(player);
if (team == null)
return false;
team.SetPlayerState(player, state);
//Event
PlayerStateChangeEvent playerStateEvent = new PlayerStateChangeEvent(this, player, PlayerState.OUT);
UtilServer.getServer().getPluginManager().callEvent(playerStateEvent);
return true;
}
public abstract void EndCheck();
public void RespawnPlayer(final Player player)
{
player.eject();
player.teleport(GetTeam(player).GetSpawn());
Manager.Clear(player);
//Re-Give Kit
Manager.GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable()
{
public void run()
{
GetKit(player).ApplyKit(player);
}
}, 0);
}
public boolean IsPlaying(Player player)
{
return GetTeam(player) != null;
}
public boolean IsAlive(Player player)
{
GameTeam team = GetTeam(player);
if (team == null)
return false;
return team.IsAlive(player);
}
public ArrayList<Player> GetPlayers(boolean aliveOnly)
{
ArrayList<Player> players = new ArrayList<Player>();
for (GameTeam team : _teamList)
players.addAll(team.GetPlayers(aliveOnly));
return players;
}
public GameTeam GetTeam(Player player)
{
for (GameTeam team : _teamList)
if (team.HasPlayer(player))
return team;
return null;
}
public GameTeam GetTeam(ChatColor color)
{
for (GameTeam team : _teamList)
if (team.GetColor() == color)
return team;
return null;
}
public Location GetSpectatorLocation()
{
if (SpectatorSpawn != null)
return SpectatorSpawn;
Vector vec = new Vector(0,0,0);
double count = 0;
for (GameTeam team : this.GetTeamList())
{
for (Location spawn : team.GetSpawns())
{
count++;
vec.add(spawn.toVector());
}
}
SpectatorSpawn = new Location(this.WorldData.World, 0,0,0);
vec.multiply(1d/count);
SpectatorSpawn.setX(vec.getX());
SpectatorSpawn.setY(vec.getY());
SpectatorSpawn.setZ(vec.getZ());
//Move Up - Out Of Blocks
while (!UtilBlock.airFoliage(SpectatorSpawn.getBlock()) || !UtilBlock.airFoliage(SpectatorSpawn.getBlock().getRelative(BlockFace.UP)))
{
SpectatorSpawn.add(0, 1, 0);
}
int Up = 0;
//Move Up - Through Air
for (int i=0 ; i<15 ; i++)
{
if (UtilBlock.airFoliage(SpectatorSpawn.getBlock().getRelative(BlockFace.UP)))
{
SpectatorSpawn.add(0, 1, 0);
Up++;
}
else
{
break;
}
}
//Move Down - Out Of Blocks
while (Up > 0 && !UtilBlock.airFoliage(SpectatorSpawn.getBlock()) || !UtilBlock.airFoliage(SpectatorSpawn.getBlock().getRelative(BlockFace.UP)))
{
SpectatorSpawn.subtract(0, 1, 0);
Up--;
}
SpectatorSpawn = SpectatorSpawn.getBlock().getLocation().add(0.5, 0.1, 0.5);
while (SpectatorSpawn.getBlock().getTypeId() != 0 || SpectatorSpawn.getBlock().getRelative(BlockFace.UP).getTypeId() != 0)
SpectatorSpawn.add(0, 1, 0);
return SpectatorSpawn;
}
public void SetSpectator(Player player)
{
Manager.Clear(player);
player.teleport(GetSpectatorLocation());
player.setGameMode(GameMode.CREATIVE);
player.setFlying(true);
player.setFlySpeed(0.1f);
((CraftPlayer)player).getHandle().spectating = true;
((CraftPlayer)player).getHandle().m = false;
Manager.GetCondition().Factory().Cloak("Spectator", player, player, 7777, true, true);
if (GetTeam(player) != null && _scoreboard.getTeam(GetTeam(player).GetName().toUpperCase()) != null)
{
_scoreboard.getTeam(GetTeam(player).GetName().toUpperCase()).removePlayer(player);
}
SetPlayerScoreboardTeam(player, "SPEC");
}
@EventHandler
public void ScoreboardUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
for (GameTeam team : this.GetTeamList())
{
String name = team.GetColor() + team.GetName();
if (name.length() > 16)
name = name.substring(0, 16);
Score score = GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(name));
score.setScore(team.GetPlayers(true).size());
}
}
public boolean DisplayDeathMessage()
{
if (this.DeathOut)
{
return true;
}
return false;
}
public boolean CanJoinTeam(GameTeam team)
{
return team.GetSize() < UtilServer.getPlayers().length/GetTeamList().size();
}
public GameTeam GetTeamPreference(Player player)
{
for (GameTeam team : _teamPreference.keySet())
{
if (_teamPreference.get(team).contains(player))
return team;
}
return null;
}
public void RemoveTeamPreference(Player player)
{
for (ArrayList<Player> queue : _teamPreference.values())
queue.remove(player);
}
public String GetTeamQueuePosition(Player player)
{
for (ArrayList<Player> queue : _teamPreference.values())
{
for (int i=0 ; i<queue.size() ; i++)
{
if (queue.get(i).equals(player))
return (i+1) + "/" + queue.size();
}
}
return "Unknown";
}
public void InformQueuePositions()
{
for (GameTeam team : _teamPreference.keySet())
{
for (Player player : _teamPreference.get(team))
{
UtilPlayer.message(player, F.main("Team", "You are " + F.elem(GetTeamQueuePosition(player)) + " in queue for " + F.elem(team.GetFormattedName() + " Team") + "."));
}
}
}
public void AnnounceGame()
{
for (Player player : UtilServer.getPlayers())
{
player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1f);
for (int i=0 ; i<6-GetDesc().length ; i++)
UtilPlayer.message(player, "");
UtilPlayer.message(player, ArcadeFormat.Line);
UtilPlayer.message(player, "§aGame - §f§l" + this.GetName());
UtilPlayer.message(player, "");
for (String line : this.GetDesc())
{
UtilPlayer.message(player, C.cGray + "- " + line);
}
UtilPlayer.message(player, "");
UtilPlayer.message(player, "§aMap - §f§l" + WorldData.MapName + C.cGray + " created by " + "§f§l" + WorldData.MapAuthor);
UtilPlayer.message(player, ArcadeFormat.Line);
}
Manager.GetChat().Silence(9000, false);
}
public void AnnounceEnd(GameTeam team)
{
for (Player player : UtilServer.getPlayers())
{
player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1f);
UtilPlayer.message(player, "");
UtilPlayer.message(player, ArcadeFormat.Line);
UtilPlayer.message(player, "§aGame - §f§l" + this.GetName());
UtilPlayer.message(player, "");
UtilPlayer.message(player, "");
if (team != null)
{
WinnerTeam = team;
Winner = team.GetName() + " Team";
UtilPlayer.message(player, team.GetColor() + C.Bold + team.GetName() + " won the game!");
}
else
{
UtilPlayer.message(player, ChatColor.WHITE + "§lNobody won the game...");
}
UtilPlayer.message(player, _customWinLine);
UtilPlayer.message(player, "");
UtilPlayer.message(player, "§aMap - §f§l" + WorldData.MapName + C.cGray + " created by " + "§f§l" + WorldData.MapAuthor);
UtilPlayer.message(player, ArcadeFormat.Line);
}
Manager.GetChat().Silence(5000, false);
}
public void AnnounceEnd(ArrayList<Player> places)
{
for (Player player : UtilServer.getPlayers())
{
player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1f);
UtilPlayer.message(player, "");
UtilPlayer.message(player, ArcadeFormat.Line);
UtilPlayer.message(player, "§aGame - §f§l" + this.GetName());
UtilPlayer.message(player, "");
if (places == null || places.isEmpty())
{
UtilPlayer.message(player, "");
UtilPlayer.message(player, ChatColor.WHITE + "§lNobody won the game...");
UtilPlayer.message(player, "");
}
else
{
if (places.size() >= 1)
{
Winner = places.get(0).getName();
UtilPlayer.message(player, C.cRed + C.Bold + "1st Place" + C.cWhite + " - " + places.get(0).getName());
}
if (places.size() >= 2)
UtilPlayer.message(player, C.cGold + C.Bold + "2nd Place" + C.cWhite + " - " + places.get(1).getName());
if (places.size() >= 3)
UtilPlayer.message(player, C.cYellow + C.Bold + "3rd Place" + C.cWhite + " - " + places.get(2).getName());
}
UtilPlayer.message(player, "");
UtilPlayer.message(player, "§aMap - §f§l" + WorldData.MapName + C.cGray + " created by " + "§f§l" + WorldData.MapAuthor);
UtilPlayer.message(player, ArcadeFormat.Line);
}
Manager.GetChat().Silence(5000, false);
}
public void Announce(String message)
{
for (Player player : UtilServer.getPlayers())
{
player.playSound(player.getLocation(), Sound.NOTE_PLING, 1f, 1f);
UtilPlayer.message(player, message);
}
}
}

View File

@ -1,8 +1,8 @@
package nautilus.game.arcade.game.minigames.deathtag.kits;
import org.bukkit.Material;
import org.bukkit.entity.Creature;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@ -46,8 +46,8 @@ public class KitArcher extends Kit
}
@Override
public void SpawnCustom(Creature ent)
{
public void SpawnCustom(LivingEntity ent)
{
ent.getEquipment().setHelmet(new ItemStack(Material.CHAINMAIL_HELMET));
ent.getEquipment().setChestplate(new ItemStack(Material.CHAINMAIL_CHESTPLATE));
ent.getEquipment().setLeggings(new ItemStack(Material.CHAINMAIL_LEGGINGS));

View File

@ -1,8 +1,8 @@
package nautilus.game.arcade.game.minigames.dragons.kits;
import org.bukkit.Material;
import org.bukkit.entity.Creature;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@ -26,7 +26,7 @@ public class KitCoward extends Kit
new Perk[]
{
new PerkLeaper("Leap", 1.2, 1.0, 8000),
new PerkLeap("Leap", 1.2, 1.0, 8000),
new PerkSpeed(0)
},
EntityType.ZOMBIE,
@ -46,8 +46,8 @@ public class KitCoward extends Kit
}
@Override
public void SpawnCustom(Creature ent)
{
public void SpawnCustom(LivingEntity ent)
{
ent.getEquipment().setHelmet(new ItemStack(Material.LEATHER_HELMET));
ent.getEquipment().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE));
ent.getEquipment().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS));

View File

@ -1,8 +1,8 @@
package nautilus.game.arcade.game.minigames.dragons.kits;
import org.bukkit.Material;
import org.bukkit.entity.Creature;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@ -45,8 +45,8 @@ public class KitMarksman extends Kit
}
@Override
public void SpawnCustom(Creature ent)
{
public void SpawnCustom(LivingEntity ent)
{
ent.getEquipment().setHelmet(new ItemStack(Material.CHAINMAIL_HELMET));
ent.getEquipment().setChestplate(new ItemStack(Material.CHAINMAIL_CHESTPLATE));
ent.getEquipment().setLeggings(new ItemStack(Material.CHAINMAIL_LEGGINGS));

View File

@ -1,8 +1,8 @@
package nautilus.game.arcade.game.minigames.dragons.kits;
import org.bukkit.Material;
import org.bukkit.entity.Creature;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@ -43,8 +43,8 @@ public class KitPyrotechnic extends Kit
}
@Override
public void SpawnCustom(Creature ent)
{
public void SpawnCustom(LivingEntity ent)
{
ent.getEquipment().setHelmet(new ItemStack(Material.GOLD_HELMET));
ent.getEquipment().setChestplate(new ItemStack(Material.GOLD_CHESTPLATE));
ent.getEquipment().setLeggings(new ItemStack(Material.GOLD_LEGGINGS));

View File

@ -15,7 +15,7 @@ import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.PerkFallDamage;
import nautilus.game.arcade.kit.perks.PerkLeaper;
import nautilus.game.arcade.kit.perks.PerkLeap;
public class KitSlime extends Kit
{
@ -30,7 +30,7 @@ public class KitSlime extends Kit
new Perk[]
{
new PerkLeaper("Bounce", 2, 2, 8000),
new PerkLeap("Bounce", 2, 2, 8000),
new PerkFallDamage(-40)
},
EntityType.SLIME,

View File

@ -14,7 +14,7 @@ import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.PerkLeaper;
import nautilus.game.arcade.kit.perks.PerkLeap;
import nautilus.game.arcade.kit.perks.PerkSpeed;
public class KitWolf extends Kit
@ -31,7 +31,7 @@ public class KitWolf extends Kit
new Perk[]
{
new PerkSpeed(2),
new PerkLeaper("Pounce", 1.2, 1, 4000)
new PerkLeap("Pounce", 1.2, 1, 4000)
},
EntityType.SLIME,
null);

View File

@ -1,8 +1,8 @@
package nautilus.game.arcade.game.minigames.horsecharge.kits;
import org.bukkit.Material;
import org.bukkit.entity.Creature;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@ -44,8 +44,8 @@ public class KitDefenceArcher extends Kit
}
@Override
public void SpawnCustom(Creature ent)
{
public void SpawnCustom(LivingEntity ent)
{
ent.getEquipment().setHelmet(new ItemStack(Material.LEATHER_HELMET));
ent.getEquipment().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE));
ent.getEquipment().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS));

View File

@ -1,8 +1,8 @@
package nautilus.game.arcade.game.minigames.horsecharge.kits;
import org.bukkit.Material;
import org.bukkit.entity.Creature;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@ -44,8 +44,8 @@ public class KitHorseKnight extends Kit
}
@Override
public void SpawnCustom(Creature ent)
{
public void SpawnCustom(LivingEntity ent)
{
ent.getEquipment().setHelmet(new ItemStack(Material.IRON_HELMET));
ent.getEquipment().setChestplate(new ItemStack(Material.IRON_CHESTPLATE));
ent.getEquipment().setLeggings(new ItemStack(Material.IRON_LEGGINGS));

View File

@ -243,6 +243,8 @@ public class Quiver extends SoloGame
event.AddMod("Projectile", "Instagib", 9001, false);
event.SetKnockback(false);
event.GetProjectile().remove();
}
@Override

View File

@ -1,7 +1,6 @@
package nautilus.game.arcade.game.minigames.quiver.kits;
import org.bukkit.Material;
import org.bukkit.entity.Creature;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@ -44,10 +43,4 @@ public class KitBrawler extends Kit
if (Manager.GetGame().GetState() == GameState.Live)
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)1, 1, F.item("Super Arrow")));
}
@Override
public void SpawnCustom(Creature ent)
{
}
}

View File

@ -1,7 +1,6 @@
package nautilus.game.arcade.game.minigames.quiver.kits;
import org.bukkit.Material;
import org.bukkit.entity.Creature;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@ -44,10 +43,4 @@ public class KitElementalist extends Kit
if (Manager.GetGame().GetState() == GameState.Live)
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)1, 1, F.item("Super Arrow")));
}
@Override
public void SpawnCustom(Creature ent)
{
}
}

View File

@ -1,7 +1,6 @@
package nautilus.game.arcade.game.minigames.quiver.kits;
import org.bukkit.Material;
import org.bukkit.entity.Creature;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@ -28,7 +27,7 @@ public class KitLeaper extends Kit
new Perk[]
{
new PerkLeaper("Leap", 1.2, 1.0, 8000)
new PerkLeap("Leap", 1.2, 1.0, 8000)
},
EntityType.ZOMBIE,
new ItemStack(Material.IRON_AXE));
@ -44,10 +43,4 @@ public class KitLeaper extends Kit
if (Manager.GetGame().GetState() == GameState.Live)
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)1, 1, F.item("Super Arrow")));
}
@Override
public void SpawnCustom(Creature ent)
{
}
}

View File

@ -25,7 +25,7 @@ public class KitLeaper extends Kit
new Perk[]
{
new PerkLeaper("Leap", 1.2, 1.2, 8000)
new PerkLeap("Leap", 1.2, 1.2, 8000)
},
EntityType.SKELETON,
new ItemStack(Material.STONE_AXE));

View File

@ -25,7 +25,7 @@ public class KitLeaper extends Kit
new Perk[]
{
new PerkLeaper("Smashing Leap", 1.2, 1.2, 8000),
new PerkLeap("Smashing Leap", 1.2, 1.2, 8000),
new PerkKnockback(0.3)
},
EntityType.PIG_ZOMBIE,

View File

@ -1,7 +1,6 @@
package nautilus.game.arcade.game.minigames.turfforts.kits;
import org.bukkit.Material;
import org.bukkit.entity.Creature;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@ -46,10 +45,4 @@ public class KitInfiltrator extends Kit
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOL, Manager.GetGame().GetTeam(player).GetColorData(), amount));
}
@Override
public void SpawnCustom(Creature ent)
{
}
}

View File

@ -1,7 +1,6 @@
package nautilus.game.arcade.game.minigames.turfforts.kits;
import org.bukkit.Material;
import org.bukkit.entity.Creature;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@ -45,10 +44,5 @@ public class KitMarksman extends Kit
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOL, Manager.GetGame().GetTeam(player).GetColorData(), amount));
}
@Override
public void SpawnCustom(Creature ent)
{
}
}

View File

@ -1,7 +1,6 @@
package nautilus.game.arcade.game.minigames.turfforts.kits;
import org.bukkit.Material;
import org.bukkit.entity.Creature;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@ -46,10 +45,4 @@ public class KitShredder extends Kit
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOL, Manager.GetGame().GetTeam(player).GetColorData(), amount));
}
@Override
public void SpawnCustom(Creature ent)
{
}
}

View File

@ -25,7 +25,7 @@ public class KitBeserker extends Kit
new Perk[]
{
new PerkLeaper("Beserker Leap", 1.2, 1.2, 8000),
new PerkLeap("Beserker Leap", 1.2, 1.2, 8000),
new PerkAxeman(),
},
EntityType.ZOMBIE,

View File

@ -1,8 +1,8 @@
package nautilus.game.arcade.game.standalone.castlesiege.kits;
import org.bukkit.Material;
import org.bukkit.entity.Creature;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
@ -69,8 +69,8 @@ public class KitHumanElementalist extends Kit
}
@Override
public void SpawnCustom(Creature ent)
{
public void SpawnCustom(LivingEntity ent)
{
ent.getEquipment().setHelmet(new ItemStack(Material.GOLD_HELMET));
ent.getEquipment().setChestplate(new ItemStack(Material.GOLD_CHESTPLATE));
ent.getEquipment().setLeggings(new ItemStack(Material.GOLD_LEGGINGS));

View File

@ -1,8 +1,8 @@
package nautilus.game.arcade.game.standalone.castlesiege.kits;
import org.bukkit.Material;
import org.bukkit.entity.Creature;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
@ -76,8 +76,8 @@ public class KitHumanKnight extends Kit
}
@Override
public void SpawnCustom(Creature ent)
{
public void SpawnCustom(LivingEntity ent)
{
ent.getEquipment().setHelmet(new ItemStack(Material.IRON_HELMET));
ent.getEquipment().setChestplate(new ItemStack(Material.IRON_CHESTPLATE));
ent.getEquipment().setLeggings(new ItemStack(Material.IRON_LEGGINGS));

View File

@ -1,8 +1,8 @@
package nautilus.game.arcade.game.standalone.castlesiege.kits;
import org.bukkit.Material;
import org.bukkit.entity.Creature;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
@ -71,8 +71,8 @@ public class KitHumanMarksman extends Kit
}
@Override
public void SpawnCustom(Creature ent)
{
public void SpawnCustom(LivingEntity ent)
{
ent.getEquipment().setHelmet(new ItemStack(Material.CHAINMAIL_HELMET));
ent.getEquipment().setChestplate(new ItemStack(Material.CHAINMAIL_CHESTPLATE));
ent.getEquipment().setLeggings(new ItemStack(Material.CHAINMAIL_LEGGINGS));

View File

@ -1,7 +1,6 @@
package nautilus.game.arcade.game.standalone.castlesiege.kits;
import org.bukkit.Material;
import org.bukkit.entity.Creature;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -59,10 +58,5 @@ public class KitHumanPeasant extends Kit
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_HOE));
}
@Override
public void SpawnCustom(Creature ent)
{
}
}

View File

@ -28,7 +28,7 @@ public class KitUndeadGhoul extends Kit
new Perk[]
{
new PerkLeaper("Ghoul Attack", 1.2, 0.8, 8000)
new PerkLeap("Ghoul Attack", 1.2, 0.8, 8000)
},
EntityType.PIG_ZOMBIE,
new ItemStack(Material.STONE_AXE));

View File

@ -8,6 +8,7 @@ import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
@ -70,7 +71,7 @@ public class SuperSmash extends SoloGame
return;
for (Player player : GetPlayers(true))
_lives.put(player, 5);
_lives.put(player, 4);
}
@EventHandler
@ -134,11 +135,11 @@ public class SuperSmash extends SoloGame
int lives = GetLives(player);
String out;
if (lives >= 4) out = lives + " " + C.cGreen + player.getName();
else if (lives == 3) out = lives + " " + C.cYellow + player.getName();
else if (lives == 2) out = lives + " " + C.cGold + player.getName();
else if (lives == 1) out = lives + " " + C.cRed + player.getName();
else if (lives == 0) out = lives + " " + C.cRed + player.getName();
if (lives >= 4) out = C.cGreen + player.getName();
else if (lives == 3) out = C.cYellow + player.getName();
else if (lives == 2) out = C.cGold + player.getName();
else if (lives == 1) out = C.cRed + player.getName();
else if (lives == 0) out = C.cRed + player.getName();
else
continue;
@ -157,8 +158,11 @@ public class SuperSmash extends SoloGame
if (event.GetDamageePlayer() != null)
event.AddKnockback("Smash Knockback", 1 + 0.1 * (20 - event.GetDamageePlayer().getHealth()));
if (event.GetCause() == DamageCause.VOID)
event.AddMod("Smash Void", "Void Kill", 5000, false);
if (event.GetCause() == DamageCause.VOID || event.GetCause() == DamageCause.LAVA)
{
event.GetDamageeEntity().getWorld().strikeLightningEffect(event.GetDamageeEntity().getLocation());
event.AddMod("Smash", "Super Smash Mobs", 5000, false);
}
}
@EventHandler
@ -179,4 +183,10 @@ public class SuperSmash extends SoloGame
if (event.getRegainReason() == RegainReason.SATIATED)
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.MONITOR)
public void EntityDeath(EntityDeathEvent event)
{
event.getDrops().clear();
}
}

View File

@ -3,10 +3,13 @@ package nautilus.game.arcade.game.standalone.smash.kits;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.common.util.C;
import mineplex.core.disguise.disguises.DisguiseBlaze;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
@ -14,7 +17,8 @@ import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.PerkDamageSet;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
import nautilus.game.arcade.kit.perks.PerkFirefly;
import nautilus.game.arcade.kit.perks.PerkFlamingSword;
import nautilus.game.arcade.kit.perks.PerkInferno;
import nautilus.game.arcade.kit.perks.PerkKnockbackFire;
import nautilus.game.arcade.kit.perks.PerkKnockbackMultiplier;
import nautilus.game.arcade.kit.perks.PerkSpeed;
@ -31,10 +35,11 @@ public class KitBlaze extends SmashKit
new Perk[]
{
new PerkDoubleJump("Double Jump", 1, 1, false),
new PerkDamageSet(6),
new PerkDamageSet(7),
new PerkKnockbackMultiplier(1.50),
new PerkKnockbackFire(1.50),
new PerkSpeed(1),
new PerkFlamingSword(),
new PerkInferno(),
new PerkFirefly(12000)
},
EntityType.BLAZE,
@ -59,4 +64,23 @@ public class KitBlaze extends SmashKit
disguise.SetCustomNameVisible(true);
Manager.GetDisguise().Disguise(disguise);
}
@EventHandler
public void FireItemResist(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
if (Manager.GetGame() == null)
return;
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (!HasKit(player))
continue;
Manager.GetCondition().Factory().FireItemImmunity(GetName(), player, player, 1.9, false);
}
}
}

View File

@ -31,7 +31,7 @@ public class KitChicken extends SmashKit
{
new PerkFlap(0.8, 0.8, false),
new PerkDamageSet(4),
new PerkKnockbackMultiplier(1.75),
new PerkKnockbackMultiplier(2.0),
new PerkEggGun(),
new PerkChickenRocket()

View File

@ -39,7 +39,7 @@ public class KitEnderman extends SmashKit
{
new PerkDoubleJump("Double Jump", 0.8, 0.8, false),
new PerkDamageSet(7),
new PerkKnockbackMultiplier(1.25),
new PerkKnockbackMultiplier(1.3),
new PerkBlink("Blink", 12, 6000),
new PerkBlockToss()
},

View File

@ -26,8 +26,8 @@ public class KitGolem extends SmashKit
new Perk[]
{
new PerkDoubleJump("Double Jump", 0.8, 0.8, false),
new PerkDamageSet(6),
new PerkMammoth(),
new PerkDamageSet(7),
new PerkKnockbackMultiplier(1),
new PerkSlow(0),
new PerkIronSkin(1),
new PerkSeismicSlam(),

View File

@ -12,7 +12,7 @@ import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.PerkBarrage;
import nautilus.game.arcade.kit.perks.PerkBoneExplosion;
import nautilus.game.arcade.kit.perks.PerkDamageSet;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
import nautilus.game.arcade.kit.perks.PerkFletcher;
@ -34,11 +34,12 @@ public class KitSkeleton extends SmashKit
{
new PerkDoubleJump("Double Jump", 0.8, 0.8, false),
new PerkDamageSet(5),
new PerkKnockbackMultiplier(1.1),
new PerkKnockbackMultiplier(1.25),
new PerkFletcher(1, 2, false),
new PerkKnockbackArrow(2),
new PerkBoneExplosion(),
new PerkRopedArrow("Roped Arrow", 1, 4000),
new PerkBarrage(5, 250, true),
//new PerkBarrage(5, 250, true),
},
EntityType.SKELETON,
new ItemStack(Material.BOW));
@ -47,7 +48,7 @@ public class KitSkeleton extends SmashKit
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "???"));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Bone Explosion"));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW, (byte)0, 1, C.cYellow + C.Bold + "Left-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Roped Arrow"));
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET));

View File

@ -13,7 +13,9 @@ import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.PerkDamageSet;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
import nautilus.game.arcade.kit.perks.PerkJump;
import nautilus.game.arcade.kit.perks.PerkKnockbackMultiplier;
import nautilus.game.arcade.kit.perks.PerkSlimeRocket;
import nautilus.game.arcade.kit.perks.PerkSlimeSlam;
public class KitSlime extends SmashKit
@ -28,10 +30,12 @@ public class KitSlime extends SmashKit
new Perk[]
{
new PerkDoubleJump("Double Jump", 1.2, 1, false),
new PerkDamageSet(7),
new PerkKnockbackMultiplier(1.4),
new PerkDoubleJump("Double Jump", 1, 0.9, false),
new PerkDamageSet(6),
new PerkKnockbackMultiplier(1.75),
new PerkJump(1),
new PerkSlimeSlam(),
new PerkSlimeRocket(),
},
EntityType.SLIME,
null);
@ -40,8 +44,8 @@ public class KitSlime extends SmashKit
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, C.cYellow + C.Bold + "Hold/Release Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "???"));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "???"));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, C.cYellow + C.Bold + "Hold/Release Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Slime Rocket"));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Slime Slam"));
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE));

View File

@ -17,6 +17,7 @@ import nautilus.game.arcade.kit.perks.PerkDamageSet;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
import nautilus.game.arcade.kit.perks.PerkIcePath;
import nautilus.game.arcade.kit.perks.PerkKnockbackMultiplier;
import nautilus.game.arcade.kit.perks.PerkKnockbackSnow;
public class KitSnowman extends SmashKit
{
@ -32,7 +33,8 @@ public class KitSnowman extends SmashKit
{
new PerkDoubleJump("Double Jump", 0.8, 0.8, false),
new PerkDamageSet(6),
new PerkKnockbackMultiplier(1.2),
new PerkKnockbackMultiplier(1.4),
new PerkKnockbackSnow(1.5),
new PerkArcticAura(),
new PerkBlizzard(),
new PerkIcePath(),

View File

@ -29,7 +29,7 @@ public class KitSpider extends SmashKit
{
new PerkDoubleJump("Double Jump", 0.8, 0.8, false),
new PerkDamageSet(7),
new PerkKnockbackMultiplier(1.25),
new PerkKnockbackMultiplier(1.6),
},
EntityType.SPIDER,
null);

View File

@ -1,8 +1,8 @@
package nautilus.game.arcade.game.standalone.zombiesurvival.kits;
import org.bukkit.Material;
import org.bukkit.entity.Creature;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@ -46,8 +46,8 @@ public class KitSurvivorArcher extends Kit
}
@Override
public void SpawnCustom(Creature ent)
{
public void SpawnCustom(LivingEntity ent)
{
ent.getEquipment().setHelmet(new ItemStack(Material.CHAINMAIL_HELMET));
ent.getEquipment().setChestplate(new ItemStack(Material.CHAINMAIL_CHESTPLATE));
ent.getEquipment().setLeggings(new ItemStack(Material.CHAINMAIL_LEGGINGS));

View File

@ -1,8 +1,8 @@
package nautilus.game.arcade.game.standalone.zombiesurvival.kits;
import org.bukkit.Material;
import org.bukkit.entity.Creature;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@ -45,7 +45,7 @@ public class KitSurvivorKnight extends Kit
}
@Override
public void SpawnCustom(Creature ent)
public void SpawnCustom(LivingEntity ent)
{
ent.getEquipment().setHelmet(new ItemStack(Material.IRON_HELMET));
ent.getEquipment().setChestplate(new ItemStack(Material.IRON_CHESTPLATE));

View File

@ -1,8 +1,8 @@
package nautilus.game.arcade.game.standalone.zombiesurvival.kits;
import org.bukkit.Material;
import org.bukkit.entity.Creature;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@ -26,7 +26,7 @@ public class KitSurvivorRogue extends Kit
new Perk[]
{
new PerkLeaper("Leap", 1, 1, 8000),
new PerkLeap("Leap", 1, 1, 8000),
new PerkSpeed(0)
},
EntityType.ZOMBIE,
@ -45,7 +45,7 @@ public class KitSurvivorRogue extends Kit
}
@Override
public void SpawnCustom(Creature ent)
public void SpawnCustom(LivingEntity ent)
{
ent.getEquipment().setHelmet(new ItemStack(Material.LEATHER_HELMET));
ent.getEquipment().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE));

View File

@ -1,8 +1,8 @@
package nautilus.game.arcade.game.standalone.zombiesurvival.kits;
import org.bukkit.Material;
import org.bukkit.entity.Creature;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Skeleton.SkeletonType;
@ -29,7 +29,7 @@ public class KitUndeadAlpha extends Kit
new Perk[]
{
new PerkLeaper("Leap", 1, 1, 8000),
new PerkLeap("Leap", 1, 1, 8000),
new PerkStrength(2),
new PerkIronSkin(2),
new PerkRegeneration(1)
@ -52,7 +52,7 @@ public class KitUndeadAlpha extends Kit
}
@Override
public void SpawnCustom(Creature ent)
public void SpawnCustom(LivingEntity ent)
{
if (ent instanceof Skeleton)
{

View File

@ -26,7 +26,7 @@ public class KitUndeadZombie extends Kit
new Perk[]
{
new PerkLeaper("Leap", 1, 1, 8000),
new PerkLeap("Leap", 1, 1, 8000),
new PerkStrength(1),
new PerkIronSkin(1),
new PerkRegeneration(0)

View File

@ -11,6 +11,7 @@ import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.entity.Creature;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
@ -95,13 +96,13 @@ public abstract class Kit implements Listener
public abstract void GiveItems(Player player);
public Creature SpawnEntity(Location loc)
public LivingEntity SpawnEntity(Location loc)
{
EntityType type = _entityType;
if (type == EntityType.PLAYER)
type = EntityType.ZOMBIE;
Creature ent = (Creature)Manager.GetCreature().SpawnEntity(loc, type);
LivingEntity ent = (LivingEntity)Manager.GetCreature().SpawnEntity(loc, type);
ent.setRemoveWhenFarAway(false);
ent.setCustomName(GetAvailability().GetColor() + GetName() + " Kit" + (GetAvailability() == KitAvailability.Blue ? ChatColor.GRAY + " (" + ChatColor.WHITE + "Ultra" + ChatColor.GRAY + ")" : ""));
ent.setCustomNameVisible(true);
@ -114,7 +115,7 @@ public abstract class Kit implements Listener
return ent;
}
public void SpawnCustom(Creature ent) { }
public void SpawnCustom(LivingEntity ent) { }
public void DisplayDesc(Player player)
{

View File

@ -41,7 +41,7 @@ public class PerkBarrage extends Perk
{
super("Barrage", new String[]
{
C.cYellow + "Charge" + C.cGray + " your bow to use " + C.cGreen + "Barrage"
C.cYellow + "Charge" + C.cGray + " your Bow to use " + C.cGreen + "Barrage"
});
_max = max;

View File

@ -44,7 +44,7 @@ public class PerkBlizzard extends Perk
if (!Kit.HasKit(player))
continue;
player.setExp((float) Math.min(0.999, player.getExp()+0.015));
player.setExp((float) Math.min(0.999, player.getExp()+0.01));
}
}

View File

@ -82,6 +82,9 @@ public class PerkBomber extends Perk
@EventHandler
public void TNTDrop(PlayerDropItemEvent event)
{
if (event.isCancelled())
return;
if (!UtilInv.IsItem(event.getItemDrop().getItemStack(), Material.TNT, (byte)0))
return;

View File

@ -0,0 +1,76 @@
package nautilus.game.arcade.kit.perks;
import java.util.HashMap;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.kit.Perk;
public class PerkBoneExplosion extends Perk
{
public PerkBoneExplosion()
{
super("Bone Explosion", new String[]
{
C.cYellow + "Right-Click" + C.cGray + " with Axe to " + C.cGreen + "Bone Explosion"
});
}
@EventHandler
public void Leap(PlayerInteractEvent event)
{
if (event.isCancelled())
return;
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
return;
if (UtilBlock.usable(event.getClickedBlock()))
return;
if (event.getPlayer().getItemInHand() == null)
return;
if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE"))
return;
Player player = event.getPlayer();
if (!Kit.HasKit(player))
return;
if (!Recharge.Instance.use(player, GetName(), 10000, true))
return;
HashMap<Player, Double> nearby = UtilPlayer.getInRadius(player.getLocation(), 8);
for (Player other : nearby.keySet())
{
if (player.equals(other))
continue;
//Inform
UtilPlayer.message(player, F.main("Game", F.elem(Manager.GetColor(player) + player.getName()) + " used " + F.skill(GetName()) + "."));
//Velocity
UtilAction.velocity(other, UtilAlg.getTrajectory(player, other), 0.4 + 1.2 * nearby.get(other), false, 0, 0.2 + 0.6 * nearby.get(other), 1.2, true);
}
//Inform
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
//Effect
Manager.GetBlood().Effects(player.getLocation().add(0, 0.5, 0), 48, 0.8, Sound.SKELETON_HURT, 2f, 1.2f, Material.BONE, (byte)0, 40, false);
}
}

View File

@ -16,6 +16,7 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
@ -78,6 +79,9 @@ public class PerkChickenRocket extends Perk
Manager.GetGame().CreatureAllowOverride = false;
_data.add(new ChickenMissileData(player, ent));
//Inform
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
}
@EventHandler

View File

@ -88,7 +88,11 @@ public class PerkEggGun extends Perk
continue;
}
Egg egg = cur.getWorld().spawn(cur.getLocation().add(0, 0.5, 0).add(cur.getLocation().getDirection()), Egg.class);
Vector offset = cur.getLocation().getDirection();
if (offset.getY() < 0)
offset.setY(0);
Egg egg = cur.getWorld().spawn(cur.getLocation().add(0, 0.5, 0).add(offset), Egg.class);
egg.setVelocity(cur.getLocation().getDirection().add(new Vector(0,0.2,0)));
egg.setShooter(cur);

View File

@ -176,13 +176,13 @@ public class PerkFirefly extends Perk
if (!data.Player.equals(event.GetDamageeEntity()))
continue;
if (UtilTime.elapsed(data.Time, 1000) || event.GetCause() == DamageCause.ENTITY_ATTACK)
if (!UtilTime.elapsed(data.Time, 1000) && event.GetCause() == DamageCause.PROJECTILE)
{
event.SetCancelled("Firefly Immunity");
dataIterator.remove();
}
else
{
dataIterator.remove();
event.SetCancelled("Firefly Immunity");
}
}
}

View File

@ -16,7 +16,6 @@ import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
@ -71,7 +70,7 @@ public class PerkFlamingSword extends Perk
if (UtilBlock.usable(event.getClickedBlock()))
return;
if (!UtilGear.isMat(event.getPlayer().getItemInHand(), Material.GOLD_SWORD))
if (!event.getPlayer().getItemInHand().getType().toString().contains("_SWORD"))
return;
Player player = event.getPlayer();

View File

@ -103,6 +103,9 @@ public class PerkFletcher extends Perk
@EventHandler
public void FletchDrop(PlayerDropItemEvent event)
{
if (event.isCancelled())
return;
if (!UtilInv.IsItem(event.getItemDrop().getItemStack(), Material.ARROW, (byte)1))
return;

View File

@ -12,7 +12,9 @@ import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
@ -54,13 +56,16 @@ public class PerkIcePath extends Perk
if (!Kit.HasKit(player))
return;
if (!Recharge.Instance.use(player, GetName(), 1000, true))
if (!Recharge.Instance.use(player, GetName(), 10000, true))
return;
player.setVelocity(new Vector(0,0,0));
player.teleport(player.getLocation().add(0, 0.5, 0));
_data.add(new IcePathData(player));
//Inform
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
}
@EventHandler

View File

@ -0,0 +1,105 @@
package nautilus.game.arcade.kit.perks;
import java.util.HashMap;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.kit.Perk;
public class PerkInferno extends Perk
{
private HashMap<Player, Long> _active = new HashMap<Player, Long>();
public PerkInferno()
{
super("Inferno", new String[]
{
C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Inferno"
});
}
@EventHandler
public void Activate(PlayerInteractEvent event)
{
if (event.isCancelled())
return;
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
return;
if (UtilBlock.usable(event.getClickedBlock()))
return;
if (!event.getPlayer().getItemInHand().getType().toString().contains("_SWORD"))
return;
Player player = event.getPlayer();
if (!Kit.HasKit(player))
return;
if (!Recharge.Instance.use(player, "Inferno", 4000, true))
return;
_active.put(player, System.currentTimeMillis());
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill("Inferno") + "."));
}
@EventHandler
public void Update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player cur : UtilServer.getPlayers())
{
if (!_active.containsKey(cur))
continue;
if (!cur.isBlocking())
{
_active.remove(cur);
continue;
}
if (UtilTime.elapsed(_active.get(cur), 1500))
{
_active.remove(cur);
continue;
}
//Fire
Item fire = cur.getWorld().dropItem(cur.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.FIRE));
Manager.GetFire().Add(fire, cur, 0.7, 0, 0.5, 1, "Inferno");
fire.teleport(cur.getEyeLocation());
double x = 0.07 - (UtilMath.r(14)/100d);
double y = 0.07 - (UtilMath.r(14)/100d);
double z = 0.07 - (UtilMath.r(14)/100d);
fire.setVelocity(cur.getLocation().getDirection().add(new Vector(x,y,z)).multiply(1.6));
//Effect
cur.getWorld().playSound(cur.getLocation(), Sound.GHAST_FIREBALL, 0.1f, 1f);
}
}
}

View File

@ -0,0 +1,42 @@
package nautilus.game.arcade.kit.perks;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.common.util.C;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import nautilus.game.arcade.kit.Perk;
public class PerkJump extends Perk
{
private int _level;
public PerkJump(int level)
{
super("Jump", new String[]
{
C.cGray + "Permanent Jump Boost " + (level+1),
});
_level = level;
}
@EventHandler
public void DigSpeed(UpdateEvent event)
{
if (event.getType() != UpdateType.SLOW)
return;
if (Manager.GetGame() == null)
return;
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (!Kit.HasKit(player))
continue;
Manager.GetCondition().Factory().Jump(GetName(), player, player, 8, _level, false, false, false);
}
}
}

View File

@ -0,0 +1,42 @@
package nautilus.game.arcade.kit.perks;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.common.util.C;
import nautilus.game.arcade.kit.Perk;
public class PerkKnockbackFire extends Perk
{
private double _power;
public PerkKnockbackFire(double power)
{
super("Flaming Knockback", new String[]
{
C.cGray + "You deal " + (int)(power*100) + "% Knockback to burning enemies.",
});
_power = power;
}
@EventHandler(priority = EventPriority.HIGH)
public void Knockback(CustomDamageEvent event)
{
if (event.GetDamageeEntity().getFireTicks() <= 0)
return;
Player damager = event.GetDamagerPlayer(true);
if (damager == null) return;
if (!Kit.HasKit(damager))
return;
if (!Manager.IsAlive(damager))
return;
event.AddKnockback("Knockback Fire", _power);
}
}

View File

@ -0,0 +1,42 @@
package nautilus.game.arcade.kit.perks;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.common.util.C;
import nautilus.game.arcade.kit.Perk;
public class PerkKnockbackSnow extends Perk
{
private double _power;
public PerkKnockbackSnow(double power)
{
super("Frosty Knockback", new String[]
{
C.cGray + "You deal " + (int)(power*100) + "% Knockback to enemies on snow.",
});
_power = power;
}
@EventHandler(priority = EventPriority.HIGH)
public void Knockback(CustomDamageEvent event)
{
if (event.GetDamageeEntity().getLocation().getBlock().getTypeId() != 78)
return;
Player damager = event.GetDamagerPlayer(true);
if (damager == null) return;
if (!Kit.HasKit(damager))
return;
if (!Manager.IsAlive(damager))
return;
event.AddKnockback("Knockback Snow", _power);
}
}

View File

@ -1,75 +0,0 @@
package nautilus.game.arcade.kit.perks;
import org.bukkit.Effect;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.event.PerkLeapEvent;
public class PerkLeaper extends Perk
{
private String _name;
private double _power;
private double _heightMax;
private long _recharge;
public PerkLeaper(String name, double power, double heightLimit, long recharge)
{
super("Leaper", new String[]
{
C.cYellow + "Right-Click" + C.cGray + " with Axes to " + C.cGreen + name
});
_name = name;
_power = power;
_heightMax = heightLimit;
_recharge = recharge;
}
@EventHandler
public void Leap(PlayerInteractEvent event)
{
if (event.isCancelled())
return;
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
return;
if (UtilBlock.usable(event.getClickedBlock()))
return;
if (event.getPlayer().getItemInHand() == null)
return;
if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE"))
return;
Player player = event.getPlayer();
if (!Kit.HasKit(player))
return;
if (!Recharge.Instance.use(player, _name, _recharge, true))
return;
UtilAction.velocity(player, _power, 0.2, _heightMax, true);
player.setFallDistance(0);
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(_name) + "."));
player.getWorld().playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 0);
PerkLeapEvent leapEvent = new PerkLeapEvent(player);
UtilServer.getServer().getPluginManager().callEvent(leapEvent);
}
}

View File

@ -0,0 +1,326 @@
package nautilus.game.arcade.kit.perks;
import java.util.HashMap;
import java.util.Iterator;
import org.bukkit.block.Block;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Slime;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.Perk;
public class PerkSlimeRocket extends Perk implements IThrown
{
private HashMap<Player, Slime> _active = new HashMap<Player, Slime>();
private HashMap<Slime, Player> _owner = new HashMap<Slime, Player>();
private HashMap<Slime, Long> _lastAttack = new HashMap<Slime, Long>();
public PerkSlimeRocket()
{
super("Slime Rocket", new String[]
{
C.cYellow + "Hold/Release Block" + C.cGray + " to use " + C.cGreen + "Slime Rocket"
});
}
@EventHandler
public void EnergyUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (!Kit.HasKit(player))
continue;
if (player.isBlocking())
return;
player.setExp((float) Math.min(0.999, player.getExp()+0.003));
}
}
@EventHandler
public void Activate(PlayerInteractEvent event)
{
if (event.isCancelled())
return;
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
return;
if (UtilBlock.usable(event.getClickedBlock()))
return;
if (!event.getPlayer().getItemInHand().getType().toString().contains("_SWORD"))
return;
Player player = event.getPlayer();
if (!Kit.HasKit(player))
return;
if (!Recharge.Instance.use(player, GetName(), 4000, true))
return;
//Spawn Slime
Manager.GetGame().CreatureAllowOverride = true;
Slime slime = player.getWorld().spawn(player.getEyeLocation(), Slime.class);
slime.setSize(1);
slime.setCustomNameVisible(true);
UtilEnt.Vegetate(slime);
Manager.GetGame().CreatureAllowOverride = false;
player.setPassenger(slime);
_active.put(player, slime);
_owner.put(slime, player);
UtilPlayer.message(player, F.main("Skill", "You are charging " + F.skill(GetName()) + "."));
}
@EventHandler
public void ChargeRelease(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
Iterator<Player> chargeIterator = _active.keySet().iterator();
while (chargeIterator.hasNext())
{
Player player = chargeIterator.next();
Slime slime = _active.get(player);
//Invalid
if (!slime.isValid())
{
slime.remove();
FireRocket(player);
chargeIterator.remove();
}
//Charge
if (player.isBlocking())
{
//Energy Depleted
if (player.getExp() < 0.1)
{
FireRocket(player);
chargeIterator.remove();
}
else
{
if (slime.getTicksLived() > 60)
{
if (slime.getTicksLived() > 100)
{
FireRocket(player);
chargeIterator.remove();
}
}
else
{
player.setExp((float) Math.max(0, player.getExp()-0.01f));
//Size
slime.setSize((int) (1.25 + slime.getTicksLived()/25d));
slime.setMaxHealth(5 + slime.getTicksLived()/3);
slime.setHealth(slime.getMaxHealth());
//NameTag
String out = C.cRed;
if (slime.getSize() == 1) out = C.cGold;
else if (slime.getSize() == 2) out = C.cYellow;
else if (slime.getSize() == 3) out = C.cGreen;
for (int i=0 ; i < slime.getTicksLived()/4 ; i++)
{
out += "|";
}
slime.setCustomName(out);
}
}
}
//Release
else
{
FireRocket(player);
chargeIterator.remove();
}
}
}
public void FireRocket(Player player)
{
double charge = Math.min(3, _active.get(player).getTicksLived()/20d);
if (_active.get(player) == null || !_active.get(player).isValid())
{
//Inform
UtilPlayer.message(player, F.main("Skill", "You failed " + F.skill(GetName()) + "."));
return;
}
Slime slime = _active.get(player);
slime.setCustomName(null);
slime.setCustomNameVisible(false);
//Inform
UtilPlayer.message(player, F.main("Skill", "You released " + F.skill(GetName()) + "."));
slime.leaveVehicle();
player.eject();
UtilAction.velocity(slime, player.getLocation().getDirection(), 1 + charge/2d, false, 0, 0.2, 10, true);
Manager.GetProjectile().AddThrow(slime, player, this, -1, true, true, true,
null, 0, 0, null, 0, UpdateType.FASTEST, 2d);
}
@EventHandler
public void SlimeTarget(EntityTargetEvent event)
{
if (event.isCancelled())
return;
if (!_owner.containsKey(event.getEntity()))
return;
if (_owner.get(event.getEntity()).equals(event.getTarget()))
{
event.setCancelled(true);
}
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
if (target == null)
return;
if (!(data.GetThrown() instanceof Slime))
return;
Slime slime = (Slime)data.GetThrown();
//Damage Event
Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null,
DamageCause.PROJECTILE, slime.getSize() * 4, true, true, false,
UtilEnt.getName(data.GetThrower()), GetName());
}
@EventHandler
public void Knockback(CustomDamageEvent event)
{
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
return;
event.AddKnockback(GetName(), 1.5);
}
@Override
public void Idle(ProjectileUser data)
{
}
@Override
public void Expire(ProjectileUser data)
{
}
@EventHandler
public void SlimeDamage(CustomDamageEvent event)
{
if (!(event.GetDamagerEntity(false) instanceof Slime))
return;
Slime slime = (Slime)event.GetDamagerEntity(false);
//Attack Rate
if (_lastAttack.containsKey(slime) && !UtilTime.elapsed(_lastAttack.get(slime), 500))
{
event.SetCancelled("Slime Attack Rate");
return;
}
_lastAttack.put(slime, System.currentTimeMillis());
//Get Owner
Player owner = _owner.get(slime);
//if (owner != null)
// event.SetDamager(owner); This gives knockback from wrong direction :(
if (owner != null && owner.equals(event.GetDamageeEntity()))
{
event.SetCancelled("Owner Damage");
//Heal Owner
if (slime.getVehicle() == null)
{
UtilPlayer.health(owner, 1);
}
}
else
{
event.AddMod("Slime Damage", "Negate", -event.GetDamageInitial(), false);
event.AddMod("Slime Damage", "Attack", 2 * slime.getSize(), true);
event.AddKnockback("Slime Knockback", 2);
}
}
@EventHandler
public void SlimeClean(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
return;
Iterator<Slime> slimeIterator = _owner.keySet().iterator();
while (slimeIterator.hasNext())
{
Slime slime = slimeIterator.next();
if (!slime.isValid())
slimeIterator.remove();
}
slimeIterator = _lastAttack.keySet().iterator();
while (slimeIterator.hasNext())
{
Slime slime = slimeIterator.next();
if (!slime.isValid())
slimeIterator.remove();
}
}
}

View File

@ -14,7 +14,7 @@ public class PerkSlow extends Perk
public PerkSlow(int level)
{
super("Speed", new String[]
super("Slow", new String[]
{
C.cGray + "Permanent Slow " + (level+1),
});

View File

@ -21,6 +21,7 @@ import org.bukkit.block.BlockFace;
import org.bukkit.entity.Creature;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Sheep;
import org.bukkit.event.EventHandler;
@ -80,10 +81,10 @@ public class GameLobbyManager implements IPacketRunnable, Listener
private Location spawn;
private HashMap<Creature, LobbyEnt> _kits = new HashMap<Creature, LobbyEnt>();
private HashMap<LivingEntity, LobbyEnt> _kits = new HashMap<LivingEntity, LobbyEnt>();
private HashMap<Block, Material> _kitBlocks = new HashMap<Block, Material>();
private HashMap<Creature, LobbyEnt> _teams = new HashMap<Creature, LobbyEnt>();
private HashMap<LivingEntity, LobbyEnt> _teams = new HashMap<LivingEntity, LobbyEnt>();
private HashMap<Block, Material> _teamBlocks = new HashMap<Block, Material>();
private long _fireworkStart;
@ -376,7 +377,7 @@ public class GameLobbyManager implements IPacketRunnable, Listener
entLoc.getChunk().load();
Creature ent = kit.SpawnEntity(entLoc);
LivingEntity ent = kit.SpawnEntity(entLoc);
if (ent == null)
continue;

View File

@ -94,7 +94,7 @@ public class MiscManager implements Listener
{
if (Manager.GetGame() == null)
return;
if (!Manager.GetGame().IsLive())
return;
@ -106,7 +106,7 @@ public class MiscManager implements Listener
if (Manager.IsAlive(player))
continue;
UtilPlayer.message(player, C.cYellow + C.Bold + "You are out of the game, but " + C.cGold + C.Bold + "DON'T QUIT" + C.cYellow + C.Bold + "!");
UtilPlayer.message(player, C.cYellow + C.Bold + "You are out of the game, but " + C.cRed + C.Bold + "DON'T QUIT" + C.cYellow + C.Bold + "!");
UtilPlayer.message(player, C.cYellow + C.Bold + "The next game will be starting soon...");
}
}