Merge branch 'Myst_LOBBERS'

This commit is contained in:
Mini-Chiss 2015-07-25 10:26:47 +02:00
commit 59d14624c0
25 changed files with 1678 additions and 29 deletions

View File

@ -630,6 +630,52 @@ public enum Achievement
new String[]{"Kill 2 enemies while blinded from", "a single flashbang"}, new String[]{"Kill 2 enemies while blinded from", "a single flashbang"},
new int[]{1}, new int[]{1},
AchievementCategory.MINE_STRIKE), AchievementCategory.MINE_STRIKE),
//Bomb Lobbers
BOMB_LOBBERS_WINS("Master Bomber", 1200,
new String[]{"Bomb Lobbers.Wins"},
new String[]{"Win 100 games of Bomb Lobbers"},
new int[] {100},
AchievementCategory.BOMB_LOBBERS),
BOMB_LOBBERS_PROFESSIONAL_LOBBER("Professional Lobber", 1000,
new String[]{"Bomb Lobbers.Thrown"},
new String[]{"Throw 2000 TNT"},
new int[]{2000},
AchievementCategory.BOMB_LOBBERS),
// BOMB_LOBBERS_REKT_X3("Rekt x3", 800,
// new String[]{"Bomb Lobbers.3Kill"},
// new String[]{"Kill 3 players with one explosion"},
// new int[]{1},
// AchievementCategory.BOMB_LOBBERS),
BOMB_LOBBERS_ULTIMATE_KILLER("Ultimate Killer", 800,
new String[]{"Bomb Lobbers.Killer"},
new String[]{"Kill 6 players in a single game"},
new int[]{1},
AchievementCategory.BOMB_LOBBERS),
BOMB_LOBBERS_EXPLOSION_PROOF("Jelly Skin", 1000,
new String[]{"Bomb Lobbers.JellySkin"},
new String[]{"Win a game without taking any damage."},
new int[]{1},
AchievementCategory.BOMB_LOBBERS),
BOMB_LOBBERS_BEST_TEAM("The Best Team", 800,
new String[]{"Bomb Lobbers.BestTeam"},
new String[]{"Win a game without losing a teammate"},
new int[]{1},
AchievementCategory.BOMB_LOBBERS),
BOMB_LOBBERS_BLAST_PROOF("Blast Proof", 800,
new String[]{"Bomb Lobbers.BlastProof"},
new String[]{"Win 20 games using Armorer"},
new int[]{20},
AchievementCategory.BOMB_LOBBERS)
// BOMB_LOBBERS_
; ;
private String _name; private String _name;

View File

