Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex

This commit is contained in:
Jonathan Williams 2014-11-19 22:25:17 -08:00
commit ab78b4b89d
43 changed files with 1247 additions and 158 deletions

View File

@ -4,7 +4,9 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.Location;
@ -59,6 +61,11 @@ public class UtilPlayer
return null;
}
public static Player searchExact(UUID uuid)
{
return UtilServer.getServer().getPlayer(uuid);
}
public static String searchCollection(Player caller, String player, Collection<String> coll, String collName, boolean inform)
{
LinkedList<String> matchList = new LinkedList<String>();

View File

@ -67,5 +67,5 @@ public class UtilTextBottom
display((prefix == null ? "" : prefix + ChatColor.RESET + " ") + progressBar + (suffix == null ? "" : ChatColor.RESET + " " + suffix), players);
}
}
}
}
}

View File

@ -519,7 +519,7 @@ public enum Achievement
MICRO_BATTLE_ANNIHILATION("Annihilation", 1200,
new String[]{"Micro Battle.Annihilation"},
new String[]{"Kill 12 players in one game"},
new String[]{"Kill 9 players in one game"},
new int[]{1},
AchievementCategory.MICRO_BATTLE),

View File

@ -6,8 +6,10 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.UUID;
import mineplex.core.MiniPlugin;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.blockrestore.BlockRestore;
@ -23,12 +25,15 @@ import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.ExplosionPrimeEvent;
import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
@ -84,8 +89,19 @@ public class Explosion extends MiniPlugin
if (event.blockList().isEmpty())
return;
// This metadata is used to identify the owner of the explosion for use in other plugins
Player owner = null;
Entity entity = event.getEntity();
if (entity.hasMetadata("owner"))
{
FixedMetadataValue ownerData = (FixedMetadataValue) entity.getMetadata("owner").get(0);
UUID ownerUUID = (UUID) ownerData.value();
owner = UtilPlayer.searchExact(ownerUUID);
}
//Event for Block awareness
ExplosionEvent explodeEvent = new ExplosionEvent(event.blockList());
ExplosionEvent explodeEvent = new ExplosionEvent(event.blockList(), owner);
_plugin.getServer().getPluginManager().callEvent(explodeEvent);
event.setYield(0f);

View File

@ -3,6 +3,7 @@ package mineplex.core.explosion;
import java.util.Collection;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
@ -10,11 +11,18 @@ public class ExplosionEvent extends Event
{
private static final HandlerList handlers = new HandlerList();
private Player _owner;
private Collection<Block> _blocks;
public ExplosionEvent(Collection<Block> blocks)
{
this(blocks, null);
}
public ExplosionEvent(Collection<Block> blocks, Player owner)
{
_blocks = blocks;
_owner = owner;
}
public HandlerList getHandlers()
@ -31,4 +39,14 @@ public class ExplosionEvent extends Event
{
return _blocks;
}
public Player getOwner()
{
return _owner;
}
public void setOwner(Player owner)
{
_owner = owner;
}
}

View File

@ -857,9 +857,12 @@ public class ItemStackFactory extends MiniPlugin
stack.setItemMeta(itemMeta);
//Unbreakable
ItemMeta meta = stack.getItemMeta();
meta.spigot().setUnbreakable(true);
stack.setItemMeta(meta);
if (stack.getType().getMaxDurability() > 1)
{
ItemMeta meta = stack.getItemMeta();
meta.spigot().setUnbreakable(true);
stack.setItemMeta(meta);
}
return stack;
}

View File

@ -7,11 +7,15 @@ import net.minecraft.util.com.mojang.authlib.GameProfile;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.inventory.ItemStack;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
@ -19,12 +23,14 @@ import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
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.UtilEnt;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilWorld;
import mineplex.core.disguise.disguises.DisguisePlayer;
import mineplex.minecraft.game.classcombat.Skill.SkillActive;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
@ -51,14 +57,17 @@ public class Illusion extends SkillActive
SetDesc(new String[]
{
"Block to go invisible, and create an",
"Hold Block to go invisible and create an",
"illusion of yourself that runs towards",
"your target location.",
"",
"Invisibility ends if you release Block",
"or your Illusion is killed.",
"",
"Lasts up to #2#2 seconds.",
"Illusion lasts up to #2#2 seconds.",
"",
"Gives Slow 2 for up to 4 seconds",
"to nearby players upon ending."
});
}
@ -100,7 +109,7 @@ public class Illusion extends SkillActive
skel.getEquipment().setLeggings(player.getInventory().getLeggings());
skel.getEquipment().setBoots(player.getInventory().getBoots());
skel.getEquipment().setItemInHand(Math.random() > 0.5 ? player.getItemInHand() : new ItemStack(Material.IRON_AXE));
//Disguise
DisguisePlayer disguise = new DisguisePlayer(skel, ((CraftPlayer)player).getHandle().getProfile());
Factory.Disguise().disguise(disguise);
@ -115,7 +124,7 @@ public class Illusion extends SkillActive
}
@EventHandler
public void Energy(UpdateEvent event)
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
@ -150,7 +159,7 @@ public class Illusion extends SkillActive
}
}
@EventHandler
@EventHandler(priority = EventPriority.HIGHEST)
public void illusionDeath(EntityDeathEvent event)
{
if (_active.containsValue(event.getEntity()))
@ -159,21 +168,36 @@ public class Illusion extends SkillActive
event.getEntity().remove();
}
}
private void end(Player cur)
private void end(Player player)
{
Factory.Condition().EndCondition(cur, null, GetName());
Factory.Condition().EndCondition(player, null, GetName());
Skeleton skel = _active.remove(cur);
Skeleton skel = _active.remove(player);
if (skel == null)
return;
//Ploop
//Level
int level = getLevel(player);
//Blind
HashMap<LivingEntity, Double> targets = UtilEnt.getInRadius(skel.getLocation(), 6d + 0.5 * level);
for (LivingEntity cur : targets.keySet())
{
if (cur.equals(player))
continue;
//Condition
Factory.Condition().Factory().Slow(GetName(), cur, player, 4 * targets.get(cur), 1, false, false, false, false);
}
//Effect
UtilParticle.PlayParticle(ParticleType.LARGE_SMOKE, skel.getLocation().add(0, 1, 0), 0.3f, 0.3f, 0.3f, 0.06f, 30);
for (int i=0 ; i<2 ; i++)
skel.getWorld().playSound(skel.getLocation(), Sound.FIZZ, 2f, 0.4f);
skel.getEquipment().clear();
skel.remove();
}

View File

@ -53,7 +53,7 @@ public class CripplingBlow extends Skill
if (level == 0) return;
//Stun
Factory.Condition().Factory().Slow(GetName(), damagee, damager, 0.5 + 0.5 * 1, 1, false, true, false, true);
Factory.Condition().Factory().Slow(GetName(), damagee, damager, 0.5 + 0.5 * 1, 0, false, true, false, true);
//Damage
event.AddMod(damager.getName(), GetName(), 0, true);

View File