@ -32,11 +32,11 @@ public enum AchievementCategory
UHC("Ultra Hardcore", null, UHC("Ultra Hardcore", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.GOLDEN_APPLE, 0, GameCategory.SURVIVAL, "Extra Class Skills"), Material.GOLDEN_APPLE, 0, GameCategory.SURVIVAL, null),
WIZARDS("Wizards", null, WIZARDS("Wizards", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.BLAZE_ROD, 0, GameCategory.SURVIVAL, "Extra Class Skills"), Material.BLAZE_ROD, 0, GameCategory.SURVIVAL, "Witch Doctor Kit"),
CASTLE_SIEGE("Castle Siege", null, CASTLE_SIEGE("Castle Siege", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, new StatDisplay("Kills as Defenders"), new StatDisplay("Deaths as Defenders"), new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, new StatDisplay("Kills as Defenders"), new StatDisplay("Deaths as Defenders"),
@ -45,7 +45,7 @@ public enum AchievementCategory
BLOCK_HUNT("Block Hunt", null, BLOCK_HUNT("Block Hunt", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.GRASS, 0, GameCategory.CLASSICS, null), Material.GRASS, 0, GameCategory.CLASSICS, "Infestor Kit"),
SMASH_MOBS("Super Smash Mobs", null, SMASH_MOBS("Super Smash Mobs", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
@ -57,7 +57,7 @@ public enum AchievementCategory
DRAW_MY_THING("Draw My Thing", null, DRAW_MY_THING("Draw My Thing", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED }, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED },
Material.BOOK_AND_QUILL, 0, GameCategory.CLASSICS, null), Material.BOOK_AND_QUILL, 0, GameCategory.CLASSICS, "Extra Tools Kit"),
CHAMPIONS("Champions", new String[] {"Champions Domination", "Champions TDM"}, CHAMPIONS("Champions", new String[] {"Champions Domination", "Champions TDM"},
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
@ -74,7 +74,7 @@ public enum AchievementCategory
DRAGON_ESCAPE("Dragon Escape", null, DRAGON_ESCAPE("Dragon Escape", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED }, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED },
Material.DRAGON_EGG, 0, GameCategory.ARCADE, null), Material.DRAGON_EGG, 0, GameCategory.ARCADE, "Digger Kit"),
SHEEP_QUEST("Sheep Quest", null, SHEEP_QUEST("Sheep Quest", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
@ -86,7 +86,7 @@ public enum AchievementCategory
ONE_IN_THE_QUIVER("One in the Quiver", null, ONE_IN_THE_QUIVER("One in the Quiver", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.BOW, 0, GameCategory.ARCADE, null), Material.BOW, 0, GameCategory.ARCADE, "Slam Shooter Kit"),
SUPER_PAINTBALL("Super Paintball", null, SUPER_PAINTBALL("Super Paintball", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
@ -110,7 +110,7 @@ public enum AchievementCategory
SNAKE("Snake", null, SNAKE("Snake", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.WOOL, 4, GameCategory.ARCADE, null), Material.WOOL, 4, GameCategory.ARCADE, "Reversal Snake Kit"),
BACON_BRAWL("Bacon Brawl", null, BACON_BRAWL("Bacon Brawl", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
@ -118,8 +118,11 @@ public enum AchievementCategory
MICRO_BATTLE("Micro Battle", null, MICRO_BATTLE("Micro Battle", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.LAVA, 0, GameCategory.ARCADE, null); Material.LAVA, 0, GameCategory.ARCADE, null),
BOMB_LOBBERS("Bomb Lobbers", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.FIREBALL, 0, GameCategory.ARCADE, "Waller Kit");
private String _name; private String _name;
private String[] _statsToPull; private String[] _statsToPull;

View File

@ -27,6 +27,7 @@ public enum GameDisplay
HideSeek("Block Hunt", Material.GRASS, (byte)0, GameCategory.CLASSICS, 20), HideSeek("Block Hunt", Material.GRASS, (byte)0, GameCategory.CLASSICS, 20),
HoleInTheWall("Hole in the Wall", Material.STAINED_GLASS, (byte) 2, GameCategory.ARCADE, 52), HoleInTheWall("Hole in the Wall", Material.STAINED_GLASS, (byte) 2, GameCategory.ARCADE, 52),
Horse("Horseback", Material.IRON_BARDING, (byte)0, GameCategory.ARCADE, 21), Horse("Horseback", Material.IRON_BARDING, (byte)0, GameCategory.ARCADE, 21),
Lobbers("Bomb Lobbers", Material.FIREBALL, (byte) 0, GameCategory.ARCADE, 53),
Micro("Micro Battle", Material.LAVA_BUCKET, (byte)0, GameCategory.ARCADE, 24), Micro("Micro Battle", Material.LAVA_BUCKET, (byte)0, GameCategory.ARCADE, 24),
MilkCow("Milk the Cow", Material.MILK_BUCKET, (byte)0, GameCategory.ARCADE, 27), MilkCow("Milk the Cow", Material.MILK_BUCKET, (byte)0, GameCategory.ARCADE, 27),
MineStrike("MineStrike", Material.TNT, (byte)0, GameCategory.CHAMPIONS, 25),// Temp set to CHAMPIONS to fix UI bug MineStrike("MineStrike", Material.TNT, (byte)0, GameCategory.CHAMPIONS, 25),// Temp set to CHAMPIONS to fix UI bug

View File

@ -1,15 +1,13 @@
package mineplex.core.projectile; package mineplex.core.projectile;
import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.WeakHashMap; import java.util.WeakHashMap;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.disguise.DisguiseManager;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import org.bukkit.Effect; import org.bukkit.Effect;
import org.bukkit.Sound; import org.bukkit.Sound;
@ -35,7 +33,7 @@ public class ProjectileManager extends MiniPlugin
{ {
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
expireTime, hitPlayer, hitBlock, idle, false, expireTime, hitPlayer, hitBlock, idle, false,
null, 1f, 1f, null, 0, null, null, hitboxGrow)); null, 1f, 1f, null, 0, null, null, 0F, 0F, 0F, 0F, 1, hitboxGrow));
} }
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
@ -43,7 +41,7 @@ public class ProjectileManager extends MiniPlugin
{ {
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
expireTime, hitPlayer, hitBlock, idle, pickup, expireTime, hitPlayer, hitBlock, idle, pickup,
null, 1f, 1f, null, 0, null, null, hitboxGrow)); null, 1f, 1f, null, 0, null, null, 0F, 0F, 0F, 0F, 1, hitboxGrow));
} }
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
@ -52,7 +50,7 @@ public class ProjectileManager extends MiniPlugin
{ {
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
expireTime, hitPlayer, hitBlock, idle, false, expireTime, hitPlayer, hitBlock, idle, false,
sound, soundVolume, soundPitch, effect, effectData, effectRate, null, hitboxGrow)); sound, soundVolume, soundPitch, effect, effectData, effectRate, null, 0F, 0F, 0F, 0F, 1, hitboxGrow));
} }
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
@ -61,7 +59,7 @@ public class ProjectileManager extends MiniPlugin
{ {
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
expireTime, hitPlayer, hitBlock, idle, false, expireTime, hitPlayer, hitBlock, idle, false,
sound, soundVolume, soundPitch, effect, effectData, effectRate, particle, hitboxGrow)); sound, soundVolume, soundPitch, effect, effectData, effectRate, particle, 0F, 0F, 0F, 0F, 1, hitboxGrow));
} }
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
@ -70,7 +68,16 @@ public class ProjectileManager extends MiniPlugin
{ {
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
expireTime, hitPlayer, hitBlock, idle, false, expireTime, hitPlayer, hitBlock, idle, false,
sound, soundVolume, soundPitch, null, 0, effectRate, particle, hitboxMult)); sound, soundVolume, soundPitch, null, 0, effectRate, particle, 0F, 0F, 0F, 0F, 1, hitboxMult));
}
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle,
Sound sound, float soundVolume, float soundPitch, ParticleType particle, float pX, float pY, float pZ, float pS, int pC, UpdateType effectRate, float hitboxMult)
{
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
expireTime, hitPlayer, hitBlock, idle, false,
sound, soundVolume, soundPitch, null, 0, effectRate, particle, pX, pY, pZ, pS, pC, hitboxMult));
} }
@EventHandler @EventHandler

View File

@ -1,16 +1,13 @@
package mineplex.core.projectile; package mineplex.core.projectile;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilParticle; 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.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.disguise.DisguiseManager; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.disguise.disguises.DisguiseSquid; import mineplex.core.common.util.UtilServer;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import net.minecraft.server.v1_7_R4.AxisAlignedBB; import net.minecraft.server.v1_7_R4.AxisAlignedBB;
import net.minecraft.server.v1_7_R4.MathHelper; import net.minecraft.server.v1_7_R4.MathHelper;
import net.minecraft.server.v1_7_R4.MovingObjectPosition; import net.minecraft.server.v1_7_R4.MovingObjectPosition;
@ -25,7 +22,6 @@ import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -46,7 +42,14 @@ public class ProjectileUser
private Sound _sound = null; private Sound _sound = null;
private float _soundVolume = 1f; private float _soundVolume = 1f;
private float _soundPitch = 1f; private float _soundPitch = 1f;
private ParticleType _particle = null; private ParticleType _particle = null;
private float _particleX = 0F;
private float _particleY = 0F;
private float _particleZ = 0F;
private float _particleS = 0F;
private int _particleC = 1;
private Effect _effect = null; private Effect _effect = null;
private int _effectData = 0; private int _effectData = 0;
private UpdateType _effectRate = UpdateType.TICK; private UpdateType _effectRate = UpdateType.TICK;
@ -57,8 +60,8 @@ public class ProjectileUser
long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, boolean pickup, long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, boolean pickup,
Sound sound, float soundVolume, float soundPitch, Sound sound, float soundVolume, float soundPitch,
Effect effect, int effectData, UpdateType effectRate, Effect effect, int effectData, UpdateType effectRate,
ParticleType particle, ParticleType particle, float particleX, float particleY,
double hitboxMult) float particleZ, float particleS, int particleC, double hitboxMult)
{ {
Throw = throwInput; Throw = throwInput;
@ -76,6 +79,11 @@ public class ProjectileUser
_soundVolume = soundVolume; _soundVolume = soundVolume;
_soundPitch = soundPitch; _soundPitch = soundPitch;
_particle = particle; _particle = particle;
_particleX = particleX;
_particleY = particleY;
_particleZ = particleZ;
_particleS = particleS;
_particleC = particleC;
_effect = effect; _effect = effect;
_effectData = effectData; _effectData = effectData;
_effectRate = effectRate; _effectRate = effectRate;
@ -95,7 +103,7 @@ public class ProjectileUser
_thrown.getWorld().playEffect(_thrown.getLocation(), _effect, _effectData); _thrown.getWorld().playEffect(_thrown.getLocation(), _effect, _effectData);
if (_particle != null) if (_particle != null)
UtilParticle.PlayParticle(_particle, _thrown.getLocation(), 0f, 0f, 0f, 0, 1, UtilParticle.PlayParticle(_particle, _thrown.getLocation(), _particleX, _particleY, _particleZ, _particleS, _particleC,
ViewDist.LONG, UtilServer.getPlayers()); ViewDist.LONG, UtilServer.getPlayers());
} }

View File

@ -26,6 +26,7 @@ import nautilus.game.arcade.game.games.halloween.Halloween;
import nautilus.game.arcade.game.games.hideseek.HideSeek; import nautilus.game.arcade.game.games.hideseek.HideSeek;
import nautilus.game.arcade.game.games.holeinwall.HoleInTheWall; import nautilus.game.arcade.game.games.holeinwall.HoleInTheWall;
import nautilus.game.arcade.game.games.horsecharge.Horse; import nautilus.game.arcade.game.games.horsecharge.Horse;
import nautilus.game.arcade.game.games.lobbers.BombLobbers;
import nautilus.game.arcade.game.games.micro.Micro; import nautilus.game.arcade.game.games.micro.Micro;
import nautilus.game.arcade.game.games.milkcow.MilkCow; import nautilus.game.arcade.game.games.milkcow.MilkCow;
import nautilus.game.arcade.game.games.minestrike.MineStrike; import nautilus.game.arcade.game.games.minestrike.MineStrike;
@ -84,6 +85,7 @@ public enum GameType
HideSeek(HideSeek.class, GameDisplay.HideSeek), HideSeek(HideSeek.class, GameDisplay.HideSeek),
HoleInTheWall(HoleInTheWall.class, GameDisplay.HoleInTheWall), HoleInTheWall(HoleInTheWall.class, GameDisplay.HoleInTheWall),
Horse(Horse.class, GameDisplay.Horse), Horse(Horse.class, GameDisplay.Horse),
Lobbers(BombLobbers.class, GameDisplay.Lobbers),
Micro(Micro.class, GameDisplay.Micro), Micro(Micro.class, GameDisplay.Micro),
MilkCow(MilkCow.class, GameDisplay.MilkCow), MilkCow(MilkCow.class, GameDisplay.MilkCow),
MineStrike(MineStrike.class, GameDisplay.MineStrike, "http://chivebox.com/file/c/assets.zip", true),// Temp set to CHAMPIONS to fix UI bug MineStrike(MineStrike.class, GameDisplay.MineStrike, "http://chivebox.com/file/c/assets.zip", true),// Temp set to CHAMPIONS to fix UI bug
@ -112,7 +114,7 @@ public enum GameType
TurfWars(TurfForts.class, GameDisplay.TurfWars), TurfWars(TurfForts.class, GameDisplay.TurfWars),
UHC(UHC.class, GameDisplay.UHC), UHC(UHC.class, GameDisplay.UHC),
WitherAssault(WitherGame.class, GameDisplay.WitherAssault), WitherAssault(WitherGame.class, GameDisplay.WitherAssault),
Wizards(Wizards.class, GameDisplay.Barbarians.Wizards, "http://chivebox.com/file/c/ResWizards.zip", true), Wizards(Wizards.class, GameDisplay.Wizards, "http://chivebox.com/file/c/ResWizards.zip", true),
ZombieSurvival(ZombieSurvival.class, GameDisplay.ZombieSurvival), ZombieSurvival(ZombieSurvival.class, GameDisplay.ZombieSurvival),
Build(Build.class, GameDisplay.Build), Build(Build.class, GameDisplay.Build),

View File