@ -37,4 +37,6 @@ public interface ISkill
Integer GetSalesPackageId();
int getMaxLevel();
boolean isAchievementSkill();
}

View File

@ -0,0 +1,203 @@
package mineplex.minecraft.game.classcombat.Skill.Knight;
import java.util.HashMap;
import java.util.Iterator;
import org.bukkit.Effect;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.util.Vector;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.core.antistack.AntiStack;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.classcombat.Skill.SkillActive;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
public class AxeThrow extends SkillActive implements IThrown
{
private HashMap<Item, Player> _thrown = new HashMap<Item, Player>();
public AxeThrow(SkillFactory skills, String name, ClassType classType, SkillType skillType,
int cost, int levels,
int energy, int energyMod,
long recharge, long rechargeMod, boolean rechargeInform,
Material[] itemArray,
Action[] actionArray)
{
super(skills, name, classType, skillType,
cost, levels,
energy, energyMod,
recharge, rechargeMod, rechargeInform,
itemArray,
actionArray);
SetDesc(new String[]
{
"Throw your axe with #0.8#0.1 velocity, ",
"dealing #7.5#0.5 damage.",
"",
"You pull your axe back to you when it",
"collides with anything.",
"",
"Your axe is returned to you if you do",
"not pick it up within #20#-2 seconds."
});
}
@Override
public boolean CustomCheck(Player player, int level)
{
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9)
{
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
return false;
}
return true;
}
@Override
public void Skill(Player player, int level)
{
//Inform
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
//Throw
Item item = player.getWorld().dropItem(player.getEyeLocation(), player.getItemInHand());
UtilAction.velocity(item, player.getLocation().getDirection(), 0.8 + 0.1 * level, false, 0, 0.2, 10, true);
player.setItemInHand(null);
//Projectile
Factory.Projectile().AddThrow(item, player, this, -1, true, true, true, false, 2.5d);
//Store
_thrown.put(item, player);
//Inform
UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + "."));
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
Rebound(data.GetThrower(), data.GetThrown());
if (target == null)
return;
int level = getLevel(data.GetThrower());
if (level <= 0)
return;
double damage = 7.5 + 0.5 * level;
//Damage Event
Factory.Damage().NewDamageEvent(target, data.GetThrower(), null,
DamageCause.CUSTOM, damage, true, true, false,
UtilEnt.getName(data.GetThrower()), GetName());
}
@Override
public void Idle(ProjectileUser data)
{
Rebound(data.GetThrower(), data.GetThrown());
}
@Override
public void Expire(ProjectileUser data)
{
Rebound(data.GetThrower(), data.GetThrown());
}
public void Rebound(LivingEntity player, Entity ent)
{
ent.getWorld().playSound(ent.getLocation(), Sound.ZOMBIE_WOOD, 0.6f, 0.5f);
double mult = 0.5 + (0.6 * (UtilMath.offset(player.getLocation(), ent.getLocation())/16d));
//Velocity
ent.setVelocity(player.getLocation().toVector().subtract(ent.getLocation().toVector()).normalize().add(new Vector(0, 0.4, 0)).multiply(mult));
//Ticks
if (ent instanceof Item)
((Item)ent).setPickupDelay(5);
}
@EventHandler
public void pickup(PlayerPickupItemEvent event)
{
if (!_thrown.containsKey(event.getItem()))
return;
event.setCancelled(true);
Player player = _thrown.remove(event.getItem());
AntiStack.removeUID(event.getItem());
player.getInventory().addItem(event.getItem().getItemStack());
UtilInv.Update(event.getPlayer());
event.getItem().remove();
player.playSound(player.getLocation(), Sound.CHICKEN_EGG_POP, 1f, 1f);
}
@EventHandler
public void timeout(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
Iterator<Item> itemIterator = _thrown.keySet().iterator();
while (itemIterator.hasNext())
{
Item item = itemIterator.next();
Player player = _thrown.get(item);
if (!player.isOnline())
{
item.remove();
itemIterator.remove();
continue;
}
int level = getLevel(player);
if (item.getTicksLived() > 400 - level * 40)
{
AntiStack.removeUID(item);
_thrown.get(item).getInventory().addItem(item.getItemStack());
item.remove();
itemIterator.remove();
}
}
}
@Override
public void Reset(Player player)
{
}
}

View File

@ -9,6 +9,8 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
@ -71,13 +73,19 @@ public class Deflection extends Skill
if (!Recharge.Instance.use(cur, GetName(), 5000 - (1000 * level), false, false))
continue;
int max = 2 + (1 * level);
int charge = 1;
if (_charges.containsKey(cur))
charge += _charges.get(cur);
charge = Math.min(2 + (1 * level), charge);
_charges.put(cur, charge);
if (charge <= max)
{
_charges.put(cur, charge);
//Inform
UtilPlayer.message(cur, F.main(GetClassType().name(), "Deflection Charges: " + F.elem(charge+"")));
}
}
}

View File

@ -9,7 +9,9 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
@ -76,14 +78,20 @@ public class Swordsmanship extends Skill
if (!Recharge.Instance.use(cur, GetName(), 5000 - (1000 * level), false, false))
continue;
int max = level;
int charge = 1;
if (_charges.containsKey(cur))
charge += _charges.get(cur);
charge = Math.min(level, charge);
_charges.put(cur, charge);
if (charge <= max)
{
_charges.put(cur, charge);
//Inform
UtilPlayer.message(cur, F.main(GetClassType().name(), "Swordsmanship Charges: " + F.elem(charge+"")));
}
}
}

View File

@ -44,7 +44,7 @@ public class ArcticArmor extends Skill
"",
"Create a freezing area around you",
"in a #3#1 Block radius. Allies inside",
"this area receive Protection 1.",
"this area receive Protection 2.",
"",
"You are permanently immune to the",
"Slowing effect of snow."

View File

@ -68,7 +68,7 @@ public class Rupture extends SkillActiveCharge
"",
"Release Block to release the rupture,",
"causing earth and players to fly upward,",
"dealing up to #3#1 inital damage."
"dealing up to #4#1 inital damage."
});
}

View File