@ -0,0 +1,560 @@
package nautilus.game.arcade.game.games.lobbers;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Map.Entry;
import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
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.UtilInv;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.explosion.ExplosionEvent;
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.core.combat.CombatComponent;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.games.lobbers.events.TNTPreExplodeEvent;
import nautilus.game.arcade.game.games.lobbers.events.TNTThrowEvent;
import nautilus.game.arcade.game.games.lobbers.kits.KitArmorer;
import nautilus.game.arcade.game.games.lobbers.kits.KitPitcher;
import nautilus.game.arcade.game.games.lobbers.kits.KitJumper;
import nautilus.game.arcade.game.games.lobbers.kits.KitWaller;
import nautilus.game.arcade.game.games.lobbers.trackers.Tracker6Kill;
import nautilus.game.arcade.game.games.lobbers.trackers.TrackerBestTeam;
import nautilus.game.arcade.game.games.lobbers.trackers.TrackerBlastProof;
import nautilus.game.arcade.game.games.lobbers.trackers.TrackerNoDamage;
import nautilus.game.arcade.game.games.lobbers.trackers.TrackerTNTThrown;
import nautilus.game.arcade.kit.Kit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.ExplosionPrimeEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.util.Vector;
public class BombLobbers extends TeamGame implements IThrown
{
private NautHashMap<GameTeam, Location> _averageSpawns = new NautHashMap<GameTeam, Location>();
private NautHashMap<TNTPrimed, BombToken> _tnt = new NautHashMap<TNTPrimed, BombToken>();
private NautHashMap<Player, Double> _kills = new NautHashMap<Player, Double>();
@SuppressWarnings("unchecked")
public BombLobbers(ArcadeManager manager)
{
super(manager, GameType.Lobbers, new Kit[]
{
new KitJumper(manager),
new KitArmorer(manager),
new KitPitcher(manager),
// new KitMortar(manager), << Spare time kit for Bobbeh
new KitWaller(manager)
}, new String[]
{
"Fight against your enemies using",
"the power of explosives!",
"Left click TNT to throw at your enemy.",
"Last team alive wins!"
});
DamageFall = true;
DamageEvP = true;
WorldWaterDamage = 5;
PrepareFreeze = false;
TeamArmor = true;
TeamArmorHotbar = true;
InventoryOpenChest = false;
InventoryOpenBlock = false;
ItemDrop = false;
BlockPlace = false;
Manager.GetExplosion().SetLiquidDamage(false);
HungerSet = 20;
registerStatTrackers(new Tracker6Kill(this), new TrackerBestTeam(this), new TrackerBlastProof(this), new TrackerNoDamage(this), new TrackerTNTThrown(this));
}
public void addKill(Player player)
{
_kills.put(player, _kills.containsKey(player) ? _kills.get(player) + 1 : 1);
}
public void addAssist(Player player)
{
_kills.put(player, _kills.containsKey(player) ? _kills.get(player) + .5 : .5);
}
public double getKills(Player player)
{
if (_kills.containsKey(player))
{
return _kills.get(player);
}
else
{
_kills.put(player, 0.0);
return 0;
}
}
@EventHandler
public void onKill(CombatDeathEvent event)
{
if (!IsLive())
return;
Player dead = UtilPlayer.searchExact(((Player) event.GetEvent().getEntity()).getName());
if (!IsAlive(dead))
return;
for (CombatComponent damager : event.GetLog().GetAttackers())
{
Player killer = UtilPlayer.searchExact(damager.GetName());
if (killer == null || !killer.isOnline())
continue;
if (IsAlive(killer))
{
if (event.GetLog().GetKiller() == damager)
{
addKill(killer);
}
else
{
addAssist(killer);
}
}
}
}
@EventHandler
public void loadTeamLocations(GameStateChangeEvent event)
{
if (event.GetState() == GameState.Live)
{
for (GameTeam team : _teamList)
{
_averageSpawns.put(team, UtilAlg.getAverageLocation(team.GetSpawns()));
}
}
}
@EventHandler
public void disableFlying(GameStateChangeEvent event)
{
for (Player player : GetPlayers(true))
{
player.setAllowFlight(false);
}
}
@EventHandler
public void throwTNT(PlayerInteractEvent event)
{
if (event.getAction() == Action.PHYSICAL)
return;
if (!IsLive())
return;
Player player = event.getPlayer();
if (!IsAlive(player))
return;
if (!UtilInv.IsItem(player.getItemInHand(), Material.TNT, (byte) 0))
return;
event.setCancelled(true);
UtilInv.remove(player, Material.TNT, (byte) 0, 1);
UtilInv.Update(player);
TNTPrimed tnt = (TNTPrimed) player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), TNTPrimed.class);
tnt.setMetadata("owner", new FixedMetadataValue(Manager.getPlugin(), player.getUniqueId()));
tnt.setFuseTicks(60);
UtilAction.velocity(tnt, player.getLocation().getDirection(), 2.0D, false, 0.0D, 0.1D, 10.0D, false);
Manager.GetProjectile().AddThrow(tnt, player, this, -1L, true, false, true, .2F);
Manager.getPlugin().getServer().getPluginManager().callEvent(new TNTThrowEvent(player, tnt));
_tnt.put(tnt, new BombToken(player));
}
public Player getThrower(TNTPrimed tnt)
{
if (_tnt.get(tnt) == null)
return null;
return UtilPlayer.searchExact(_tnt.get(tnt).Thrower);
}
@EventHandler
public void onTNTExplode(ExplosionPrimeEvent event)
{
if (!IsLive())
return;
if (!(event.getEntity() instanceof TNTPrimed))
return;
TNTPrimed tnt = (TNTPrimed) event.getEntity();
if (!_tnt.containsKey(tnt))
return;
Player thrower = UtilPlayer.searchExact(_tnt.get(tnt).Thrower);
if (thrower == null)
{
event.setCancelled(true);
_tnt.remove(tnt);
event.getEntity().remove();
return;
}
if (GetTeam(thrower) == getSide(tnt.getLocation()))
{
event.setCancelled(true);
_tnt.remove(tnt);
event.getEntity().remove();
return;
}
TNTPreExplodeEvent preExplode = new TNTPreExplodeEvent(thrower, tnt);
Manager.getPlugin().getServer().getPluginManager().callEvent(preExplode);
if (preExplode.isCancelled())
{
event.setCancelled(true);
tnt.remove();
}
else
{
for (Player other : UtilPlayer.getNearby(event.getEntity().getLocation(), 14))
{
Manager.GetCondition().Factory().Explosion("Throwing TNT", other, thrower, 50, 0.1, false, false);
}
}
_tnt.remove(tnt);
}
@EventHandler
public void updateTNT(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
if (!IsLive())
return;
Iterator<Entry<TNTPrimed, BombToken>> iterator = _tnt.entrySet().iterator();
while (iterator.hasNext())
{
Entry<TNTPrimed, BombToken> tnt = iterator.next();
if (tnt.getKey() == null)
continue;
if (!tnt.getKey().isValid())
continue;
BombToken token = tnt.getValue();
Player thrower = UtilPlayer.searchExact(token.Thrower);
if (thrower == null)
continue;
if (!IsPlaying(thrower))
continue;
if (!token.Primed)
{
if (tnt.getKey().getFuseTicks() <= 20)
{
//Respawn
TNTPrimed newTNT = tnt.getKey().getWorld().spawn(tnt.getKey().getLocation(), TNTPrimed.class);
newTNT.setMetadata("owner", new FixedMetadataValue(Manager.getPlugin(), thrower.getUniqueId()));
newTNT.setVelocity(tnt.getKey().getVelocity());
newTNT.setFuseTicks(60);
Manager.GetProjectile().AddThrow(newTNT, thrower, this, -1L, true, false, true, .2F);
tnt.getKey().remove();
_tnt.remove(tnt.getKey());
_tnt.put(newTNT, token);
}
}
}
}
@EventHandler
public void blockCollision(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
if (!IsLive())
return;
for (Entry<TNTPrimed, BombToken> tnt : _tnt.entrySet())
{
if (tnt.getKey() == null)
continue;
if (!tnt.getKey().isValid())
continue;
BombToken token = tnt.getValue();
Player thrower = UtilPlayer.searchExact(token.Thrower);
if (thrower == null)
continue;
if (!IsPlaying(thrower))
continue;
if (!token.Primed)
{
//8+ insta explode
if (UtilTime.elapsed(token.Created, 8000))
{
token.Primed = true;
tnt.getKey().setFuseTicks(0);
continue;
}
else if (UtilTime.elapsed(token.Created, 3000))
{
for (Block block : UtilBlock.getSurrounding(tnt.getKey().getLocation().getBlock(), true))
{
if (block.getType() != Material.AIR)
{
token.Primed = true;
tnt.getKey().setFuseTicks(0);
break;
}
}
}
}
}
}
@EventHandler
public void updateParticles(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
if (!IsLive())
return;
for (Entry<TNTPrimed, BombToken> tnt : _tnt.entrySet())
{
if (tnt.getKey() == null)
continue;
if (!tnt.getKey().isValid())
continue;
if (UtilEnt.isGrounded(tnt.getKey()) || tnt.getKey().isOnGround())
continue;
BombToken token = tnt.getValue();
Player thrower = UtilPlayer.searchExact(token.Thrower);
if (thrower == null)
continue;
if (!IsPlaying(thrower))
continue;
GameTeam team = GetTeam(thrower);
if (team == null)
continue;
//A is current
//B is previous
token.B = token.A;
token.A = tnt.getKey().getLocation();
if (token.A == null || token.B == null)
continue;
//Adapted from static lazer code
double curRange = 0;
double distance = Math.abs(token.A.distance(token.B));
while (curRange <= distance)
{
Location newTarget = token.B.add(UtilAlg.getTrajectory(token.B, token.A).multiply(curRange));
// Location newTarget = player.getEyeLocation().add(player.getLocation().getDirection().multiply(curRange));
//Progress Forwards
curRange += 0.2;
if (team.GetColor() == ChatColor.AQUA)
{
for (int i = 0 ; i < 5 ; i++)
UtilParticle.PlayParticle(ParticleType.RED_DUST, newTarget.clone().add(0.0, 0.5, 0.0), -1, 1, 1, 1, 0,
ViewDist.LONG, UtilServer.getPlayers());
}
else
{
for (int i = 0 ; i < 5 ; i++)
UtilParticle.PlayParticle(ParticleType.RED_DUST, newTarget.clone().add(0.0, 0.5, 0.0), 0, 0, 0, 0, 1,
ViewDist.LONG, UtilServer.getPlayers());
}
//UtilParticle.PlayParticle(ParticleType.RED_DUST, newTarget.clone().add(0.0, 0.6, 0.0), team.GetColorBase().getRed(), team.GetColorBase().getGreen(), team.GetColorBase().getBlue(), 1, 0, ViewDist.LONG, UtilServer.getPlayers());
}
}
}
@EventHandler
public void preventCheating(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
if (!IsLive())
return;
for (Player player : GetPlayers(true))
{
if (GetTeam(player) != getSide(player.getLocation()))
{
player.damage(500);
UtilPlayer.message(player, F.main("Game", "You were killed for trying to cheat!"));
}
}
}
@SuppressWarnings("deprecation")
@EventHandler
public void damageBlocks(ExplosionEvent event)
{
if (!Manager.GetGame().IsLive())
return;
Iterator<Block> iterator = event.GetBlocks().iterator();
while (iterator.hasNext())
{
Block block = iterator.next();
//Stone
if (block.getType() == Material.STONE)
{
block.setType(Material.COBBLESTONE);
iterator.remove();
continue;
}
//Stone Brick
if (block.getType() == Material.SMOOTH_BRICK && block.getData() != 2)
{
block.setData((byte) 2);
iterator.remove();
continue;
}
}
}
private GameTeam getSide(Location entityLoc)
{
Location nearest = UtilAlg.findClosest(entityLoc, new ArrayList<Location>(_averageSpawns.values()));
for (Entry<GameTeam, Location> entry : _averageSpawns.entrySet())
{
if (entry.getValue().equals(nearest))
return entry.getKey();
}
return null;
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
if (!(data.GetThrown() instanceof TNTPrimed))
return;
if (!(data.GetThrower() instanceof Player))
return;
if (!(target instanceof Player))
return;
if (GetTeam((Player) target) == GetTeam((Player) data.GetThrower()))
return;
data.GetThrown().setVelocity(new Vector());
if (target != null)
UtilAction.velocity(target, UtilAlg.getTrajectory2d(data.GetThrown().getLocation(), target.getLocation()), .2, false, 0, 0.2, .4, true);
Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, DamageCause.PROJECTILE, 6.0, false, false, true, "Throwing TNT", "Throwing TNT Direct Hit");
}
@Override
public void Idle(ProjectileUser data)
{
}
@Override
public void Expire(ProjectileUser data)
{
}
public void knockbackIncrease(CustomDamageEvent event)
{
if (event.GetCause() != DamageCause.ENTITY_EXPLOSION && event.GetCause() != DamageCause.BLOCK_EXPLOSION)
return;
event.AddKnockback("Explosion", 1.5D);
}
}

View File

@ -0,0 +1,20 @@
package nautilus.game.arcade.game.games.lobbers;
import org.bukkit.Location;
import org.bukkit.entity.Player;
public class BombToken
{
public final long Created;
public final String Thrower;
public Location A = null;
public Location B = null;
public boolean Primed = false;
public BombToken(Player player)
{
Thrower = player.getName();
Created = System.currentTimeMillis();
}
}

View File

@ -0,0 +1,52 @@
package nautilus.game.arcade.game.games.lobbers.events;
import org.bukkit.entity.Player;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
public class TNTPreExplodeEvent extends PlayerEvent implements Cancellable
{
private static final HandlerList _handlers = new HandlerList();
private boolean _cancelled = false;
private TNTPrimed _tnt;
public TNTPreExplodeEvent(Player thrower, TNTPrimed tnt)
{
super(thrower);
_tnt = tnt;
}
public TNTPrimed getTNT()
{
return _tnt;
}
@Override
public void setCancelled(boolean flag)
{
_cancelled = flag;
}
@Override
public boolean isCancelled()
{
return _cancelled;
}
public static HandlerList getHandlerList()
{
return _handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
}

View File

@ -0,0 +1,37 @@
package nautilus.game.arcade.game.games.lobbers.events;
import org.bukkit.entity.Player;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
public class TNTThrowEvent extends PlayerEvent
{
private static final HandlerList _handlers = new HandlerList();
private TNTPrimed _tnt;
public TNTThrowEvent(Player thrower, TNTPrimed tnt)
{
super(thrower);
_tnt = tnt;
}
public TNTPrimed getTNT()
{
return _tnt;
}
public static HandlerList getHandlerList()
{
return _handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
}

View File

@ -0,0 +1,69 @@
package nautilus.game.arcade.game.games.lobbers.kits;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.lobbers.kits.perks.PerkCraftman;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class KitArmorer extends Kit
{
public KitArmorer(ArcadeManager manager)
{
super(manager, "Armorer", KitAvailability.Gem, 2000, new String[]
{
"He uses his expert armor-making",
"skills to block excess damage!",
"",
C.cGray + "Recieve " + C.cYellow + "Full Gold Armor"
}, new Perk[]
{
new PerkCraftman()
}, EntityType.ZOMBIE,
new ItemStack(Material.AIR));
}
@Override
public void ApplyKit(Player player)
{
UtilInv.Clear(player);
for (Perk perk : GetPerks())
perk.Apply(player);
GiveItemsCall(player);
player.getInventory().setHelmet(new ItemBuilder(Material.GOLD_HELMET).setUnbreakable(true).build());
player.getInventory().setChestplate(new ItemBuilder(Material.GOLD_CHESTPLATE).setUnbreakable(true).build());
player.getInventory().setLeggings(new ItemBuilder(Material.GOLD_LEGGINGS).setUnbreakable(true).build());
player.getInventory().setBoots(new ItemBuilder(Material.GOLD_BOOTS).setUnbreakable(true).build());
UtilInv.Update(player);
}
@Override
public void SpawnCustom(LivingEntity ent)
{
ent.getEquipment().setHelmet(new ItemBuilder(Material.GOLD_HELMET).build());
ent.getEquipment().setChestplate(new ItemBuilder(Material.GOLD_CHESTPLATE).build());
ent.getEquipment().setLeggings(new ItemBuilder(Material.GOLD_LEGGINGS).build());
ent.getEquipment().setBoots(new ItemBuilder(Material.GOLD_BOOTS).build());
}
@Override
public void GiveItems(Player player)
{
}
}

View File

@ -0,0 +1,57 @@
package nautilus.game.arcade.game.games.lobbers.kits;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.lobbers.kits.perks.PerkCraftman;
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 org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
public class KitJumper extends Kit
{
public KitJumper(ArcadeManager manager)
{
super(manager, "Jumper", KitAvailability.Free, 0, new String[]
{
"Use your jumping abilities to leap away from trouble!",
"You take no fall damage."
}, new Perk[]
{
new PerkDoubleJump("Double Jump", 1.2, 1.2, false, 6000, true),
new PerkCraftman()
}, EntityType.ZOMBIE, new ItemBuilder(Material.IRON_AXE).build());
}
@Override
public void GiveItems(Player player)
{
}
@EventHandler
public void onDamage(CustomDamageEvent event)
{
if (!Manager.GetGame().IsLive())
return;
if (!(event.GetDamageeEntity() instanceof Player))
return;
if (!HasKit(event.GetDamageePlayer()))
return;
if (event.GetCause() == DamageCause.FALL)
{
event.SetCancelled("Jumper no fall damage");
}
}
}

View File

@ -0,0 +1,36 @@
package nautilus.game.arcade.game.games.lobbers.kits;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.lobbers.kits.perks.PerkCraftman;
import nautilus.game.arcade.game.games.lobbers.kits.perks.PerkMortar;
import nautilus.game.arcade.game.games.lobbers.kits.perks.PerkMorterCraftman;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
public class KitMortar extends Kit
{
public KitMortar(ArcadeManager manager)
{
super(manager, "Mortar", KitAvailability.Gem, 6000, new String[]
{
"He loves the big guns."
}, new Perk[]
{
new PerkMortar(),
new PerkCraftman(),
new PerkMorterCraftman()
}, EntityType.ZOMBIE, new ItemBuilder(Material.FIREBALL).build());
}
@Override
public void GiveItems(Player player)
{
}
}

View File

@ -0,0 +1,122 @@
package nautilus.game.arcade.game.games.lobbers.kits;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilInv;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.lobbers.events.TNTThrowEvent;
import nautilus.game.arcade.game.games.lobbers.kits.perks.PerkCraftman;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
public class KitPitcher extends Kit
{
public KitPitcher(ArcadeManager manager)
{
super(manager, "Pitcher", KitAvailability.Gem, 4000, new String[]
{
"He can easily pitch the perfect shot for any occasion.",
"",
C.cYellow + "Left Click" + C.cGray + " lever to " + C.cGreen + "Decrease Velocity",
C.cYellow + "Right Click" + C.cGray + " lever to " + C.cGreen + "Increase Velocity",
"Maximum Velocity of " + C.cYellow + "3.",
"Minimum Velocity of " + C.cYellow + "1.",
}, new Perk[]
{
new PerkCraftman()
}, EntityType.ZOMBIE,
new ItemBuilder(Material.LEVER).build());
}
@Override
public void GiveItems(Player player)
{
player.getInventory().setItem(1, new ItemBuilder(Material.LEVER).setTitle(F.item("Velocity Selector")).setAmount(3).build());
}
@EventHandler
public void setFuse(TNTThrowEvent event)
{
if (!Manager.GetGame().IsLive())
return;
if (!HasKit(event.getPlayer()))
return;
ItemStack lever = event.getPlayer().getInventory().getItem(1);
if (lever == null || lever.getType() == Material.AIR)
{
GiveItems(event.getPlayer());
}
else
{
if (lever.getAmount() < 1 || lever.getAmount() > 3)
{
GiveItems(event.getPlayer());
}
UtilAction.velocity(event.getTNT(), event.getPlayer().getLocation().getDirection(), getVelocity(lever.getAmount()), false, 0.0D, 0.1D, 10.0D, false);
}
}
@EventHandler
public void changeFuse(PlayerInteractEvent event)
{
if (!Manager.GetGame().IsLive())
return;
if (!Manager.IsAlive(event.getPlayer()))
return;
if (!HasKit(event.getPlayer()))
return;
if (!UtilInv.IsItem(event.getItem(), Material.LEVER, (byte) 0))
return;
int amount = event.getPlayer().getInventory().getItem(1).getAmount();
//Right
if (UtilEvent.isAction(event, ActionType.R))
{
if (amount >= 3)
return;
UtilInv.insert(event.getPlayer(), new ItemBuilder(Material.LEVER).setTitle(F.item("Velocity Selector")).build());
UtilInv.Update(event.getPlayer());
}
//Left
else if (UtilEvent.isAction(event, ActionType.L))
{
if (amount <= 1)
return;
UtilInv.remove(event.getPlayer(), Material.LEVER, (byte) 0, 1);
UtilInv.Update(event.getPlayer());
}
}
private double getVelocity(int amount)
{
if (amount == 1)
return 1.5;
if (amount == 2)
return 1.75;
return 2.0;
}
}

View File

@ -0,0 +1,38 @@
package nautilus.game.arcade.game.games.lobbers.kits;
import mineplex.core.common.util.F;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.lobbers.kits.perks.PerkCraftman;
import nautilus.game.arcade.game.games.lobbers.kits.perks.PerkWaller;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
public class KitWaller extends Kit
{
public KitWaller(ArcadeManager manager)
{
super(manager, "Waller", KitAvailability.Achievement, 0, new String[]
{
"When the times get tough,",
"build yourself a wall!"
}, new Perk[]
{
new PerkWaller(),
new PerkCraftman()
}, EntityType.ZOMBIE,
new ItemBuilder(Material.SMOOTH_BRICK).setUnbreakable(true).build());
}
@Override
public void GiveItems(Player player)
{
player.getInventory().setItem(1, new ItemBuilder(Material.STONE_SPADE).setAmount(3).setTitle(F.item("Wall Builder")).build());
}
}

View File

@ -0,0 +1,74 @@
package nautilus.game.arcade.game.games.lobbers.kits.perks;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilInv;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.kit.Perk;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
public class PerkCraftman extends Perk
{
private Recharge _recharge;
public PerkCraftman()
{
super("Craftman", new String[]
{
C.cGray + "Recieve 1 TNT every so often. Maximum of 3."
}, false);
_recharge = Recharge.Instance;
}
@EventHandler
public void give(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
if (!Manager.GetGame().IsLive())
return;
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (!Kit.HasKit(player))
continue;
//If game time is 56 seconds - 56000
//8 - 1
if (!_recharge.use(player, "Bomb Give", getRechargeTime(), false, false))
continue;
//Has 3
if (UtilInv.contains(player, Material.TNT, (byte) 0, 3))
continue;
UtilInv.insert(player, new ItemBuilder(Material.TNT).setTitle(F.item("Throwing TNT")).build());
}
}
private long getRechargeTime()
{
long ingame = Manager.GetGame().getGameLiveTime();
if (ingame <= 20000)
return 8000;
if (ingame <= 40000)
return 7000;
if (ingame <= 60000)
return 6000;
if (ingame <= 620000)
return 5000;
return 4000;
}
}

View File

@ -0,0 +1,116 @@
package nautilus.game.arcade.game.games.lobbers.kits.perks;
import java.util.HashSet;
import java.util.Set;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilInv;
import nautilus.game.arcade.game.games.lobbers.BombLobbers;
import nautilus.game.arcade.game.games.lobbers.events.TNTPreExplodeEvent;
import nautilus.game.arcade.kit.Perk;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.util.Vector;
public class PerkMortar extends Perk
{
private Set<TNTPrimed> _scatter = new HashSet<TNTPrimed>();
public PerkMortar()
{
super("Mortar", new String[]
{
C.cYellow + "Right Click" + C.cGray + " Fireball to " + C.cGreen + "Fire Mortar",
"Mortars will explode after " + C.cYellow + "2 Seconds",
"releasing 3 more TNT, each with a 3 second fuse.",
"Your TNT will not scatter if it is grounded."
});
}
@EventHandler
public void throwTNT(PlayerInteractEvent event)
{
if (event.getAction() == Action.PHYSICAL)
return;
if (!Manager.GetGame().IsLive())
return;
if (!(Manager.GetGame() instanceof BombLobbers))
return;
BombLobbers l = (BombLobbers) Manager.GetGame();
Player player = event.getPlayer();
if (!Manager.IsAlive(player))
return;
if (!UtilInv.IsItem(player.getItemInHand(), Material.FIREBALL, (byte) 0))
return;
event.setCancelled(true);
UtilInv.remove(player, Material.FIREBALL, (byte) 0, 1);
UtilInv.Update(player);
TNTPrimed tnt = (TNTPrimed) player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), TNTPrimed.class);
tnt.setMetadata("owner", new FixedMetadataValue(Manager.getPlugin(), player.getUniqueId()));
tnt.setFuseTicks(40);
UtilAction.velocity(tnt, player.getLocation().getDirection(), 2.0D, false, 0.0D, 0.1D, 10.0D, false);
Manager.GetProjectile().AddThrow(tnt, player, l, -1L, true, false, false, .2F);
player.playSound(player.getLocation(), Sound.CREEPER_HISS, 3.0F, 1.0F);
// l.addThrower(player, tnt);
}
@EventHandler
public void onExplode(TNTPreExplodeEvent event)
{
if (!Manager.GetGame().IsLive())
return;
if (!Kit.HasKit(event.getPlayer()))
return;
if (event.getTNT().isOnGround() || UtilEnt.isGrounded(event.getTNT()))
return;
if (!(Manager.GetGame() instanceof BombLobbers))
return;
BombLobbers l = (BombLobbers) Manager.GetGame();
event.setCancelled(true);
if (_scatter.contains(event.getTNT()))
{
_scatter.remove(event.getTNT());
return;
}
for (int i = -1 ; i < 2 ; i++)
{
TNTPrimed tnt = (TNTPrimed) event.getTNT().getWorld().spawn(event.getTNT().getLocation(), TNTPrimed.class);
tnt.setMetadata("owner", new FixedMetadataValue(Manager.getPlugin(), event.getPlayer().getUniqueId()));
tnt.setFuseTicks(60);
UtilAction.velocity(tnt, event.getTNT().getVelocity().add(new Vector(i / 5, 0, i / 5)).normalize(), 2.0D, false, 0.0D, 0.1D, 10.0D, false);
Manager.GetProjectile().AddThrow(tnt, event.getPlayer(), l, -1L, true, false, false, .2F);
// l.addThrower(event.getPlayer(), tnt);
_scatter.add(tnt);
}
}
}