@ -0,0 +1,152 @@
package mineplex.minecraft.game.classcombat.Skill.Mage;
import java.util.HashMap;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.minecraft.game.classcombat.Skill.SkillChargeSword;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import org.bukkit.Color;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
public class StaticLazer extends SkillChargeSword
{
private NautHashMap<Player, Float> _chargeStore = new NautHashMap<Player, Float>();
public StaticLazer(SkillFactory skills, String name,
ClassType classType, SkillType skillType,
int cost, int maxLevel)
{
super(skills, name, classType, skillType, cost, maxLevel,
0.012f, 0.008f,
12000, -1000, true, true,
false, true);
SetDesc(new String[]
{
"Hold Block to charge static electricity.",
"Release Block to fire static lazer.",
"",
GetChargeString(),
"Taking damage cancels charge.",
"",
"Deals up to #7#1 damage and travels",
"up to #20#10 blocks.",
});
_fireOnFull = true;
}
@Override
public String GetRechargeString()
{
return "Recharge: " + "#12#-1 Seconds";
}
@Override
public void DoSkillCustom(Player player, float charge)
{
int level = getLevel(player);
if (level <= 0)
return;
//Action
double curRange = 0;
while (curRange <= 20 + 10 * level)
{
Location newTarget = player.getEyeLocation().add(player.getLocation().getDirection().multiply(curRange));
//Hit Player
HashMap<LivingEntity, Double> hits = UtilEnt.getInRadius(newTarget, 2);
hits.remove(player);
if (!hits.isEmpty())
break;
//Hit Block
if (!UtilBlock.airFoliage(newTarget.getBlock()))
break;
//Progress Forwards
curRange += 0.2;
//Smoke Trail
UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, newTarget, 0, 0, 0, 0, 1);
}
//Destination
Location target = player.getLocation().add(player.getLocation().getDirection().multiply(curRange));
UtilParticle.PlayParticle(ParticleType.EXPLODE, target, 0, 0, 0, 0, 1);
//Firework
UtilFirework.playFirework(player.getLocation().add(player.getLocation().getDirection().multiply(Math.max(0, curRange - 0.6))), Type.BURST, Color.WHITE, false, false);
HashMap<LivingEntity, Double> hit = UtilEnt.getInRadius(target, 6);
for (LivingEntity other : hit.keySet())
{
if (other.equals(player))
continue;
//Do from center
if (UtilMath.offset(target, other.getLocation().add(0, 1, 0)) < 3)
{
//Damage Event
Factory.Damage().NewDamageEvent(other, player, null,
DamageCause.CUSTOM, 2 + (5 + level) * hit.get(other), true, true, false,
player.getName(), GetName());
}
}
//Inform
UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(getLevel(player))) + "."));
//Effect
player.getWorld().playSound(player.getEyeLocation(), Sound.ZOMBIE_REMEDY, 0.5f + player.getExp(), 1.75f - charge);
_chargeStore.put(player, charge);
}
@EventHandler(priority = EventPriority.NORMAL)
public void damageCancelCharge(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
//Damagee
Player damagee = event.GetDamageePlayer();
if (damagee == null) return;
if (_charge.remove(damagee) == null)
return;
//Inform
UtilPlayer.message(damagee, F.main(GetClassType().name(), F.skill(GetName()) + " was interrupted."));
//Effect
damagee.getWorld().playSound(damagee.getLocation(), Sound.ZOMBIE_REMEDY, 0.5f, 3f);
}
@Override
public void Reset(Player player)
{
_charge.remove(player);
}
}

View File

@ -33,7 +33,7 @@ public class Void extends Skill
"Drop Axe/Sword to Toggle.",
"",
"While in void form, you receive",
"Slow 3, take no knockback and",
"Slow 2, take no knockback and",
"use no energy to swing weapons.",
"",
"Reduces incoming damage by #1#1 , but",

View File

@ -0,0 +1,252 @@
package mineplex.minecraft.game.classcombat.Skill.Ranger;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.ProjectileHitEvent;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.minecraft.game.classcombat.Skill.SkillActive;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
public class ExplosiveShot extends SkillActive
{
private HashSet<Arrow> _arrows = new HashSet<Arrow>();
private HashSet<Player> _active = new HashSet<Player>();
public ExplosiveShot(SkillFactory skills, String name, ClassType classType, SkillType skillType,
int cost, int levels,
int energy, int energyMod,
long recharge, long rechargeMod, boolean rechargeInform,
Material[] itemArray,
Action[] actionArray)
{
super(skills, name, classType, skillType,
cost, levels,
energy, energyMod,
recharge, rechargeMod, rechargeInform,
itemArray,
actionArray);
SetDesc(new String[]
{
"Prepare an explosive shot;",
"Your next arrow will explode on",
"impact, dealing up to 12 damage",
"and knockback. ",
" ",
"Explosion radius of #5#1",
});
}
@Override
public boolean CustomCheck(Player player, int level)
{
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9)
{
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
return false;
}
return true;
}
@Override
public void Skill(Player player, int level)
{
//Action
_active.add(player);
//Inform
UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + "."));
//Effect
player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f);
}
@EventHandler
public void BowShoot(EntityShootBowEvent event)
{
if (!(event.getEntity() instanceof Player))
return;
if (!(event.getProjectile() instanceof Arrow))
return;
Player player = (Player)event.getEntity();
if (!_active.remove(player))
return;
//Inform
UtilPlayer.message(player, F.main(GetClassType().name(), "You fired " + F.skill(GetName(getLevel(player))) + "."));
_arrows.add((Arrow)event.getProjectile());
}
@EventHandler(priority = EventPriority.HIGH)
public void hitEntityTrigger(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
if (event.GetCause() != DamageCause.PROJECTILE)
return;
Projectile projectile = event.GetProjectile();
if (projectile == null)
return;
if (!_arrows.remove(event.GetProjectile()))
return;
event.SetCancelled(GetName());
Location loc = event.GetDamageeEntity().getLocation().subtract(event.GetProjectile().getVelocity().normalize().multiply(0.1));
trigger((Arrow)event.GetProjectile(), loc);
}
@EventHandler
public void hitBlockTrigger(ProjectileHitEvent event)
{
Projectile proj = event.getEntity();
if (!_arrows.contains(proj))
return;
if (proj.getShooter() == null)
return;
if (!(proj.getShooter() instanceof Player))
return;
Player damager = (Player)proj.getShooter();
int level = getLevel(damager);
if (level == 0) return;
final Arrow arrow = (Arrow)proj;
Factory.GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Factory.GetPlugin(), new Runnable()
{
public void run()
{
try
{
//If it hasnt already triggered (via damage)
if (_arrows.remove(arrow))
trigger(arrow, arrow.getLocation());
}
catch (Exception e)
{
e.printStackTrace();
}
}
}, 0);
//Remove
proj.remove();
}
@EventHandler
public void cleanTrigger(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
return;
for (Iterator<Arrow> arrowIterator = _arrows.iterator(); arrowIterator.hasNext();)
{
Arrow arrow = arrowIterator.next();
if (arrow.isDead() || !arrow.isValid() || arrow.isOnGround() || arrow.getTicksLived() > 60)
{
arrowIterator.remove();
trigger(arrow, arrow.getLocation());
}
}
}
public void trigger(Arrow arrow, Location loc)
{
if (arrow == null)
return;
if (arrow.getShooter() == null || !(arrow.getShooter() instanceof Player))
{
arrow.remove();
return;
}
Player player = (Player)arrow.getShooter();
//Level
int level = getLevel(player);
if (level == 0)
return;
//Velocity Players
HashMap<Player,Double> hitMap = UtilPlayer.getInRadius(loc, 5 + (level));
for (Player cur : hitMap.keySet())
{
double range = hitMap.get(cur);
//Condition
Factory.Condition().Factory().Falling(GetName(), cur, player, 6, false, true);
//Damage Event
Factory.Damage().NewDamageEvent(cur, player, null,
DamageCause.CUSTOM, 2 + 10 * range, false, true, false,
player.getName(), GetName());
//Velocity
UtilAction.velocity(cur, UtilAlg.getTrajectory2d(loc, cur.getLocation().add(0, 1, 0)),
0.4 + 1 * range, false, 0, 0.2 + 0.6 * range, 1.2, true);
//Inform
if (cur instanceof Player)
UtilPlayer.message((Player)cur, F.main(GetClassType().name(), F.name(player.getName()) +" hit you with " + F.skill(GetName(level)) + "."));
}
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, loc, 0, 0, 0, 0, 1);
loc.getWorld().playSound(loc, Sound.EXPLODE, 2f, 0.75f);
}
@EventHandler
public void particle(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Entity ent : _arrows)
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, ent.getLocation(), 0, 0, 0, 0, 1);
}
@Override
public void Reset(Player player)
{
_active.remove(player);
}
}