View File

@ -0,0 +1,55 @@
package nautilus.game.arcade.game.games.lobbers.kits.perks;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilInv;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.kit.Perk;
public class PerkMorterCraftman extends Perk
{
private Recharge _recharge;
public PerkMorterCraftman()
{
super("Morter Craftman", new String[]
{
"You will recieve 1 mortar every " + C.cYellow + "10 Seconds.",
"Maximum of 1."
});
_recharge = Recharge.Instance;
}
@EventHandler
public void give(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
if (!Manager.GetGame().IsLive())
return;
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (!Kit.HasKit(player))
continue;
if (!_recharge.use(player, "Mortar Give", 10000, false, false))
continue;
//Has 1
if (UtilInv.contains(player, Material.FIREBALL, (byte) 0, 1))
continue;
UtilInv.insert(player, new ItemBuilder(Material.FIREBALL).setTitle(F.item("Mortar")).build());
}
}
}

View File

@ -0,0 +1,123 @@
package nautilus.game.arcade.game.games.lobbers.kits.perks;
import java.util.HashSet;
import java.util.Set;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilInv;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.games.lobbers.events.TNTThrowEvent;
import nautilus.game.arcade.kit.Perk;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.player.PlayerInteractEvent;
public class PerkWaller extends Perk
{
private BlockFace[] axis = { BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST };
private Set<TNTPrimed> _tnt = new HashSet<TNTPrimed>();
private Set<Location> _wallBlocks = new HashSet<Location>();
public PerkWaller()
{
super("Waller", new String[]
{
C.cYellow + "Click Block" + C.cGray + " with shovel to " + C.cGreen + "Place Wall"
});
}
@EventHandler
public void onThrow(TNTThrowEvent event)
{
_tnt.add(event.getTNT());
}
@EventHandler
public void onExplode(EntityExplodeEvent event)
{
if (_tnt.contains(event.getEntity()))
{
_tnt.remove(event.getEntity());
}
}
@EventHandler
public void onPlace(PlayerInteractEvent event)
{
if (!UtilEvent.isAction(event, ActionType.R_BLOCK))
return;
if (!Manager.GetGame().IsLive())
return;
if (!Manager.IsAlive(event.getPlayer()))
return;
if (!Kit.HasKit(event.getPlayer()))
return;
if (!UtilInv.IsItem(event.getItem(), Material.STONE_SPADE, (byte) 0))
return;
UtilInv.remove(event.getPlayer(), Material.STONE_SPADE, (byte) 0, 1);
_wallBlocks.addAll(buildWall(event.getClickedBlock().getLocation(), event.getPlayer().getLocation().getYaw()));
}
@SuppressWarnings("deprecation")
private Set<Location> buildWall(final Location source, final float playerYaw)
{
BlockFace facing = getFace(playerYaw + 180F);
Set<Location> allWallBlocks = new HashSet<Location>();
Set<Location> baseWallBlocks = new HashSet<Location>();
Location centerWallBlock = source.getBlock().getRelative(facing).getRelative(BlockFace.UP).getLocation();
float leftYaw = playerYaw - 90;
float rightYaw = playerYaw + 90;
BlockFace leftSide = getFace(leftYaw);
BlockFace rightSide = getFace(rightYaw);
baseWallBlocks.add(centerWallBlock.getBlock().getRelative(leftSide).getRelative(leftSide).getLocation());
baseWallBlocks.add(centerWallBlock.getBlock().getRelative(leftSide).getLocation());
baseWallBlocks.add(centerWallBlock);
baseWallBlocks.add(centerWallBlock.getBlock().getRelative(rightSide).getLocation());
baseWallBlocks.add(centerWallBlock.getBlock().getRelative(rightSide).getRelative(rightSide).getLocation());
for (Location base : baseWallBlocks)
{
for (int height = 0 ; height < 3 ; height++)
{
allWallBlocks.add(base.clone().add(0, height, 0));
}
}
for (Location block : allWallBlocks)
{
block.getBlock().setType(Material.SMOOTH_BRICK);
block.getBlock().setData((byte) 0);
block.getWorld().playEffect(block, Effect.STEP_SOUND, block.getBlock().getType());
}
return allWallBlocks;
}
private BlockFace getFace(float yaw)
{
return axis[Math.round(yaw / 90f) & 0x3];
}
}

View File

@ -0,0 +1,38 @@
package nautilus.game.arcade.game.games.lobbers.trackers;
import mineplex.core.common.util.UtilServer;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.lobbers.BombLobbers;
import nautilus.game.arcade.stats.StatTracker;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
public class Tracker6Kill extends StatTracker<Game>
{
public Tracker6Kill(Game game)
{
super(game);
}
@EventHandler
public void onEndgame(GameStateChangeEvent event)
{
if (event.GetState() != GameState.End)
return;
if (getGame() instanceof BombLobbers)
{
for (Player player : UtilServer.getPlayers())
{
if (((BombLobbers) getGame()).getKills(player) >= 6.0)
{
addStat(player, "Killer", 1, true, false);
}
}
}
}
}

View File

@ -0,0 +1,51 @@
package nautilus.game.arcade.game.games.lobbers.trackers;
import mineplex.core.common.util.NautHashMap;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.stats.StatTracker;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
public class TrackerBestTeam extends StatTracker<Game>
{
private NautHashMap<GameTeam, Integer> _teams = new NautHashMap<GameTeam, Integer>();
public TrackerBestTeam(Game game)
{
super(game);
}
@EventHandler
public void onGameStart(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Prepare)
return;
for (GameTeam team : getGame().GetTeamList())
{
_teams.put(team, team.GetPlayers(true).size());
}
}
@EventHandler
public void onGameEnd(GameStateChangeEvent event)
{
if (event.GetState() != GameState.End)
return;
for (GameTeam team : getGame().GetTeamList())
{
if (_teams.get(team) == team.GetPlayers(true).size())
{
for (Player player : team.GetPlayers(true))
{
addStat(player, "BestTeam", 1, true, false);
}
}
}
}
}