View File

@ -48,8 +48,8 @@ public class NapalmShot extends SkillActive
SetDesc(new String[]
{
"Prepare a napalm shot;",
"Your next arrow will explode on",
"impact, releasing #8#8 flames."
"Your next arrow will burst into",
"#8#8 flames on impact."
});
}

View File

@ -46,7 +46,7 @@ public class PinDown extends SkillActive
SetDesc(new String[]
{
"Instantly fire an arrow, giving",
"target Slow 3 for #3#1 seconds."
"target Slow 4 for #3#1 seconds."
});
}

View File

@ -78,7 +78,7 @@ public class WolfsFury extends SkillActive
_active.put(player, System.currentTimeMillis() + 8000);
//Condition
Factory.Condition().Factory().Strength(GetName(), player, player, 2 + 2*level, level-1, false, true, true);
Factory.Condition().Factory().Strength(GetName(), player, player, 2 + 2*level, 2, false, true, true);
//Inform
UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + "."));
@ -133,6 +133,9 @@ public class WolfsFury extends SkillActive
int level = getLevel(damager);
if (level == 0) return;
if (!_active.containsKey(damager))
return;
//Remove Swing
_swing.remove(damager);

View File

@ -39,6 +39,8 @@ public abstract class Skill implements ISkill, Listener
private boolean _free;
private NautHashMap<Player, Integer> _users;
private boolean _isAchievementSkill = false;
public SkillFactory Factory;
@ -327,4 +329,10 @@ public abstract class Skill implements ISkill, Listener
{
}
@Override
public boolean isAchievementSkill()
{
return _isAchievementSkill;
}
}

View File

@ -13,7 +13,7 @@ public class SkillCharge extends Skill
protected float _rateBase;
protected float _rateBoost;
public SkillCharge(SkillFactory skills, String name, ClassType classType,
SkillType skillType, int cost, int maxLevel,
float base, float boost)

View File

@ -21,6 +21,8 @@ public abstract class SkillChargeSword extends SkillCharge implements Listener
protected boolean _rechargeInform = false;
protected boolean _rechargeAttach = false;
protected boolean _fireOnFull = false;
public SkillChargeSword(SkillFactory skills, String name, ClassType classType,
SkillType skillType, int cost, int maxLevel,
float base, float boost,
@ -62,7 +64,18 @@ public abstract class SkillChargeSword extends SkillCharge implements Listener
continue;
//Charge
Charge(cur);
if (Charge(cur) && _fireOnFull)
{
//Action
float charge = _charge.remove(cur);
//Set Recharge
Recharge.Instance.recharge(cur, GetName());
Recharge.Instance.use(cur, GetName(), _recharge + (getLevel(cur) * _rechargePerLevel), true, true);
DoSkill(cur, charge);
}
}
//Release Charge
else if (_charge.containsKey(cur))

View File

@ -167,13 +167,13 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
0, 0, true,
new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD},
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
//
// AddSkill(new Illusion(this, "Illusion", ClassType.Assassin, SkillType.Sword,
// 1, 4,
// 30, -5,
// 0, 0, true,
// new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD},
// new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
AddSkill(new Illusion(this, "Illusion", ClassType.Assassin, SkillType.Sword,
1, 4,
30, -5,
12000, -1000, true,
new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD},
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
//Axe
AddSkill(new Blink(this, "Blink", ClassType.Assassin, SkillType.Axe,
@ -327,6 +327,13 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
8000, -1000, true,
new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE},
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
AddSkill(new AxeThrow(this, "Roped Axe Throw", ClassType.Knight, SkillType.Axe,
1, 5,
0, 0,
3000, -450, true,
new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE},
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
//Passive A
@ -366,6 +373,8 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD},
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
AddSkill(new StaticLazer(this, "Static Lazer", ClassType.Mage, SkillType.Sword, 1, 5));
//Axe
AddSkill(new FireBlast(this, "Fire Blast", ClassType.Mage, SkillType.Axe,
1, 5,
@ -491,6 +500,13 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
10000, -1500, false,
new Material[] {Material.BOW},
new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK}));
AddSkill(new ExplosiveShot(this, "Explosive Arrow", ClassType.Ranger, SkillType.Bow,
1, 4,
0, 0,
20000, -2000, false,
new Material[] {Material.BOW},
new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK}));
//Passive A
AddSkill(new Barrage(this, "Barrage", ClassType.Ranger, SkillType.PassiveA, 1, 3));

View File

@ -1,8 +1,11 @@
package mineplex.minecraft.game.classcombat.shop;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin;
import mineplex.core.achievement.Achievement;
import mineplex.core.achievement.AchievementManager;
import mineplex.minecraft.game.classcombat.Class.ClassManager;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.classcombat.item.ItemFactory;
@ -12,6 +15,7 @@ public class ClassShopManager extends MiniPlugin
private ClassManager _classManager;
private SkillFactory _skillFactory;
private ItemFactory _itemFactory;
private AchievementManager _achievementManager;
public ClassShopManager(JavaPlugin plugin, ClassManager classManager, SkillFactory skillFactory, ItemFactory itemFactory)
{
@ -20,6 +24,7 @@ public class ClassShopManager extends MiniPlugin
_classManager = classManager;
_skillFactory = skillFactory;
_itemFactory = itemFactory;
//_achievementManager = achievementManager;
}
public ClassManager GetClassManager()
@ -36,4 +41,18 @@ public class ClassShopManager extends MiniPlugin
{
return _itemFactory;
}
public boolean hasAchievements(Player player)
{
return _achievementManager.hasCategory(player, new Achievement[]
{
Achievement.CHAMPIONS_ACE,
Achievement.CHAMPIONS_ASSASSINATION,
Achievement.CHAMPIONS_EARTHQUAKE,
Achievement.CHAMPIONS_FLAWLESS_VICTORY,
Achievement.CHAMPIONS_MASS_ELECTROCUTION,
Achievement.CHAMPIONS_THE_LONGEST_SHOT,
Achievement.CHAMPIONS_WINS,
});
}
}

View File

@ -104,6 +104,7 @@ import nautilus.game.arcade.managers.GameLobbyManager;
import nautilus.game.arcade.managers.GameLootManager;
import nautilus.game.arcade.managers.GameManager;
import nautilus.game.arcade.managers.GamePlayerManager;
import nautilus.game.arcade.managers.GameSpectatorManager;
import nautilus.game.arcade.managers.GameStatManager;
import nautilus.game.arcade.managers.GameTournamentManager;
import nautilus.game.arcade.managers.GameWorldManager;
@ -263,6 +264,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
_gameTournamentManager = new GameTournamentManager(this);
new GameStatManager(this);
new GameLootManager(this, petManager);
new GameSpectatorManager(this);
_gameWorldManager = new GameWorldManager(this);
new MiscManager(this);
_idleManager = new IdleManager(this);

View File

@ -11,18 +11,27 @@ import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Hanging;
import org.bukkit.entity.Minecart;
import org.bukkit.entity.Player;
import org.bukkit.entity.minecart.CommandMinecart;
import org.bukkit.entity.minecart.ExplosiveMinecart;
import org.bukkit.entity.minecart.HopperMinecart;
import org.bukkit.entity.minecart.PoweredMinecart;
import org.bukkit.entity.minecart.StorageMinecart;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.hanging.HangingBreakEvent;
import org.bukkit.event.hanging.HangingPlaceEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.scoreboard.Objective;
import org.bukkit.util.Vector;
@ -31,11 +40,14 @@ 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.UtilEvent;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTabTitle;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.classcombat.event.ClassCombatCreatureAllowSpawnEvent;
@ -1274,4 +1286,8 @@ public abstract class Game implements Listener
loc.getY() >= WorldData.MaxY ||
loc.getY() <= WorldData.MinY);
}
}

View File