View File

@ -0,0 +1,38 @@
package nautilus.game.arcade.game.games.lobbers.trackers;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.lobbers.kits.KitArmorer;
import nautilus.game.arcade.stats.StatTracker;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
public class TrackerBlastProof extends StatTracker<Game>
{
public TrackerBlastProof(Game game)
{
super(game);
}
@EventHandler(priority = EventPriority.MONITOR)
public void onGameEnd(GameStateChangeEvent event)
{
if (event.GetState() != GameState.End)
return;
if (getGame().getWinners() == null)
return;
for (Player winner : getGame().getWinners())
{
if (getGame().GetKit(winner) instanceof KitArmorer)
{
addStat(winner, "BlastProof", 1, false, false);
}
}
}
}

View File

@ -0,0 +1,69 @@
package nautilus.game.arcade.game.games.lobbers.trackers;
import java.util.HashSet;
import java.util.Set;
import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.stats.StatTracker;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
public class TrackerNoDamage extends StatTracker<Game>
{
private Set<String> _noDamage = new HashSet<String>();
public TrackerNoDamage(Game game)
{
super(game);
}
@EventHandler
public void onGameStart(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Prepare)
return;
for (Player player : getGame().GetPlayers(true))
{
_noDamage.add(player.getName());
}
}
@EventHandler
public void onGameEnd(GameStateChangeEvent event)
{
if (event.GetState() != GameState.End)
return;
for (String name : _noDamage)
{
Player player = UtilPlayer.searchExact(name);
if (player == null || !player.isOnline())
continue;
addStat(player, "JellySkin", 1, true, false);
}
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onDamage(CustomDamageEvent event)
{
if (!getGame().IsLive())
return;
if (event.GetDamageePlayer() == null || !event.GetDamageePlayer().isOnline())
return;
if (_noDamage.contains(event.GetDamageePlayer().getName()))
{
_noDamage.remove(event.GetDamageePlayer().getName());
}
}
}

View File

@ -0,0 +1,26 @@
package nautilus.game.arcade.game.games.lobbers.trackers;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.lobbers.events.TNTThrowEvent;
import nautilus.game.arcade.stats.StatTracker;
import org.bukkit.event.EventHandler;
public class TrackerTNTThrown extends StatTracker<Game>
{
public TrackerTNTThrown(Game game)
{
super(game);
}
@EventHandler
public void onThrow(TNTThrowEvent event)
{
if (!getGame().IsLive())
return;
addStat(event.getPlayer(), "Thrown", 1, false, false);
}
}

View File

@ -84,6 +84,7 @@ public class GameHostManager implements Listener
ultraGames.add(GameType.SneakyAssassins); ultraGames.add(GameType.SneakyAssassins);
ultraGames.add(GameType.TurfWars); ultraGames.add(GameType.TurfWars);
ultraGames.add(GameType.Spleef); ultraGames.add(GameType.Spleef);
ultraGames.add(GameType.Lobbers);
//Hero Games //Hero Games
heroGames.add(GameType.ChampionsDominate); heroGames.add(GameType.ChampionsDominate);