@ -962,9 +962,27 @@ public class Bridge extends TeamGame implements OreObsfucation
}
@EventHandler
public void OreReveal(ExplosionEvent event)
public void handleExplosion(ExplosionEvent event)
{
// Reveal ore that are inside the explosion
_ore.Explosion(event);
// Handle block ownership for explosion
if (event.getOwner() != null)
{
for (Block cur : event.GetBlocks())
{
// These are the only blocks that will drop from the explosion so they are the only ones
// we need to worry about for keeping owner data of
if (cur.getType() == Material.IRON_ORE ||
cur.getType() == Material.COAL_ORE ||
cur.getType() == Material.GOLD_ORE ||
cur.getType() == Material.DIAMOND_ORE)
{
_blockToUUIDMap.put(cur, event.getOwner().getUniqueId());
}
}
}
}
@EventHandler(priority = EventPriority.MONITOR)
@ -992,22 +1010,14 @@ public class Bridge extends TeamGame implements OreObsfucation
"Cannot place blocks this high up."));
event.setCancelled(true);
return;
}
//Under Water
if (event.getBlock().getRelative(BlockFace.UP).isLiquid())
{
UtilPlayer.message(event.getPlayer(), F.main("Game",
"Cannot place blocks under liquids."));
event.setCancelled(true);
return;
}
}
if (_bridgesDown)
return;
//In Liquid
if (event.getBlockReplacedState().getTypeId() == 8 ||
if (event.getBlock().getRelative(BlockFace.UP).isLiquid() ||
event.getBlockReplacedState().getTypeId() == 8 ||
event.getBlockReplacedState().getTypeId() == 9 ||
event.getBlockReplacedState().getTypeId() == 10 ||
event.getBlockReplacedState().getTypeId() == 11)
@ -1597,7 +1607,7 @@ public class Bridge extends TeamGame implements OreObsfucation
// }
@EventHandler
public void boatDeny(PlayerInteractEvent event)
public void vehicleDeny(PlayerInteractEvent event)
{
if (!UtilEvent.isAction(event, ActionType.R))
return;

View File

@ -562,7 +562,7 @@ public class DragonEscape extends SoloGame
if (!UtilTime.elapsed(GetStateTime(), 10000))
{
UtilPlayer.message(player, F.main("Game", "You cannot dig for " + F.elem(UtilTime.MakeStr(6000 - (System.currentTimeMillis() - GetStateTime())) + ".")));
UtilPlayer.message(player, F.main("Game", "You cannot dig for " + F.elem(UtilTime.MakeStr(10000 - (System.currentTimeMillis() - GetStateTime())) + ".")));
return;
}

View File

@ -60,7 +60,7 @@ public class Micro extends TeamGame
this.BlockBreak = true;
this.BlockPlace = true;
registerStatTrackers(new KillsWithinGameStatTracker(this, 12, "Annihilation"));
registerStatTrackers(new KillsWithinGameStatTracker(this, 9, "Annihilation"));
}
@Override

View File

@ -99,7 +99,6 @@ public class Paintball extends TeamGame
}
private HashMap<Player, PlayerCopy> _doubles = new HashMap<Player, PlayerCopy>();
private HashSet<Projectile> _water = new HashSet<Projectile>();
public Paintball(ArcadeManager manager)
{

View File

@ -3,21 +3,23 @@ package nautilus.game.arcade.game.games.paintball;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.disguise.disguises.DisguisePlayer;
import nautilus.game.arcade.game.Game;
import org.bukkit.ChatColor;
import org.bukkit.EntityEffect;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton;
public class PlayerCopy
{
private Paintball Host;
private Game Host;
private Skeleton _ent;
private Player _owner;
public PlayerCopy(Paintball host, Player owner)
public PlayerCopy(Game host, Player owner)
{
Host = host;
@ -34,12 +36,12 @@ public class PlayerCopy
//Armor
_ent.getEquipment().setArmorContents(owner.getInventory().getArmorContents());
_ent.setCustomName(C.cWhite + C.Bold + C.Scramble + "XX" + ChatColor.RESET + " " + host.GetTeam(owner).GetColor() + owner.getName() + " " + C.cWhite + C.Bold + C.Scramble + "XX");
_ent.setCustomName(C.cWhite + C.Bold + C.Scramble + "XX" + ChatColor.RESET + " " + C.cYellow + owner.getName() + " " + C.cWhite + C.Bold + C.Scramble + "XX");
_ent.setCustomNameVisible(true);
//Disguise
////DisguisePlayer disguise = new DisguisePlayer(_ent, owner.getName());
//Host.Manager.GetDisguise().disguise(disguise);
// DisguisePlayer disguise = new DisguisePlayer(_ent, ((CraftPlayer)owner).getProfile());
// Host.Manager.GetDisguise().disguise(disguise);
}
public LivingEntity GetEntity()

View File

@ -6,13 +6,23 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.EntityEffect;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.ThrownPotion;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
@ -22,12 +32,15 @@ import mineplex.core.common.util.UtilAlg;
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.UtilTextMiddle;
import mineplex.core.common.util.UtilTime;
import mineplex.core.data.BlockData;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
@ -35,6 +48,9 @@ import nautilus.game.arcade.events.PlayerDeathOutEvent;
import nautilus.game.arcade.events.PlayerKitGiveEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.game.games.paintball.PlayerCopy;
import nautilus.game.arcade.game.games.paintball.Paintball.ReviveEvent;
import nautilus.game.arcade.game.games.wither.kit.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.NullKit;
@ -44,15 +60,17 @@ public class WitherGame extends TeamGame implements IBlockRestorer
{
private GameTeam _runners;
private GameTeam _withers;
private double _witherFactor = 2.5;
private int _yLimit = 0;
private long _gameTime = 300000;
private int _livesPerPlayer = 3;
private HashMap<Player, Integer> _lives = new HashMap<Player, Integer>();
private HashMap<Player, PlayerCopy> _doubles = new HashMap<Player, PlayerCopy>();
// private int _livesPerPlayer = 3;
// private HashMap<Player, Integer> _lives = new HashMap<Player, Integer>();
private HashSet<BlockData> _blocks = new HashSet<BlockData>();
@ -62,10 +80,9 @@ public class WitherGame extends TeamGame implements IBlockRestorer
new Kit[]
{
//new KitHumanRunner(manager),
new KitHumanArcher(manager),
new KitHumanBuilder(manager),
new NullKit(manager),
new KitHumanRunner(manager),
new NullKit(manager),
new KitWitherMinion(manager),
//new KitWitherWeb(manager),
@ -75,8 +92,8 @@ public class WitherGame extends TeamGame implements IBlockRestorer
new String[]
{
C.cGreen + "Humans" + C.cWhite + " Find Armor Upgrades to help surive!",
C.cGreen + "Humans" + C.cWhite + " 5 Lives per Player",
C.cGreen + "Humans" + C.cWhite + " Run and hide from the Withers",
C.cGreen + "Humans" + C.cWhite + " Revive your dead allies!",
C.cGreen + "Humans" + C.cWhite + " Win by surviving for 5 minutes",
" ",
C.cRed + "Withers" + C.cWhite + " Moves very slowly when near ground",
@ -95,6 +112,9 @@ public class WitherGame extends TeamGame implements IBlockRestorer
this.KitRegisterState = GameState.Prepare;
this.TeamArmor = true;
this.TeamArmorHotbar = false;
_help = new String[]
{
C.cRed + C.Bold + "This game is in early stages of development!",
@ -164,15 +184,17 @@ public class WitherGame extends TeamGame implements IBlockRestorer
public void setWither(Player player, boolean forced)
{
_lives.remove(player);
// _lives.remove(player);
SetPlayerTeam(player, _withers, true);
//Kit
Kit newKit = GetKits()[4];
SetKit(player, newKit, false);
newKit.ApplyKit(player);
player.teleport(_withers.GetSpawn());
if (forced)
{
@ -185,25 +207,25 @@ public class WitherGame extends TeamGame implements IBlockRestorer
}
}
@EventHandler
public void playerDead(final PlayerDeathOutEvent event)
{
Player player = event.GetPlayer();
if (_lives.containsKey(player))
{
int lives = _lives.get(player);
if (lives <= 1)
return;
_lives.put(player, lives - 1);
UtilPlayer.message(player, F.main("Game", "You have " + F.elem(C.cGreen + C.Bold + lives + " Lives Remaining") + "."));
event.setCancelled(true);
}
}
// @EventHandler
// public void playerLoseLife(final PlayerDeathOutEvent event)
// {
// Player player = event.GetPlayer();
//
// if (_lives.containsKey(player))
// {
// int lives = _lives.get(player);
//
// if (lives <= 1)
// return;
//
// _lives.put(player, lives - 1);
//
// UtilPlayer.message(player, F.main("Game", "You have " + F.elem(C.cGreen + C.Bold + lives + " Lives Remaining") + "."));
//
// event.setCancelled(true);
// }
// }
@EventHandler
public void gameStart(GameStateChangeEvent event)
@ -211,31 +233,31 @@ public class WitherGame extends TeamGame implements IBlockRestorer
if (event.GetState() != GameState.Live)
return;
UtilTextMiddle.display(C.cGreen + "Humans Hiding", "12 Seconds until Assault", 10, 80, 10);
UtilTextMiddle.display(C.cGreen + "Humans Hiding", "15 Seconds until Assault", 10, 80, 10);
for (Player player : _withers.GetPlayers(true))
{
Manager.GetCondition().Factory().Blind("Game Start", player, null, 12, 0, false, false, false);
Manager.GetCondition().Factory().Blind("Game Start", player, null, 15, 0, false, false, false);
}
}
@EventHandler
public void playerLivesDisplay(PlayerKitGiveEvent event)
{
if (!_runners.HasPlayer(event.GetPlayer()))
return;
//Player Lives
if (!_lives.containsKey(event.GetPlayer()))
_lives.put(event.GetPlayer(), _livesPerPlayer);
int lives = _lives.get(event.GetPlayer());
if (lives <= 0)
return;
event.GetPlayer().getInventory().setItem(8, ItemStackFactory.Instance.CreateStack(Material.BONE, (byte)0, lives, C.cGreen + C.Bold + lives + " Lives Remaining"));
}
// @EventHandler
// public void playerLivesDisplay(PlayerKitGiveEvent event)
// {
// if (!_runners.HasPlayer(event.GetPlayer()))
// return;
//
// //Player Lives
// if (!_lives.containsKey(event.GetPlayer()))
// _lives.put(event.GetPlayer(), _livesPerPlayer);
//
// int lives = _lives.get(event.GetPlayer());
//
// if (lives <= 0)
// return;
//
// event.GetPlayer().getInventory().setItem(8, ItemStackFactory.Instance.CreateStack(Material.BONE, (byte)0, lives, C.cGreen + C.Bold + lives + " Lives Remaining"));
// }
@Override
public void EndCheck()
@ -292,9 +314,9 @@ public class WitherGame extends TeamGame implements IBlockRestorer
if (event.getType() != UpdateType.FAST)
return;
int lives = 0;
for (int i : _lives.values())
lives += i;
// int lives = 0;
// for (int i : _lives.values())
// lives += i;
//Wipe Last
Scoreboard.Reset();
@ -307,9 +329,9 @@ public class WitherGame extends TeamGame implements IBlockRestorer
Scoreboard.Write(_withers.GetColor() + C.Bold + _withers.GetName());
Scoreboard.Write(_withers.GetColor() + "" + _withers.GetPlayers(true).size() + " Players");
Scoreboard.WriteBlank();
Scoreboard.Write(C.cYellow + C.Bold + "Human Lives");
Scoreboard.Write(lives + " / " + (_lives.size() * _livesPerPlayer));
// Scoreboard.WriteBlank();
// Scoreboard.Write(C.cYellow + C.Bold + "Humans Alive");
// Scoreboard.Write(lives + " / " + (_lives.size() * _livesPerPlayer));
Scoreboard.WriteBlank();
Scoreboard.Write(C.cYellow + C.Bold + "Time Left");
@ -357,7 +379,7 @@ public class WitherGame extends TeamGame implements IBlockRestorer
ArrayList<Location> collisions = new ArrayList<Location>();
//Fly Speed
double speed = 0.06 - (_yLimit - player.getLocation().getY()) * 0.075;
double speed = 0.06 - (_yLimit - player.getLocation().getY()) * 0.0075;
if (speed > 0.16)
speed = 0.16;
@ -431,29 +453,214 @@ public class WitherGame extends TeamGame implements IBlockRestorer
}
}
// @EventHandler
// public void cleanLives(PlayerQuitEvent event)
// {
// _lives.remove(event.getPlayer());
// }
// @EventHandler
// public void livesUpdate(UpdateEvent event)
// {
// if (!IsLive())
// return;
//
// if (event.getType() != UpdateType.FASTER)
// return;
//
// Iterator<Player> playerIter = _lives.keySet().iterator();
//
// while (playerIter.hasNext())
// {
// Player player = playerIter.next();
//
// if (!player.isOnline() || !_runners.HasPlayer(player))
// playerIter.remove();
// }
// }
@EventHandler
public void playerQuit(PlayerQuitEvent event)
public void arrowDamage(CustomDamageEvent event)
{
_lives.remove(event.getPlayer());
if (event.GetProjectile() == null)
return;
event.AddMult(GetName(), "Arrow Mod", 0.75, false);
}
@EventHandler(priority = EventPriority.HIGHEST)
public void damageOut(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
if (event.GetDamageePlayer() == null)
return;
if (event.GetDamage() < event.GetDamageePlayer().getHealth())
return;
event.SetCancelled("Fake Death");
event.GetDamageePlayer().playEffect(EntityEffect.HURT);
playerOut(event.GetDamageePlayer());
}
public void playerOut(Player player)
{
//State
SetPlayerState(player, PlayerState.OUT);
player.setHealth(20);
//Conditions
Manager.GetCondition().Factory().Blind("Hit", player, player, 1.5, 0, false, false, false);
Manager.GetCondition().Factory().Cloak("Hit", player, player, 9999, false, false);
//Settings
player.setGameMode(GameMode.CREATIVE);
player.setFlying(true);
((CraftPlayer)player).getHandle().spectating = true;
((CraftPlayer)player).getHandle().k = false;
player.setVelocity(new Vector(0,1.2,0));
_doubles.put(player, new PlayerCopy(this, player));
}
public void playerIn(final Player player, final LivingEntity copy)
{
//State
SetPlayerState(player, PlayerState.IN);
player.setHealth(20);
//Teleport
if (copy != null)
{
Location loc = player.getLocation();
loc.setX(copy.getLocation().getX());
loc.setY(copy.getLocation().getY());
loc.setZ(copy.getLocation().getZ());
player.teleport(loc);
}
//Settings
player.setGameMode(GameMode.SURVIVAL);
player.setFlying(false);
((CraftPlayer)player).getHandle().spectating = false;
((CraftPlayer)player).getHandle().k = true;
//Items
player.getInventory().remove(Material.WATCH);
player.getInventory().remove(Material.COMPASS);
//Inform
UtilPlayer.message(player, F.main("Game", "You have been revived!"));
//Delayed Visibility
if (copy != null)
{
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable()
{
public void run()
{
//Remove Invis
if (IsAlive(player))
Manager.GetCondition().EndCondition(player, ConditionType.CLOAK, null);
//Remove Copy
copy.remove();
}
}, 4);
}
}
@EventHandler
public void livesUpdate(UpdateEvent event)
public void revive(ProjectileHitEvent event)
{
if (!IsLive())
return;
if (event.getType() != UpdateType.FASTER)
if (!(event.getEntity() instanceof ThrownPotion))
return;
if (event.getEntity().getShooter() == null)
return;
if (!(event.getEntity().getShooter() instanceof Player))
return;
Player thrower = (Player)event.getEntity().getShooter();
GameTeam throwerTeam = GetTeam(thrower);
if (throwerTeam == null) return;
//Revive
Iterator<PlayerCopy> copyIterator = _doubles.values().iterator();
while (copyIterator.hasNext())
{
PlayerCopy copy = copyIterator.next();
GameTeam otherTeam = GetTeam(copy.GetPlayer());
if (otherTeam == null || !otherTeam.equals(throwerTeam))
continue;
if (UtilMath.offset(copy.GetEntity().getLocation().add(0,1,0), event.getEntity().getLocation()) > 3)
continue;
playerIn(copy.GetPlayer(), copy.GetEntity());
copyIterator.remove();
AddGems(thrower, 3, "Revived Ally", true);
}
//Revive
for (Player player : GetPlayers(true))
{
GameTeam otherTeam = GetTeam(player);
if (otherTeam == null || !otherTeam.equals(throwerTeam))
continue;
if (UtilMath.offset(player.getLocation().add(0,1,0), event.getEntity().getLocation()) > 3)
continue;
playerIn(player, null);
}
}
@EventHandler
public void removePotionEffect(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
Iterator<Player> playerIter = _lives.keySet().iterator();
while (playerIter.hasNext())
for (Player player : GetPlayers(true))
player.removePotionEffect(PotionEffectType.WATER_BREATHING);
}
@EventHandler
public void skeletonDamage(CustomDamageEvent event)
{
for (PlayerCopy copy : _doubles.values())
{
Player player = playerIter.next();
if (!player.isOnline() || !_runners.HasPlayer(player))
playerIter.remove();
if (copy.GetEntity().equals(event.GetDamageeEntity()))
{
event.SetCancelled("Runner Copy Cancel");
break;
}
}
}
@EventHandler
public void skeletonCombust(EntityCombustEvent event)
{
for (PlayerCopy copy : _doubles.values())
{
if (copy.GetEntity().equals(event.getEntity()))
{
event.setCancelled(true);
break;
}
}
}
}

View File

@ -1,10 +1,15 @@
package nautilus.game.arcade.game.games.wither.kit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.PotionMeta;
import mineplex.core.disguise.disguises.DisguisePlayer;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
@ -28,7 +33,7 @@ public class KitHumanArcher extends Kit
new Perk[]
{
new PerkRopedArrow("Roped Arrow", 1, 4000),
new PerkWitherArrowBlind(3),
new PerkWitherArrowBlind(6),
new PerkFletcher(4, 4, true),
},
@ -42,10 +47,15 @@ public class KitHumanArcher extends Kit
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW));
ItemStack potion = new ItemStack(Material.POTION, 3, (short)16429); // 16422
PotionMeta potionMeta = (PotionMeta)potion.getItemMeta();
potionMeta.setDisplayName(ChatColor.RESET + "Revival Potion");
potion.setItemMeta(potionMeta);
player.getInventory().addItem(potion);
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
Manager.GetCondition().Factory().Invulnerable("Spawn Invul", player, player, 6, false, false);
}
@Override

View File

@ -1,10 +1,15 @@
package nautilus.game.arcade.game.games.wither.kit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.PotionMeta;
import mineplex.core.disguise.disguises.DisguisePlayer;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
@ -39,10 +44,15 @@ public class KitHumanBuilder extends Kit
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE));
ItemStack potion = new ItemStack(Material.POTION, 3, (short)16429); // 16422
PotionMeta potionMeta = (PotionMeta)potion.getItemMeta();
potionMeta.setDisplayName(ChatColor.RESET + "Revival Potion");
potion.setItemMeta(potionMeta);
player.getInventory().addItem(potion);
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
Manager.GetCondition().Factory().Invulnerable("Spawn Invul", player, player, 6, false, false);
}
@Override

View File

@ -1,24 +1,29 @@
package nautilus.game.arcade.game.games.wither.kit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.PotionMeta;
import mineplex.core.common.util.C;
import mineplex.core.disguise.disguises.DisguisePlayer;
import mineplex.core.itemstack.ItemStackFactory;
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.PerkDoubleJump;
import nautilus.game.arcade.kit.perks.PerkLeap;
public class KitHumanRunner extends Kit
{
public KitHumanRunner(ArcadeManager manager)
{
super(manager, "Human Leaper", KitAvailability.Free,
super(manager, "Human Jumper", KitAvailability.Free,
new String[]
{
@ -27,7 +32,7 @@ public class KitHumanRunner extends Kit
new Perk[]
{
new PerkLeap("Leap", 1, 1, 4000)
new PerkDoubleJump("Double Jump", 1, 0.8, true, 6000, true),
},
EntityType.ZOMBIE,
null);
@ -38,10 +43,15 @@ public class KitHumanRunner extends Kit
public void GiveItems(Player player)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE));
ItemStack potion = new ItemStack(Material.POTION, 3, (short)16429); // 16422
PotionMeta potionMeta = (PotionMeta)potion.getItemMeta();
potionMeta.setDisplayName(ChatColor.RESET + "Revival Potion");
potion.setItemMeta(potionMeta);
player.getInventory().addItem(potion);
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
Manager.GetCondition().Factory().Invulnerable("Spawn Invul", player, player, 6, false, false);
}
@Override

View File

@ -38,22 +38,22 @@ public class KitWitherMinion extends Kit
new PerkWitherAttack(),
new PerkWitherMinion()
},
EntityType.SKELETON,
EntityType.WITHER,
null);
}
@Override
public void SpawnCustom(LivingEntity ent)
{
ent.setMaxHealth(300);
ent.setHealth(300);
DisguiseWither disguise = new DisguiseWither(ent);
disguise.SetName(C.cYellow + "Wither");
disguise.SetCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);
}
// @Override
// public void SpawnCustom(LivingEntity ent)
// {
// ent.setMaxHealth(300);
// ent.setHealth(300);
//
// DisguiseWither disguise = new DisguiseWither(ent);
// disguise.SetName(C.cYellow + "Wither");
// disguise.SetCustomNameVisible(true);
// Manager.GetDisguise().disguise(disguise);
// }
@Override
public void GiveItems(Player player)

View File

@ -14,6 +14,7 @@ import org.bukkit.event.block.*;
import org.bukkit.event.entity.*;
import org.bukkit.event.inventory.*;
import org.bukkit.event.player.*;
import org.bukkit.metadata.FixedMetadataValue;
import java.util.*;
@ -169,6 +170,8 @@ public class PerkBomber extends Perk
UtilAction.velocity(tnt, player.getLocation().getDirection(), 0.5, false, 0, 0.1, 10, false);
tnt.setMetadata("owner", new FixedMetadataValue(Manager.GetPlugin(), player.getUniqueId()));
_tntMap.put(tnt, player);
}

View File

@ -96,7 +96,7 @@ public class PerkWitherArrowBlind extends Perk
boolean hit = false;
for (Player player : getWitherTeam().GetPlayers(true))
{
if (UtilMath.offset(player.getLocation().add(0, 1, 0), arrow.getLocation()) < _proximityHit)
if (UtilMath.offset(player.getLocation().add(0, 3, 0), arrow.getLocation()) < _proximityHit)
{
Manager.GetCondition().Factory().Blind(GetName(), player, null, 4, 0, false, false, false);

View File

@ -41,11 +41,11 @@ public class PerkWitherArrows extends Perk
if (!player.isBlocking())
{
player.setExp((float) Math.min(0.999, player.getExp()+(1f/30f)));
player.setExp((float) Math.min(0.999, player.getExp()+(1f/20f)));
}
else if (player.getExp() > 0)
{
player.setExp((float) Math.max(0, player.getExp()-(1f/30f)));
player.setExp((float) Math.max(0, player.getExp()-(1f/20f)));
for (int i=0 ; i<1 ; i++)
{

View File

@ -58,9 +58,9 @@ public class GameLootManager implements Listener
false);
//Chest
_rewardManager.addReward(new InventoryReward(_rewardManager, Manager.getInventoryManager(), "Treasure Chest", "Treasure Chest", 1, 1,
_rewardManager.addReward(new InventoryReward(_rewardManager, Manager.getInventoryManager(), "Treasure Chest", "Treasure Chest", 1, 2,
new ItemStack(Material.CHEST), RewardRarity.COMMON, 4));
//Key
_rewardManager.addReward(new InventoryReward(_rewardManager, Manager.getInventoryManager(), "Treasure Key", "Treasure Key", 1, 1,
new ItemStack(Material.DIAMOND), RewardRarity.UNCOMMON, 1000));

View File

@ -0,0 +1,72 @@
package nautilus.game.arcade.managers;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.Game.GameState;
import org.bukkit.Material;
import org.bukkit.entity.Minecart;
import org.bukkit.entity.Player;
import org.bukkit.entity.minecart.CommandMinecart;
import org.bukkit.entity.minecart.ExplosiveMinecart;
import org.bukkit.entity.minecart.HopperMinecart;
import org.bukkit.entity.minecart.PoweredMinecart;
import org.bukkit.entity.minecart.StorageMinecart;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.vehicle.VehicleDamageEvent;
public class GameSpectatorManager implements Listener
{
ArcadeManager Manager;
public GameSpectatorManager(ArcadeManager manager)
{
Manager = manager;
Manager.GetPluginManager().registerEvents(this, Manager.GetPlugin());
}
@EventHandler(priority = EventPriority.LOW)
public void interactCancel(PlayerInteractEvent event)
{
if (Manager.GetGame() == null)
return;
Player player = event.getPlayer();
if (!Manager.GetGame().IsAlive(player))
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.LOW)
public void interactEntityCancel(PlayerInteractEntityEvent event)
{
if (Manager.GetGame() == null)
return;
Player player = event.getPlayer();
if (!Manager.GetGame().IsAlive(player))
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.LOW)
public void vehicleDamage(VehicleDamageEvent event)
{
if (Manager.GetGame() == null)
return;
if (!(event.getAttacker() instanceof Player))
return;
Player player = (Player)event.getAttacker();
if (!Manager.GetGame().IsAlive(player))
event.setCancelled(true);
}
}

View File

@ -52,12 +52,8 @@ public class MiscManager implements Listener
Player player = event.getPlayer();
if (!Manager.GetGame().IsAlive(player))
{
event.setCancelled(true);
}
//BoneMeal
else if (event.getPlayer().getItemInHand().getType() == Material.INK_SACK && event.getPlayer().getItemInHand().getData().getData() == (byte)15)
if (event.getPlayer().getItemInHand().getType() == Material.INK_SACK && event.getPlayer().getItemInHand().getData().getData() == (byte)15)
{
if (event.getAction() == Action.RIGHT_CLICK_BLOCK && Manager.GetGame().GetType() != GameType.UHC)
event.setCancelled(true);