From 15aca5dca9874ddf7858d92148a64e6ede8997b2 Mon Sep 17 00:00:00 2001 From: Sarah Date: Wed, 26 Aug 2015 00:59:28 +0200 Subject: [PATCH 001/113] Making the mob spawning prototype. still have to figure out how to move them properly. --- .../src/mineplex/core/game/GameDisplay.java | 1 + .../src/nautilus/game/arcade/GameType.java | 2 + .../arcade/game/games/typewars/Minion.java | 111 ++++++++++++++++++ .../game/games/typewars/MinionType.java | 65 ++++++++++ .../arcade/game/games/typewars/TypeWars.java | 100 ++++++++++++++++ 5 files changed, 279 insertions(+) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionType.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java index 37d826e6c..82cb8f815 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java @@ -65,6 +65,7 @@ public enum GameDisplay SkywarsTeams("Skywars Teams", "Skywars", Material.FEATHER, (byte)0, GameCategory.TEAM_VARIANT, 53), Lobbers("Bomb Lobbers", Material.FIREBALL, (byte) 0, GameCategory.ARCADE, 54), + TypeWars("Type Wars", Material.BOOK_AND_QUILL, (byte) 0, GameCategory.ARCADE, 55), Event("Mineplex Event", Material.CAKE, (byte)0, GameCategory.EVENT, 999); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java index 875e86e77..387106c6a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java @@ -54,6 +54,7 @@ import nautilus.game.arcade.game.games.survivalgames.SoloSurvivalGames; import nautilus.game.arcade.game.games.survivalgames.TeamSurvivalGames; import nautilus.game.arcade.game.games.tug.Tug; import nautilus.game.arcade.game.games.turfforts.TurfForts; +import nautilus.game.arcade.game.games.typewars.TypeWars; import nautilus.game.arcade.game.games.uhc.UHC; import nautilus.game.arcade.game.games.wither.WitherGame; import nautilus.game.arcade.game.games.wizards.Wizards; @@ -120,6 +121,7 @@ public enum GameType Build(Build.class, GameDisplay.Build), Cards(Cards.class, GameDisplay.Cards), Skywars(SoloSkywars.class, GameDisplay.Skywars), + TypeWars(TypeWars.class, GameDisplay.TypeWars, new GameType[]{GameType.TurfWars}, false), SkywarsTeams(TeamSkywars.class, GameDisplay.SkywarsTeams, new GameType[]{GameType.Skywars}, false), Event(EventGame.class, GameDisplay.Event, new GameType[]{ diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java new file mode 100644 index 000000000..2cf9c6de7 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java @@ -0,0 +1,111 @@ +package nautilus.game.arcade.game.games.typewars; + +import java.util.ArrayList; +import java.util.Collections; + +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; +import nautilus.game.arcade.game.GameTeam; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Snowman; +import org.bukkit.inventory.ItemStack; +import org.bukkit.util.Vector; + +public class Minion +{ + + private static String[] NAMES = new String[]{"Fishing", "Cookie", "Sleeping", "Diamond", "Banana", "Tree House", "Christmas Holidays", "Tree", "Egg", "Cat"}; + + private MinionType _type; + private Entity _entity; + private String _name; + private Location _location; + private Location _target; + private GameTeam _team; + private Player _player; + private int _money; + + public Minion(Location location, Location target, GameTeam team) + { + this(location, target, team, null, true); + } + + public Minion(Location location, Location target, GameTeam team, Player player, boolean spawn) + { + _type = randomType(); + _entity = null; + _team = team; + _player = player; + _money = Math.max(UtilMath.r(_type.getMaxmoney()), _type.getMinMoney()); + + ArrayList tempList = new ArrayList<>(); + for(String names : NAMES) + tempList.add(names); + + Collections.shuffle(tempList); + for(String str : tempList) + { + if(str.length() >= _type.getMinName() && str.length() <= _type.getMaxName()) + _name = str; + } + _location = location; + _target = target; + if(spawn) + spawnMinion(); + } + + public void spawnMinion() + { + _entity = _location.getWorld().spawn(_location, _type.getType().getEntityClass()); + try + { + _type.getType().getEntityClass().getMethod("setCustomName", String.class).invoke(_entity, _name); + _type.getType().getEntityClass().getMethod("setRemoveWhenFarAway", boolean.class).invoke(_entity, false); + _type.getType().getEntityClass().getMethod("setCustomNameVisible", boolean.class).invoke(_entity, true); + } + catch (Exception e) + { + e.printStackTrace(); + } + equipMinion(); + path(); + } + + private Material[] _items = new Material[]{Material.DIAMOND_AXE, Material.IRON_SWORD, Material.CARROT, Material.STONE_SPADE, Material.GOLD_PICKAXE, Material.AIR}; + + private void equipMinion() + { + try + { + ((CraftLivingEntity) _entity).getEquipment().setHelmet(new ItemStack(Material.LEATHER_HELMET)); + ((CraftLivingEntity) _entity).getEquipment().setItemInHand(new ItemStack(_items[UtilMath.r(_items.length)])); + } + catch(Exception e) {} + } + + private void path() + { + UtilEnt.Vegetate(_entity); + UtilEnt.silence(_entity, true); + UtilEnt.ghost(_entity, true, false); + UtilEnt.CreatureMoveFast(_entity, _target, _type.getWalkSpeed()); + } + + private MinionType randomType() + { + int rdm = UtilMath.r(MinionType.values().length); + for(MinionType type : MinionType.values()) + { + if(type.ordinal() == rdm) + return type; + } + return null; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionType.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionType.java new file mode 100644 index 000000000..be6606d07 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionType.java @@ -0,0 +1,65 @@ +package nautilus.game.arcade.game.games.typewars; + +import org.bukkit.entity.EntityType; + +public enum MinionType +{ + + ZOMBIE(EntityType.ZOMBIE, 9, 12, 1, 2, 3), + //SILVERFISH(EntityType.SILVERFISH, 3, 8, 2, 1, 2), + SKELETON(EntityType.SKELETON, 9, 12, 1, 2, 3), + IRON_GOLEM(EntityType.IRON_GOLEM, 13, 18, (float) 0.5, 4, 6), + BAT(EntityType.BAT, 3, 8, 2, 1, 2), + CREEPER(EntityType.CREEPER, 9, 12, 1, 2, 3), + SNOW_GOLEM(EntityType.SNOWMAN, 9, 12, 1, 2, 3); + //BLAZE(EntityType.BLAZE, 9, 12, 1, 2, 3), + //ENDERMAN(EntityType.ENDERMAN, 13, 18, (float) 0.5, 4, 6); + + private EntityType _type; + private int _minName; + private int _maxName; + private float _walkSpeed; + private int _minMoney; + private int _maxMoney; + + private MinionType(EntityType type, int minName, int maxName, float walkSpeed, int minMoney, int maxMoney) + { + _type = type; + _minName = minName; + _maxName = maxName; + _walkSpeed = walkSpeed; + _minMoney = minMoney; + _maxMoney = maxMoney; + } + + public EntityType getType() + { + return _type; + } + + public int getMinName() + { + return _minName; + } + + public int getMaxName() + { + return _maxName; + } + + public float getWalkSpeed() + { + return _walkSpeed; + } + + public int getMinMoney() + { + return _minMoney; + } + + public int getMaxmoney() + { + return _maxMoney; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java new file mode 100644 index 000000000..4b718553d --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -0,0 +1,100 @@ +package nautilus.game.arcade.game.games.typewars; + +import java.util.ArrayList; + +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilTime; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +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.kit.Kit; + +import org.bukkit.entity.Player; +import org.bukkit.entity.Wither; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityTargetLivingEntityEvent; + +public class TypeWars extends TeamGame +{ + + private ArrayList _activeMinions; + + private long _lastSpawned; + private long _timeToSpawn; + + public TypeWars(ArcadeManager manager) + { + super(manager, GameType.TypeWars, new Kit[]{}, new String[] + { + "Type as fast as you can", + "to kill the evil minions." + }); + + this.DeathOut = false; + this.DamageTeamSelf = false; + this.DamageSelf = false; + this.DamageTeamOther = false; + this.DeathSpectateSecs = 0; + this.HungerSet = 20; + this.WorldBoundaryKill = true; + this.CompassEnabled = false; + this.TeamArmor = true; + this.TeamArmorHotbar = false; + this.WorldTimeSet = 6000; + this.DamageEvP = false; + this.DamagePvE = false; + this.DamagePvP = false; + + _activeMinions = new ArrayList(); + _timeToSpawn = 2500; + } + + @EventHandler + public void stateChange(GameStateChangeEvent event) + { + for (Player player : GetPlayers(true)) + player.setAllowFlight(true); + + if(event.GetState() != GameState.Live) + return; + + _lastSpawned = System.currentTimeMillis(); + } + + @EventHandler + public void spawnMinions(UpdateEvent event) + { + if(event.getType() != UpdateType.TICK) + return; + + if(!IsLive()) + return; + + if(UtilTime.elapsed(_lastSpawned, _timeToSpawn)) + { + _lastSpawned = System.currentTimeMillis(); + this.CreatureAllowOverride = true; + + for(GameTeam teams : GetTeamList()) + { + for(GameTeam team : GetTeamList()) + { + if(teams != team) + { + _activeMinions.add(new Minion(teams.GetSpawns().get(0), team.GetSpawns().get(0), teams)); + } + } + } + + this.CreatureAllowOverride = false; + + if(_timeToSpawn > 1000) + _timeToSpawn = _timeToSpawn - 100; + } + } + +} From 2a236684ac59e1d76ba0ee9ed581fbd3534db383 Mon Sep 17 00:00:00 2001 From: Sarah Date: Fri, 28 Aug 2015 14:47:49 +0200 Subject: [PATCH 002/113] Finalizing prototype of Type wars. --- .../src/nautilus/game/arcade/GameType.java | 2 +- .../arcade/game/games/typewars/Minion.java | 194 ++++++++++-- .../game/games/typewars/MinionType.java | 55 +++- .../arcade/game/games/typewars/TypeWars.java | 284 +++++++++++++++++- .../game/games/typewars/kits/KitTyper.java | 42 +++ .../nautilus/game/arcade/world/WorldData.java | 5 + 6 files changed, 534 insertions(+), 48 deletions(-) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTyper.java diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java index 387106c6a..35f65ab42 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java @@ -99,6 +99,7 @@ public enum GameType Runner(Runner.class, GameDisplay.Runner), SearchAndDestroy(SearchAndDestroy.class, GameDisplay.SearchAndDestroy), Sheep(SheepGame.class, GameDisplay.Sheep), + TypeWars(TypeWars.class, GameDisplay.TypeWars), Smash(SoloSuperSmash.class, GameDisplay.Smash), SmashDomination(SuperSmashDominate.class, GameDisplay.SmashDomination), @@ -121,7 +122,6 @@ public enum GameType Build(Build.class, GameDisplay.Build), Cards(Cards.class, GameDisplay.Cards), Skywars(SoloSkywars.class, GameDisplay.Skywars), - TypeWars(TypeWars.class, GameDisplay.TypeWars, new GameType[]{GameType.TurfWars}, false), SkywarsTeams(TeamSkywars.class, GameDisplay.SkywarsTeams, new GameType[]{GameType.Skywars}, false), Event(EventGame.class, GameDisplay.Event, new GameType[]{ diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java index 2cf9c6de7..cb2962e4e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java @@ -3,25 +3,37 @@ package nautilus.game.arcade.game.games.typewars; import java.util.ArrayList; import java.util.Collections; -import mineplex.core.common.util.UtilAction; 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.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilServer; +import mineplex.core.disguise.disguises.DisguiseBase; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.GameTeam; +import org.bukkit.Color; +import org.bukkit.FireworkEffect.Type; import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity; +import org.bukkit.entity.Creeper; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; -import org.bukkit.entity.Snowman; +import org.bukkit.event.EventHandler; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; import org.bukkit.inventory.ItemStack; -import org.bukkit.util.Vector; -public class Minion +public class Minion implements Listener { private static String[] NAMES = new String[]{"Fishing", "Cookie", "Sleeping", "Diamond", "Banana", "Tree House", "Christmas Holidays", "Tree", "Egg", "Cat"}; + private ArcadeManager _manager; + private MinionType _type; private Entity _entity; private String _name; @@ -29,19 +41,34 @@ public class Minion private Location _target; private GameTeam _team; private Player _player; + private Player _killer; private int _money; + private boolean _spawned; - public Minion(Location location, Location target, GameTeam team) + private boolean _die; + private boolean _killed; + private int _frame; + + public Minion(ArcadeManager manager, Location location, Location target, GameTeam team) { - this(location, target, team, null, true); + this(manager, location, target, team, null, true, null); } - public Minion(Location location, Location target, GameTeam team, Player player, boolean spawn) + public Minion(ArcadeManager manager, Location location, Location target, GameTeam team, Player player, boolean spawn, MinionType type) { - _type = randomType(); + _manager = manager; + + _type = type; + if(_type == null) + _type = randomType(); + + _die = false; + _killed = false; + _frame = 0; _entity = null; _team = team; _player = player; + _killer = null; _money = Math.max(UtilMath.r(_type.getMaxmoney()), _type.getMinMoney()); ArrayList tempList = new ArrayList<>(); @@ -56,37 +83,40 @@ public class Minion } _location = location; _target = target; + _spawned = false; if(spawn) spawnMinion(); } public void spawnMinion() - { - _entity = _location.getWorld().spawn(_location, _type.getType().getEntityClass()); - try - { - _type.getType().getEntityClass().getMethod("setCustomName", String.class).invoke(_entity, _name); - _type.getType().getEntityClass().getMethod("setRemoveWhenFarAway", boolean.class).invoke(_entity, false); - _type.getType().getEntityClass().getMethod("setCustomNameVisible", boolean.class).invoke(_entity, true); - } - catch (Exception e) - { - e.printStackTrace(); - } - equipMinion(); + { + _entity = _location.getWorld().spawn(_location, Creeper.class); + Creeper creeper = (Creeper) _entity; + creeper.setRemoveWhenFarAway(false); + disguiseCreeper(); path(); + _spawned = true; } private Material[] _items = new Material[]{Material.DIAMOND_AXE, Material.IRON_SWORD, Material.CARROT, Material.STONE_SPADE, Material.GOLD_PICKAXE, Material.AIR}; - - private void equipMinion() + + private void disguiseCreeper() { try { - ((CraftLivingEntity) _entity).getEquipment().setHelmet(new ItemStack(Material.LEATHER_HELMET)); - ((CraftLivingEntity) _entity).getEquipment().setItemInHand(new ItemStack(_items[UtilMath.r(_items.length)])); + Object disguise = _type.getDisguiseClass().getConstructors()[0].newInstance(_entity); + Class clazz = _type.getDisguiseClass(); + clazz.getMethod("setName", String.class).invoke(disguise, _team.GetColor() + _name); + clazz.getMethod("setCustomNameVisible", boolean.class).invoke(disguise, true); + try + { + clazz.getMethod("setHelmet", ItemStack.class).invoke(disguise, new ItemStack(Material.LEATHER_HELMET)); + clazz.getMethod("setHeldItem", ItemStack.class).invoke(disguise, new ItemStack(_items[UtilMath.r(_items.length)])); + } + catch (Exception e) {} + _manager.GetDisguise().disguise((DisguiseBase)disguise); } - catch(Exception e) {} + catch (Exception e) {} } private void path() @@ -94,7 +124,6 @@ public class Minion UtilEnt.Vegetate(_entity); UtilEnt.silence(_entity, true); UtilEnt.ghost(_entity, true, false); - UtilEnt.CreatureMoveFast(_entity, _target, _type.getWalkSpeed()); } private MinionType randomType() @@ -108,4 +137,113 @@ public class Minion return null; } + public void despawn(Player player, boolean killed) + { + _killed = killed; + _player = player; + _die = true; + _entity.remove(); + } + + @EventHandler + public void animation(UpdateEvent event) + { + if(event.getType() != UpdateType.TICK) + return; + + if(!_die) + return; + + if(_killed) + { + if(_frame <= 1) + { + UtilFirework.playFirework(_entity.getLocation().add(0.5, 0.5, 0.5), Type.BALL_LARGE, Color.RED, true, true); + } + if(_frame <= 30) + { + double radius = _frame / 20D; + int particleAmount = _frame / 2; + for (int i = 0; i < particleAmount; i++) + { + double xDiff = Math.sin(i/(double)particleAmount * 2 * Math.PI) * radius; + double zDiff = Math.cos(i/(double)particleAmount * 2 * Math.PI) * radius; + + Location location = _entity.getLocation().add(0.5, 0, 0.5).clone().add(xDiff, -1.3, zDiff); + UtilParticle.PlayParticle(UtilParticle.ParticleType.WITCH_MAGIC, location, 0, 0, 0, 0, 1, + ViewDist.NORMAL, UtilServer.getPlayers()); + } + } + } + else + { + if(_frame <= 1) + { + UtilFirework.playFirework(_entity.getLocation().add(0.5, 0.5, 0.5), Type.BALL_LARGE, Color.GREEN, true, true); + } + if(_frame <= 30) + { + double radius = _frame / 20D; + int particleAmount = _frame / 2; + for (int i = 0; i < particleAmount; i++) + { + double xDiff = Math.sin(i/(double)particleAmount * 2 * Math.PI) * radius; + double zDiff = Math.cos(i/(double)particleAmount * 2 * Math.PI) * radius; + + Location location = _entity.getLocation().add(0.5, 0, 0.5).clone().add(xDiff, -1.3, zDiff); + UtilParticle.PlayParticle(UtilParticle.ParticleType.HAPPY_VILLAGER, location, 0, 0, 0, 0, 1, + ViewDist.NORMAL, UtilServer.getPlayers()); + } + } + } + + if(_frame == 31) + { + _die = false; + HandlerList.unregisterAll(this); + } + + _frame++; + } + + public Location getTarget() + { + return _target; + } + + public boolean isSpawned() + { + return _spawned; + } + + public Entity getEntity() + { + return _entity; + } + + public MinionType getType() + { + return _type; + } + + public int getMoney() + { + return _money; + } + + public Player getPlayer() + { + return _player; + } + + public GameTeam getTeam() + { + return _team; + } + + public String getName() + { + return _name; + } + } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionType.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionType.java index be6606d07..418af6857 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionType.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionType.java @@ -1,19 +1,33 @@ package nautilus.game.arcade.game.games.typewars; +import mineplex.core.disguise.disguises.DisguiseBase; +import mineplex.core.disguise.disguises.DisguiseCreeper; +import mineplex.core.disguise.disguises.DisguiseEnderman; +import mineplex.core.disguise.disguises.DisguiseHorse; +import mineplex.core.disguise.disguises.DisguiseIronGolem; +import mineplex.core.disguise.disguises.DisguiseMagmaCube; +import mineplex.core.disguise.disguises.DisguiseSkeleton; +import mineplex.core.disguise.disguises.DisguiseSlime; +import mineplex.core.disguise.disguises.DisguiseWolf; +import mineplex.core.disguise.disguises.DisguiseZombie; + +import org.bukkit.Material; import org.bukkit.entity.EntityType; public enum MinionType { - ZOMBIE(EntityType.ZOMBIE, 9, 12, 1, 2, 3), - //SILVERFISH(EntityType.SILVERFISH, 3, 8, 2, 1, 2), - SKELETON(EntityType.SKELETON, 9, 12, 1, 2, 3), - IRON_GOLEM(EntityType.IRON_GOLEM, 13, 18, (float) 0.5, 4, 6), - BAT(EntityType.BAT, 3, 8, 2, 1, 2), - CREEPER(EntityType.CREEPER, 9, 12, 1, 2, 3), - SNOW_GOLEM(EntityType.SNOWMAN, 9, 12, 1, 2, 3); - //BLAZE(EntityType.BLAZE, 9, 12, 1, 2, 3), - //ENDERMAN(EntityType.ENDERMAN, 13, 18, (float) 0.5, 4, 6); + ZOMBIE(DisguiseZombie.class ,EntityType.ZOMBIE, 9, 12, (float) 1.5, 2, 3, 4, Material.ROTTEN_FLESH), + SKELETON(DisguiseSkeleton.class ,EntityType.SKELETON, 9, 12, (float) 1.5, 2, 3, 4, Material.BONE), + CREEPER(DisguiseCreeper.class ,EntityType.CREEPER, 9, 12, (float) 1.5, 2, 3, 4, Material.SULPHUR), + WOLF(DisguiseWolf.class ,EntityType.WOLF, 3, 8, 2, 1, 2, 3, Material.COOKED_BEEF), + SLIME(DisguiseSlime.class ,EntityType.SLIME, 3, 8, 2, 1, 2, 3, Material.SLIME_BALL), + CUBE(DisguiseMagmaCube.class ,EntityType.MAGMA_CUBE, 3, 8, 2, 1, 2, 3, Material.MAGMA_CREAM), + IRON_GOLEM(DisguiseIronGolem.class ,EntityType.IRON_GOLEM, 13, 18, 1, 4, 6, 8, Material.IRON_INGOT), + HORSE(DisguiseHorse.class ,EntityType.HORSE, 13, 18, 1, 4, 6, 8, Material.APPLE), + ENDERMAN(DisguiseEnderman.class ,EntityType.ENDERMAN, 13, 18, 1, 4, 6, 8, Material.ENDER_STONE); + + private Class _disguiseClass; private EntityType _type; private int _minName; @@ -22,14 +36,20 @@ public enum MinionType private int _minMoney; private int _maxMoney; - private MinionType(EntityType type, int minName, int maxName, float walkSpeed, int minMoney, int maxMoney) + private int _cost; + private Material _displayItem; + + private MinionType(Class disguiseClass, EntityType type, int minName, int maxName, float walkSpeed, int minMoney, int maxMoney, int cost, Material displayItem) { + _disguiseClass = disguiseClass; _type = type; _minName = minName; _maxName = maxName; _walkSpeed = walkSpeed; _minMoney = minMoney; _maxMoney = maxMoney; + _cost = cost; + _displayItem = displayItem; } public EntityType getType() @@ -62,4 +82,19 @@ public enum MinionType return _maxMoney; } + public int getCost() + { + return _cost; + } + + public Material getDisplayItem() + { + return _displayItem; + } + + public Class getDisguiseClass() + { + return _disguiseClass; + } + } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index 4b718553d..e6212148d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -1,8 +1,16 @@ package nautilus.game.arcade.game.games.typewars; import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilTime; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -11,24 +19,39 @@ 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.typewars.kits.KitTyper; import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.world.WorldData; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Material; import org.bukkit.entity.Player; -import org.bukkit.entity.Wither; import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityTargetLivingEntityEvent; +import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.PlayerInteractEvent; public class TypeWars extends TeamGame { private ArrayList _activeMinions; + private ArrayList _deadMinions; + private ArrayList _finishedMinions; + + private HashMap _moneyMap; private long _lastSpawned; private long _timeToSpawn; + private HashMap> _minionSpawns; + public TypeWars(ArcadeManager manager) { - super(manager, GameType.TypeWars, new Kit[]{}, new String[] + super(manager, GameType.TypeWars, + new Kit[]{ + new KitTyper(manager) + }, + new String[] { "Type as fast as you can", "to kill the evil minions." @@ -49,22 +72,106 @@ public class TypeWars extends TeamGame this.DamagePvE = false; this.DamagePvP = false; - _activeMinions = new ArrayList(); - _timeToSpawn = 2500; + _activeMinions = new ArrayList<>(); + _deadMinions = new ArrayList<>(); + _finishedMinions = new ArrayList<>(); + _minionSpawns = new HashMap<>(); + _moneyMap = new HashMap<>(); + _timeToSpawn = 5000; + } + + private void initSpawns() + { + WorldData data = WorldData; + int i = 0; + for(String string : data.GetAllDataLocs().keySet()) + { + System.out.println("Hi"); + _minionSpawns.put(GetTeamList().get(i), data.GetDataLocs(string)); + i++; + if(i > GetTeamList().size()) + return; + } } @EventHandler public void stateChange(GameStateChangeEvent event) { for (Player player : GetPlayers(true)) - player.setAllowFlight(true); + { + UtilAction.velocity(player, 0.1, 0.1, 0.1, false); + _moneyMap.put(player, 0); + } if(event.GetState() != GameState.Live) return; + initSpawns(); + _lastSpawned = System.currentTimeMillis(); } + @EventHandler + public void Players(UpdateEvent event) + { + + if(GetState() != GameState.Live) + return; + + for(Player player : GetPlayers(true)) + { + player.setAllowFlight(true); + player.setFlying(true); + player.setLevel(_moneyMap.get(player)); + + for(Minion minion : _activeMinions) + { + if(UtilMath.offset(minion.getEntity().getLocation(), player.getLocation()) < 1) + { + UtilAction.velocity(player, UtilAlg.getTrajectory(minion.getEntity().getLocation(), player.getLocation()), 1, true, 1, 1, 1, true); + } + } + } + } + + @EventHandler + public void interact(PlayerInteractEvent event) + { + if(event.getItem() == null) + return; + + if(GetState() != GameState.Live) + return; + + for(MinionType type : MinionType.values()) + { + if(type.getDisplayItem() == event.getItem().getType()) + { + if(type.getCost() > _moneyMap.get(event.getPlayer())) + { + UtilPlayer.message(event.getPlayer(), F.main("Game", "You dont have enough money to spawn this Minion.")); + return; + } + GameTeam teams = GetTeam(event.getPlayer()); + for(GameTeam team : GetTeamList()) + { + if(teams != team) + { + this.CreatureAllowOverride = true; + _moneyMap.put(event.getPlayer(), _moneyMap.get(event.getPlayer()) - type.getCost()); + UtilPlayer.message(event.getPlayer(), F.main("Game", "You bought a Minion.")); + int rdm = UtilMath.r(_minionSpawns.get(teams).size()); + Minion minion = new Minion(Manager, _minionSpawns.get(teams).get(rdm), _minionSpawns.get(team).get(rdm), teams, event.getPlayer(), true, type); + Bukkit.getPluginManager().registerEvents(minion, Manager.getPlugin()); + _activeMinions.add(minion); + this.CreatureAllowOverride = false; + } + } + return; + } + } + } + @EventHandler public void spawnMinions(UpdateEvent event) { @@ -85,16 +192,175 @@ public class TypeWars extends TeamGame { if(teams != team) { - _activeMinions.add(new Minion(teams.GetSpawns().get(0), team.GetSpawns().get(0), teams)); + int rdm = UtilMath.r(_minionSpawns.get(teams).size()); + Minion minion = new Minion(Manager, _minionSpawns.get(teams).get(rdm), _minionSpawns.get(team).get(rdm), teams); + Bukkit.getPluginManager().registerEvents(minion, Manager.getPlugin()); + _activeMinions.add(minion); } } } this.CreatureAllowOverride = false; - if(_timeToSpawn > 1000) - _timeToSpawn = _timeToSpawn - 100; + if(_timeToSpawn > 2000) + _timeToSpawn = _timeToSpawn - 75; } } + @EventHandler + public void moveMinions(UpdateEvent event) + { + if(event.getType() != UpdateType.TICK) + return; + + if(GetState() != GameState.Live) + return; + + Iterator minionIterator = _activeMinions.iterator(); + + while(minionIterator.hasNext()) + { + Minion minion = minionIterator.next(); + + if(minion.isSpawned()) + { + if(!UtilEnt.CreatureMoveFast(minion.getEntity(), minion.getTarget(), minion.getType().getWalkSpeed())) + { + minionIterator.remove(); + minion.despawn(null, false); + _finishedMinions.add(minion); + } + } + } + } + + public int getScore(GameTeam team) + { + int i = 0; + for(Minion minion : _finishedMinions) + { + if(minion.getTeam() == team) + i++; + } + return i; + } + + @EventHandler + public void chatCheck(AsyncPlayerChatEvent event) + { + if(!GetPlayers(true).contains(event.getPlayer())) + return; + + Minion minion = getFarestMininion(event.getPlayer(), event.getMessage()); + + if(minion == null) + return; + + event.setCancelled(true); + minion.despawn(event.getPlayer(), true); + _activeMinions.remove(minion); + _deadMinions.add(minion); + UtilPlayer.message(event.getPlayer(), F.main("Game", "You killed the "+ "Minion " + C.cYellow + "\"" + minion.getName() + "\"" + C.cGray + " and got " + minion.getMoney() + "$")); + _moneyMap.put(event.getPlayer(), _moneyMap.get(event.getPlayer()) + minion.getMoney()); + return; + } + + private Minion getFarestMininion(Player player, String msg) + { + for(Minion minion : _activeMinions) + { + if(!minion.getName().equalsIgnoreCase(msg)) + continue; + + if(GetTeam(player) == minion.getTeam()) + continue; + + boolean found = true; + + for(Minion otherMinion : _activeMinions) + { + if(minion == otherMinion) + continue; + + if(!otherMinion.getName().equalsIgnoreCase(msg)) + continue; + + if(GetTeam(player) == otherMinion.getTeam()) + continue; + + if(UtilMath.offset(minion.getEntity().getLocation(), minion.getTarget()) > UtilMath.offset(otherMinion.getEntity().getLocation(), otherMinion.getTarget())) + found = false; + } + + if(found) + return minion; + else + continue; + } + return null; + } + + @Override + public void EndCheck() + { + if (!IsLive()) + return; + + ArrayList winners = new ArrayList<>(); + + for(GameTeam team : GetTeamList()) + { + if(getScore(team) >= 11) + { + winners.add(team); + } + } + + if(winners.isEmpty()) + return; + + GameTeam winner = winners.get(UtilMath.r(winners.size())); + AnnounceEnd(winner); + + for (GameTeam team : GetTeamList()) + { + if (WinnerTeam != null && team.equals(WinnerTeam)) + { + for (Player player : team.GetPlayers(false)) + AddGems(player, 10, "Winning Team", false, false); + } + + for (Player player : team.GetPlayers(false)) + if (player.isOnline()) + AddGems(player, 10, "Participation", false, false); + } + + //End + SetState(GameState.End); + } + + @Override + @EventHandler + public void ScoreboardUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (GetTeamList().isEmpty()) + return; + + Scoreboard.Reset(); + + Scoreboard.WriteBlank(); + + for(GameTeam team : GetTeamList()) + { + Scoreboard.Write(team.GetColor() + C.Bold + team.GetName()); + Scoreboard.Write(team.GetColor() + "Score: " + getScore(team)); + Scoreboard.WriteBlank(); + } + + Scoreboard.Draw(); + } + } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTyper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTyper.java new file mode 100644 index 000000000..da56dfbfe --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTyper.java @@ -0,0 +1,42 @@ +package nautilus.game.arcade.game.games.typewars.kits; + +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.typewars.MinionType; +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.inventory.ItemStack; + +public class KitTyper extends Kit +{ + + public KitTyper(ArcadeManager manager) + { + super(manager, "Typer", KitAvailability.Free, + + new String[] + { + "This fast typer can buy Minions with earned money." + }, + new Perk[] + {}, EntityType.ZOMBIE, new ItemStack(Material.FEATHER)); + } + + @Override + public void GiveItems(Player player) + { + int i = 0; + for(MinionType type : MinionType.values()) + { + player.getInventory().setItem(i, ItemStackFactory.Instance.CreateStack(type.getDisplayItem(), (byte) 0, 1, C.cYellow + "Spawn " + type.getType().getName(), new String[]{C.cGreen + "Cost: " + type.getCost()})); + i++; + } + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/WorldData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/WorldData.java index e584708fc..5d42c6116 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/WorldData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/WorldData.java @@ -542,6 +542,11 @@ public class WorldData { return CustomLocs; } + + public HashMap> GetAllDataLocs() + { + return DataLocs; + } public Location GetRandomXZ() { From ccc9645c47f2cefa50816ae21b631c2c014ba0af Mon Sep 17 00:00:00 2001 From: Sarah Date: Sat, 29 Aug 2015 00:24:44 +0200 Subject: [PATCH 003/113] adding hotbar text. --- .../game/arcade/game/games/typewars/TypeWars.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index e6212148d..b6cb7391c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -11,6 +11,7 @@ import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTextBottom; import mineplex.core.common.util.UtilTime; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -123,6 +124,9 @@ public class TypeWars extends TeamGame player.setAllowFlight(true); player.setFlying(true); player.setLevel(_moneyMap.get(player)); + Minion firstMinion = getFarestMininion(player, null); + if(firstMinion != null) + UtilTextBottom.display(firstMinion.getTeam().GetColor() + firstMinion.getName(), player); for(Minion minion : _activeMinions) { @@ -269,7 +273,7 @@ public class TypeWars extends TeamGame { for(Minion minion : _activeMinions) { - if(!minion.getName().equalsIgnoreCase(msg)) + if(msg != null && !minion.getName().equalsIgnoreCase(msg)) continue; if(GetTeam(player) == minion.getTeam()) @@ -282,7 +286,7 @@ public class TypeWars extends TeamGame if(minion == otherMinion) continue; - if(!otherMinion.getName().equalsIgnoreCase(msg)) + if(msg != null && !otherMinion.getName().equalsIgnoreCase(msg)) continue; if(GetTeam(player) == otherMinion.getTeam()) From 0f37829b54026c3ad1b761bb27e2729bea64f067 Mon Sep 17 00:00:00 2001 From: Sarah Date: Sat, 29 Aug 2015 00:56:24 +0200 Subject: [PATCH 004/113] changing Hotbar text to money. --- .../nautilus/game/arcade/game/games/typewars/TypeWars.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index b6cb7391c..106bb985e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -123,10 +123,7 @@ public class TypeWars extends TeamGame { player.setAllowFlight(true); player.setFlying(true); - player.setLevel(_moneyMap.get(player)); - Minion firstMinion = getFarestMininion(player, null); - if(firstMinion != null) - UtilTextBottom.display(firstMinion.getTeam().GetColor() + firstMinion.getName(), player); + UtilTextBottom.display(C.cGreen + "You have " + _moneyMap.get(player) + "$", player); for(Minion minion : _activeMinions) { From 353c55358950eac67a7512f1e877ba49a93daa47 Mon Sep 17 00:00:00 2001 From: Sarah Date: Sun, 13 Sep 2015 10:00:18 +0200 Subject: [PATCH 005/113] Adding more Words, Removing some Minion types and changing Items in Hotbar. --- .../arcade/game/games/typewars/Minion.java | 121 +++++++++++++++++- .../game/games/typewars/MinionType.java | 18 +-- .../arcade/game/games/typewars/TypeWars.java | 33 +++++ .../game/games/typewars/kits/KitTyper.java | 4 +- 4 files changed, 164 insertions(+), 12 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java index cb2962e4e..97ae7cbaf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java @@ -30,7 +30,126 @@ import org.bukkit.inventory.ItemStack; public class Minion implements Listener { - private static String[] NAMES = new String[]{"Fishing", "Cookie", "Sleeping", "Diamond", "Banana", "Tree House", "Christmas Holidays", "Tree", "Egg", "Cat"}; + private static String[] NAMES = new String[]{"Fishing", "Cookie", "Sleeping", "Diamond", "Banana", "Tree House", "Christmas Holidays", "Tree", "Egg", "Cat", + "Quadrilateral", "Rollercoaster", "Hallucinating", "Advertisement", "Entertainment", "Administrator", "Intergalactic", "International", "Understanding", "Investigation", + "Veterinarian", "Photographer", "Cheeseburger", "Civilization", "Tranquilizer", "Conversation", "EnderDragon", "Engineering", "Philippines", "Countryside", + "Electricity", "Caterpillar", "Keyboarding", "Agriculture", "Mathematics", "Millimeters", "Centimeters", "Screwdriver", "Achievement", "Necromancer", + "Grasshopper", "Quadrillion", "Horseradish", "Aboveground", "Belowground", "Mississippi", "Computerize", "Hibernation", "Radioactive", "Unfortunate", + "Demonstrate", "Gymnastics", "Toothpaste", "Paraphrase", "Stone Hoe", "Limitless", "Breakfast", "Graveyard", "Philippines", "Countryside", + "Competition", "Management", "Peppermint", "Pyromaniac", "Sandstone", "Vengeance", "Passwords", "Chew", "Philippines", "Countryside", + "Competitive", "Accounting", "Generation", "Mechanized", "Minecraft", "Sprinting", "Beautiful", "Container", "Mayonaise", "Generator", + "Bombardment", "Laboratory", "BlackBerry", "Calculator", "Mushrooms", "Heartbeat", "Authority", "Apartment", "Deception", "Recommend", + "Highlighter", "Incomplete", "Javascript", "Compressor", "Dentistry", "Rectangle", "Exhausted", "Slimeball", "Commander", "Associate", + "Complicated", "Government", "Ceptillion", "Deflection", "Cosmetics", "Trapezoid", "Hamburger", "Raspberry", "Developer", "Accompany", + "Basketball", "Milkshakes", "Antibiotic", "Vocabulary", "Australia", "Dodecagon", "Miniature", "Blueberry", "Historian", "Machinery", + "Volleyball", "Earthquake", "Girlfriend", "Definition", "Christmas", "Hot Sauce", "Cardboard", "Dimension", "Overreact", "Character", + "Television", "Motorcycle", "Despicable", "Contradict", "Chocolate", "Screaming", "Microsoft", "Barbarian", "Backspace", "Knowledge", + "Microphone", "Buccaneers", "Affordable", "Attendance", "Halloween", "Demanding", "Wrestling", "Lightbulb", "Wisconsin", "Secondary", + "Rhinoceros", "Applesauce", "Disconnect", "Protection", "Vacations", "Hopscotch", "Moderator", "Invisible", "Tennessee", "Adjective", + "Chestpiece", "Headphones", "Watermelon", "Reasonless", "Traveling", "Spectator", "Paintball", "Carnivore", "Awareness", "Direction", + "Complicated", "Controller", "Chimpanzee", "Deportment", "Saxophone", "Quadruple", "Champions", "Herbivore", "Unexcused", "Different", + "Antarctica", "Paintbrush", "Newsletter", "Appearance", "Hurricane", "Autopilot", "Architect", "Automatic", "Diplomacy", "Construct", + "Snowflakes", "Typewriter", "Sunglasses", "Occupation", "Piercings", "Principle", "Sharpness", "Performer", "Valentine", "Alternate", + "Strawberry", "Smartwatch", "Horrendous", "Antarctica", "Necklaces", "September", "Trademark", "Miniscule", "Copyright", "Opposable", + "Blackholes", "Minestrike", "California", "Wristwatch", "Evolution", "Microwave", "Dangerous", "Humongous", "Practical", "Imaginary", + "Rocketship", "Deathmatch", "Transplant", "Confusion", "Spaceship", "Eyeshadow", "Afternoon", "Judgement", "Imperfect", "Bonemeal", + "Aquamarine", "Playground", "Inevitable", "Surprised", "Lightning", "Butterfly", "Beekeeper", "Gladiator", "Excessive", "Courages", + "Levitation", "Resistance", "Inflatable", "Newspaper", "Sketching", "Centipede", "Parachute", "Treachery", "Crocodile", "Baseball", + "Vegetables", "Lighthouse", "Relentless", "Dinosaurs", "Teenagers", "Cartwheel", "Barricade", "Blowtorch", "Alligator", "Presents", + "Whispering", "Helicopter", "Mistakable", "Tarantula", "Grassland", "Hard Rock", "President", "Raincloud", "Incentive", "Balloons", + "Announcing", "Mechanical", "Expectance", "Stone Axe", "Mountains", "Pop Music", "Fingertip", "Millenium", "Structure", "Keyboard", + "Meditation", "Toothbrush", "Tumbleweed", "Sandstone", "Dumplings", "Scientist", "Pineapple", "Boyfriend", "Spotlight", "Computer", + "Clothing", "Elephant", "Reptiles", "Scorpion", "Redstone", "Diamonds", "Porkchop", "Endermen", "Obsidian", "Planting", + "Potatoes", "Vampires", "Bracelet", "Coloring", "Thousand", "Hologram", "Lipstick", "Cruising", "Delivery", "Dreaming", + "Minecart", "Werewolf", "Highways", "Painting", "Infinity", "Ancestor", "Eyeliner", "Complete", "Packages", "Thinking", + "Unicorns", "Pumpkins", "Internet", "Toddlers", "Swimming", "Wreckage", "Siblings", "Branches", "Criminal", "Engineer", + "Military", "Costumes", "Earrings", "Children", "Triangle", "Defender", "Baguette", "Politics", "Handsome", "Reindeer", + "Portland", "Chipotle", "Dolphins", "Pre-teen", "Pentagon", "Homework", "Princess", "Citizens", "Gorgeous", "Necklace", + "Penguins", "Sapphire", "Galaxies", "Campfire", "Heptagon", "February", "Alphabet", "Username", "Panthers", "Mineplex", + "Barbecue", "Amethyst", "Cartoons", "Tropical", "Lollipop", "November", "Scissors", "Medicine", "Warriors", "Pallette", + "Mermaids", "Clarinet", "Basement", "Broccoli", "Shouting", "December", "Eternity", "Behavior", "Chatting", "Dominate", + "Assassin", "Elevator", "Weakness", "Blizzard", "Entrance", "Universe", "Teleport", "Director", "Stuffing", "Eruption", + "Godzilla", "Electron", "Strength", "Powerful", "Dynamite", "Backyard", "Gradient", "Producer", "Festival", "Mattress", + "Empoleon", "Building", "Dinosaur", "Illusion", "Mustache", "Ceremony", "Shipment", "Cosmetic", "Applause", "Research", + "Chimchar", "Aquarium", "Sidewalk", "Calendar", "Treasure", "Airplane", "Envelope", "Kangaroo", "Goldfish", "Starfish", + "Nickname", "Slowness", "Official", "Accident", "Cinnamon", "Collapse", "Geometry", "Barnacle", "Football", "Creative", + "Hypnotic", "Antidode", "Emulator", "Foothold", "Friction", "Tungsten", "Tablets", "Torches", "Fairies", "Windows", + "Conquest", "Province", "Overflow", "Graceful", "Negative", "Doctrine", "Charger", "Carrots", "Spirits", "Robbers", + "Karambit", "Solution", "Sandiwch", "Catapult", "Positive", "Firework", "Ukulele", "Dragons", "Cobwebs", "Drawing", + "Internal", "Japanese", "Atronomy", "Villager", "Tranquil", "Compress", "Glasses", "Nursing", "College", "Magenta", + "Trillion", "Standard", "Atrology", "Infringe", "Fortress", "Prisoner", "Daisies", "Soldier", "Courses", "Serpent", + "Carnival", "Parasite", "Porridge", "Variable", "Charcoal", "Decision", "Hazards", "Jupiter", "Buttons", "Camping", + "Concrete", "Carriage", "Pressure", "Practice", "Commerce", "Windmill", "Cheetah", "Mercury", "Octopus", "Canyons", + "Pavement", "Auxilary", "Demolish", "Maintain", "Barbeque", "Parmesan", "Vulture", "America", "Printer", "Seventy", + "Joystick", "Marshall", "Franklin", "Umbrella", "Contract", "Warthog", "Turtles", "Ireland", "Titanic", "Hundred", + "Sppeaker", "Suitcase", "Michigan", "Darkness", "Separate", "Puzzled", "Ocelots", "Germany", "Vanilla", "Million", + "Figurine", "Mandarin", "Arkansas", "Ethernet", "Eligible", "Shocked", "Creeper", "Chillie", "Tornado", "Billion", + "Boundary", "Anteater", "Colorado", "Everyday", "Fraction", "Figures", "Zombies", "Jamaica", "Seaweed", "Twitter", + "Birthday", "Sunshine", "Virginia", "Surprise", "Compound", "Pillows", "Leather", "Bermuda", "Craters", "Waiting", + "Hogwarts", "Particle", "American", "Together", "Precious", "Erasers", "Chicken", "Bahamas", "Meteors", "Passion", + "Walking", "Decagon", "Spatula", "Science", "Bicycle", "Animate", "Cereal", "Graphic", "Message", "Episode", + "Running", "Talking", "Cooking", "Biology", "Sweater", "Cabinet", "Pokemon", "Kingdom", "Funeral", "Destroy", + "Jogging", "Yelling", "Fashion", "Pajamas", "Lettuce", "Furnace", "Chariot", "Package", "Grinder", "Defrost", + "Breathe", "Ladybug", "Brother", "Reflect", "Cheddar", "Bridges", "Spawner", "Exhibit", "Nuclear", "Avocado", + "Muscles", "Envader", "Grandpa", "Confirm", "Speaker", "Wizards", "Stacker", "Feather", "Channel", "Thunder", + "Marbles", "Contest", "Grandma", "History", "Minigun", "Skywars", "Turtwig", "Morning", "Explode", "Factory", + "Polygon", "Teacher", "Royalty", "Balcony", "Android", "Monster", "Emerald", "Primate", "Village", "Company", + "Degrees", "Glacier", "Cricket", "Partner", "Mideval", "Gravity", "Surgeon", "Volcano", "Forward", "Console", + "Hexagon", "Cyclops", "Kung-fu", "Bonjour", "Painter", "Snowman", "Caramel", "Lullaby", "Sparrow", "Blowgun", + "Octagon", "January", "Century", "Bowling", "Plumber", "Explore", "Healing", "Circuit", "Vampire", "Distort", + "Nonagon", "October", "Lockers", "Justice", "England", "Pancake", "Whisper", "Voltage", "Ceramic", "Avenger", + "Bazooka", "Actress", "Highway", "Fighter", "Notepad", "Knuckle", "YouTube", "Fishing", "Florida", "Capsule", + "Missile", "Haircut", "Apricot", "Deathly", "Cracker", "Western", "Colonel", "Balance", "Georgia", "Boolean", + "Pyramid", "Stomach", "Dracula", "Fractal", "Network", "Eastern", "Creator", "Monitor", "Glowing", "Integer", + "Mailbox", "Phantom", "Harpoon", "Endless", "Ketchup", "English", "Sunrise", "Examine", "Blowing", "Perfect", + "Algebra", "Pattern", "Cottage", "Crystal", "Mustard", "Spanish", "Unlucky", "Tragedy", "Deviate", "Builder", + "Penguin", "Emperor", "Amplify", "Hamster", "Paprika", "Chinese", "Shackle", "Kitchen", "Liberty", "Cupcake", + "Robotic", "Fortune", "Gazelle", "Scratch", "Revenge", "Honesty", "Hideout", "Compass", "Italian", "Demoman", + "Machine", "Gymnast", "Balloon", "Country", "Poision", "Brendan", "Connect", "Fireman", "Mexican", "Neptune", + "Aquatic", "Hostage", "Program", "Witness", "Villain", "Virtual", "Supreme", "Platter", "Ukraine", "Profile", + "Hatchet", "Hangers", "Bayonet", "Gamepad", "Bandage", "Blister", "Archive", "Implode", "Hilbert", "Offline", + "Shelter", "Primary", "Organic", "Healthy", "Makeup", "Blazes", "Brazil", "Horror", "Subway", "Babies", + "Capture", "Various", "Gradual", "Rapture", "Pollen", "String", "Warren", "Moving", "Shorts", "Elders", + "Elegant", "Violate", "Heroic", "Violent", "Leaves", "Soccer", "Europe", "School", "Scarfs", "Orange", + "Dentist", "Neglect", "Strong", "Solvent", "Monkey", "Closet", "Africa", "Hotels", "Sharks", "Yellow", + "Combine", "Fulfill", "Barbie", "Engrave", "Rabbit", "Carpet", "Winter", "Zipper", "Whales", "Purple", + "Surface", "Sailing", "Pencil", "Passage", "Kitten", "Satern", "Spring", "Acorns", "Comets", "Graffe", + "Gelatin", "Klarin", "Phones", "Quality", "Ingots", "Uranus", "Summer", "Pariot", "Comedy", "Poison", + "Similar", "Flutter", "Shield", "Psychic", "Spider", "Mexico", "Autumn", "Cruise", "Sports", "Forest", + "Oxidize", "Disease", "Guitar", "Opossum", "Ghasts", "France", "Ghosts", "Lucius", "Cement", "Desert", + "Purpose", "Symptom", "Sticks", "Measure", "Slimes", "Greece", "Spooky", "Coffee", "Aliens", "Cities", + "Bikini", "Mortal", "Serena", "Future", "Bottle", "Helmet", "Crunch", "Afraid", "Threat", "Static", + "Happy", "Knife", "Scary", "Lapis", "Skirt", "Waves", "Calem", "Clock", "Taste", "Lucas", + "Anger", "Spork", "Maike", "Candy", "Shirt", "Tides", "Ocean", "Crawl", "Smell", "React", + "Dolls", "Roses", "Trips", "Flute", "Pants", "Brick", "Three", "Ethan", "Uncle", "Lunch", + "Legos", "Tulip", "Beach", "Wipes", "Heels", "Straw", "Seven", "Hands", "Queen", "Books", + "Couch", "Grass", "Clans", "Frame", "Nails", "Cream", "Eight", "Belly", "Crown", "Polls", + "Vases", "Tiger", "Wagon", "Sleet", "Rings", "Attic", "Forty", "Chest", "Staff", "Hello", + "Sword", "Panda", "Sleep", "Roads", "Money", "Green", "Fifty", "Brush", "Tools", "Howdy", + "Banjo", "Sloth", "X-ray", "Truck", "Coral", "Speed", "Sixty", "Peace", "Music", "Court", + "Drums", "Snake", "Socks", "Plane", "Reefs", "Hilda", "Brown", "Heart", "Lucia", "Raven", + "Spoon", "Boots", "Pearl", "Train", "Horse", "Woods", "Silly", "Lotta", "Month", "Games", + "Love", "Cats", "Lava", "Ship", "Moon", "Five", "Head", "July", "Mask", "Hola", + "Rosa", "Wolf", "Soda", "Ruby", "News", "Nine", "Hair", "Feel", "Jazz", "Soft", + "Toys", "Duck", "Mars", "Mint", "Ufos", "Grey", "Ears", "Hear", "Hour", "Hard", + "Soap", "Ores", "Cuba", "Snow", "Cops", "Derp", "Eyes", "Oven", "Week", "Clay", + "Wigs", "Gold", "Asia", "Rain", "Lime", "Time", "Star", "King", "Year", "Gold", + "Fork", "Iron", "Elfs", "Suit", "Blue", "Tony", "Salt", "Ants", "Nate", "Mind", + "Weed", "Pigs", "Brix", "Blue", "Pink", "Hide", "Kris", "File", "Yard", "Comb", + "Wood", "Lyra", "Frog", "Hats", "Heal", "Feet", "Yoga", "Edit", "Mile", "Paws", + "Bird", "Wool", "Fish", "Eels", "Jump", "Arms", "Boom", "View", "Girl", "Tree", + "Lion", "Dirt", "Yarn", "Dawn", "Four", "Neck", "June", "Help", "Mail", "Lamp", + "Sad", "Sun", "Pan", "Yes", "Dad", "Bat", "Wig", "KFC", "War", "Fan", + "Red", "Jam", "Ivy", "Map", "Fur", "Yen", "Hum", "May", "Dog", + "One", "Day", "Sky", "Add", "Orb", "Hip", "Sew", "Act", "Ice", + "Two", "Gum", "Cow", "Moo", "Bee", "Ape", "Zoo", "Pit", "Hat", + "Six", "Gym", "Rat", "Mow", "Pot", "Dot", "Paw", "Hen", "Bed", + "Ten", "Art", "Bag", "Mob", "End", "Egg", "Saw", "Law", "Fog", + "Fly", "Boy", "Rag", "New", "Jet", "Pet", "Tin", "Pen", "Car", + "Old", "Age", "TNT", "Leg", "Axe", "UFO", "Rap", "Wet", "Tie", + "May", "Gas", "Hue", "Wax", "Toy", "Lay", "Pop", "Dry", "Sea", + "See", "Ash", "Mom", "Box", "Key", "Fat", "Spy", + "why +3?"}; private ArcadeManager _manager; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionType.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionType.java index 418af6857..c42b28a0d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionType.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionType.java @@ -17,15 +17,15 @@ import org.bukkit.entity.EntityType; public enum MinionType { - ZOMBIE(DisguiseZombie.class ,EntityType.ZOMBIE, 9, 12, (float) 1.5, 2, 3, 4, Material.ROTTEN_FLESH), - SKELETON(DisguiseSkeleton.class ,EntityType.SKELETON, 9, 12, (float) 1.5, 2, 3, 4, Material.BONE), - CREEPER(DisguiseCreeper.class ,EntityType.CREEPER, 9, 12, (float) 1.5, 2, 3, 4, Material.SULPHUR), - WOLF(DisguiseWolf.class ,EntityType.WOLF, 3, 8, 2, 1, 2, 3, Material.COOKED_BEEF), - SLIME(DisguiseSlime.class ,EntityType.SLIME, 3, 8, 2, 1, 2, 3, Material.SLIME_BALL), - CUBE(DisguiseMagmaCube.class ,EntityType.MAGMA_CUBE, 3, 8, 2, 1, 2, 3, Material.MAGMA_CREAM), - IRON_GOLEM(DisguiseIronGolem.class ,EntityType.IRON_GOLEM, 13, 18, 1, 4, 6, 8, Material.IRON_INGOT), - HORSE(DisguiseHorse.class ,EntityType.HORSE, 13, 18, 1, 4, 6, 8, Material.APPLE), - ENDERMAN(DisguiseEnderman.class ,EntityType.ENDERMAN, 13, 18, 1, 4, 6, 8, Material.ENDER_STONE); + //ZOMBIE(DisguiseZombie.class ,EntityType.ZOMBIE, 9, 12, (float) 1.5, 2, 3, 4, Material.ROTTEN_FLESH), + SKELETON(DisguiseSkeleton.class ,EntityType.SKELETON, 7, 10, (float) 1.5, 2, 3, 4, Material.BONE), + //CREEPER(DisguiseCreeper.class ,EntityType.CREEPER, 9, 12, (float) 1.5, 2, 3, 4, Material.SULPHUR), + WOLF(DisguiseWolf.class ,EntityType.WOLF, 3, 6, 2, 1, 2, 3, Material.COOKED_BEEF), + //SLIME(DisguiseSlime.class ,EntityType.SLIME, 3, 8, 2, 1, 2, 3, Material.SLIME_BALL), + //CUBE(DisguiseMagmaCube.class ,EntityType.MAGMA_CUBE, 3, 8, 2, 1, 2, 3, Material.MAGMA_CREAM), + IRON_GOLEM(DisguiseIronGolem.class ,EntityType.IRON_GOLEM, 10, 18, 1, 4, 6, 8, Material.IRON_INGOT); + //HORSE(DisguiseHorse.class ,EntityType.HORSE, 13, 18, 1, 4, 6, 8, Material.APPLE), + //ENDERMAN(DisguiseEnderman.class ,EntityType.ENDERMAN, 13, 18, 1, 4, 6, 8, Material.ENDER_STONE); private Class _disguiseClass; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index 106bb985e..5f5f895b4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -12,7 +12,9 @@ import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilTextBottom; +import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTime; +import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; @@ -32,6 +34,8 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.PlayerInteractEvent; +import com.sun.xml.internal.ws.resources.UtilMessages; + public class TypeWars extends TeamGame { @@ -72,6 +76,7 @@ public class TypeWars extends TeamGame this.DamageEvP = false; this.DamagePvE = false; this.DamagePvP = false; + this.TeamArmorHotbar = true; _activeMinions = new ArrayList<>(); _deadMinions = new ArrayList<>(); @@ -262,6 +267,7 @@ public class TypeWars extends TeamGame _activeMinions.remove(minion); _deadMinions.add(minion); UtilPlayer.message(event.getPlayer(), F.main("Game", "You killed the "+ "Minion " + C.cYellow + "\"" + minion.getName() + "\"" + C.cGray + " and got " + minion.getMoney() + "$")); + UtilTextMiddle.display("", C.cGreen + "+" + minion.getMoney() + "$"); _moneyMap.put(event.getPlayer(), _moneyMap.get(event.getPlayer()) + minion.getMoney()); return; } @@ -340,6 +346,33 @@ public class TypeWars extends TeamGame SetState(GameState.End); } + @EventHandler + public void updateHotbarItems(UpdateEvent event) + { + if(!IsLive()) + return; + + if (event.getType() != UpdateType.FASTEST) + return; + + for(Player player : GetPlayers(true)) + { + int i = 4; + for(MinionType type : MinionType.values()) + { + if(_moneyMap.get(player) >= type.getCost()) + { + player.getInventory().setItem(i, ItemStackFactory.Instance.CreateStack(type.getDisplayItem(), (byte) 0, Math.round(_moneyMap.get(player)/type.getCost()), C.cGreen + "Spawn " + type.getType().getName() + " Cost: " + type.getCost())); + } + else + { + player.getInventory().setItem(i, ItemStackFactory.Instance.CreateStack(type.getDisplayItem(), (byte) 0, 0, C.cRed + "Spawn " + type.getType().getName() + " Cost: " + type.getCost())); + } + i++; + } + } + } + @Override @EventHandler public void ScoreboardUpdate(UpdateEvent event) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTyper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTyper.java index da56dfbfe..36fbebd74 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTyper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTyper.java @@ -31,10 +31,10 @@ public class KitTyper extends Kit @Override public void GiveItems(Player player) { - int i = 0; + int i = 4; for(MinionType type : MinionType.values()) { - player.getInventory().setItem(i, ItemStackFactory.Instance.CreateStack(type.getDisplayItem(), (byte) 0, 1, C.cYellow + "Spawn " + type.getType().getName(), new String[]{C.cGreen + "Cost: " + type.getCost()})); + player.getInventory().setItem(i, ItemStackFactory.Instance.CreateStack(type.getDisplayItem(), (byte) 0, 1, C.cYellow + "Spawn " + type.getType().getName() + " Cost: " + type.getCost())); i++; } } From 0a42ab7aee3a2e5bf1b6efaaef0ee4a2dfd8cb60 Mon Sep 17 00:00:00 2001 From: Sarah Date: Wed, 23 Sep 2015 22:04:45 +0200 Subject: [PATCH 006/113] Adding spell system, spells, and more kits. --- .../arcade/game/games/typewars/Minion.java | 85 ++++++-- .../arcade/game/games/typewars/Spell.java | 137 +++++++++++++ .../arcade/game/games/typewars/TypeWars.java | 181 ++++++++++++++++-- .../games/typewars/kits/KitTypeWarsBase.java | 85 ++++++++ .../game/games/typewars/kits/KitTyper.java | 31 ++- .../game/games/typewars/kits/KitWarrior.java | 35 ++++ .../games/typewars/spells/SpellFirebomb.java | 97 ++++++++++ .../typewars/spells/SpellGrowthLiner.java | 136 +++++++++++++ .../typewars/spells/SpellKillEverything.java | 52 +++++ .../games/typewars/spells/SpellSpeedUp.java | 43 +++++ 10 files changed, 838 insertions(+), 44 deletions(-) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Spell.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTypeWarsBase.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitWarrior.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellFirebomb.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellGrowthLiner.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellKillEverything.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellSpeedUp.java diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java index 97ae7cbaf..ab2a9077e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java @@ -161,7 +161,10 @@ public class Minion implements Listener private GameTeam _team; private Player _player; private Player _killer; + private DisguiseBase _disguise; + private Location _lastNameChanged; private int _money; + private float _walkSpeed; private boolean _spawned; private boolean _die; @@ -181,6 +184,7 @@ public class Minion implements Listener if(_type == null) _type = randomType(); + _walkSpeed = _type.getWalkSpeed(); _die = false; _killed = false; _frame = 0; @@ -190,16 +194,8 @@ public class Minion implements Listener _killer = null; _money = Math.max(UtilMath.r(_type.getMaxmoney()), _type.getMinMoney()); - ArrayList tempList = new ArrayList<>(); - for(String names : NAMES) - tempList.add(names); + changeRandomName(_type.getMinName(), _type.getMaxName(), true); - Collections.shuffle(tempList); - for(String str : tempList) - { - if(str.length() >= _type.getMinName() && str.length() <= _type.getMaxName()) - _name = str; - } _location = location; _target = target; _spawned = false; @@ -212,6 +208,8 @@ public class Minion implements Listener _entity = _location.getWorld().spawn(_location, Creeper.class); Creeper creeper = (Creeper) _entity; creeper.setRemoveWhenFarAway(false); + creeper.setMaxHealth(200); + creeper.setHealth(200); disguiseCreeper(); path(); _spawned = true; @@ -288,7 +286,7 @@ public class Minion implements Listener double xDiff = Math.sin(i/(double)particleAmount * 2 * Math.PI) * radius; double zDiff = Math.cos(i/(double)particleAmount * 2 * Math.PI) * radius; - Location location = _entity.getLocation().add(0.5, 0, 0.5).clone().add(xDiff, -1.3, zDiff); + Location location = _entity.getLocation().add(0.5, 0, 0.5).clone().add(xDiff, particleAmount/10, zDiff); UtilParticle.PlayParticle(UtilParticle.ParticleType.WITCH_MAGIC, location, 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers()); } @@ -309,7 +307,7 @@ public class Minion implements Listener double xDiff = Math.sin(i/(double)particleAmount * 2 * Math.PI) * radius; double zDiff = Math.cos(i/(double)particleAmount * 2 * Math.PI) * radius; - Location location = _entity.getLocation().add(0.5, 0, 0.5).clone().add(xDiff, -1.3, zDiff); + Location location = _entity.getLocation().add(0.5, 0, 0.5).clone().add(xDiff, particleAmount/10, zDiff); UtilParticle.PlayParticle(UtilParticle.ParticleType.HAPPY_VILLAGER, location, 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers()); } @@ -325,6 +323,61 @@ public class Minion implements Listener _frame++; } + public void changeName(String name) + { + _name = name; + try + { + Class clazz = _type.getDisguiseClass(); + clazz.getMethod("setName", String.class).invoke(_disguise, _team.GetColor() + _name); + _manager.GetDisguise().disguise((DisguiseBase) _disguise); + } + catch (Exception e) {} + _lastNameChanged = _entity.getLocation(); + } + + public void changeRandomName(int min, int max, boolean spawned) + { + ArrayList tempList = new ArrayList<>(); + for(String names : NAMES) + tempList.add(names); + + Collections.shuffle(tempList); + for(String str : tempList) + { + if(str.length() >= min && str.length() <= max) + if(!spawned) + changeName(str); + else + _name = str; + } + } + + public boolean isNameChangeable() + { + if(_lastNameChanged == null) + return true; + + if(_entity.getLocation().getBlockX() != _lastNameChanged.getBlockX()) + return true; + + if(_entity.getLocation().getBlockZ() != _lastNameChanged.getBlockZ()) + return true; + + return false; + } + + public void setWalkSpeed(float speed) + { + _walkSpeed = speed; + } + + public void increaseWalkSpeed(float speed) + { + float oldSpeed = _walkSpeed; + _walkSpeed = oldSpeed + speed; + } + public Location getTarget() { return _target; @@ -364,5 +417,15 @@ public class Minion implements Listener { return _name; } + + public float getWalkSpeed() + { + return _walkSpeed; + } + + public Location getLastNameChanged() + { + return _lastNameChanged; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Spell.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Spell.java new file mode 100644 index 000000000..be1ffb189 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Spell.java @@ -0,0 +1,137 @@ +package nautilus.game.arcade.game.games.typewars; + +import java.util.ArrayList; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilBlock; +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.UtilShapes; +import mineplex.core.recharge.Recharge; +import nautilus.game.arcade.ArcadeManager; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Player; + +public abstract class Spell +{ + + private ArrayList _playerUses; + + private ArcadeManager _manager; + private TypeWars _typeWars; + private String _name; + private int _cost; + private Material _material; + private Long _recharge; + private boolean _singleUse; + + public Spell(ArcadeManager manager, String name, int cost, Material material, Long recharge, boolean singleUse) + { + _manager = manager; + _name = name; + _cost = cost; + _material = material; + _recharge = recharge; + _singleUse = singleUse; + _playerUses = new ArrayList<>(); + } + + public boolean prepareExecution(Player player) + { + if(isSingleUse()) + { + if(_playerUses.contains(player)) + { + UtilPlayer.message(player, F.main("Game", "You can't use this spell anymore.")); + return false; + } + } + + _typeWars = (TypeWars) _manager.GetGame(); + if(_typeWars.getMoneyMap().get(player) < getCost()) + { + UtilPlayer.message(player, F.main("Game", "You dont have enough Money to use that spell.")); + return false; + } + if(!Recharge.Instance.usable(player, getName(), true)) + return false; + + Location loc = player.getLastTwoTargetBlocks(UtilBlock.blockAirFoliageSet, 80).get(0).getLocation().add(0.5, 0.5, 0.5); + if(trail() != null) + { + for (Location location : UtilShapes.getLinesDistancedPoints(player.getEyeLocation().subtract(0, 0.1, 0), loc, 0.1)) + { + UtilParticle.PlayParticle(trail(), location, 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers()); + } + } + if(hit() != null) + UtilParticle.PlayParticle(hit(), loc, 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers()); + + if(execute(player, loc)) + { + Recharge.Instance.use(player, getName(), getRecharge(), false, true); + int money = ((TypeWars) _manager.GetGame()).getMoneyMap().get(player); + ((TypeWars) _manager.GetGame()).getMoneyMap().put(player, money - getCost()); + if(!_playerUses.contains(player)) + _playerUses.add(player); + + UtilPlayer.message(player, F.main("Game", "You activated the Spell " + F.game(getName()) + " and got charged " + F.game(getCost() + "$") + ".")); + return true; + } + else + { + UtilPlayer.message(player, F.main("Game", "Error while using spell.")); + return false; + } + } + + public abstract ParticleType trail(); + + public ParticleType hit() + { + return ParticleType.EXPLODE; + } + + public abstract boolean execute(Player player, Location location); + + public ArcadeManager getManager() + { + return _manager; + } + + public TypeWars getTypeWars() + { + return _typeWars; + } + + public String getName() + { + return _name; + } + + public int getCost() + { + return _cost; + } + + public Material getMaterial() + { + return _material; + } + + public Long getRecharge() + { + return _recharge; + } + + public boolean isSingleUse() + { + return _singleUse; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index 5f5f895b4..44f4a9266 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -22,7 +22,9 @@ 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.typewars.kits.KitTypeWarsBase; import nautilus.game.arcade.game.games.typewars.kits.KitTyper; +import nautilus.game.arcade.game.games.typewars.kits.KitWarrior; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.world.WorldData; @@ -47,20 +49,24 @@ public class TypeWars extends TeamGame private long _lastSpawned; private long _timeToSpawn; + private HashMap> _lineGrowth; + private HashMap> _lineShorten; private HashMap> _minionSpawns; public TypeWars(ArcadeManager manager) { super(manager, GameType.TypeWars, - new Kit[]{ - new KitTyper(manager) - }, - new String[] - { - "Type as fast as you can", - "to kill the evil minions." - }); + new Kit[] + { + new KitTyper(manager), + new KitWarrior(manager) + }, + new String[] + { + "Type as fast as you can", + "to kill the evil minions." + }); this.DeathOut = false; this.DamageTeamSelf = false; @@ -83,7 +89,9 @@ public class TypeWars extends TeamGame _finishedMinions = new ArrayList<>(); _minionSpawns = new HashMap<>(); _moneyMap = new HashMap<>(); - _timeToSpawn = 5000; + _timeToSpawn = 5000; + _lineGrowth = new HashMap<>(); + _lineShorten = new HashMap<>(); } private void initSpawns() @@ -92,7 +100,6 @@ public class TypeWars extends TeamGame int i = 0; for(String string : data.GetAllDataLocs().keySet()) { - System.out.println("Hi"); _minionSpawns.put(GetTeamList().get(i), data.GetDataLocs(string)); i++; if(i > GetTeamList().size()) @@ -114,6 +121,12 @@ public class TypeWars extends TeamGame initSpawns(); + for(GameTeam team : GetTeamList()) + { + _lineGrowth.put(team, new ArrayList()); + _lineShorten.put(team, new ArrayList()); + } + _lastSpawned = System.currentTimeMillis(); } @@ -230,7 +243,7 @@ public class TypeWars extends TeamGame if(minion.isSpawned()) { - if(!UtilEnt.CreatureMoveFast(minion.getEntity(), minion.getTarget(), minion.getType().getWalkSpeed())) + if(!UtilEnt.CreatureMoveFast(minion.getEntity(), minion.getTarget(), minion.getWalkSpeed())) { minionIterator.remove(); minion.despawn(null, false); @@ -263,15 +276,20 @@ public class TypeWars extends TeamGame return; event.setCancelled(true); - minion.despawn(event.getPlayer(), true); - _activeMinions.remove(minion); - _deadMinions.add(minion); + killMinion(minion, event.getPlayer()); UtilPlayer.message(event.getPlayer(), F.main("Game", "You killed the "+ "Minion " + C.cYellow + "\"" + minion.getName() + "\"" + C.cGray + " and got " + minion.getMoney() + "$")); UtilTextMiddle.display("", C.cGreen + "+" + minion.getMoney() + "$"); _moneyMap.put(event.getPlayer(), _moneyMap.get(event.getPlayer()) + minion.getMoney()); return; } + public void killMinion(Minion minion, Player player) + { + minion.despawn(player, true); + _activeMinions.remove(minion); + _deadMinions.add(minion); + } + private Minion getFarestMininion(Player player, String msg) { for(Minion minion : _activeMinions) @@ -317,7 +335,7 @@ public class TypeWars extends TeamGame for(GameTeam team : GetTeamList()) { - if(getScore(team) >= 11) + if(getScore(team) >= 110) { winners.add(team); } @@ -341,11 +359,33 @@ public class TypeWars extends TeamGame if (player.isOnline()) AddGems(player, 10, "Participation", false, false); } + + Iterator minionIterator = _activeMinions.iterator(); + + while (minionIterator.hasNext()) + { + Minion minion = minionIterator.next(); + minion.despawn(null, true); + minionIterator.remove(); + } //End SetState(GameState.End); } + @EventHandler + public void preventFire(UpdateEvent event) + { + if(event.getType() != UpdateType.TICK) + return; + + Iterator minionIterator = _activeMinions.iterator(); + while(minionIterator.hasNext()) + { + minionIterator.next().getEntity().setFireTicks(0); + } + } + @EventHandler public void updateHotbarItems(UpdateEvent event) { @@ -357,6 +397,23 @@ public class TypeWars extends TeamGame for(Player player : GetPlayers(true)) { + int e = 0; + for(Spell spell : ((KitTypeWarsBase) GetKit(player)).getSpells()) + { + if(_moneyMap.get(player) >= spell.getCost()) + { + if(spell.getCost() > 0) + player.getInventory().setItem(e, ItemStackFactory.Instance.CreateStack(spell.getMaterial(), (byte) 0, Math.round(_moneyMap.get(player)/spell.getCost()), C.cGreen + "Activate " + spell.getName() + " Cost: " + spell.getCost())); + else + player.getInventory().setItem(e, ItemStackFactory.Instance.CreateStack(spell.getMaterial(), (byte) 0, 1, C.cGreen + "Activate " + spell.getName() + " Cost: " + spell.getCost())); + } + else + { + player.getInventory().setItem(e, ItemStackFactory.Instance.CreateStack(spell.getMaterial(), (byte) 0, 0, C.cRed + "Activate " + spell.getName() + " Cost: " + spell.getCost())); + } + e++; + } + int i = 4; for(MinionType type : MinionType.values()) { @@ -373,6 +430,71 @@ public class TypeWars extends TeamGame } } + @EventHandler + public void lines(UpdateEvent event) + { + if(event.getType() != UpdateType.FASTER) + return; + + for(ArrayList locs : _lineGrowth.values()) + { + for(Location loc : locs) + { + loc.getBlock().setType(Material.FIRE); + } + } + for(ArrayList locs : _lineShorten.values()) + { + for(Location loc : locs) + { + loc.getBlock().setType(Material.FIRE); + } + } + for(Minion minion : _activeMinions) + { + for(GameTeam team : _lineGrowth.keySet()) + { + for(Location loc : _lineGrowth.get(team)) + { + if(minion.getEntity().getLocation().getBlockX() != loc.getBlockX()) + continue; + + if(minion.getEntity().getLocation().getBlockZ() != loc.getBlockZ()) + continue; + + if(!minion.isNameChangeable()) + continue; + + if(team != minion.getTeam()) + continue; + + int oldname = minion.getName().length() + 2; + minion.changeRandomName(oldname, oldname, false); + } + } + for(GameTeam team : _lineShorten.keySet()) + { + for(Location loc : _lineShorten.get(team)) + { + if(minion.getEntity().getLocation().getBlockX() != loc.getBlockX()) + continue; + + if(minion.getEntity().getLocation().getBlockZ() != loc.getBlockZ()) + continue; + + if(!minion.isNameChangeable()) + continue; + + if(team == minion.getTeam()) + continue; + + int oldname = minion.getName().length() - 2; + minion.changeRandomName(oldname, oldname, false); + } + } + } + } + @Override @EventHandler public void ScoreboardUpdate(UpdateEvent event) @@ -397,4 +519,33 @@ public class TypeWars extends TeamGame Scoreboard.Draw(); } + public HashMap getMoneyMap() + { + return _moneyMap; + } + + public ArrayList getActiveMinions() + { + return _activeMinions; + } + + public ArrayList getDeadMinions() + { + return _deadMinions; + } + + public HashMap> getMinionSpawns() + { + return _minionSpawns; + } + + public HashMap> getLineGrowth() + { + return _lineGrowth; + } + + public HashMap> getLineShorten() + { + return _lineShorten; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTypeWarsBase.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTypeWarsBase.java new file mode 100644 index 000000000..ed0ccff74 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTypeWarsBase.java @@ -0,0 +1,85 @@ +package nautilus.game.arcade.game.games.typewars.kits; + +import jdk.nashorn.internal.ir.GetSplitState; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.typewars.MinionType; +import nautilus.game.arcade.game.games.typewars.Spell; +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.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; + +public abstract class KitTypeWarsBase extends Kit +{ + + private Spell[] _spells; + + public KitTypeWarsBase(ArcadeManager manager, String name, KitAvailability kitAvailability, int cost, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand, Spell[] spells) + { + super(manager, name, kitAvailability, cost, kitDesc, kitPerks, entityType, itemInHand); + _spells = spells; + } + + public KitTypeWarsBase(ArcadeManager manager, String name, KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand, Spell[] spells) + { + super(manager, name, kitAvailability, kitDesc, kitPerks, entityType, itemInHand); + _spells = spells; + } + + @Override + public void GiveItems(Player player) + { + int e = 0; + for(Spell spell : getSpells()) + { + player.getInventory().setItem(e, ItemStackFactory.Instance.CreateStack(spell.getMaterial(), (byte) 0, 1, C.cYellow + "Activate " + spell.getName() + " Cost: " + spell.getCost())); + e++; + } + + int i = 4; + for(MinionType type : MinionType.values()) + { + player.getInventory().setItem(i, ItemStackFactory.Instance.CreateStack(type.getDisplayItem(), (byte) 0, 1, C.cYellow + "Spawn " + type.getType().getName() + " Cost: " + type.getCost())); + i++; + } + } + + public Spell[] getSpells() + { + return _spells; + } + + @EventHandler + public void activateSpell(PlayerInteractEvent event) + { + if(event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK) + return; + + if(event.getPlayer().getItemInHand() == null) + return; + + executeSpell(event.getPlayer(), event.getPlayer().getItemInHand().getType()); + } + + public boolean executeSpell(Player player, Material mat) + { + for(Spell spell : getSpells()) + { + if(spell.getMaterial() == mat) + return spell.prepareExecution(player); + } + return false; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTyper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTyper.java index 36fbebd74..4283dda75 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTyper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTyper.java @@ -1,19 +1,18 @@ package nautilus.game.arcade.game.games.typewars.kits; -import mineplex.core.common.util.C; -import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.game.games.typewars.MinionType; -import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.game.games.typewars.Spell; +import nautilus.game.arcade.game.games.typewars.spells.SpellFirebomb; +import nautilus.game.arcade.game.games.typewars.spells.SpellKillEverything; +import nautilus.game.arcade.game.games.typewars.spells.SpellSpeedUp; 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.inventory.ItemStack; -public class KitTyper extends Kit +public class KitTyper extends KitTypeWarsBase { public KitTyper(ArcadeManager manager) @@ -22,21 +21,17 @@ public class KitTyper extends Kit new String[] { - "This fast typer can buy Minions with earned money." + "This fast typer has offensive.", + "and defensive Spells" }, new Perk[] - {}, EntityType.ZOMBIE, new ItemStack(Material.FEATHER)); - } - - @Override - public void GiveItems(Player player) - { - int i = 4; - for(MinionType type : MinionType.values()) { - player.getInventory().setItem(i, ItemStackFactory.Instance.CreateStack(type.getDisplayItem(), (byte) 0, 1, C.cYellow + "Spawn " + type.getType().getName() + " Cost: " + type.getCost())); - i++; - } + new Perk("Fire Bomb", new String[]{"Kills all mobs with 8 or less characters", "in a radius of 3"}){}, + new Perk("Speed up", new String[]{"Speeds up your mobs", "in a radius of 3"}){}, + new Perk("Nuke Spell", new String[]{"Kill all enemy Minions", "This is a single use spell"}){} + }, + EntityType.ZOMBIE, new ItemStack(Material.FEATHER), + new Spell[]{new SpellFirebomb(manager), new SpellSpeedUp(manager), new SpellKillEverything(manager)}); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitWarrior.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitWarrior.java new file mode 100644 index 000000000..955b0611d --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitWarrior.java @@ -0,0 +1,35 @@ +package nautilus.game.arcade.game.games.typewars.kits; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.typewars.Spell; +import nautilus.game.arcade.game.games.typewars.spells.SpellGrowthLiner; +import nautilus.game.arcade.game.games.typewars.spells.SpellKillEverything; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.inventory.ItemStack; + +public class KitWarrior extends KitTypeWarsBase +{ + + public KitWarrior(ArcadeManager manager) + { + super(manager, "Letter Warrior", KitAvailability.Gem, 2000, + new String[] + { + "This Legendary Warrior", + "has many Offensive spells" + }, + new Perk[] + { + new Perk("Growth Liner", new String[]{"This Spell creats a line of fire and all", "enemy mobs that pass it will get a longer name"}){}, + new Perk("Speed up", new String[]{"Speeds up your mobs", "in a radius of 3"}){}, + new Perk("Nuke Spell", new String[]{"Kill all enemy Minions", "This is a single use spell"}){} + }, + EntityType.SKELETON, new ItemStack(Material.STONE_SWORD), + new Spell[]{new SpellGrowthLiner(manager), new SpellKillEverything(manager)}); + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellFirebomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellFirebomb.java new file mode 100644 index 000000000..2c59153ea --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellFirebomb.java @@ -0,0 +1,97 @@ +package nautilus.game.arcade.game.games.typewars.spells; + +import java.util.Iterator; + +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilParticle.ParticleType; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.typewars.Minion; +import nautilus.game.arcade.game.games.typewars.Spell; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; + +public class SpellFirebomb extends Spell +{ + + public SpellFirebomb(ArcadeManager manager) + { + super(manager, "Firebomb", 5, Material.BLAZE_POWDER, 2000L, false); + } + + @Override + public boolean execute(Player player, Location location) + { + Iterator minionIterator = getTypeWars().getActiveMinions().iterator(); + while(minionIterator.hasNext()) + { + Minion minion = minionIterator.next(); + + if(UtilMath.offset2d(minion.getEntity().getLocation(), location) > 3) + continue; + + if(getTypeWars().GetTeam(player) == minion.getTeam()) + continue; + + if(minion.getName().length() > 100) + continue; + + final Location loc = minion.getEntity().getLocation(); + loc.getBlock().setType(Material.FIRE); + + getManager().runSyncLater(new Runnable() + { + @Override + public void run() + { + + loc.getBlock().getRelative(BlockFace.EAST).setType(Material.FIRE); + loc.getBlock().getRelative(BlockFace.NORTH).setType(Material.FIRE); + loc.getBlock().getRelative(BlockFace.SOUTH).setType(Material.FIRE); + loc.getBlock().getRelative(BlockFace.WEST).setType(Material.FIRE); + } + }, 20); + + getManager().runSyncLater(new Runnable() + { + @Override + public void run() + { + loc.getBlock().setType(Material.AIR); + } + }, 40); + + getManager().runSyncLater(new Runnable() + { + @Override + public void run() + { + loc.getBlock().getRelative(BlockFace.EAST).setType(Material.AIR); + loc.getBlock().getRelative(BlockFace.NORTH).setType(Material.AIR); + loc.getBlock().getRelative(BlockFace.SOUTH).setType(Material.AIR); + loc.getBlock().getRelative(BlockFace.WEST).setType(Material.AIR); + } + }, 60); + + minion.despawn(player, true); + minionIterator.remove(); + getTypeWars().getDeadMinions().add(minion); + } + return true; + } + + @Override + public ParticleType trail() + { + return ParticleType.WITCH_MAGIC; + } + + @Override + public ParticleType hit() + { + return ParticleType.FLAME; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellGrowthLiner.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellGrowthLiner.java new file mode 100644 index 000000000..207ba1047 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellGrowthLiner.java @@ -0,0 +1,136 @@ +package nautilus.game.arcade.game.games.typewars.spells; + +import java.util.ArrayList; +import java.util.Iterator; + +import mineplex.core.common.util.UtilParticle.ParticleType; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.typewars.Spell; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Player; + +public class SpellGrowthLiner extends Spell +{ + + public SpellGrowthLiner(ArcadeManager manager) + { + super(manager, "Growth Liner", 7, Material.BLAZE_ROD, 2000L, false); + } + + @Override + public ParticleType trail() + { + return ParticleType.FLAME; + } + + @Override + public boolean execute(final Player player, Location location) + { + final ArrayList line = getLine(player, location); + for(Location loc : line) + { + getTypeWars().getLineGrowth().get(getManager().GetGame().GetTeam(player)).add(loc); + } + + getManager().runSyncLater(new Runnable() + { + @Override + public void run() + { + for(Location loc : line) + { + getTypeWars().getLineGrowth().get(getManager().GetGame().GetTeam(player)).remove(loc); + loc.getBlock().setType(Material.AIR); + } + } + }, 140); + return true; + } + + private ArrayList getLine(Player player, Location location) + { + ArrayList line = new ArrayList<>(); + ArrayList spawns = getTypeWars().getMinionSpawns().get(getManager().GetGame().GetTeam(player)); + for(Location loc : spawns) + { + if(loc.getBlockX() == location.getBlockX() || loc.getBlockX() == location.getBlockX() - 1 || loc.getBlockX() == location.getBlockX() + 1) + { + for(Location locs : getTypeWars().getMinionSpawns().get(getManager().GetGame().GetTeam(player))) + { + Location newLoc = locs.clone(); + newLoc.setZ(location.getBlockZ()); + line.add(newLoc); + Location pos1 = newLoc.clone().add(1, 0, 0); + Location pos2 = newLoc.clone().add(-1, 0, 0); + boolean addLoc1 = true; + boolean addLoc2 = true; + for(Location otherLoc : line) + { + if(otherLoc.equals(pos1)) + addLoc1 = false; + } + for(Location otherLoc : line) + { + if(otherLoc.equals(pos2)) + addLoc2 = false; + } + if(addLoc1) + line.add(pos1); + + if(addLoc2) + line.add(pos2); + } + break; + } + if(loc.getBlockZ() == location.getBlockZ() || loc.getBlockZ() == location.getBlockZ() - 1 || loc.getBlockZ() == location.getBlockZ() + 1) + { + for(Location locs : getTypeWars().getMinionSpawns().get(getManager().GetGame().GetTeam(player))) + { + Location newLoc = locs.clone(); + newLoc.setX(location.getBlockX()); + line.add(newLoc); + Location pos1 = newLoc.clone().add(0, 0, 1); + Location pos2 = newLoc.clone().add(0, 0, -1); + boolean addLoc1 = true; + boolean addLoc2 = true; + for(Location otherLoc : line) + { + if(otherLoc.equals(pos1)) + addLoc1 = false; + } + for(Location otherLoc : line) + { + if(otherLoc.equals(pos2)) + addLoc2 = false; + } + if(addLoc1) + line.add(pos1); + + if(addLoc2) + line.add(pos2); + } + break; + } + } + for(Location loc : spawns) + { + Iterator locIterator = line.iterator(); + while(locIterator.hasNext()) + { + Location locs = locIterator.next(); + if(locs.equals(loc)) + { + locIterator.remove(); + } + if(locs.getBlock().getType() != Material.AIR) + locIterator.remove(); + //if(!UtilBlock.getInBoundingBox(getTypeWars().getMinionSpawns().get(0).get(0), getTypeWars().getMinionSpawns().get(1).get(getTypeWars().getMinionSpawns().get(1).size())).contains(locIterator)) + //locIterator.remove(); + } + } + return line; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellKillEverything.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellKillEverything.java new file mode 100644 index 000000000..d683643c8 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellKillEverything.java @@ -0,0 +1,52 @@ +package nautilus.game.arcade.game.games.typewars.spells; + +import java.util.Iterator; + +import mineplex.core.common.util.UtilParticle.ParticleType; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.typewars.Minion; +import nautilus.game.arcade.game.games.typewars.Spell; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Player; + +public class SpellKillEverything extends Spell +{ + + public SpellKillEverything(ArcadeManager manager) + { + super(manager, "Nuke Spell", 0, Material.TNT, 1000L, true); + } + + @Override + public ParticleType trail() + { + return null; + } + + @Override + public ParticleType hit() + { + return null; + } + + @Override + public boolean execute(Player player, Location location) + { + Iterator minionIterator = getTypeWars().getActiveMinions().iterator(); + while(minionIterator.hasNext()) + { + Minion minion = minionIterator.next(); + + if(getTypeWars().GetTeam(player) == minion.getTeam()) + continue; + + minion.despawn(player, true); + minionIterator.remove(); + getTypeWars().getDeadMinions().add(minion); + } + return true; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellSpeedUp.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellSpeedUp.java new file mode 100644 index 000000000..b2ea178fd --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellSpeedUp.java @@ -0,0 +1,43 @@ +package nautilus.game.arcade.game.games.typewars.spells; + +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle.ParticleType; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.typewars.Minion; +import nautilus.game.arcade.game.games.typewars.Spell; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Player; + +public class SpellSpeedUp extends Spell +{ + + public SpellSpeedUp(ArcadeManager manager) + { + super(manager, "Speed up", 6, Material.FEATHER, 5000L, false); + } + + @Override + public ParticleType trail() + { + return ParticleType.HAPPY_VILLAGER; + } + + @Override + public boolean execute(Player player, Location location) + { + for(Minion minion : getTypeWars().getActiveMinions()) + { + if(UtilMath.offset2d(minion.getEntity().getLocation(), location) > 3) + continue; + + if(getTypeWars().GetTeam(player) != minion.getTeam()) + continue; + + minion.increaseWalkSpeed((float) 0.5); + } + return true; + } + +} From c99851da377389eb6dc9af1d2299590274dc3a27 Mon Sep 17 00:00:00 2001 From: Sarah Date: Sat, 26 Sep 2015 14:31:17 +0200 Subject: [PATCH 007/113] finishing spells, kits and animations. --- .../arcade/game/games/typewars/Minion.java | 20 +-- .../arcade/game/games/typewars/Spell.java | 7 + .../arcade/game/games/typewars/TypeWars.java | 54 ++++++- .../games/typewars/kits/KitTactician.java | 36 +++++ .../games/typewars/kits/KitTypeWarsBase.java | 5 + .../game/games/typewars/kits/KitWarrior.java | 9 +- .../games/typewars/spells/SpellFirebomb.java | 4 +- .../typewars/spells/SpellGrowthLiner.java | 9 +- .../games/typewars/spells/SpellMassSlow.java | 75 ++++++++++ .../typewars/spells/SpellShrinkLiner.java | 135 ++++++++++++++++++ .../games/typewars/spells/SpellSniper.java | 52 +++++++ 11 files changed, 379 insertions(+), 27 deletions(-) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTactician.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellMassSlow.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellShrinkLiner.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellSniper.java diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java index ab2a9077e..396bcda01 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java @@ -19,8 +19,10 @@ import org.bukkit.Color; import org.bukkit.FireworkEffect.Type; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity; import org.bukkit.entity.Creeper; import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.HandlerList; @@ -161,7 +163,6 @@ public class Minion implements Listener private GameTeam _team; private Player _player; private Player _killer; - private DisguiseBase _disguise; private Location _lastNameChanged; private int _money; private float _walkSpeed; @@ -326,14 +327,9 @@ public class Minion implements Listener public void changeName(String name) { _name = name; - try - { - Class clazz = _type.getDisguiseClass(); - clazz.getMethod("setName", String.class).invoke(_disguise, _team.GetColor() + _name); - _manager.GetDisguise().disguise((DisguiseBase) _disguise); - } - catch (Exception e) {} - _lastNameChanged = _entity.getLocation(); + Location loc = _entity.getLocation(); + _lastNameChanged = loc; + disguiseCreeper(); } public void changeRandomName(int min, int max, boolean spawned) @@ -346,10 +342,14 @@ public class Minion implements Listener for(String str : tempList) { if(str.length() >= min && str.length() <= max) + { if(!spawned) changeName(str); else _name = str; + + return; + } } } @@ -376,6 +376,8 @@ public class Minion implements Listener { float oldSpeed = _walkSpeed; _walkSpeed = oldSpeed + speed; + if(_walkSpeed <= 0.5) + _walkSpeed = 0.6F; } public Location getTarget() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Spell.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Spell.java index be1ffb189..702e69ed0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Spell.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Spell.java @@ -64,9 +64,14 @@ public abstract class Spell Location loc = player.getLastTwoTargetBlocks(UtilBlock.blockAirFoliageSet, 80).get(0).getLocation().add(0.5, 0.5, 0.5); if(trail() != null) { + int i = 0; for (Location location : UtilShapes.getLinesDistancedPoints(player.getEyeLocation().subtract(0, 0.1, 0), loc, 0.1)) { UtilParticle.PlayParticle(trail(), location, 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers()); + trailAnimation(location, i); + i++; + if(i > 30) + i = 0; } } if(hit() != null) @@ -97,6 +102,8 @@ public abstract class Spell return ParticleType.EXPLODE; } + public void trailAnimation(Location location, int frame) {} + public abstract boolean execute(Player player, Location location); public ArcadeManager getManager() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index 44f4a9266..78e273f8b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -10,10 +10,15 @@ import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilShapes; +import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTextBottom; import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -22,6 +27,7 @@ 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.typewars.kits.KitTactician; import nautilus.game.arcade.game.games.typewars.kits.KitTypeWarsBase; import nautilus.game.arcade.game.games.typewars.kits.KitTyper; import nautilus.game.arcade.game.games.typewars.kits.KitWarrior; @@ -60,7 +66,8 @@ public class TypeWars extends TeamGame new Kit[] { new KitTyper(manager), - new KitWarrior(manager) + new KitWarrior(manager), + new KitTactician(manager) }, new String[] { @@ -83,6 +90,7 @@ public class TypeWars extends TeamGame this.DamagePvE = false; this.DamagePvP = false; this.TeamArmorHotbar = true; + this.Damage = false; _activeMinions = new ArrayList<>(); _deadMinions = new ArrayList<>(); @@ -92,6 +100,8 @@ public class TypeWars extends TeamGame _timeToSpawn = 5000; _lineGrowth = new HashMap<>(); _lineShorten = new HashMap<>(); + + _animationTicks = 0; } private void initSpawns() @@ -113,7 +123,7 @@ public class TypeWars extends TeamGame for (Player player : GetPlayers(true)) { UtilAction.velocity(player, 0.1, 0.1, 0.1, false); - _moneyMap.put(player, 0); + _moneyMap.put(player, 100); } if(event.GetState() != GameState.Live) @@ -278,7 +288,7 @@ public class TypeWars extends TeamGame event.setCancelled(true); killMinion(minion, event.getPlayer()); UtilPlayer.message(event.getPlayer(), F.main("Game", "You killed the "+ "Minion " + C.cYellow + "\"" + minion.getName() + "\"" + C.cGray + " and got " + minion.getMoney() + "$")); - UtilTextMiddle.display("", C.cGreen + "+" + minion.getMoney() + "$"); + UtilTextMiddle.display("", C.cGreen + "+" + minion.getMoney() + "$", event.getPlayer()); _moneyMap.put(event.getPlayer(), _moneyMap.get(event.getPlayer()) + minion.getMoney()); return; } @@ -430,28 +440,58 @@ public class TypeWars extends TeamGame } } + private int _animationTicks; + @EventHandler public void lines(UpdateEvent event) { - if(event.getType() != UpdateType.FASTER) + if(event.getType() != UpdateType.TICK) return; for(ArrayList locs : _lineGrowth.values()) { for(Location loc : locs) { - loc.getBlock().setType(Material.FIRE); + double radius = _animationTicks / 20D; + int particleAmount = _animationTicks / 2; + for (int e = 0; e < particleAmount; e++) + { + double xDiff = Math.sin(e/(double)particleAmount * 2 * Math.PI) * radius; + double zDiff = Math.cos(e/(double)particleAmount * 2 * Math.PI) * radius; + + Location location = loc.clone().add(0.5, 0, 0.5).clone().add(xDiff, particleAmount/10, zDiff); + UtilParticle.PlayParticle(UtilParticle.ParticleType.RED_DUST, location, 0, 0, 0, 0, 1, + ViewDist.NORMAL, UtilServer.getPlayers()); + } } } for(ArrayList locs : _lineShorten.values()) { for(Location loc : locs) { - loc.getBlock().setType(Material.FIRE); + double radius = _animationTicks / 20D; + int particleAmount = _animationTicks / 2; + for (int e = 0; e < particleAmount; e++) + { + double xDiff = Math.sin(e/(double)particleAmount * 2 * Math.PI) * radius; + double zDiff = Math.cos(e/(double)particleAmount * 2 * Math.PI) * radius; + + Location location = loc.clone().add(0.5, 0, 0.5).add(xDiff, particleAmount/10, zDiff); + UtilParticle.PlayParticle(UtilParticle.ParticleType.WITCH_MAGIC, location, 0, 0, 0, 0, 1, + ViewDist.NORMAL, UtilServer.getPlayers()); + } } } - for(Minion minion : _activeMinions) + + _animationTicks++; + if(_animationTicks > 15) + _animationTicks = 0; + + Iterator minionIterator = _activeMinions.iterator(); + + while(minionIterator.hasNext()) { + Minion minion = minionIterator.next(); for(GameTeam team : _lineGrowth.keySet()) { for(Location loc : _lineGrowth.get(team)) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTactician.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTactician.java new file mode 100644 index 000000000..edabd1bf4 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTactician.java @@ -0,0 +1,36 @@ +package nautilus.game.arcade.game.games.typewars.kits; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.typewars.Spell; +import nautilus.game.arcade.game.games.typewars.spells.SpellGrowthLiner; +import nautilus.game.arcade.game.games.typewars.spells.SpellKillEverything; +import nautilus.game.arcade.game.games.typewars.spells.SpellMassSlow; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.inventory.ItemStack; + +public class KitTactician extends KitTypeWarsBase +{ + + public KitTactician(ArcadeManager manager) + { + super(manager, "Alpha. Tactician", KitAvailability.Achievement, + new String[] + { + "The ahlpabet Tactician", + "is known for using deffensive spells" + }, + new Perk[] + { + new Perk("Growth Liner", new String[]{"This Spell creats a line of fire and all", "enemy mobs that pass it will get a shorter name"}){}, + new Perk("Mass Slow", new String[]{"Slows down all enemy Minions"}){}, + new Perk("Nuke Spell", new String[]{"Kill all enemy Minions", "This is a single use spell"}){} + }, + EntityType.SKELETON, new ItemStack(Material.PAPER), + new Spell[]{new SpellGrowthLiner(manager), new SpellMassSlow(manager), new SpellKillEverything(manager)}); + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTypeWarsBase.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTypeWarsBase.java index ed0ccff74..3c30c9796 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTypeWarsBase.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTypeWarsBase.java @@ -5,6 +5,8 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.typewars.MinionType; import nautilus.game.arcade.game.games.typewars.Spell; @@ -69,6 +71,9 @@ public abstract class KitTypeWarsBase extends Kit if(event.getPlayer().getItemInHand() == null) return; + if(!Manager.GetGame().GetKit(event.getPlayer()).GetName().equalsIgnoreCase(GetName())) + return; + executeSpell(event.getPlayer(), event.getPlayer().getItemInHand().getType()); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitWarrior.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitWarrior.java index 955b0611d..1e4646f05 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitWarrior.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitWarrior.java @@ -2,8 +2,9 @@ package nautilus.game.arcade.game.games.typewars.kits; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.typewars.Spell; -import nautilus.game.arcade.game.games.typewars.spells.SpellGrowthLiner; import nautilus.game.arcade.game.games.typewars.spells.SpellKillEverything; +import nautilus.game.arcade.game.games.typewars.spells.SpellShrinkLiner; +import nautilus.game.arcade.game.games.typewars.spells.SpellSniper; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; @@ -24,12 +25,12 @@ public class KitWarrior extends KitTypeWarsBase }, new Perk[] { - new Perk("Growth Liner", new String[]{"This Spell creats a line of fire and all", "enemy mobs that pass it will get a longer name"}){}, - new Perk("Speed up", new String[]{"Speeds up your mobs", "in a radius of 3"}){}, + new Perk("Shrink Liner", new String[]{"This Spell creats a line of fire and all", "enemy mobs that pass it will get a shorter name"}){}, + new Perk("Sniper spell", new String[]{"Shoot a minion", "and kill it instantly"}){}, new Perk("Nuke Spell", new String[]{"Kill all enemy Minions", "This is a single use spell"}){} }, EntityType.SKELETON, new ItemStack(Material.STONE_SWORD), - new Spell[]{new SpellGrowthLiner(manager), new SpellKillEverything(manager)}); + new Spell[]{new SpellShrinkLiner(manager), new SpellSniper(manager), new SpellKillEverything(manager)}); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellFirebomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellFirebomb.java index 2c59153ea..a657430d8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellFirebomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellFirebomb.java @@ -19,7 +19,7 @@ public class SpellFirebomb extends Spell public SpellFirebomb(ArcadeManager manager) { - super(manager, "Firebomb", 5, Material.BLAZE_POWDER, 2000L, false); + super(manager, "Firebomb", 4, Material.BLAZE_POWDER, 2000L, false); } @Override @@ -36,7 +36,7 @@ public class SpellFirebomb extends Spell if(getTypeWars().GetTeam(player) == minion.getTeam()) continue; - if(minion.getName().length() > 100) + if(minion.getName().length() > 8) continue; final Location loc = minion.getEntity().getLocation(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellGrowthLiner.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellGrowthLiner.java index 207ba1047..95e92fc3a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellGrowthLiner.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellGrowthLiner.java @@ -3,6 +3,7 @@ package nautilus.game.arcade.game.games.typewars.spells; import java.util.ArrayList; import java.util.Iterator; +import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilParticle.ParticleType; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.typewars.Spell; @@ -16,7 +17,7 @@ public class SpellGrowthLiner extends Spell public SpellGrowthLiner(ArcadeManager manager) { - super(manager, "Growth Liner", 7, Material.BLAZE_ROD, 2000L, false); + super(manager, "Growth Liner", 7, Material.STICK, 2000L, false); } @Override @@ -42,10 +43,9 @@ public class SpellGrowthLiner extends Spell for(Location loc : line) { getTypeWars().getLineGrowth().get(getManager().GetGame().GetTeam(player)).remove(loc); - loc.getBlock().setType(Material.AIR); } } - }, 140); + }, 180); return true; } @@ -126,8 +126,7 @@ public class SpellGrowthLiner extends Spell } if(locs.getBlock().getType() != Material.AIR) locIterator.remove(); - //if(!UtilBlock.getInBoundingBox(getTypeWars().getMinionSpawns().get(0).get(0), getTypeWars().getMinionSpawns().get(1).get(getTypeWars().getMinionSpawns().get(1).size())).contains(locIterator)) - //locIterator.remove(); + } } return line; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellMassSlow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellMassSlow.java new file mode 100644 index 000000000..365cf3b88 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellMassSlow.java @@ -0,0 +1,75 @@ +package nautilus.game.arcade.game.games.typewars.spells; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.typewars.Minion; +import nautilus.game.arcade.game.games.typewars.Spell; + +public class SpellMassSlow extends Spell +{ + + public SpellMassSlow(ArcadeManager manager) + { + super(manager, "Mass Slow spell", 8, Material.ANVIL, 2000L, false); + } + + @Override + public ParticleType trail() + { + return ParticleType.FLAME; + } + + @Override + public boolean execute(Player player, Location location) + { + location.getWorld().playSound(location.clone().add(0.5, 0.5, 0.5), Sound.ENDERDRAGON_DEATH, 10F, 2.0F); + for(int e = 0; e <= 60; e++) + { + double radius = e/8; + int particleAmount = e / 2; + for (int i = 0; i < particleAmount; i++) + { + double xDiff = Math.sin(i/(double)particleAmount * 2 * Math.PI) * radius; + double zDiff = Math.cos(i/(double)particleAmount * 2 * Math.PI) * radius; + + Location loc = location.clone().add(0.5, -0.4, 0.5).add(xDiff, 0, zDiff); + UtilParticle.PlayParticle(UtilParticle.ParticleType.WITCH_MAGIC, loc, 0, 0, 0, 0, 1, + ViewDist.NORMAL, UtilServer.getPlayers()); + } + } + for(Minion minion : getTypeWars().getActiveMinions()) + { + if(getTypeWars().GetTeam(player) == minion.getTeam()) + continue; + + minion.increaseWalkSpeed(-0.3F); + } + return true; + } + + @Override + public void trailAnimation(Location location, int frame) + { + double radius = 0.6; + int particleAmount = frame / 2; + for (int i = 0; i < particleAmount; i++) + { + double xDiff = Math.sin(i/(double)particleAmount * 2 * Math.PI) * radius; + double zDiff = Math.cos(i/(double)particleAmount * 2 * Math.PI) * radius; + + Location loc = location.clone().add(xDiff, 0, zDiff); + UtilParticle.PlayParticle(UtilParticle.ParticleType.ENCHANTMENT_TABLE, loc, 0, 0, 0, 0, 1, + ViewDist.NORMAL, UtilServer.getPlayers()); + } + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellShrinkLiner.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellShrinkLiner.java new file mode 100644 index 000000000..5b2beba08 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellShrinkLiner.java @@ -0,0 +1,135 @@ +package nautilus.game.arcade.game.games.typewars.spells; + +import java.util.ArrayList; +import java.util.Iterator; + +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilParticle.ParticleType; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.typewars.Spell; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Player; + +public class SpellShrinkLiner extends Spell +{ + + public SpellShrinkLiner(ArcadeManager manager) + { + super(manager, "Shrink Liner", 7, Material.BLAZE_ROD, 2000L, false); + } + + @Override + public ParticleType trail() + { + return ParticleType.FLAME; + } + + @Override + public boolean execute(final Player player, Location location) + { + final ArrayList line = getLine(player, location); + for(Location loc : line) + { + getTypeWars().getLineShorten().get(getManager().GetGame().GetTeam(player)).add(loc); + } + + getManager().runSyncLater(new Runnable() + { + @Override + public void run() + { + for(Location loc : line) + { + getTypeWars().getLineShorten().get(getManager().GetGame().GetTeam(player)).remove(loc); + } + } + }, 180); + return true; + } + + private ArrayList getLine(Player player, Location location) + { + ArrayList line = new ArrayList<>(); + ArrayList spawns = getTypeWars().getMinionSpawns().get(getManager().GetGame().GetTeam(player)); + for(Location loc : spawns) + { + if(loc.getBlockX() == location.getBlockX() || loc.getBlockX() == location.getBlockX() - 1 || loc.getBlockX() == location.getBlockX() + 1) + { + for(Location locs : getTypeWars().getMinionSpawns().get(getManager().GetGame().GetTeam(player))) + { + Location newLoc = locs.clone(); + newLoc.setZ(location.getBlockZ()); + line.add(newLoc); + Location pos1 = newLoc.clone().add(1, 0, 0); + Location pos2 = newLoc.clone().add(-1, 0, 0); + boolean addLoc1 = true; + boolean addLoc2 = true; + for(Location otherLoc : line) + { + if(otherLoc.equals(pos1)) + addLoc1 = false; + } + for(Location otherLoc : line) + { + if(otherLoc.equals(pos2)) + addLoc2 = false; + } + if(addLoc1) + line.add(pos1); + + if(addLoc2) + line.add(pos2); + } + break; + } + if(loc.getBlockZ() == location.getBlockZ() || loc.getBlockZ() == location.getBlockZ() - 1 || loc.getBlockZ() == location.getBlockZ() + 1) + { + for(Location locs : getTypeWars().getMinionSpawns().get(getManager().GetGame().GetTeam(player))) + { + Location newLoc = locs.clone(); + newLoc.setX(location.getBlockX()); + line.add(newLoc); + Location pos1 = newLoc.clone().add(0, 0, 1); + Location pos2 = newLoc.clone().add(0, 0, -1); + boolean addLoc1 = true; + boolean addLoc2 = true; + for(Location otherLoc : line) + { + if(otherLoc.equals(pos1)) + addLoc1 = false; + } + for(Location otherLoc : line) + { + if(otherLoc.equals(pos2)) + addLoc2 = false; + } + if(addLoc1) + line.add(pos1); + + if(addLoc2) + line.add(pos2); + } + break; + } + } + for(Location loc : spawns) + { + Iterator locIterator = line.iterator(); + while(locIterator.hasNext()) + { + Location locs = locIterator.next(); + if(locs.equals(loc)) + { + locIterator.remove(); + } + if(locs.getBlock().getType() != Material.AIR) + locIterator.remove(); + + } + } + return line; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellSniper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellSniper.java new file mode 100644 index 000000000..1ac26542a --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellSniper.java @@ -0,0 +1,52 @@ +package nautilus.game.arcade.game.games.typewars.spells; + +import java.util.Iterator; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle.ParticleType; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.typewars.Minion; +import nautilus.game.arcade.game.games.typewars.Spell; + +public class SpellSniper extends Spell +{ + + public SpellSniper(ArcadeManager manager) + { + super(manager, "Sniper spell", 4, Material.ARROW, 2000L, false); + } + + @Override + public ParticleType trail() + { + return ParticleType.EXPLODE; + } + + @Override + public boolean execute(Player player, Location location) + { + Iterator minionIterator = getTypeWars().getActiveMinions().iterator(); + while(minionIterator.hasNext()) + { + Minion minion = minionIterator.next(); + + if(UtilMath.offset2d(minion.getEntity().getLocation(), location) > 2) + continue; + + if(getTypeWars().GetTeam(player) == minion.getTeam()) + continue; + + minion.despawn(player, true); + minionIterator.remove(); + getTypeWars().getDeadMinions().add(minion); + break; + } + return true; + } + +} From e5b69a85c2d4c53d6e9ca1aaa74f5cb06bee66c5 Mon Sep 17 00:00:00 2001 From: Sarah Date: Mon, 5 Oct 2015 02:27:37 +0200 Subject: [PATCH 008/113] Changing back from 2 disguises to one. --- .../game/arcade/game/games/typewars/Minion.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java index 396bcda01..29431c30b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java @@ -1,6 +1,7 @@ package nautilus.game.arcade.game.games.typewars; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import mineplex.core.common.util.UtilEnt; @@ -10,10 +11,12 @@ import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilServer; import mineplex.core.disguise.disguises.DisguiseBase; +import mineplex.core.disguise.disguises.DisguiseCreeper; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.GameTeam; +import net.minecraft.util.com.google.common.collect.Lists; import org.bukkit.Color; import org.bukkit.FireworkEffect.Type; @@ -217,7 +220,7 @@ public class Minion implements Listener } private Material[] _items = new Material[]{Material.DIAMOND_AXE, Material.IRON_SWORD, Material.CARROT, Material.STONE_SPADE, Material.GOLD_PICKAXE, Material.AIR}; - + private void disguiseCreeper() { try @@ -235,6 +238,7 @@ public class Minion implements Listener _manager.GetDisguise().disguise((DisguiseBase)disguise); } catch (Exception e) {} + } private void path() @@ -278,7 +282,7 @@ public class Minion implements Listener { UtilFirework.playFirework(_entity.getLocation().add(0.5, 0.5, 0.5), Type.BALL_LARGE, Color.RED, true, true); } - if(_frame <= 30) + /*if(_frame <= 30) { double radius = _frame / 20D; int particleAmount = _frame / 2; @@ -291,7 +295,7 @@ public class Minion implements Listener UtilParticle.PlayParticle(UtilParticle.ParticleType.WITCH_MAGIC, location, 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers()); } - } + }*/ } else { @@ -299,7 +303,7 @@ public class Minion implements Listener { UtilFirework.playFirework(_entity.getLocation().add(0.5, 0.5, 0.5), Type.BALL_LARGE, Color.GREEN, true, true); } - if(_frame <= 30) + /*if(_frame <= 30) { double radius = _frame / 20D; int particleAmount = _frame / 2; @@ -312,7 +316,7 @@ public class Minion implements Listener UtilParticle.PlayParticle(UtilParticle.ParticleType.HAPPY_VILLAGER, location, 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers()); } - } + }*/ } if(_frame == 31) From 6e0e618e03fa632ce1df2cbad1b93a2ae860b485 Mon Sep 17 00:00:00 2001 From: Sarah Date: Tue, 6 Oct 2015 03:20:25 +0200 Subject: [PATCH 009/113] Finishing Achievements. --- .../core/achievement/Achievement.java | 38 ++++++++++- .../core/achievement/AchievementCategory.java | 6 +- .../typewars/ActivateNukeSpellEvent.java | 42 ++++++++++++ .../games/typewars/ActivateSpellEvent.java | 40 +++++++++++ .../game/games/typewars/MinionKillEvent.java | 67 ++++++++++++++++++ .../arcade/game/games/typewars/Spell.java | 4 +- .../games/typewars/SummonMinionEvent.java | 40 +++++++++++ .../game/games/typewars/TypeAttemptEvent.java | 49 +++++++++++++ .../arcade/game/games/typewars/TypeWars.java | 29 +++++++- .../typewars/spells/SpellKillEverything.java | 6 ++ .../games/typewars/spells/SpellMassSlow.java | 28 ++++---- .../typewars/stats/DemonStatsTracker.java | 54 +++++++++++++++ .../typewars/stats/DumbledontStatTracker.java | 49 +++++++++++++ .../typewars/stats/HoarderStatTracker.java | 37 ++++++++++ .../stats/PerfectionistStatTracker.java | 68 +++++++++++++++++++ .../typewars/stats/WaitForItStatTracker.java | 24 +++++++ 16 files changed, 564 insertions(+), 17 deletions(-) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/ActivateNukeSpellEvent.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/ActivateSpellEvent.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionKillEvent.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/SummonMinionEvent.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeAttemptEvent.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/DemonStatsTracker.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/DumbledontStatTracker.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/HoarderStatTracker.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/PerfectionistStatTracker.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/WaitForItStatTracker.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java index ab821003d..6cc1b1f67 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java @@ -708,9 +708,43 @@ public enum Achievement new String[]{"Evolution.EvolveKill"}, new String[]{"Kill 25 people while they", "Are trying to evolve"}, new int[]{25}, - AchievementCategory.EVOLUTION) + AchievementCategory.EVOLUTION), - ; + TYPE_WARS_SPEED_DEMON("Speed Demon", 1000, + new String[]{"Type Wars.Demon"}, + new String[]{"Kill 5 Mobs in 8 seconds", "by typing"}, + new int[]{1}, + AchievementCategory.TYPE_WARS), + + TYPE_WARS_PERFECTIONIST("Perfectionist", 1200, + new String[]{"Type Wars.Perfectionist"}, + new String[]{"Go an entire game", "without mistyping"}, + new int[]{1}, + AchievementCategory.TYPE_WARS), + + TYPE_WARS_WAIT_FOR_IT("Wait for it", 1200, + new String[]{"Type Wars.Nuke"}, + new String[]{"Kill 30 or more Mobs", "with a Nuke Spell"}, + new int[]{1}, + AchievementCategory.TYPE_WARS), + + TYPE_WARS_HOARDER("Hoarder", 1000, + new String[]{"Type Wars.Hoarder"}, + new String[]{"Summon 50 Mobs in one game"}, + new int[]{1}, + AchievementCategory.TYPE_WARS), + + TYPE_WARS_DUMBLEDONT("Dumbledont", 800, + new String[]{"Type Wars.Dumbledont"}, + new String[]{"Win without using any spells"}, + new int[]{1}, + AchievementCategory.TYPE_WARS), + + TYPE_WARS_WINNS("The true Typewriter", 2000, + new String[]{"Type Wars.Wins"}, + new String[]{"winn 30 Games"}, + new int[]{30}, + AchievementCategory.TYPE_WARS); private String _name; private String[] _desc; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java index 5b81e40ea..d2d5b4aa2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java @@ -127,7 +127,11 @@ public enum AchievementCategory EVOLUTION("Evolution", null, new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED}, - Material.MONSTER_EGG, 0, GameCategory.ARCADE, "Harvester Kit"); + Material.MONSTER_EGG, 0, GameCategory.ARCADE, "Harvester Kit"), + + TYPE_WARS("Evolution", null, + new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED}, + Material.FEATHER, 0, GameCategory.ARCADE, "Alpha. Tactician"); private String _name; private String[] _statsToPull; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/ActivateNukeSpellEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/ActivateNukeSpellEvent.java new file mode 100644 index 000000000..8b27a426e --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/ActivateNukeSpellEvent.java @@ -0,0 +1,42 @@ +package nautilus.game.arcade.game.games.typewars; + +import java.util.ArrayList; + +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class ActivateNukeSpellEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + public static HandlerList getHandlerList() + { + return handlers; + } + + @Override + public HandlerList getHandlers() + { + return getHandlerList(); + } + + private Player _player; + private ArrayList _minions; + + public ActivateNukeSpellEvent(Player player, ArrayList minions) + { + _player = player; + _minions = minions; + } + + public Player getPlayer() + { + return _player; + } + + public ArrayList getMinions() + { + return _minions; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/ActivateSpellEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/ActivateSpellEvent.java new file mode 100644 index 000000000..21148e56d --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/ActivateSpellEvent.java @@ -0,0 +1,40 @@ +package nautilus.game.arcade.game.games.typewars; + +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class ActivateSpellEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + public static HandlerList getHandlerList() + { + return handlers; + } + + @Override + public HandlerList getHandlers() + { + return getHandlerList(); + } + + private Player _player; + private Spell _spell; + + public ActivateSpellEvent(Player player, Spell spell) + { + _player = player; + _spell = spell; + } + + public Player getPlayer() + { + return _player; + } + + public Spell getSpell() + { + return _spell; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionKillEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionKillEvent.java new file mode 100644 index 000000000..ad477c975 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionKillEvent.java @@ -0,0 +1,67 @@ +package nautilus.game.arcade.game.games.typewars; + +import nautilus.game.arcade.game.games.typewars.TypeWars.KillType; + +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +import com.sun.xml.internal.ws.api.Cancelable; + +public class MinionKillEvent extends Event implements Cancelable +{ + + private static final HandlerList handlers = new HandlerList(); + + public static HandlerList getHandlerList() + { + return handlers; + } + + @Override + public HandlerList getHandlers() + { + return getHandlerList(); + } + + private Player _player; + private Minion _minion; + private KillType _type; + + private boolean _canceled; + + public MinionKillEvent(Player player, Minion minion, KillType type) + { + _player = player; + _minion = minion; + _type = type; + _canceled = false; + } + + public Player getPlayer() + { + return _player; + } + + public Minion getMinion() + { + return _minion; + } + + public KillType getType() + { + return _type; + } + + @Override + public void cancel(boolean cancel) + { + _canceled = cancel; + } + + public boolean isCanceled() + { + return _canceled; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Spell.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Spell.java index 702e69ed0..56e1268d9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Spell.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Spell.java @@ -13,6 +13,7 @@ import mineplex.core.common.util.UtilShapes; import mineplex.core.recharge.Recharge; import nautilus.game.arcade.ArcadeManager; +import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -65,7 +66,7 @@ public abstract class Spell if(trail() != null) { int i = 0; - for (Location location : UtilShapes.getLinesDistancedPoints(player.getEyeLocation().subtract(0, 0.1, 0), loc, 0.1)) + for (Location location : UtilShapes.getLinesDistancedPoints(player.getEyeLocation().subtract(0, 0.1, 0), loc, 0.6)) { UtilParticle.PlayParticle(trail(), location, 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers()); trailAnimation(location, i); @@ -85,6 +86,7 @@ public abstract class Spell if(!_playerUses.contains(player)) _playerUses.add(player); + Bukkit.getPluginManager().callEvent(new ActivateSpellEvent(player, this)); UtilPlayer.message(player, F.main("Game", "You activated the Spell " + F.game(getName()) + " and got charged " + F.game(getCost() + "$") + ".")); return true; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/SummonMinionEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/SummonMinionEvent.java new file mode 100644 index 000000000..49ed46c56 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/SummonMinionEvent.java @@ -0,0 +1,40 @@ +package nautilus.game.arcade.game.games.typewars; + +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class SummonMinionEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + public static HandlerList getHandlerList() + { + return handlers; + } + + @Override + public HandlerList getHandlers() + { + return getHandlerList(); + } + + private Player _player; + private Minion _minion; + + public SummonMinionEvent(Player player, Minion minion) + { + _player = player; + _minion = minion; + } + + public Player getPlayer() + { + return _player; + } + + public Minion getMinion() + { + return _minion; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeAttemptEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeAttemptEvent.java new file mode 100644 index 000000000..c03828fdf --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeAttemptEvent.java @@ -0,0 +1,49 @@ +package nautilus.game.arcade.game.games.typewars; + +import java.util.ArrayList; + +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class TypeAttemptEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + public static HandlerList getHandlerList() + { + return handlers; + } + + @Override + public HandlerList getHandlers() + { + return getHandlerList(); + } + + private Player _player; + private String _attempt; + private boolean _success; + + public TypeAttemptEvent(Player player, String attempt, boolean sucess) + { + _player = player; + _attempt = attempt; + _success = sucess; + } + + public Player getPlayer() + { + return _player; + } + + public String getAttempt() + { + return _attempt; + } + + public boolean isSuccessful() + { + return _success; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index 78e273f8b..a5e8bdd07 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -31,6 +31,11 @@ import nautilus.game.arcade.game.games.typewars.kits.KitTactician; import nautilus.game.arcade.game.games.typewars.kits.KitTypeWarsBase; import nautilus.game.arcade.game.games.typewars.kits.KitTyper; import nautilus.game.arcade.game.games.typewars.kits.KitWarrior; +import nautilus.game.arcade.game.games.typewars.stats.DemonStatsTracker; +import nautilus.game.arcade.game.games.typewars.stats.DumbledontStatTracker; +import nautilus.game.arcade.game.games.typewars.stats.HoarderStatTracker; +import nautilus.game.arcade.game.games.typewars.stats.PerfectionistStatTracker; +import nautilus.game.arcade.game.games.typewars.stats.WaitForItStatTracker; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.world.WorldData; @@ -102,6 +107,13 @@ public class TypeWars extends TeamGame _lineShorten = new HashMap<>(); _animationTicks = 0; + + registerStatTrackers( + new DemonStatsTracker(this), + new DumbledontStatTracker(this), + new HoarderStatTracker(this), + new PerfectionistStatTracker(this), + new WaitForItStatTracker(this)); } private void initSpawns() @@ -192,6 +204,7 @@ public class TypeWars extends TeamGame int rdm = UtilMath.r(_minionSpawns.get(teams).size()); Minion minion = new Minion(Manager, _minionSpawns.get(teams).get(rdm), _minionSpawns.get(team).get(rdm), teams, event.getPlayer(), true, type); Bukkit.getPluginManager().registerEvents(minion, Manager.getPlugin()); + Bukkit.getPluginManager().callEvent(new SummonMinionEvent(event.getPlayer(), minion)); _activeMinions.add(minion); this.CreatureAllowOverride = false; } @@ -282,10 +295,19 @@ public class TypeWars extends TeamGame Minion minion = getFarestMininion(event.getPlayer(), event.getMessage()); + Bukkit.getPluginManager().callEvent(new TypeAttemptEvent(event.getPlayer(), event.getMessage(), minion != null)); + if(minion == null) return; event.setCancelled(true); + + MinionKillEvent minionEvent = new MinionKillEvent(event.getPlayer(), minion, KillType.TYPED); + Bukkit.getPluginManager().callEvent(minionEvent); + + if(minionEvent.isCanceled()) + return; + killMinion(minion, event.getPlayer()); UtilPlayer.message(event.getPlayer(), F.main("Game", "You killed the "+ "Minion " + C.cYellow + "\"" + minion.getName() + "\"" + C.cGray + " and got " + minion.getMoney() + "$")); UtilTextMiddle.display("", C.cGreen + "+" + minion.getMoney() + "$", event.getPlayer()); @@ -293,6 +315,11 @@ public class TypeWars extends TeamGame return; } + public enum KillType + { + TYPED, SPELL; + } + public void killMinion(Minion minion, Player player) { minion.despawn(player, true); @@ -445,7 +472,7 @@ public class TypeWars extends TeamGame @EventHandler public void lines(UpdateEvent event) { - if(event.getType() != UpdateType.TICK) + if(event.getType() != UpdateType.FASTEST) return; for(ArrayList locs : _lineGrowth.values()) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellKillEverything.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellKillEverything.java index d683643c8..c8f2b7780 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellKillEverything.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellKillEverything.java @@ -1,12 +1,15 @@ package nautilus.game.arcade.game.games.typewars.spells; +import java.util.ArrayList; import java.util.Iterator; import mineplex.core.common.util.UtilParticle.ParticleType; import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.typewars.ActivateNukeSpellEvent; import nautilus.game.arcade.game.games.typewars.Minion; import nautilus.game.arcade.game.games.typewars.Spell; +import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -34,6 +37,7 @@ public class SpellKillEverything extends Spell @Override public boolean execute(Player player, Location location) { + ArrayList minionList = new ArrayList<>(); Iterator minionIterator = getTypeWars().getActiveMinions().iterator(); while(minionIterator.hasNext()) { @@ -44,8 +48,10 @@ public class SpellKillEverything extends Spell minion.despawn(player, true); minionIterator.remove(); + minionList.add(minion); getTypeWars().getDeadMinions().add(minion); } + Bukkit.getPluginManager().callEvent(new ActivateNukeSpellEvent(player, minionList)); return true; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellMassSlow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellMassSlow.java index 365cf3b88..1c3735598 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellMassSlow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellMassSlow.java @@ -32,20 +32,24 @@ public class SpellMassSlow extends Spell public boolean execute(Player player, Location location) { location.getWorld().playSound(location.clone().add(0.5, 0.5, 0.5), Sound.ENDERDRAGON_DEATH, 10F, 2.0F); - for(int e = 0; e <= 60; e++) + + for(int c = -1; c <= 1; c++) { - double radius = e/8; - int particleAmount = e / 2; - for (int i = 0; i < particleAmount; i++) + for(int i = -10; i <= 10; i = i + 2) { - double xDiff = Math.sin(i/(double)particleAmount * 2 * Math.PI) * radius; - double zDiff = Math.cos(i/(double)particleAmount * 2 * Math.PI) * radius; - - Location loc = location.clone().add(0.5, -0.4, 0.5).add(xDiff, 0, zDiff); - UtilParticle.PlayParticle(UtilParticle.ParticleType.WITCH_MAGIC, loc, 0, 0, 0, 0, 1, - ViewDist.NORMAL, UtilServer.getPlayers()); + for(double x = 0.2; x <= 2; x = x + 0.2) + { + Location loc = location.clone().add(i + x, 2*(x-1)*(x-1)*(x-1) -2*(x-1), c); + loc.add(0, 0.3, 0); + UtilParticle.PlayParticle(UtilParticle.ParticleType.HAPPY_VILLAGER, loc, 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers()); + + Location otherLocation = location.clone().add(c, 2*(x-1)*(x-1)*(x-1) -2*(x-1), i + x); + otherLocation.add(0, 0.3, 0); + UtilParticle.PlayParticle(UtilParticle.ParticleType.HAPPY_VILLAGER, otherLocation, 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers()); + } } } + for(Minion minion : getTypeWars().getActiveMinions()) { if(getTypeWars().GetTeam(player) == minion.getTeam()) @@ -56,7 +60,7 @@ public class SpellMassSlow extends Spell return true; } - @Override + /*@Override public void trailAnimation(Location location, int frame) { double radius = 0.6; @@ -70,6 +74,6 @@ public class SpellMassSlow extends Spell UtilParticle.PlayParticle(UtilParticle.ParticleType.ENCHANTMENT_TABLE, loc, 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers()); } - } + }*/ } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/DemonStatsTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/DemonStatsTracker.java new file mode 100644 index 000000000..480443f76 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/DemonStatsTracker.java @@ -0,0 +1,54 @@ +package nautilus.game.arcade.game.games.typewars.stats; + +import java.util.HashMap; + +import nautilus.game.arcade.game.games.typewars.MinionKillEvent; +import nautilus.game.arcade.game.games.typewars.TypeWars; +import nautilus.game.arcade.game.games.typewars.TypeWars.KillType; +import nautilus.game.arcade.stats.StatTracker; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +public class DemonStatsTracker extends StatTracker +{ + + private HashMap _players; + private HashMap _kills; + + public DemonStatsTracker(TypeWars game) + { + super(game); + _players = new HashMap<>(); + _kills = new HashMap<>(); + } + + @EventHandler + public void minonKill(MinionKillEvent event) + { + if(event.getType() != KillType.TYPED) + return; + + if(!_players.containsKey(event.getPlayer())) + { + _players.put(event.getPlayer(), System.currentTimeMillis()); + _kills.put(event.getPlayer(), 1); + return; + } + if(_players.get(event.getPlayer()) + 8000 > System.currentTimeMillis()) + { + int kills = _kills.get(event.getPlayer()); + _kills.put(event.getPlayer(), kills + 1); + } + else + { + _players.put(event.getPlayer(), System.currentTimeMillis()); + _kills.put(event.getPlayer(), 1); + } + if(_kills.get(event.getPlayer()) >= 5) + { + addStat(event.getPlayer(), "Demon", 1, true, false); + } + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/DumbledontStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/DumbledontStatTracker.java new file mode 100644 index 000000000..ea84f1eb0 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/DumbledontStatTracker.java @@ -0,0 +1,49 @@ +package nautilus.game.arcade.game.games.typewars.stats; + +import java.util.ArrayList; + +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.typewars.ActivateSpellEvent; +import nautilus.game.arcade.game.games.typewars.TypeWars; +import nautilus.game.arcade.stats.StatTracker; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +public class DumbledontStatTracker extends StatTracker +{ + + private ArrayList _players; + + public DumbledontStatTracker(TypeWars game) + { + super(game); + _players = new ArrayList<>(); + } + + @EventHandler + public void spell(ActivateSpellEvent event) + { + _players.remove(event.getPlayer()); + } + + @EventHandler + public void end(GameStateChangeEvent event) + { + if(event.GetState() == GameState.Live) + { + for(Player player : event.GetGame().GetPlayers(true)) + _players.add(player); + } + if(event.GetState() == GameState.End) + { + for(Player player : _players) + { + if(player.isOnline()) + addStat(player, "Dumbledont", 1, true, false); + } + } + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/HoarderStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/HoarderStatTracker.java new file mode 100644 index 000000000..588520211 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/HoarderStatTracker.java @@ -0,0 +1,37 @@ +package nautilus.game.arcade.game.games.typewars.stats; + +import java.util.HashMap; + +import nautilus.game.arcade.game.games.typewars.SummonMinionEvent; +import nautilus.game.arcade.game.games.typewars.TypeWars; +import nautilus.game.arcade.stats.StatTracker; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +public class HoarderStatTracker extends StatTracker +{ + + private HashMap _players; + + public HoarderStatTracker(TypeWars game) + { + super(game); + _players = new HashMap<>(); + } + + @EventHandler + public void summonMinion(SummonMinionEvent event) + { + if(!_players.containsKey(event.getPlayer())) + { + _players.put(event.getPlayer(), 1); + return; + } + int summons = _players.get(event.getPlayer()); + _players.put(event.getPlayer(), summons + 1); + if(_players.get(event.getPlayer()) >= 50) + addStat(event.getPlayer(), "Hoarder", 1, true, false); + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/PerfectionistStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/PerfectionistStatTracker.java new file mode 100644 index 000000000..fae291179 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/PerfectionistStatTracker.java @@ -0,0 +1,68 @@ +package nautilus.game.arcade.game.games.typewars.stats; + +import java.util.ArrayList; +import java.util.HashMap; + +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.typewars.TypeAttemptEvent; +import nautilus.game.arcade.game.games.typewars.TypeWars; +import nautilus.game.arcade.stats.StatTracker; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +public class PerfectionistStatTracker extends StatTracker +{ + + private HashMap _wordsRecently; + private ArrayList _players; + + public PerfectionistStatTracker(TypeWars game) + { + super(game); + _wordsRecently = new HashMap<>(); + _players = new ArrayList<>(); + } + + @EventHandler + public void attempt(TypeAttemptEvent event) + { + if(event.isSuccessful()) + { + _wordsRecently.put(event.getAttempt().toUpperCase(), System.currentTimeMillis()); + } + else + { + if(_wordsRecently.containsKey(event.getAttempt().toUpperCase())) + { + if(_wordsRecently.get(event.getAttempt().toUpperCase()) + 2000 > System.currentTimeMillis()) + { + return; + } + } + _players.remove(event.getPlayer()); + } + } + + @EventHandler + public void gameState(GameStateChangeEvent event) + { + if(event.GetState() == GameState.Live) + { + for(Player player : event.GetGame().GetPlayers(true)) + { + _players.add(player); + } + } + if(event.GetState() == GameState.End) + { + for(Player player : _players) + { + if(player.isOnline()) + addStat(player, "Perfectionist", 1, true, false); + } + } + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/WaitForItStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/WaitForItStatTracker.java new file mode 100644 index 000000000..14ec0a44c --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/WaitForItStatTracker.java @@ -0,0 +1,24 @@ +package nautilus.game.arcade.game.games.typewars.stats; + +import nautilus.game.arcade.game.games.typewars.ActivateNukeSpellEvent; +import nautilus.game.arcade.game.games.typewars.TypeWars; +import nautilus.game.arcade.stats.StatTracker; + +import org.bukkit.event.EventHandler; + +public class WaitForItStatTracker extends StatTracker +{ + + public WaitForItStatTracker(TypeWars game) + { + super(game); + } + + @EventHandler + public void nuke(ActivateNukeSpellEvent event) + { + if(event.getMinions().size() >= 30) + addStat(event.getPlayer(), "Nuke", 1, true, false); + } + +} From 34a554584cf3382fd74c01bd609f9069440445de Mon Sep 17 00:00:00 2001 From: Sarah Date: Tue, 6 Oct 2015 17:45:38 +0200 Subject: [PATCH 010/113] Making mob spawn rate dynamical, removing kill message, lowering kill animation, editing Scoreboard and changing Nuke animation. --- .../arcade/game/games/typewars/Minion.java | 63 +++---- .../game/games/typewars/MinionKillEvent.java | 9 +- .../arcade/game/games/typewars/TypeWars.java | 169 ++++++++++++++---- .../games/typewars/kits/KitTactician.java | 4 +- .../game/games/typewars/kits/KitTyper.java | 6 +- .../game/games/typewars/kits/KitWarrior.java | 6 +- .../typewars/spells/SpellKillEverything.java | 4 +- 7 files changed, 179 insertions(+), 82 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java index 29431c30b..1704101e5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java @@ -8,6 +8,7 @@ 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.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilServer; import mineplex.core.disguise.disguises.DisguiseBase; @@ -18,8 +19,10 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.GameTeam; import net.minecraft.util.com.google.common.collect.Lists; +import org.bukkit.Bukkit; import org.bukkit.Color; import org.bukkit.FireworkEffect.Type; +import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity; @@ -35,7 +38,7 @@ import org.bukkit.inventory.ItemStack; public class Minion implements Listener { - private static String[] NAMES = new String[]{"Fishing", "Cookie", "Sleeping", "Diamond", "Banana", "Tree House", "Christmas Holidays", "Tree", "Egg", "Cat", + private static String[] NAMES = new String[]{"Fishing", "Cookie", "Sleeping", "Diamond", "Banana", "Christmas Holidays", "Tree", "Egg", "Cat", "Quadrilateral", "Rollercoaster", "Hallucinating", "Advertisement", "Entertainment", "Administrator", "Intergalactic", "International", "Understanding", "Investigation", "Veterinarian", "Photographer", "Cheeseburger", "Civilization", "Tranquilizer", "Conversation", "EnderDragon", "Engineering", "Philippines", "Countryside", "Electricity", "Caterpillar", "Keyboarding", "Agriculture", "Mathematics", "Millimeters", "Centimeters", "Screwdriver", "Achievement", "Necromancer", @@ -264,7 +267,7 @@ public class Minion implements Listener _killed = killed; _player = player; _die = true; - _entity.remove(); + ((Creeper) _entity).damage(10000); } @EventHandler @@ -278,24 +281,38 @@ public class Minion implements Listener if(_killed) { - if(_frame <= 1) + if(_frame <= 30) { - UtilFirework.playFirework(_entity.getLocation().add(0.5, 0.5, 0.5), Type.BALL_LARGE, Color.RED, true, true); - } - /*if(_frame <= 30) - { - double radius = _frame / 20D; - int particleAmount = _frame / 2; - for (int i = 0; i < particleAmount; i++) + if(_team.GetColor() == ChatColor.RED) { - double xDiff = Math.sin(i/(double)particleAmount * 2 * Math.PI) * radius; - double zDiff = Math.cos(i/(double)particleAmount * 2 * Math.PI) * radius; + double radius = _frame / 20D; + int particleAmount = _frame / 2; + for (int e = 0; e < particleAmount; e++) + { + double xDiff = Math.sin(e/(double)particleAmount * 2 * Math.PI) * radius; + double zDiff = Math.cos(e/(double)particleAmount * 2 * Math.PI) * radius; - Location location = _entity.getLocation().add(0.5, 0, 0.5).clone().add(xDiff, particleAmount/10, zDiff); - UtilParticle.PlayParticle(UtilParticle.ParticleType.WITCH_MAGIC, location, 0, 0, 0, 0, 1, - ViewDist.NORMAL, UtilServer.getPlayers()); + Location location = _entity.getLocation().clone().add(0.5, 0, 0.5).add(xDiff, particleAmount/10, zDiff); + UtilParticle.PlayParticle(UtilParticle.ParticleType.RED_DUST, location, 0, 0, 0, 0, 1, ViewDist.NORMAL, _player); + + } } - }*/ + else + { + double radius = _frame / 20D; + int particleAmount = _frame / 2; + for (int e = 0; e < particleAmount; e++) + { + double xDiff = Math.sin(e/(double)particleAmount * 2 * Math.PI) * radius; + double zDiff = Math.cos(e/(double)particleAmount * 2 * Math.PI) * radius; + + Location location = _entity.getLocation().clone().add(0.5, 0, 0.5).add(xDiff, particleAmount/10, zDiff); + UtilParticle.PlayParticle(ParticleType.RED_DUST, location, -1, 1, 1, 1, 0,ViewDist.NORMAL, _player); + + } + + } + } } else { @@ -303,20 +320,6 @@ public class Minion implements Listener { UtilFirework.playFirework(_entity.getLocation().add(0.5, 0.5, 0.5), Type.BALL_LARGE, Color.GREEN, true, true); } - /*if(_frame <= 30) - { - double radius = _frame / 20D; - int particleAmount = _frame / 2; - for (int i = 0; i < particleAmount; i++) - { - double xDiff = Math.sin(i/(double)particleAmount * 2 * Math.PI) * radius; - double zDiff = Math.cos(i/(double)particleAmount * 2 * Math.PI) * radius; - - Location location = _entity.getLocation().add(0.5, 0, 0.5).clone().add(xDiff, particleAmount/10, zDiff); - UtilParticle.PlayParticle(UtilParticle.ParticleType.HAPPY_VILLAGER, location, 0, 0, 0, 0, 1, - ViewDist.NORMAL, UtilServer.getPlayers()); - } - }*/ } if(_frame == 31) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionKillEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionKillEvent.java index ad477c975..2198d4aca 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionKillEvent.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionKillEvent.java @@ -3,12 +3,11 @@ package nautilus.game.arcade.game.games.typewars; import nautilus.game.arcade.game.games.typewars.TypeWars.KillType; import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; -import com.sun.xml.internal.ws.api.Cancelable; - -public class MinionKillEvent extends Event implements Cancelable +public class MinionKillEvent extends Event implements Cancellable { private static final HandlerList handlers = new HandlerList(); @@ -54,12 +53,12 @@ public class MinionKillEvent extends Event implements Cancelable } @Override - public void cancel(boolean cancel) + public void setCancelled(boolean cancel) { _canceled = cancel; } - public boolean isCanceled() + public boolean isCancelled() { return _canceled; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index a5e8bdd07..bad98b069 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -12,13 +12,12 @@ import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilShapes; -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.UtilTextBottom; import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -40,15 +39,13 @@ import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.world.WorldData; import org.bukkit.Bukkit; +import org.bukkit.ChatColor; import org.bukkit.Location; -import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.PlayerInteractEvent; -import com.sun.xml.internal.ws.resources.UtilMessages; - public class TypeWars extends TeamGame { @@ -58,8 +55,14 @@ public class TypeWars extends TeamGame private HashMap _moneyMap; - private long _lastSpawned; - private long _timeToSpawn; + private long _lastSpawnedRed; + private long _timeToSpawnRed; + + private long _lastSpawnedBlue; + private long _timeToSpawnBlue; + + private ArrayList _pendingNukes; + private HashMap> _lineGrowth; private HashMap> _lineShorten; @@ -102,11 +105,14 @@ public class TypeWars extends TeamGame _finishedMinions = new ArrayList<>(); _minionSpawns = new HashMap<>(); _moneyMap = new HashMap<>(); - _timeToSpawn = 5000; + _timeToSpawnRed = 30000; + _timeToSpawnBlue = 30000; _lineGrowth = new HashMap<>(); _lineShorten = new HashMap<>(); + _pendingNukes = new ArrayList<>(); _animationTicks = 0; + _nukeFrame = 0; registerStatTrackers( new DemonStatsTracker(this), @@ -135,7 +141,7 @@ public class TypeWars extends TeamGame for (Player player : GetPlayers(true)) { UtilAction.velocity(player, 0.1, 0.1, 0.1, false); - _moneyMap.put(player, 100); + _moneyMap.put(player, 0); } if(event.GetState() != GameState.Live) @@ -149,7 +155,11 @@ public class TypeWars extends TeamGame _lineShorten.put(team, new ArrayList()); } - _lastSpawned = System.currentTimeMillis(); + _timeToSpawnBlue = 30000 / GetTeam(ChatColor.RED).GetPlayers(true).size(); + _timeToSpawnBlue = 30000 / GetTeam(ChatColor.BLUE).GetPlayers(true).size(); + + _lastSpawnedRed = System.currentTimeMillis(); + _lastSpawnedBlue = System.currentTimeMillis(); } @EventHandler @@ -223,29 +233,35 @@ public class TypeWars extends TeamGame if(!IsLive()) return; - if(UtilTime.elapsed(_lastSpawned, _timeToSpawn)) + if(UtilTime.elapsed(_lastSpawnedRed, _timeToSpawnRed)) { - _lastSpawned = System.currentTimeMillis(); - this.CreatureAllowOverride = true; + _lastSpawnedRed = System.currentTimeMillis(); - for(GameTeam teams : GetTeamList()) - { - for(GameTeam team : GetTeamList()) - { - if(teams != team) - { - int rdm = UtilMath.r(_minionSpawns.get(teams).size()); - Minion minion = new Minion(Manager, _minionSpawns.get(teams).get(rdm), _minionSpawns.get(team).get(rdm), teams); - Bukkit.getPluginManager().registerEvents(minion, Manager.getPlugin()); - _activeMinions.add(minion); - } - } - } + this.CreatureAllowOverride = true; + int rdm = UtilMath.r(_minionSpawns.get(GetTeam(ChatColor.RED)).size()); + Minion minion = new Minion(Manager, _minionSpawns.get(GetTeam(ChatColor.RED)).get(rdm), _minionSpawns.get(GetTeam(ChatColor.BLUE)).get(rdm), GetTeam(ChatColor.RED)); + Bukkit.getPluginManager().registerEvents(minion, Manager.getPlugin()); + _activeMinions.add(minion); this.CreatureAllowOverride = false; - if(_timeToSpawn > 2000) - _timeToSpawn = _timeToSpawn - 75; + if(_timeToSpawnRed > 12000 / GetTeam(ChatColor.BLUE).GetPlayers(true).size()) + _timeToSpawnRed = _timeToSpawnRed - 75; + } + if(UtilTime.elapsed(_lastSpawnedBlue, _timeToSpawnBlue)) + { + _lastSpawnedBlue = System.currentTimeMillis(); + + this.CreatureAllowOverride = true; + int rdm = UtilMath.r(_minionSpawns.get(GetTeam(ChatColor.BLUE)).size()); + Minion minion = new Minion(Manager, _minionSpawns.get(GetTeam(ChatColor.BLUE)).get(rdm), _minionSpawns.get(GetTeam(ChatColor.RED)).get(rdm), GetTeam(ChatColor.BLUE)); + Bukkit.getPluginManager().registerEvents(minion, Manager.getPlugin()); + _activeMinions.add(minion); + + this.CreatureAllowOverride = false; + + if(_timeToSpawnBlue > 12000 / GetTeam(ChatColor.RED).GetPlayers(true).size()) + _timeToSpawnBlue = _timeToSpawnRed - 75; } } @@ -293,6 +309,9 @@ public class TypeWars extends TeamGame if(!GetPlayers(true).contains(event.getPlayer())) return; + if(event.getMessage().split(" ").length == 1) + event.setCancelled(true); + Minion minion = getFarestMininion(event.getPlayer(), event.getMessage()); Bukkit.getPluginManager().callEvent(new TypeAttemptEvent(event.getPlayer(), event.getMessage(), minion != null)); @@ -300,16 +319,14 @@ public class TypeWars extends TeamGame if(minion == null) return; - event.setCancelled(true); - MinionKillEvent minionEvent = new MinionKillEvent(event.getPlayer(), minion, KillType.TYPED); Bukkit.getPluginManager().callEvent(minionEvent); - if(minionEvent.isCanceled()) + if(minionEvent.isCancelled()) return; killMinion(minion, event.getPlayer()); - UtilPlayer.message(event.getPlayer(), F.main("Game", "You killed the "+ "Minion " + C.cYellow + "\"" + minion.getName() + "\"" + C.cGray + " and got " + minion.getMoney() + "$")); + //UtilPlayer.message(event.getPlayer(), F.main("Game", "You killed the "+ "Minion " + C.cYellow + "\"" + minion.getName() + "\"" + C.cGray + " and got " + minion.getMoney() + "$")); UtilTextMiddle.display("", C.cGreen + "+" + minion.getMoney() + "$", event.getPlayer()); _moneyMap.put(event.getPlayer(), _moneyMap.get(event.getPlayer()) + minion.getMoney()); return; @@ -576,16 +593,91 @@ public class TypeWars extends TeamGame Scoreboard.WriteBlank(); - for(GameTeam team : GetTeamList()) + for(GameTeam teams : GetTeamList()) { - Scoreboard.Write(team.GetColor() + C.Bold + team.GetName()); - Scoreboard.Write(team.GetColor() + "Score: " + getScore(team)); - Scoreboard.WriteBlank(); + for(GameTeam team : GetTeamList()) + { + if(team == teams) + continue; + + Scoreboard.Write(team.GetColor() + C.Bold + team.GetName() + " Team"); + Scoreboard.Write(team.GetColor() + "Lives: " + (60 - getScore(teams))); + Scoreboard.Write(team.GetColor() + "Minions: " + getMinions(team).size() + "/60"); + Scoreboard.WriteBlank(); + } } Scoreboard.Draw(); } + public ArrayList getMinions(GameTeam team) + { + ArrayList minionList = new ArrayList<>(); + Iterator minionIterator = _activeMinions.iterator(); + while(minionIterator.hasNext()) + { + Minion minion = minionIterator.next(); + if(minion.getTeam() == team) + minionList.add(minion); + } + return minionList; + } + + private int _nukeFrame; + + @EventHandler + public void nuke(UpdateEvent event) + { + if(event.getType() != UpdateType.FASTEST) + return; + + if(_pendingNukes.isEmpty()) + return; + + Player player = _pendingNukes.get(0); + GameTeam team = GetTeam(player); + + GameTeam otherTeam = null; + for(GameTeam teams : GetTeamList()) + { + if(teams != team) + { + otherTeam = teams; + } + } + int i = 0; + for(Location loc : _minionSpawns.get(team)) + { + ArrayList locations = UtilShapes.getLinesDistancedPoints(loc, _minionSpawns.get(otherTeam).get(i), 1); + Location location = locations.get(_nukeFrame); + + UtilParticle.PlayParticle(UtilParticle.ParticleType.HUGE_EXPLOSION, location, 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers()); + + Iterator minionIterator = _activeMinions.iterator(); + while(minionIterator.hasNext()) + { + Minion minion = minionIterator.next(); + if(minion.getTeam() == team) + continue; + + if(UtilMath.offset(location, minion.getEntity().getLocation()) > 1) + continue; + + minion.despawn(player, true); + minionIterator.remove(); + _deadMinions.add(minion); + } + + if(_nukeFrame >= locations.size()) + { + _nukeFrame = -1; + _pendingNukes.remove(0); + } + i++; + } + _nukeFrame++; + } + public HashMap getMoneyMap() { return _moneyMap; @@ -615,4 +707,9 @@ public class TypeWars extends TeamGame { return _lineShorten; } + + public void addNuke(Player player) + { + _pendingNukes.put(player); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTactician.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTactician.java index edabd1bf4..2c01f5e70 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTactician.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTactician.java @@ -25,9 +25,9 @@ public class KitTactician extends KitTypeWarsBase }, new Perk[] { - new Perk("Growth Liner", new String[]{"This Spell creats a line of fire and all", "enemy mobs that pass it will get a shorter name"}){}, + new Perk("Growth Liner", new String[]{"creates a line that grows your minions names"}){}, new Perk("Mass Slow", new String[]{"Slows down all enemy Minions"}){}, - new Perk("Nuke Spell", new String[]{"Kill all enemy Minions", "This is a single use spell"}){} + new Perk("Nuke Spell", new String[]{"Kill all enemy minions. One use."}){} }, EntityType.SKELETON, new ItemStack(Material.PAPER), new Spell[]{new SpellGrowthLiner(manager), new SpellMassSlow(manager), new SpellKillEverything(manager)}); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTyper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTyper.java index 4283dda75..ef71ee5fb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTyper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTyper.java @@ -26,9 +26,9 @@ public class KitTyper extends KitTypeWarsBase }, new Perk[] { - new Perk("Fire Bomb", new String[]{"Kills all mobs with 8 or less characters", "in a radius of 3"}){}, - new Perk("Speed up", new String[]{"Speeds up your mobs", "in a radius of 3"}){}, - new Perk("Nuke Spell", new String[]{"Kill all enemy Minions", "This is a single use spell"}){} + new Perk("Fire Bomb", new String[]{"Kills small and medium sized enemies."}){}, + new Perk("Speed up", new String[]{"Temporarily boosts speed of your minions."}){}, + new Perk("Nuke Spell", new String[]{"Kill all enemy minions. One use."}){} }, EntityType.ZOMBIE, new ItemStack(Material.FEATHER), new Spell[]{new SpellFirebomb(manager), new SpellSpeedUp(manager), new SpellKillEverything(manager)}); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitWarrior.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitWarrior.java index 1e4646f05..05064b104 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitWarrior.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitWarrior.java @@ -25,9 +25,9 @@ public class KitWarrior extends KitTypeWarsBase }, new Perk[] { - new Perk("Shrink Liner", new String[]{"This Spell creats a line of fire and all", "enemy mobs that pass it will get a shorter name"}){}, - new Perk("Sniper spell", new String[]{"Shoot a minion", "and kill it instantly"}){}, - new Perk("Nuke Spell", new String[]{"Kill all enemy Minions", "This is a single use spell"}){} + new Perk("Shrink Liner", new String[]{"creates a line that shortens enemy names"}){}, + new Perk("Sniper spell", new String[]{"Shoot a minion and kill it"}){}, + new Perk("Nuke Spell", new String[]{"Kill all enemy minions. One use."}){} }, EntityType.SKELETON, new ItemStack(Material.STONE_SWORD), new Spell[]{new SpellShrinkLiner(manager), new SpellSniper(manager), new SpellKillEverything(manager)}); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellKillEverything.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellKillEverything.java index c8f2b7780..bcada9f99 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellKillEverything.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellKillEverything.java @@ -46,11 +46,9 @@ public class SpellKillEverything extends Spell if(getTypeWars().GetTeam(player) == minion.getTeam()) continue; - minion.despawn(player, true); - minionIterator.remove(); minionList.add(minion); - getTypeWars().getDeadMinions().add(minion); } + getTypeWars().addNuke(player); Bukkit.getPluginManager().callEvent(new ActivateNukeSpellEvent(player, minionList)); return true; } From f8528c9cffbbc14a46ab6f9259ace2aaca3564b5 Mon Sep 17 00:00:00 2001 From: Sarah Date: Thu, 8 Oct 2015 19:04:39 +0200 Subject: [PATCH 011/113] Fixing Nuke animation bugs. --- .../arcade/game/games/typewars/Minion.java | 14 +++- .../arcade/game/games/typewars/TypeWars.java | 67 ++++++++++++------- 2 files changed, 54 insertions(+), 27 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java index 1704101e5..79752bb99 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java @@ -31,8 +31,10 @@ import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; import org.bukkit.event.HandlerList; import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.inventory.ItemStack; public class Minion implements Listener @@ -267,7 +269,17 @@ public class Minion implements Listener _killed = killed; _player = player; _die = true; - ((Creeper) _entity).damage(10000); + try + { + ((Creeper) _entity).damage(10000); + } + catch (Exception e) {} + } + + @EventHandler(priority=EventPriority.LOWEST) + public void noItems(EntityDeathEvent event) + { + event.getDrops().clear(); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index bad98b069..c1048b4e4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -155,8 +155,8 @@ public class TypeWars extends TeamGame _lineShorten.put(team, new ArrayList()); } - _timeToSpawnBlue = 30000 / GetTeam(ChatColor.RED).GetPlayers(true).size(); - _timeToSpawnBlue = 30000 / GetTeam(ChatColor.BLUE).GetPlayers(true).size(); + _timeToSpawnBlue = 10000 / GetTeamList().get(0).GetPlayers(true).size(); + _timeToSpawnBlue = 10000 / GetTeamList().get(1).GetPlayers(true).size(); _lastSpawnedRed = System.currentTimeMillis(); _lastSpawnedBlue = System.currentTimeMillis(); @@ -208,6 +208,12 @@ public class TypeWars extends TeamGame { if(teams != team) { + if(getMinions(team).size() >= 60) + { + UtilPlayer.message(event.getPlayer(), F.main("Game", "Your Team cant have more than 60 Minions")); + return; + } + this.CreatureAllowOverride = true; _moneyMap.put(event.getPlayer(), _moneyMap.get(event.getPlayer()) - type.getCost()); UtilPlayer.message(event.getPlayer(), F.main("Game", "You bought a Minion.")); @@ -235,33 +241,41 @@ public class TypeWars extends TeamGame if(UtilTime.elapsed(_lastSpawnedRed, _timeToSpawnRed)) { - _lastSpawnedRed = System.currentTimeMillis(); - - this.CreatureAllowOverride = true; - int rdm = UtilMath.r(_minionSpawns.get(GetTeam(ChatColor.RED)).size()); - Minion minion = new Minion(Manager, _minionSpawns.get(GetTeam(ChatColor.RED)).get(rdm), _minionSpawns.get(GetTeam(ChatColor.BLUE)).get(rdm), GetTeam(ChatColor.RED)); - Bukkit.getPluginManager().registerEvents(minion, Manager.getPlugin()); - _activeMinions.add(minion); - - this.CreatureAllowOverride = false; + if(getMinions(GetTeamList().get(0)).size() < 60) + { + _lastSpawnedRed = System.currentTimeMillis(); - if(_timeToSpawnRed > 12000 / GetTeam(ChatColor.BLUE).GetPlayers(true).size()) - _timeToSpawnRed = _timeToSpawnRed - 75; + this.CreatureAllowOverride = true; + int rdm = UtilMath.r(_minionSpawns.get(GetTeamList().get(0)).size()); + Minion minion = new Minion(Manager, _minionSpawns.get(GetTeamList().get(0)).get(rdm), _minionSpawns.get(GetTeamList().get(1)).get(rdm), GetTeamList().get(0)); + Bukkit.getPluginManager().registerEvents(minion, Manager.getPlugin()); + _activeMinions.add(minion); + + this.CreatureAllowOverride = false; + + if(_timeToSpawnRed > 10000 / GetTeamList().get(1).GetPlayers(true).size()) + _timeToSpawnRed = _timeToSpawnRed - 75; + + } } if(UtilTime.elapsed(_lastSpawnedBlue, _timeToSpawnBlue)) { - _lastSpawnedBlue = System.currentTimeMillis(); + if(getMinions(GetTeamList().get(1)).size() < 60) + { + _lastSpawnedBlue = System.currentTimeMillis(); - this.CreatureAllowOverride = true; - int rdm = UtilMath.r(_minionSpawns.get(GetTeam(ChatColor.BLUE)).size()); - Minion minion = new Minion(Manager, _minionSpawns.get(GetTeam(ChatColor.BLUE)).get(rdm), _minionSpawns.get(GetTeam(ChatColor.RED)).get(rdm), GetTeam(ChatColor.BLUE)); - Bukkit.getPluginManager().registerEvents(minion, Manager.getPlugin()); - _activeMinions.add(minion); + this.CreatureAllowOverride = true; + int rdm = UtilMath.r(_minionSpawns.get(GetTeamList().get(1)).size()); + Minion minion = new Minion(Manager, _minionSpawns.get(GetTeamList().get(1)).get(rdm), _minionSpawns.get(GetTeamList().get(0)).get(rdm), GetTeamList().get(1)); + Bukkit.getPluginManager().registerEvents(minion, Manager.getPlugin()); + _activeMinions.add(minion); - this.CreatureAllowOverride = false; + this.CreatureAllowOverride = false; - if(_timeToSpawnBlue > 12000 / GetTeam(ChatColor.RED).GetPlayers(true).size()) - _timeToSpawnBlue = _timeToSpawnRed - 75; + if(_timeToSpawnBlue > 10000 / GetTeamList().get(0).GetPlayers(true).size()) + _timeToSpawnBlue = _timeToSpawnRed - 75; + + } } } @@ -628,7 +642,7 @@ public class TypeWars extends TeamGame @EventHandler public void nuke(UpdateEvent event) { - if(event.getType() != UpdateType.FASTEST) + if(event.getType() != UpdateType.TICK) return; if(_pendingNukes.isEmpty()) @@ -668,10 +682,11 @@ public class TypeWars extends TeamGame _deadMinions.add(minion); } - if(_nukeFrame >= locations.size()) + if(_nukeFrame >= locations.size() - 1) { - _nukeFrame = -1; + _nukeFrame = 0; _pendingNukes.remove(0); + break; } i++; } @@ -710,6 +725,6 @@ public class TypeWars extends TeamGame public void addNuke(Player player) { - _pendingNukes.put(player); + _pendingNukes.add(player); } } From 65b0d682445bed255396ead4cd9bea5f842e356a Mon Sep 17 00:00:00 2001 From: Sarah Date: Sat, 10 Oct 2015 16:56:21 +0200 Subject: [PATCH 012/113] adding more mobs and hiding enemy mob name tags. --- .../arcade/game/games/typewars/Minion.java | 13 +++++- .../game/games/typewars/MinionType.java | 29 +++++++----- .../arcade/game/games/typewars/TypeWars.java | 45 +++++++++++++++---- .../games/typewars/kits/KitTypeWarsBase.java | 7 ++- 4 files changed, 70 insertions(+), 24 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java index 79752bb99..389b2e8d7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java @@ -8,11 +8,13 @@ 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.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilServer; import mineplex.core.disguise.disguises.DisguiseBase; import mineplex.core.disguise.disguises.DisguiseCreeper; +import mineplex.core.hologram.Hologram; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; @@ -172,6 +174,7 @@ public class Minion implements Listener private Player _player; private Player _killer; private Location _lastNameChanged; + private Hologram _hologram; private int _money; private float _walkSpeed; private boolean _spawned; @@ -232,7 +235,7 @@ public class Minion implements Listener { Object disguise = _type.getDisguiseClass().getConstructors()[0].newInstance(_entity); Class clazz = _type.getDisguiseClass(); - clazz.getMethod("setName", String.class).invoke(disguise, _team.GetColor() + _name); + //clazz.getMethod("setName", String.class).invoke(disguise, _team.GetColor() + _name); clazz.getMethod("setCustomNameVisible", boolean.class).invoke(disguise, true); try { @@ -243,7 +246,7 @@ public class Minion implements Listener _manager.GetDisguise().disguise((DisguiseBase)disguise); } catch (Exception e) {} - + _hologram = new Hologram(_manager.getHologramManager(), _entity.getLocation().add(0, 2, 0), _team.GetColor() + _name); } private void path() @@ -269,6 +272,7 @@ public class Minion implements Listener _killed = killed; _player = player; _die = true; + _hologram.stop(); try { ((Creeper) _entity).damage(10000); @@ -448,5 +452,10 @@ public class Minion implements Listener { return _lastNameChanged; } + + public Hologram getHologram() + { + return _hologram; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionType.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionType.java index c42b28a0d..26d0341fa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionType.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionType.java @@ -17,15 +17,15 @@ import org.bukkit.entity.EntityType; public enum MinionType { - //ZOMBIE(DisguiseZombie.class ,EntityType.ZOMBIE, 9, 12, (float) 1.5, 2, 3, 4, Material.ROTTEN_FLESH), - SKELETON(DisguiseSkeleton.class ,EntityType.SKELETON, 7, 10, (float) 1.5, 2, 3, 4, Material.BONE), - //CREEPER(DisguiseCreeper.class ,EntityType.CREEPER, 9, 12, (float) 1.5, 2, 3, 4, Material.SULPHUR), - WOLF(DisguiseWolf.class ,EntityType.WOLF, 3, 6, 2, 1, 2, 3, Material.COOKED_BEEF), - //SLIME(DisguiseSlime.class ,EntityType.SLIME, 3, 8, 2, 1, 2, 3, Material.SLIME_BALL), - //CUBE(DisguiseMagmaCube.class ,EntityType.MAGMA_CUBE, 3, 8, 2, 1, 2, 3, Material.MAGMA_CREAM), - IRON_GOLEM(DisguiseIronGolem.class ,EntityType.IRON_GOLEM, 10, 18, 1, 4, 6, 8, Material.IRON_INGOT); - //HORSE(DisguiseHorse.class ,EntityType.HORSE, 13, 18, 1, 4, 6, 8, Material.APPLE), - //ENDERMAN(DisguiseEnderman.class ,EntityType.ENDERMAN, 13, 18, 1, 4, 6, 8, Material.ENDER_STONE); + ZOMBIE(DisguiseZombie.class ,EntityType.ZOMBIE, 9, 12, (float) 1.5, 2, 3, 4, 0D, Material.ROTTEN_FLESH), + SKELETON(DisguiseSkeleton.class ,EntityType.SKELETON, 7, 10, (float) 1.5, 2, 3, 4, 0D, Material.BONE), + CREEPER(DisguiseCreeper.class ,EntityType.CREEPER, 9, 12, (float) 1.5, 2, 3, 4, 0D, Material.SULPHUR), + WOLF(DisguiseWolf.class ,EntityType.WOLF, 3, 6, 2, 1, 2, 3, -1D, Material.COOKED_BEEF), + SLIME(DisguiseSlime.class ,EntityType.SLIME, 3, 8, 2, 1, 2, 3, -1D, Material.SLIME_BALL), + CUBE(DisguiseMagmaCube.class ,EntityType.MAGMA_CUBE, 3, 8, 2, 1, 2, 3, -1D, Material.MAGMA_CREAM), + IRON_GOLEM(DisguiseIronGolem.class ,EntityType.IRON_GOLEM, 10, 18, 1, 4, 6, 8, 0.5D, Material.IRON_INGOT), + HORSE(DisguiseHorse.class ,EntityType.HORSE, 13, 18, 1, 4, 6, 8, 0D, Material.APPLE), + ENDERMAN(DisguiseEnderman.class ,EntityType.ENDERMAN, 13, 18, 1, 4, 6, 8, 1D, Material.ENDER_STONE); private Class _disguiseClass; @@ -37,9 +37,10 @@ public enum MinionType private int _maxMoney; private int _cost; + private double _tagHight; private Material _displayItem; - private MinionType(Class disguiseClass, EntityType type, int minName, int maxName, float walkSpeed, int minMoney, int maxMoney, int cost, Material displayItem) + private MinionType(Class disguiseClass, EntityType type, int minName, int maxName, float walkSpeed, int minMoney, int maxMoney, int cost, double tagHight, Material displayItem) { _disguiseClass = disguiseClass; _type = type; @@ -50,6 +51,7 @@ public enum MinionType _maxMoney = maxMoney; _cost = cost; _displayItem = displayItem; + _tagHight = tagHight; } public EntityType getType() @@ -94,7 +96,12 @@ public enum MinionType public Class getDisguiseClass() { - return _disguiseClass; + return _disguiseClass; + } + + public double getTagHight() + { + return _tagHight; } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index c1048b4e4..2c945a17f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -12,12 +12,14 @@ import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilShapes; +import mineplex.core.common.util.UtilSound; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTextBottom; import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTime; +import mineplex.core.hologram.Hologram; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -37,10 +39,13 @@ import nautilus.game.arcade.game.games.typewars.stats.PerfectionistStatTracker; import nautilus.game.arcade.game.games.typewars.stats.WaitForItStatTracker; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.world.WorldData; +import net.minecraft.server.v1_7_R4.DataWatcher; +import net.minecraft.server.v1_7_R4.PacketPlayOutEntityMetadata; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; +import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.AsyncPlayerChatEvent; @@ -280,7 +285,7 @@ public class TypeWars extends TeamGame } @EventHandler - public void moveMinions(UpdateEvent event) + public void updateMinions(UpdateEvent event) { if(event.getType() != UpdateType.TICK) return; @@ -303,6 +308,22 @@ public class TypeWars extends TeamGame _finishedMinions.add(minion); } } + + for(Player player : GetPlayers(false)) + { + if(IsPlaying(player)) + { + if(GetTeam(player) == minion.getTeam()) + continue; + } + + Hologram hologram = minion.getHologram(); + double yAdd = UtilPlayer.is1_8(player) ? 2.18 : 2.3; + hologram.setLocation(minion.getEntity().getLocation().add(0, minion.getType().getTagHight() + yAdd, 0)); + hologram.setHologramTarget(Hologram.HologramTarget.WHITELIST); + hologram.addPlayer(player); + hologram.start(); + } } } @@ -403,7 +424,7 @@ public class TypeWars extends TeamGame for(GameTeam team : GetTeamList()) { - if(getScore(team) >= 110) + if(getScore(team) >= 60) { winners.add(team); } @@ -485,6 +506,9 @@ public class TypeWars extends TeamGame int i = 4; for(MinionType type : MinionType.values()) { + if(type != MinionType.SKELETON && type != MinionType.WOLF && type != MinionType.IRON_GOLEM) + continue; + if(_moneyMap.get(player) >= type.getCost()) { player.getInventory().setItem(i, ItemStackFactory.Instance.CreateStack(type.getDisplayItem(), (byte) 0, Math.round(_moneyMap.get(player)/type.getCost()), C.cGreen + "Spawn " + type.getType().getName() + " Cost: " + type.getCost())); @@ -659,6 +683,14 @@ public class TypeWars extends TeamGame otherTeam = teams; } } + ArrayList testLocs = UtilShapes.getLinesDistancedPoints(_minionSpawns.get(team).get(0), _minionSpawns.get(otherTeam).get(0), 1); + + if(_nukeFrame >= testLocs.size()) + { + _nukeFrame = 0; + _pendingNukes.remove(0); + return; + } int i = 0; for(Location loc : _minionSpawns.get(team)) { @@ -666,6 +698,8 @@ public class TypeWars extends TeamGame Location location = locations.get(_nukeFrame); UtilParticle.PlayParticle(UtilParticle.ParticleType.HUGE_EXPLOSION, location, 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers()); + for(Player players : GetPlayers(false)) + players.playSound(location, Sound.EXPLODE, 1, 1); Iterator minionIterator = _activeMinions.iterator(); while(minionIterator.hasNext()) @@ -681,13 +715,6 @@ public class TypeWars extends TeamGame minionIterator.remove(); _deadMinions.add(minion); } - - if(_nukeFrame >= locations.size() - 1) - { - _nukeFrame = 0; - _pendingNukes.remove(0); - break; - } i++; } _nukeFrame++; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTypeWarsBase.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTypeWarsBase.java index 3c30c9796..82274d79e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTypeWarsBase.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTypeWarsBase.java @@ -52,8 +52,11 @@ public abstract class KitTypeWarsBase extends Kit int i = 4; for(MinionType type : MinionType.values()) { - player.getInventory().setItem(i, ItemStackFactory.Instance.CreateStack(type.getDisplayItem(), (byte) 0, 1, C.cYellow + "Spawn " + type.getType().getName() + " Cost: " + type.getCost())); - i++; + if(type == MinionType.SKELETON || type == MinionType.WOLF || type == MinionType.IRON_GOLEM) + { + player.getInventory().setItem(i, ItemStackFactory.Instance.CreateStack(type.getDisplayItem(), (byte) 0, 1, C.cYellow + "Spawn " + type.getType().getName() + " Cost: " + type.getCost())); + i++; + } } } From e969e1adeb2440094d7a6a0e92438f308acd9c27 Mon Sep 17 00:00:00 2001 From: Sarah Date: Mon, 12 Oct 2015 21:25:59 +0200 Subject: [PATCH 013/113] pushing for Lib to check because of Holograms, also editing spell names, removing 2 word words and editing the sniper spell. --- .../arcade/game/games/typewars/Minion.java | 19 ++++++++++++- .../arcade/game/games/typewars/TypeWars.java | 5 ++-- .../game/games/typewars/kits/KitTyper.java | 2 +- .../game/games/typewars/kits/KitWarrior.java | 2 +- .../typewars/spells/SpellShrinkLiner.java | 2 +- .../games/typewars/spells/SpellSniper.java | 27 ++++++++++++------- .../games/typewars/spells/SpellSpeedUp.java | 2 +- 7 files changed, 41 insertions(+), 18 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java index 389b2e8d7..0f88f5ba9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java @@ -42,7 +42,7 @@ import org.bukkit.inventory.ItemStack; public class Minion implements Listener { - private static String[] NAMES = new String[]{"Fishing", "Cookie", "Sleeping", "Diamond", "Banana", "Christmas Holidays", "Tree", "Egg", "Cat", + private static String[] NAMES = new String[]{"Fishing", "Cookie", "Sleeping", "Diamond", "Banana", "Tree", "Egg", "Cat", "Quadrilateral", "Rollercoaster", "Hallucinating", "Advertisement", "Entertainment", "Administrator", "Intergalactic", "International", "Understanding", "Investigation", "Veterinarian", "Photographer", "Cheeseburger", "Civilization", "Tranquilizer", "Conversation", "EnderDragon", "Engineering", "Philippines", "Countryside", "Electricity", "Caterpillar", "Keyboarding", "Agriculture", "Mathematics", "Millimeters", "Centimeters", "Screwdriver", "Achievement", "Necromancer", @@ -231,6 +231,10 @@ public class Minion implements Listener private void disguiseCreeper() { + if(_hologram != null) + { + _hologram.setText(_team.GetColor() + _name); + } try { Object disguise = _type.getDisguiseClass().getConstructors()[0].newInstance(_entity); @@ -247,6 +251,7 @@ public class Minion implements Listener } catch (Exception e) {} _hologram = new Hologram(_manager.getHologramManager(), _entity.getLocation().add(0, 2, 0), _team.GetColor() + _name); + _hologram.setHologramTarget(Hologram.HologramTarget.WHITELIST); } private void path() @@ -272,6 +277,18 @@ public class Minion implements Listener _killed = killed; _player = player; _die = true; + for(Player players : UtilServer.getPlayers()) + { + try + { + _hologram.removePlayer(players); + _hologram.setLocation(new Location(_entity.getWorld(), 0, 0, 0)); + } + catch (Exception e) + { + + } + } _hologram.stop(); try { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index 2c945a17f..03655ad56 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -258,7 +258,7 @@ public class TypeWars extends TeamGame this.CreatureAllowOverride = false; - if(_timeToSpawnRed > 10000 / GetTeamList().get(1).GetPlayers(true).size()) + if(_timeToSpawnRed > 10000 / (GetTeamList().get(1).GetPlayers(true).size() > 0 ? GetTeamList().get(1).GetPlayers(true).size() : 1)) _timeToSpawnRed = _timeToSpawnRed - 75; } @@ -277,7 +277,7 @@ public class TypeWars extends TeamGame this.CreatureAllowOverride = false; - if(_timeToSpawnBlue > 10000 / GetTeamList().get(0).GetPlayers(true).size()) + if(_timeToSpawnBlue > 10000 / (GetTeamList().get(0).GetPlayers(true).size() > 0 ? GetTeamList().get(0).GetPlayers(true).size() : 1)) _timeToSpawnBlue = _timeToSpawnRed - 75; } @@ -320,7 +320,6 @@ public class TypeWars extends TeamGame Hologram hologram = minion.getHologram(); double yAdd = UtilPlayer.is1_8(player) ? 2.18 : 2.3; hologram.setLocation(minion.getEntity().getLocation().add(0, minion.getType().getTagHight() + yAdd, 0)); - hologram.setHologramTarget(Hologram.HologramTarget.WHITELIST); hologram.addPlayer(player); hologram.start(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTyper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTyper.java index ef71ee5fb..c9dffce37 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTyper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTyper.java @@ -27,7 +27,7 @@ public class KitTyper extends KitTypeWarsBase new Perk[] { new Perk("Fire Bomb", new String[]{"Kills small and medium sized enemies."}){}, - new Perk("Speed up", new String[]{"Temporarily boosts speed of your minions."}){}, + new Perk("Speed Boost", new String[]{"Temporarily boosts speed of your minions."}){}, new Perk("Nuke Spell", new String[]{"Kill all enemy minions. One use."}){} }, EntityType.ZOMBIE, new ItemStack(Material.FEATHER), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitWarrior.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitWarrior.java index 05064b104..b4a6886fc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitWarrior.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitWarrior.java @@ -25,7 +25,7 @@ public class KitWarrior extends KitTypeWarsBase }, new Perk[] { - new Perk("Shrink Liner", new String[]{"creates a line that shortens enemy names"}){}, + new Perk("Shrinking Line", new String[]{"creates a line that shortens enemy names"}){}, new Perk("Sniper spell", new String[]{"Shoot a minion and kill it"}){}, new Perk("Nuke Spell", new String[]{"Kill all enemy minions. One use."}){} }, diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellShrinkLiner.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellShrinkLiner.java index 5b2beba08..792c62792 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellShrinkLiner.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellShrinkLiner.java @@ -17,7 +17,7 @@ public class SpellShrinkLiner extends Spell public SpellShrinkLiner(ArcadeManager manager) { - super(manager, "Shrink Liner", 7, Material.BLAZE_ROD, 2000L, false); + super(manager, "Shrinking Line", 7, Material.BLAZE_ROD, 2000L, false); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellSniper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellSniper.java index 1ac26542a..89b275e8d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellSniper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellSniper.java @@ -1,5 +1,6 @@ package nautilus.game.arcade.game.games.typewars.spells; +import java.util.ArrayList; import java.util.Iterator; import org.bukkit.Location; @@ -8,6 +9,7 @@ import org.bukkit.block.BlockFace; import org.bukkit.entity.Player; import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilShapes; import mineplex.core.common.util.UtilParticle.ParticleType; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.typewars.Minion; @@ -31,20 +33,25 @@ public class SpellSniper extends Spell public boolean execute(Player player, Location location) { Iterator minionIterator = getTypeWars().getActiveMinions().iterator(); + + ArrayList locs = UtilShapes.getLinesDistancedPoints(player.getEyeLocation(), location, 0.5); while(minionIterator.hasNext()) { Minion minion = minionIterator.next(); - if(UtilMath.offset2d(minion.getEntity().getLocation(), location) > 2) - continue; - - if(getTypeWars().GetTeam(player) == minion.getTeam()) - continue; - - minion.despawn(player, true); - minionIterator.remove(); - getTypeWars().getDeadMinions().add(minion); - break; + for(Location loc : locs) + { + if(UtilMath.offset2d(minion.getEntity().getLocation(), loc) > 1) + continue; + + if(getTypeWars().GetTeam(player) == minion.getTeam()) + continue; + + minion.despawn(player, true); + minionIterator.remove(); + getTypeWars().getDeadMinions().add(minion); + break; + } } return true; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellSpeedUp.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellSpeedUp.java index b2ea178fd..50e266329 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellSpeedUp.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellSpeedUp.java @@ -15,7 +15,7 @@ public class SpellSpeedUp extends Spell public SpellSpeedUp(ArcadeManager manager) { - super(manager, "Speed up", 6, Material.FEATHER, 5000L, false); + super(manager, "Speed Boost", 6, Material.FEATHER, 5000L, false); } @Override From cef52368a31d71dbd0e90b4908f621ba5e2a064c Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Tue, 13 Oct 2015 08:59:13 +1300 Subject: [PATCH 014/113] Hologram fixes --- .../src/mineplex/core/hologram/Hologram.java | 2 +- .../arcade/game/games/typewars/Minion.java | 38 +++++++++++-------- .../arcade/game/games/typewars/TypeWars.java | 2 - 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/hologram/Hologram.java b/Plugins/Mineplex.Core/src/mineplex/core/hologram/Hologram.java index fd5311707..38577d396 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/hologram/Hologram.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/hologram/Hologram.java @@ -350,7 +350,7 @@ public class Hologram */ public Hologram removePlayer(Player player) { - return addPlayer(player.getName()); + return removePlayer(player.getName()); } /** diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java index 0f88f5ba9..1199032aa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java @@ -231,10 +231,30 @@ public class Minion implements Listener private void disguiseCreeper() { - if(_hologram != null) + if (_hologram != null) { - _hologram.setText(_team.GetColor() + _name); + _hologram.setText(_team.GetColor() + _name); } + else + { + _hologram = new Hologram(_manager.getHologramManager(), _entity + .getLocation().add(0, 2.3, 0), _team.GetColor() + _name); + _hologram.setHologramTarget(Hologram.HologramTarget.WHITELIST); + _hologram.setFollowEntity(_entity); + + for (Player player : _manager.GetGame().GetPlayers(false)) + { + if (_manager.GetGame().GetTeam(player) == _team) + { + continue; + } + + _hologram.addPlayer(player); + } + + _hologram.start(); + } + try { Object disguise = _type.getDisguiseClass().getConstructors()[0].newInstance(_entity); @@ -250,8 +270,6 @@ public class Minion implements Listener _manager.GetDisguise().disguise((DisguiseBase)disguise); } catch (Exception e) {} - _hologram = new Hologram(_manager.getHologramManager(), _entity.getLocation().add(0, 2, 0), _team.GetColor() + _name); - _hologram.setHologramTarget(Hologram.HologramTarget.WHITELIST); } private void path() @@ -277,18 +295,6 @@ public class Minion implements Listener _killed = killed; _player = player; _die = true; - for(Player players : UtilServer.getPlayers()) - { - try - { - _hologram.removePlayer(players); - _hologram.setLocation(new Location(_entity.getWorld(), 0, 0, 0)); - } - catch (Exception e) - { - - } - } _hologram.stop(); try { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index 03655ad56..e806cb427 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -320,8 +320,6 @@ public class TypeWars extends TeamGame Hologram hologram = minion.getHologram(); double yAdd = UtilPlayer.is1_8(player) ? 2.18 : 2.3; hologram.setLocation(minion.getEntity().getLocation().add(0, minion.getType().getTagHight() + yAdd, 0)); - hologram.addPlayer(player); - hologram.start(); } } } From 9010b8bfe9623dca628766e4844b490552f8e6e8 Mon Sep 17 00:00:00 2001 From: Sarah Date: Mon, 12 Oct 2015 22:01:23 +0200 Subject: [PATCH 015/113] removing some unneeded stuff and fixing tag overlaying --- .../src/mineplex/core/hologram/Hologram.java | 5 ++--- .../game/arcade/game/games/typewars/Minion.java | 13 ++++--------- .../game/arcade/game/games/typewars/TypeWars.java | 10 ++-------- .../game/games/typewars/kits/KitTypeWarsBase.java | 5 ----- .../games/typewars/spells/SpellShrinkLiner.java | 1 - 5 files changed, 8 insertions(+), 26 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/hologram/Hologram.java b/Plugins/Mineplex.Core/src/mineplex/core/hologram/Hologram.java index fd5311707..0762b6fe8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/hologram/Hologram.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/hologram/Hologram.java @@ -7,6 +7,8 @@ import java.util.HashSet; import java.util.Iterator; import java.util.Map.Entry; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; import net.minecraft.server.v1_7_R4.DataWatcher; import net.minecraft.server.v1_7_R4.Packet; import net.minecraft.server.v1_7_R4.PacketPlayOutAttachEntity; @@ -23,9 +25,6 @@ import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.util.Vector; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilPlayer; - public class Hologram { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java index 0f88f5ba9..89e83a6ee 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java @@ -1,36 +1,29 @@ package nautilus.game.arcade.game.games.typewars; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; 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.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilServer; import mineplex.core.disguise.disguises.DisguiseBase; -import mineplex.core.disguise.disguises.DisguiseCreeper; import mineplex.core.hologram.Hologram; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.GameTeam; -import net.minecraft.util.com.google.common.collect.Lists; -import org.bukkit.Bukkit; +import org.bukkit.ChatColor; import org.bukkit.Color; import org.bukkit.FireworkEffect.Type; -import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity; import org.bukkit.entity.Creeper; import org.bukkit.entity.Entity; -import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -233,7 +226,8 @@ public class Minion implements Listener { if(_hologram != null) { - _hologram.setText(_team.GetColor() + _name); + _hologram.setText(""); + _hologram.stop(); } try { @@ -252,6 +246,7 @@ public class Minion implements Listener catch (Exception e) {} _hologram = new Hologram(_manager.getHologramManager(), _entity.getLocation().add(0, 2, 0), _team.GetColor() + _name); _hologram.setHologramTarget(Hologram.HologramTarget.WHITELIST); + _hologram.start(); } private void path() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index 03655ad56..339cfc7c0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -11,11 +11,10 @@ import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilShapes; -import mineplex.core.common.util.UtilSound; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilShapes; import mineplex.core.common.util.UtilTextBottom; import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTime; @@ -39,11 +38,8 @@ import nautilus.game.arcade.game.games.typewars.stats.PerfectionistStatTracker; import nautilus.game.arcade.game.games.typewars.stats.WaitForItStatTracker; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.world.WorldData; -import net.minecraft.server.v1_7_R4.DataWatcher; -import net.minecraft.server.v1_7_R4.PacketPlayOutEntityMetadata; import org.bukkit.Bukkit; -import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Sound; import org.bukkit.entity.Player; @@ -318,10 +314,8 @@ public class TypeWars extends TeamGame } Hologram hologram = minion.getHologram(); - double yAdd = UtilPlayer.is1_8(player) ? 2.18 : 2.3; - hologram.setLocation(minion.getEntity().getLocation().add(0, minion.getType().getTagHight() + yAdd, 0)); + hologram.setLocation(minion.getEntity().getLocation().add(0, minion.getType().getTagHight() + 2.3, 0)); hologram.addPlayer(player); - hologram.start(); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTypeWarsBase.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTypeWarsBase.java index 82274d79e..2e4252319 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTypeWarsBase.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTypeWarsBase.java @@ -1,12 +1,7 @@ package nautilus.game.arcade.game.games.typewars.kits; -import jdk.nashorn.internal.ir.GetSplitState; import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilPlayer; import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.typewars.MinionType; import nautilus.game.arcade.game.games.typewars.Spell; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellShrinkLiner.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellShrinkLiner.java index 792c62792..3283530c9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellShrinkLiner.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellShrinkLiner.java @@ -3,7 +3,6 @@ package nautilus.game.arcade.game.games.typewars.spells; import java.util.ArrayList; import java.util.Iterator; -import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilParticle.ParticleType; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.typewars.Spell; From 6f55a60de0545749ac47cf878a17bc2bd5206222 Mon Sep 17 00:00:00 2001 From: Sarah Date: Wed, 14 Oct 2015 22:41:34 +0200 Subject: [PATCH 016/113] removing more 2 word words, adding not killable message at Firebomb. --- .../nautilus/game/arcade/game/games/typewars/Minion.java | 6 +++--- .../nautilus/game/arcade/game/games/typewars/TypeWars.java | 2 +- .../game/arcade/game/games/typewars/kits/KitTactician.java | 2 +- .../arcade/game/games/typewars/spells/SpellFirebomb.java | 6 +++++- .../arcade/game/games/typewars/spells/SpellGrowthLiner.java | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java index 06945f6ef..852cd57bf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java @@ -40,14 +40,14 @@ public class Minion implements Listener "Veterinarian", "Photographer", "Cheeseburger", "Civilization", "Tranquilizer", "Conversation", "EnderDragon", "Engineering", "Philippines", "Countryside", "Electricity", "Caterpillar", "Keyboarding", "Agriculture", "Mathematics", "Millimeters", "Centimeters", "Screwdriver", "Achievement", "Necromancer", "Grasshopper", "Quadrillion", "Horseradish", "Aboveground", "Belowground", "Mississippi", "Computerize", "Hibernation", "Radioactive", "Unfortunate", - "Demonstrate", "Gymnastics", "Toothpaste", "Paraphrase", "Stone Hoe", "Limitless", "Breakfast", "Graveyard", "Philippines", "Countryside", + "Demonstrate", "Gymnastics", "Toothpaste", "Paraphrase", "Limitless", "Breakfast", "Graveyard", "Philippines", "Countryside", "Competition", "Management", "Peppermint", "Pyromaniac", "Sandstone", "Vengeance", "Passwords", "Chew", "Philippines", "Countryside", "Competitive", "Accounting", "Generation", "Mechanized", "Minecraft", "Sprinting", "Beautiful", "Container", "Mayonaise", "Generator", "Bombardment", "Laboratory", "BlackBerry", "Calculator", "Mushrooms", "Heartbeat", "Authority", "Apartment", "Deception", "Recommend", "Highlighter", "Incomplete", "Javascript", "Compressor", "Dentistry", "Rectangle", "Exhausted", "Slimeball", "Commander", "Associate", "Complicated", "Government", "Ceptillion", "Deflection", "Cosmetics", "Trapezoid", "Hamburger", "Raspberry", "Developer", "Accompany", "Basketball", "Milkshakes", "Antibiotic", "Vocabulary", "Australia", "Dodecagon", "Miniature", "Blueberry", "Historian", "Machinery", - "Volleyball", "Earthquake", "Girlfriend", "Definition", "Christmas", "Hot Sauce", "Cardboard", "Dimension", "Overreact", "Character", + "Volleyball", "Earthquake", "Girlfriend", "Definition", "Christmas", "Cardboard", "Dimension", "Overreact", "Character", "Television", "Motorcycle", "Despicable", "Contradict", "Chocolate", "Screaming", "Microsoft", "Barbarian", "Backspace", "Knowledge", "Microphone", "Buccaneers", "Affordable", "Attendance", "Halloween", "Demanding", "Wrestling", "Lightbulb", "Wisconsin", "Secondary", "Rhinoceros", "Applesauce", "Disconnect", "Protection", "Vacations", "Hopscotch", "Moderator", "Invisible", "Tennessee", "Adjective", @@ -62,7 +62,7 @@ public class Minion implements Listener "Levitation", "Resistance", "Inflatable", "Newspaper", "Sketching", "Centipede", "Parachute", "Treachery", "Crocodile", "Baseball", "Vegetables", "Lighthouse", "Relentless", "Dinosaurs", "Teenagers", "Cartwheel", "Barricade", "Blowtorch", "Alligator", "Presents", "Whispering", "Helicopter", "Mistakable", "Tarantula", "Grassland", "Hard Rock", "President", "Raincloud", "Incentive", "Balloons", - "Announcing", "Mechanical", "Expectance", "Stone Axe", "Mountains", "Pop Music", "Fingertip", "Millenium", "Structure", "Keyboard", + "Announcing", "Mechanical", "Expectance", "Mountains", "Pop Music", "Fingertip", "Millenium", "Structure", "Keyboard", "Meditation", "Toothbrush", "Tumbleweed", "Sandstone", "Dumplings", "Scientist", "Pineapple", "Boyfriend", "Spotlight", "Computer", "Clothing", "Elephant", "Reptiles", "Scorpion", "Redstone", "Diamonds", "Porkchop", "Endermen", "Obsidian", "Planting", "Potatoes", "Vampires", "Bracelet", "Coloring", "Thousand", "Hologram", "Lipstick", "Cruising", "Delivery", "Dreaming", diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index 04b9bf74f..ad96748b2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -635,7 +635,7 @@ public class TypeWars extends TeamGame continue; Scoreboard.Write(team.GetColor() + C.Bold + team.GetName() + " Team"); - Scoreboard.Write(team.GetColor() + "Lives: " + (60 - getScore(teams))); + Scoreboard.Write(team.GetColor() + "Lives: " + ((60 - getScore(teams)) > 0 ? 0 : (60 - getScore(teams)))); Scoreboard.Write(team.GetColor() + "Minions: " + getMinions(team).size() + "/60"); Scoreboard.WriteBlank(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTactician.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTactician.java index 2c01f5e70..e15538677 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTactician.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTactician.java @@ -25,7 +25,7 @@ public class KitTactician extends KitTypeWarsBase }, new Perk[] { - new Perk("Growth Liner", new String[]{"creates a line that grows your minions names"}){}, + new Perk("Growth Line", new String[]{"creates a line that grows your minions names"}){}, new Perk("Mass Slow", new String[]{"Slows down all enemy Minions"}){}, new Perk("Nuke Spell", new String[]{"Kill all enemy minions. One use."}){} }, diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellFirebomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellFirebomb.java index a657430d8..f176f71b5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellFirebomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellFirebomb.java @@ -2,7 +2,9 @@ package nautilus.game.arcade.game.games.typewars.spells; import java.util.Iterator; +import mineplex.core.common.util.F; import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilParticle.ParticleType; import nautilus.game.arcade.ArcadeManager; @@ -37,8 +39,10 @@ public class SpellFirebomb extends Spell continue; if(minion.getName().length() > 8) + { + UtilPlayer.message(player, F.main("Game", F.game(minion.getName()) + " is to strong to be killed with that.")); continue; - + } final Location loc = minion.getEntity().getLocation(); loc.getBlock().setType(Material.FIRE); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellGrowthLiner.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellGrowthLiner.java index 95e92fc3a..548a1197f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellGrowthLiner.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellGrowthLiner.java @@ -17,7 +17,7 @@ public class SpellGrowthLiner extends Spell public SpellGrowthLiner(ArcadeManager manager) { - super(manager, "Growth Liner", 7, Material.STICK, 2000L, false); + super(manager, "Growth Line", 7, Material.STICK, 2000L, false); } @Override From cd4b3054fa60dbfed317a19c18bfcc069c05cd3f Mon Sep 17 00:00:00 2001 From: Sarah Date: Thu, 15 Oct 2015 20:25:35 +0200 Subject: [PATCH 017/113] Fixing "Armor Stand" --- .../src/nautilus/game/arcade/game/games/typewars/Minion.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java index 852cd57bf..1b2c602d2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java @@ -226,7 +226,7 @@ public class Minion implements Listener { if (_hologram != null) { - _hologram.setText(""); + _hologram.setText( _team.GetColor() + _name); _hologram.stop(); } else From b7b99687c80751dd935ffb9eb8e2d4f080bae05a Mon Sep 17 00:00:00 2001 From: Sarah Date: Mon, 19 Oct 2015 01:34:48 +0200 Subject: [PATCH 018/113] decreasing nuke animation --- .../game/arcade/game/games/typewars/TypeWars.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index ad96748b2..d8ce43092 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -687,15 +687,20 @@ public class TypeWars extends TeamGame _pendingNukes.remove(0); return; } + boolean cansee = true; int i = 0; for(Location loc : _minionSpawns.get(team)) { + cansee = !cansee; ArrayList locations = UtilShapes.getLinesDistancedPoints(loc, _minionSpawns.get(otherTeam).get(i), 1); Location location = locations.get(_nukeFrame); - UtilParticle.PlayParticle(UtilParticle.ParticleType.HUGE_EXPLOSION, location, 0, 0, 0, 0, 1, ViewDist.LONG, UtilServer.getPlayers()); - for(Player players : GetPlayers(false)) - players.playSound(location, Sound.EXPLODE, 1, 1); + if(cansee) + { + UtilParticle.PlayParticle(UtilParticle.ParticleType.HUGE_EXPLOSION, location, 0, 0, 0, 0, 1, ViewDist.LONG, UtilServer.getPlayers()); + for(Player players : GetPlayers(false)) + players.playSound(location, Sound.EXPLODE, 1, 1); + } Iterator minionIterator = _activeMinions.iterator(); while(minionIterator.hasNext()) From 6860f013d036001d79fe89f22c2f90458ee2d7cf Mon Sep 17 00:00:00 2001 From: Sarah Date: Tue, 20 Oct 2015 19:23:58 +0200 Subject: [PATCH 019/113] Fixing some spelling typos chat filtering and the scoreboard. --- .../mineplex/core/achievement/Achievement.java | 4 ++-- .../game/arcade/game/games/cards/Cards.java | 15 +++++++-------- .../game/arcade/game/games/typewars/Minion.java | 3 +-- .../game/arcade/game/games/typewars/TypeWars.java | 8 +++++++- .../game/games/typewars/kits/KitTactician.java | 2 +- .../game/games/typewars/kits/KitWarrior.java | 2 +- 6 files changed, 19 insertions(+), 15 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java index a8350f68c..154ac75a1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java @@ -747,9 +747,9 @@ public enum Achievement new int[]{1}, AchievementCategory.TYPE_WARS), - TYPE_WARS_WINNS("The true Typewriter", 2000, + TYPE_WARS_WINNS("The True Typewriter", 2000, new String[]{"Type Wars.Wins"}, - new String[]{"winn 30 Games"}, + new String[]{"Win 30 Games"}, new int[]{30}, AchievementCategory.TYPE_WARS); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cards/Cards.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cards/Cards.java index 07e2ab006..8943458b7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cards/Cards.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cards/Cards.java @@ -2,17 +2,9 @@ package nautilus.game.arcade.game.games.cards; import java.util.ArrayList; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.entity.ItemFrame; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.inventory.ItemStack; - import mineplex.core.common.util.C; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; @@ -23,6 +15,13 @@ import nautilus.game.arcade.game.games.GameScore; import nautilus.game.arcade.game.games.cards.kits.KitPlayer; import nautilus.game.arcade.kit.Kit; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.ItemFrame; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.inventory.ItemStack; + public class Cards extends SoloGame { private CardFactory _cardFactory; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java index 1b2c602d2..2389b99d7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java @@ -153,8 +153,7 @@ public class Minion implements Listener "Fly", "Boy", "Rag", "New", "Jet", "Pet", "Tin", "Pen", "Car", "Old", "Age", "TNT", "Leg", "Axe", "UFO", "Rap", "Wet", "Tie", "May", "Gas", "Hue", "Wax", "Toy", "Lay", "Pop", "Dry", "Sea", - "See", "Ash", "Mom", "Box", "Key", "Fat", "Spy", - "why +3?"}; + "See", "Ash", "Mom", "Box", "Key", "Fat", "Spy"}; private ArcadeManager _manager; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index d8ce43092..d5e09f4a6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -336,6 +336,9 @@ public class TypeWars extends TeamGame @EventHandler public void chatCheck(AsyncPlayerChatEvent event) { + if(!IsLive()) + return; + if(!GetPlayers(true).contains(event.getPlayer())) return; @@ -623,6 +626,9 @@ public class TypeWars extends TeamGame if (GetTeamList().isEmpty()) return; + if(!IsLive()) + return; + Scoreboard.Reset(); Scoreboard.WriteBlank(); @@ -635,7 +641,7 @@ public class TypeWars extends TeamGame continue; Scoreboard.Write(team.GetColor() + C.Bold + team.GetName() + " Team"); - Scoreboard.Write(team.GetColor() + "Lives: " + ((60 - getScore(teams)) > 0 ? 0 : (60 - getScore(teams)))); + Scoreboard.Write(team.GetColor() + "Lives: " + (60 - getScore(teams))); Scoreboard.Write(team.GetColor() + "Minions: " + getMinions(team).size() + "/60"); Scoreboard.WriteBlank(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTactician.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTactician.java index e15538677..62ed1d88e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTactician.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTactician.java @@ -25,7 +25,7 @@ public class KitTactician extends KitTypeWarsBase }, new Perk[] { - new Perk("Growth Line", new String[]{"creates a line that grows your minions names"}){}, + new Perk("Growth Line", new String[]{"Creates a line that grows your minions names"}){}, new Perk("Mass Slow", new String[]{"Slows down all enemy Minions"}){}, new Perk("Nuke Spell", new String[]{"Kill all enemy minions. One use."}){} }, diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitWarrior.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitWarrior.java index b4a6886fc..de293df7d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitWarrior.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitWarrior.java @@ -25,7 +25,7 @@ public class KitWarrior extends KitTypeWarsBase }, new Perk[] { - new Perk("Shrinking Line", new String[]{"creates a line that shortens enemy names"}){}, + new Perk("Shrinking Line", new String[]{"Creates a line that shortens enemy names"}){}, new Perk("Sniper spell", new String[]{"Shoot a minion and kill it"}){}, new Perk("Nuke Spell", new String[]{"Kill all enemy minions. One use."}){} }, From e3049fd22e6cae0cb71f89eba8583c30ebb6ba76 Mon Sep 17 00:00:00 2001 From: Sarah Date: Mon, 26 Oct 2015 17:54:45 +0100 Subject: [PATCH 020/113] performance update for Minions and reducing nuke particles. --- .../arcade/game/games/typewars/Minion.java | 29 ++++++++++++------- .../arcade/game/games/typewars/TypeWars.java | 19 +++++++++--- 2 files changed, 34 insertions(+), 14 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java index 2389b99d7..73d4ff5a7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java @@ -32,7 +32,7 @@ import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.inventory.ItemStack; -public class Minion implements Listener +public class Minion { private static String[] NAMES = new String[]{"Fishing", "Cookie", "Sleeping", "Diamond", "Banana", "Tree", "Egg", "Cat", @@ -303,12 +303,8 @@ public class Minion implements Listener event.getDrops().clear(); } - @EventHandler - public void animation(UpdateEvent event) + public void animation() { - if(event.getType() != UpdateType.TICK) - return; - if(!_die) return; @@ -325,8 +321,15 @@ public class Minion implements Listener double xDiff = Math.sin(e/(double)particleAmount * 2 * Math.PI) * radius; double zDiff = Math.cos(e/(double)particleAmount * 2 * Math.PI) * radius; - Location location = _entity.getLocation().clone().add(0.5, 0, 0.5).add(xDiff, particleAmount/10, zDiff); - UtilParticle.PlayParticle(UtilParticle.ParticleType.RED_DUST, location, 0, 0, 0, 0, 1, ViewDist.NORMAL, _player); + Location location = _entity.getLocation().clone().add(0.5, 0, 0.5).add(xDiff, particleAmount/10, zDiff); + try + { + UtilParticle.PlayParticle(UtilParticle.ParticleType.RED_DUST, location, 0, 0, 0, 0, 1, ViewDist.NORMAL, _player); + } + catch (Exception ex) + { + + } } } @@ -340,7 +343,14 @@ public class Minion implements Listener double zDiff = Math.cos(e/(double)particleAmount * 2 * Math.PI) * radius; Location location = _entity.getLocation().clone().add(0.5, 0, 0.5).add(xDiff, particleAmount/10, zDiff); - UtilParticle.PlayParticle(ParticleType.RED_DUST, location, -1, 1, 1, 1, 0,ViewDist.NORMAL, _player); + try + { + UtilParticle.PlayParticle(ParticleType.RED_DUST, location, -1, 1, 1, 1, 0,ViewDist.NORMAL, _player); + } + catch (Exception ex) + { + + } } @@ -358,7 +368,6 @@ public class Minion implements Listener if(_frame == 31) { _die = false; - HandlerList.unregisterAll(this); } _frame++; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index d5e09f4a6..20038c7a9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -222,7 +222,6 @@ public class TypeWars extends TeamGame UtilPlayer.message(event.getPlayer(), F.main("Game", "You bought a Minion.")); int rdm = UtilMath.r(_minionSpawns.get(teams).size()); Minion minion = new Minion(Manager, _minionSpawns.get(teams).get(rdm), _minionSpawns.get(team).get(rdm), teams, event.getPlayer(), true, type); - Bukkit.getPluginManager().registerEvents(minion, Manager.getPlugin()); Bukkit.getPluginManager().callEvent(new SummonMinionEvent(event.getPlayer(), minion)); _activeMinions.add(minion); this.CreatureAllowOverride = false; @@ -251,7 +250,6 @@ public class TypeWars extends TeamGame this.CreatureAllowOverride = true; int rdm = UtilMath.r(_minionSpawns.get(GetTeamList().get(0)).size()); Minion minion = new Minion(Manager, _minionSpawns.get(GetTeamList().get(0)).get(rdm), _minionSpawns.get(GetTeamList().get(1)).get(rdm), GetTeamList().get(0)); - Bukkit.getPluginManager().registerEvents(minion, Manager.getPlugin()); _activeMinions.add(minion); this.CreatureAllowOverride = false; @@ -270,7 +268,6 @@ public class TypeWars extends TeamGame this.CreatureAllowOverride = true; int rdm = UtilMath.r(_minionSpawns.get(GetTeamList().get(1)).size()); Minion minion = new Minion(Manager, _minionSpawns.get(GetTeamList().get(1)).get(rdm), _minionSpawns.get(GetTeamList().get(0)).get(rdm), GetTeamList().get(1)); - Bukkit.getPluginManager().registerEvents(minion, Manager.getPlugin()); _activeMinions.add(minion); this.CreatureAllowOverride = false; @@ -322,6 +319,20 @@ public class TypeWars extends TeamGame } } + @EventHandler + public void minionAnimation(UpdateEvent event) + { + if(event.getType() != UpdateType.TICK) + return; + + Iterator minionIterator = _activeMinions.iterator(); + while(minionIterator.hasNext()) + { + Minion minion = minionIterator.next(); + minion.animation(); + } + } + public int getScore(GameTeam team) { int i = 0; @@ -703,7 +714,7 @@ public class TypeWars extends TeamGame if(cansee) { - UtilParticle.PlayParticle(UtilParticle.ParticleType.HUGE_EXPLOSION, location, 0, 0, 0, 0, 1, ViewDist.LONG, UtilServer.getPlayers()); + UtilParticle.PlayParticle(UtilParticle.ParticleType.HUGE_EXPLOSION, location, 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers()); for(Player players : GetPlayers(false)) players.playSound(location, Sound.EXPLODE, 1, 1); } From d0e49280a48ce9bb530d0ccd119090c3f11bdf99 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Wed, 28 Oct 2015 13:34:03 -0400 Subject: [PATCH 021/113] Added a sniper kit! :D --- .../game/games/paintball/Paintball.java | 5 + .../games/paintball/kits/KitMachineGun.java | 1 + .../game/games/paintball/kits/KitRifle.java | 1 + .../game/games/paintball/kits/KitShotgun.java | 1 + .../game/games/paintball/kits/KitSniper.java | 77 +++++++++ .../kits}/perks/PerkPaintballMachineGun.java | 2 +- .../kits}/perks/PerkPaintballRifle.java | 2 +- .../kits}/perks/PerkPaintballShotgun.java | 2 +- .../kits/perks/PerkPaintballSniper.java | 147 ++++++++++++++++++ 9 files changed, 235 insertions(+), 3 deletions(-) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitSniper.java rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/{kit => game/games/paintball/kits}/perks/PerkPaintballMachineGun.java (98%) rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/{kit => game/games/paintball/kits}/perks/PerkPaintballRifle.java (97%) rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/{kit => game/games/paintball/kits}/perks/PerkPaintballShotgun.java (97%) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballSniper.java diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java index 19ead99b7..57ea34f63 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java @@ -24,6 +24,7 @@ import nautilus.game.arcade.game.TeamGame; import nautilus.game.arcade.game.games.paintball.kits.KitMachineGun; import nautilus.game.arcade.game.games.paintball.kits.KitRifle; import nautilus.game.arcade.game.games.paintball.kits.KitShotgun; +import nautilus.game.arcade.game.games.paintball.kits.KitSniper; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.stats.KillFastStatTracker; import nautilus.game.arcade.stats.LastStandStatTracker; @@ -262,6 +263,10 @@ public class Paintball extends TeamGame { count = 3; } + if (GetKit(damager) instanceof KitSniper) + { + count = ((KitSniper) GetKit(damager)).getPaintDamage(damager); + } } //Out diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitMachineGun.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitMachineGun.java index 3c6db6cc1..04a62d950 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitMachineGun.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitMachineGun.java @@ -11,6 +11,7 @@ import org.bukkit.inventory.meta.PotionMeta; import mineplex.core.common.util.C; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.paintball.kits.perks.PerkPaintballMachineGun; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitRifle.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitRifle.java index 4bbf4b523..ac0f1b480 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitRifle.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitRifle.java @@ -12,6 +12,7 @@ import org.bukkit.potion.PotionEffectType; import mineplex.core.common.util.C; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.paintball.kits.perks.PerkPaintballRifle; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitShotgun.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitShotgun.java index a397ccb10..ce2e2db69 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitShotgun.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitShotgun.java @@ -11,6 +11,7 @@ import org.bukkit.inventory.meta.PotionMeta; import mineplex.core.common.util.C; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.paintball.kits.perks.PerkPaintballShotgun; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitSniper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitSniper.java new file mode 100644 index 000000000..8075cd4ee --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitSniper.java @@ -0,0 +1,77 @@ +package nautilus.game.arcade.game.games.paintball.kits; + +import mineplex.core.achievement.Achievement; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilInv; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.paintball.kits.perks.PerkPaintballShotgun; +import nautilus.game.arcade.game.games.paintball.kits.perks.PerkPaintballSniper; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkSlow; + +import org.bukkit.Color; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +public class KitSniper extends Kit +{ + public KitSniper(ArcadeManager manager) + { + super(manager, "Sniper", KitAvailability.Achievement, + + new String[] + { + "Long range sniper rifle", + C.cGold + "Higher damage every second scoped" + }, + + new Perk[] + { + new PerkPaintballShotgun(), + new PerkSlow(0) + }, + EntityType.ZOMBIE, + new ItemStack(Material.STONE_HOE)); + + setAchievementRequirements(new Achievement[] + { + Achievement.SUPER_PAINTBALL_FLAWLESS_VICTORY, + Achievement.SUPER_PAINTBALL_KILLING_SPREE, + Achievement.SUPER_PAINTBALL_LAST_STAND, + Achievement.SUPER_PAINTBALL_MEDIC, + Achievement.SUPER_PAINTBALL_SPEEDRUNNER, + Achievement.SUPER_PAINTBALL_WINS + }); + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_HOE, (byte)0, 1, C.cWhite + "Paintball Sniper Rifle")); + + UtilInv.insert(player, ItemStackFactory.Instance.CreateStack(Material.POTION, (byte) 16429, 1, "Water Bomb")); + + player.getInventory().setHelmet(new ItemBuilder(Material.LEATHER_HELMET).setColor(Color.WHITE).build()); + player.getInventory().setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(Color.WHITE).build()); + player.getInventory().setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).setColor(Color.WHITE).build()); + player.getInventory().setBoots(new ItemBuilder(Material.LEATHER_BOOTS).setColor(Color.WHITE).build()); + } + + public int getPaintDamage(Player player) + { + for (Perk perk : this.GetPerks()) + { + if (perk instanceof PerkPaintballSniper) + { + return ((PerkPaintballSniper) perk).getPaintDamage(player); + } + } + return 0; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPaintballMachineGun.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballMachineGun.java similarity index 98% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPaintballMachineGun.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballMachineGun.java index f2097476a..9cc331b61 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPaintballMachineGun.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballMachineGun.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.kit.perks; +package nautilus.game.arcade.game.games.paintball.kits.perks; import org.bukkit.ChatColor; import org.bukkit.Material; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPaintballRifle.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballRifle.java similarity index 97% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPaintballRifle.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballRifle.java index d977b8cfc..963da3e0c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPaintballRifle.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballRifle.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.kit.perks; +package nautilus.game.arcade.game.games.paintball.kits.perks; import org.bukkit.ChatColor; import org.bukkit.Material; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPaintballShotgun.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballShotgun.java similarity index 97% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPaintballShotgun.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballShotgun.java index 257f58a15..6c14682f9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPaintballShotgun.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballShotgun.java @@ -1,4 +1,4 @@ -package nautilus.game.arcade.kit.perks; +package nautilus.game.arcade.game.games.paintball.kits.perks; import org.bukkit.ChatColor; import org.bukkit.Material; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballSniper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballSniper.java new file mode 100644 index 000000000..fd2d18031 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballSniper.java @@ -0,0 +1,147 @@ +package nautilus.game.arcade.game.games.paintball.kits.perks; + +import java.util.HashMap; + +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.UtilGear; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.recharge.Recharge; +import mineplex.core.recharge.RechargedEvent; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.condition.Condition.ConditionType; +import nautilus.game.arcade.kit.Perk; + +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EnderPearl; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.entity.Snowball; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEvent; + +public class PerkPaintballSniper extends Perk +{ + private HashMap _crouching = new HashMap(); + + public PerkPaintballSniper() + { + super("Sniper Rifle", new String[] + { + C.cYellow + "Crouch" + C.cGray + " to use " + C.cGreen + "Scope", + C.cYellow + "Right-Click" + C.cGray + " to use " + C.cGreen + "Shotgun" + }); + } + + @EventHandler + public void Recharge(RechargedEvent event) + { + if (!event.GetAbility().equals(GetName())) + return; + + event.GetPlayer().playSound(event.GetPlayer().getLocation(), Sound.NOTE_STICKS, 2f, 1f); + event.GetPlayer().playSound(event.GetPlayer().getLocation(), Sound.NOTE_STICKS, 2f, 1.5f); + } + + @EventHandler + public void Shoot(PlayerInteractEvent event) + { + if (!Manager.GetGame().IsLive()) + return; + + if (!UtilEvent.isAction(event, ActionType.R)) + return; + + if (UtilBlock.usable(event.getClickedBlock())) + return; + + if (!UtilGear.isMat(event.getItem(), Material.STONE_HOE)) + return; + + Player player = event.getPlayer(); + + if (!Manager.IsAlive(player)) + return; + + if (UtilPlayer.isSpectator(player)) + return; + + if (!Kit.HasKit(player)) + return; + + event.setCancelled(true); + + if (!Recharge.Instance.use(player, GetName(), 1400, true, false)) + return; + + Projectile proj = player.launchProjectile(Manager.GetGame().GetTeam(player).GetColor() == ChatColor.AQUA ? Snowball.class : EnderPearl.class); + + proj.setVelocity(proj.getVelocity().normalize().multiply(4)); + + //Sound + player.getWorld().playSound(player.getLocation(), Sound.CHICKEN_EGG_POP, 0.8f, 1f); + } + + @EventHandler + public void onUpdate(UpdateEvent event) + { + if (!Manager.GetGame().IsLive()) + return; + + //Cleanup check + HashMap copyMap = new HashMap(); + copyMap.putAll(_crouching); + for (Player player : copyMap.keySet()) + { + boolean remove = false; + if (!Manager.GetGame().IsAlive(player)) + remove = true; + + if (UtilPlayer.isSpectator(player)) + remove = true; + + if (!player.isSneaking()) + remove = true; + + if (remove) + { + _crouching.remove(player); + + // Zoom + if (Manager.GetCondition().HasCondition(player, ConditionType.SLOW, GetName())) + Manager.GetCondition().EndCondition(player, ConditionType.SLOW, GetName()); + } + } + + //Add check + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (UtilPlayer.isSpectator(player)) + continue; + + if (!player.isSneaking()) + continue; + + if (_crouching.containsKey(player)) + continue; + + _crouching.put(player, System.currentTimeMillis()); + + // Zoom + if (!Manager.GetCondition().HasCondition(player, ConditionType.SLOW, GetName())) + Manager.GetCondition().Factory().Slow(GetName(), player, null, Double.MAX_VALUE, 5, false, false, false, false); + } + } + + public int getPaintDamage(Player player) + { + if (!_crouching.containsKey(player)) + return 1; + + return (int) Math.max(1, Math.floor((System.currentTimeMillis() - _crouching.get(player)) / 1000)); + } +} \ No newline at end of file From a7070065580085448aa48288574312b1a497da24 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Wed, 28 Oct 2015 21:42:41 -0400 Subject: [PATCH 022/113] Work. Deemed unsuitable due to an issue with the paintballs flying wide. --- .../game/games/paintball/Paintball.java | 31 +++- .../game/games/paintball/PlayerCopy.java | 3 - .../games/paintball/kits/KitMachineGun.java | 52 ++----- .../game/games/paintball/kits/KitRifle.java | 57 +++---- .../game/games/paintball/kits/KitShotgun.java | 53 +++---- .../game/games/paintball/kits/KitSniper.java | 32 ++-- .../kits/perks/PerkPaintballSniper.java | 146 ++++++++++++++++-- 7 files changed, 233 insertions(+), 141 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java index 57ea34f63..2dd4344b2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java @@ -7,6 +7,10 @@ import java.util.Iterator; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; @@ -56,6 +60,7 @@ import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.player.PlayerEvent; +import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; @@ -98,6 +103,7 @@ public class Paintball extends TeamGame private HashMap _doubles = new HashMap(); + @SuppressWarnings("unchecked") public Paintball(ArcadeManager manager) { super(manager, GameType.Paintball, @@ -107,6 +113,7 @@ public class Paintball extends TeamGame new KitRifle(manager), new KitShotgun(manager), new KitMachineGun(manager), + new KitSniper(manager), }, new String[] @@ -162,6 +169,7 @@ public class Paintball extends TeamGame event.setCancelled(true); } + @SuppressWarnings("deprecation") @EventHandler public void Paint(ProjectileHitEvent event) { @@ -265,7 +273,10 @@ public class Paintball extends TeamGame } if (GetKit(damager) instanceof KitSniper) { - count = ((KitSniper) GetKit(damager)).getPaintDamage(damager); + count = ((KitSniper) GetKit(damager)).getPaintDamage(event.GetProjectile()); + + if (count == -1) + count = 1; } } @@ -517,4 +528,22 @@ public class Paintball extends TeamGame for (Player player : GetPlayers(true)) player.removePotionEffect(PotionEffectType.WATER_BREATHING); } + + @EventHandler + public void onHeal(PlayerInteractEvent event) + { + if (!IsLive()) + return; + + if (!UtilEvent.isAction(event, ActionType.R)) + return; + + if (!UtilGear.isMat(event.getItem(), Material.POTION)) + return; + + if (!IsAlive(event.getPlayer()) || UtilPlayer.isSpectator(event.getPlayer())) + event.setCancelled(true); + + UtilInv.Update(event.getPlayer()); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopy.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopy.java index b072dea9a..787c23296 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopy.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopy.java @@ -2,12 +2,9 @@ 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; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitMachineGun.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitMachineGun.java index 04a62d950..591abb677 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitMachineGun.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitMachineGun.java @@ -1,21 +1,22 @@ package nautilus.game.arcade.game.games.paintball.kits; -import org.bukkit.Color; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.LeatherArmorMeta; -import org.bukkit.inventory.meta.PotionMeta; - 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.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.paintball.kits.perks.PerkPaintballMachineGun; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; + +import org.bukkit.Color; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.PotionMeta; public class KitMachineGun extends Kit { @@ -40,36 +41,17 @@ public class KitMachineGun extends Kit @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_BARDING, (byte)0, 1, "Paintball Machine Gun")); + UtilInv.insert(player, ItemStackFactory.Instance.CreateStack(Material.DIAMOND_BARDING, (byte)0, 1, F.item("Paintball Machine Gun"))); ItemStack potion = new ItemStack(Material.POTION, 3, (short)16429); // 16422 PotionMeta potionMeta = (PotionMeta)potion.getItemMeta(); - potionMeta.setDisplayName("Water Bomb"); + potionMeta.setDisplayName(F.item("Water Bomb")); potion.setItemMeta(potionMeta); - player.getInventory().addItem(potion); - - ItemStack helm = new ItemStack(Material.LEATHER_HELMET); - LeatherArmorMeta metaHelm = (LeatherArmorMeta)helm.getItemMeta(); - metaHelm.setColor(Color.WHITE); - helm.setItemMeta(metaHelm); - player.getInventory().setHelmet(helm); + UtilInv.insert(player, potion); - ItemStack armor = new ItemStack(Material.LEATHER_CHESTPLATE); - LeatherArmorMeta meta = (LeatherArmorMeta)armor.getItemMeta(); - meta.setColor(Color.WHITE); - armor.setItemMeta(meta); - player.getInventory().setChestplate(armor); - - ItemStack legs = new ItemStack(Material.LEATHER_LEGGINGS); - LeatherArmorMeta metaLegs = (LeatherArmorMeta)armor.getItemMeta(); - metaLegs.setColor(Color.WHITE); - legs.setItemMeta(metaLegs); - player.getInventory().setLeggings(legs); - - ItemStack boots = new ItemStack(Material.LEATHER_BOOTS); - LeatherArmorMeta metaBoots = (LeatherArmorMeta)armor.getItemMeta(); - metaBoots.setColor(Color.WHITE); - boots.setItemMeta(metaBoots); - player.getInventory().setBoots(boots); + player.getInventory().setHelmet(new ItemBuilder(Material.LEATHER_HELMET).setUnbreakable(true).setColor(Color.WHITE).build()); + player.getInventory().setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).setUnbreakable(true).setColor(Color.WHITE).build()); + player.getInventory().setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).setUnbreakable(true).setColor(Color.WHITE).build()); + player.getInventory().setBoots(new ItemBuilder(Material.LEATHER_BOOTS).setUnbreakable(true).setColor(Color.WHITE).build()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitRifle.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitRifle.java index ac0f1b480..db88ea43c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitRifle.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitRifle.java @@ -1,22 +1,23 @@ package nautilus.game.arcade.game.games.paintball.kits; -import org.bukkit.Color; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.LeatherArmorMeta; -import org.bukkit.inventory.meta.PotionMeta; -import org.bukkit.potion.PotionEffectType; - 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.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.paintball.kits.perks.PerkPaintballRifle; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; +import nautilus.game.arcade.kit.perks.PerkSpeed; + +import org.bukkit.Color; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.PotionMeta; public class KitRifle extends Kit { @@ -42,37 +43,17 @@ public class KitRifle extends Kit @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_BARDING, (byte)0, 1, "Paintball Rifle")); - - //Potion + UtilInv.insert(player, ItemStackFactory.Instance.CreateStack(Material.IRON_BARDING, (byte)0, 1, F.item("Paintball Rifle"))); + ItemStack potion = new ItemStack(Material.POTION, 3, (short)16429); // 16422 PotionMeta potionMeta = (PotionMeta)potion.getItemMeta(); - potionMeta.setDisplayName("Water Bomb"); + potionMeta.setDisplayName(F.item("Water Bomb")); potion.setItemMeta(potionMeta); - player.getInventory().addItem(potion); - - ItemStack helm = new ItemStack(Material.LEATHER_HELMET); - LeatherArmorMeta metaHelm = (LeatherArmorMeta)helm.getItemMeta(); - metaHelm.setColor(Color.WHITE); - helm.setItemMeta(metaHelm); - player.getInventory().setHelmet(helm); + UtilInv.insert(player, potion); - ItemStack armor = new ItemStack(Material.LEATHER_CHESTPLATE); - LeatherArmorMeta meta = (LeatherArmorMeta)armor.getItemMeta(); - meta.setColor(Color.WHITE); - armor.setItemMeta(meta); - player.getInventory().setChestplate(armor); - - ItemStack legs = new ItemStack(Material.LEATHER_LEGGINGS); - LeatherArmorMeta metaLegs = (LeatherArmorMeta)armor.getItemMeta(); - metaLegs.setColor(Color.WHITE); - legs.setItemMeta(metaLegs); - player.getInventory().setLeggings(legs); - - ItemStack boots = new ItemStack(Material.LEATHER_BOOTS); - LeatherArmorMeta metaBoots = (LeatherArmorMeta)armor.getItemMeta(); - metaBoots.setColor(Color.WHITE); - boots.setItemMeta(metaBoots); - player.getInventory().setBoots(boots); + player.getInventory().setHelmet(new ItemBuilder(Material.LEATHER_HELMET).setUnbreakable(true).setColor(Color.WHITE).build()); + player.getInventory().setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).setUnbreakable(true).setColor(Color.WHITE).build()); + player.getInventory().setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).setUnbreakable(true).setColor(Color.WHITE).build()); + player.getInventory().setBoots(new ItemBuilder(Material.LEATHER_BOOTS).setUnbreakable(true).setColor(Color.WHITE).build()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitShotgun.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitShotgun.java index ce2e2db69..65275c0a8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitShotgun.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitShotgun.java @@ -1,21 +1,23 @@ package nautilus.game.arcade.game.games.paintball.kits; -import org.bukkit.Color; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.LeatherArmorMeta; -import org.bukkit.inventory.meta.PotionMeta; - 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.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.paintball.kits.perks.PerkPaintballShotgun; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.*; +import nautilus.game.arcade.kit.perks.PerkSpeed; + +import org.bukkit.Color; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.PotionMeta; public class KitShotgun extends Kit { @@ -41,36 +43,17 @@ public class KitShotgun extends Kit @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.GOLD_BARDING, (byte)0, 1, "Paintball Shotgun")); + UtilInv.insert(player, ItemStackFactory.Instance.CreateStack(Material.GOLD_BARDING, (byte)0, 1, F.item("Paintball Shotgun"))); ItemStack potion = new ItemStack(Material.POTION, 3, (short)16429); // 16422 PotionMeta potionMeta = (PotionMeta)potion.getItemMeta(); - potionMeta.setDisplayName("Water Bomb"); + potionMeta.setDisplayName(F.item("Water Bomb")); potion.setItemMeta(potionMeta); - player.getInventory().addItem(potion); + UtilInv.insert(player, potion); - ItemStack helm = new ItemStack(Material.LEATHER_HELMET); - LeatherArmorMeta metaHelm = (LeatherArmorMeta)helm.getItemMeta(); - metaHelm.setColor(Color.WHITE); - helm.setItemMeta(metaHelm); - player.getInventory().setHelmet(helm); - - ItemStack armor = new ItemStack(Material.LEATHER_CHESTPLATE); - LeatherArmorMeta meta = (LeatherArmorMeta)armor.getItemMeta(); - meta.setColor(Color.WHITE); - armor.setItemMeta(meta); - player.getInventory().setChestplate(armor); - - ItemStack legs = new ItemStack(Material.LEATHER_LEGGINGS); - LeatherArmorMeta metaLegs = (LeatherArmorMeta)armor.getItemMeta(); - metaLegs.setColor(Color.WHITE); - legs.setItemMeta(metaLegs); - player.getInventory().setLeggings(legs); - - ItemStack boots = new ItemStack(Material.LEATHER_BOOTS); - LeatherArmorMeta metaBoots = (LeatherArmorMeta)armor.getItemMeta(); - metaBoots.setColor(Color.WHITE); - boots.setItemMeta(metaBoots); - player.getInventory().setBoots(boots); + player.getInventory().setHelmet(new ItemBuilder(Material.LEATHER_HELMET).setUnbreakable(true).setColor(Color.WHITE).build()); + player.getInventory().setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).setUnbreakable(true).setColor(Color.WHITE).build()); + player.getInventory().setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).setUnbreakable(true).setColor(Color.WHITE).build()); + player.getInventory().setBoots(new ItemBuilder(Material.LEATHER_BOOTS).setUnbreakable(true).setColor(Color.WHITE).build()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitSniper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitSniper.java index 8075cd4ee..4604ddd0e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitSniper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitSniper.java @@ -2,22 +2,23 @@ package nautilus.game.arcade.game.games.paintball.kits; import mineplex.core.achievement.Achievement; 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.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.game.games.paintball.kits.perks.PerkPaintballShotgun; import nautilus.game.arcade.game.games.paintball.kits.perks.PerkPaintballSniper; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkSlow; import org.bukkit.Color; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.PotionMeta; public class KitSniper extends Kit { @@ -33,8 +34,7 @@ public class KitSniper extends Kit new Perk[] { - new PerkPaintballShotgun(), - new PerkSlow(0) + new PerkPaintballSniper(), }, EntityType.ZOMBIE, new ItemStack(Material.STONE_HOE)); @@ -51,27 +51,31 @@ public class KitSniper extends Kit } @Override - public void GiveItems(Player player) + public void GiveItems(Player player) { player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_HOE, (byte)0, 1, C.cWhite + "Paintball Sniper Rifle")); - UtilInv.insert(player, ItemStackFactory.Instance.CreateStack(Material.POTION, (byte) 16429, 1, "Water Bomb")); + ItemStack potion = new ItemStack(Material.POTION, 2, (short)16429); // 16422 + PotionMeta potionMeta = (PotionMeta)potion.getItemMeta(); + potionMeta.setDisplayName(F.item("Water Bomb")); + potion.setItemMeta(potionMeta); + UtilInv.insert(player, potion); - player.getInventory().setHelmet(new ItemBuilder(Material.LEATHER_HELMET).setColor(Color.WHITE).build()); - player.getInventory().setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(Color.WHITE).build()); - player.getInventory().setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).setColor(Color.WHITE).build()); - player.getInventory().setBoots(new ItemBuilder(Material.LEATHER_BOOTS).setColor(Color.WHITE).build()); + player.getInventory().setHelmet(new ItemBuilder(Material.LEATHER_HELMET).setUnbreakable(true).setColor(Color.WHITE).build()); + player.getInventory().setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).setUnbreakable(true).setColor(Color.WHITE).build()); + player.getInventory().setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).setUnbreakable(true).setColor(Color.WHITE).build()); + player.getInventory().setBoots(new ItemBuilder(Material.LEATHER_BOOTS).setUnbreakable(true).setColor(Color.WHITE).build()); } - public int getPaintDamage(Player player) + public int getPaintDamage(Projectile proj) { - for (Perk perk : this.GetPerks()) + for (Perk perk : GetPerks()) { if (perk instanceof PerkPaintballSniper) { - return ((PerkPaintballSniper) perk).getPaintDamage(player); + return ((PerkPaintballSniper) perk).getPaintDamage(proj); } } - return 0; + return -1; } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballSniper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballSniper.java index fd2d18031..71b9bf2b9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballSniper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballSniper.java @@ -1,8 +1,10 @@ package nautilus.game.arcade.game.games.paintball.kits.perks; import java.util.HashMap; +import java.util.HashSet; import mineplex.core.common.util.C; +import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent.ActionType; @@ -10,8 +12,11 @@ import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilPlayer; import mineplex.core.recharge.Recharge; import mineplex.core.recharge.RechargedEvent; +import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.condition.Condition.ConditionType; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.kit.Perk; import org.bukkit.ChatColor; @@ -22,18 +27,25 @@ import org.bukkit.entity.Player; import org.bukkit.entity.Projectile; import org.bukkit.entity.Snowball; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.util.Vector; public class PerkPaintballSniper extends Perk { private HashMap _crouching = new HashMap(); + private HashMap _fired = new HashMap(); + private NautHashMap _damage = new NautHashMap(); + + private double _velocity = 8; public PerkPaintballSniper() { super("Sniper Rifle", new String[] { C.cYellow + "Crouch" + C.cGray + " to use " + C.cGreen + "Scope", - C.cYellow + "Right-Click" + C.cGray + " to use " + C.cGreen + "Shotgun" + C.cYellow + "Right-Click" + C.cGray + " to use " + C.cGreen + "Sniper Rifle", + "Experience Bar represents damage." }); } @@ -75,45 +87,63 @@ public class PerkPaintballSniper extends Perk event.setCancelled(true); - if (!Recharge.Instance.use(player, GetName(), 1400, true, false)) + if (!Recharge.Instance.use(player, GetName(), 1000, true, true)) return; - Projectile proj = player.launchProjectile(Manager.GetGame().GetTeam(player).GetColor() == ChatColor.AQUA ? Snowball.class : EnderPearl.class); - - proj.setVelocity(proj.getVelocity().normalize().multiply(4)); + Projectile proj = player.launchProjectile(Manager.GetGame().GetTeam(player).GetColor() == ChatColor.AQUA ? Snowball.class : EnderPearl.class, player.getEyeLocation().getDirection().clone().multiply(_velocity)); + + _fired.put(proj, proj.getVelocity()); + _damage.put(proj, getPaintDamage(player)); //Sound player.getWorld().playSound(player.getLocation(), Sound.CHICKEN_EGG_POP, 0.8f, 1f); + + player.setSneaking(false); + + //Effects + removeEffects(player); } @EventHandler public void onUpdate(UpdateEvent event) { - if (!Manager.GetGame().IsLive()) + if (event.getType() != UpdateType.TICK) return; + if (!Manager.GetGame().IsLive()) + return; + //Cleanup check HashMap copyMap = new HashMap(); copyMap.putAll(_crouching); for (Player player : copyMap.keySet()) { boolean remove = false; + if (!player.isOnline()) + remove = true; + if (!Manager.GetGame().IsAlive(player)) remove = true; - + if (UtilPlayer.isSpectator(player)) remove = true; - + if (!player.isSneaking()) remove = true; + if (!Recharge.Instance.usable(player, GetName())) + remove = true; + if (remove) { - _crouching.remove(player); + if (_crouching.containsKey(player)) + _crouching.remove(player); + + player.setExp(0F); + player.setSneaking(false); // Zoom - if (Manager.GetCondition().HasCondition(player, ConditionType.SLOW, GetName())) - Manager.GetCondition().EndCondition(player, ConditionType.SLOW, GetName()); + removeEffects(player); } } @@ -123,6 +153,9 @@ public class PerkPaintballSniper extends Perk if (UtilPlayer.isSpectator(player)) continue; + if (!Kit.HasKit(player)) + continue; + if (!player.isSneaking()) continue; @@ -132,12 +165,95 @@ public class PerkPaintballSniper extends Perk _crouching.put(player, System.currentTimeMillis()); // Zoom - if (!Manager.GetCondition().HasCondition(player, ConditionType.SLOW, GetName())) - Manager.GetCondition().Factory().Slow(GetName(), player, null, Double.MAX_VALUE, 5, false, false, false, false); - } + addEffects(player); + } + + // Exp check + + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (UtilPlayer.isSpectator(player)) + continue; + + if (!Kit.HasKit(player)) + continue; + + if (!_crouching.containsKey(player)) + continue; + + player.setExp((float) Math.min(.999F, player.getExp() + .0125)); + } } - public int getPaintDamage(Player player) + @EventHandler + public void updateProjectiles(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (!Manager.GetGame().IsLive()) + return; + + HashSet copySet = new HashSet(_fired.keySet()); + for (Projectile proj : copySet) + { + if (!proj.isValid()) + { + _fired.remove(proj); + + if (_damage.containsKey(proj)) + _damage.remove(proj); + + continue; + } + + proj.setVelocity(_fired.get(proj).clone().normalize().multiply(_velocity)); + } + } + + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void removeEffects(GameStateChangeEvent event) + { + if (event.GetState() != GameState.End) + return; + + for (Player player : _crouching.keySet()) + { + removeEffects(player); + } + + _crouching.clear(); + } + + private void removeEffects(Player player) + { + // Zoom + if (Manager.GetCondition().HasCondition(player, ConditionType.SLOW, GetName())) + Manager.GetCondition().EndCondition(player, ConditionType.SLOW, GetName()); + + if (Manager.GetCondition().HasCondition(player, ConditionType.JUMP, GetName())) + Manager.GetCondition().EndCondition(player, ConditionType.JUMP, GetName()); + } + + private void addEffects(Player player) + { + // Zoom + if (!Manager.GetCondition().HasCondition(player, ConditionType.SLOW, GetName())) + Manager.GetCondition().Factory().Slow(GetName(), player, null, Double.MAX_VALUE, 8, false, false, false, false); + +// if (!Manager.GetCondition().HasCondition(player, ConditionType.JUMP, GetName())) +// Manager.GetCondition().Factory().Jump(GetName(), player, null, 9999999, 250, true, false, false); + } + + public int getPaintDamage(Projectile proj) + { + if (!_damage.containsKey(proj)) + return 1; + + return _damage.remove(proj); + } + + private int getPaintDamage(Player player) { if (!_crouching.containsKey(player)) return 1; From 71bb03420b308195035cda12cdc64e41ce53f4b0 Mon Sep 17 00:00:00 2001 From: Sarah Date: Sat, 31 Oct 2015 18:37:19 +0100 Subject: [PATCH 023/113] Adding sounds to spells, removing kits, notifications to Titles, Mob sizes/standardization, nuke -> Zombie Smash, 10 secs delay to Zombie Smash, Firebomb improvements and Freaks. --- .../arcade/game/games/typewars/Minion.java | 60 ++++++-- .../game/games/typewars/MinionSize.java | 57 ++++++++ .../game/games/typewars/MinionType.java | 76 +++++----- .../arcade/game/games/typewars/Spell.java | 135 +++++++++++++----- .../arcade/game/games/typewars/TypeWars.java | 20 ++- .../games/typewars/kits/KitTypeWarsBase.java | 13 +- .../game/games/typewars/kits/KitTyper.java | 11 +- .../games/typewars/spells/SpellFirebomb.java | 49 +------ .../typewars/spells/SpellGrowthLiner.java | 2 +- .../typewars/spells/SpellKillEverything.java | 4 +- .../games/typewars/spells/SpellMassSlow.java | 2 +- .../typewars/spells/SpellShrinkLiner.java | 2 +- .../games/typewars/spells/SpellSniper.java | 2 +- .../games/typewars/spells/SpellSpeedUp.java | 2 +- 14 files changed, 278 insertions(+), 157 deletions(-) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionSize.java diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java index 73d4ff5a7..1567cac62 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java @@ -9,11 +9,9 @@ import mineplex.core.common.util.UtilMath; 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.UtilServer; import mineplex.core.disguise.disguises.DisguiseBase; +import mineplex.core.disguise.disguises.DisguiseZombie; import mineplex.core.hologram.Hologram; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.GameTeam; @@ -27,8 +25,6 @@ import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; -import org.bukkit.event.HandlerList; -import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.inventory.ItemStack; @@ -196,7 +192,7 @@ public class Minion _team = team; _player = player; _killer = null; - _money = Math.max(UtilMath.r(_type.getMaxmoney()), _type.getMinMoney()); + _money = _type.getMoney(); changeRandomName(_type.getMinName(), _type.getMaxName(), true); @@ -250,17 +246,36 @@ public class Minion try { - Object disguise = _type.getDisguiseClass().getConstructors()[0].newInstance(_entity); - Class clazz = _type.getDisguiseClass(); - //clazz.getMethod("setName", String.class).invoke(disguise, _team.GetColor() + _name); - clazz.getMethod("setCustomNameVisible", boolean.class).invoke(disguise, true); - try + int i = 0; + for(Class clazz : _type.getDisguiseClasses()) { - clazz.getMethod("setHelmet", ItemStack.class).invoke(disguise, new ItemStack(Material.LEATHER_HELMET)); - clazz.getMethod("setHeldItem", ItemStack.class).invoke(disguise, new ItemStack(_items[UtilMath.r(_items.length)])); + Object disguise = null; + Entity ent = null; + if(i == 0) + { + disguise = clazz.getConstructors()[0].newInstance(_entity); + } + else + { + ent = _location.getWorld().spawn(_location, Creeper.class); + disguise = clazz.getConstructors()[0].newInstance(ent); + } + clazz.getMethod("setCustomNameVisible", boolean.class).invoke(disguise, true); + try + { + clazz.getMethod("setHelmet", ItemStack.class).invoke(disguise, new ItemStack(Material.LEATHER_HELMET)); + clazz.getMethod("setHeldItem", ItemStack.class).invoke(disguise, new ItemStack(_items[UtilMath.r(_items.length)])); + } + catch (Exception e) {} + if(disguise instanceof DisguiseZombie && i > 0) + { + DisguiseZombie zombie = (DisguiseZombie) disguise; + zombie.SetBaby(true); + } + _entity.setPassenger(ent); + _manager.GetDisguise().disguise((DisguiseBase)disguise); + i++; } - catch (Exception e) {} - _manager.GetDisguise().disguise((DisguiseBase)disguise); } catch (Exception e) {} _hologram.start(); @@ -276,6 +291,17 @@ public class Minion private MinionType randomType() { int rdm = UtilMath.r(MinionType.values().length); + int freak = UtilMath.r(100); + if(freak <= 10) + { + ArrayList minions = new ArrayList<>(); + for(MinionType type : MinionType.values()) + { + if(type.getSize() == MinionSize.FREAK) + minions.add(type); + } + return minions.get(UtilMath.r(minions.size())); + } for(MinionType type : MinionType.values()) { if(type.ordinal() == rdm) @@ -292,6 +318,10 @@ public class Minion _hologram.stop(); try { + if(_entity.getPassenger() != null) + { + ((Creeper) _entity.getPassenger()).damage(10000); + } ((Creeper) _entity).damage(10000); } catch (Exception e) {} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionSize.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionSize.java new file mode 100644 index 000000000..34a1d6b94 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionSize.java @@ -0,0 +1,57 @@ +package nautilus.game.arcade.game.games.typewars; + +import java.util.ArrayList; + +import mineplex.core.common.util.UtilMath; + +import org.bukkit.Material; + +public enum MinionSize +{ + EASY("Easy", 2, Material.SLIME_BALL), + MEDIUM("Medium", 4, Material.COAL), + HARD("Hard", 6, Material.DIAMOND), + FREAK("Freak", 10000, Material.APPLE), + BOSS("Boss", 10000, Material.NETHER_STAR); + + private int _cost; + private Material _displayItem; + + private String _displayName; + + private MinionSize(String name, int cost, Material displayItem) + { + _displayName = name; + _cost = cost; + _displayItem = displayItem; + } + + public int getCost() + { + return _cost; + } + + public Material getDisplayItem() + { + return _displayItem; + } + + public String getDisplayName() + { + return _displayName; + } + + public MinionType getRandomType() + { + ArrayList minionList = new ArrayList<>(); + for(MinionType type : MinionType.values()) + { + if(type.getSize() == this) + { + minionList.add(type); + } + } + return minionList.get(UtilMath.r(minionList.size())); + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionType.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionType.java index 26d0341fa..9447779da 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionType.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionType.java @@ -1,57 +1,69 @@ package nautilus.game.arcade.game.games.typewars; import mineplex.core.disguise.disguises.DisguiseBase; +import mineplex.core.disguise.disguises.DisguiseChicken; +import mineplex.core.disguise.disguises.DisguiseCow; import mineplex.core.disguise.disguises.DisguiseCreeper; import mineplex.core.disguise.disguises.DisguiseEnderman; import mineplex.core.disguise.disguises.DisguiseHorse; import mineplex.core.disguise.disguises.DisguiseIronGolem; import mineplex.core.disguise.disguises.DisguiseMagmaCube; +import mineplex.core.disguise.disguises.DisguisePig; import mineplex.core.disguise.disguises.DisguiseSkeleton; import mineplex.core.disguise.disguises.DisguiseSlime; +import mineplex.core.disguise.disguises.DisguiseSpider; import mineplex.core.disguise.disguises.DisguiseWolf; import mineplex.core.disguise.disguises.DisguiseZombie; import org.bukkit.Material; import org.bukkit.entity.EntityType; +@SuppressWarnings("unchecked") public enum MinionType { - ZOMBIE(DisguiseZombie.class ,EntityType.ZOMBIE, 9, 12, (float) 1.5, 2, 3, 4, 0D, Material.ROTTEN_FLESH), - SKELETON(DisguiseSkeleton.class ,EntityType.SKELETON, 7, 10, (float) 1.5, 2, 3, 4, 0D, Material.BONE), - CREEPER(DisguiseCreeper.class ,EntityType.CREEPER, 9, 12, (float) 1.5, 2, 3, 4, 0D, Material.SULPHUR), - WOLF(DisguiseWolf.class ,EntityType.WOLF, 3, 6, 2, 1, 2, 3, -1D, Material.COOKED_BEEF), - SLIME(DisguiseSlime.class ,EntityType.SLIME, 3, 8, 2, 1, 2, 3, -1D, Material.SLIME_BALL), - CUBE(DisguiseMagmaCube.class ,EntityType.MAGMA_CUBE, 3, 8, 2, 1, 2, 3, -1D, Material.MAGMA_CREAM), - IRON_GOLEM(DisguiseIronGolem.class ,EntityType.IRON_GOLEM, 10, 18, 1, 4, 6, 8, 0.5D, Material.IRON_INGOT), - HORSE(DisguiseHorse.class ,EntityType.HORSE, 13, 18, 1, 4, 6, 8, 0D, Material.APPLE), - ENDERMAN(DisguiseEnderman.class ,EntityType.ENDERMAN, 13, 18, 1, 4, 6, 8, 1D, Material.ENDER_STONE); + CHICKEN(10, MinionSize.EASY, EntityType.CHICKEN, 1, 3, (float) 0.3*7, 2, -0.5D, Material.EGG, DisguiseChicken.class), + PIG(10, MinionSize.EASY, EntityType.PIG, 3, 6, (float) 0.3*7, 5, -0.5D, Material.PORK, DisguisePig.class), + COW(10, MinionSize.EASY, EntityType.COW, 6, 9, (float) 0.3*7, 3, -0.5D, Material.COOKED_BEEF, DisguiseCow.class), - private Class _disguiseClass; + ZOMBIE(10, MinionSize.MEDIUM, EntityType.ZOMBIE, 9, 12, (float) 0.3*2, 3, 0D, Material.ROTTEN_FLESH, DisguiseZombie.class), + SPIDER(10, MinionSize.MEDIUM, EntityType.SPIDER, 6, 9, (float) 0.3*5, 3, 0D, Material.SPIDER_EYE, DisguiseSpider.class), + WOLF(10, MinionSize.MEDIUM, EntityType.WOLF, 3, 6, (float) 0.3*8, 2, -1D, Material.COOKED_BEEF, DisguiseWolf.class), + + IRON_GOLEM(10, MinionSize.HARD, EntityType.IRON_GOLEM, 10, 13,(float) 0.3*3, 6, 0.5D, Material.IRON_INGOT, DisguiseIronGolem.class), + HORSE(10, MinionSize.HARD, EntityType.HORSE, 6, 9, (float) 0.3*10, 6, 0D, Material.APPLE, DisguiseHorse.class), + ENDERMAN(10, MinionSize.HARD, EntityType.ENDERMAN, 9, 12, (float) 0.3*4, 6, 1D, Material.ENDER_STONE, DisguiseEnderman.class), + + SPIDER_JOKEY(1, MinionSize.FREAK, EntityType.SPIDER, 10, 13, (float) 0.3*7, 10, 1D, Material.APPLE, DisguiseSpider.class, DisguiseSkeleton.class), + CHICKEN_JOKEY(1, MinionSize.FREAK, EntityType.CHICKEN, 10, 13, (float) 0.3*7, 10, 1D, Material.APPLE, DisguiseChicken.class, DisguiseZombie.class); + + private Class[] _disguiseClasses; private EntityType _type; private int _minName; private int _maxName; private float _walkSpeed; - private int _minMoney; - private int _maxMoney; + private int _money; + + private MinionSize _size; - private int _cost; private double _tagHight; private Material _displayItem; - private MinionType(Class disguiseClass, EntityType type, int minName, int maxName, float walkSpeed, int minMoney, int maxMoney, int cost, double tagHight, Material displayItem) + private int _chance; + + private MinionType(int chance, MinionSize size, EntityType type, int minName, int maxName, float walkSpeed, int money, double tagHight, Material displayItem,Class... disguiseClasses) { - _disguiseClass = disguiseClass; + _disguiseClasses = disguiseClasses; _type = type; _minName = minName; _maxName = maxName; _walkSpeed = walkSpeed; - _minMoney = minMoney; - _maxMoney = maxMoney; - _cost = cost; + _money = money; _displayItem = displayItem; _tagHight = tagHight; + _chance = chance; + _size = size; } public EntityType getType() @@ -74,19 +86,9 @@ public enum MinionType return _walkSpeed; } - public int getMinMoney() + public int getMoney() { - return _minMoney; - } - - public int getMaxmoney() - { - return _maxMoney; - } - - public int getCost() - { - return _cost; + return _money; } public Material getDisplayItem() @@ -94,9 +96,9 @@ public enum MinionType return _displayItem; } - public Class getDisguiseClass() + public Class[] getDisguiseClasses() { - return _disguiseClass; + return _disguiseClasses; } public double getTagHight() @@ -104,4 +106,14 @@ public enum MinionType return _tagHight; } + public int getChance() + { + return _chance; + } + + public MinionSize getSize() + { + return _size; + } + } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Spell.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Spell.java index 56e1268d9..0e1d43694 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Spell.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Spell.java @@ -1,21 +1,29 @@ package nautilus.game.arcade.game.games.typewars; import java.util.ArrayList; +import java.util.HashMap; +import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilTime; 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.UtilShapes; +import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.recharge.Recharge; import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.GameTeam; import org.bukkit.Bukkit; +import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.Sound; import org.bukkit.entity.Player; public abstract class Spell @@ -30,8 +38,12 @@ public abstract class Spell private Material _material; private Long _recharge; private boolean _singleUse; + private long _updateDelay; - public Spell(ArcadeManager manager, String name, int cost, Material material, Long recharge, boolean singleUse) + private HashMap _lastUsed; + private long _useDelay; + + public Spell(ArcadeManager manager, String name, int cost, Material material, Long recharge, int updateDelay, long useDelay, boolean singleUse) { _manager = manager; _name = name; @@ -39,71 +51,120 @@ public abstract class Spell _material = material; _recharge = recharge; _singleUse = singleUse; + _updateDelay = updateDelay; _playerUses = new ArrayList<>(); + _lastUsed = new HashMap<>(); + _updateDelay = useDelay; } - public boolean prepareExecution(Player player) + public void prepareExecution(final Player player) { if(isSingleUse()) { if(_playerUses.contains(player)) { - UtilPlayer.message(player, F.main("Game", "You can't use this spell anymore.")); - return false; + UtilTextMiddle.display("", C.cYellow + "You can't use this spell anymore.", player); + return; } } + GameTeam team = getManager().GetGame().GetTeam(player); + if(_lastUsed.containsKey(team)) + { + if(!UtilTime.elapsed(_lastUsed.get(team), _useDelay)) + { + UtilTextMiddle.display("", "This Spell cant be used at the moment.", player); + return; + } + } + _lastUsed.put(team, System.currentTimeMillis()); _typeWars = (TypeWars) _manager.GetGame(); if(_typeWars.getMoneyMap().get(player) < getCost()) { - UtilPlayer.message(player, F.main("Game", "You dont have enough Money to use that spell.")); - return false; + UtilTextMiddle.display("", "You dont have enough Money to use that spell.", player); + return; } if(!Recharge.Instance.usable(player, getName(), true)) - return false; + return; - Location loc = player.getLastTwoTargetBlocks(UtilBlock.blockAirFoliageSet, 80).get(0).getLocation().add(0.5, 0.5, 0.5); - if(trail() != null) + UtilTextMiddle.display("", "You activated the Spell " + F.game(getName()) + " and got charged " + F.game(getCost() + "$") + ".", player); + final Spell spell = this; + + new Thread(new Runnable() { - int i = 0; - for (Location location : UtilShapes.getLinesDistancedPoints(player.getEyeLocation().subtract(0, 0.1, 0), loc, 0.6)) + + @Override + public void run() { - UtilParticle.PlayParticle(trail(), location, 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers()); - trailAnimation(location, i); - i++; - if(i > 30) - i = 0; + Location loc = player.getLastTwoTargetBlocks(UtilBlock.blockAirFoliageSet, 80).get(0).getLocation().add(0.5, 0.5, 0.5); + if(trail() != null) + { + int i = 0; + for (Location location : UtilShapes.getLinesDistancedPoints(player.getEyeLocation().subtract(0, 0.1, 0), loc, 0.6)) + { + if(getManager().GetGame().GetTeam(player).GetColor() == ChatColor.RED) + { + UtilParticle.PlayParticle(trail(), location, 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers()); + } + else + { + UtilParticle.PlayParticle(trail(), location, -1, 1, 1, 1, 0, ViewDist.NORMAL, UtilServer.getPlayers()); + } + trailAnimation(location, i); + location.getWorld().playSound(location, sound(), 1, 1); + i++; + if(i > 30) + i = 0; + try + { + Thread.sleep(_updateDelay); + } + catch (InterruptedException e) + { + e.printStackTrace(); + } + } + } + if(hit() != null) + UtilParticle.PlayParticle(hit(), loc, 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers()); + + if(execute(player, loc)) + { + Recharge.Instance.use(player, getName(), getRecharge(), false, true); + int money = ((TypeWars) _manager.GetGame()).getMoneyMap().get(player); + ((TypeWars) _manager.GetGame()).getMoneyMap().put(player, money - getCost()); + if(!_playerUses.contains(player)) + _playerUses.add(player); + + Bukkit.getPluginManager().callEvent(new ActivateSpellEvent(player, spell)); + return; + } + else + { + UtilPlayer.message(player, F.main("Game", "Error while using spell.")); + return; + } } - } - if(hit() != null) - UtilParticle.PlayParticle(hit(), loc, 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers()); - - if(execute(player, loc)) - { - Recharge.Instance.use(player, getName(), getRecharge(), false, true); - int money = ((TypeWars) _manager.GetGame()).getMoneyMap().get(player); - ((TypeWars) _manager.GetGame()).getMoneyMap().put(player, money - getCost()); - if(!_playerUses.contains(player)) - _playerUses.add(player); - Bukkit.getPluginManager().callEvent(new ActivateSpellEvent(player, this)); - UtilPlayer.message(player, F.main("Game", "You activated the Spell " + F.game(getName()) + " and got charged " + F.game(getCost() + "$") + ".")); - return true; - } - else - { - UtilPlayer.message(player, F.main("Game", "Error while using spell.")); - return false; - } + }).start(); + } - public abstract ParticleType trail(); + public ParticleType trail() + { + return ParticleType.RED_DUST; + } public ParticleType hit() { return ParticleType.EXPLODE; } + public Sound sound() + { + return Sound.CLICK; + } + public void trailAnimation(Location location, int frame) {} public abstract boolean execute(Player player, Location location); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index 20038c7a9..ba673f683 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -75,8 +75,6 @@ public class TypeWars extends TeamGame new Kit[] { new KitTyper(manager), - new KitWarrior(manager), - new KitTactician(manager) }, new String[] { @@ -197,13 +195,13 @@ public class TypeWars extends TeamGame if(GetState() != GameState.Live) return; - for(MinionType type : MinionType.values()) + for(MinionSize type : MinionSize.values()) { if(type.getDisplayItem() == event.getItem().getType()) { if(type.getCost() > _moneyMap.get(event.getPlayer())) { - UtilPlayer.message(event.getPlayer(), F.main("Game", "You dont have enough money to spawn this Minion.")); + UtilTextMiddle.display("", "You dont have enough money to spawn this Minion.", event.getPlayer()); return; } GameTeam teams = GetTeam(event.getPlayer()); @@ -213,15 +211,15 @@ public class TypeWars extends TeamGame { if(getMinions(team).size() >= 60) { - UtilPlayer.message(event.getPlayer(), F.main("Game", "Your Team cant have more than 60 Minions")); + UtilTextMiddle.display("", "Your Team cant have more than 60 Minions", event.getPlayer()); return; } this.CreatureAllowOverride = true; _moneyMap.put(event.getPlayer(), _moneyMap.get(event.getPlayer()) - type.getCost()); - UtilPlayer.message(event.getPlayer(), F.main("Game", "You bought a Minion.")); + UtilTextMiddle.display("", "You bought a Minion.", event.getPlayer()); int rdm = UtilMath.r(_minionSpawns.get(teams).size()); - Minion minion = new Minion(Manager, _minionSpawns.get(teams).get(rdm), _minionSpawns.get(team).get(rdm), teams, event.getPlayer(), true, type); + Minion minion = new Minion(Manager, _minionSpawns.get(teams).get(rdm), _minionSpawns.get(team).get(rdm), teams, event.getPlayer(), true, type.getRandomType()); Bukkit.getPluginManager().callEvent(new SummonMinionEvent(event.getPlayer(), minion)); _activeMinions.add(minion); this.CreatureAllowOverride = false; @@ -514,18 +512,18 @@ public class TypeWars extends TeamGame } int i = 4; - for(MinionType type : MinionType.values()) + for(MinionSize type : MinionSize.values()) { - if(type != MinionType.SKELETON && type != MinionType.WOLF && type != MinionType.IRON_GOLEM) + if(type == MinionSize.BOSS || type == MinionSize.FREAK) continue; if(_moneyMap.get(player) >= type.getCost()) { - player.getInventory().setItem(i, ItemStackFactory.Instance.CreateStack(type.getDisplayItem(), (byte) 0, Math.round(_moneyMap.get(player)/type.getCost()), C.cGreen + "Spawn " + type.getType().getName() + " Cost: " + type.getCost())); + player.getInventory().setItem(i, ItemStackFactory.Instance.CreateStack(type.getDisplayItem(), (byte) 0, Math.round(_moneyMap.get(player)/type.getCost()), C.cGreen + "Spawn " + type.getDisplayName() + " Minion Cost: " + type.getCost())); } else { - player.getInventory().setItem(i, ItemStackFactory.Instance.CreateStack(type.getDisplayItem(), (byte) 0, 0, C.cRed + "Spawn " + type.getType().getName() + " Cost: " + type.getCost())); + player.getInventory().setItem(i, ItemStackFactory.Instance.CreateStack(type.getDisplayItem(), (byte) 0, 0, C.cRed + "Spawn " + type.getDisplayName() + " Minion Cost: " + type.getCost())); } i++; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTypeWarsBase.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTypeWarsBase.java index 2e4252319..e4608f9fc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTypeWarsBase.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTypeWarsBase.java @@ -3,7 +3,7 @@ package nautilus.game.arcade.game.games.typewars.kits; import mineplex.core.common.util.C; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.game.games.typewars.MinionType; +import nautilus.game.arcade.game.games.typewars.MinionSize; import nautilus.game.arcade.game.games.typewars.Spell; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; @@ -45,11 +45,11 @@ public abstract class KitTypeWarsBase extends Kit } int i = 4; - for(MinionType type : MinionType.values()) + for(MinionSize type : MinionSize.values()) { - if(type == MinionType.SKELETON || type == MinionType.WOLF || type == MinionType.IRON_GOLEM) + if(type != MinionSize.BOSS && type != MinionSize.FREAK) { - player.getInventory().setItem(i, ItemStackFactory.Instance.CreateStack(type.getDisplayItem(), (byte) 0, 1, C.cYellow + "Spawn " + type.getType().getName() + " Cost: " + type.getCost())); + player.getInventory().setItem(i, ItemStackFactory.Instance.CreateStack(type.getDisplayItem(), (byte) 0, 1, C.cYellow + "Spawn " + type.getDisplayName() + " Minion Cost: " + type.getCost())); i++; } } @@ -80,7 +80,10 @@ public abstract class KitTypeWarsBase extends Kit for(Spell spell : getSpells()) { if(spell.getMaterial() == mat) - return spell.prepareExecution(player); + { + spell.prepareExecution(player); + return true; + } } return false; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTyper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTyper.java index c9dffce37..4eb64ad90 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTyper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTyper.java @@ -4,6 +4,7 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.typewars.Spell; import nautilus.game.arcade.game.games.typewars.spells.SpellFirebomb; import nautilus.game.arcade.game.games.typewars.spells.SpellKillEverything; +import nautilus.game.arcade.game.games.typewars.spells.SpellSniper; import nautilus.game.arcade.game.games.typewars.spells.SpellSpeedUp; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; @@ -21,17 +22,17 @@ public class KitTyper extends KitTypeWarsBase new String[] { - "This fast typer has offensive.", - "and defensive Spells" + "This is the fastest typer ", + "in the land of Mineplex" }, new Perk[] { new Perk("Fire Bomb", new String[]{"Kills small and medium sized enemies."}){}, - new Perk("Speed Boost", new String[]{"Temporarily boosts speed of your minions."}){}, - new Perk("Nuke Spell", new String[]{"Kill all enemy minions. One use."}){} + new Perk("Sniper spell", new String[]{"Shoot a minion and kill it"}){}, + new Perk("Zombie Smash", new String[]{"Kill all enemy minions. One use."}){} }, EntityType.ZOMBIE, new ItemStack(Material.FEATHER), - new Spell[]{new SpellFirebomb(manager), new SpellSpeedUp(manager), new SpellKillEverything(manager)}); + new Spell[]{new SpellFirebomb(manager), new SpellSniper(manager), new SpellKillEverything(manager)}); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellFirebomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellFirebomb.java index f176f71b5..b69d1dabb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellFirebomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellFirebomb.java @@ -9,6 +9,7 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilParticle.ParticleType; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.typewars.Minion; +import nautilus.game.arcade.game.games.typewars.MinionSize; import nautilus.game.arcade.game.games.typewars.Spell; import org.bukkit.Location; @@ -21,7 +22,7 @@ public class SpellFirebomb extends Spell public SpellFirebomb(ArcadeManager manager) { - super(manager, "Firebomb", 4, Material.BLAZE_POWDER, 2000L, false); + super(manager, "Firebomb", 4, Material.BLAZE_POWDER, 2000L, 5, 0, false); } @Override @@ -38,47 +39,11 @@ public class SpellFirebomb extends Spell if(getTypeWars().GetTeam(player) == minion.getTeam()) continue; - if(minion.getName().length() > 8) + if(minion.getType().getSize() != MinionSize.EASY) { UtilPlayer.message(player, F.main("Game", F.game(minion.getName()) + " is to strong to be killed with that.")); continue; } - final Location loc = minion.getEntity().getLocation(); - loc.getBlock().setType(Material.FIRE); - - getManager().runSyncLater(new Runnable() - { - @Override - public void run() - { - - loc.getBlock().getRelative(BlockFace.EAST).setType(Material.FIRE); - loc.getBlock().getRelative(BlockFace.NORTH).setType(Material.FIRE); - loc.getBlock().getRelative(BlockFace.SOUTH).setType(Material.FIRE); - loc.getBlock().getRelative(BlockFace.WEST).setType(Material.FIRE); - } - }, 20); - - getManager().runSyncLater(new Runnable() - { - @Override - public void run() - { - loc.getBlock().setType(Material.AIR); - } - }, 40); - - getManager().runSyncLater(new Runnable() - { - @Override - public void run() - { - loc.getBlock().getRelative(BlockFace.EAST).setType(Material.AIR); - loc.getBlock().getRelative(BlockFace.NORTH).setType(Material.AIR); - loc.getBlock().getRelative(BlockFace.SOUTH).setType(Material.AIR); - loc.getBlock().getRelative(BlockFace.WEST).setType(Material.AIR); - } - }, 60); minion.despawn(player, true); minionIterator.remove(); @@ -87,15 +52,9 @@ public class SpellFirebomb extends Spell return true; } - @Override - public ParticleType trail() - { - return ParticleType.WITCH_MAGIC; - } - @Override public ParticleType hit() { - return ParticleType.FLAME; + return ParticleType.HUGE_EXPLOSION; } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellGrowthLiner.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellGrowthLiner.java index 548a1197f..1ba8efa83 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellGrowthLiner.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellGrowthLiner.java @@ -17,7 +17,7 @@ public class SpellGrowthLiner extends Spell public SpellGrowthLiner(ArcadeManager manager) { - super(manager, "Growth Line", 7, Material.STICK, 2000L, false); + super(manager, "Growth Line", 7, Material.STICK, 2000L, 10, 0, false); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellKillEverything.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellKillEverything.java index bcada9f99..1815173a0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellKillEverything.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellKillEverything.java @@ -16,10 +16,10 @@ import org.bukkit.entity.Player; public class SpellKillEverything extends Spell { - + public SpellKillEverything(ArcadeManager manager) { - super(manager, "Nuke Spell", 0, Material.TNT, 1000L, true); + super(manager, "Nuke Spell", 0, Material.TNT, 1000L, 0, 10000, true); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellMassSlow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellMassSlow.java index 8bb216953..26068b303 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellMassSlow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellMassSlow.java @@ -19,7 +19,7 @@ public class SpellMassSlow extends Spell public SpellMassSlow(ArcadeManager manager) { - super(manager, "Mass Slow spell", 8, Material.ANVIL, 2000L, false); + super(manager, "Mass Slow spell", 8, Material.ANVIL, 2000L, 0, 0, false); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellShrinkLiner.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellShrinkLiner.java index 3283530c9..4bf3471e8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellShrinkLiner.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellShrinkLiner.java @@ -16,7 +16,7 @@ public class SpellShrinkLiner extends Spell public SpellShrinkLiner(ArcadeManager manager) { - super(manager, "Shrinking Line", 7, Material.BLAZE_ROD, 2000L, false); + super(manager, "Shrinking Line", 7, Material.BLAZE_ROD, 2000L, 10, 0, false); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellSniper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellSniper.java index 89b275e8d..6a6e4f097 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellSniper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellSniper.java @@ -20,7 +20,7 @@ public class SpellSniper extends Spell public SpellSniper(ArcadeManager manager) { - super(manager, "Sniper spell", 4, Material.ARROW, 2000L, false); + super(manager, "Sniper spell", 4, Material.ARROW, 2000L, 0, 0, false); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellSpeedUp.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellSpeedUp.java index 9fcee628b..e38733319 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellSpeedUp.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellSpeedUp.java @@ -19,7 +19,7 @@ public class SpellSpeedUp extends Spell public SpellSpeedUp(ArcadeManager manager) { - super(manager, "Speed Boost", 6, Material.FEATHER, 5000L, false); + super(manager, "Speed Boost", 6, Material.FEATHER, 5000L, 0, 0, false); } @Override From 7c42dc3483ff3484ea24f61eeacdb7b745d6024b Mon Sep 17 00:00:00 2001 From: Sarah Date: Sun, 1 Nov 2015 18:33:19 +0100 Subject: [PATCH 024/113] fixinf random Freaks. --- .../game/arcade/game/games/typewars/Minion.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java index 1567cac62..5d7762363 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java @@ -305,7 +305,16 @@ public class Minion for(MinionType type : MinionType.values()) { if(type.ordinal() == rdm) - return type; + { + if(type.getSize() != MinionSize.FREAK) + { + return type; + } + else + { + return randomType(); + } + } } return null; } From ebf5ad4a4ec857be414bd03b6a444d54587d54c9 Mon Sep 17 00:00:00 2001 From: Sarah Date: Sun, 1 Nov 2015 22:32:25 +0100 Subject: [PATCH 025/113] adding boss Mobs and changing win mechanic. --- .../arcade/game/games/typewars/Minion.java | 57 +++- .../game/games/typewars/MinionSize.java | 19 +- .../game/games/typewars/MinionType.java | 6 +- .../arcade/game/games/typewars/Spell.java | 8 +- .../arcade/game/games/typewars/TypeWars.java | 297 +++++++++++++++--- .../games/typewars/spells/SpellSniper.java | 8 +- 6 files changed, 322 insertions(+), 73 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java index 5d7762363..a595ed1fc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java @@ -10,6 +10,7 @@ import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.disguise.disguises.DisguiseBase; +import mineplex.core.disguise.disguises.DisguiseSlime; import mineplex.core.disguise.disguises.DisguiseZombie; import mineplex.core.hologram.Hologram; import nautilus.game.arcade.ArcadeManager; @@ -167,16 +168,19 @@ public class Minion private float _walkSpeed; private boolean _spawned; + private int _spawnID; + private boolean _die; private boolean _killed; private int _frame; + private int _lives; - public Minion(ArcadeManager manager, Location location, Location target, GameTeam team) + public Minion(ArcadeManager manager, Location location, Location target, GameTeam team, int spawnID) { - this(manager, location, target, team, null, true, null); + this(manager, location, target, team, null, true, null, spawnID); } - public Minion(ArcadeManager manager, Location location, Location target, GameTeam team, Player player, boolean spawn, MinionType type) + public Minion(ArcadeManager manager, Location location, Location target, GameTeam team, Player player, boolean spawn, MinionType type, int spawnID) { _manager = manager; @@ -193,12 +197,14 @@ public class Minion _player = player; _killer = null; _money = _type.getMoney(); + _spawnID = spawnID; changeRandomName(_type.getMinName(), _type.getMaxName(), true); _location = location; _target = target; _spawned = false; + _lives = _type.getSize().getLives(); if(spawn) spawnMinion(); } @@ -222,14 +228,12 @@ public class Minion if (_hologram != null) { _hologram.setText( _team.GetColor() + _name); - _hologram.stop(); } else { - _hologram = new Hologram(_manager.getHologramManager(), _entity - .getLocation().add(0, 2.3, 0), _team.GetColor() + _name); + _hologram = new Hologram(_manager.getHologramManager(), _entity.getLocation().add(0, 2.3, 0), _team.GetColor() + _name); _hologram.setHologramTarget(Hologram.HologramTarget.WHITELIST); - _hologram.setFollowEntity(_entity); + //_hologram.setFollowEntity(_entity); for (Player player : _manager.GetGame().GetPlayers(false)) { @@ -272,6 +276,11 @@ public class Minion DisguiseZombie zombie = (DisguiseZombie) disguise; zombie.SetBaby(true); } + if(disguise instanceof DisguiseSlime) + { + DisguiseSlime slime = (DisguiseSlime) disguise; + slime.SetSize(10); + } _entity.setPassenger(ent); _manager.GetDisguise().disguise((DisguiseBase)disguise); i++; @@ -306,7 +315,7 @@ public class Minion { if(type.ordinal() == rdm) { - if(type.getSize() != MinionSize.FREAK) + if(type.getSize() != MinionSize.FREAK && type.getSize() != MinionSize.BOSS) { return type; } @@ -319,8 +328,19 @@ public class Minion return null; } + public boolean hasLives() + { + return _lives > 1; + } + public void despawn(Player player, boolean killed) { + if(_lives > 1) + { + _lives = _lives - 1; + changeRandomName(_name.length()+3, _name.length()+3, false); + return; + } _killed = killed; _player = player; _die = true; @@ -333,13 +353,10 @@ public class Minion } ((Creeper) _entity).damage(10000); } - catch (Exception e) {} - } - - @EventHandler(priority=EventPriority.LOWEST) - public void noItems(EntityDeathEvent event) - { - event.getDrops().clear(); + catch (Exception e) + { + e.printStackTrace(); + } } public void animation() @@ -522,5 +539,15 @@ public class Minion { return _hologram; } + + public int getSpawnID() + { + return _spawnID; + } + public void setTarget(Location location) + { + _target = location; + } + } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionSize.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionSize.java index 34a1d6b94..5ec85a7e1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionSize.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionSize.java @@ -8,22 +8,24 @@ import org.bukkit.Material; public enum MinionSize { - EASY("Easy", 2, Material.SLIME_BALL), - MEDIUM("Medium", 4, Material.COAL), - HARD("Hard", 6, Material.DIAMOND), - FREAK("Freak", 10000, Material.APPLE), - BOSS("Boss", 10000, Material.NETHER_STAR); + EASY("Easy", 2, Material.SLIME_BALL, 1), + MEDIUM("Medium", 4, Material.COAL, 1), + HARD("Hard", 6, Material.DIAMOND, 1), + FREAK("Freak", 10000, Material.APPLE, 1), + BOSS("Boss", 10000, Material.NETHER_STAR, 5); private int _cost; private Material _displayItem; + private int _lives; private String _displayName; - private MinionSize(String name, int cost, Material displayItem) + private MinionSize(String name, int cost, Material displayItem, int lives) { _displayName = name; _cost = cost; _displayItem = displayItem; + _lives = lives; } public int getCost() @@ -53,5 +55,10 @@ public enum MinionSize } return minionList.get(UtilMath.r(minionList.size())); } + + public int getLives() + { + return _lives; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionType.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionType.java index 9447779da..1c616ab5d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionType.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionType.java @@ -12,6 +12,7 @@ import mineplex.core.disguise.disguises.DisguisePig; import mineplex.core.disguise.disguises.DisguiseSkeleton; import mineplex.core.disguise.disguises.DisguiseSlime; import mineplex.core.disguise.disguises.DisguiseSpider; +import mineplex.core.disguise.disguises.DisguiseWither; import mineplex.core.disguise.disguises.DisguiseWolf; import mineplex.core.disguise.disguises.DisguiseZombie; @@ -22,7 +23,7 @@ import org.bukkit.entity.EntityType; public enum MinionType { - CHICKEN(10, MinionSize.EASY, EntityType.CHICKEN, 1, 3, (float) 0.3*7, 2, -0.5D, Material.EGG, DisguiseChicken.class), + CHICKEN(10, MinionSize.EASY, EntityType.CHICKEN, 3, 3, (float) 0.3*7, 2, -0.5D, Material.EGG, DisguiseChicken.class), PIG(10, MinionSize.EASY, EntityType.PIG, 3, 6, (float) 0.3*7, 5, -0.5D, Material.PORK, DisguisePig.class), COW(10, MinionSize.EASY, EntityType.COW, 6, 9, (float) 0.3*7, 3, -0.5D, Material.COOKED_BEEF, DisguiseCow.class), @@ -34,6 +35,9 @@ public enum MinionType HORSE(10, MinionSize.HARD, EntityType.HORSE, 6, 9, (float) 0.3*10, 6, 0D, Material.APPLE, DisguiseHorse.class), ENDERMAN(10, MinionSize.HARD, EntityType.ENDERMAN, 9, 12, (float) 0.3*4, 6, 1D, Material.ENDER_STONE, DisguiseEnderman.class), + WITHER(1, MinionSize.BOSS, EntityType.WITHER, 3, 3, (float) 0.3*2, 15, 2D, Material.NETHER_STAR, DisguiseWither.class), + SLIME(1, MinionSize.BOSS, EntityType.SLIME, 3, 3, (float) 0.3*2, 15, 3D, Material.SLIME_BALL, DisguiseSlime.class), + SPIDER_JOKEY(1, MinionSize.FREAK, EntityType.SPIDER, 10, 13, (float) 0.3*7, 10, 1D, Material.APPLE, DisguiseSpider.class, DisguiseSkeleton.class), CHICKEN_JOKEY(1, MinionSize.FREAK, EntityType.CHICKEN, 10, 13, (float) 0.3*7, 10, 1D, Material.APPLE, DisguiseChicken.class, DisguiseZombie.class); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Spell.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Spell.java index 0e1d43694..b2dff63c3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Spell.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Spell.java @@ -63,7 +63,7 @@ public abstract class Spell { if(_playerUses.contains(player)) { - UtilTextMiddle.display("", C.cYellow + "You can't use this spell anymore.", player); + UtilTextMiddle.display("", ChatColor.GRAY + "You can't use this spell anymore.", player); return; } } @@ -72,7 +72,7 @@ public abstract class Spell { if(!UtilTime.elapsed(_lastUsed.get(team), _useDelay)) { - UtilTextMiddle.display("", "This Spell cant be used at the moment.", player); + UtilTextMiddle.display("", ChatColor.GRAY + "This Spell cant be used at the moment.", player); return; } } @@ -81,13 +81,13 @@ public abstract class Spell _typeWars = (TypeWars) _manager.GetGame(); if(_typeWars.getMoneyMap().get(player) < getCost()) { - UtilTextMiddle.display("", "You dont have enough Money to use that spell.", player); + UtilTextMiddle.display("", ChatColor.GRAY + "You dont have enough Money to use that spell.", player); return; } if(!Recharge.Instance.usable(player, getName(), true)) return; - UtilTextMiddle.display("", "You activated the Spell " + F.game(getName()) + " and got charged " + F.game(getCost() + "$") + ".", player); + UtilTextMiddle.display("", ChatColor.GRAY + "You activated the Spell " + F.game(getName()) + " and got charged " + F.game(getCost() + "$") + ".", player); final Spell spell = this; new Thread(new Runnable() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index ba673f683..62661b052 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; +import mineplex.core.common.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; @@ -38,14 +39,30 @@ import nautilus.game.arcade.game.games.typewars.stats.PerfectionistStatTracker; import nautilus.game.arcade.game.games.typewars.stats.WaitForItStatTracker; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.world.WorldData; +import net.minecraft.server.v1_7_R4.EntityGiantZombie; import org.bukkit.Bukkit; +import org.bukkit.ChatColor; import org.bukkit.Location; +import org.bukkit.Material; import org.bukkit.Sound; +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftGiant; +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftZombie; +import org.bukkit.entity.Giant; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.PlayerChatEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.util.Vector; + +import com.sun.jndi.url.corbaname.corbanameURLContextFactory; +import com.sun.xml.internal.bind.v2.runtime.unmarshaller.XsiNilLoader.Array; public class TypeWars extends TeamGame { @@ -69,6 +86,12 @@ public class TypeWars extends TeamGame private HashMap> _minionSpawns; + private HashMap> _giantAttackZones; + + private HashMap _giants; + + private HashMap _minionsSpawned; + public TypeWars(ArcadeManager manager) { super(manager, GameType.TypeWars, @@ -109,6 +132,9 @@ public class TypeWars extends TeamGame _lineGrowth = new HashMap<>(); _lineShorten = new HashMap<>(); _pendingNukes = new ArrayList<>(); + _giantAttackZones = new HashMap<>(); + _giants = new HashMap<>(); + _minionsSpawned = new HashMap<>(); _animationTicks = 0; _nukeFrame = 0; @@ -126,14 +152,19 @@ public class TypeWars extends TeamGame private void initSpawns() { WorldData data = WorldData; - int i = 0; + /*int i = 0; for(String string : data.GetAllDataLocs().keySet()) { _minionSpawns.put(GetTeamList().get(i), data.GetDataLocs(string)); i++; - if(i > GetTeamList().size()) + if(i >= GetTeamList().size() -1) return; - } + }*/ + _minionSpawns.put(GetTeamList().get(0), (ArrayList)data.GetDataLocs("RED")); + _minionSpawns.put(GetTeamList().get(1), (ArrayList)data.GetDataLocs("LIGHT_BLUE")); + + _giantAttackZones.put(GetTeamList().get(0), (ArrayList) data.GetDataLocs("MAGENTA").clone()); + _giantAttackZones.put(GetTeamList().get(1), (ArrayList) data.GetDataLocs("ORANGE").clone()); } @EventHandler @@ -149,11 +180,13 @@ public class TypeWars extends TeamGame return; initSpawns(); + prepareGiants(); for(GameTeam team : GetTeamList()) { _lineGrowth.put(team, new ArrayList()); _lineShorten.put(team, new ArrayList()); + _minionsSpawned.put(team, 0); } _timeToSpawnRed = 6000 / GetTeamList().get(0).GetPlayers(true).size(); @@ -163,6 +196,50 @@ public class TypeWars extends TeamGame _lastSpawnedBlue = System.currentTimeMillis(); } + public void prepareGiants() + { + Location red = WorldData.GetDataLocs("LIME").get(0); + Location blue = WorldData.GetDataLocs("PURPLE").get(0); + + red.setYaw(UtilAlg.GetYaw(new Vector(blue.getBlockX() - red.getBlockX(), blue.getBlockY() - red.getBlockY(), blue.getBlockZ() - red.getBlockZ()))); + blue.setYaw(UtilAlg.GetYaw(new Vector(red.getBlockX() - blue.getBlockX(), red.getBlockY() - blue.getBlockY(), red.getBlockZ() - blue.getBlockZ()))); + + int i = 0; + for(GameTeam team : GetTeamList()) + { + Location loc = red; + if(i == 1) + loc = blue; + + this.CreatureAllowOverride = true; + Giant giant = loc.getWorld().spawn(loc, Giant.class); + this.CreatureAllowOverride = false; + giant.setRemoveWhenFarAway(false); + UtilEnt.Vegetate(giant, true); + UtilEnt.ghost(giant, true, false); + giant.getEquipment().setHelmet(new ItemStack(Material.LEATHER_HELMET)); + giant.setMaxHealth(100); + giant.setHealth(100); + _giants.put(team, giant); + i++; + } + for(GameTeam team : GetTeamList()) + { + for(GameTeam otherTeam : GetTeamList()) + { + if(team != otherTeam) + { + for(Location location : _giantAttackZones.get(team)) + { + Location giantLoc = _giants.get(otherTeam).getLocation(); + location.setYaw(UtilAlg.GetYaw(new Vector(giantLoc.getBlockX() - location.getBlockX(), giantLoc.getBlockY() - location.getBlockY(), giantLoc.getBlockZ() - location.getBlockZ()))); + } + + } + } + } + } + @EventHandler public void Players(UpdateEvent event) { @@ -186,6 +263,38 @@ public class TypeWars extends TeamGame } } + @EventHandler + public void test(PlayerCommandPreprocessEvent event) + { + if(!event.getMessage().contains("/Boss")) + return; + + if(GetState() != GameState.Live) + return; + + if(!Manager.GetClients().Get(event.getPlayer()).GetRank().has(event.getPlayer(), Rank.DEVELOPER, true)) + return; + + event.setCancelled(true); + + if(!IsPlaying(event.getPlayer())) + return; + + GameTeam teams = GetTeam(event.getPlayer()); + for(GameTeam team : GetTeamList()) + { + if(team == teams) + continue; + + int rdm = UtilMath.r(_minionSpawns.get(teams).size()); + this.CreatureAllowOverride = true; + Minion minion = new Minion(Manager, _minionSpawns.get(teams).get(rdm), _minionSpawns.get(team).get(rdm), teams, event.getPlayer(), true, MinionSize.BOSS.getRandomType(), rdm); + _activeMinions.add(minion); + this.CreatureAllowOverride = false; + UtilPlayer.message(event.getPlayer(), F.main("Boss", "You have spawned a Boss")); + } + } + @EventHandler public void interact(PlayerInteractEvent event) { @@ -201,7 +310,7 @@ public class TypeWars extends TeamGame { if(type.getCost() > _moneyMap.get(event.getPlayer())) { - UtilTextMiddle.display("", "You dont have enough money to spawn this Minion.", event.getPlayer()); + UtilTextMiddle.display("", ChatColor.GRAY + "You dont have enough money to spawn this Minion.", event.getPlayer()); return; } GameTeam teams = GetTeam(event.getPlayer()); @@ -211,15 +320,15 @@ public class TypeWars extends TeamGame { if(getMinions(team).size() >= 60) { - UtilTextMiddle.display("", "Your Team cant have more than 60 Minions", event.getPlayer()); + UtilTextMiddle.display("", ChatColor.GRAY + "Your Team cant have more than 60 Minions", event.getPlayer()); return; } this.CreatureAllowOverride = true; _moneyMap.put(event.getPlayer(), _moneyMap.get(event.getPlayer()) - type.getCost()); - UtilTextMiddle.display("", "You bought a Minion.", event.getPlayer()); + UtilTextMiddle.display("", ChatColor.GRAY + "You bought a Minion.", event.getPlayer()); int rdm = UtilMath.r(_minionSpawns.get(teams).size()); - Minion minion = new Minion(Manager, _minionSpawns.get(teams).get(rdm), _minionSpawns.get(team).get(rdm), teams, event.getPlayer(), true, type.getRandomType()); + Minion minion = new Minion(Manager, _minionSpawns.get(teams).get(rdm), _minionSpawns.get(team).get(rdm), teams, event.getPlayer(), true, type.getRandomType(), rdm); Bukkit.getPluginManager().callEvent(new SummonMinionEvent(event.getPlayer(), minion)); _activeMinions.add(minion); this.CreatureAllowOverride = false; @@ -230,6 +339,12 @@ public class TypeWars extends TeamGame } } + @EventHandler(priority=EventPriority.LOWEST) + public void noItems(EntityDeathEvent event) + { + event.getDrops().clear(); + } + @EventHandler public void spawnMinions(UpdateEvent event) { @@ -247,9 +362,19 @@ public class TypeWars extends TeamGame this.CreatureAllowOverride = true; int rdm = UtilMath.r(_minionSpawns.get(GetTeamList().get(0)).size()); - Minion minion = new Minion(Manager, _minionSpawns.get(GetTeamList().get(0)).get(rdm), _minionSpawns.get(GetTeamList().get(1)).get(rdm), GetTeamList().get(0)); + Minion minion = null; + + if(_minionsSpawned.get(GetTeamList().get(0)) >= 100) + { + minion = new Minion(Manager, _minionSpawns.get(GetTeamList().get(0)).get(rdm), _minionSpawns.get(GetTeamList().get(1)).get(rdm), GetTeamList().get(0), null, true, MinionSize.BOSS.getRandomType(), rdm); + this.Announce(ChatColor.RED + "ALERT:" + ChatColor.WHITE + "A BOSS MONSTER HAS SPAWNED", true); + } + else + { + minion = new Minion(Manager, _minionSpawns.get(GetTeamList().get(0)).get(rdm), _minionSpawns.get(GetTeamList().get(1)).get(rdm), GetTeamList().get(0), rdm); + } _activeMinions.add(minion); - + this.CreatureAllowOverride = false; if(_timeToSpawnRed > 5000 / (GetTeamList().get(1).GetPlayers(true).size() > 0 ? GetTeamList().get(1).GetPlayers(true).size() : 1)) @@ -265,9 +390,17 @@ public class TypeWars extends TeamGame this.CreatureAllowOverride = true; int rdm = UtilMath.r(_minionSpawns.get(GetTeamList().get(1)).size()); - Minion minion = new Minion(Manager, _minionSpawns.get(GetTeamList().get(1)).get(rdm), _minionSpawns.get(GetTeamList().get(0)).get(rdm), GetTeamList().get(1)); + Minion minion = null; + if(_minionsSpawned.get(GetTeamList().get(1)) >= 100) + { + minion = new Minion(Manager, _minionSpawns.get(GetTeamList().get(1)).get(rdm), _minionSpawns.get(GetTeamList().get(0)).get(rdm), GetTeamList().get(1), null, true, MinionSize.BOSS.getRandomType(), rdm); + this.Announce(ChatColor.RED + "ALERT:" + ChatColor.WHITE + "A BOSS MONSTER HAS SPAWNED", true); + } + else + { + minion = new Minion(Manager, _minionSpawns.get(GetTeamList().get(1)).get(rdm), _minionSpawns.get(GetTeamList().get(0)).get(rdm), GetTeamList().get(1), rdm); + } _activeMinions.add(minion); - this.CreatureAllowOverride = false; if(_timeToSpawnBlue > 5000 / (GetTeamList().get(0).GetPlayers(true).size() > 0 ? GetTeamList().get(0).GetPlayers(true).size() : 1)) @@ -296,23 +429,82 @@ public class TypeWars extends TeamGame { if(!UtilEnt.CreatureMoveFast(minion.getEntity(), minion.getTarget(), minion.getWalkSpeed())) { - minionIterator.remove(); - minion.despawn(null, false); - _finishedMinions.add(minion); + GameTeam enemy = null; + for(GameTeam teams : GetTeamList()) + { + if(teams != minion.getTeam()) + enemy = teams; + } + Location nextTarget = _giantAttackZones.get(enemy).get(minion.getSpawnID()); + if(!nextTarget.equals(minion.getTarget())) + { + minion.setTarget(nextTarget); + _finishedMinions.add(minion); + } + } + } + Hologram hologram = minion.getHologram(); + hologram.setLocation(minion.getEntity().getLocation().add(0, minion.getType().getTagHight() + 2.3, 0)); + } + } + + @EventHandler + public void giants(UpdateEvent event) + { + if(GetState() != GameState.Live) + return; + + if(event.getType() != UpdateType.SLOW) + return; + + for(GameTeam team : _giants.keySet()) + { + ArrayList minions = new ArrayList<>(); + for(Minion minion : _finishedMinions) + { + if(!minion.getEntity().isDead()) + { + if(minion.getTeam() != team) + minions.add(minion); } } + if(minions.isEmpty()) + continue; + + Giant giant = _giants.get(team); + Minion minion = minions.get(UtilMath.r(minions.size())); + Location loc = giant.getLocation().clone(); + loc.setYaw(UtilAlg.GetYaw(new Vector(minion.getEntity().getLocation().getBlockX() - loc.getBlockX(), minion.getEntity().getLocation().getBlockY() - loc.getBlockY(), minion.getEntity().getLocation().getBlockZ() - loc.getBlockZ()))); + giant.teleport(loc); + EntityGiantZombie ent = (EntityGiantZombie)((CraftEntity) giant).getHandle(); + ent.world.broadcastEntityEffect(ent, (byte) 4); - for(Player player : GetPlayers(false)) + minion.despawn(null, true); + if(!minion.hasLives()) + _deadMinions.add(minion); + } + } + + @EventHandler + public void minionAttack(UpdateEvent event) + { + if(GetState() != GameState.Live) + return; + + if(event.getType() != UpdateType.SEC) + return; + + for(Minion minion : _finishedMinions) + { + if(minion.getEntity().isDead()) + continue; + + for(GameTeam team : _giants.keySet()) { - if(IsPlaying(player)) + if(team != minion.getTeam()) { - if(GetTeam(player) == minion.getTeam()) - continue; + _giants.get(team).damage(1); } - - Hologram hologram = minion.getHologram(); - hologram.setLocation(minion.getEntity().getLocation().add(0, minion.getType().getTagHight() + 2.3, 0)); - } } } @@ -331,15 +523,13 @@ public class TypeWars extends TeamGame } } - public int getScore(GameTeam team) + public double getScore(GameTeam team) { - int i = 0; - for(Minion minion : _finishedMinions) + if(_giants.get(team).isDead()) { - if(minion.getTeam() == team) - i++; + return 0; } - return i; + return _giants.get(team).getHealth(); } @EventHandler @@ -353,6 +543,16 @@ public class TypeWars extends TeamGame if(event.getMessage().split(" ").length == 1) event.setCancelled(true); + } + + @EventHandler + public void chatCheck(PlayerChatEvent event) + { + if(!IsLive()) + return; + + if(!GetPlayers(true).contains(event.getPlayer())) + return; Minion minion = getFarestMininion(event.getPlayer(), event.getMessage()); @@ -368,7 +568,10 @@ public class TypeWars extends TeamGame return; killMinion(minion, event.getPlayer()); - //UtilPlayer.message(event.getPlayer(), F.main("Game", "You killed the "+ "Minion " + C.cYellow + "\"" + minion.getName() + "\"" + C.cGray + " and got " + minion.getMoney() + "$")); + + int spawned = _minionsSpawned.get(GetTeam(event.getPlayer())); + _minionsSpawned.put(GetTeam(event.getPlayer()), spawned + 1); + UtilTextMiddle.display("", C.cGreen + "+" + minion.getMoney() + "$", event.getPlayer()); _moneyMap.put(event.getPlayer(), _moneyMap.get(event.getPlayer()) + minion.getMoney()); return; @@ -381,9 +584,12 @@ public class TypeWars extends TeamGame public void killMinion(Minion minion, Player player) { + if(!minion.hasLives()) + { + _activeMinions.remove(minion); + _deadMinions.add(minion); + } minion.despawn(player, true); - _activeMinions.remove(minion); - _deadMinions.add(minion); } private Minion getFarestMininion(Player player, String msg) @@ -431,9 +637,16 @@ public class TypeWars extends TeamGame for(GameTeam team : GetTeamList()) { - if(getScore(team) >= 60) + for(GameTeam otherTeam : GetTeamList()) { - winners.add(team); + if(team == otherTeam) + continue; + + if(getScore(team) <= 0) + { + _giants.get(team).damage(1); + winners.add(otherTeam); + } } } @@ -461,7 +674,7 @@ public class TypeWars extends TeamGame while (minionIterator.hasNext()) { Minion minion = minionIterator.next(); - minion.despawn(null, true); + minion.despawn(null, false); minionIterator.remove(); } @@ -642,18 +855,12 @@ public class TypeWars extends TeamGame Scoreboard.WriteBlank(); - for(GameTeam teams : GetTeamList()) + for(GameTeam team : GetTeamList()) { - for(GameTeam team : GetTeamList()) - { - if(team == teams) - continue; - - Scoreboard.Write(team.GetColor() + C.Bold + team.GetName() + " Team"); - Scoreboard.Write(team.GetColor() + "Lives: " + (60 - getScore(teams))); - Scoreboard.Write(team.GetColor() + "Minions: " + getMinions(team).size() + "/60"); - Scoreboard.WriteBlank(); - } + Scoreboard.Write(team.GetColor() + C.Bold + team.GetName() + " Team"); + Scoreboard.Write(team.GetColor() + "Health: " + getScore(team)); + Scoreboard.Write(team.GetColor() + "Minions: " + getMinions(team).size() + "/60"); + Scoreboard.WriteBlank(); } Scoreboard.Draw(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellSniper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellSniper.java index 6a6e4f097..ddc9db8e5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellSniper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellSniper.java @@ -13,6 +13,7 @@ import mineplex.core.common.util.UtilShapes; import mineplex.core.common.util.UtilParticle.ParticleType; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.typewars.Minion; +import nautilus.game.arcade.game.games.typewars.MinionSize; import nautilus.game.arcade.game.games.typewars.Spell; public class SpellSniper extends Spell @@ -48,8 +49,11 @@ public class SpellSniper extends Spell continue; minion.despawn(player, true); - minionIterator.remove(); - getTypeWars().getDeadMinions().add(minion); + if(!minion.hasLives()) + { + minionIterator.remove(); + getTypeWars().getDeadMinions().add(minion); + } break; } } From ee7006a3de55a17fd8fe8888161a29023084842e Mon Sep 17 00:00:00 2001 From: Sarah Date: Wed, 4 Nov 2015 07:17:15 +0100 Subject: [PATCH 026/113] Giant makes Sounds, lifted up Giant, randomize Minions by time played, changing spawn Items. --- .../arcade/game/games/typewars/Minion.java | 14 ++++++- .../game/games/typewars/MinionSize.java | 17 ++++---- .../game/games/typewars/MinionType.java | 26 ++++++------ .../arcade/game/games/typewars/Spell.java | 7 +++- .../arcade/game/games/typewars/TypeWars.java | 41 +++++++++++++++---- .../games/typewars/kits/KitTypeWarsBase.java | 2 +- .../typewars/spells/SpellKillEverything.java | 6 ++- 7 files changed, 81 insertions(+), 32 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java index a595ed1fc..c10d24959 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java @@ -299,8 +299,20 @@ public class Minion private MinionType randomType() { + if(System.currentTimeMillis() - _manager.GetGame().GetStateTime() <= 30000) + { + return MinionSize.EASY.getRandomType(); + } + if(System.currentTimeMillis() - _manager.GetGame().GetStateTime() <= 60000) + { + int rdm = UtilMath.r(2); + if(rdm == 0) + return MinionSize.MEDIUM.getRandomType(); + else + return MinionSize.EASY.getRandomType(); + } int rdm = UtilMath.r(MinionType.values().length); - int freak = UtilMath.r(100); + int freak = UtilMath.r(1000); if(freak <= 10) { ArrayList minions = new ArrayList<>(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionSize.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionSize.java index 5ec85a7e1..0bc211f90 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionSize.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionSize.java @@ -5,22 +5,23 @@ import java.util.ArrayList; import mineplex.core.common.util.UtilMath; import org.bukkit.Material; +import org.bukkit.inventory.ItemStack; public enum MinionSize { - EASY("Easy", 2, Material.SLIME_BALL, 1), - MEDIUM("Medium", 4, Material.COAL, 1), - HARD("Hard", 6, Material.DIAMOND, 1), - FREAK("Freak", 10000, Material.APPLE, 1), - BOSS("Boss", 10000, Material.NETHER_STAR, 5); + EASY("Easy", 2, new ItemStack(Material.MONSTER_EGG, 55), 1), + MEDIUM("Medium", 4, new ItemStack(Material.MONSTER_EGG, 61), 1), + HARD("Hard", 6, new ItemStack(Material.MONSTER_EGG, 52), 1), + FREAK("Freak", 10000, new ItemStack(Material.MONSTER_EGG), 1), + BOSS("Boss", 10000, new ItemStack(Material.MONSTER_EGG), 5); private int _cost; - private Material _displayItem; + private ItemStack _displayItem; private int _lives; private String _displayName; - private MinionSize(String name, int cost, Material displayItem, int lives) + private MinionSize(String name, int cost, ItemStack displayItem, int lives) { _displayName = name; _cost = cost; @@ -33,7 +34,7 @@ public enum MinionSize return _cost; } - public Material getDisplayItem() + public ItemStack getDisplayItem() { return _displayItem; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionType.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionType.java index 1c616ab5d..a1831eecc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionType.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionType.java @@ -23,23 +23,23 @@ import org.bukkit.entity.EntityType; public enum MinionType { - CHICKEN(10, MinionSize.EASY, EntityType.CHICKEN, 3, 3, (float) 0.3*7, 2, -0.5D, Material.EGG, DisguiseChicken.class), - PIG(10, MinionSize.EASY, EntityType.PIG, 3, 6, (float) 0.3*7, 5, -0.5D, Material.PORK, DisguisePig.class), - COW(10, MinionSize.EASY, EntityType.COW, 6, 9, (float) 0.3*7, 3, -0.5D, Material.COOKED_BEEF, DisguiseCow.class), + CHICKEN(10, MinionSize.EASY, EntityType.CHICKEN, 3, 3, (float) (0.7 + (0.1*7)), 1, -0.5D, Material.EGG, DisguiseChicken.class), + PIG(10, MinionSize.EASY, EntityType.PIG, 3, 6, (float) (0.7 + (0.1*7)), 1, -0.5D, Material.PORK, DisguisePig.class), + COW(10, MinionSize.EASY, EntityType.COW, 6, 9, (float) (0.7 + (0.1*7)), 1, -0.5D, Material.COOKED_BEEF, DisguiseCow.class), - ZOMBIE(10, MinionSize.MEDIUM, EntityType.ZOMBIE, 9, 12, (float) 0.3*2, 3, 0D, Material.ROTTEN_FLESH, DisguiseZombie.class), - SPIDER(10, MinionSize.MEDIUM, EntityType.SPIDER, 6, 9, (float) 0.3*5, 3, 0D, Material.SPIDER_EYE, DisguiseSpider.class), - WOLF(10, MinionSize.MEDIUM, EntityType.WOLF, 3, 6, (float) 0.3*8, 2, -1D, Material.COOKED_BEEF, DisguiseWolf.class), + ZOMBIE(10, MinionSize.MEDIUM, EntityType.ZOMBIE, 9, 12, (float) (0.7 + (0.1*2)), 2, 0D, Material.ROTTEN_FLESH, DisguiseZombie.class), + SPIDER(10, MinionSize.MEDIUM, EntityType.SPIDER, 6, 9, (float) (0.7 + (0.1*5)), 2, 0D, Material.SPIDER_EYE, DisguiseSpider.class), + WOLF(10, MinionSize.MEDIUM, EntityType.WOLF, 3, 6, (float) (0.7 + (0.1*8)), 2, -1D, Material.COOKED_BEEF, DisguiseWolf.class), - IRON_GOLEM(10, MinionSize.HARD, EntityType.IRON_GOLEM, 10, 13,(float) 0.3*3, 6, 0.5D, Material.IRON_INGOT, DisguiseIronGolem.class), - HORSE(10, MinionSize.HARD, EntityType.HORSE, 6, 9, (float) 0.3*10, 6, 0D, Material.APPLE, DisguiseHorse.class), - ENDERMAN(10, MinionSize.HARD, EntityType.ENDERMAN, 9, 12, (float) 0.3*4, 6, 1D, Material.ENDER_STONE, DisguiseEnderman.class), + IRON_GOLEM(10, MinionSize.HARD, EntityType.IRON_GOLEM, 10, 13,(float) (0.7 + (0.1*3)), 3, 0.5D, Material.IRON_INGOT, DisguiseIronGolem.class), + HORSE(10, MinionSize.HARD, EntityType.HORSE, 6, 9, (float) (0.7 + (0.1*10)), 3, 0D, Material.APPLE, DisguiseHorse.class), + ENDERMAN(10, MinionSize.HARD, EntityType.ENDERMAN, 9, 12, (float) (0.7 + (0.1*4)), 3, 1D, Material.ENDER_STONE, DisguiseEnderman.class), - WITHER(1, MinionSize.BOSS, EntityType.WITHER, 3, 3, (float) 0.3*2, 15, 2D, Material.NETHER_STAR, DisguiseWither.class), - SLIME(1, MinionSize.BOSS, EntityType.SLIME, 3, 3, (float) 0.3*2, 15, 3D, Material.SLIME_BALL, DisguiseSlime.class), + WITHER(1, MinionSize.BOSS, EntityType.WITHER, 3, 3, (float) (0.7 + (0.1*2)), 15, 2D, Material.NETHER_STAR, DisguiseWither.class), + SLIME(1, MinionSize.BOSS, EntityType.SLIME, 3, 3, (float) (0.7 + (0.1*2)), 15, 3D, Material.SLIME_BALL, DisguiseSlime.class), - SPIDER_JOKEY(1, MinionSize.FREAK, EntityType.SPIDER, 10, 13, (float) 0.3*7, 10, 1D, Material.APPLE, DisguiseSpider.class, DisguiseSkeleton.class), - CHICKEN_JOKEY(1, MinionSize.FREAK, EntityType.CHICKEN, 10, 13, (float) 0.3*7, 10, 1D, Material.APPLE, DisguiseChicken.class, DisguiseZombie.class); + SPIDER_JOKEY(1, MinionSize.FREAK, EntityType.SPIDER, 10, 13, (float) (0.7 + (0.1*7)), 10, 1D, Material.APPLE, DisguiseSpider.class, DisguiseSkeleton.class), + CHICKEN_JOKEY(1, MinionSize.FREAK, EntityType.CHICKEN, 10, 13, (float) (0.7 + (0.1*7)), 10, 1D, Material.APPLE, DisguiseChicken.class, DisguiseZombie.class); private Class[] _disguiseClasses; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Spell.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Spell.java index b2dff63c3..532de8dd0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Spell.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Spell.java @@ -87,7 +87,7 @@ public abstract class Spell if(!Recharge.Instance.usable(player, getName(), true)) return; - UtilTextMiddle.display("", ChatColor.GRAY + "You activated the Spell " + F.game(getName()) + " and got charged " + F.game(getCost() + "$") + ".", player); + UtilTextMiddle.display(ChatColor.GREEN + "-$" + getCost(), ChatColor.GRAY + "You used " + F.game(getName()), player); final Spell spell = this; new Thread(new Runnable() @@ -164,6 +164,11 @@ public abstract class Spell { return Sound.CLICK; } + + public boolean hasUsed(Player player) + { + return _playerUses.contains(player); + } public void trailAnimation(Location location, int frame) {} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index 62661b052..8a2f7e83e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -12,6 +12,7 @@ import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilMath; 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; @@ -32,6 +33,7 @@ import nautilus.game.arcade.game.games.typewars.kits.KitTactician; import nautilus.game.arcade.game.games.typewars.kits.KitTypeWarsBase; import nautilus.game.arcade.game.games.typewars.kits.KitTyper; import nautilus.game.arcade.game.games.typewars.kits.KitWarrior; +import nautilus.game.arcade.game.games.typewars.spells.SpellKillEverything; import nautilus.game.arcade.game.games.typewars.stats.DemonStatsTracker; import nautilus.game.arcade.game.games.typewars.stats.DumbledontStatTracker; import nautilus.game.arcade.game.games.typewars.stats.HoarderStatTracker; @@ -121,6 +123,7 @@ public class TypeWars extends TeamGame this.DamagePvP = false; this.TeamArmorHotbar = true; this.Damage = false; + this.CreatureAllow = false; _activeMinions = new ArrayList<>(); _deadMinions = new ArrayList<>(); @@ -201,6 +204,18 @@ public class TypeWars extends TeamGame Location red = WorldData.GetDataLocs("LIME").get(0); Location blue = WorldData.GetDataLocs("PURPLE").get(0); + for (int i = 0; i < 4; i++) + { + red.getWorld().getBlockAt(red).setType(Material.STONE); + blue.getWorld().getBlockAt(blue).setType(Material.STONE); + + red.add(0, 1, 0); + blue.add(0,1,0); + } + + red.add(0, 1, 0); + blue.add(0, 1, 0); + red.setYaw(UtilAlg.GetYaw(new Vector(blue.getBlockX() - red.getBlockX(), blue.getBlockY() - red.getBlockY(), blue.getBlockZ() - red.getBlockZ()))); blue.setYaw(UtilAlg.GetYaw(new Vector(red.getBlockX() - blue.getBlockX(), red.getBlockY() - blue.getBlockY(), red.getBlockZ() - blue.getBlockZ()))); @@ -251,7 +266,7 @@ public class TypeWars extends TeamGame { player.setAllowFlight(true); player.setFlying(true); - UtilTextBottom.display(C.cGreen + "You have " + _moneyMap.get(player) + "$", player); + UtilTextBottom.display(C.cGreen + "You have $" + _moneyMap.get(player), player); for(Minion minion : _activeMinions) { @@ -306,7 +321,7 @@ public class TypeWars extends TeamGame for(MinionSize type : MinionSize.values()) { - if(type.getDisplayItem() == event.getItem().getType()) + if(type.getDisplayItem().getDurability() == event.getItem().getDurability()) { if(type.getCost() > _moneyMap.get(event.getPlayer())) { @@ -476,8 +491,8 @@ public class TypeWars extends TeamGame Location loc = giant.getLocation().clone(); loc.setYaw(UtilAlg.GetYaw(new Vector(minion.getEntity().getLocation().getBlockX() - loc.getBlockX(), minion.getEntity().getLocation().getBlockY() - loc.getBlockY(), minion.getEntity().getLocation().getBlockZ() - loc.getBlockZ()))); giant.teleport(loc); - EntityGiantZombie ent = (EntityGiantZombie)((CraftEntity) giant).getHandle(); - ent.world.broadcastEntityEffect(ent, (byte) 4); + giant.getWorld().playSound(giant.getLocation(), Sound.ZOMBIE_WOODBREAK, 1, 1); + UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, minion.getEntity().getLocation(), 0, 0, 0, 1, 1, ViewDist.NORMAL, UtilServer.getPlayers()); minion.despawn(null, true); if(!minion.hasLives()) @@ -572,7 +587,7 @@ public class TypeWars extends TeamGame int spawned = _minionsSpawned.get(GetTeam(event.getPlayer())); _minionsSpawned.put(GetTeam(event.getPlayer()), spawned + 1); - UtilTextMiddle.display("", C.cGreen + "+" + minion.getMoney() + "$", event.getPlayer()); + UtilTextMiddle.display("", C.cGreen + "+$" + minion.getMoney(), event.getPlayer()); _moneyMap.put(event.getPlayer(), _moneyMap.get(event.getPlayer()) + minion.getMoney()); return; } @@ -710,6 +725,14 @@ public class TypeWars extends TeamGame int e = 0; for(Spell spell : ((KitTypeWarsBase) GetKit(player)).getSpells()) { + if(spell instanceof SpellKillEverything) + { + if(spell.hasUsed(player)) + { + player.getInventory().setItem(e, new ItemStack(Material.AIR)); + continue; + } + } if(_moneyMap.get(player) >= spell.getCost()) { if(spell.getCost() > 0) @@ -732,11 +755,11 @@ public class TypeWars extends TeamGame if(_moneyMap.get(player) >= type.getCost()) { - player.getInventory().setItem(i, ItemStackFactory.Instance.CreateStack(type.getDisplayItem(), (byte) 0, Math.round(_moneyMap.get(player)/type.getCost()), C.cGreen + "Spawn " + type.getDisplayName() + " Minion Cost: " + type.getCost())); + player.getInventory().setItem(i, ItemStackFactory.Instance.CreateStack(type.getDisplayItem().getType(), (byte) 0, Math.round(_moneyMap.get(player)/type.getCost()), (short) type.getDisplayItem().getAmount(), C.cGreen + "Spawn " + type.getDisplayName() + " Minion Cost: " + type.getCost(), new String[]{})); } else { - player.getInventory().setItem(i, ItemStackFactory.Instance.CreateStack(type.getDisplayItem(), (byte) 0, 0, C.cRed + "Spawn " + type.getDisplayName() + " Minion Cost: " + type.getCost())); + player.getInventory().setItem(i, ItemStackFactory.Instance.CreateStack(type.getDisplayItem().getType(), (byte) 0, 0, (short) type.getDisplayItem().getAmount(), C.cRed + "Spawn " + type.getDisplayName() + " Minion Cost: " + type.getCost(), new String[]{})); } i++; } @@ -909,6 +932,10 @@ public class TypeWars extends TeamGame _pendingNukes.remove(0); return; } + if(_nukeFrame < 25) + { + _giants.get(team).getWorld().playSound(_giants.get(team).getLocation(), Sound.ZOMBIE_IDLE, 1, 1); + } boolean cansee = true; int i = 0; for(Location loc : _minionSpawns.get(team)) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTypeWarsBase.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTypeWarsBase.java index e4608f9fc..e767bc080 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTypeWarsBase.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTypeWarsBase.java @@ -49,7 +49,7 @@ public abstract class KitTypeWarsBase extends Kit { if(type != MinionSize.BOSS && type != MinionSize.FREAK) { - player.getInventory().setItem(i, ItemStackFactory.Instance.CreateStack(type.getDisplayItem(), (byte) 0, 1, C.cYellow + "Spawn " + type.getDisplayName() + " Minion Cost: " + type.getCost())); + player.getInventory().setItem(i, ItemStackFactory.Instance.CreateStack(type.getDisplayItem().getType(), (byte) 0, 1, (short) type.getDisplayItem().getAmount(), C.cYellow + "Spawn " + type.getDisplayName() + " Minion Cost: " + type.getCost(), new String[]{})); i++; } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellKillEverything.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellKillEverything.java index 1815173a0..33a1384d2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellKillEverything.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellKillEverything.java @@ -4,6 +4,8 @@ import java.util.ArrayList; import java.util.Iterator; import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextMiddle; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.typewars.ActivateNukeSpellEvent; import nautilus.game.arcade.game.games.typewars.Minion; @@ -19,7 +21,7 @@ public class SpellKillEverything extends Spell public SpellKillEverything(ArcadeManager manager) { - super(manager, "Nuke Spell", 0, Material.TNT, 1000L, 0, 10000, true); + super(manager, "Zombie Smash", 0, Material.TNT, 1000L, 0, 10000, true); } @Override @@ -37,6 +39,8 @@ public class SpellKillEverything extends Spell @Override public boolean execute(Player player, Location location) { + + UtilTextMiddle.display("", player.getName() + " used A Zombie Smash", UtilServer.getPlayers()); ArrayList minionList = new ArrayList<>(); Iterator minionIterator = getTypeWars().getActiveMinions().iterator(); while(minionIterator.hasNext()) From 56966d690fa1fd4f64fdc331abe31defc88bbda4 Mon Sep 17 00:00:00 2001 From: Sarah Date: Thu, 5 Nov 2015 22:56:07 +0100 Subject: [PATCH 027/113] Fixing random Creepers, adding giant is under Attack message, adding start message, small fixes --- .../arcade/game/games/typewars/Minion.java | 23 +++--- .../game/games/typewars/MinionSize.java | 7 +- .../arcade/game/games/typewars/TypeWars.java | 79 ++++++++++++++----- .../games/typewars/kits/KitTypeWarsBase.java | 2 +- 4 files changed, 76 insertions(+), 35 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java index c10d24959..6b4b6607b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java @@ -24,9 +24,7 @@ import org.bukkit.Material; import org.bukkit.entity.Creeper; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.entity.EntityDeathEvent; +import org.bukkit.entity.Zombie; import org.bukkit.inventory.ItemStack; public class Minion @@ -59,7 +57,7 @@ public class Minion "Levitation", "Resistance", "Inflatable", "Newspaper", "Sketching", "Centipede", "Parachute", "Treachery", "Crocodile", "Baseball", "Vegetables", "Lighthouse", "Relentless", "Dinosaurs", "Teenagers", "Cartwheel", "Barricade", "Blowtorch", "Alligator", "Presents", "Whispering", "Helicopter", "Mistakable", "Tarantula", "Grassland", "Hard Rock", "President", "Raincloud", "Incentive", "Balloons", - "Announcing", "Mechanical", "Expectance", "Mountains", "Pop Music", "Fingertip", "Millenium", "Structure", "Keyboard", + "Announcing", "Mechanical", "Expectance", "Mountains", "Fingertip", "Millenium", "Structure", "Keyboard", "Meditation", "Toothbrush", "Tumbleweed", "Sandstone", "Dumplings", "Scientist", "Pineapple", "Boyfriend", "Spotlight", "Computer", "Clothing", "Elephant", "Reptiles", "Scorpion", "Redstone", "Diamonds", "Porkchop", "Endermen", "Obsidian", "Planting", "Potatoes", "Vampires", "Bracelet", "Coloring", "Thousand", "Hologram", "Lipstick", "Cruising", "Delivery", "Dreaming", @@ -115,7 +113,7 @@ public class Minion "Elegant", "Violate", "Heroic", "Violent", "Leaves", "Soccer", "Europe", "School", "Scarfs", "Orange", "Dentist", "Neglect", "Strong", "Solvent", "Monkey", "Closet", "Africa", "Hotels", "Sharks", "Yellow", "Combine", "Fulfill", "Barbie", "Engrave", "Rabbit", "Carpet", "Winter", "Zipper", "Whales", "Purple", - "Surface", "Sailing", "Pencil", "Passage", "Kitten", "Satern", "Spring", "Acorns", "Comets", "Graffe", + "Surface", "Sailing", "Pencil", "Passage", "Kitten", "Saturn", "Spring", "Acorns", "Comets", "Graffe", "Gelatin", "Klarin", "Phones", "Quality", "Ingots", "Uranus", "Summer", "Pariot", "Comedy", "Poison", "Similar", "Flutter", "Shield", "Psychic", "Spider", "Mexico", "Autumn", "Cruise", "Sports", "Forest", "Oxidize", "Disease", "Guitar", "Opossum", "Ghasts", "France", "Ghosts", "Lucius", "Cement", "Desert", @@ -211,11 +209,12 @@ public class Minion public void spawnMinion() { - _entity = _location.getWorld().spawn(_location, Creeper.class); - Creeper creeper = (Creeper) _entity; - creeper.setRemoveWhenFarAway(false); - creeper.setMaxHealth(200); - creeper.setHealth(200); + _entity = _location.getWorld().spawn(_location, Zombie.class); + Zombie zombie = (Zombie) _entity; + zombie.setRemoveWhenFarAway(false); + zombie.setMaxHealth(200); + zombie.setHealth(200); + zombie.getEquipment().setHelmet(new ItemStack(Material.LEATHER_HELMET)); disguiseCreeper(); path(); _spawned = true; @@ -361,9 +360,9 @@ public class Minion { if(_entity.getPassenger() != null) { - ((Creeper) _entity.getPassenger()).damage(10000); + ((Zombie) _entity.getPassenger()).damage(10000); } - ((Creeper) _entity).damage(10000); + ((Zombie) _entity).damage(10000); } catch (Exception e) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionSize.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionSize.java index 0bc211f90..ccabb5af5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionSize.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionSize.java @@ -3,15 +3,16 @@ package nautilus.game.arcade.game.games.typewars; import java.util.ArrayList; import mineplex.core.common.util.UtilMath; +import mineplex.core.itemstack.ItemStackFactory; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; public enum MinionSize { - EASY("Easy", 2, new ItemStack(Material.MONSTER_EGG, 55), 1), - MEDIUM("Medium", 4, new ItemStack(Material.MONSTER_EGG, 61), 1), - HARD("Hard", 6, new ItemStack(Material.MONSTER_EGG, 52), 1), + EASY("Easy", 2, ItemStackFactory.Instance.CreateStack(Material.MONSTER_EGG, (byte) 0, 1, (short) 55, "", new String[]{}), 1), + MEDIUM("Medium", 4, ItemStackFactory.Instance.CreateStack(Material.MONSTER_EGG, (byte) 0, 1, (short) 61, "", new String[]{}), 1), + HARD("Hard", 6, ItemStackFactory.Instance.CreateStack(Material.MONSTER_EGG, (byte) 0, 1, (short) 52, "", new String[]{}), 1), FREAK("Freak", 10000, new ItemStack(Material.MONSTER_EGG), 1), BOSS("Boss", 10000, new ItemStack(Material.MONSTER_EGG), 5); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index 8a2f7e83e..601d27fd0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -29,10 +29,8 @@ 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.typewars.kits.KitTactician; import nautilus.game.arcade.game.games.typewars.kits.KitTypeWarsBase; import nautilus.game.arcade.game.games.typewars.kits.KitTyper; -import nautilus.game.arcade.game.games.typewars.kits.KitWarrior; import nautilus.game.arcade.game.games.typewars.spells.SpellKillEverything; import nautilus.game.arcade.game.games.typewars.stats.DemonStatsTracker; import nautilus.game.arcade.game.games.typewars.stats.DumbledontStatTracker; @@ -41,31 +39,28 @@ import nautilus.game.arcade.game.games.typewars.stats.PerfectionistStatTracker; import nautilus.game.arcade.game.games.typewars.stats.WaitForItStatTracker; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.world.WorldData; -import net.minecraft.server.v1_7_R4.EntityGiantZombie; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftGiant; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftZombie; +import org.bukkit.entity.Creeper; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Giant; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.entity.EntityDeathEvent; +import org.bukkit.event.entity.EntitySpawnEvent; import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.PlayerChatEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.LeatherArmorMeta; import org.bukkit.util.Vector; -import com.sun.jndi.url.corbaname.corbanameURLContextFactory; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.XsiNilLoader.Array; - public class TypeWars extends TeamGame { @@ -94,6 +89,8 @@ public class TypeWars extends TeamGame private HashMap _minionsSpawned; + private HashMap _giantsAttacked; + public TypeWars(ArcadeManager manager) { super(manager, GameType.TypeWars, @@ -138,6 +135,7 @@ public class TypeWars extends TeamGame _giantAttackZones = new HashMap<>(); _giants = new HashMap<>(); _minionsSpawned = new HashMap<>(); + _giantsAttacked = new HashMap<>(); _animationTicks = 0; _nukeFrame = 0; @@ -163,11 +161,11 @@ public class TypeWars extends TeamGame if(i >= GetTeamList().size() -1) return; }*/ - _minionSpawns.put(GetTeamList().get(0), (ArrayList)data.GetDataLocs("RED")); - _minionSpawns.put(GetTeamList().get(1), (ArrayList)data.GetDataLocs("LIGHT_BLUE")); + _minionSpawns.put(GetTeamList().get(1), (ArrayList)data.GetDataLocs("RED")); + _minionSpawns.put(GetTeamList().get(0), (ArrayList)data.GetDataLocs("LIGHT_BLUE")); - _giantAttackZones.put(GetTeamList().get(0), (ArrayList) data.GetDataLocs("MAGENTA").clone()); - _giantAttackZones.put(GetTeamList().get(1), (ArrayList) data.GetDataLocs("ORANGE").clone()); + _giantAttackZones.put(GetTeamList().get(1), (ArrayList) data.GetDataLocs("MAGENTA").clone()); + _giantAttackZones.put(GetTeamList().get(0), (ArrayList) data.GetDataLocs("ORANGE").clone()); } @EventHandler @@ -182,6 +180,8 @@ public class TypeWars extends TeamGame if(event.GetState() != GameState.Live) return; + UtilTextMiddle.display("", "Protect your Giant from minions! Type their names to kill them.", 20, 100, 20, UtilServer.getPlayers()); + initSpawns(); prepareGiants(); @@ -232,7 +232,10 @@ public class TypeWars extends TeamGame giant.setRemoveWhenFarAway(false); UtilEnt.Vegetate(giant, true); UtilEnt.ghost(giant, true, false); - giant.getEquipment().setHelmet(new ItemStack(Material.LEATHER_HELMET)); + ItemStack stack = new ItemStack(Material.LEATHER_HELMET); + LeatherArmorMeta meta = (LeatherArmorMeta) stack.getItemMeta(); + meta.setColor(team.GetColorBase()); + giant.getEquipment().setHelmet(stack); giant.setMaxHealth(100); giant.setHealth(100); _giants.put(team, giant); @@ -354,6 +357,15 @@ public class TypeWars extends TeamGame } } + @EventHandler + public void mobSpawn(EntitySpawnEvent event) + { + if(event.getEntityType() == EntityType.CREEPER) + { + event.setCancelled(true); + } + } + @EventHandler(priority=EventPriority.LOWEST) public void noItems(EntityDeathEvent event) { @@ -381,6 +393,7 @@ public class TypeWars extends TeamGame if(_minionsSpawned.get(GetTeamList().get(0)) >= 100) { + _minionsSpawned.put(GetTeamList().get(0), 0); minion = new Minion(Manager, _minionSpawns.get(GetTeamList().get(0)).get(rdm), _minionSpawns.get(GetTeamList().get(1)).get(rdm), GetTeamList().get(0), null, true, MinionSize.BOSS.getRandomType(), rdm); this.Announce(ChatColor.RED + "ALERT:" + ChatColor.WHITE + "A BOSS MONSTER HAS SPAWNED", true); } @@ -408,6 +421,7 @@ public class TypeWars extends TeamGame Minion minion = null; if(_minionsSpawned.get(GetTeamList().get(1)) >= 100) { + _minionsSpawned.put(GetTeamList().get(1), 0); minion = new Minion(Manager, _minionSpawns.get(GetTeamList().get(1)).get(rdm), _minionSpawns.get(GetTeamList().get(0)).get(rdm), GetTeamList().get(1), null, true, MinionSize.BOSS.getRandomType(), rdm); this.Announce(ChatColor.RED + "ALERT:" + ChatColor.WHITE + "A BOSS MONSTER HAS SPAWNED", true); } @@ -492,6 +506,7 @@ public class TypeWars extends TeamGame loc.setYaw(UtilAlg.GetYaw(new Vector(minion.getEntity().getLocation().getBlockX() - loc.getBlockX(), minion.getEntity().getLocation().getBlockY() - loc.getBlockY(), minion.getEntity().getLocation().getBlockZ() - loc.getBlockZ()))); giant.teleport(loc); giant.getWorld().playSound(giant.getLocation(), Sound.ZOMBIE_WOODBREAK, 1, 1); + giant.getWorld().playSound(giant.getLocation(), Sound.ZOMBIE_IDLE, 1, 1); UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, minion.getEntity().getLocation(), 0, 0, 0, 1, 1, ViewDist.NORMAL, UtilServer.getPlayers()); minion.despawn(null, true); @@ -509,16 +524,42 @@ public class TypeWars extends TeamGame if(event.getType() != UpdateType.SEC) return; + HashMap minions = new HashMap<>(); for(Minion minion : _finishedMinions) { if(minion.getEntity().isDead()) continue; - for(GameTeam team : _giants.keySet()) + if(!minions.containsKey(minion.getTeam())) { - if(team != minion.getTeam()) + minions.put(minion.getTeam(), 1); + continue; + } + int i = minions.get(minion.getTeam()); + minions.put(minion.getTeam(), i + 1); + } + for(GameTeam team : _giants.keySet()) + { + for(GameTeam otherTeam : minions.keySet()) + if(team != otherTeam) { - _giants.get(team).damage(1); + if(minions.containsKey(otherTeam)) + _giants.get(team).damage(minions.get(otherTeam)); + } + if(_giantsAttacked.containsKey(team)) + { + if(_giantsAttacked.get(team) != null) + { + if(UtilTime.elapsed(_giantsAttacked.get(team), 10000)) + { + for(Player player : GetPlayers(true)) + { + if(GetTeam(player) == team) + { + UtilTextMiddle.display("", "Your giant is under Attack!", player); + } + } + } } } } @@ -755,11 +796,11 @@ public class TypeWars extends TeamGame if(_moneyMap.get(player) >= type.getCost()) { - player.getInventory().setItem(i, ItemStackFactory.Instance.CreateStack(type.getDisplayItem().getType(), (byte) 0, Math.round(_moneyMap.get(player)/type.getCost()), (short) type.getDisplayItem().getAmount(), C.cGreen + "Spawn " + type.getDisplayName() + " Minion Cost: " + type.getCost(), new String[]{})); + player.getInventory().setItem(i, ItemStackFactory.Instance.CreateStack(type.getDisplayItem().getType(), (byte) 0, Math.round(_moneyMap.get(player)/type.getCost()), (short) type.getDisplayItem().getDurability(), C.cGreen + "Spawn " + type.getDisplayName() + " Minion Cost: " + type.getCost(), new String[]{})); } else { - player.getInventory().setItem(i, ItemStackFactory.Instance.CreateStack(type.getDisplayItem().getType(), (byte) 0, 0, (short) type.getDisplayItem().getAmount(), C.cRed + "Spawn " + type.getDisplayName() + " Minion Cost: " + type.getCost(), new String[]{})); + player.getInventory().setItem(i, ItemStackFactory.Instance.CreateStack(type.getDisplayItem().getType(), (byte) 0, 0, (short) type.getDisplayItem().getDurability(), C.cRed + "Spawn " + type.getDisplayName() + " Minion Cost: " + type.getCost(), new String[]{})); } i++; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTypeWarsBase.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTypeWarsBase.java index e767bc080..ae36d5c21 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTypeWarsBase.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTypeWarsBase.java @@ -49,7 +49,7 @@ public abstract class KitTypeWarsBase extends Kit { if(type != MinionSize.BOSS && type != MinionSize.FREAK) { - player.getInventory().setItem(i, ItemStackFactory.Instance.CreateStack(type.getDisplayItem().getType(), (byte) 0, 1, (short) type.getDisplayItem().getAmount(), C.cYellow + "Spawn " + type.getDisplayName() + " Minion Cost: " + type.getCost(), new String[]{})); + player.getInventory().setItem(i, ItemStackFactory.Instance.CreateStack(type.getDisplayItem().getType(), (byte) 0, 1, (short) type.getDisplayItem().getDurability(), C.cYellow + "Spawn " + type.getDisplayName() + " Minion Cost: " + type.getCost(), new String[]{})); i++; } } From 18ab3d0f5b60d96be66fc7ef3ea681e65571a3cc Mon Sep 17 00:00:00 2001 From: Sarah Date: Mon, 9 Nov 2015 15:40:49 +0100 Subject: [PATCH 028/113] Mob shrinking and some Word fixes. --- .../arcade/game/games/typewars/Minion.java | 37 +++++++++++++++---- .../game/games/typewars/MinionSize.java | 2 +- .../game/games/typewars/MinionType.java | 4 +- .../arcade/game/games/typewars/TypeWars.java | 4 +- 4 files changed, 34 insertions(+), 13 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java index 6b4b6607b..9d0c8c05a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java @@ -11,6 +11,7 @@ import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.disguise.disguises.DisguiseBase; import mineplex.core.disguise.disguises.DisguiseSlime; +import mineplex.core.disguise.disguises.DisguiseWither; import mineplex.core.disguise.disguises.DisguiseZombie; import mineplex.core.hologram.Hologram; import nautilus.game.arcade.ArcadeManager; @@ -73,9 +74,9 @@ public class Minion "Empoleon", "Building", "Dinosaur", "Illusion", "Mustache", "Ceremony", "Shipment", "Cosmetic", "Applause", "Research", "Chimchar", "Aquarium", "Sidewalk", "Calendar", "Treasure", "Airplane", "Envelope", "Kangaroo", "Goldfish", "Starfish", "Nickname", "Slowness", "Official", "Accident", "Cinnamon", "Collapse", "Geometry", "Barnacle", "Football", "Creative", - "Hypnotic", "Antidode", "Emulator", "Foothold", "Friction", "Tungsten", "Tablets", "Torches", "Fairies", "Windows", + "Hypnotic", "Antidote", "Emulator", "Foothold", "Friction", "Tungsten", "Tablets", "Torches", "Fairies", "Windows", "Conquest", "Province", "Overflow", "Graceful", "Negative", "Doctrine", "Charger", "Carrots", "Spirits", "Robbers", - "Karambit", "Solution", "Sandiwch", "Catapult", "Positive", "Firework", "Ukulele", "Dragons", "Cobwebs", "Drawing", + "Karambit", "Solution", "Sandwich", "Catapult", "Positive", "Firework", "Ukulele", "Dragons", "Cobwebs", "Drawing", "Internal", "Japanese", "Atronomy", "Villager", "Tranquil", "Compress", "Glasses", "Nursing", "College", "Magenta", "Trillion", "Standard", "Atrology", "Infringe", "Fortress", "Prisoner", "Daisies", "Soldier", "Courses", "Serpent", "Carnival", "Parasite", "Porridge", "Variable", "Charcoal", "Decision", "Hazards", "Jupiter", "Buttons", "Camping", @@ -91,7 +92,7 @@ public class Minion "Running", "Talking", "Cooking", "Biology", "Sweater", "Cabinet", "Pokemon", "Kingdom", "Funeral", "Destroy", "Jogging", "Yelling", "Fashion", "Pajamas", "Lettuce", "Furnace", "Chariot", "Package", "Grinder", "Defrost", "Breathe", "Ladybug", "Brother", "Reflect", "Cheddar", "Bridges", "Spawner", "Exhibit", "Nuclear", "Avocado", - "Muscles", "Envader", "Grandpa", "Confirm", "Speaker", "Wizards", "Stacker", "Feather", "Channel", "Thunder", + "Muscles", "Invader", "Grandpa", "Confirm", "Speaker", "Wizards", "Stacker", "Feather", "Channel", "Thunder", "Marbles", "Contest", "Grandma", "History", "Minigun", "Skywars", "Turtwig", "Morning", "Explode", "Factory", "Polygon", "Teacher", "Royalty", "Balcony", "Android", "Monster", "Emerald", "Primate", "Village", "Company", "Degrees", "Glacier", "Cricket", "Partner", "Mideval", "Gravity", "Surgeon", "Volcano", "Forward", "Console", @@ -110,7 +111,7 @@ public class Minion "Hatchet", "Hangers", "Bayonet", "Gamepad", "Bandage", "Blister", "Archive", "Implode", "Hilbert", "Offline", "Shelter", "Primary", "Organic", "Healthy", "Makeup", "Blazes", "Brazil", "Horror", "Subway", "Babies", "Capture", "Various", "Gradual", "Rapture", "Pollen", "String", "Warren", "Moving", "Shorts", "Elders", - "Elegant", "Violate", "Heroic", "Violent", "Leaves", "Soccer", "Europe", "School", "Scarfs", "Orange", + "Elegant", "Violate", "Heroic", "Violent", "Leaves", "Soccer", "Europe", "School", "Scarves", "Orange", "Dentist", "Neglect", "Strong", "Solvent", "Monkey", "Closet", "Africa", "Hotels", "Sharks", "Yellow", "Combine", "Fulfill", "Barbie", "Engrave", "Rabbit", "Carpet", "Winter", "Zipper", "Whales", "Purple", "Surface", "Sailing", "Pencil", "Passage", "Kitten", "Saturn", "Spring", "Acorns", "Comets", "Graffe", @@ -135,7 +136,7 @@ public class Minion "Soap", "Ores", "Cuba", "Snow", "Cops", "Derp", "Eyes", "Oven", "Week", "Clay", "Wigs", "Gold", "Asia", "Rain", "Lime", "Time", "Star", "King", "Year", "Gold", "Fork", "Iron", "Elfs", "Suit", "Blue", "Tony", "Salt", "Ants", "Nate", "Mind", - "Weed", "Pigs", "Brix", "Blue", "Pink", "Hide", "Kris", "File", "Yard", "Comb", + "Weed", "Pigs", "Bricks", "Blue", "Pink", "Hide", "Kris", "File", "Yard", "Comb", "Wood", "Lyra", "Frog", "Hats", "Heal", "Feet", "Yoga", "Edit", "Mile", "Paws", "Bird", "Wool", "Fish", "Eels", "Jump", "Arms", "Boom", "View", "Girl", "Tree", "Lion", "Dirt", "Yarn", "Dawn", "Four", "Neck", "June", "Help", "Mail", "Lamp", @@ -166,6 +167,8 @@ public class Minion private float _walkSpeed; private boolean _spawned; + private int _size; + private int _spawnID; private boolean _die; @@ -196,7 +199,10 @@ public class Minion _killer = null; _money = _type.getMoney(); _spawnID = spawnID; - + _size = 10; + if(_type == MinionType.WITHER) + _size = 0; + changeRandomName(_type.getMinName(), _type.getMaxName(), true); _location = location; @@ -278,7 +284,12 @@ public class Minion if(disguise instanceof DisguiseSlime) { DisguiseSlime slime = (DisguiseSlime) disguise; - slime.SetSize(10); + slime.SetSize(_size); + } + if(disguise instanceof DisguiseWither) + { + DisguiseWither wither = (DisguiseWither) disguise; + wither.s(_size); } _entity.setPassenger(ent); _manager.GetDisguise().disguise((DisguiseBase)disguise); @@ -349,7 +360,15 @@ public class Minion if(_lives > 1) { _lives = _lives - 1; - changeRandomName(_name.length()+3, _name.length()+3, false); + changeRandomName(_name.length()+1, _name.length()+1, false); + if(_type == MinionType.WITHER) + { + _size = _size + 100; + } + else + { + _size = _size -1; + } return; } _killed = killed; @@ -363,6 +382,8 @@ public class Minion ((Zombie) _entity.getPassenger()).damage(10000); } ((Zombie) _entity).damage(10000); + if(!_entity.isDead()) + _entity.remove(); } catch (Exception e) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionSize.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionSize.java index ccabb5af5..0d52ae230 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionSize.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionSize.java @@ -14,7 +14,7 @@ public enum MinionSize MEDIUM("Medium", 4, ItemStackFactory.Instance.CreateStack(Material.MONSTER_EGG, (byte) 0, 1, (short) 61, "", new String[]{}), 1), HARD("Hard", 6, ItemStackFactory.Instance.CreateStack(Material.MONSTER_EGG, (byte) 0, 1, (short) 52, "", new String[]{}), 1), FREAK("Freak", 10000, new ItemStack(Material.MONSTER_EGG), 1), - BOSS("Boss", 10000, new ItemStack(Material.MONSTER_EGG), 5); + BOSS("Boss", 10000, new ItemStack(Material.MONSTER_EGG), 7); private int _cost; private ItemStack _displayItem; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionType.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionType.java index a1831eecc..1f3f9a4ca 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionType.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionType.java @@ -35,8 +35,8 @@ public enum MinionType HORSE(10, MinionSize.HARD, EntityType.HORSE, 6, 9, (float) (0.7 + (0.1*10)), 3, 0D, Material.APPLE, DisguiseHorse.class), ENDERMAN(10, MinionSize.HARD, EntityType.ENDERMAN, 9, 12, (float) (0.7 + (0.1*4)), 3, 1D, Material.ENDER_STONE, DisguiseEnderman.class), - WITHER(1, MinionSize.BOSS, EntityType.WITHER, 3, 3, (float) (0.7 + (0.1*2)), 15, 2D, Material.NETHER_STAR, DisguiseWither.class), - SLIME(1, MinionSize.BOSS, EntityType.SLIME, 3, 3, (float) (0.7 + (0.1*2)), 15, 3D, Material.SLIME_BALL, DisguiseSlime.class), + WITHER(1, MinionSize.BOSS, EntityType.WITHER, 5, 5, (float) (0.7 + (0.1*2)), 15, 2D, Material.NETHER_STAR, DisguiseWither.class), + SLIME(1, MinionSize.BOSS, EntityType.SLIME, 5, 5, (float) (0.7 + (0.1*2)), 15, 3D, Material.SLIME_BALL, DisguiseSlime.class), SPIDER_JOKEY(1, MinionSize.FREAK, EntityType.SPIDER, 10, 13, (float) (0.7 + (0.1*7)), 10, 1D, Material.APPLE, DisguiseSpider.class, DisguiseSkeleton.class), CHICKEN_JOKEY(1, MinionSize.FREAK, EntityType.CHICKEN, 10, 13, (float) (0.7 + (0.1*7)), 10, 1D, Material.APPLE, DisguiseChicken.class, DisguiseZombie.class); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index 601d27fd0..baedceacf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -395,7 +395,7 @@ public class TypeWars extends TeamGame { _minionsSpawned.put(GetTeamList().get(0), 0); minion = new Minion(Manager, _minionSpawns.get(GetTeamList().get(0)).get(rdm), _minionSpawns.get(GetTeamList().get(1)).get(rdm), GetTeamList().get(0), null, true, MinionSize.BOSS.getRandomType(), rdm); - this.Announce(ChatColor.RED + "ALERT:" + ChatColor.WHITE + "A BOSS MONSTER HAS SPAWNED", true); + UtilTextMiddle.display("", "A Boss monster has spawned!"); } else { @@ -423,7 +423,7 @@ public class TypeWars extends TeamGame { _minionsSpawned.put(GetTeamList().get(1), 0); minion = new Minion(Manager, _minionSpawns.get(GetTeamList().get(1)).get(rdm), _minionSpawns.get(GetTeamList().get(0)).get(rdm), GetTeamList().get(1), null, true, MinionSize.BOSS.getRandomType(), rdm); - this.Announce(ChatColor.RED + "ALERT:" + ChatColor.WHITE + "A BOSS MONSTER HAS SPAWNED", true); + UtilTextMiddle.display("", "A Boss monster has spawned!"); } else { From 4958ce347da1ab054b8c1eba9984c72d27ec2b8b Mon Sep 17 00:00:00 2001 From: Sarah Date: Thu, 12 Nov 2015 18:41:40 +0100 Subject: [PATCH 029/113] Fixing boss not despawning bug, scoreboard end bug and some achievements. --- .../arcade/game/games/typewars/Minion.java | 12 ++++- .../game/games/typewars/MinionType.java | 4 +- .../arcade/game/games/typewars/TypeWars.java | 54 ++++++++++++++++--- .../games/typewars/spells/SpellFirebomb.java | 7 ++- .../typewars/stats/DumbledontStatTracker.java | 5 +- .../stats/PerfectionistStatTracker.java | 13 ++++- 6 files changed, 80 insertions(+), 15 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java index 9d0c8c05a..fcb2403e1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java @@ -83,7 +83,7 @@ public class Minion "Concrete", "Carriage", "Pressure", "Practice", "Commerce", "Windmill", "Cheetah", "Mercury", "Octopus", "Canyons", "Pavement", "Auxilary", "Demolish", "Maintain", "Barbeque", "Parmesan", "Vulture", "America", "Printer", "Seventy", "Joystick", "Marshall", "Franklin", "Umbrella", "Contract", "Warthog", "Turtles", "Ireland", "Titanic", "Hundred", - "Sppeaker", "Suitcase", "Michigan", "Darkness", "Separate", "Puzzled", "Ocelots", "Germany", "Vanilla", "Million", + "Speaker", "Suitcase", "Michigan", "Darkness", "Separate", "Puzzled", "Ocelots", "Germany", "Vanilla", "Million", "Figurine", "Mandarin", "Arkansas", "Ethernet", "Eligible", "Shocked", "Creeper", "Chillie", "Tornado", "Billion", "Boundary", "Anteater", "Colorado", "Everyday", "Fraction", "Figures", "Zombies", "Jamaica", "Seaweed", "Twitter", "Birthday", "Sunshine", "Virginia", "Surprise", "Compound", "Pillows", "Leather", "Bermuda", "Craters", "Waiting", @@ -166,6 +166,7 @@ public class Minion private int _money; private float _walkSpeed; private boolean _spawned; + private double _tagHight; private int _size; @@ -190,6 +191,7 @@ public class Minion _type = randomType(); _walkSpeed = _type.getWalkSpeed(); + _tagHight = _type.getTagHight(); _die = false; _killed = false; _frame = 0; @@ -357,6 +359,7 @@ public class Minion public void despawn(Player player, boolean killed) { + _money = _money + 1; if(_lives > 1) { _lives = _lives - 1; @@ -364,10 +367,12 @@ public class Minion if(_type == MinionType.WITHER) { _size = _size + 100; + _tagHight = _tagHight - 0.15; } else { _size = _size -1; + _tagHight = _tagHight - 0.1; } return; } @@ -576,6 +581,11 @@ public class Minion { return _spawnID; } + + public double getTagHight() + { + return _tagHight; + } public void setTarget(Location location) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionType.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionType.java index 1f3f9a4ca..a80d1fc5f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionType.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionType.java @@ -35,8 +35,8 @@ public enum MinionType HORSE(10, MinionSize.HARD, EntityType.HORSE, 6, 9, (float) (0.7 + (0.1*10)), 3, 0D, Material.APPLE, DisguiseHorse.class), ENDERMAN(10, MinionSize.HARD, EntityType.ENDERMAN, 9, 12, (float) (0.7 + (0.1*4)), 3, 1D, Material.ENDER_STONE, DisguiseEnderman.class), - WITHER(1, MinionSize.BOSS, EntityType.WITHER, 5, 5, (float) (0.7 + (0.1*2)), 15, 2D, Material.NETHER_STAR, DisguiseWither.class), - SLIME(1, MinionSize.BOSS, EntityType.SLIME, 5, 5, (float) (0.7 + (0.1*2)), 15, 3D, Material.SLIME_BALL, DisguiseSlime.class), + WITHER(1, MinionSize.BOSS, EntityType.WITHER, 5, 5, (float) (0.7 + (0.1*2)), 1, 2D, Material.NETHER_STAR, DisguiseWither.class), + SLIME(1, MinionSize.BOSS, EntityType.SLIME, 5, 5, (float) (0.7 + (0.1*2)), 1, 3D, Material.SLIME_BALL, DisguiseSlime.class), SPIDER_JOKEY(1, MinionSize.FREAK, EntityType.SPIDER, 10, 13, (float) (0.7 + (0.1*7)), 10, 1D, Material.APPLE, DisguiseSpider.class, DisguiseSkeleton.class), CHICKEN_JOKEY(1, MinionSize.FREAK, EntityType.CHICKEN, 10, 13, (float) (0.7 + (0.1*7)), 10, 1D, Material.APPLE, DisguiseChicken.class, DisguiseZombie.class); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index baedceacf..e7895cfd6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -100,8 +100,8 @@ public class TypeWars extends TeamGame }, new String[] { - "Type as fast as you can", - "to kill the evil minions." + "Protect your Giant!", + "Type Minions' names to kill them." }); this.DeathOut = false; @@ -177,10 +177,14 @@ public class TypeWars extends TeamGame _moneyMap.put(player, 0); } + if(event.GetState() == GameState.Prepare) + { + UtilTextMiddle.display("", "Protect your Giant! Type Minions' names to kill them.", 20, 100, 20, UtilServer.getPlayers()); + } + if(event.GetState() != GameState.Live) return; - UtilTextMiddle.display("", "Protect your Giant from minions! Type their names to kill them.", 20, 100, 20, UtilServer.getPlayers()); initSpawns(); prepareGiants(); @@ -324,7 +328,7 @@ public class TypeWars extends TeamGame for(MinionSize type : MinionSize.values()) { - if(type.getDisplayItem().getDurability() == event.getItem().getDurability()) + if(type.getDisplayItem().getType() == event.getItem().getType() && type.getDisplayItem().getDurability() == event.getItem().getDurability()) { if(type.getCost() > _moneyMap.get(event.getPlayer())) { @@ -473,7 +477,23 @@ public class TypeWars extends TeamGame } } Hologram hologram = minion.getHologram(); - hologram.setLocation(minion.getEntity().getLocation().add(0, minion.getType().getTagHight() + 2.3, 0)); + hologram.setLocation(minion.getEntity().getLocation().add(0, minion.getTagHight() + 2.3, 0)); + } + } + + @EventHandler + public void checkDeadMinions(UpdateEvent event) + { + if(GetState() != GameState.Live && GetState() != GameState.End) + return; + + if(event.getType() != UpdateType.FASTER) + return; + + for(Minion minion : _deadMinions) + { + if(!minion.getEntity().isDead()) + minion.despawn(null, false); } } @@ -734,6 +754,21 @@ public class TypeWars extends TeamGame minionIterator.remove(); } + + Scoreboard.Reset(); + + Scoreboard.WriteBlank(); + + for(GameTeam team : GetTeamList()) + { + Scoreboard.Write(team.GetColor() + C.Bold + team.GetName() + " Team"); + Scoreboard.Write(team.GetColor() + "Health: " + Math.round(getScore(team))); + Scoreboard.Write(team.GetColor() + "Minions: " + getMinions(team).size() + "/60"); + Scoreboard.WriteBlank(); + } + + Scoreboard.Draw(); + //End Manager.GetCreature().SetDisableCustomDrops(false); SetState(GameState.End); @@ -922,7 +957,7 @@ public class TypeWars extends TeamGame for(GameTeam team : GetTeamList()) { Scoreboard.Write(team.GetColor() + C.Bold + team.GetName() + " Team"); - Scoreboard.Write(team.GetColor() + "Health: " + getScore(team)); + Scoreboard.Write(team.GetColor() + "Health: " + Math.round(getScore(team))); Scoreboard.Write(team.GetColor() + "Minions: " + getMinions(team).size() + "/60"); Scoreboard.WriteBlank(); } @@ -1003,8 +1038,11 @@ public class TypeWars extends TeamGame continue; minion.despawn(player, true); - minionIterator.remove(); - _deadMinions.add(minion); + if(!minion.hasLives()) + { + minionIterator.remove(); + _deadMinions.add(minion); + } } i++; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellFirebomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellFirebomb.java index b69d1dabb..2da5791b2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellFirebomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellFirebomb.java @@ -46,8 +46,11 @@ public class SpellFirebomb extends Spell } minion.despawn(player, true); - minionIterator.remove(); - getTypeWars().getDeadMinions().add(minion); + if(!minion.hasLives()) + { + minionIterator.remove(); + getTypeWars().getDeadMinions().add(minion); + } } return true; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/DumbledontStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/DumbledontStatTracker.java index ea84f1eb0..2549690a6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/DumbledontStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/DumbledontStatTracker.java @@ -41,7 +41,10 @@ public class DumbledontStatTracker extends StatTracker for(Player player : _players) { if(player.isOnline()) - addStat(player, "Dumbledont", 1, true, false); + { + if(event.GetGame().GetTeam(player) == event.GetGame().WinnerTeam) + addStat(player, "Dumbledont", 1, true, false); + } } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/PerfectionistStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/PerfectionistStatTracker.java index fae291179..8ffeb57a1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/PerfectionistStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/PerfectionistStatTracker.java @@ -17,12 +17,14 @@ public class PerfectionistStatTracker extends StatTracker private HashMap _wordsRecently; private ArrayList _players; + private HashMap _playerWords; public PerfectionistStatTracker(TypeWars game) { super(game); _wordsRecently = new HashMap<>(); _players = new ArrayList<>(); + _playerWords = new HashMap<>(); } @EventHandler @@ -31,6 +33,12 @@ public class PerfectionistStatTracker extends StatTracker if(event.isSuccessful()) { _wordsRecently.put(event.getAttempt().toUpperCase(), System.currentTimeMillis()); + + if(!_playerWords.containsKey(event.getPlayer())) + _playerWords.put(event.getPlayer(), 1); + + int words = _playerWords.get(event.getPlayer()); + _playerWords.put(event.getPlayer(), words + 1); } else { @@ -60,7 +68,10 @@ public class PerfectionistStatTracker extends StatTracker for(Player player : _players) { if(player.isOnline()) - addStat(player, "Perfectionist", 1, true, false); + { + if(_playerWords.get(player) >= 5) + addStat(player, "Perfectionist", 1, true, false); + } } } } From 399edbab2940762ad38a8fc38dd97aa604051609 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Sun, 15 Nov 2015 12:47:45 -0500 Subject: [PATCH 030/113] Sniper work --- .../game/games/paintball/Paintball.java | 81 ++++----- .../game/games/paintball/kits/KitSniper.java | 18 +- .../kits/perks/PerkPaintballSniper.java | 158 ++++++++++++++---- 3 files changed, 175 insertions(+), 82 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java index 468316016..2384386ef 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java @@ -4,6 +4,40 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Color; +import org.bukkit.Effect; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.EnderPearl; +import org.bukkit.entity.HumanEntity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Snowball; +import org.bukkit.entity.ThrownPotion; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.HandlerList; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.EntityRegainHealthEvent; +import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; +import org.bukkit.event.entity.ProjectileHitEvent; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.player.PlayerEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.PlayerTeleportEvent; +import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.LeatherArmorMeta; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.util.Vector; + import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilBlock; @@ -36,39 +70,6 @@ import nautilus.game.arcade.stats.MedicStatTracker; import nautilus.game.arcade.stats.WinFastStatTracker; import nautilus.game.arcade.stats.WinWithoutLosingTeammateStatTracker; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Color; -import org.bukkit.Effect; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; -import org.bukkit.entity.EnderPearl; -import org.bukkit.entity.HumanEntity; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.entity.Snowball; -import org.bukkit.entity.ThrownPotion; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.HandlerList; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.entity.EntityRegainHealthEvent; -import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; -import org.bukkit.event.entity.ProjectileHitEvent; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.event.player.PlayerEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.event.player.PlayerTeleportEvent; -import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.LeatherArmorMeta; -import org.bukkit.potion.PotionEffectType; -import org.bukkit.util.Vector; - public class Paintball extends TeamGame { public static class ReviveEvent extends PlayerEvent @@ -181,10 +182,13 @@ public class Paintball extends TeamGame return; byte color = 3; - if (event.getEntity() instanceof EnderPearl) + if (event.getEntity() instanceof EnderPearl || (event.getEntity() instanceof Arrow && event.getEntity().hasMetadata("color") && ChatColor.values()[event.getEntity().getMetadata("color").get(0).asInt()] == ChatColor.RED)) color = 14; + + Location loc = event.getEntity().getLocation(); - Location loc = event.getEntity().getLocation().add(event.getEntity().getVelocity()); + if (!(event.getEntity() instanceof Arrow)) + loc.add(event.getEntity().getVelocity()); for (Block block : UtilBlock.getInRadius(loc, 1.5d).keySet()) { @@ -197,6 +201,7 @@ public class Paintball extends TeamGame if (color == 3) loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 8); else loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 10); + event.getEntity().remove(); } } @@ -234,7 +239,7 @@ public class Paintball extends TeamGame if (event.GetProjectile() == null) return; - if (!(event.GetProjectile() instanceof Snowball) && !(event.GetProjectile() instanceof EnderPearl)) + if (!(event.GetProjectile() instanceof Snowball) && !(event.GetProjectile() instanceof EnderPearl) && !(event.GetProjectile() instanceof Arrow)) return; //Negate @@ -271,9 +276,9 @@ public class Paintball extends TeamGame { count = 3; } - if (GetKit(damager) instanceof KitSniper) + if (GetKit(damager) instanceof KitSniper && event.GetProjectile() instanceof Arrow) { - count = ((KitSniper) GetKit(damager)).getPaintDamage(event.GetProjectile()); + count = ((KitSniper) GetKit(damager)).getPaintDamage((Arrow) event.GetProjectile()); if (count == -1) count = 1; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitSniper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitSniper.java index 4604ddd0e..e7d41949a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitSniper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitSniper.java @@ -1,5 +1,13 @@ package nautilus.game.arcade.game.games.paintball.kits; +import org.bukkit.Color; +import org.bukkit.Material; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.PotionMeta; + import mineplex.core.achievement.Achievement; import mineplex.core.common.util.C; import mineplex.core.common.util.F; @@ -12,14 +20,6 @@ import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -import org.bukkit.Color; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.entity.Projectile; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.PotionMeta; - public class KitSniper extends Kit { public KitSniper(ArcadeManager manager) @@ -67,7 +67,7 @@ public class KitSniper extends Kit player.getInventory().setBoots(new ItemBuilder(Material.LEATHER_BOOTS).setUnbreakable(true).setColor(Color.WHITE).build()); } - public int getPaintDamage(Projectile proj) + public int getPaintDamage(Arrow proj) { for (Perk perk : GetPerks()) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballSniper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballSniper.java index 71b9bf2b9..61ce1e918 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballSniper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballSniper.java @@ -1,15 +1,33 @@ package nautilus.game.arcade.game.games.paintball.kits.perks; +import java.util.ArrayList; import java.util.HashMap; -import java.util.HashSet; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.ProjectileHitEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.metadata.FixedMetadataValue; import mineplex.core.common.util.C; import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilMath; +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.recharge.Recharge; import mineplex.core.recharge.RechargedEvent; import mineplex.core.updater.UpdateType; @@ -18,26 +36,22 @@ import mineplex.minecraft.game.core.condition.Condition.ConditionType; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.kit.Perk; - -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.EnderPearl; -import org.bukkit.entity.Player; -import org.bukkit.entity.Projectile; -import org.bukkit.entity.Snowball; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.util.Vector; +import net.md_5.bungee.api.ChatColor; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy; public class PerkPaintballSniper extends Perk { - private HashMap _crouching = new HashMap(); - private HashMap _fired = new HashMap(); - private NautHashMap _damage = new NautHashMap(); + private static class Bullet + { + public int Damage; + public Location LastSeen; + } - private double _velocity = 8; + private HashMap _crouching = new HashMap(); +// private HashMap _fired = new HashMap(); + private NautHashMap _fired = new NautHashMap(); + + private double _velocity = 15; public PerkPaintballSniper() { @@ -90,10 +104,21 @@ public class PerkPaintballSniper extends Perk if (!Recharge.Instance.use(player, GetName(), 1000, true, true)) return; - Projectile proj = player.launchProjectile(Manager.GetGame().GetTeam(player).GetColor() == ChatColor.AQUA ? Snowball.class : EnderPearl.class, player.getEyeLocation().getDirection().clone().multiply(_velocity)); + Arrow proj = player.launchProjectile(Arrow.class, player.getEyeLocation().getDirection().clone().multiply(_velocity)); - _fired.put(proj, proj.getVelocity()); - _damage.put(proj, getPaintDamage(player)); + PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(); + packet.a = new int[]{proj.getEntityId()}; + + for (Player viewer : UtilServer.getPlayers()) + UtilPlayer.sendPacket(viewer, packet); + + proj.setMetadata("color", new FixedMetadataValue(Manager.getPlugin(), Manager.GetGame().GetTeam(player).GetColor().ordinal())); + + Bullet bullet = new Bullet(); + bullet.Damage = getPaintDamage(player); + bullet.LastSeen = proj.getLocation(); + + _fired.put(proj, bullet); //Sound player.getWorld().playSound(player.getLocation(), Sound.CHICKEN_EGG_POP, 0.8f, 1f); @@ -131,6 +156,9 @@ public class PerkPaintballSniper extends Perk if (!player.isSneaking()) remove = true; + if (!UtilInv.IsItem(player.getItemInHand(), Material.STONE_HOE, (byte) -1)) + remove = true; + if (!Recharge.Instance.usable(player, GetName())) remove = true; @@ -159,6 +187,9 @@ public class PerkPaintballSniper extends Perk if (!player.isSneaking()) continue; + if (!UtilInv.IsItem(player.getItemInHand(), Material.STONE_HOE, (byte) -1)) + continue; + if (_crouching.containsKey(player)) continue; @@ -186,7 +217,7 @@ public class PerkPaintballSniper extends Perk } @EventHandler - public void updateProjectiles(UpdateEvent event) + public void doArrowEffects(UpdateEvent event) { if (event.getType() != UpdateType.TICK) return; @@ -194,20 +225,80 @@ public class PerkPaintballSniper extends Perk if (!Manager.GetGame().IsLive()) return; - HashSet copySet = new HashSet(_fired.keySet()); - for (Projectile proj : copySet) + for (Arrow proj : new ArrayList(_fired.keySet())) { if (!proj.isValid()) { _fired.remove(proj); - - if (_damage.containsKey(proj)) - _damage.remove(proj); - continue; } - proj.setVelocity(_fired.get(proj).clone().normalize().multiply(_velocity)); + Bullet bullet = _fired.get(proj); + + double curRange = 0; + double distance = Math.abs(UtilMath.offset(proj.getLocation(), bullet.LastSeen)); + + while (curRange <= distance) + { + Location newTarget = bullet.LastSeen.add(UtilAlg.getTrajectory(bullet.LastSeen, proj.getLocation()).multiply(curRange)); + + //Progress Forwards + curRange += 0.8; + + ChatColor color = ChatColor.values()[proj.getMetadata("color").get(0).asInt()]; + if (color == ChatColor.BLUE || color == ChatColor.AQUA) + { + UtilParticle.PlayParticle(ParticleType.RED_DUST, newTarget, -1, 1, 1, 1, 0, + ViewDist.NORMAL, UtilServer.getPlayers()); + } + else + { + UtilParticle.PlayParticle(ParticleType.RED_DUST, newTarget, 0, 0, 0, 0, 1, + ViewDist.NORMAL, UtilServer.getPlayers()); + } + } + + bullet.LastSeen = proj.getLocation(); + } + } + + @EventHandler(priority = EventPriority.HIGH) + public void doArrowEffects(ProjectileHitEvent event) + { + if (!Manager.GetGame().IsLive()) + return; + + if (!(event.getEntity() instanceof Arrow)) + return; + + Arrow proj = (Arrow) event.getEntity(); + + if (!_fired.containsKey(proj)) + return; + + Bullet bullet = _fired.get(proj); + + double curRange = 0; + double distance = Math.abs(UtilMath.offset(proj.getLocation(), bullet.LastSeen)); + + while (curRange <= distance) + { + Location newTarget = bullet.LastSeen.add(UtilAlg.getTrajectory(bullet.LastSeen, proj.getLocation()).multiply(curRange)); + + //Progress Forwards + curRange += 0.8; + + ChatColor color = ChatColor.values()[proj.getMetadata("color").get(0).asInt()]; + if (color == ChatColor.BLUE || color == ChatColor.AQUA) + { + UtilParticle.PlayParticle(ParticleType.RED_DUST, newTarget, -1, 1, 1, 1, 0, + ViewDist.NORMAL, UtilServer.getPlayers()); + } + else + { + UtilParticle.PlayParticle(ParticleType.RED_DUST, newTarget, 0, 0, 0, 0, 1, + ViewDist.NORMAL, UtilServer.getPlayers()); + } } } @@ -240,17 +331,14 @@ public class PerkPaintballSniper extends Perk // Zoom if (!Manager.GetCondition().HasCondition(player, ConditionType.SLOW, GetName())) Manager.GetCondition().Factory().Slow(GetName(), player, null, Double.MAX_VALUE, 8, false, false, false, false); - -// if (!Manager.GetCondition().HasCondition(player, ConditionType.JUMP, GetName())) -// Manager.GetCondition().Factory().Jump(GetName(), player, null, 9999999, 250, true, false, false); } - public int getPaintDamage(Projectile proj) + public int getPaintDamage(Arrow proj) { - if (!_damage.containsKey(proj)) + if (!_fired.containsKey(proj)) return 1; - return _damage.remove(proj); + return _fired.get(proj).Damage; } private int getPaintDamage(Player player) @@ -258,6 +346,6 @@ public class PerkPaintballSniper extends Perk if (!_crouching.containsKey(player)) return 1; - return (int) Math.max(1, Math.floor((System.currentTimeMillis() - _crouching.get(player)) / 1000)); + return (int) Math.max(1, Math.min(4, Math.floor((System.currentTimeMillis() - _crouching.get(player)) / 1000))); } } \ No newline at end of file From 448dd33c1a370a1972984d3676aab856499e6dca Mon Sep 17 00:00:00 2001 From: Mysticate Date: Tue, 17 Nov 2015 11:38:02 -0500 Subject: [PATCH 031/113] Switching branches c: --- .../core/achievement/AchievementCategory.java | 4 +- .../game/games/baconbrawl/BaconBrawl.java | 11 ++- .../games/baconbrawl/kits/KitMamaPig.java | 1 - .../game/games/baconbrawl/kits/KitPig.java | 1 - .../games/baconbrawl/kits/KitSheepPig.java | 1 - .../arcade/game/games/bridge/BridgePart.java | 1 + .../game/games/paintball/Paintball.java | 53 +++++++--- .../kits/perks/PerkPaintballSniper.java | 97 +++++++++---------- .../game/arcade/kit/perks/PerkBaconBlast.java | 6 +- .../game/arcade/kit/perks/PerkBodySlam.java | 1 - .../game/arcade/kit/perks/PerkPigCloak.java | 7 +- 11 files changed, 101 insertions(+), 82 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java index 8eb4305a2..b7a4af7f5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java @@ -109,7 +109,7 @@ public enum AchievementCategory SUPER_PAINTBALL("Super Paintball", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, - Material.ENDER_PEARL, 0, GameCategory.ARCADE, null), + Material.ENDER_PEARL, 0, GameCategory.ARCADE, "Sniper Kit"), TURF_WARS("Turf Wars", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, @@ -137,7 +137,7 @@ public enum AchievementCategory MICRO_BATTLE("Micro Battle", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, - Material.LAVA, 0, GameCategory.ARCADE, null), + Material.LAVA_BUCKET, 0, GameCategory.ARCADE, null), BOMB_LOBBERS("Bomb Lobbers", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/BaconBrawl.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/BaconBrawl.java index e66165d86..0ee17ce94 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/BaconBrawl.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/BaconBrawl.java @@ -5,14 +5,15 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import mineplex.core.common.util.UtilPlayer; -import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.game.SoloGame; -import nautilus.game.arcade.game.games.baconbrawl.kits.*; +import nautilus.game.arcade.game.games.baconbrawl.kits.KitMamaPig; +import nautilus.game.arcade.game.games.baconbrawl.kits.KitPig; +import nautilus.game.arcade.game.games.baconbrawl.kits.KitSheepPig; import nautilus.game.arcade.kit.Kit; public class BaconBrawl extends SoloGame @@ -34,9 +35,9 @@ public class BaconBrawl extends SoloGame "Last pig in the arena wins!" }); - this.DamageTeamSelf = true; - this.HungerSet = 20; - this.PrepareFreeze = false; + DamageTeamSelf = true; + HungerSet = 20; + PrepareFreeze = false; } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitMamaPig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitMamaPig.java index 7ab4b7812..c285f9c53 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitMamaPig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitMamaPig.java @@ -11,7 +11,6 @@ import org.bukkit.event.EventPriority; import org.bukkit.inventory.ItemStack; import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilPlayer; import mineplex.core.disguise.disguises.DisguisePig; import mineplex.core.itemstack.ItemStackFactory; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitPig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitPig.java index db9071a12..1f54d2eec 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitPig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitPig.java @@ -13,7 +13,6 @@ import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkBodySlam; -import nautilus.game.arcade.kit.perks.PerkJump; public class KitPig extends Kit { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitSheepPig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitSheepPig.java index 3a63d31ff..5607d41ba 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitSheepPig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitSheepPig.java @@ -1,6 +1,5 @@ package nautilus.game.arcade.game.games.baconbrawl.kits; -import org.bukkit.ChatColor; import org.bukkit.DyeColor; import org.bukkit.Location; import org.bukkit.Material; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/BridgePart.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/BridgePart.java index 86765e9a1..3d810c506 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/BridgePart.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/BridgePart.java @@ -26,6 +26,7 @@ public class BridgePart Velocity = velocity; } + @SuppressWarnings("deprecation") public boolean Update() { if (!Entity.isValid()) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java index 2384386ef..22b6a06d5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java @@ -172,7 +172,7 @@ public class Paintball extends TeamGame @SuppressWarnings("deprecation") @EventHandler - public void Paint(ProjectileHitEvent event) + public void Paint(final ProjectileHitEvent event) { // Fixed projectile wool painting in waiting lobby. @@ -181,27 +181,48 @@ public class Paintball extends TeamGame if (event.getEntity() instanceof ThrownPotion) return; - byte color = 3; - if (event.getEntity() instanceof EnderPearl || (event.getEntity() instanceof Arrow && event.getEntity().hasMetadata("color") && ChatColor.values()[event.getEntity().getMetadata("color").get(0).asInt()] == ChatColor.RED)) - color = 14; + final byte color = (byte) (event.getEntity() instanceof EnderPearl || (event.getEntity() instanceof Arrow && event.getEntity().hasMetadata("color") && ChatColor.values()[event.getEntity().getMetadata("color").get(0).asInt()] == ChatColor.RED) ? 14 : 3); - Location loc = event.getEntity().getLocation(); + if (event.getEntity() instanceof Arrow) + { + Manager.runSyncLater(new Runnable() + { + @Override + public void run() + { + Location loc = event.getEntity().getLocation(); + + for (Block block : UtilBlock.getInRadius(loc, 1.5d).keySet()) + { + if (block.getType() != Material.WOOL && block.getType() != Material.STAINED_CLAY) + continue; - if (!(event.getEntity() instanceof Arrow)) + block.setData(color); + } + + if (color == 3) loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 8); + else loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 10); + } + }, 1); + } + else + { + Location loc = event.getEntity().getLocation(); loc.add(event.getEntity().getVelocity()); - for (Block block : UtilBlock.getInRadius(loc, 1.5d).keySet()) - { - if (block.getType() != Material.WOOL && block.getType() != Material.STAINED_CLAY) - continue; + for (Block block : UtilBlock.getInRadius(loc, 1.5d).keySet()) + { + if (block.getType() != Material.WOOL && block.getType() != Material.STAINED_CLAY) + continue; - block.setData(color); + block.setData(color); + } + + if (color == 3) loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 8); + else loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 10); + + event.getEntity().remove(); } - - if (color == 3) loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 8); - else loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 10); - - event.getEntity().remove(); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballSniper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballSniper.java index 61ce1e918..c8bad2b0a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballSniper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballSniper.java @@ -10,7 +10,6 @@ import org.bukkit.entity.Arrow; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; -import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.metadata.FixedMetadataValue; @@ -111,7 +110,7 @@ public class PerkPaintballSniper extends Perk for (Player viewer : UtilServer.getPlayers()) UtilPlayer.sendPacket(viewer, packet); - + proj.setMetadata("color", new FixedMetadataValue(Manager.getPlugin(), Manager.GetGame().GetTeam(player).GetColor().ordinal())); Bullet bullet = new Bullet(); @@ -226,13 +225,7 @@ public class PerkPaintballSniper extends Perk return; for (Arrow proj : new ArrayList(_fired.keySet())) - { - if (!proj.isValid()) - { - _fired.remove(proj); - continue; - } - + { Bullet bullet = _fired.get(proj); double curRange = 0; @@ -258,49 +251,55 @@ public class PerkPaintballSniper extends Perk } } + if (!proj.isValid()) + { + _fired.remove(proj); + continue; + } + bullet.LastSeen = proj.getLocation(); } } - - @EventHandler(priority = EventPriority.HIGH) - public void doArrowEffects(ProjectileHitEvent event) - { - if (!Manager.GetGame().IsLive()) - return; - - if (!(event.getEntity() instanceof Arrow)) - return; - - Arrow proj = (Arrow) event.getEntity(); - - if (!_fired.containsKey(proj)) - return; - - Bullet bullet = _fired.get(proj); - - double curRange = 0; - double distance = Math.abs(UtilMath.offset(proj.getLocation(), bullet.LastSeen)); - - while (curRange <= distance) - { - Location newTarget = bullet.LastSeen.add(UtilAlg.getTrajectory(bullet.LastSeen, proj.getLocation()).multiply(curRange)); - - //Progress Forwards - curRange += 0.8; - - ChatColor color = ChatColor.values()[proj.getMetadata("color").get(0).asInt()]; - if (color == ChatColor.BLUE || color == ChatColor.AQUA) - { - UtilParticle.PlayParticle(ParticleType.RED_DUST, newTarget, -1, 1, 1, 1, 0, - ViewDist.NORMAL, UtilServer.getPlayers()); - } - else - { - UtilParticle.PlayParticle(ParticleType.RED_DUST, newTarget, 0, 0, 0, 0, 1, - ViewDist.NORMAL, UtilServer.getPlayers()); - } - } - } +// +// @EventHandler(priority = EventPriority.HIGH) +// public void doArrowEffects(ProjectileHitEvent event) +// { +// if (!Manager.GetGame().IsLive()) +// return; +// +// if (!(event.getEntity() instanceof Arrow)) +// return; +// +// Arrow proj = (Arrow) event.getEntity(); +// +// if (!_fired.containsKey(proj)) +// return; +// +// Bullet bullet = _fired.get(proj); +// +// double curRange = 0; +// double distance = Math.abs(UtilMath.offset(proj.getLocation(), bullet.LastSeen)); +// +// while (curRange <= distance) +// { +// Location newTarget = bullet.LastSeen.add(UtilAlg.getTrajectory(bullet.LastSeen, proj.getLocation()).multiply(curRange)); +// +// //Progress Forwards +// curRange += 0.8; +// +// ChatColor color = ChatColor.values()[proj.getMetadata("color").get(0).asInt()]; +// if (color == ChatColor.BLUE || color == ChatColor.AQUA) +// { +// UtilParticle.PlayParticle(ParticleType.RED_DUST, newTarget, -1, 1, 1, 1, 0, +// ViewDist.NORMAL, UtilServer.getPlayers()); +// } +// else +// { +// UtilParticle.PlayParticle(ParticleType.RED_DUST, newTarget, 0, 0, 0, 0, 1, +// ViewDist.NORMAL, UtilServer.getPlayers()); +// } +// } +// } @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void removeEffects(GameStateChangeEvent event) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBaconBlast.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBaconBlast.java index d69147917..b3869a7cf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBaconBlast.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBaconBlast.java @@ -15,6 +15,7 @@ import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilPlayer; import mineplex.core.itemstack.ItemStackFactory; @@ -47,10 +48,7 @@ public class PerkBaconBlast extends Perk implements IThrown if (UtilBlock.usable(event.getClickedBlock())) return; - if (event.getPlayer().getItemInHand() == null) - return; - - if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE")) + if (!UtilGear.isAxe(event.getItem())) return; Player player = event.getPlayer(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBodySlam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBodySlam.java index f4e0aaf0f..b438a7440 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBodySlam.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBodySlam.java @@ -2,7 +2,6 @@ package nautilus.game.arcade.kit.perks; import java.util.HashMap; -import org.bukkit.GameMode; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigCloak.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigCloak.java index 4b01f97e5..163695218 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigCloak.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkPigCloak.java @@ -11,7 +11,10 @@ import org.bukkit.event.player.PlayerInteractEvent; import mineplex.core.common.util.C; import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.recharge.Recharge; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.kit.Perk; @@ -31,10 +34,10 @@ public class PerkPigCloak extends Perk { Player player = event.getPlayer(); - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + if (!UtilEvent.isAction(event, ActionType.R)) return; - if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE")) + if (!UtilGear.isAxe(event.getItem())) return; if (!Kit.HasKit(player)) From 1342a8ac9f44da62574ec667867bc77081f0e9fb Mon Sep 17 00:00:00 2001 From: Mysticate Date: Tue, 17 Nov 2015 11:38:15 -0500 Subject: [PATCH 032/113] Class --- .../game/arcade/game/games/bridge/BattleCryManager.java | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/BattleCryManager.java diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/BattleCryManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/BattleCryManager.java new file mode 100644 index 000000000..7c7e71ba0 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/BattleCryManager.java @@ -0,0 +1,6 @@ +package nautilus.game.arcade.game.games.bridge; + +public class BattleCryManager +{ + +} From 64970ab8d6e1ce1b3c866b7f7bf88ae0c5833eac Mon Sep 17 00:00:00 2001 From: Sarah Date: Wed, 18 Nov 2015 17:53:35 +0100 Subject: [PATCH 033/113] adding little tutorial at the start of the game. --- .../arcade/game/games/typewars/Minion.java | 27 +- .../arcade/game/games/typewars/TypeWars.java | 232 ++++++++++++++++-- .../typewars/spells/SpellKillEverything.java | 2 +- 3 files changed, 231 insertions(+), 30 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java index fcb2403e1..4b1203f85 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java @@ -16,6 +16,7 @@ import mineplex.core.disguise.disguises.DisguiseZombie; import mineplex.core.hologram.Hologram; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.Game.GameState; import org.bukkit.ChatColor; import org.bukkit.Color; @@ -167,6 +168,7 @@ public class Minion private float _walkSpeed; private boolean _spawned; private double _tagHight; + private boolean _moving; private int _size; @@ -187,6 +189,7 @@ public class Minion _manager = manager; _type = type; + _moving = true; if(_type == null) _type = randomType(); @@ -234,17 +237,24 @@ public class Minion { if (_hologram != null) { - _hologram.setText( _team.GetColor() + _name); + _hologram.setText(_team.GetColor() + _name); } else { - _hologram = new Hologram(_manager.getHologramManager(), _entity.getLocation().add(0, 2.3, 0), _team.GetColor() + _name); + if(_manager.GetGame().GetState() == GameState.Live) + { + _hologram = new Hologram(_manager.getHologramManager(), _entity.getLocation().add(0, 2.3, 0), _team.GetColor() + _name); + } + else + { + _hologram = new Hologram(_manager.getHologramManager(), _entity.getLocation().add(0, 2.3, 0), ChatColor.WHITE + _name); + } _hologram.setHologramTarget(Hologram.HologramTarget.WHITELIST); //_hologram.setFollowEntity(_entity); for (Player player : _manager.GetGame().GetPlayers(false)) { - if (_manager.GetGame().GetTeam(player) == _team) + if (_manager.GetGame().GetTeam(player) == _team && _manager.GetGame().GetState() != GameState.Prepare) { continue; } @@ -295,6 +305,7 @@ public class Minion } _entity.setPassenger(ent); _manager.GetDisguise().disguise((DisguiseBase)disguise); + _manager.GetDisguise().updateDisguise((DisguiseBase)disguise); i++; } } @@ -592,4 +603,14 @@ public class Minion _target = location; } + public void setMoving(boolean moving) + { + _moving = moving; + } + + public boolean isMoving() + { + return _moving; + } + } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index e7895cfd6..dcb679170 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.typewars; import java.util.ArrayList; import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; import mineplex.core.common.Rank; @@ -20,10 +21,12 @@ import mineplex.core.common.util.UtilShapes; import mineplex.core.common.util.UtilTextBottom; import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilWorld; import mineplex.core.hologram.Hologram; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.visibility.VisibilityManager; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; @@ -80,17 +83,18 @@ public class TypeWars extends TeamGame private HashMap> _lineGrowth; private HashMap> _lineShorten; - private HashMap> _minionSpawns; private HashMap> _giantAttackZones; - private HashMap _giants; - private HashMap _minionsSpawned; - private HashMap _giantsAttacked; + private HashSet _playerTitles; + private HashMap _playerSpawns; + + private int _tutorialFrame; + public TypeWars(ArcadeManager manager) { super(manager, GameType.TypeWars, @@ -121,6 +125,8 @@ public class TypeWars extends TeamGame this.TeamArmorHotbar = true; this.Damage = false; this.CreatureAllow = false; + this.PrepareTime = 30000; + this.PrepareFreeze = false; _activeMinions = new ArrayList<>(); _deadMinions = new ArrayList<>(); @@ -136,9 +142,12 @@ public class TypeWars extends TeamGame _giants = new HashMap<>(); _minionsSpawned = new HashMap<>(); _giantsAttacked = new HashMap<>(); + _playerTitles = new HashSet<>(); + _playerSpawns = new HashMap<>(); _animationTicks = 0; _nukeFrame = 0; + _tutorialFrame = 0; registerStatTrackers( new DemonStatsTracker(this), @@ -175,20 +184,17 @@ public class TypeWars extends TeamGame { UtilAction.velocity(player, 0.1, 0.1, 0.1, false); _moneyMap.put(player, 0); + _playerTitles.add(player); } if(event.GetState() == GameState.Prepare) { - UtilTextMiddle.display("", "Protect your Giant! Type Minions' names to kill them.", 20, 100, 20, UtilServer.getPlayers()); + initSpawns(); + prepareGiants(); } - if(event.GetState() != GameState.Live) return; - - initSpawns(); - prepareGiants(); - for(GameTeam team : GetTeamList()) { _lineGrowth.put(team, new ArrayList()); @@ -285,6 +291,160 @@ public class TypeWars extends TeamGame } } + private Location _tutorialLocation; + + @EventHandler + public void tutorialFrames(UpdateEvent event) + { + if(event.getType() != UpdateType.TICK) + return; + + if(GetState() != GameState.Prepare) + return; + + for(Player player : UtilServer.getPlayers()) + displayTutorial(player); + + if(_tutorialFrame < 400 && _tutorialFrame > 20) + { + for(Player player : UtilServer.getPlayers()) + { + player.setAllowFlight(true); + player.setFlying(true); + player.teleport(_tutorialLocation); + } + } + if(_tutorialFrame < 50 && _tutorialFrame > 20) + { + Minion minion = _activeMinions.get(0); + minion.setMoving(false); + } + if(_tutorialFrame == 5) + { + Location red = WorldData.GetDataLocs("LIME").get(0); + Location blue = WorldData.GetDataLocs("PURPLE").get(0); + + ArrayList tutorialLocations = UtilShapes.getLinesDistancedPoints(red, blue, 1); + _tutorialLocation = tutorialLocations.get(7).clone().add(0, 15, 0); + + for(Player player : UtilServer.getPlayers()) + { + VisibilityManager.Instance.setVisibility(player, false, UtilServer.getPlayers()); + _playerSpawns.put(player, player.getLocation().clone()); + } + + ArrayList locations = UtilShapes.getLinesDistancedPoints(_minionSpawns.get(GetTeamList().get(0)).get(3), _minionSpawns.get(GetTeamList().get(1)).get(3), 1); + Manager.GetCreature().SetForce(true); + this.CreatureAllowOverride = true; + Minion minion = new Minion(Manager, locations.get(locations.size() - 10), _minionSpawns.get(GetTeamList().get(1)).get(3), GetTeamList().get(0), 0); + _activeMinions.add(minion); + this.CreatureAllowOverride = false; + Manager.GetCreature().SetForce(false); + + Vector vec = new Vector(minion.getEntity().getLocation().getBlockX() - _tutorialLocation.getBlockX(), minion.getEntity().getLocation().getBlockY() - _tutorialLocation.getBlockY(), minion.getEntity().getLocation().getBlockZ() - _tutorialLocation.getBlockZ()); + float pitch = UtilAlg.GetPitch(vec); + float yaw = UtilAlg.GetYaw(vec); + _tutorialLocation.setPitch(pitch); + _tutorialLocation.setYaw(yaw); + } + if(_tutorialFrame == 200) + { + + Location red = WorldData.GetDataLocs("LIME").get(0); + Location blue = WorldData.GetDataLocs("PURPLE").get(0); + + ArrayList tutorialLocations = UtilShapes.getLinesDistancedPoints(red, blue, 1); + _tutorialLocation = tutorialLocations.get(15).clone().add(0, 15, 0); + + _activeMinions.get(0).despawn(null, false); + Vector vec = new Vector(_giants.get(GetTeamList().get(0)).getEyeLocation().getBlockX() - _tutorialLocation.getBlockX(), _giants.get(GetTeamList().get(0)).getEyeLocation().getBlockY() - _tutorialLocation.getBlockY(), _giants.get(GetTeamList().get(0)).getEyeLocation().getBlockZ() - _tutorialLocation.getBlockZ()); + float pitch = UtilAlg.GetPitch(vec); + float yaw = UtilAlg.GetYaw(vec); + _tutorialLocation.setPitch(pitch); + _tutorialLocation.setYaw(yaw); + for(int i = 0; i <= 8; i = i + 2) + { + ArrayList locations = UtilShapes.getLinesDistancedPoints(_minionSpawns.get(GetTeamList().get(0)).get(i), _minionSpawns.get(GetTeamList().get(1)).get(i), 1); + Manager.GetCreature().SetForce(true); + this.CreatureAllowOverride = true; + Minion minion = new Minion(Manager, locations.get(locations.size() - 5), _minionSpawns.get(GetTeamList().get(1)).get(i), GetTeamList().get(0), i); + _activeMinions.add(minion); + this.CreatureAllowOverride = false; + Manager.GetCreature().SetForce(false); + } + } + if(_tutorialFrame == 401) + { + for(Player player : UtilServer.getPlayers()) + { + player.setAllowFlight(false); + player.teleport(_playerSpawns.get(player)); + VisibilityManager.Instance.setVisibility(player, true, UtilServer.getPlayers()); + } + this.PrepareFreeze = true; + for(Giant giant : _giants.values()) + { + giant.setHealth(100); + } + for(Minion minion : _activeMinions) + minion.despawn(null, false); + + _activeMinions.clear(); + _deadMinions.clear(); + _finishedMinions.clear(); + } + _tutorialFrame++; + } + + public void displayTutorial(Player player) + { + if(_tutorialFrame != 20 && + _tutorialFrame != 50 && + _tutorialFrame != 100 && + _tutorialFrame != 150 && + _tutorialFrame != 200 && + _tutorialFrame != 250 && + _tutorialFrame != 300 && + _tutorialFrame != 350) + return; + + player.playSound(player.getLocation(), Sound.NOTE_PLING, 1, 1); + UtilPlayer.message(player, " "); + UtilPlayer.message(player, " "); + UtilPlayer.message(player, " "); + UtilPlayer.message(player, C.cGreen + C.Strike + C.Bold + "========================================"); + UtilPlayer.message(player, C.cGold + C.Bold + "Type wars tutorial"); + UtilPlayer.message(player, " "); + + if(_tutorialFrame >= 20 && _tutorialFrame < 200) + UtilPlayer.message(player, "Welcome to the Type wars tutorial!"); + + if(_tutorialFrame >= 50 && _tutorialFrame < 200) + UtilPlayer.message(player, "Here you can see a Minion."); + + if(_tutorialFrame >= 100 && _tutorialFrame < 200) + UtilPlayer.message(player, "You have to type it's name to kill it."); + + if(_tutorialFrame >= 150 && _tutorialFrame < 200) + UtilPlayer.message(player, "You can only see the names of enemy Minions."); + + //next Phase + + if(_tutorialFrame >= 200 && _tutorialFrame < 1200) + UtilPlayer.message(player, "Those are some Minions."); + + if(_tutorialFrame >= 250 && _tutorialFrame < 1200) + UtilPlayer.message(player, "They are attacking a Giant."); + + if(_tutorialFrame >= 300 && _tutorialFrame < 1200) + UtilPlayer.message(player, "You have to kill them as fast as you can."); + + if(_tutorialFrame >= 350 && _tutorialFrame < 1200) + UtilPlayer.message(player, "If your Giants health end up with 0 the other team will win."); + + UtilPlayer.message(player, C.cGreen + C.Strike + C.Bold + "========================================"); + } + @EventHandler public void test(PlayerCommandPreprocessEvent event) { @@ -366,7 +526,7 @@ public class TypeWars extends TeamGame { if(event.getEntityType() == EntityType.CREEPER) { - event.setCancelled(true); + event.setCancelled(true); } } @@ -399,7 +559,7 @@ public class TypeWars extends TeamGame { _minionsSpawned.put(GetTeamList().get(0), 0); minion = new Minion(Manager, _minionSpawns.get(GetTeamList().get(0)).get(rdm), _minionSpawns.get(GetTeamList().get(1)).get(rdm), GetTeamList().get(0), null, true, MinionSize.BOSS.getRandomType(), rdm); - UtilTextMiddle.display("", "A Boss monster has spawned!"); + UtilTextMiddle.display("", minion.getTeam().GetColor() + "A Boss monster has spawned!"); } else { @@ -427,7 +587,7 @@ public class TypeWars extends TeamGame { _minionsSpawned.put(GetTeamList().get(1), 0); minion = new Minion(Manager, _minionSpawns.get(GetTeamList().get(1)).get(rdm), _minionSpawns.get(GetTeamList().get(0)).get(rdm), GetTeamList().get(1), null, true, MinionSize.BOSS.getRandomType(), rdm); - UtilTextMiddle.display("", "A Boss monster has spawned!"); + UtilTextMiddle.display("", minion.getTeam().GetColor() + "A Boss monster has spawned!"); } else { @@ -449,7 +609,7 @@ public class TypeWars extends TeamGame if(event.getType() != UpdateType.TICK) return; - if(GetState() != GameState.Live) + if(GetState() != GameState.Live && GetState() != GameState.Prepare) return; Iterator minionIterator = _activeMinions.iterator(); @@ -460,19 +620,22 @@ public class TypeWars extends TeamGame if(minion.isSpawned()) { - if(!UtilEnt.CreatureMoveFast(minion.getEntity(), minion.getTarget(), minion.getWalkSpeed())) + if(minion.isMoving()) { - GameTeam enemy = null; - for(GameTeam teams : GetTeamList()) + if(!UtilEnt.CreatureMoveFast(minion.getEntity(), minion.getTarget(), minion.getWalkSpeed())) { - if(teams != minion.getTeam()) - enemy = teams; - } - Location nextTarget = _giantAttackZones.get(enemy).get(minion.getSpawnID()); - if(!nextTarget.equals(minion.getTarget())) - { - minion.setTarget(nextTarget); - _finishedMinions.add(minion); + GameTeam enemy = null; + for(GameTeam teams : GetTeamList()) + { + if(teams != minion.getTeam()) + enemy = teams; + } + Location nextTarget = _giantAttackZones.get(enemy).get(minion.getSpawnID()); + if(!nextTarget.equals(minion.getTarget())) + { + minion.setTarget(nextTarget); + _finishedMinions.add(minion); + } } } } @@ -538,7 +701,7 @@ public class TypeWars extends TeamGame @EventHandler public void minionAttack(UpdateEvent event) { - if(GetState() != GameState.Live) + if(GetState() != GameState.Live && GetState() != GameState.Prepare) return; if(event.getType() != UpdateType.SEC) @@ -561,11 +724,14 @@ public class TypeWars extends TeamGame for(GameTeam team : _giants.keySet()) { for(GameTeam otherTeam : minions.keySet()) + { if(team != otherTeam) { + _giants.get(team).getWorld().playSound(_giants.get(team).getEyeLocation(), Sound.ZOMBIE_HURT, 1, 1); if(minions.containsKey(otherTeam)) _giants.get(team).damage(minions.get(otherTeam)); } + } if(_giantsAttacked.containsKey(team)) { if(_giantsAttacked.get(team) != null) @@ -621,6 +787,15 @@ public class TypeWars extends TeamGame event.setCancelled(true); } + @EventHandler + public void titles(GameStateChangeEvent event) + { + if(event.GetState() == GameState.Live) + { + UtilTextMiddle.display("", "Type the names over mob's heads to kill them!", 20, Integer.MAX_VALUE, 20, UtilServer.getPlayers()); + } + } + @EventHandler public void chatCheck(PlayerChatEvent event) { @@ -648,6 +823,11 @@ public class TypeWars extends TeamGame int spawned = _minionsSpawned.get(GetTeam(event.getPlayer())); _minionsSpawned.put(GetTeam(event.getPlayer()), spawned + 1); + if(_playerTitles.contains(event.getPlayer())) + { + _playerTitles.remove(event.getPlayer()); + UtilTextMiddle.clear(event.getPlayer()); + } UtilTextMiddle.display("", C.cGreen + "+$" + minion.getMoney(), event.getPlayer()); _moneyMap.put(event.getPlayer(), _moneyMap.get(event.getPlayer()) + minion.getMoney()); return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellKillEverything.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellKillEverything.java index 33a1384d2..cc25ac55f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellKillEverything.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellKillEverything.java @@ -40,7 +40,7 @@ public class SpellKillEverything extends Spell public boolean execute(Player player, Location location) { - UtilTextMiddle.display("", player.getName() + " used A Zombie Smash", UtilServer.getPlayers()); + UtilTextMiddle.display("", player.getName() + " used a Zombie Smash", UtilServer.getPlayers()); ArrayList minionList = new ArrayList<>(); Iterator minionIterator = getTypeWars().getActiveMinions().iterator(); while(minionIterator.hasNext()) From f2830e653e596e4071886c3a880316300e3c9afd Mon Sep 17 00:00:00 2001 From: Sarah Date: Wed, 18 Nov 2015 19:25:12 +0100 Subject: [PATCH 034/113] Making last changes to the tutorial --- .../arcade/game/games/typewars/Minion.java | 19 ++++-- .../arcade/game/games/typewars/TypeWars.java | 60 ++++++++++--------- 2 files changed, 47 insertions(+), 32 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java index 06dfe1a08..1b0fcc70d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java @@ -281,7 +281,6 @@ public class Minion ent = _location.getWorld().spawn(_location, Creeper.class); disguise = clazz.getConstructors()[0].newInstance(ent); } - clazz.getMethod("setCustomNameVisible", boolean.class).invoke(disguise, true); try { clazz.getMethod("setHelmet", ItemStack.class).invoke(disguise, new ItemStack(Material.LEATHER_HELMET)); @@ -368,7 +367,7 @@ public class Minion return _lives > 1; } - public void despawn(Player player, boolean killed) + public void despawn(Player player, boolean killed, boolean clean) { _money = _money + 1; if(_lives > 1) @@ -395,9 +394,16 @@ public class Minion { if(_entity.getPassenger() != null) { - ((Zombie) _entity.getPassenger()).damage(10000); + if(!clean) + ((Zombie) _entity.getPassenger()).damage(10000); + else + _entity.getPassenger().remove(); } - ((Zombie) _entity).damage(10000); + if(!clean) + ((Zombie) _entity).damage(10000); + else + _entity.remove(); + if(!_entity.isDead()) _entity.remove(); } @@ -407,6 +413,11 @@ public class Minion } } + public void despawn(Player player, boolean killed) + { + despawn(player, killed, false); + } + public void animation() { if(!_die) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index dcb679170..83afb94d5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -125,7 +125,7 @@ public class TypeWars extends TeamGame this.TeamArmorHotbar = true; this.Damage = false; this.CreatureAllow = false; - this.PrepareTime = 30000; + this.PrepareTime = 40000; this.PrepareFreeze = false; _activeMinions = new ArrayList<>(); @@ -170,8 +170,8 @@ public class TypeWars extends TeamGame if(i >= GetTeamList().size() -1) return; }*/ - _minionSpawns.put(GetTeamList().get(1), (ArrayList)data.GetDataLocs("RED")); - _minionSpawns.put(GetTeamList().get(0), (ArrayList)data.GetDataLocs("LIGHT_BLUE")); + _minionSpawns.put(GetTeamList().get(1), (ArrayList)data.GetDataLocs("RED").clone()); + _minionSpawns.put(GetTeamList().get(0), (ArrayList)data.GetDataLocs("LIGHT_BLUE").clone()); _giantAttackZones.put(GetTeamList().get(1), (ArrayList) data.GetDataLocs("MAGENTA").clone()); _giantAttackZones.put(GetTeamList().get(0), (ArrayList) data.GetDataLocs("ORANGE").clone()); @@ -211,8 +211,8 @@ public class TypeWars extends TeamGame public void prepareGiants() { - Location red = WorldData.GetDataLocs("LIME").get(0); - Location blue = WorldData.GetDataLocs("PURPLE").get(0); + Location red = WorldData.GetDataLocs("PURPLE").get(0); + Location blue = WorldData.GetDataLocs("LIME").get(0); for (int i = 0; i < 4; i++) { @@ -262,7 +262,6 @@ public class TypeWars extends TeamGame Location giantLoc = _giants.get(otherTeam).getLocation(); location.setYaw(UtilAlg.GetYaw(new Vector(giantLoc.getBlockX() - location.getBlockX(), giantLoc.getBlockY() - location.getBlockY(), giantLoc.getBlockZ() - location.getBlockZ()))); } - } } } @@ -305,7 +304,7 @@ public class TypeWars extends TeamGame for(Player player : UtilServer.getPlayers()) displayTutorial(player); - if(_tutorialFrame < 400 && _tutorialFrame > 20) + if(_tutorialFrame < 500 && _tutorialFrame > 20) { for(Player player : UtilServer.getPlayers()) { @@ -314,7 +313,7 @@ public class TypeWars extends TeamGame player.teleport(_tutorialLocation); } } - if(_tutorialFrame < 50 && _tutorialFrame > 20) + if(_tutorialFrame == 40) { Minion minion = _activeMinions.get(0); minion.setMoving(false); @@ -325,7 +324,7 @@ public class TypeWars extends TeamGame Location blue = WorldData.GetDataLocs("PURPLE").get(0); ArrayList tutorialLocations = UtilShapes.getLinesDistancedPoints(red, blue, 1); - _tutorialLocation = tutorialLocations.get(7).clone().add(0, 15, 0); + _tutorialLocation = tutorialLocations.get(7).clone().add(0, 10, 0); for(Player player : UtilServer.getPlayers()) { @@ -336,12 +335,12 @@ public class TypeWars extends TeamGame ArrayList locations = UtilShapes.getLinesDistancedPoints(_minionSpawns.get(GetTeamList().get(0)).get(3), _minionSpawns.get(GetTeamList().get(1)).get(3), 1); Manager.GetCreature().SetForce(true); this.CreatureAllowOverride = true; - Minion minion = new Minion(Manager, locations.get(locations.size() - 10), _minionSpawns.get(GetTeamList().get(1)).get(3), GetTeamList().get(0), 0); + Minion minion = new Minion(Manager, locations.get(locations.size() - 10), _minionSpawns.get(GetTeamList().get(1)).get(3), GetTeamList().get(0), 3); _activeMinions.add(minion); this.CreatureAllowOverride = false; Manager.GetCreature().SetForce(false); - Vector vec = new Vector(minion.getEntity().getLocation().getBlockX() - _tutorialLocation.getBlockX(), minion.getEntity().getLocation().getBlockY() - _tutorialLocation.getBlockY(), minion.getEntity().getLocation().getBlockZ() - _tutorialLocation.getBlockZ()); + Vector vec = new Vector(locations.get(locations.size() - 5).getBlockX() - _tutorialLocation.getBlockX(), locations.get(locations.size() - 5).getBlockY() - _tutorialLocation.getBlockY(), locations.get(locations.size() - 5).getBlockZ() - _tutorialLocation.getBlockZ()); float pitch = UtilAlg.GetPitch(vec); float yaw = UtilAlg.GetYaw(vec); _tutorialLocation.setPitch(pitch); @@ -356,24 +355,25 @@ public class TypeWars extends TeamGame ArrayList tutorialLocations = UtilShapes.getLinesDistancedPoints(red, blue, 1); _tutorialLocation = tutorialLocations.get(15).clone().add(0, 15, 0); - _activeMinions.get(0).despawn(null, false); - Vector vec = new Vector(_giants.get(GetTeamList().get(0)).getEyeLocation().getBlockX() - _tutorialLocation.getBlockX(), _giants.get(GetTeamList().get(0)).getEyeLocation().getBlockY() - _tutorialLocation.getBlockY(), _giants.get(GetTeamList().get(0)).getEyeLocation().getBlockZ() - _tutorialLocation.getBlockZ()); + _activeMinions.get(0).despawn(null, false, true); + + Vector vec = new Vector(_giants.get(GetTeamList().get(1)).getEyeLocation().getBlockX() - _tutorialLocation.getBlockX(), _giants.get(GetTeamList().get(1)).getEyeLocation().getBlockY() - _tutorialLocation.getBlockY(), _giants.get(GetTeamList().get(1)).getEyeLocation().getBlockZ() - _tutorialLocation.getBlockZ()); float pitch = UtilAlg.GetPitch(vec); float yaw = UtilAlg.GetYaw(vec); _tutorialLocation.setPitch(pitch); _tutorialLocation.setYaw(yaw); - for(int i = 0; i <= 8; i = i + 2) + for(int i = 2; i <= 10; i = i + 2) { ArrayList locations = UtilShapes.getLinesDistancedPoints(_minionSpawns.get(GetTeamList().get(0)).get(i), _minionSpawns.get(GetTeamList().get(1)).get(i), 1); Manager.GetCreature().SetForce(true); this.CreatureAllowOverride = true; - Minion minion = new Minion(Manager, locations.get(locations.size() - 5), _minionSpawns.get(GetTeamList().get(1)).get(i), GetTeamList().get(0), i); + Minion minion = new Minion(Manager, locations.get(locations.size() - 8), _minionSpawns.get(GetTeamList().get(1)).get(i), GetTeamList().get(0), i); _activeMinions.add(minion); this.CreatureAllowOverride = false; Manager.GetCreature().SetForce(false); } } - if(_tutorialFrame == 401) + if(_tutorialFrame == 501) { for(Player player : UtilServer.getPlayers()) { @@ -387,7 +387,7 @@ public class TypeWars extends TeamGame giant.setHealth(100); } for(Minion minion : _activeMinions) - minion.despawn(null, false); + minion.despawn(null, false, true); _activeMinions.clear(); _deadMinions.clear(); @@ -405,7 +405,8 @@ public class TypeWars extends TeamGame _tutorialFrame != 200 && _tutorialFrame != 250 && _tutorialFrame != 300 && - _tutorialFrame != 350) + _tutorialFrame != 350 && + _tutorialFrame != 400) return; player.playSound(player.getLocation(), Sound.NOTE_PLING, 1, 1); @@ -420,27 +421,30 @@ public class TypeWars extends TeamGame UtilPlayer.message(player, "Welcome to the Type wars tutorial!"); if(_tutorialFrame >= 50 && _tutorialFrame < 200) - UtilPlayer.message(player, "Here you can see a Minion."); + UtilPlayer.message(player, "Here you can see a Minion"); if(_tutorialFrame >= 100 && _tutorialFrame < 200) - UtilPlayer.message(player, "You have to type it's name to kill it."); + UtilPlayer.message(player, "You have to type it's name to kill it"); if(_tutorialFrame >= 150 && _tutorialFrame < 200) - UtilPlayer.message(player, "You can only see the names of enemy Minions."); + UtilPlayer.message(player, "You can only see the names of enemy Minions"); //next Phase if(_tutorialFrame >= 200 && _tutorialFrame < 1200) - UtilPlayer.message(player, "Those are some Minions."); + UtilPlayer.message(player, "Those are some Minions"); if(_tutorialFrame >= 250 && _tutorialFrame < 1200) - UtilPlayer.message(player, "They are attacking a Giant."); + UtilPlayer.message(player, "They are attacking a Giant"); if(_tutorialFrame >= 300 && _tutorialFrame < 1200) - UtilPlayer.message(player, "You have to kill them as fast as you can."); + UtilPlayer.message(player, "You have to kill them as fast as you can"); if(_tutorialFrame >= 350 && _tutorialFrame < 1200) - UtilPlayer.message(player, "If your Giants health end up with 0 the other team will win."); + UtilPlayer.message(player, "If your Giants health ends up with 0 the other team will win"); + + if(_tutorialFrame >= 400 && _tutorialFrame < 1200) + UtilPlayer.message(player, "Your Giant can kill one Minion all 4 seconds"); UtilPlayer.message(player, C.cGreen + C.Strike + C.Bold + "========================================"); } @@ -663,7 +667,7 @@ public class TypeWars extends TeamGame @EventHandler public void giants(UpdateEvent event) { - if(GetState() != GameState.Live) + if(GetState() != GameState.Live && GetState() != GameState.Prepare) return; if(event.getType() != UpdateType.SLOW) @@ -688,7 +692,7 @@ public class TypeWars extends TeamGame Location loc = giant.getLocation().clone(); loc.setYaw(UtilAlg.GetYaw(new Vector(minion.getEntity().getLocation().getBlockX() - loc.getBlockX(), minion.getEntity().getLocation().getBlockY() - loc.getBlockY(), minion.getEntity().getLocation().getBlockZ() - loc.getBlockZ()))); giant.teleport(loc); - giant.getWorld().playSound(giant.getLocation(), Sound.ZOMBIE_WOODBREAK, 1, 1); + giant.getWorld().playSound(giant.getLocation(), Sound.ZOMBIE_WOODBREAK, 100, 1); giant.getWorld().playSound(giant.getLocation(), Sound.ZOMBIE_IDLE, 1, 1); UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, minion.getEntity().getLocation(), 0, 0, 0, 1, 1, ViewDist.NORMAL, UtilServer.getPlayers()); @@ -727,7 +731,7 @@ public class TypeWars extends TeamGame { if(team != otherTeam) { - _giants.get(team).getWorld().playSound(_giants.get(team).getEyeLocation(), Sound.ZOMBIE_HURT, 1, 1); + _giants.get(team).getWorld().playSound(_giants.get(team).getEyeLocation(), Sound.ZOMBIE_HURT, 100, 1); if(minions.containsKey(otherTeam)) _giants.get(team).damage(minions.get(otherTeam)); } From a8ba1f1ea6fe3005546de84ecddc124b38baf0f4 Mon Sep 17 00:00:00 2001 From: Sarah Date: Wed, 18 Nov 2015 22:33:47 +0100 Subject: [PATCH 035/113] some perspektive changes to the tutorial and removing prepare timer. --- .../src/nautilus/game/arcade/game/Game.java | 2 ++ .../arcade/game/games/typewars/TypeWars.java | 26 +++++++++++-------- .../game/arcade/managers/GameManager.java | 10 +++++-- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index 23dc523e1..e5eb903c2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -262,6 +262,8 @@ public abstract class Game implements Listener public long PrepareTime = 9000; public boolean PlaySoundGameStart = true; + public boolean PlayPrepareCountdownSound = true; + public boolean DisplayPrepareTimer = true; // Gems public double GemMultiplier = 1; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index 83afb94d5..112d8bdec 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -125,8 +125,11 @@ public class TypeWars extends TeamGame this.TeamArmorHotbar = true; this.Damage = false; this.CreatureAllow = false; - this.PrepareTime = 40000; + this.PrepareTime = 50000; this.PrepareFreeze = false; + this.PlayPrepareCountdownSound = false; + this.PlaySoundGameStart = false; + this.DisplayPrepareTimer = false; _activeMinions = new ArrayList<>(); _deadMinions = new ArrayList<>(); @@ -324,7 +327,7 @@ public class TypeWars extends TeamGame Location blue = WorldData.GetDataLocs("PURPLE").get(0); ArrayList tutorialLocations = UtilShapes.getLinesDistancedPoints(red, blue, 1); - _tutorialLocation = tutorialLocations.get(7).clone().add(0, 10, 0); + _tutorialLocation = tutorialLocations.get(20).clone().add(0, 10, 0); for(Player player : UtilServer.getPlayers()) { @@ -332,10 +335,10 @@ public class TypeWars extends TeamGame _playerSpawns.put(player, player.getLocation().clone()); } - ArrayList locations = UtilShapes.getLinesDistancedPoints(_minionSpawns.get(GetTeamList().get(0)).get(3), _minionSpawns.get(GetTeamList().get(1)).get(3), 1); + ArrayList locations = UtilShapes.getLinesDistancedPoints(_minionSpawns.get(GetTeamList().get(0)).get(4), _minionSpawns.get(GetTeamList().get(1)).get(4), 1); Manager.GetCreature().SetForce(true); this.CreatureAllowOverride = true; - Minion minion = new Minion(Manager, locations.get(locations.size() - 10), _minionSpawns.get(GetTeamList().get(1)).get(3), GetTeamList().get(0), 3); + Minion minion = new Minion(Manager, locations.get(locations.size() - 10), _minionSpawns.get(GetTeamList().get(1)).get(4), GetTeamList().get(0), 4); _activeMinions.add(minion); this.CreatureAllowOverride = false; Manager.GetCreature().SetForce(false); @@ -357,7 +360,7 @@ public class TypeWars extends TeamGame _activeMinions.get(0).despawn(null, false, true); - Vector vec = new Vector(_giants.get(GetTeamList().get(1)).getEyeLocation().getBlockX() - _tutorialLocation.getBlockX(), _giants.get(GetTeamList().get(1)).getEyeLocation().getBlockY() - _tutorialLocation.getBlockY(), _giants.get(GetTeamList().get(1)).getEyeLocation().getBlockZ() - _tutorialLocation.getBlockZ()); + Vector vec = new Vector(_giants.get(GetTeamList().get(1)).getLocation().getBlockX() - _tutorialLocation.getBlockX(), _giants.get(GetTeamList().get(1)).getLocation().getBlockY() - _tutorialLocation.getBlockY(), _giants.get(GetTeamList().get(1)).getLocation().getBlockZ() - _tutorialLocation.getBlockZ()); float pitch = UtilAlg.GetPitch(vec); float yaw = UtilAlg.GetYaw(vec); _tutorialLocation.setPitch(pitch); @@ -392,6 +395,9 @@ public class TypeWars extends TeamGame _activeMinions.clear(); _deadMinions.clear(); _finishedMinions.clear(); + this.PrepareTime = 5000 + (System.currentTimeMillis() - GetStateTime()); + this.DisplayPrepareTimer = true; + this.PlayPrepareCountdownSound = true; } _tutorialFrame++; } @@ -432,19 +438,17 @@ public class TypeWars extends TeamGame //next Phase if(_tutorialFrame >= 200 && _tutorialFrame < 1200) - UtilPlayer.message(player, "Those are some Minions"); + UtilPlayer.message(player, "These minions are attacking your Giant"); if(_tutorialFrame >= 250 && _tutorialFrame < 1200) - UtilPlayer.message(player, "They are attacking a Giant"); + UtilPlayer.message(player, "Kill them quickly to protect him!"); if(_tutorialFrame >= 300 && _tutorialFrame < 1200) - UtilPlayer.message(player, "You have to kill them as fast as you can"); + UtilPlayer.message(player, "If your Giant's health reaches 0 you lose!"); if(_tutorialFrame >= 350 && _tutorialFrame < 1200) - UtilPlayer.message(player, "If your Giants health ends up with 0 the other team will win"); + UtilPlayer.message(player, "Your Giant can kill 1 monster every 4 seconds."); - if(_tutorialFrame >= 400 && _tutorialFrame < 1200) - UtilPlayer.message(player, "Your Giant can kill one Minion all 4 seconds"); UtilPlayer.message(player, C.cGreen + C.Strike + C.Bold + "========================================"); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java index 21d8c6501..8ebaa67ad 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java @@ -132,6 +132,9 @@ public class GameManager implements Listener Game game = Manager.GetGame(); + if(!game.DisplayPrepareTimer) + return; + double percentage = (double) (System.currentTimeMillis() - game.GetStateTime()) / game.PrepareTime; for (Player player : UtilServer.getPlayers()) @@ -209,8 +212,11 @@ public class GameManager implements Listener } else { - for (Player player : UtilServer.getPlayers()) - player.playSound(player.getLocation(), Sound.NOTE_STICKS, 1f, 1f); + if(game.PlayPrepareCountdownSound) + { + for (Player player : UtilServer.getPlayers()) + player.playSound(player.getLocation(), Sound.NOTE_STICKS, 1f, 1f); + } } } } From 0fedb9966022bace7f3f764b2624de7a6e435e16 Mon Sep 17 00:00:00 2001 From: Sarah Date: Thu, 19 Nov 2015 21:04:50 +0100 Subject: [PATCH 036/113] Changing the tutorial visuals and texts. --- .../arcade/game/games/typewars/TypeWars.java | 96 ++++++++++++------- 1 file changed, 62 insertions(+), 34 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index 112d8bdec..43f9437df 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -307,7 +307,7 @@ public class TypeWars extends TeamGame for(Player player : UtilServer.getPlayers()) displayTutorial(player); - if(_tutorialFrame < 500 && _tutorialFrame > 20) + if(_tutorialFrame < 220 && _tutorialFrame > 6) { for(Player player : UtilServer.getPlayers()) { @@ -321,6 +321,14 @@ public class TypeWars extends TeamGame Minion minion = _activeMinions.get(0); minion.setMoving(false); } + if(_tutorialFrame == 4) + { + for(Player player : UtilServer.getPlayers()) + { + VisibilityManager.Instance.setVisibility(player, false, UtilServer.getPlayers()); + _playerSpawns.put(player, player.getLocation().clone()); + } + } if(_tutorialFrame == 5) { Location red = WorldData.GetDataLocs("LIME").get(0); @@ -329,27 +337,26 @@ public class TypeWars extends TeamGame ArrayList tutorialLocations = UtilShapes.getLinesDistancedPoints(red, blue, 1); _tutorialLocation = tutorialLocations.get(20).clone().add(0, 10, 0); - for(Player player : UtilServer.getPlayers()) - { - VisibilityManager.Instance.setVisibility(player, false, UtilServer.getPlayers()); - _playerSpawns.put(player, player.getLocation().clone()); - } - ArrayList locations = UtilShapes.getLinesDistancedPoints(_minionSpawns.get(GetTeamList().get(0)).get(4), _minionSpawns.get(GetTeamList().get(1)).get(4), 1); Manager.GetCreature().SetForce(true); this.CreatureAllowOverride = true; Minion minion = new Minion(Manager, locations.get(locations.size() - 10), _minionSpawns.get(GetTeamList().get(1)).get(4), GetTeamList().get(0), 4); + minion.changeName("Fishing"); _activeMinions.add(minion); this.CreatureAllowOverride = false; Manager.GetCreature().SetForce(false); - Vector vec = new Vector(locations.get(locations.size() - 5).getBlockX() - _tutorialLocation.getBlockX(), locations.get(locations.size() - 5).getBlockY() - _tutorialLocation.getBlockY(), locations.get(locations.size() - 5).getBlockZ() - _tutorialLocation.getBlockZ()); + Vector vec = new Vector(locations.get(locations.size() - 3).getBlockX() - _tutorialLocation.getBlockX(), locations.get(locations.size() - 3).getBlockY() - _tutorialLocation.getBlockY(), locations.get(locations.size() - 3).getBlockZ() - _tutorialLocation.getBlockZ()); float pitch = UtilAlg.GetPitch(vec); float yaw = UtilAlg.GetYaw(vec); _tutorialLocation.setPitch(pitch); _tutorialLocation.setYaw(yaw); } - if(_tutorialFrame == 200) + if(_tutorialFrame == 150) + { + _activeMinions.get(0).despawn(null, false); + } + /*if(_tutorialFrame == 200) { Location red = WorldData.GetDataLocs("LIME").get(0); @@ -375,8 +382,8 @@ public class TypeWars extends TeamGame this.CreatureAllowOverride = false; Manager.GetCreature().SetForce(false); } - } - if(_tutorialFrame == 501) + }*/ + if(_tutorialFrame == 220) { for(Player player : UtilServer.getPlayers()) { @@ -406,13 +413,16 @@ public class TypeWars extends TeamGame { if(_tutorialFrame != 20 && _tutorialFrame != 50 && + _tutorialFrame != 80 && + _tutorialFrame != 90 && _tutorialFrame != 100 && + _tutorialFrame != 110 && + _tutorialFrame != 120 && + _tutorialFrame != 130 && + _tutorialFrame != 140 && _tutorialFrame != 150 && - _tutorialFrame != 200 && - _tutorialFrame != 250 && - _tutorialFrame != 300 && - _tutorialFrame != 350 && - _tutorialFrame != 400) + _tutorialFrame != 170 && + _tutorialFrame != 200) return; player.playSound(player.getLocation(), Sound.NOTE_PLING, 1, 1); @@ -423,32 +433,50 @@ public class TypeWars extends TeamGame UtilPlayer.message(player, C.cGold + C.Bold + "Type wars tutorial"); UtilPlayer.message(player, " "); - if(_tutorialFrame >= 20 && _tutorialFrame < 200) - UtilPlayer.message(player, "Welcome to the Type wars tutorial!"); + if(_tutorialFrame >= 20 && _tutorialFrame < 220) + UtilPlayer.message(player, "This is your giant!"); - if(_tutorialFrame >= 50 && _tutorialFrame < 200) - UtilPlayer.message(player, "Here you can see a Minion"); + if(_tutorialFrame >= 50 && _tutorialFrame < 220) + UtilPlayer.message(player, "Protect him from evil minions!"); - if(_tutorialFrame >= 100 && _tutorialFrame < 200) - UtilPlayer.message(player, "You have to type it's name to kill it"); + if(_tutorialFrame >= 80 && _tutorialFrame < 220) + UtilPlayer.message(player, "Type the name above their head to kill them"); - if(_tutorialFrame >= 150 && _tutorialFrame < 200) - UtilPlayer.message(player, "You can only see the names of enemy Minions"); + // display word + if(_tutorialFrame >= 90) + UtilPlayer.message(player, " "); - //next Phase + if(_tutorialFrame == 90) + UtilPlayer.message(player, "F_"); - if(_tutorialFrame >= 200 && _tutorialFrame < 1200) - UtilPlayer.message(player, "These minions are attacking your Giant"); + if(_tutorialFrame == 100) + UtilPlayer.message(player, "Fi_"); - if(_tutorialFrame >= 250 && _tutorialFrame < 1200) - UtilPlayer.message(player, "Kill them quickly to protect him!"); - - if(_tutorialFrame >= 300 && _tutorialFrame < 1200) - UtilPlayer.message(player, "If your Giant's health reaches 0 you lose!"); + if(_tutorialFrame == 110) + UtilPlayer.message(player, "Fis_"); - if(_tutorialFrame >= 350 && _tutorialFrame < 1200) - UtilPlayer.message(player, "Your Giant can kill 1 monster every 4 seconds."); + if(_tutorialFrame == 120) + UtilPlayer.message(player, "Fish_"); + if(_tutorialFrame == 130) + UtilPlayer.message(player, "Fishi_"); + + if(_tutorialFrame == 140) + UtilPlayer.message(player, "Fishin_"); + + if(_tutorialFrame >= 150) + UtilPlayer.message(player, "Fishing_"); + + if(_tutorialFrame >= 90) + UtilPlayer.message(player, " "); + + // ====== + + if(_tutorialFrame >= 170 && _tutorialFrame < 220) + UtilPlayer.message(player, "Kill your enemies giant before they kill yours."); + + if(_tutorialFrame >= 200 && _tutorialFrame < 220) + UtilPlayer.message(player, "Good luck!"); UtilPlayer.message(player, C.cGreen + C.Strike + C.Bold + "========================================"); } From 502f12f00fca6a7790b001254e00e8b88c613baf Mon Sep 17 00:00:00 2001 From: Mysticate Date: Thu, 19 Nov 2015 17:46:07 -0500 Subject: [PATCH 037/113] Fixed paintball to the max. :>> --- .../game/games/paintball/Paintball.java | 78 ++++++------------- .../paintball/events/PaintballEvent.java | 35 +++++++++ .../games/paintball/events/ReviveEvent.java | 35 +++++++++ .../trackers/KillingSpreeTracker.java | 56 +++++++++++++ .../trackers/LastStandStatTracker.java | 42 ++++++++++ .../paintball/trackers}/MedicStatTracker.java | 7 +- .../arcade/stats/LastStandStatTracker.java | 63 --------------- 7 files changed, 195 insertions(+), 121 deletions(-) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/events/PaintballEvent.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/events/ReviveEvent.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/trackers/KillingSpreeTracker.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/trackers/LastStandStatTracker.java rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/{stats => game/games/paintball/trackers}/MedicStatTracker.java (66%) delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/LastStandStatTracker.java diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java index 22b6a06d5..8a0854330 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java @@ -22,13 +22,11 @@ import org.bukkit.entity.Snowball; import org.bukkit.entity.ThrownPotion; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; -import org.bukkit.event.HandlerList; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityRegainHealthEvent; import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.event.player.PlayerEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerTeleportEvent; @@ -59,82 +57,50 @@ import nautilus.game.arcade.events.PlayerPrepareTeleportEvent; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam.PlayerState; import nautilus.game.arcade.game.TeamGame; +import nautilus.game.arcade.game.games.paintball.events.PaintballEvent; +import nautilus.game.arcade.game.games.paintball.events.ReviveEvent; import nautilus.game.arcade.game.games.paintball.kits.KitMachineGun; import nautilus.game.arcade.game.games.paintball.kits.KitRifle; import nautilus.game.arcade.game.games.paintball.kits.KitShotgun; import nautilus.game.arcade.game.games.paintball.kits.KitSniper; +import nautilus.game.arcade.game.games.paintball.trackers.KillingSpreeTracker; +import nautilus.game.arcade.game.games.paintball.trackers.LastStandStatTracker; +import nautilus.game.arcade.game.games.paintball.trackers.MedicStatTracker; import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.stats.KillFastStatTracker; -import nautilus.game.arcade.stats.LastStandStatTracker; -import nautilus.game.arcade.stats.MedicStatTracker; import nautilus.game.arcade.stats.WinFastStatTracker; import nautilus.game.arcade.stats.WinWithoutLosingTeammateStatTracker; public class Paintball extends TeamGame { - public static class ReviveEvent extends PlayerEvent - { - private static final HandlerList handlers = new HandlerList(); - - public static HandlerList getHandlerList() - { - return handlers; - } - - @Override - public HandlerList getHandlers() - { - return getHandlerList(); - } - - private final Player _revivedPlayer; - - public ReviveEvent(Player who, Player revivedPlayer) - { - super(who); - - _revivedPlayer = revivedPlayer; - } - - public Player getRevivedPlayer() - { - return _revivedPlayer; - } - } - private HashMap _doubles = new HashMap(); @SuppressWarnings("unchecked") public Paintball(ArcadeManager manager) { - super(manager, GameType.Paintball, + super(manager, GameType.Paintball, new Kit[] + { + new KitRifle(manager), + new KitShotgun(manager), + new KitMachineGun(manager), + new KitSniper(manager), + }, new String[] + { + "Shoot enemies to paint them", + "Revive/heal with Water Bombs", + "Last team alive wins!" + }); - new Kit[] - { - new KitRifle(manager), - new KitShotgun(manager), - new KitMachineGun(manager), - new KitSniper(manager), - }, + StrictAntiHack = true; - new String[] - { - "Shoot enemies to paint them", - "Revive/heal with Water Bombs", - "Last team alive wins!" - }); - - this.StrictAntiHack = true; - - this.HungerSet = 20; + HungerSet = 20; registerStatTrackers( - new KillFastStatTracker(this, 4, 5, "KillingSpree"), + new KillingSpreeTracker(this), new WinWithoutLosingTeammateStatTracker(this, "FlawlessVictory"), new MedicStatTracker(this), new WinFastStatTracker(this, 30, "Speedrunner"), new LastStandStatTracker(this) - ); + ); } @EventHandler @@ -319,6 +285,8 @@ public class Paintball extends TeamGame AddStat(damager, "Kills", 1, false, false); AddStat(damagee, "Deaths", 1, false, false); + + Bukkit.getPluginManager().callEvent(new PaintballEvent(damagee, damager)); } //Hit Sound diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/events/PaintballEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/events/PaintballEvent.java new file mode 100644 index 000000000..1805e641e --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/events/PaintballEvent.java @@ -0,0 +1,35 @@ +package nautilus.game.arcade.game.games.paintball.events; + +import org.bukkit.entity.Player; +import org.bukkit.event.HandlerList; +import org.bukkit.event.player.PlayerEvent; + +public class PaintballEvent extends PlayerEvent +{ + private static final HandlerList handlers = new HandlerList(); + + public static HandlerList getHandlerList() + { + return handlers; + } + + @Override + public HandlerList getHandlers() + { + return getHandlerList(); + } + + private Player _revivedPlayer; + + public PaintballEvent(Player who, Player revivedPlayer) + { + super(who); + + _revivedPlayer = revivedPlayer; + } + + public Player getKiller() + { + return _revivedPlayer; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/events/ReviveEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/events/ReviveEvent.java new file mode 100644 index 000000000..53cb01acc --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/events/ReviveEvent.java @@ -0,0 +1,35 @@ +package nautilus.game.arcade.game.games.paintball.events; + +import org.bukkit.entity.Player; +import org.bukkit.event.HandlerList; +import org.bukkit.event.player.PlayerEvent; + +public class ReviveEvent extends PlayerEvent +{ + private static final HandlerList handlers = new HandlerList(); + + public static HandlerList getHandlerList() + { + return handlers; + } + + @Override + public HandlerList getHandlers() + { + return getHandlerList(); + } + + private Player _revivedPlayer; + + public ReviveEvent(Player who, Player revivedPlayer) + { + super(who); + + _revivedPlayer = revivedPlayer; + } + + public Player getRevivedPlayer() + { + return _revivedPlayer; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/trackers/KillingSpreeTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/trackers/KillingSpreeTracker.java new file mode 100644 index 000000000..354d64ea9 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/trackers/KillingSpreeTracker.java @@ -0,0 +1,56 @@ +package nautilus.game.arcade.game.games.paintball.trackers; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.games.paintball.Paintball; +import nautilus.game.arcade.game.games.paintball.events.PaintballEvent; +import nautilus.game.arcade.stats.StatTracker; + +public class KillingSpreeTracker extends StatTracker +{ + private final Map _killCount = new HashMap<>(); + private final Map _lastKillTime = new HashMap<>(); + + public KillingSpreeTracker(Paintball game) + { + super(game); + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onCombatDeath(PaintballEvent event) + { + if (getGame().GetState() != Game.GameState.Live) + return; + + Long lastTime = _lastKillTime.get(event.getKiller().getUniqueId()); + + long now = System.currentTimeMillis(); + + Integer killCount; + if (lastTime == null || now - lastTime > 5000) + killCount = 0; + else + { + killCount = _killCount.get(event.getKiller().getUniqueId()); + if (killCount == null) + killCount = 0; + } + + killCount++; + + _killCount.put(event.getKiller().getUniqueId(), killCount); + _lastKillTime.put(event.getKiller().getUniqueId(), now); + + _killCount.remove(event.getPlayer().getUniqueId()); + _lastKillTime.remove(event.getPlayer().getUniqueId()); + + if (killCount >= 4) + addStat(event.getKiller(), "KillingSpree", 1, true, false); + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/trackers/LastStandStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/trackers/LastStandStatTracker.java new file mode 100644 index 000000000..6d983b81a --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/trackers/LastStandStatTracker.java @@ -0,0 +1,42 @@ +package nautilus.game.arcade.game.games.paintball.trackers; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.games.paintball.Paintball; +import nautilus.game.arcade.game.games.paintball.events.PaintballEvent; +import nautilus.game.arcade.stats.StatTracker; + +public class LastStandStatTracker extends StatTracker +{ + private final Map _kills = new HashMap<>(); + + public LastStandStatTracker(Paintball game) + { + super(game); + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onPaintball(PaintballEvent event) + { + if (getGame().GetState() != Game.GameState.Live) + return; + + if (getGame().GetTeam(event.getKiller()).GetPlayers(true).size() == 1) + { + Integer kills = _kills.get(event.getKiller().getUniqueId()); + + kills = (kills == null ? 0 : kills) + 1; + + _kills.put(event.getKiller().getUniqueId(), kills); + + if (kills >= 3) + addStat(event.getKiller(), "LastStand", 1, true, false); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/MedicStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/trackers/MedicStatTracker.java similarity index 66% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/MedicStatTracker.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/trackers/MedicStatTracker.java index 7b3e65e02..ee5b7bf63 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/MedicStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/trackers/MedicStatTracker.java @@ -1,10 +1,11 @@ -package nautilus.game.arcade.stats; +package nautilus.game.arcade.game.games.paintball.trackers; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import nautilus.game.arcade.game.Game; -import nautilus.game.arcade.game.games.paintball.Paintball; +import nautilus.game.arcade.game.games.paintball.events.ReviveEvent; +import nautilus.game.arcade.stats.StatTracker; public class MedicStatTracker extends StatTracker { @@ -14,7 +15,7 @@ public class MedicStatTracker extends StatTracker } @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) - public void onCombatDeath(Paintball.ReviveEvent event) + public void onCombatDeath(ReviveEvent event) { if (getGame().GetState() != Game.GameState.Live) return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/LastStandStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/LastStandStatTracker.java deleted file mode 100644 index d1df0b6f5..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/LastStandStatTracker.java +++ /dev/null @@ -1,63 +0,0 @@ -package nautilus.game.arcade.stats; - -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import mineplex.core.common.util.UtilPlayer; -import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; -import nautilus.game.arcade.game.Game; -import nautilus.game.arcade.game.TeamGame; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; - -public class LastStandStatTracker extends StatTracker -{ - private final Map _kills = new HashMap<>(); - - public LastStandStatTracker(TeamGame game) - { - super(game); - } - - @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) - public void onCombatDeath(CombatDeathEvent event) - { - if (getGame().GetState() != Game.GameState.Live) - return; - - if (event.GetLog().GetKiller() == null) - return; - - if (!event.GetLog().GetKiller().IsPlayer()) - return; - - Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName()); - if (killer == null) - return; - - if (event.GetLog().GetPlayer() == null) - return; - - if (!event.GetLog().GetPlayer().IsPlayer()) - return; - - Player player = UtilPlayer.searchExact(event.GetLog().GetPlayer().GetName()); - if (player == null) - return; - - if (getGame().GetTeam(killer).GetPlayers(true).size() == 1) - { - Integer kills = _kills.get(killer.getUniqueId()); - - kills = (kills == null ? 0 : kills) + 1; - - _kills.put(killer.getUniqueId(), kills); - - if (kills >= 3) - addStat(killer, "LastStand", 1, true, false); - } - } -} From e816a79f37825ae577d6dd2226c8448f4fbbbfc8 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Thu, 19 Nov 2015 17:51:25 -0500 Subject: [PATCH 038/113] Reformatted --- .../trackers/LastStandStatTracker.java | 22 +++++++++---------- .../paintball/trackers/MedicStatTracker.java | 2 +- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/trackers/LastStandStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/trackers/LastStandStatTracker.java index 6d983b81a..523201a16 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/trackers/LastStandStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/trackers/LastStandStatTracker.java @@ -1,42 +1,40 @@ package nautilus.game.arcade.game.games.paintball.trackers; -import java.util.HashMap; -import java.util.Map; import java.util.UUID; import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import nautilus.game.arcade.game.Game; +import mineplex.core.common.util.NautHashMap; import nautilus.game.arcade.game.games.paintball.Paintball; import nautilus.game.arcade.game.games.paintball.events.PaintballEvent; import nautilus.game.arcade.stats.StatTracker; public class LastStandStatTracker extends StatTracker { - private final Map _kills = new HashMap<>(); + private final NautHashMap _kills = new NautHashMap(); public LastStandStatTracker(Paintball game) { super(game); } - @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + @EventHandler public void onPaintball(PaintballEvent event) { - if (getGame().GetState() != Game.GameState.Live) + if (!getGame().IsLive()) return; if (getGame().GetTeam(event.getKiller()).GetPlayers(true).size() == 1) { - Integer kills = _kills.get(event.getKiller().getUniqueId()); - - kills = (kills == null ? 0 : kills) + 1; - - _kills.put(event.getKiller().getUniqueId(), kills); + if (!_kills.containsKey(event.getKiller().getUniqueId())) + _kills.put(event.getKiller().getUniqueId(), 0); + + int kills = _kills.get(event.getKiller().getUniqueId()) + 1; if (kills >= 3) addStat(event.getKiller(), "LastStand", 1, true, false); + + _kills.put(event.getKiller().getUniqueId(), kills); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/trackers/MedicStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/trackers/MedicStatTracker.java index ee5b7bf63..052412c13 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/trackers/MedicStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/trackers/MedicStatTracker.java @@ -17,7 +17,7 @@ public class MedicStatTracker extends StatTracker @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) public void onCombatDeath(ReviveEvent event) { - if (getGame().GetState() != Game.GameState.Live) + if (!getGame().IsLive()) return; addStat(event.getPlayer(), "Medic", 1, false, false); From f02e2b2e72094427a30bfa989ebd5fffac3c6353 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Thu, 19 Nov 2015 18:02:07 -0500 Subject: [PATCH 039/113] Formatting --- .../game/games/paintball/Paintball.java | 9 ++-- .../paintball/events/PaintballEvent.java | 5 ++ .../games/paintball/events/ReviveEvent.java | 5 ++ .../kits/perks/PerkPaintballSniper.java | 46 ++----------------- .../paintball/trackers/MedicStatTracker.java | 6 +-- 5 files changed, 22 insertions(+), 49 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java index 8a0854330..aac5c3853 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java @@ -151,12 +151,13 @@ public class Paintball extends TeamGame if (event.getEntity() instanceof Arrow) { - Manager.runSyncLater(new Runnable() - { + Manager.runSyncLater(new Runnable() // Stupid thing I have to do to make sure the arrow's location is accounted for. Stupid mojang. - Myst + { @Override public void run() { Location loc = event.getEntity().getLocation(); + loc.add(event.getEntity().getVelocity().clone().normalize().multiply(.5)); for (Block block : UtilBlock.getInRadius(loc, 1.5d).keySet()) { @@ -174,7 +175,7 @@ public class Paintball extends TeamGame else { Location loc = event.getEntity().getLocation(); - loc.add(event.getEntity().getVelocity()); + loc.add(event.getEntity().getVelocity().clone().normalize().multiply(.5)); for (Block block : UtilBlock.getInRadius(loc, 1.5d).keySet()) { @@ -186,8 +187,6 @@ public class Paintball extends TeamGame if (color == 3) loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 8); else loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 10); - - event.getEntity().remove(); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/events/PaintballEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/events/PaintballEvent.java index 1805e641e..6de498547 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/events/PaintballEvent.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/events/PaintballEvent.java @@ -6,6 +6,11 @@ import org.bukkit.event.player.PlayerEvent; public class PaintballEvent extends PlayerEvent { + /** + * Created by: Mysticate + * Timestamp: November 19, 2015 + */ + private static final HandlerList handlers = new HandlerList(); public static HandlerList getHandlerList() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/events/ReviveEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/events/ReviveEvent.java index 53cb01acc..1fb253675 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/events/ReviveEvent.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/events/ReviveEvent.java @@ -6,6 +6,11 @@ import org.bukkit.event.player.PlayerEvent; public class ReviveEvent extends PlayerEvent { + /** + * Created by: Mysticate + * Timestamp: November 19, 2015 + */ + private static final HandlerList handlers = new HandlerList(); public static HandlerList getHandlerList() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballSniper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballSniper.java index c8bad2b0a..80ecdec5c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballSniper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballSniper.java @@ -40,6 +40,11 @@ import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy; public class PerkPaintballSniper extends Perk { + /** + * Created by: Mysticate + * Timestamp: October 27, 2015 + */ + private static class Bullet { public int Damage; @@ -47,7 +52,6 @@ public class PerkPaintballSniper extends Perk } private HashMap _crouching = new HashMap(); -// private HashMap _fired = new HashMap(); private NautHashMap _fired = new NautHashMap(); private double _velocity = 15; @@ -260,46 +264,6 @@ public class PerkPaintballSniper extends Perk bullet.LastSeen = proj.getLocation(); } } -// -// @EventHandler(priority = EventPriority.HIGH) -// public void doArrowEffects(ProjectileHitEvent event) -// { -// if (!Manager.GetGame().IsLive()) -// return; -// -// if (!(event.getEntity() instanceof Arrow)) -// return; -// -// Arrow proj = (Arrow) event.getEntity(); -// -// if (!_fired.containsKey(proj)) -// return; -// -// Bullet bullet = _fired.get(proj); -// -// double curRange = 0; -// double distance = Math.abs(UtilMath.offset(proj.getLocation(), bullet.LastSeen)); -// -// while (curRange <= distance) -// { -// Location newTarget = bullet.LastSeen.add(UtilAlg.getTrajectory(bullet.LastSeen, proj.getLocation()).multiply(curRange)); -// -// //Progress Forwards -// curRange += 0.8; -// -// ChatColor color = ChatColor.values()[proj.getMetadata("color").get(0).asInt()]; -// if (color == ChatColor.BLUE || color == ChatColor.AQUA) -// { -// UtilParticle.PlayParticle(ParticleType.RED_DUST, newTarget, -1, 1, 1, 1, 0, -// ViewDist.NORMAL, UtilServer.getPlayers()); -// } -// else -// { -// UtilParticle.PlayParticle(ParticleType.RED_DUST, newTarget, 0, 0, 0, 0, 1, -// ViewDist.NORMAL, UtilServer.getPlayers()); -// } -// } -// } @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void removeEffects(GameStateChangeEvent event) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/trackers/MedicStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/trackers/MedicStatTracker.java index 052412c13..cedccaba6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/trackers/MedicStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/trackers/MedicStatTracker.java @@ -3,13 +3,13 @@ package nautilus.game.arcade.game.games.paintball.trackers; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; -import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.games.paintball.Paintball; import nautilus.game.arcade.game.games.paintball.events.ReviveEvent; import nautilus.game.arcade.stats.StatTracker; -public class MedicStatTracker extends StatTracker +public class MedicStatTracker extends StatTracker { - public MedicStatTracker(Game game) + public MedicStatTracker(Paintball game) { super(game); } From f7011032bc121989fa2656893b3134aae04918a1 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Thu, 19 Nov 2015 19:49:46 -0500 Subject: [PATCH 040/113] Switching branches --- .../game/games/paintball/Paintball.java | 28 +++++++---- .../game/games/paintball/PlayerCopy.java | 48 ++++++++++++++----- 2 files changed, 55 insertions(+), 21 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java index aac5c3853..3eabf69b5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java @@ -16,7 +16,6 @@ import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Arrow; import org.bukkit.entity.EnderPearl; import org.bukkit.entity.HumanEntity; -import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.entity.Snowball; import org.bukkit.entity.ThrownPotion; @@ -27,6 +26,7 @@ import org.bukkit.event.entity.EntityRegainHealthEvent; import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.player.PlayerInteractAtEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerTeleportEvent; @@ -278,7 +278,7 @@ public class Paintball extends TeamGame UtilPlayer.message(player, damageeTeam.GetColor() + damagee.getName() + ChatColor.RESET + " was painted by " + damagerTeam.GetColor() + damager.getName() + ChatColor.RESET + "!"); - PlayerOut(damagee); + PlayerOut(damagee, damager); AddGems(damager, 2, "Kills", true, true); @@ -340,7 +340,7 @@ public class Paintball extends TeamGame return nonColored.isEmpty(); } - public void PlayerOut(Player player) + public void PlayerOut(Player player, Player killer) { //State SetPlayerState(player, PlayerState.OUT); @@ -358,7 +358,7 @@ public class Paintball extends TeamGame UtilAction.velocity(player, new Vector(0,1.2,0)); - _doubles.put(player, new PlayerCopy(this, player, GetTeam(player).GetColor())); + _doubles.put(player, new PlayerCopy(this, player, killer, GetTeam(player).GetColor())); } // @EventHandler @@ -423,7 +423,8 @@ public class Paintball extends TeamGame if (UtilMath.offset(copy.GetEntity().getLocation().add(0,1,0), event.getEntity().getLocation()) > 3) continue; - PlayerIn(copy.GetPlayer(), copy.GetEntity()); + PlayerIn(copy.GetPlayer(), copy); + copyIterator.remove(); AddGems(thrower, 3, "Revived Ally", true, true); @@ -445,7 +446,7 @@ public class Paintball extends TeamGame } } - public void PlayerIn(final Player player, final LivingEntity copy) + public void PlayerIn(final Player player, final PlayerCopy copy) { //State SetPlayerState(player, PlayerState.IN); @@ -455,9 +456,9 @@ public class Paintball extends TeamGame if (copy != null) { Location loc = player.getLocation(); - loc.setX(copy.getLocation().getX()); - loc.setY(copy.getLocation().getY()); - loc.setZ(copy.getLocation().getZ()); + loc.setX(copy.GetEntity().getLocation().getX()); + loc.setY(copy.GetEntity().getLocation().getY()); + loc.setZ(copy.GetEntity().getLocation().getZ()); player.teleport(loc); } @@ -489,7 +490,8 @@ public class Paintball extends TeamGame Manager.GetCondition().EndCondition(player, ConditionType.CLOAK, null); //Remove Copy - copy.remove(); + copy.GetEntity().remove(); + copy.GetHolo().stop(); } }, 4); } @@ -539,4 +541,10 @@ public class Paintball extends TeamGame UtilInv.Update(event.getPlayer()); } + + @EventHandler + public void onInteract(PlayerInteractAtEntityEvent event) + { + event.setCancelled(true); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopy.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopy.java index 620c891ea..8dec1c93b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopy.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopy.java @@ -1,44 +1,66 @@ package nautilus.game.arcade.game.games.paintball; import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.ArmorStand; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; -import org.bukkit.entity.Skeleton; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.SkullMeta; +import org.bukkit.util.EulerAngle; import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilEnt; +import mineplex.core.hologram.Hologram; import nautilus.game.arcade.game.Game; public class PlayerCopy { private Game Host; - - private Skeleton _ent; + private Player _owner; - public PlayerCopy(Game host, Player owner, ChatColor nameColor) + private ArmorStand _ent; + private Hologram _holo; + + public PlayerCopy(Game host, Player owner, Player paintedBy, ChatColor nameColor) { Host = host; _owner = owner; Host.CreatureAllowOverride = true; - _ent = owner.getWorld().spawn(owner.getLocation(), Skeleton.class); + _ent = owner.getWorld().spawn(owner.getLocation(), ArmorStand.class); Host.CreatureAllowOverride = false; UtilEnt.ghost(_ent, true, false); UtilEnt.Vegetate(_ent); + _ent.setArms(true); + _ent.setBasePlate(false); + + Location loc = owner.getLocation(); + _ent.teleport(owner); + _ent.setHeadPose(new EulerAngle(UtilAlg.GetYaw(loc.getDirection()), UtilAlg.GetPitch(loc.getDirection()), 0)); + //Armor _ent.getEquipment().setArmorContents(owner.getInventory().getArmorContents()); + _ent.setItemInHand(owner.getItemInHand()); - _ent.setCustomName(C.cWhite + C.Bold + C.Scramble + "XX" + ChatColor.RESET + " " + nameColor + owner.getName() + " " + C.cWhite + C.Bold + C.Scramble + "XX"); - _ent.setCustomNameVisible(true); + //Player skull + ItemStack skull = new ItemStack(Material.SKULL_ITEM, 3); + SkullMeta meta = (SkullMeta) skull.getItemMeta(); + meta.setOwner(owner.getName()); + skull.setItemMeta(meta); + _ent.setHelmet(skull); - //Disguise -// DisguisePlayer disguise = new DisguisePlayer(_ent, ((CraftPlayer)owner).getProfile()); -// Host.Manager.GetDisguise().disguise(disguise); + //Name + _holo = new Hologram(host.Manager.getHologramManager(), _ent.getEyeLocation().clone().add(0, .5, 0)); + _holo.setText(C.cWhite + C.Bold + C.Scramble + "XX" + ChatColor.RESET + " " + nameColor + owner.getName() + " " + C.cWhite + C.Bold + C.Scramble + "XX", C.cWhite + "Painted by " + host.GetTeam(paintedBy).GetColor() + paintedBy.getName()); + _holo.start(); } public LivingEntity GetEntity() @@ -50,5 +72,9 @@ public class PlayerCopy { return _owner; } - + + public Hologram GetHolo() + { + return _holo; + } } From 3f37b893d3f54be9d59af345501ddf8764e169be Mon Sep 17 00:00:00 2001 From: Mysticate Date: Thu, 19 Nov 2015 20:29:20 -0500 Subject: [PATCH 041/113] Worked on double. --- .../game/games/paintball/PlayerCopy.java | 6 +- .../arcade/game/games/wither/PlayerCopy.java | 54 ++++++++++++ .../arcade/game/games/wither/WitherGame.java | 82 ++++++++----------- 3 files changed, 93 insertions(+), 49 deletions(-) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/PlayerCopy.java diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopy.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopy.java index 8dec1c93b..591e35e54 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopy.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopy.java @@ -14,6 +14,7 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilEnt; import mineplex.core.hologram.Hologram; +import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.game.Game; public class PlayerCopy @@ -41,17 +42,18 @@ public class PlayerCopy _ent.setArms(true); _ent.setBasePlate(false); + _ent.setVisible(false); Location loc = owner.getLocation(); _ent.teleport(owner); - _ent.setHeadPose(new EulerAngle(UtilAlg.GetYaw(loc.getDirection()), UtilAlg.GetPitch(loc.getDirection()), 0)); + _ent.setHeadPose(new EulerAngle(Math.toRadians(UtilAlg.GetPitch(loc.getDirection())), Math.toRadians(UtilAlg.GetYaw(loc.getDirection())), 0)); //Armor _ent.getEquipment().setArmorContents(owner.getInventory().getArmorContents()); _ent.setItemInHand(owner.getItemInHand()); //Player skull - ItemStack skull = new ItemStack(Material.SKULL_ITEM, 3); + ItemStack skull = ItemStackFactory.Instance.CreateStack(Material.SKULL_ITEM, (byte) 3, 1); SkullMeta meta = (SkullMeta) skull.getItemMeta(); meta.setOwner(owner.getName()); skull.setItemMeta(meta); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/PlayerCopy.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/PlayerCopy.java new file mode 100644 index 000000000..8101f2b13 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/PlayerCopy.java @@ -0,0 +1,54 @@ +package nautilus.game.arcade.game.games.wither; + +import org.bukkit.ChatColor; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Skeleton; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilEnt; +import nautilus.game.arcade.game.Game; + +public class PlayerCopy +{ + private Game Host; + + private Skeleton _ent; + private Player _owner; + + public PlayerCopy(Game host, Player owner, ChatColor nameColor) + { + Host = host; + + _owner = owner; + + Host.CreatureAllowOverride = true; + _ent = owner.getWorld().spawn(owner.getLocation(), Skeleton.class); + Host.CreatureAllowOverride = false; + + UtilEnt.ghost(_ent, true, false); + + UtilEnt.Vegetate(_ent); + + //Armor + _ent.getEquipment().setArmorContents(owner.getInventory().getArmorContents()); + + _ent.setCustomName(C.cWhite + C.Bold + C.Scramble + "XX" + ChatColor.RESET + " " + nameColor + owner.getName() + " " + C.cWhite + C.Bold + C.Scramble + "XX"); + _ent.setCustomNameVisible(true); + + //Disguise +// DisguisePlayer disguise = new DisguisePlayer(_ent, ((CraftPlayer)owner).getProfile()); +// Host.Manager.GetDisguise().disguise(disguise); + } + + public LivingEntity GetEntity() + { + return _ent; + } + + public Player GetPlayer() + { + return _owner; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java index ef4cab48f..a79e15922 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java @@ -1,55 +1,11 @@ package nautilus.game.arcade.game.games.wither; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.Set; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -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.ItemBuilder; -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; -import nautilus.game.arcade.game.GameTeam; -import nautilus.game.arcade.game.GameTeam.PlayerState; -import nautilus.game.arcade.game.TeamGame; -import nautilus.game.arcade.game.games.paintball.PlayerCopy; -import nautilus.game.arcade.game.games.wither.events.HumanReviveEvent; -import nautilus.game.arcade.game.games.wither.kit.KitHumanArcher; -import nautilus.game.arcade.game.games.wither.kit.KitHumanMedic; -import nautilus.game.arcade.game.games.wither.kit.KitHumanEditor; -import nautilus.game.arcade.game.games.wither.kit.KitWitherMinion; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.NullKit; -import nautilus.game.arcade.kit.perks.data.IBlockRestorer; -import nautilus.game.arcade.stats.BloodThirstyStatTracker; -import nautilus.game.arcade.stats.KingDamageStatTracker; -import nautilus.game.arcade.stats.KingSlayerStatTracker; -import nautilus.game.arcade.stats.TeamDeathsStatTracker; -import nautilus.game.arcade.stats.TeamKillsStatTracker; -import nautilus.game.arcade.stats.WinAsTeamStatTracker; -import nautilus.game.arcade.stats.WitherAssaultReviveTracker; - import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.EntityEffect; @@ -74,13 +30,45 @@ import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.entity.ProjectileLaunchEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerPickupItemEvent; -import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.potion.PotionEffectType; import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.util.Vector; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilMath; +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.UtilTextMiddle; +import mineplex.core.common.util.UtilTime; +import mineplex.core.data.BlockData; +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; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.GameTeam.PlayerState; +import nautilus.game.arcade.game.TeamGame; +import nautilus.game.arcade.game.games.wither.events.HumanReviveEvent; +import nautilus.game.arcade.game.games.wither.kit.KitHumanArcher; +import nautilus.game.arcade.game.games.wither.kit.KitHumanEditor; +import nautilus.game.arcade.game.games.wither.kit.KitHumanMedic; +import nautilus.game.arcade.game.games.wither.kit.KitWitherMinion; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.NullKit; +import nautilus.game.arcade.kit.perks.data.IBlockRestorer; +import nautilus.game.arcade.stats.TeamDeathsStatTracker; +import nautilus.game.arcade.stats.TeamKillsStatTracker; + public class WitherGame extends TeamGame implements IBlockRestorer { private GameTeam _runners; From 2a4d20650a23b6b283db05d3dffbe798422bff9d Mon Sep 17 00:00:00 2001 From: Sarah Date: Fri, 20 Nov 2015 19:04:11 +0100 Subject: [PATCH 042/113] Saving for branch switching. --- .../arcade/game/games/typewars/TypeWars.java | 181 +++++++++++------- .../typewars/spells/SpellKillEverything.java | 2 +- 2 files changed, 111 insertions(+), 72 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index 43f9437df..b3104c3bd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -70,6 +70,7 @@ public class TypeWars extends TeamGame private ArrayList _activeMinions; private ArrayList _deadMinions; private ArrayList _finishedMinions; + private ArrayList _attackingMinions; private HashMap _moneyMap; @@ -104,8 +105,11 @@ public class TypeWars extends TeamGame }, new String[] { - "Protect your Giant!", - "Type Minions' names to kill them." + "Protect your Giant from enemy minions.", + "Type minions names to kill them and get money.", + "Spend money on Spells and Minion Spawns.", + "You get ONE free Giant Smash per game.", + "Kill your enemies Giant before they kill yours!" }); this.DeathOut = false; @@ -147,6 +151,7 @@ public class TypeWars extends TeamGame _giantsAttacked = new HashMap<>(); _playerTitles = new HashSet<>(); _playerSpawns = new HashMap<>(); + _attackingMinions = new ArrayList<>(); _animationTicks = 0; _nukeFrame = 0; @@ -245,9 +250,27 @@ public class TypeWars extends TeamGame giant.setRemoveWhenFarAway(false); UtilEnt.Vegetate(giant, true); UtilEnt.ghost(giant, true, false); - ItemStack stack = new ItemStack(Material.LEATHER_HELMET); + + ItemStack helmet = new ItemStack(Material.LEATHER_HELMET); + LeatherArmorMeta helmetmeta = (LeatherArmorMeta) helmet.getItemMeta(); + helmetmeta.setColor(team.GetColorBase()); + helmet.setItemMeta(helmetmeta); + + ItemStack chest = new ItemStack(Material.LEATHER_CHESTPLATE); + LeatherArmorMeta chestmeta = (LeatherArmorMeta) chest.getItemMeta(); + chestmeta.setColor(team.GetColorBase()); + chest.setItemMeta(chestmeta); + + ItemStack leggings = new ItemStack(Material.LEATHER_LEGGINGS); + LeatherArmorMeta leggingsmeta = (LeatherArmorMeta) leggings.getItemMeta(); + leggingsmeta.setColor(team.GetColorBase()); + leggings.setItemMeta(leggingsmeta); + + ItemStack stack = new ItemStack(Material.LEATHER_BOOTS); LeatherArmorMeta meta = (LeatherArmorMeta) stack.getItemMeta(); meta.setColor(team.GetColorBase()); + stack.setItemMeta(meta); + giant.getEquipment().setHelmet(stack); giant.setMaxHealth(100); giant.setHealth(100); @@ -307,7 +330,7 @@ public class TypeWars extends TeamGame for(Player player : UtilServer.getPlayers()) displayTutorial(player); - if(_tutorialFrame < 220 && _tutorialFrame > 6) + if(_tutorialFrame < 40 + _tutorialText[1].length() + _tutorialText[2].length() + 30 + _tutorialText[3].length() + _tutorialText[4].length() + 40 && _tutorialFrame > 6) { for(Player player : UtilServer.getPlayers()) { @@ -316,11 +339,6 @@ public class TypeWars extends TeamGame player.teleport(_tutorialLocation); } } - if(_tutorialFrame == 40) - { - Minion minion = _activeMinions.get(0); - minion.setMoving(false); - } if(_tutorialFrame == 4) { for(Player player : UtilServer.getPlayers()) @@ -340,7 +358,7 @@ public class TypeWars extends TeamGame ArrayList locations = UtilShapes.getLinesDistancedPoints(_minionSpawns.get(GetTeamList().get(0)).get(4), _minionSpawns.get(GetTeamList().get(1)).get(4), 1); Manager.GetCreature().SetForce(true); this.CreatureAllowOverride = true; - Minion minion = new Minion(Manager, locations.get(locations.size() - 10), _minionSpawns.get(GetTeamList().get(1)).get(4), GetTeamList().get(0), 4); + Minion minion = new Minion(Manager, locations.get(locations.size() - 15), _minionSpawns.get(GetTeamList().get(1)).get(4), GetTeamList().get(0), 4); minion.changeName("Fishing"); _activeMinions.add(minion); this.CreatureAllowOverride = false; @@ -352,7 +370,7 @@ public class TypeWars extends TeamGame _tutorialLocation.setPitch(pitch); _tutorialLocation.setYaw(yaw); } - if(_tutorialFrame == 150) + if(_tutorialFrame == 40 + _tutorialText[1].length() + _tutorialText[2].length() + 30) { _activeMinions.get(0).despawn(null, false); } @@ -383,7 +401,7 @@ public class TypeWars extends TeamGame Manager.GetCreature().SetForce(false); } }*/ - if(_tutorialFrame == 220) + if(_tutorialFrame == 40 + _tutorialText[1].length() + _tutorialText[2].length() + 30 + _tutorialText[3].length() + _tutorialText[4].length() + 40) { for(Player player : UtilServer.getPlayers()) { @@ -409,75 +427,93 @@ public class TypeWars extends TeamGame _tutorialFrame++; } + private String[] _tutorialText = new String[] + { + "This is your giant!", + "Protect him from evil minions!", + "Type the name above their head to kill them", + "Kill your enemies giant before they kill yours.", + "Good luck!" + }; + public void displayTutorial(Player player) { - if(_tutorialFrame != 20 && - _tutorialFrame != 50 && - _tutorialFrame != 80 && - _tutorialFrame != 90 && - _tutorialFrame != 100 && - _tutorialFrame != 110 && - _tutorialFrame != 120 && - _tutorialFrame != 130 && - _tutorialFrame != 140 && - _tutorialFrame != 150 && - _tutorialFrame != 170 && - _tutorialFrame != 200) + + if(_tutorialFrame < 20) return; + if(_tutorialFrame != 20 && + _tutorialFrame != 40 + _tutorialText[1].length() && + _tutorialFrame != 40 + _tutorialText[1].length() + _tutorialText[2].length() && + _tutorialFrame != 40 + _tutorialText[1].length() + _tutorialText[2].length() && + _tutorialFrame != 40 + _tutorialText[1].length() + _tutorialText[2].length() + 5 && + _tutorialFrame != 40 + _tutorialText[1].length() + _tutorialText[2].length() + 10 && + _tutorialFrame != 40 + _tutorialText[1].length() + _tutorialText[2].length() + 15 && + _tutorialFrame != 40 + _tutorialText[1].length() + _tutorialText[2].length() + 20 && + _tutorialFrame != 40 + _tutorialText[1].length() + _tutorialText[2].length() + 25 && + _tutorialFrame != 40 + _tutorialText[1].length() + _tutorialText[2].length() + 30 && + _tutorialFrame != 40 + _tutorialText[1].length() + _tutorialText[2].length() + 30 + _tutorialText[3].length() && + _tutorialFrame != 40 + _tutorialText[1].length() + _tutorialText[2].length() + 30 + _tutorialText[3].length() + _tutorialText[4].length()) + return; + + if(_tutorialFrame == 20) + UtilTextMiddle.display("", "This is your giant!", 0, _tutorialText[0].length() + 20, 2); + + if(_tutorialFrame == 40 + _tutorialText[1].length()) + UtilTextMiddle.display("", "Protect him from evil minions!", 0, _tutorialText[1].length() + 20, 2); + + if(_tutorialFrame == 40 + _tutorialText[1].length() + _tutorialText[2].length()) + UtilTextMiddle.display("", "Type the name above their head to kill them", 0, _tutorialText[2].length() + 20, 2); + + if(_tutorialFrame == 40 + _tutorialText[1].length() + _tutorialText[2].length()) + UtilTextMiddle.display("", "F_", 1, 3, 1); + + if(_tutorialFrame == 40 + _tutorialText[1].length() + _tutorialText[2].length() + 5) + UtilTextMiddle.display("", "Fi_", 1, 3, 1); + + if(_tutorialFrame == 40 + _tutorialText[1].length() + _tutorialText[2].length() + 10) + UtilTextMiddle.display("", "Fis_", 1, 3, 1); + + if(_tutorialFrame == 40 + _tutorialText[1].length() + _tutorialText[2].length() + 15) + UtilTextMiddle.display("", "Fish_", 1, 3, 1); + + if(_tutorialFrame == 40 + _tutorialText[1].length() + _tutorialText[2].length() + 20) + UtilTextMiddle.display("", "Fishi_", 1, 3, 1); + + if(_tutorialFrame == 40 + _tutorialText[1].length() + _tutorialText[2].length() + 25) + UtilTextMiddle.display("", "Fishin_", 1, 3, 1); + + if(_tutorialFrame == 40 + _tutorialText[1].length() + _tutorialText[2].length() + 30) + UtilTextMiddle.display("", "Fishing_", 1, 3, 1); + + + // ====== + + if(_tutorialFrame == 40 + _tutorialText[1].length() + _tutorialText[2].length() + 30 + _tutorialText[3].length()) + UtilTextMiddle.display("", "Kill your enemies giant before they kill yours.", 0, _tutorialText[3].length() + 20, 2); + + if(_tutorialFrame == 40 + _tutorialText[1].length() + _tutorialText[2].length() + 30 + _tutorialText[3].length() + _tutorialText[4].length()) + UtilTextMiddle.display("", "Good luck!", 0, _tutorialText[4].length() + 20, 2); + + } + + public void displayTutorialChat(Player player) + { player.playSound(player.getLocation(), Sound.NOTE_PLING, 1, 1); UtilPlayer.message(player, " "); UtilPlayer.message(player, " "); UtilPlayer.message(player, " "); UtilPlayer.message(player, C.cGreen + C.Strike + C.Bold + "========================================"); UtilPlayer.message(player, C.cGold + C.Bold + "Type wars tutorial"); + UtilPlayer.message(player, " "); + UtilPlayer.message(player, "This is your giant!"); + UtilPlayer.message(player, "Protect him from evil minions!"); + UtilPlayer.message(player, "Type the name above their head to kill them"); UtilPlayer.message(player, " "); - - if(_tutorialFrame >= 20 && _tutorialFrame < 220) - UtilPlayer.message(player, "This is your giant!"); - - if(_tutorialFrame >= 50 && _tutorialFrame < 220) - UtilPlayer.message(player, "Protect him from evil minions!"); - - if(_tutorialFrame >= 80 && _tutorialFrame < 220) - UtilPlayer.message(player, "Type the name above their head to kill them"); - - // display word - if(_tutorialFrame >= 90) - UtilPlayer.message(player, " "); - - if(_tutorialFrame == 90) - UtilPlayer.message(player, "F_"); - - if(_tutorialFrame == 100) - UtilPlayer.message(player, "Fi_"); - - if(_tutorialFrame == 110) - UtilPlayer.message(player, "Fis_"); - - if(_tutorialFrame == 120) - UtilPlayer.message(player, "Fish_"); - - if(_tutorialFrame == 130) - UtilPlayer.message(player, "Fishi_"); - - if(_tutorialFrame == 140) - UtilPlayer.message(player, "Fishin_"); - - if(_tutorialFrame >= 150) - UtilPlayer.message(player, "Fishing_"); - - if(_tutorialFrame >= 90) - UtilPlayer.message(player, " "); - - // ====== - - if(_tutorialFrame >= 170 && _tutorialFrame < 220) - UtilPlayer.message(player, "Kill your enemies giant before they kill yours."); - - if(_tutorialFrame >= 200 && _tutorialFrame < 220) - UtilPlayer.message(player, "Good luck!"); - + UtilPlayer.message(player, "Fishing_"); + UtilPlayer.message(player, " "); + UtilPlayer.message(player, "Kill your enemies giant before they kill yours."); + UtilPlayer.message(player, "Good luck!"); UtilPlayer.message(player, C.cGreen + C.Strike + C.Bold + "========================================"); } @@ -670,6 +706,9 @@ public class TypeWars extends TeamGame if(!nextTarget.equals(minion.getTarget())) { minion.setTarget(nextTarget); + } + else + { _finishedMinions.add(minion); } } @@ -699,7 +738,7 @@ public class TypeWars extends TeamGame @EventHandler public void giants(UpdateEvent event) { - if(GetState() != GameState.Live && GetState() != GameState.Prepare) + if(GetState() != GameState.Live) return; if(event.getType() != UpdateType.SLOW) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellKillEverything.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellKillEverything.java index cc25ac55f..b8eb8a571 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellKillEverything.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellKillEverything.java @@ -40,7 +40,7 @@ public class SpellKillEverything extends Spell public boolean execute(Player player, Location location) { - UtilTextMiddle.display("", player.getName() + " used a Zombie Smash", UtilServer.getPlayers()); + UtilTextMiddle.display("", player.getName() + " used a Zombie Smash", 0, 40, 0); ArrayList minionList = new ArrayList<>(); Iterator minionIterator = getTypeWars().getActiveMinions().iterator(); while(minionIterator.hasNext()) From d0b5f6d8acaa0d52ca8d01f5ce5303bf8c54ab00 Mon Sep 17 00:00:00 2001 From: Sarah Date: Sat, 21 Nov 2015 16:56:56 +0100 Subject: [PATCH 043/113] starting implementation of Type wars tutorial. --- .../src/nautilus/game/arcade/game/Game.java | 2 - .../arcade/game/games/typewars/TypeWars.java | 123 +----------------- .../tutorial/TutorialPhaseTypeWars.java | 55 ++++++++ .../typewars/tutorial/TutorialTypeWars.java | 15 +++ .../game/arcade/managers/GameManager.java | 10 +- 5 files changed, 78 insertions(+), 127 deletions(-) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialPhaseTypeWars.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index 7da71d8fc..d09ecb8fc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -263,8 +263,6 @@ public abstract class Game implements Listener public long PrepareTime = 9000; public boolean PlaySoundGameStart = true; - public boolean PlayPrepareCountdownSound = true; - public boolean DisplayPrepareTimer = true; // Gems public double GemMultiplier = 1; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index b3104c3bd..939786afb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -131,9 +131,8 @@ public class TypeWars extends TeamGame this.CreatureAllow = false; this.PrepareTime = 50000; this.PrepareFreeze = false; - this.PlayPrepareCountdownSound = false; this.PlaySoundGameStart = false; - this.DisplayPrepareTimer = false; + this.EnableTutorials = true; _activeMinions = new ArrayList<>(); _deadMinions = new ArrayList<>(); @@ -271,7 +270,11 @@ public class TypeWars extends TeamGame meta.setColor(team.GetColorBase()); stack.setItemMeta(meta); - giant.getEquipment().setHelmet(stack); + giant.getEquipment().setHelmet(helmet); + giant.getEquipment().setChestplate(chest); + giant.getEquipment().setLeggings(leggings); + giant.getEquipment().setBoots(stack); + giant.setMaxHealth(100); giant.setHealth(100); _giants.put(team, giant); @@ -318,7 +321,6 @@ public class TypeWars extends TeamGame private Location _tutorialLocation; - @EventHandler public void tutorialFrames(UpdateEvent event) { if(event.getType() != UpdateType.TICK) @@ -326,9 +328,6 @@ public class TypeWars extends TeamGame if(GetState() != GameState.Prepare) return; - - for(Player player : UtilServer.getPlayers()) - displayTutorial(player); if(_tutorialFrame < 40 + _tutorialText[1].length() + _tutorialText[2].length() + 30 + _tutorialText[3].length() + _tutorialText[4].length() + 40 && _tutorialFrame > 6) { @@ -374,33 +373,6 @@ public class TypeWars extends TeamGame { _activeMinions.get(0).despawn(null, false); } - /*if(_tutorialFrame == 200) - { - - Location red = WorldData.GetDataLocs("LIME").get(0); - Location blue = WorldData.GetDataLocs("PURPLE").get(0); - - ArrayList tutorialLocations = UtilShapes.getLinesDistancedPoints(red, blue, 1); - _tutorialLocation = tutorialLocations.get(15).clone().add(0, 15, 0); - - _activeMinions.get(0).despawn(null, false, true); - - Vector vec = new Vector(_giants.get(GetTeamList().get(1)).getLocation().getBlockX() - _tutorialLocation.getBlockX(), _giants.get(GetTeamList().get(1)).getLocation().getBlockY() - _tutorialLocation.getBlockY(), _giants.get(GetTeamList().get(1)).getLocation().getBlockZ() - _tutorialLocation.getBlockZ()); - float pitch = UtilAlg.GetPitch(vec); - float yaw = UtilAlg.GetYaw(vec); - _tutorialLocation.setPitch(pitch); - _tutorialLocation.setYaw(yaw); - for(int i = 2; i <= 10; i = i + 2) - { - ArrayList locations = UtilShapes.getLinesDistancedPoints(_minionSpawns.get(GetTeamList().get(0)).get(i), _minionSpawns.get(GetTeamList().get(1)).get(i), 1); - Manager.GetCreature().SetForce(true); - this.CreatureAllowOverride = true; - Minion minion = new Minion(Manager, locations.get(locations.size() - 8), _minionSpawns.get(GetTeamList().get(1)).get(i), GetTeamList().get(0), i); - _activeMinions.add(minion); - this.CreatureAllowOverride = false; - Manager.GetCreature().SetForce(false); - } - }*/ if(_tutorialFrame == 40 + _tutorialText[1].length() + _tutorialText[2].length() + 30 + _tutorialText[3].length() + _tutorialText[4].length() + 40) { for(Player player : UtilServer.getPlayers()) @@ -421,8 +393,6 @@ public class TypeWars extends TeamGame _deadMinions.clear(); _finishedMinions.clear(); this.PrepareTime = 5000 + (System.currentTimeMillis() - GetStateTime()); - this.DisplayPrepareTimer = true; - this.PlayPrepareCountdownSound = true; } _tutorialFrame++; } @@ -436,87 +406,6 @@ public class TypeWars extends TeamGame "Good luck!" }; - public void displayTutorial(Player player) - { - - if(_tutorialFrame < 20) - return; - - if(_tutorialFrame != 20 && - _tutorialFrame != 40 + _tutorialText[1].length() && - _tutorialFrame != 40 + _tutorialText[1].length() + _tutorialText[2].length() && - _tutorialFrame != 40 + _tutorialText[1].length() + _tutorialText[2].length() && - _tutorialFrame != 40 + _tutorialText[1].length() + _tutorialText[2].length() + 5 && - _tutorialFrame != 40 + _tutorialText[1].length() + _tutorialText[2].length() + 10 && - _tutorialFrame != 40 + _tutorialText[1].length() + _tutorialText[2].length() + 15 && - _tutorialFrame != 40 + _tutorialText[1].length() + _tutorialText[2].length() + 20 && - _tutorialFrame != 40 + _tutorialText[1].length() + _tutorialText[2].length() + 25 && - _tutorialFrame != 40 + _tutorialText[1].length() + _tutorialText[2].length() + 30 && - _tutorialFrame != 40 + _tutorialText[1].length() + _tutorialText[2].length() + 30 + _tutorialText[3].length() && - _tutorialFrame != 40 + _tutorialText[1].length() + _tutorialText[2].length() + 30 + _tutorialText[3].length() + _tutorialText[4].length()) - return; - - if(_tutorialFrame == 20) - UtilTextMiddle.display("", "This is your giant!", 0, _tutorialText[0].length() + 20, 2); - - if(_tutorialFrame == 40 + _tutorialText[1].length()) - UtilTextMiddle.display("", "Protect him from evil minions!", 0, _tutorialText[1].length() + 20, 2); - - if(_tutorialFrame == 40 + _tutorialText[1].length() + _tutorialText[2].length()) - UtilTextMiddle.display("", "Type the name above their head to kill them", 0, _tutorialText[2].length() + 20, 2); - - if(_tutorialFrame == 40 + _tutorialText[1].length() + _tutorialText[2].length()) - UtilTextMiddle.display("", "F_", 1, 3, 1); - - if(_tutorialFrame == 40 + _tutorialText[1].length() + _tutorialText[2].length() + 5) - UtilTextMiddle.display("", "Fi_", 1, 3, 1); - - if(_tutorialFrame == 40 + _tutorialText[1].length() + _tutorialText[2].length() + 10) - UtilTextMiddle.display("", "Fis_", 1, 3, 1); - - if(_tutorialFrame == 40 + _tutorialText[1].length() + _tutorialText[2].length() + 15) - UtilTextMiddle.display("", "Fish_", 1, 3, 1); - - if(_tutorialFrame == 40 + _tutorialText[1].length() + _tutorialText[2].length() + 20) - UtilTextMiddle.display("", "Fishi_", 1, 3, 1); - - if(_tutorialFrame == 40 + _tutorialText[1].length() + _tutorialText[2].length() + 25) - UtilTextMiddle.display("", "Fishin_", 1, 3, 1); - - if(_tutorialFrame == 40 + _tutorialText[1].length() + _tutorialText[2].length() + 30) - UtilTextMiddle.display("", "Fishing_", 1, 3, 1); - - - // ====== - - if(_tutorialFrame == 40 + _tutorialText[1].length() + _tutorialText[2].length() + 30 + _tutorialText[3].length()) - UtilTextMiddle.display("", "Kill your enemies giant before they kill yours.", 0, _tutorialText[3].length() + 20, 2); - - if(_tutorialFrame == 40 + _tutorialText[1].length() + _tutorialText[2].length() + 30 + _tutorialText[3].length() + _tutorialText[4].length()) - UtilTextMiddle.display("", "Good luck!", 0, _tutorialText[4].length() + 20, 2); - - } - - public void displayTutorialChat(Player player) - { - player.playSound(player.getLocation(), Sound.NOTE_PLING, 1, 1); - UtilPlayer.message(player, " "); - UtilPlayer.message(player, " "); - UtilPlayer.message(player, " "); - UtilPlayer.message(player, C.cGreen + C.Strike + C.Bold + "========================================"); - UtilPlayer.message(player, C.cGold + C.Bold + "Type wars tutorial"); - UtilPlayer.message(player, " "); - UtilPlayer.message(player, "This is your giant!"); - UtilPlayer.message(player, "Protect him from evil minions!"); - UtilPlayer.message(player, "Type the name above their head to kill them"); - UtilPlayer.message(player, " "); - UtilPlayer.message(player, "Fishing_"); - UtilPlayer.message(player, " "); - UtilPlayer.message(player, "Kill your enemies giant before they kill yours."); - UtilPlayer.message(player, "Good luck!"); - UtilPlayer.message(player, C.cGreen + C.Strike + C.Bold + "========================================"); - } - @EventHandler public void test(PlayerCommandPreprocessEvent event) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialPhaseTypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialPhaseTypeWars.java new file mode 100644 index 000000000..c929da13f --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialPhaseTypeWars.java @@ -0,0 +1,55 @@ +package nautilus.game.arcade.game.games.typewars.tutorial; + +import nautilus.game.arcade.gametutorial.TutorialPhase; +import nautilus.game.arcade.gametutorial.TutorialText; + +public class TutorialPhaseTypeWars extends TutorialPhase +{ + + public TutorialPhaseTypeWars() + { + super(new TutorialText[] + { + new TutorialText("This is your giant!", 1), + new TutorialText("Protect him from evil minions!", 2), + new TutorialText("Type the name above their head to kill them", 3), + new TutorialText("F_", 7, 4), + new TutorialText("Fi_", 7, 5), + new TutorialText("Fis_", 7, 6), + new TutorialText("Fish_", 7, 7), + new TutorialText("Fishi_", 7, 8), + new TutorialText("Fishin_", 7, 9), + new TutorialText("Fishing_", 7, 10), + new TutorialText("Kill your enemies giant before they kill yours.", 11), + new TutorialText("Good luck!", 12) + }); + } + + @Override + public int ID() + { + return 1; + } + + @Override + public void onStart() + { + + } + + @Override + public void onEnd() + { + + } + + @Override + public void onMessageDisplay(TutorialText text) + { + if(text.ID() == 10) + { + + } + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java new file mode 100644 index 000000000..e0bb16d90 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java @@ -0,0 +1,15 @@ +package nautilus.game.arcade.game.games.typewars.tutorial; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.gametutorial.GameTutorial; +import nautilus.game.arcade.gametutorial.TutorialPhase; + +public class TutorialTypeWars extends GameTutorial +{ + + public TutorialTypeWars(ArcadeManager manager) + { + super(manager, new TutorialPhase[]{new TutorialPhaseTypeWars()}); + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java index c3a234407..37ffdc79c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java @@ -161,9 +161,6 @@ public class GameManager implements Listener } } } - - if(!game.DisplayPrepareTimer) - return; double percentage = (double) (System.currentTimeMillis() - game.GetStateTime()) / game.PrepareTime; @@ -285,11 +282,8 @@ public class GameManager implements Listener } else { - if(game.PlayPrepareCountdownSound) - { - for (Player player : UtilServer.getPlayers()) - player.playSound(player.getLocation(), Sound.NOTE_STICKS, 1f, 1f); - } + for (Player player : UtilServer.getPlayers()) + player.playSound(player.getLocation(), Sound.NOTE_STICKS, 1f, 1f); } } } From e10a63254adf09a913a3c906317cc869941ff75e Mon Sep 17 00:00:00 2001 From: Sarah Date: Sat, 21 Nov 2015 18:16:24 +0100 Subject: [PATCH 044/113] saving typewars state --- .../arcade/game/games/typewars/TypeWars.java | 148 +++++++----------- .../tutorial/TutorialPhaseTypeWars.java | 10 +- .../typewars/tutorial/TutorialTypeWars.java | 32 ++++ .../arcade/gametutorial/TutorialPhase.java | 15 +- .../game/arcade/managers/GameManager.java | 14 +- 5 files changed, 110 insertions(+), 109 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index 939786afb..1cbeae1f9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -40,6 +40,8 @@ import nautilus.game.arcade.game.games.typewars.stats.DumbledontStatTracker; import nautilus.game.arcade.game.games.typewars.stats.HoarderStatTracker; import nautilus.game.arcade.game.games.typewars.stats.PerfectionistStatTracker; import nautilus.game.arcade.game.games.typewars.stats.WaitForItStatTracker; +import nautilus.game.arcade.game.games.typewars.tutorial.TutorialTypeWars; +import nautilus.game.arcade.gametutorial.events.GameTutorialStartEvent; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.world.WorldData; @@ -92,9 +94,6 @@ public class TypeWars extends TeamGame private HashMap _giantsAttacked; private HashSet _playerTitles; - private HashMap _playerSpawns; - - private int _tutorialFrame; public TypeWars(ArcadeManager manager) { @@ -133,6 +132,7 @@ public class TypeWars extends TeamGame this.PrepareFreeze = false; this.PlaySoundGameStart = false; this.EnableTutorials = true; + this.PrepareFreeze = true; _activeMinions = new ArrayList<>(); _deadMinions = new ArrayList<>(); @@ -149,12 +149,10 @@ public class TypeWars extends TeamGame _minionsSpawned = new HashMap<>(); _giantsAttacked = new HashMap<>(); _playerTitles = new HashSet<>(); - _playerSpawns = new HashMap<>(); _attackingMinions = new ArrayList<>(); _animationTicks = 0; _nukeFrame = 0; - _tutorialFrame = 0; registerStatTrackers( new DemonStatsTracker(this), @@ -165,24 +163,6 @@ public class TypeWars extends TeamGame manager.GetCreature().SetDisableCustomDrops(true); } - - private void initSpawns() - { - WorldData data = WorldData; - /*int i = 0; - for(String string : data.GetAllDataLocs().keySet()) - { - _minionSpawns.put(GetTeamList().get(i), data.GetDataLocs(string)); - i++; - if(i >= GetTeamList().size() -1) - return; - }*/ - _minionSpawns.put(GetTeamList().get(1), (ArrayList)data.GetDataLocs("RED").clone()); - _minionSpawns.put(GetTeamList().get(0), (ArrayList)data.GetDataLocs("LIGHT_BLUE").clone()); - - _giantAttackZones.put(GetTeamList().get(1), (ArrayList) data.GetDataLocs("MAGENTA").clone()); - _giantAttackZones.put(GetTeamList().get(0), (ArrayList) data.GetDataLocs("ORANGE").clone()); - } @EventHandler public void stateChange(GameStateChangeEvent event) @@ -319,82 +299,66 @@ public class TypeWars extends TeamGame } } - private Location _tutorialLocation; + private Location _tutorialLocationRed, _tutorialLocationBlue; - public void tutorialFrames(UpdateEvent event) + private void initSpawns() { - if(event.getType() != UpdateType.TICK) + WorldData data = WorldData; + _minionSpawns.put(GetTeamList().get(1), (ArrayList)data.GetDataLocs("RED").clone()); + _minionSpawns.put(GetTeamList().get(0), (ArrayList)data.GetDataLocs("LIGHT_BLUE").clone()); + + _giantAttackZones.put(GetTeamList().get(1), (ArrayList) data.GetDataLocs("MAGENTA").clone()); + _giantAttackZones.put(GetTeamList().get(0), (ArrayList) data.GetDataLocs("ORANGE").clone()); + + Location red = WorldData.GetDataLocs("LIME").get(0); + Location blue = WorldData.GetDataLocs("PURPLE").get(0); + + ArrayList tutorialLocations = UtilShapes.getLinesDistancedPoints(red, blue, 1); + _tutorialLocationRed = tutorialLocations.get(20).clone().add(0, 15, 0); + _tutorialLocationBlue = tutorialLocations.get(tutorialLocations.size() - 20).clone().add(0, 15, 0); + } + + @EventHandler + public void tutorialStart(GameTutorialStartEvent event) + { + Location targetRed, targetBlue; + ArrayList locations = UtilShapes.getLinesDistancedPoints(_minionSpawns.get(GetTeamList().get(0)).get(4), _minionSpawns.get(GetTeamList().get(1)).get(4), 1); + + targetRed = locations.get(locations.size() - 3); + targetBlue = locations.get(3); + if(event.getTutorial().getTeam() == GetTeamList().get(1)) + { + event.getTutorial().getPhase(1).setLocation(_tutorialLocationRed); + event.getTutorial().getPhase(1).setTarget(targetRed); + } + else + { + event.getTutorial().getPhase(1).setLocation(_tutorialLocationBlue); + event.getTutorial().getPhase(1).setTarget(targetBlue); + } + } + + @Override + public void addTutorials() + { + GetTeamList().get(0).setTutorial(new TutorialTypeWars(Manager)); + GetTeamList().get(1).setTutorial(new TutorialTypeWars(Manager)); + } + + @EventHandler + public void tutorialFrames(GameStateChangeEvent event) + { + if(event.GetState() != GameState.Live) return; - if(GetState() != GameState.Prepare) - return; - - if(_tutorialFrame < 40 + _tutorialText[1].length() + _tutorialText[2].length() + 30 + _tutorialText[3].length() + _tutorialText[4].length() + 40 && _tutorialFrame > 6) + for(Giant giant : _giants.values()) { - for(Player player : UtilServer.getPlayers()) - { - player.setAllowFlight(true); - player.setFlying(true); - player.teleport(_tutorialLocation); - } + giant.setHealth(100); } - if(_tutorialFrame == 4) - { - for(Player player : UtilServer.getPlayers()) - { - VisibilityManager.Instance.setVisibility(player, false, UtilServer.getPlayers()); - _playerSpawns.put(player, player.getLocation().clone()); - } - } - if(_tutorialFrame == 5) - { - Location red = WorldData.GetDataLocs("LIME").get(0); - Location blue = WorldData.GetDataLocs("PURPLE").get(0); - ArrayList tutorialLocations = UtilShapes.getLinesDistancedPoints(red, blue, 1); - _tutorialLocation = tutorialLocations.get(20).clone().add(0, 10, 0); - - ArrayList locations = UtilShapes.getLinesDistancedPoints(_minionSpawns.get(GetTeamList().get(0)).get(4), _minionSpawns.get(GetTeamList().get(1)).get(4), 1); - Manager.GetCreature().SetForce(true); - this.CreatureAllowOverride = true; - Minion minion = new Minion(Manager, locations.get(locations.size() - 15), _minionSpawns.get(GetTeamList().get(1)).get(4), GetTeamList().get(0), 4); - minion.changeName("Fishing"); - _activeMinions.add(minion); - this.CreatureAllowOverride = false; - Manager.GetCreature().SetForce(false); - - Vector vec = new Vector(locations.get(locations.size() - 3).getBlockX() - _tutorialLocation.getBlockX(), locations.get(locations.size() - 3).getBlockY() - _tutorialLocation.getBlockY(), locations.get(locations.size() - 3).getBlockZ() - _tutorialLocation.getBlockZ()); - float pitch = UtilAlg.GetPitch(vec); - float yaw = UtilAlg.GetYaw(vec); - _tutorialLocation.setPitch(pitch); - _tutorialLocation.setYaw(yaw); - } - if(_tutorialFrame == 40 + _tutorialText[1].length() + _tutorialText[2].length() + 30) - { - _activeMinions.get(0).despawn(null, false); - } - if(_tutorialFrame == 40 + _tutorialText[1].length() + _tutorialText[2].length() + 30 + _tutorialText[3].length() + _tutorialText[4].length() + 40) - { - for(Player player : UtilServer.getPlayers()) - { - player.setAllowFlight(false); - player.teleport(_playerSpawns.get(player)); - VisibilityManager.Instance.setVisibility(player, true, UtilServer.getPlayers()); - } - this.PrepareFreeze = true; - for(Giant giant : _giants.values()) - { - giant.setHealth(100); - } - for(Minion minion : _activeMinions) - minion.despawn(null, false, true); - - _activeMinions.clear(); - _deadMinions.clear(); - _finishedMinions.clear(); - this.PrepareTime = 5000 + (System.currentTimeMillis() - GetStateTime()); - } - _tutorialFrame++; + _activeMinions.clear(); + _deadMinions.clear(); + _finishedMinions.clear(); } private String[] _tutorialText = new String[] diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialPhaseTypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialPhaseTypeWars.java index c929da13f..206d69477 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialPhaseTypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialPhaseTypeWars.java @@ -1,5 +1,7 @@ package nautilus.game.arcade.game.games.typewars.tutorial; +import nautilus.game.arcade.game.games.typewars.Minion; +import nautilus.game.arcade.game.games.typewars.TypeWars; import nautilus.game.arcade.gametutorial.TutorialPhase; import nautilus.game.arcade.gametutorial.TutorialText; @@ -48,7 +50,13 @@ public class TutorialPhaseTypeWars extends TutorialPhase { if(text.ID() == 10) { - + for(Minion minion : ((TypeWars) getTutorial().Manager.GetGame()).getActiveMinions()) + { + if(minion.getTeam() == getTutorial().getTeam()) + { + minion.despawn(null, false); + } + } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java index e0bb16d90..2b16f04c4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java @@ -1,15 +1,47 @@ package nautilus.game.arcade.game.games.typewars.tutorial; +import java.util.ArrayList; + +import mineplex.core.common.util.UtilShapes; import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.games.typewars.Minion; +import nautilus.game.arcade.game.games.typewars.TypeWars; import nautilus.game.arcade.gametutorial.GameTutorial; import nautilus.game.arcade.gametutorial.TutorialPhase; +import org.bukkit.Location; + public class TutorialTypeWars extends GameTutorial { + private ArcadeManager _manager; + private TypeWars _typeWars; + public TutorialTypeWars(ArcadeManager manager) { super(manager, new TutorialPhase[]{new TutorialPhaseTypeWars()}); } + @Override + public void onStart() + { + _manager = Manager; + _typeWars = (TypeWars) Manager.GetGame(); + for(GameTeam team : Manager.GetGame().GetTeamList()) + { + if(team != getTeam()) + { + ArrayList locations = UtilShapes.getLinesDistancedPoints(_typeWars.getMinionSpawns().get(getTeam()).get(4), _typeWars.getMinionSpawns().get(team).get(4), 1); + _manager.GetCreature().SetForce(true); + _manager.GetGame().CreatureAllowOverride = true; + Minion minion = new Minion(_manager, locations.get(locations.size() - 15), _typeWars.getMinionSpawns().get(team).get(4), getTeam(), 4); + minion.changeName("Fishing"); + ((TypeWars) _manager.GetGame()).getActiveMinions().add(minion); + _manager.GetGame().CreatureAllowOverride = false; + _manager.GetCreature().SetForce(false); + } + } + } + } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/TutorialPhase.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/TutorialPhase.java index 1082fe6db..a157ed847 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/TutorialPhase.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/TutorialPhase.java @@ -114,7 +114,8 @@ public abstract class TutorialPhase i++; } UtilTextMiddle.display("", text.getText(), 0, text.getStayTime(), 0, players); - displayMessage(text); + System.out.println(text.ID()); + onMessageDisplay(text); try { Thread.sleep(text.getStayTime() * 50); @@ -129,18 +130,6 @@ public abstract class TutorialPhase }).start(); } - private void displayMessage(final TutorialText text) - { - _tutorial.Manager.runSync(new Runnable() - { - @Override - public void run() - { - onMessageDisplay(text); - } - }); - } - protected TutorialText getNextMessage() { for(TutorialText text : _text) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java index 37ffdc79c..e97b6ea88 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java @@ -145,14 +145,22 @@ public class GameManager implements Listener } if(game.EnableTutorials) { - for(GameTeam team : game.GetTeamList()) + for(final GameTeam team : game.GetTeamList()) { if(team.getTutorial() != null) { if(!team.getTutorial().hasStarted()) { - team.getTutorial().setTeam(team); - team.getTutorial().start(); + Manager.runSync(new Runnable() + { + + @Override + public void run() + { + team.getTutorial().setTeam(team); + team.getTutorial().start(); + } + }); } if(!team.getTutorial().hasEnded()) { From 171696ff0d26eb1018a7fcefa35253d4da190f46 Mon Sep 17 00:00:00 2001 From: Sarah Date: Sat, 21 Nov 2015 18:24:17 +0100 Subject: [PATCH 045/113] final tutorial implementation. --- .../nautilus/game/arcade/managers/GameManager.java | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java index ea7aca1f7..6d97f0003 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java @@ -146,22 +146,14 @@ public class GameManager implements Listener boolean finished = true; if(game.EnableTutorials) { - for(final GameTeam team : game.GetTeamList()) + for(GameTeam team : game.GetTeamList()) { if(team.getTutorial() != null) { if(!team.getTutorial().hasStarted()) { - Manager.runSync(new Runnable() - { - - @Override - public void run() - { - team.getTutorial().setTeam(team); - team.getTutorial().start(); - } - }); + team.getTutorial().setTeam(team); + team.getTutorial().start(); } if(!team.getTutorial().hasEnded()) { From 7708f879dc5c1e008bfb8023066d486572cdc2c4 Mon Sep 17 00:00:00 2001 From: Sarah Date: Tue, 24 Nov 2015 16:15:07 +0100 Subject: [PATCH 046/113] Fixing attack damage. --- .../arcade/game/games/typewars/TypeWars.java | 89 ++++++++++--------- .../stats/PerfectionistStatTracker.java | 7 +- 2 files changed, 54 insertions(+), 42 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index 1cbeae1f9..55dfd5496 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -371,35 +371,44 @@ public class TypeWars extends TeamGame }; @EventHandler - public void test(PlayerCommandPreprocessEvent event) - { - if(!event.getMessage().contains("/Boss")) - return; - + public void testCommands(PlayerCommandPreprocessEvent event) + { if(GetState() != GameState.Live) return; if(!Manager.GetClients().Get(event.getPlayer()).GetRank().has(event.getPlayer(), Rank.DEVELOPER, true)) return; - - event.setCancelled(true); - if(!IsPlaying(event.getPlayer())) - return; - - GameTeam teams = GetTeam(event.getPlayer()); - for(GameTeam team : GetTeamList()) + if(event.getMessage().contains("/Money")) { - if(team == teams) - continue; - - int rdm = UtilMath.r(_minionSpawns.get(teams).size()); - this.CreatureAllowOverride = true; - Minion minion = new Minion(Manager, _minionSpawns.get(teams).get(rdm), _minionSpawns.get(team).get(rdm), teams, event.getPlayer(), true, MinionSize.BOSS.getRandomType(), rdm); - _activeMinions.add(minion); - this.CreatureAllowOverride = false; - UtilPlayer.message(event.getPlayer(), F.main("Boss", "You have spawned a Boss")); + _moneyMap.put(event.getPlayer(), 1000); + UtilPlayer.message(event.getPlayer(), F.main("Money", "You got some Money")); + event.setCancelled(true); + return; } + + if(event.getMessage().contains("/Boss")) + { + if(!IsPlaying(event.getPlayer())) + return; + + + event.setCancelled(true); + GameTeam teams = GetTeam(event.getPlayer()); + for(GameTeam team : GetTeamList()) + { + if(team == teams) + continue; + + int rdm = UtilMath.r(_minionSpawns.get(teams).size()); + this.CreatureAllowOverride = true; + Minion minion = new Minion(Manager, _minionSpawns.get(teams).get(rdm), _minionSpawns.get(team).get(rdm), teams, event.getPlayer(), true, MinionSize.BOSS.getRandomType(), rdm); + _activeMinions.add(minion); + this.CreatureAllowOverride = false; + UtilPlayer.message(event.getPlayer(), F.main("Boss", "You have spawned a Boss")); + } + } + } @EventHandler @@ -562,7 +571,8 @@ public class TypeWars extends TeamGame } else { - _finishedMinions.add(minion); + if(!_finishedMinions.contains(minion)) + _finishedMinions.add(minion); } } } @@ -635,29 +645,28 @@ public class TypeWars extends TeamGame if(event.getType() != UpdateType.SEC) return; - HashMap minions = new HashMap<>(); - for(Minion minion : _finishedMinions) - { - if(minion.getEntity().isDead()) - continue; - - if(!minions.containsKey(minion.getTeam())) - { - minions.put(minion.getTeam(), 1); - continue; - } - int i = minions.get(minion.getTeam()); - minions.put(minion.getTeam(), i + 1); - } for(GameTeam team : _giants.keySet()) { - for(GameTeam otherTeam : minions.keySet()) + int damage = 0; + for(Minion minion : _finishedMinions) + { + if(minion.getTeam() == team) + continue; + + if(minion.getEntity().isDead()) + continue; + + damage++; + } + if(damage == 0) + continue; + + for(GameTeam otherTeam : GetTeamList()) { if(team != otherTeam) { _giants.get(team).getWorld().playSound(_giants.get(team).getEyeLocation(), Sound.ZOMBIE_HURT, 100, 1); - if(minions.containsKey(otherTeam)) - _giants.get(team).damage(minions.get(otherTeam)); + _giants.get(team).damage(damage); } } if(_giantsAttacked.containsKey(team)) @@ -670,7 +679,7 @@ public class TypeWars extends TeamGame { if(GetTeam(player) == team) { - UtilTextMiddle.display("", "Your giant is under Attack!", player); + UtilTextMiddle.display("", "Your giant is under Attack!", 0, 30, 9, player); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/PerfectionistStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/PerfectionistStatTracker.java index 8ffeb57a1..f84200bd0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/PerfectionistStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/PerfectionistStatTracker.java @@ -69,8 +69,11 @@ public class PerfectionistStatTracker extends StatTracker { if(player.isOnline()) { - if(_playerWords.get(player) >= 5) - addStat(player, "Perfectionist", 1, true, false); + if(_playerWords.containsKey(player)) + { + if(_playerWords.get(player) >= 5) + addStat(player, "Perfectionist", 1, true, false); + } } } } From 2a64d06bddf8d0cd372dd8e0cbb7010987820574 Mon Sep 17 00:00:00 2001 From: Sarah Date: Tue, 24 Nov 2015 16:24:22 +0100 Subject: [PATCH 047/113] removing some debug. --- .../src/nautilus/game/arcade/gametutorial/TutorialPhase.java | 1 - 1 file changed, 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/TutorialPhase.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/TutorialPhase.java index 01dbc8df6..75a2a0a59 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/TutorialPhase.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/TutorialPhase.java @@ -114,7 +114,6 @@ public abstract class TutorialPhase i++; } UtilTextMiddle.display("", text.getText(), 0, text.getStayTime(), 0, players); - System.out.println(text.ID()); onMessageDisplay(text); try { From de9262882a42672da635152f6f1b8b18cdcba026 Mon Sep 17 00:00:00 2001 From: Sarah Date: Wed, 25 Nov 2015 16:03:13 +0100 Subject: [PATCH 048/113] fixing "enemy's" and some merge isssues. --- .../typewars/tutorial/TutorialPhaseTypeWars.java | 2 +- .../game/arcade/gametutorial/TutorialPhase.java | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialPhaseTypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialPhaseTypeWars.java index 206d69477..38a170428 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialPhaseTypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialPhaseTypeWars.java @@ -22,7 +22,7 @@ public class TutorialPhaseTypeWars extends TutorialPhase new TutorialText("Fishi_", 7, 8), new TutorialText("Fishin_", 7, 9), new TutorialText("Fishing_", 7, 10), - new TutorialText("Kill your enemies giant before they kill yours.", 11), + new TutorialText("Kill your enemy's giant before they kill yours.", 11), new TutorialText("Good luck!", 12) }); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/TutorialPhase.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/TutorialPhase.java index 3689fb44b..716e38af8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/TutorialPhase.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/TutorialPhase.java @@ -114,7 +114,8 @@ public abstract class TutorialPhase i++; } displayMessage(text); - UtilTextMiddle.display("", text.getText(), 0, text.getStayTime(), 0, players); try + UtilTextMiddle.display("", text.getText(), 0, text.getStayTime(), 0, players); + try { Thread.sleep(text.getStayTime() * 50); } catch (InterruptedException e) @@ -128,6 +129,18 @@ public abstract class TutorialPhase }).start(); } + private void displayMessage(final TutorialText text) + { + getTutorial().Manager.runSync(new Runnable() + { + @Override + public void run() + { + onMessageDisplay(text); + } + }); + } + protected TutorialText getNextMessage() { for(TutorialText text : _text) From 32ee1c285af8a167785616f27a90d5468e27745c Mon Sep 17 00:00:00 2001 From: Sarah Date: Thu, 26 Nov 2015 00:29:28 +0100 Subject: [PATCH 049/113] merging pregametutorial into type wars. --- .../game/games/typewars/tutorial/TutorialPhaseTypeWars.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialPhaseTypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialPhaseTypeWars.java index 38a170428..18e6fdd2b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialPhaseTypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialPhaseTypeWars.java @@ -22,8 +22,7 @@ public class TutorialPhaseTypeWars extends TutorialPhase new TutorialText("Fishi_", 7, 8), new TutorialText("Fishin_", 7, 9), new TutorialText("Fishing_", 7, 10), - new TutorialText("Kill your enemy's giant before they kill yours.", 11), - new TutorialText("Good luck!", 12) + new TutorialText("Kill your enemy's giant before they kill yours.", 11) }); } From 9f3c3589b255c00e85fc7a919947637ee5798ba9 Mon Sep 17 00:00:00 2001 From: Sarah Date: Thu, 26 Nov 2015 16:09:29 +0100 Subject: [PATCH 050/113] Particle render distance. --- .../nautilus/game/arcade/game/games/typewars/TypeWars.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index 55dfd5496..6cc14c900 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -628,7 +628,7 @@ public class TypeWars extends TeamGame giant.teleport(loc); giant.getWorld().playSound(giant.getLocation(), Sound.ZOMBIE_WOODBREAK, 100, 1); giant.getWorld().playSound(giant.getLocation(), Sound.ZOMBIE_IDLE, 1, 1); - UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, minion.getEntity().getLocation(), 0, 0, 0, 1, 1, ViewDist.NORMAL, UtilServer.getPlayers()); + UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, minion.getEntity().getLocation(), 0, 0, 0, 1, 1, ViewDist.LONG, UtilServer.getPlayers()); minion.despawn(null, true); if(!minion.hasLives()) @@ -1139,7 +1139,7 @@ public class TypeWars extends TeamGame if(cansee) { - UtilParticle.PlayParticle(UtilParticle.ParticleType.HUGE_EXPLOSION, location, 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers()); + UtilParticle.PlayParticle(UtilParticle.ParticleType.HUGE_EXPLOSION, location, 0, 0, 0, 0, 1, ViewDist.LONG, UtilServer.getPlayers()); for(Player players : GetPlayers(false)) players.playSound(location, Sound.EXPLODE, 1, 1); } From efc05803ac8598cde94f2fe0faa54a0f001e6d14 Mon Sep 17 00:00:00 2001 From: Sarah Date: Thu, 26 Nov 2015 16:25:44 +0100 Subject: [PATCH 051/113] Minion spawn. --- .../arcade/game/games/typewars/tutorial/TutorialTypeWars.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java index 2b16f04c4..591255cb7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java @@ -35,7 +35,7 @@ public class TutorialTypeWars extends GameTutorial ArrayList locations = UtilShapes.getLinesDistancedPoints(_typeWars.getMinionSpawns().get(getTeam()).get(4), _typeWars.getMinionSpawns().get(team).get(4), 1); _manager.GetCreature().SetForce(true); _manager.GetGame().CreatureAllowOverride = true; - Minion minion = new Minion(_manager, locations.get(locations.size() - 15), _typeWars.getMinionSpawns().get(team).get(4), getTeam(), 4); + Minion minion = new Minion(_manager, locations.get(locations.size() - 25), _typeWars.getMinionSpawns().get(team).get(4), getTeam(), 4); minion.changeName("Fishing"); ((TypeWars) _manager.GetGame()).getActiveMinions().add(minion); _manager.GetGame().CreatureAllowOverride = false; From 9e1d522876d4cbd9bbb8539f716734e459e14074 Mon Sep 17 00:00:00 2001 From: Sarah Date: Thu, 26 Nov 2015 16:47:31 +0100 Subject: [PATCH 052/113] Increase Render distance on particles, Don't spawn mob until "protect him from evil minions" title appears and changing some timings. --- .../game/games/typewars/tutorial/TutorialPhaseTypeWars.java | 2 +- .../arcade/game/games/typewars/tutorial/TutorialTypeWars.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialPhaseTypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialPhaseTypeWars.java index 18e6fdd2b..0c6c64898 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialPhaseTypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialPhaseTypeWars.java @@ -21,7 +21,7 @@ public class TutorialPhaseTypeWars extends TutorialPhase new TutorialText("Fish_", 7, 7), new TutorialText("Fishi_", 7, 8), new TutorialText("Fishin_", 7, 9), - new TutorialText("Fishing_", 7, 10), + new TutorialText("Fishing_", 30, 10), new TutorialText("Kill your enemy's giant before they kill yours.", 11) }); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java index 591255cb7..dfff09de9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java @@ -35,7 +35,7 @@ public class TutorialTypeWars extends GameTutorial ArrayList locations = UtilShapes.getLinesDistancedPoints(_typeWars.getMinionSpawns().get(getTeam()).get(4), _typeWars.getMinionSpawns().get(team).get(4), 1); _manager.GetCreature().SetForce(true); _manager.GetGame().CreatureAllowOverride = true; - Minion minion = new Minion(_manager, locations.get(locations.size() - 25), _typeWars.getMinionSpawns().get(team).get(4), getTeam(), 4); + Minion minion = new Minion(_manager, locations.get(locations.size() - 27), _typeWars.getMinionSpawns().get(team).get(4), getTeam(), 4); minion.changeName("Fishing"); ((TypeWars) _manager.GetGame()).getActiveMinions().add(minion); _manager.GetGame().CreatureAllowOverride = false; From b0e16f6612ab841a061937b99fb3c2227b903e2c Mon Sep 17 00:00:00 2001 From: Sarah Date: Tue, 1 Dec 2015 17:05:55 +0100 Subject: [PATCH 053/113] Zombie smash Color. --- .../game/games/typewars/spells/SpellKillEverything.java | 2 +- .../nautilus/game/arcade/gametutorial/TutorialPhase.java | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellKillEverything.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellKillEverything.java index b8eb8a571..12b1cd34e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellKillEverything.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellKillEverything.java @@ -40,7 +40,7 @@ public class SpellKillEverything extends Spell public boolean execute(Player player, Location location) { - UtilTextMiddle.display("", player.getName() + " used a Zombie Smash", 0, 40, 0); + UtilTextMiddle.display("", getManager().GetGame().GetTeam(player).GetColor() + player.getName() + " used a Zombie Smash", 0, 40, 0); ArrayList minionList = new ArrayList<>(); Iterator minionIterator = getTypeWars().getActiveMinions().iterator(); while(minionIterator.hasNext()) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/TutorialPhase.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/TutorialPhase.java index 3ec45651f..00cc4832e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/TutorialPhase.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/TutorialPhase.java @@ -142,8 +142,10 @@ public abstract class TutorialPhase private void displayMessage(final TutorialText text) { - if(_tutorial.RunTasksSync) - _tutorial.Manager.runSync(new Runnable() { + if(_tutorial.RunTasksSync) + { + _tutorial.Manager.runSync(new Runnable() + { @Override public void run() { From a3d6af884d372cd388a5e6e597896d043733260b Mon Sep 17 00:00:00 2001 From: Sarah Date: Sat, 5 Dec 2015 00:57:27 +0100 Subject: [PATCH 054/113] spawns after tutorial and Giants facing each other. --- .../arcade/game/games/typewars/TypeWars.java | 44 ++++++++++++------- .../typewars/tutorial/TutorialTypeWars.java | 1 + 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index 6cc14c900..d88cc777c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -21,12 +21,10 @@ import mineplex.core.common.util.UtilShapes; import mineplex.core.common.util.UtilTextBottom; import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilWorld; import mineplex.core.hologram.Hologram; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import mineplex.core.visibility.VisibilityManager; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; @@ -41,6 +39,7 @@ import nautilus.game.arcade.game.games.typewars.stats.HoarderStatTracker; import nautilus.game.arcade.game.games.typewars.stats.PerfectionistStatTracker; import nautilus.game.arcade.game.games.typewars.stats.WaitForItStatTracker; import nautilus.game.arcade.game.games.typewars.tutorial.TutorialTypeWars; +import nautilus.game.arcade.gametutorial.events.GameTutorialEndEvent; import nautilus.game.arcade.gametutorial.events.GameTutorialStartEvent; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.world.WorldData; @@ -50,7 +49,6 @@ import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; -import org.bukkit.entity.Creeper; import org.bukkit.entity.EntityType; import org.bukkit.entity.Giant; import org.bukkit.entity.Player; @@ -72,7 +70,6 @@ public class TypeWars extends TeamGame private ArrayList _activeMinions; private ArrayList _deadMinions; private ArrayList _finishedMinions; - private ArrayList _attackingMinions; private HashMap _moneyMap; @@ -149,7 +146,6 @@ public class TypeWars extends TeamGame _minionsSpawned = new HashMap<>(); _giantsAttacked = new HashMap<>(); _playerTitles = new HashSet<>(); - _attackingMinions = new ArrayList<>(); _animationTicks = 0; _nukeFrame = 0; @@ -201,21 +197,15 @@ public class TypeWars extends TeamGame Location red = WorldData.GetDataLocs("PURPLE").get(0); Location blue = WorldData.GetDataLocs("LIME").get(0); - for (int i = 0; i < 4; i++) - { - red.getWorld().getBlockAt(red).setType(Material.STONE); - blue.getWorld().getBlockAt(blue).setType(Material.STONE); - - red.add(0, 1, 0); - blue.add(0,1,0); - } + red.setPitch(UtilAlg.GetPitch(UtilAlg.getTrajectory(red, blue))); + red.setYaw(UtilAlg.GetYaw(UtilAlg.getTrajectory(red, blue))); + + blue.setPitch(UtilAlg.GetPitch(UtilAlg.getTrajectory(blue, red))); + blue.setYaw(UtilAlg.GetYaw(UtilAlg.getTrajectory(blue, red))); red.add(0, 1, 0); blue.add(0, 1, 0); - red.setYaw(UtilAlg.GetYaw(new Vector(blue.getBlockX() - red.getBlockX(), blue.getBlockY() - red.getBlockY(), blue.getBlockZ() - red.getBlockZ()))); - blue.setYaw(UtilAlg.GetYaw(new Vector(red.getBlockX() - blue.getBlockX(), red.getBlockY() - blue.getBlockY(), red.getBlockZ() - blue.getBlockZ()))); - int i = 0; for(GameTeam team : GetTeamList()) { @@ -338,6 +328,28 @@ public class TypeWars extends TeamGame } } + @EventHandler + public void tutorialEnd(GameTutorialEndEvent event) + { + int i = 0; + for(Player player : event.getTutorial().getPlayers().keySet()) + { + Location location = event.getTutorial().getTeam().GetSpawns().get(i); + for(GameTeam team : GetTeamList()) + { + if(team != event.getTutorial().getTeam()) + { + location.setPitch(UtilAlg.GetPitch(UtilAlg.getTrajectory(location, _giants.get(team).getLocation()))); + location.setYaw(UtilAlg.GetYaw(UtilAlg.getTrajectory(location, _giants.get(team).getLocation()))); + } + } + player.teleport(location); + i++; + if(i >= event.getTutorial().getTeam().GetSpawns().size()) + i = 0; + } + } + @Override public void addTutorials() { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java index dfff09de9..03d660b83 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java @@ -21,6 +21,7 @@ public class TutorialTypeWars extends GameTutorial public TutorialTypeWars(ArcadeManager manager) { super(manager, new TutorialPhase[]{new TutorialPhaseTypeWars()}); + this.TeleportOnEnd = false; } @Override From 4c4b9974530d508ff20b2db53c37a59d6f8b446f Mon Sep 17 00:00:00 2001 From: Sarah Date: Sat, 5 Dec 2015 19:00:44 +0100 Subject: [PATCH 055/113] fixing giant facing. --- .../arcade/game/games/typewars/TypeWars.java | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index d88cc777c..709bc68a7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -87,6 +87,7 @@ public class TypeWars extends TeamGame private HashMap> _giantAttackZones; private HashMap _giants; + private HashMap _giantLocs; private HashMap _minionsSpawned; private HashMap _giantsAttacked; @@ -146,6 +147,7 @@ public class TypeWars extends TeamGame _minionsSpawned = new HashMap<>(); _giantsAttacked = new HashMap<>(); _playerTitles = new HashSet<>(); + _giantLocs = new HashMap<>(); _animationTicks = 0; _nukeFrame = 0; @@ -194,17 +196,17 @@ public class TypeWars extends TeamGame public void prepareGiants() { - Location red = WorldData.GetDataLocs("PURPLE").get(0); - Location blue = WorldData.GetDataLocs("LIME").get(0); + Location red = WorldData.GetDataLocs("PURPLE").get(0).clone(); + Location blue = WorldData.GetDataLocs("LIME").get(0).clone(); - red.setPitch(UtilAlg.GetPitch(UtilAlg.getTrajectory(red, blue))); red.setYaw(UtilAlg.GetYaw(UtilAlg.getTrajectory(red, blue))); - - blue.setPitch(UtilAlg.GetPitch(UtilAlg.getTrajectory(blue, red))); blue.setYaw(UtilAlg.GetYaw(UtilAlg.getTrajectory(blue, red))); - red.add(0, 1, 0); - blue.add(0, 1, 0); + red.getBlock().setType(Material.STONE); + blue.getBlock().setType(Material.STONE); + + red.add(0, 2, 0); + blue.add(0, 2, 0); int i = 0; for(GameTeam team : GetTeamList()) @@ -215,6 +217,7 @@ public class TypeWars extends TeamGame this.CreatureAllowOverride = true; Giant giant = loc.getWorld().spawn(loc, Giant.class); + _giantLocs.put(giant, loc.clone()); this.CreatureAllowOverride = false; giant.setRemoveWhenFarAway(false); UtilEnt.Vegetate(giant, true); @@ -266,6 +269,18 @@ public class TypeWars extends TeamGame } } + @EventHandler + public void fixGiants(UpdateEvent event) + { + if(event.getType() != UpdateType.TICK) + return; + + for(Giant giant : _giantLocs.keySet()) + { + giant.teleport(_giantLocs.get(giant)); + } + } + @EventHandler public void Players(UpdateEvent event) { From 90c6d0a83ff343034eebec13c7e7c8883d523a67 Mon Sep 17 00:00:00 2001 From: Sarah Date: Sat, 5 Dec 2015 22:17:45 +0100 Subject: [PATCH 056/113] spelling fixes, disabling Particles, fixing mob limit. --- .../src/nautilus/game/arcade/game/games/typewars/Minion.java | 2 +- .../nautilus/game/arcade/game/games/typewars/TypeWars.java | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java index 1b0fcc70d..dab5f7c72 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java @@ -96,7 +96,7 @@ public class Minion "Muscles", "Invader", "Grandpa", "Confirm", "Speaker", "Wizards", "Stacker", "Feather", "Channel", "Thunder", "Marbles", "Contest", "Grandma", "History", "Minigun", "Skywars", "Turtwig", "Morning", "Explode", "Factory", "Polygon", "Teacher", "Royalty", "Balcony", "Android", "Monster", "Emerald", "Primate", "Village", "Company", - "Degrees", "Glacier", "Cricket", "Partner", "Mideval", "Gravity", "Surgeon", "Volcano", "Forward", "Console", + "Degrees", "Glacier", "Cricket", "Partner", "Medieval", "Gravity", "Surgeon", "Volcano", "Forward", "Console", "Hexagon", "Cyclops", "Kung-fu", "Bonjour", "Painter", "Snowman", "Caramel", "Lullaby", "Sparrow", "Blowgun", "Octagon", "January", "Century", "Bowling", "Plumber", "Explore", "Healing", "Circuit", "Vampire", "Distort", "Nonagon", "October", "Lockers", "Justice", "England", "Pancake", "Whisper", "Voltage", "Ceramic", "Avenger", diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index 709bc68a7..5f3df4322 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -131,6 +131,7 @@ public class TypeWars extends TeamGame this.PlaySoundGameStart = false; this.EnableTutorials = true; this.PrepareFreeze = true; + this.AllowParticles = false; _activeMinions = new ArrayList<>(); _deadMinions = new ArrayList<>(); @@ -461,9 +462,9 @@ public class TypeWars extends TeamGame { if(teams != team) { - if(getMinions(team).size() >= 60) + if(getMinions(teams).size() >= 60) { - UtilTextMiddle.display("", ChatColor.GRAY + "Your Team cant have more than 60 Minions", event.getPlayer()); + UtilTextMiddle.display("", ChatColor.GRAY + "Your Team cant have more than 60 Minions", 5, 30, 5); return; } From 114ae33d89755f6adf2a43ecfa803ab1bf5a4c05 Mon Sep 17 00:00:00 2001 From: Sarah Date: Sun, 6 Dec 2015 00:00:50 +0100 Subject: [PATCH 057/113] fixing spawns and monster slowdown. --- .../arcade/game/games/typewars/TypeWars.java | 37 ++++++++++++------- .../typewars/tutorial/TutorialTypeWars.java | 1 - 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index 5f3df4322..f6cc42a73 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -49,6 +49,7 @@ import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.entity.EntityType; import org.bukkit.entity.Giant; import org.bukkit.entity.Player; @@ -310,6 +311,13 @@ public class TypeWars extends TeamGame private void initSpawns() { WorldData data = WorldData; + + ((CraftWorld) data.World).getHandle().spigotConfig.animalActivationRange = 200; + ((CraftWorld) data.World).getHandle().spigotConfig.monsterActivationRange = 200; + + ((CraftWorld) data.World).getHandle().spigotConfig.animalTrackingRange = 200; + ((CraftWorld) data.World).getHandle().spigotConfig.monsterTrackingRange = 200; + _minionSpawns.put(GetTeamList().get(1), (ArrayList)data.GetDataLocs("RED").clone()); _minionSpawns.put(GetTeamList().get(0), (ArrayList)data.GetDataLocs("LIGHT_BLUE").clone()); @@ -345,25 +353,28 @@ public class TypeWars extends TeamGame } @EventHandler - public void tutorialEnd(GameTutorialEndEvent event) + public void tutorialEnd(final GameTutorialEndEvent event) { - int i = 0; - for(Player player : event.getTutorial().getPlayers().keySet()) + Manager.runSyncLater(new Runnable() { - Location location = event.getTutorial().getTeam().GetSpawns().get(i); - for(GameTeam team : GetTeamList()) + @Override + public void run() { - if(team != event.getTutorial().getTeam()) + for(Player player : event.getTutorial().getPlayers().keySet()) { - location.setPitch(UtilAlg.GetPitch(UtilAlg.getTrajectory(location, _giants.get(team).getLocation()))); - location.setYaw(UtilAlg.GetYaw(UtilAlg.getTrajectory(location, _giants.get(team).getLocation()))); + Location location = player.getLocation().clone(); + for(GameTeam team : GetTeamList()) + { + if(team != event.getTutorial().getTeam()) + { + location.setPitch(UtilAlg.GetPitch(UtilAlg.getTrajectory(location, _giants.get(team).getLocation()))); + location.setYaw(UtilAlg.GetYaw(UtilAlg.getTrajectory(location, _giants.get(team).getLocation()))); + } + } + player.teleport(location); } } - player.teleport(location); - i++; - if(i >= event.getTutorial().getTeam().GetSpawns().size()) - i = 0; - } + }, 7); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java index 03d660b83..dfff09de9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java @@ -21,7 +21,6 @@ public class TutorialTypeWars extends GameTutorial public TutorialTypeWars(ArcadeManager manager) { super(manager, new TutorialPhase[]{new TutorialPhaseTypeWars()}); - this.TeleportOnEnd = false; } @Override From 11b2748a5a9a217bc9ac4f9e2bbfecf7b796613d Mon Sep 17 00:00:00 2001 From: Mysticate Date: Sun, 6 Dec 2015 11:45:10 -0500 Subject: [PATCH 058/113] Quick thing before merge --- .../arcade/game/games/paintball/Paintball.java | 17 ++++++----------- .../kits/perks/PerkPaintballSniper.java | 4 ++-- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java index 3eabf69b5..12f0e47f7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java @@ -15,7 +15,6 @@ import org.bukkit.block.Block; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Arrow; import org.bukkit.entity.EnderPearl; -import org.bukkit.entity.HumanEntity; import org.bukkit.entity.Player; import org.bukkit.entity.Snowball; import org.bukkit.entity.ThrownPotion; @@ -93,6 +92,8 @@ public class Paintball extends TeamGame StrictAntiHack = true; HungerSet = 20; + + InventoryClick = false; registerStatTrackers( new KillingSpreeTracker(this), @@ -135,7 +136,7 @@ public class Paintball extends TeamGame if (event.getCause() == TeleportCause.ENDER_PEARL) event.setCancelled(true); } - + @SuppressWarnings("deprecation") @EventHandler public void Paint(final ProjectileHitEvent event) @@ -198,9 +199,9 @@ public class Paintball extends TeamGame if (_doubles.containsKey(player)) { - PlayerCopy copy = _doubles.get(player); + PlayerCopy copy = _doubles.remove(player); copy.GetEntity().remove(); - _doubles.remove(player); + copy.GetHolo().stop(); } } @@ -297,14 +298,8 @@ public class Paintball extends TeamGame @EventHandler public void ArmorRemoveCancel(InventoryClickEvent event) { - HumanEntity player = event.getWhoClicked(); - - // Fixed armor being taken off while spectating after being painted. - - if (!IsAlive(player)) - { + if (!IsAlive(event.getWhoClicked())) event.setCancelled(true); - } } public boolean Color(Player player, int amount) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballSniper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballSniper.java index 80ecdec5c..657f2e3d7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballSniper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballSniper.java @@ -285,8 +285,8 @@ public class PerkPaintballSniper extends Perk if (Manager.GetCondition().HasCondition(player, ConditionType.SLOW, GetName())) Manager.GetCondition().EndCondition(player, ConditionType.SLOW, GetName()); - if (Manager.GetCondition().HasCondition(player, ConditionType.JUMP, GetName())) - Manager.GetCondition().EndCondition(player, ConditionType.JUMP, GetName()); +// if (Manager.GetCondition().HasCondition(player, ConditionType.JUMP, GetName())) +// Manager.GetCondition().EndCondition(player, ConditionType.JUMP, GetName()); } private void addEffects(Player player) From 3260550368b7b2496902486fde53aa8bdd431d13 Mon Sep 17 00:00:00 2001 From: Sarah Date: Sun, 6 Dec 2015 19:38:23 +0100 Subject: [PATCH 059/113] adding proper forcefield for minions and giants. --- .../arcade/game/games/typewars/TypeWars.java | 40 ++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index f6cc42a73..178aaa162 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -23,6 +23,7 @@ import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTime; import mineplex.core.hologram.Hologram; import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; @@ -50,6 +51,7 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.Giant; import org.bukkit.entity.Player; @@ -287,7 +289,7 @@ public class TypeWars extends TeamGame public void Players(UpdateEvent event) { - if(GetState() != GameState.Live) + if(GetState() != GameState.Live && GetState() != GameState.Prepare && GetState() != GameState.End) return; for(Player player : GetPlayers(true)) @@ -306,6 +308,42 @@ public class TypeWars extends TeamGame } } + @EventHandler + public void ForcefieldUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTER) + return; + + for (Minion minion : _activeMinions) + { + for (Player other : UtilServer.getPlayers()) + { + if (UtilMath.offset(other, minion.getEntity()) > 2) + continue; + + if (Recharge.Instance.use(other, "Forcefield Bump", 500, false, false)) + { + UtilAction.velocity(other, UtilAlg.getTrajectory2d(minion.getEntity(), other), 1.6, true, 0.8, 0, 10, true); + other.getWorld().playSound(other.getLocation(), Sound.CHICKEN_EGG_POP, 2f, 0.5f); + } + } + } + for (Giant giant : _giants.values()) + { + for (Player other : UtilServer.getPlayers()) + { + if (UtilMath.offset(other, giant) > 7) + continue; + + if (Recharge.Instance.use(other, "Forcefield Bump", 500, false, false)) + { + UtilAction.velocity(other, UtilAlg.getTrajectory2d(giant, other), 1.6, true, 0.8, 0, 10, true); + other.getWorld().playSound(other.getLocation(), Sound.CHICKEN_EGG_POP, 2f, 0.5f); + } + } + } + } + private Location _tutorialLocationRed, _tutorialLocationBlue; private void initSpawns() From 5e57caa94db2ae55b1c4ef6d3d010c9749813a03 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Sun, 6 Dec 2015 17:09:33 -0500 Subject: [PATCH 060/113] Final tweaks to random armorstand --- .../games/paintball/PlayerCopyPaintball.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopyPaintball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopyPaintball.java index 84e8336c9..595aa9889 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopyPaintball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopyPaintball.java @@ -11,8 +11,8 @@ import org.bukkit.inventory.meta.SkullMeta; import org.bukkit.util.EulerAngle; import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; import mineplex.core.hologram.Hologram; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.game.Game; @@ -32,6 +32,9 @@ public class PlayerCopyPaintball _owner = owner; + Location entLoc = owner.getLocation(); + entLoc.setPitch(0F); + Host.CreatureAllowOverride = true; _ent = owner.getWorld().spawn(owner.getLocation(), ArmorStand.class); Host.CreatureAllowOverride = false; @@ -44,9 +47,15 @@ public class PlayerCopyPaintball _ent.setBasePlate(false); _ent.setVisible(false); - Location loc = owner.getLocation(); - _ent.teleport(owner); - _ent.setHeadPose(new EulerAngle(Math.toRadians(UtilAlg.GetPitch(loc.getDirection())), Math.toRadians(UtilAlg.GetYaw(loc.getDirection())), 0)); + //Rand pose + int rA = UtilMath.r(20) - 3; + int lA = UtilMath.r(20) - 3; + int rL = UtilMath.r(20) - 3; + int lL = UtilMath.r(20) - 3; + _ent.setRightArmPose(new EulerAngle(Math.toRadians(rA < 0 ? 360 - rA : rA), 0, Math.toRadians(Math.abs(rA)))); + _ent.setRightLegPose(new EulerAngle(Math.toRadians(rL < 0 ? 360 - rL : rL), 0, Math.toRadians(Math.abs(rL)))); + _ent.setLeftArmPose(new EulerAngle(Math.toRadians(lA < 0 ? 360 - lA : lA), 0, Math.toRadians(360 - Math.abs(lA)))); + _ent.setLeftLegPose(new EulerAngle(Math.toRadians(lL < 0 ? 360 - lL : rA), 0, Math.toRadians(360 - Math.abs(lL)))); //Armor _ent.getEquipment().setArmorContents(owner.getInventory().getArmorContents()); From b5967a12059ccd3cf3bbaba796152e8758937125 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Sun, 6 Dec 2015 17:14:51 -0500 Subject: [PATCH 061/113] Uncommented bouncy balls --- .../src/nautilus/game/arcade/GameType.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java index bbde4499e..5eedb306e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java @@ -8,6 +8,7 @@ import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.games.baconbrawl.BaconBrawl; import nautilus.game.arcade.game.games.barbarians.Barbarians; import nautilus.game.arcade.game.games.bossbattles.BossBattles; +import nautilus.game.arcade.game.games.bouncyballs.BouncyBalls; import nautilus.game.arcade.game.games.bridge.Bridge; import nautilus.game.arcade.game.games.build.Build; import nautilus.game.arcade.game.games.cards.Cards; @@ -128,7 +129,7 @@ public enum GameType MonsterMaze(MonsterMaze.class, GameDisplay.MonsterMaze), MonsterLeague(MonsterLeague.class, GameDisplay.MonsterLeague), -// BouncyBalls(BouncyBalls.class, GameDisplay.BouncyBalls), + BouncyBalls(BouncyBalls.class, GameDisplay.BouncyBalls), Event(EventGame.class, GameDisplay.Event, new GameType[]{ GameType.BaconBrawl, GameType.Barbarians, GameType.Bridge, GameType.Build, GameType.Build, From 09f7a03444e903467e83e966efb8233785a9c849 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Sun, 6 Dec 2015 20:00:22 -0500 Subject: [PATCH 062/113] Quick changes to improve things. --- .../src/mineplex/core/hologram/Hologram.java | 7 +- .../game/core/damage/CustomDamageEvent.java | 15 +++- .../game/core/damage/DamageManager.java | 2 +- .../game/games/paintball/Paintball.java | 86 ++++++++++++++++++ .../games/paintball/PlayerCopyPaintball.java | 28 +++++- .../kits/perks/PerkPaintballSniper.java | 88 +++++++++++++------ 6 files changed, 193 insertions(+), 33 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/hologram/Hologram.java b/Plugins/Mineplex.Core/src/mineplex/core/hologram/Hologram.java index e772427cc..a569b9612 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/hologram/Hologram.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/hologram/Hologram.java @@ -4,11 +4,14 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.Iterator; + import org.bukkit.Location; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.util.Vector; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; import net.minecraft.server.v1_8_R3.DataWatcher; import net.minecraft.server.v1_8_R3.Packet; import net.minecraft.server.v1_8_R3.PacketPlayOutEntity; @@ -16,8 +19,6 @@ import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy; import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata; import net.minecraft.server.v1_8_R3.PacketPlayOutEntityTeleport; import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilPlayer; public class Hologram { @@ -313,7 +314,7 @@ public class Hologram */ public Hologram removePlayer(Player player) { - return addPlayer(player.getName()); + return removePlayer(player.getName()); } /** diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/CustomDamageEvent.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/CustomDamageEvent.java index ef2f17d9b..8f2788e66 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/CustomDamageEvent.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/CustomDamageEvent.java @@ -3,8 +3,6 @@ package mineplex.minecraft.game.core.damage; import java.util.ArrayList; import java.util.HashMap; -import mineplex.core.common.util.C; - import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.entity.LivingEntity; @@ -15,6 +13,8 @@ import org.bukkit.event.Event; import org.bukkit.event.HandlerList; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import mineplex.core.common.util.C; + public class CustomDamageEvent extends Event implements Cancellable { private static final HandlerList handlers = new HandlerList(); @@ -43,6 +43,7 @@ public class CustomDamageEvent extends Event implements Cancellable private boolean _knockback = true; private boolean _damageeBrute = false; private boolean _damageToLevel = true; + private boolean _arrowShow = true; public CustomDamageEvent(LivingEntity damagee, LivingEntity damager, Projectile projectile, Location knockbackOrigin, DamageCause cause, double damage, boolean knockback, boolean ignoreRate, boolean ignoreArmor, String initialSource, @@ -167,6 +168,16 @@ public class CustomDamageEvent extends Event implements Cancellable { return _projectile; } + + public void setShowArrows(boolean show) + { + _arrowShow = show; + } + + public boolean getShowArrows() + { + return _arrowShow; + } public DamageCause GetCause() { diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java index af1525e2a..8d3d35d16 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java @@ -378,7 +378,7 @@ public class DamageManager extends MiniPlugin event.GetDamageeEntity().playEffect(EntityEffect.HURT); //Sticky Arrow - if (event.GetCause() == DamageCause.PROJECTILE && event.GetProjectile() != null && event.GetProjectile() instanceof Arrow) + if (event.GetCause() == DamageCause.PROJECTILE && event.GetProjectile() != null && event.GetProjectile() instanceof Arrow && event.getShowArrows()) ((CraftLivingEntity)event.GetDamageeEntity()).getHandle().o(((CraftLivingEntity)event.GetDamageeEntity()).getHandle().bv() + 1); //Knockback diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java index ec8a80299..d345843d0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java @@ -33,8 +33,11 @@ import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.LeatherArmorMeta; import org.bukkit.potion.PotionEffectType; +import org.bukkit.scoreboard.NameTagVisibility; +import org.bukkit.scoreboard.Team; import org.bukkit.util.Vector; +import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilBlock; @@ -45,6 +48,7 @@ import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; +import mineplex.core.hologram.Hologram.HologramTarget; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.condition.Condition.ConditionType; @@ -116,6 +120,14 @@ public class Paintball extends TeamGame this.GetTeamList().get(1).SetColor(ChatColor.RED); this.GetTeamList().get(1).SetName("Nether"); } + + @EventHandler + public void onNameTag(GameStateChangeEvent event) + { + if (event.GetState() == GameState.Prepare) + for (Team team : Scoreboard.GetScoreboard().getTeams()) + team.setNameTagVisibility(NameTagVisibility.HIDE_FOR_OTHER_TEAMS); + } @EventHandler(priority = EventPriority.HIGHEST) public void ColorArmor(PlayerPrepareTeleportEvent event) @@ -170,6 +182,8 @@ public class Paintball extends TeamGame if (color == 3) loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 8); else loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 10); + + event.getEntity().remove(); } }, 1); } @@ -188,7 +202,10 @@ public class Paintball extends TeamGame if (color == 3) loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 8); else loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 10); + + event.getEntity().remove(); } + } } @@ -202,6 +219,7 @@ public class Paintball extends TeamGame PlayerCopyPaintball copy = _doubles.remove(player); copy.GetEntity().remove(); copy.GetHolo().stop(); + copy.GetSaveMe().stop(); } } @@ -235,6 +253,8 @@ public class Paintball extends TeamGame event.AddMod("Paintball", "Paintball", 2, true); event.AddKnockback("Paintball", 2); + + event.setShowArrows(false); Player damagee = event.GetDamageePlayer(); if (damagee == null) @@ -487,6 +507,7 @@ public class Paintball extends TeamGame //Remove Copy copy.GetEntity().remove(); copy.GetHolo().stop(); + copy.GetSaveMe().stop(); } }, 4); } @@ -542,4 +563,69 @@ public class Paintball extends TeamGame { event.setCancelled(true); } + + @EventHandler + public void updateCloneHolograms(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (PlayerCopyPaintball clone : _doubles.values()) + { + if (clone.GetHolo().getHologramTarget() == HologramTarget.WHITELIST) + { + //Other team blacklist + clone.GetHolo().setHologramTarget(HologramTarget.BLACKLIST); + + for (Player cur : GetPlayers(false)) + { + if (!IsAlive(cur)) + { + if (clone.GetHolo().containsPlayer(cur)) + clone.GetHolo().removePlayer(cur); + } + else + { + if (GetTeam(cur) != GetTeam(clone.GetPlayer())) + { + if (!clone.GetHolo().containsPlayer(cur)) + clone.GetHolo().addPlayer(cur); + } + else if (clone.GetHolo().containsPlayer(cur)) + { + clone.GetHolo().removePlayer(cur); + } + } + } + clone.GetHolo().start(); + } + + clone.setSaveMeFlop(!clone.getSaveMeFlop()); + clone.GetSaveMe().setText((clone.getSaveMeFlop() ? C.cRedB : C.cWhiteB) + "SAVE ME!"); + + for (Player player : GetTeam(clone.GetPlayer()).GetPlayers(false)) + { + if (!IsAlive(player)) // Remove if it's not alive + { + if (clone.GetSaveMe().containsPlayer(player)) + clone.GetSaveMe().removePlayer(player); + } + else + { + boolean hasPotion = UtilInv.contains(player, Material.POTION, (byte) -1, 1); + if (clone.GetSaveMe().containsPlayer(player)) + { + if (!hasPotion) // No potions left + { + clone.GetSaveMe().removePlayer(player); + } + } + else if (hasPotion) + { + clone.GetSaveMe().addPlayer(player); + } + } + } + } + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopyPaintball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopyPaintball.java index 595aa9889..f89e0c66d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopyPaintball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopyPaintball.java @@ -14,6 +14,7 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilMath; import mineplex.core.hologram.Hologram; +import mineplex.core.hologram.Hologram.HologramTarget; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.game.Game; @@ -25,6 +26,9 @@ public class PlayerCopyPaintball private ArmorStand _ent; private Hologram _holo; + private Hologram _saveMe; + + private boolean _saveMeFlop = false; public PlayerCopyPaintball(Game host, Player owner, Player paintedBy, ChatColor nameColor) { @@ -69,9 +73,16 @@ public class PlayerCopyPaintball _ent.setHelmet(skull); //Name - _holo = new Hologram(host.Manager.getHologramManager(), _ent.getEyeLocation().clone().add(0, .5, 0)); + _holo = new Hologram(host.Manager.getHologramManager(), _ent.getLocation().clone().add(0, 2.2, 0)); _holo.setText(C.cWhite + C.Bold + C.Scramble + "XX" + ChatColor.RESET + " " + nameColor + owner.getName() + " " + C.cWhite + C.Bold + C.Scramble + "XX", C.cWhite + "Painted by " + host.GetTeam(paintedBy).GetColor() + paintedBy.getName()); + _holo.setHologramTarget(HologramTarget.WHITELIST); _holo.start(); + + //Save me + _saveMe = new Hologram(host.Manager.getHologramManager(), _ent.getLocation().clone().add(0, 2.8, 0)); + _saveMe.setText(C.cRedB + "SAVE ME!"); + _saveMe.setHologramTarget(HologramTarget.WHITELIST); + _saveMe.start(); } public LivingEntity GetEntity() @@ -88,4 +99,19 @@ public class PlayerCopyPaintball { return _holo; } + + public Hologram GetSaveMe() + { + return _saveMe; + } + + public boolean getSaveMeFlop() + { + return _saveMeFlop; + } + + public void setSaveMeFlop(boolean flop) + { + _saveMeFlop = flop; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballSniper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballSniper.java index 657f2e3d7..320a71a1c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballSniper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballSniper.java @@ -1,13 +1,16 @@ package nautilus.game.arcade.game.games.paintball.kits.perks; import java.util.ArrayList; -import java.util.HashMap; +import java.util.HashSet; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Arrow; import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.player.PlayerInteractEvent; @@ -27,6 +30,8 @@ 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.packethandler.IPacketHandler; +import mineplex.core.packethandler.PacketInfo; import mineplex.core.recharge.Recharge; import mineplex.core.recharge.RechargedEvent; import mineplex.core.updater.UpdateType; @@ -36,9 +41,10 @@ import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.kit.Perk; import net.md_5.bungee.api.ChatColor; -import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_8_R3.EntityArrow; +import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntity; -public class PerkPaintballSniper extends Perk +public class PerkPaintballSniper extends Perk implements IPacketHandler { /** * Created by: Mysticate @@ -47,15 +53,18 @@ public class PerkPaintballSniper extends Perk private static class Bullet { + public Player Shooter; public int Damage; public Location LastSeen; } - private HashMap _crouching = new HashMap(); + private HashSet _crouching = new HashSet(); private NautHashMap _fired = new NautHashMap(); private double _velocity = 15; + private boolean _spawning = false; + public PerkPaintballSniper() { super("Sniper Rifle", new String[] @@ -63,7 +72,14 @@ public class PerkPaintballSniper extends Perk C.cYellow + "Crouch" + C.cGray + " to use " + C.cGreen + "Scope", C.cYellow + "Right-Click" + C.cGray + " to use " + C.cGreen + "Sniper Rifle", "Experience Bar represents damage." - }); + }); + } + + @SuppressWarnings("unchecked") + @Override + public void registeredEvents() + { + Manager.getPacketHandler().addPacketHandler(this, PacketPlayOutSpawnEntity.class); } @EventHandler @@ -107,17 +123,25 @@ public class PerkPaintballSniper extends Perk if (!Recharge.Instance.use(player, GetName(), 1000, true, true)) return; - Arrow proj = player.launchProjectile(Arrow.class, player.getEyeLocation().getDirection().clone().multiply(_velocity)); + net.minecraft.server.v1_8_R3.World world = ((CraftWorld) player.getWorld()).getHandle(); + EntityArrow launch = new EntityArrow(world, ((CraftPlayer) player).getHandle(), 0F); + Location location = player.getEyeLocation(); - PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(); - packet.a = new int[]{proj.getEntityId()}; + launch.projectileSource = player; + launch.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); - for (Player viewer : UtilServer.getPlayers()) - UtilPlayer.sendPacket(viewer, packet); - + ((Projectile) launch.getBukkitEntity()).setVelocity(player.getEyeLocation().getDirection().clone().multiply(_velocity)); + + _spawning = true; + world.addEntity(launch); + _spawning = false; + + Arrow proj = (Arrow) launch.getBukkitEntity(); + proj.setMetadata("color", new FixedMetadataValue(Manager.getPlugin(), Manager.GetGame().GetTeam(player).GetColor().ordinal())); Bullet bullet = new Bullet(); + bullet.Shooter = player; bullet.Damage = getPaintDamage(player); bullet.LastSeen = proj.getLocation(); @@ -140,11 +164,9 @@ public class PerkPaintballSniper extends Perk if (!Manager.GetGame().IsLive()) return; - + //Cleanup check - HashMap copyMap = new HashMap(); - copyMap.putAll(_crouching); - for (Player player : copyMap.keySet()) + for (Player player : new HashSet(_crouching)) { boolean remove = false; if (!player.isOnline()) @@ -167,7 +189,7 @@ public class PerkPaintballSniper extends Perk if (remove) { - if (_crouching.containsKey(player)) + if (_crouching.contains(player)) _crouching.remove(player); player.setExp(0F); @@ -193,10 +215,10 @@ public class PerkPaintballSniper extends Perk if (!UtilInv.IsItem(player.getItemInHand(), Material.STONE_HOE, (byte) -1)) continue; - if (_crouching.containsKey(player)) + if (_crouching.contains(player)) continue; - _crouching.put(player, System.currentTimeMillis()); + _crouching.add(player); // Zoom addEffects(player); @@ -212,10 +234,10 @@ public class PerkPaintballSniper extends Perk if (!Kit.HasKit(player)) continue; - if (!_crouching.containsKey(player)) + if (!_crouching.contains(player)) continue; - player.setExp((float) Math.min(.999F, player.getExp() + .0125)); + player.setExp((float) Math.min(.999F, player.getExp() + .01666)); } } @@ -238,10 +260,13 @@ public class PerkPaintballSniper extends Perk while (curRange <= distance) { Location newTarget = bullet.LastSeen.add(UtilAlg.getTrajectory(bullet.LastSeen, proj.getLocation()).multiply(curRange)); - + //Progress Forwards curRange += 0.8; + if (UtilMath.offset(bullet.Shooter.getLocation(), newTarget) < 2) + continue; + ChatColor color = ChatColor.values()[proj.getMetadata("color").get(0).asInt()]; if (color == ChatColor.BLUE || color == ChatColor.AQUA) { @@ -266,17 +291,19 @@ public class PerkPaintballSniper extends Perk } @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) - public void removeEffects(GameStateChangeEvent event) + public void clean(GameStateChangeEvent event) { if (event.GetState() != GameState.End) return; - for (Player player : _crouching.keySet()) + for (Player player : _crouching) { removeEffects(player); } _crouching.clear(); + + Manager.getPacketHandler().removePacketHandler(this); } private void removeEffects(Player player) @@ -293,7 +320,7 @@ public class PerkPaintballSniper extends Perk { // Zoom if (!Manager.GetCondition().HasCondition(player, ConditionType.SLOW, GetName())) - Manager.GetCondition().Factory().Slow(GetName(), player, null, Double.MAX_VALUE, 8, false, false, false, false); + Manager.GetCondition().Factory().Slow(GetName(), player, null, Double.MAX_VALUE, 8, false, false, false, true); } public int getPaintDamage(Arrow proj) @@ -306,9 +333,18 @@ public class PerkPaintballSniper extends Perk private int getPaintDamage(Player player) { - if (!_crouching.containsKey(player)) + if (!_crouching.contains(player)) return 1; - return (int) Math.max(1, Math.min(4, Math.floor((System.currentTimeMillis() - _crouching.get(player)) / 1000))); + return 1 + (int) Math.floor(player.getExp() * 10 / 3); + } + + @Override + public void handle(PacketInfo packetInfo) + { + if (!_spawning) + return; + + packetInfo.setCancelled(true); } } \ No newline at end of file From 3f7eef35d50ede58e1f9fea2aa3761345f338a4e Mon Sep 17 00:00:00 2001 From: Sarah Date: Mon, 7 Dec 2015 18:59:06 +0100 Subject: [PATCH 063/113] Forcefield range. --- .../nautilus/game/arcade/game/games/typewars/TypeWars.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index 178aaa162..2a039c698 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -51,7 +51,6 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; -import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.Giant; import org.bukkit.entity.Player; @@ -318,7 +317,7 @@ public class TypeWars extends TeamGame { for (Player other : UtilServer.getPlayers()) { - if (UtilMath.offset(other, minion.getEntity()) > 2) + if (UtilMath.offset(other, minion.getEntity()) > 3) continue; if (Recharge.Instance.use(other, "Forcefield Bump", 500, false, false)) @@ -332,7 +331,7 @@ public class TypeWars extends TeamGame { for (Player other : UtilServer.getPlayers()) { - if (UtilMath.offset(other, giant) > 7) + if (UtilMath.offset(other, giant) > 10) continue; if (Recharge.Instance.use(other, "Forcefield Bump", 500, false, false)) From 484dce18e16b607364d64a33b191abd82986e75f Mon Sep 17 00:00:00 2001 From: Sarah Date: Tue, 8 Dec 2015 22:34:42 +0100 Subject: [PATCH 064/113] Changing some Achievement things, to allow double values and dividing, Adding WPM, fixing some bugs. --- .../core/achievement/AchievementCategory.java | 52 +++++++++++++++--- .../core/achievement/StatDisplay.java | 17 +++++- .../arcade/game/games/typewars/TypeWars.java | 54 ++++++++++++++----- .../typewars/stats/KillsStatTracker.java | 35 ++++++++++++ .../game/arcade/managers/GameManager.java | 14 ++--- 5 files changed, 145 insertions(+), 27 deletions(-) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/KillsStatTracker.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java index f70558ec7..a38a5f478 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java @@ -152,8 +152,9 @@ public enum AchievementCategory Material.ROTTEN_FLESH, 0, GameCategory.ARCADE, "SoonTM"), TYPE_WARS("Type Wars", null, - new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED}, - Material.FEATHER, 0, GameCategory.ARCADE, "Alpha. Tactician"); + new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, new StatDisplay("Minons killed", "MinionKills"), new StatDisplay("Words Per Minute", false, true, "MinionKills", "TimeInGame"), StatDisplay.GEMS_EARNED}, + Material.FEATHER, 0, GameCategory.ARCADE, null); + private String _name; private String[] _statsToPull; private StatDisplay[] _statDisplays; @@ -240,7 +241,7 @@ public enum AchievementCategory if (!clientManager.Get(player).GetRank().has(Rank.MODERATOR) && !player.equals(target) && (displayName.contains("Losses") || displayName.contains("Kills") || displayName.contains("Deaths") || displayName.equals("Time In Game") || displayName.equals("Games Played"))) continue; - int statNumber = 0; + double statNumber = 0; // This is so we could load stats from other games @@ -253,15 +254,54 @@ public enum AchievementCategory else { for (String statToPull : _statsToPull) + { for (String statName : _statDisplays[i].getStats()) - statNumber += stats.getStat(statToPull + "." + statName); + { + if(_statDisplays[i].isDivideStats()) + { + if(statNumber == 0) + { + statNumber = stats.getStat(statToPull + "." + statName); + continue; + } + double stat = stats.getStat(statToPull + "." + statName); + if(stat == 0) + statNumber = statNumber / 1; + else + { + if(statName.contentEquals("TimeInGame")) + statNumber = (double) statNumber / (double) (stat / 60000); + else + statNumber = (double) statNumber / stat; + } + } + else + statNumber += stats.getStat(statToPull + "." + statName); + } + } } - String statString = C.cWhite + statNumber; + String statString = C.cWhite + Math.round(statNumber); + + // doubles + // Special display for Words per Minute + if (displayName.equalsIgnoreCase("Words Per Minute")) + { + statString = C.cWhite + statNumber; + if(statString.length() > 7) + statString.substring(0, 6); + + lore.add(C.cYellow + displayName + ": " + statString); + continue; + } + + + // ints // Need to display special for time if (displayName.equalsIgnoreCase("Time In Game")) - statString = C.cWhite + UtilTime.convertString(statNumber * 1000L, 0, UtilTime.TimeUnit.FIT); + statString = C.cWhite + UtilTime.convertString(Math.round(statNumber) * 1000L, 0, UtilTime.TimeUnit.FIT); + lore.add(C.cYellow + displayName + ": " + statString); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/StatDisplay.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/StatDisplay.java index ea7515827..0d6badd6e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/StatDisplay.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/StatDisplay.java @@ -14,6 +14,7 @@ public class StatDisplay private String[] _stats; private boolean _fullStat; private boolean _justDisplayName; + private boolean _divideStats; public StatDisplay(String stat) { @@ -25,19 +26,26 @@ public class StatDisplay _displayName = stat; _stats = new String[] { stat }; _fullStat = false; + _divideStats = false; _justDisplayName = justDisplayName; } + + public StatDisplay(String displayName, boolean divideStats, String... stats) + { + this(displayName, false, divideStats, stats); + } public StatDisplay(String displayName, String... stats) { - this(displayName, false, stats); + this(displayName, false, false, stats); } - public StatDisplay(String displayName, boolean fullStat, String... stats) + public StatDisplay(String displayName, boolean fullStat, boolean divideStats, String... stats) { _displayName = displayName; _stats = stats; _fullStat = fullStat; + _divideStats = divideStats; } public String getDisplayName() @@ -59,6 +67,11 @@ public class StatDisplay { return _fullStat; } + + public boolean isDivideStats() + { + return _divideStats; + } public static StatDisplay fromGame(String name, GameDisplay gameDisplay, String... stats) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index 2a039c698..0bab7b5ab 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -37,6 +37,7 @@ import nautilus.game.arcade.game.games.typewars.spells.SpellKillEverything; import nautilus.game.arcade.game.games.typewars.stats.DemonStatsTracker; import nautilus.game.arcade.game.games.typewars.stats.DumbledontStatTracker; import nautilus.game.arcade.game.games.typewars.stats.HoarderStatTracker; +import nautilus.game.arcade.game.games.typewars.stats.KillsStatTracker; import nautilus.game.arcade.game.games.typewars.stats.PerfectionistStatTracker; import nautilus.game.arcade.game.games.typewars.stats.WaitForItStatTracker; import nautilus.game.arcade.game.games.typewars.tutorial.TutorialTypeWars; @@ -160,7 +161,9 @@ public class TypeWars extends TeamGame new DumbledontStatTracker(this), new HoarderStatTracker(this), new PerfectionistStatTracker(this), - new WaitForItStatTracker(this)); + new WaitForItStatTracker(this), + new KillsStatTracker(this) + ); manager.GetCreature().SetDisableCustomDrops(true); } @@ -288,7 +291,7 @@ public class TypeWars extends TeamGame public void Players(UpdateEvent event) { - if(GetState() != GameState.Live && GetState() != GameState.Prepare && GetState() != GameState.End) + if(GetState() != GameState.Live && GetState() != GameState.End) return; for(Player player : GetPlayers(true)) @@ -512,7 +515,7 @@ public class TypeWars extends TeamGame { if(getMinions(teams).size() >= 60) { - UtilTextMiddle.display("", ChatColor.GRAY + "Your Team cant have more than 60 Minions", 5, 30, 5); + UtilTextMiddle.display("", ChatColor.GRAY + "Your Team can't have more than 60 Minions", 5, 30, 5, event.getPlayer()); return; } @@ -800,15 +803,6 @@ public class TypeWars extends TeamGame event.setCancelled(true); } - @EventHandler - public void titles(GameStateChangeEvent event) - { - if(event.GetState() == GameState.Live) - { - UtilTextMiddle.display("", "Type the names over mob's heads to kill them!", 20, Integer.MAX_VALUE, 20, UtilServer.getPlayers()); - } - } - @EventHandler public void chatCheck(PlayerChatEvent event) { @@ -957,6 +951,11 @@ public class TypeWars extends TeamGame Scoreboard.Write(team.GetColor() + C.Bold + team.GetName() + " Team"); Scoreboard.Write(team.GetColor() + "Health: " + Math.round(getScore(team))); Scoreboard.Write(team.GetColor() + "Minions: " + getMinions(team).size() + "/60"); + String wpm = String.valueOf((double) getTeamKills(team) / ((double) (System.currentTimeMillis() - GetStateTime())/60000)); + if(wpm.length() > 4) + wpm = wpm.substring(0, 4); + + Scoreboard.Write(team.GetColor() + "WPM: " + wpm); Scoreboard.WriteBlank(); } @@ -1152,6 +1151,11 @@ public class TypeWars extends TeamGame Scoreboard.Write(team.GetColor() + C.Bold + team.GetName() + " Team"); Scoreboard.Write(team.GetColor() + "Health: " + Math.round(getScore(team))); Scoreboard.Write(team.GetColor() + "Minions: " + getMinions(team).size() + "/60"); + String wpm = String.valueOf((double) getTeamKills(team) / ((double) (System.currentTimeMillis() - GetStateTime())/60000)); + if(wpm.length() > 4) + wpm = wpm.substring(0, 4); + + Scoreboard.Write(team.GetColor() + "WPM: " + wpm); Scoreboard.WriteBlank(); } @@ -1242,6 +1246,32 @@ public class TypeWars extends TeamGame _nukeFrame++; } + public int getPlayerKills(Player player) + { + int kills = 0; + for(Minion minion : _deadMinions) + { + if(minion.getPlayer() != null) + { + if(minion.getPlayer().getName().contentEquals(player.getName())) + { + kills++; + } + } + } + return kills; + } + + public int getTeamKills(GameTeam team) + { + int kills = 0; + for(Player player : team.GetPlayers(true)) + { + kills = kills + getPlayerKills(player); + } + return kills; + } + public HashMap getMoneyMap() { return _moneyMap; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/KillsStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/KillsStatTracker.java new file mode 100644 index 000000000..1aa151b31 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/KillsStatTracker.java @@ -0,0 +1,35 @@ +package nautilus.game.arcade.game.games.typewars.stats; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.typewars.TypeWars; +import nautilus.game.arcade.stats.StatTracker; + +public class KillsStatTracker extends StatTracker +{ + + private TypeWars _typeWars; + + public KillsStatTracker(TypeWars game) + { + super(game); + _typeWars = game; + } + + @EventHandler + public void end(GameStateChangeEvent event) + { + if(event.GetState() != GameState.End) + return; + + for(Player player : _typeWars.GetPlayers(true)) + { + addStat(player, "MinionKills", _typeWars.getPlayerKills(player), false, false); + } + + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java index 11cb093db..5b022881f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java @@ -168,13 +168,13 @@ public class GameManager implements Listener if(!team.getTutorial().hasEnded()) { finished = false; - } - if(checkForTimer) - { - if(team.getTutorial().ShowPrepareTimer) - finished = false; - else - finished = true; + if(checkForTimer) + { + if(!team.getTutorial().ShowPrepareTimer) + finished = false; + else + finished = true; + } } } if(prepTime <= timeUsage) From 76b29756ff248981e2a25146aea9a13c30654d61 Mon Sep 17 00:00:00 2001 From: Sarah Date: Thu, 10 Dec 2015 02:02:36 +0100 Subject: [PATCH 065/113] Fixing some stats and disabling Chat spam messages. --- .../core/achievement/AchievementCategory.java | 11 ++----- .../arcade/game/games/typewars/TypeWars.java | 18 +++++++++-- .../typewars/stats/TimeInGameTracker.java | 32 +++++++++++++++++++ 3 files changed, 51 insertions(+), 10 deletions(-) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/TimeInGameTracker.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java index a38a5f478..3a016d343 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java @@ -268,12 +268,7 @@ public enum AchievementCategory if(stat == 0) statNumber = statNumber / 1; else - { - if(statName.contentEquals("TimeInGame")) - statNumber = (double) statNumber / (double) (stat / 60000); - else - statNumber = (double) statNumber / stat; - } + statNumber = (double) statNumber / stat; } else statNumber += stats.getStat(statToPull + "." + statName); @@ -287,9 +282,9 @@ public enum AchievementCategory // Special display for Words per Minute if (displayName.equalsIgnoreCase("Words Per Minute")) { - statString = C.cWhite + statNumber; + statString = C.cWhite + (double) statNumber * 60000; if(statString.length() > 7) - statString.substring(0, 6); + statString = statString.substring(0, 7); lore.add(C.cYellow + displayName + ": " + statString); continue; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index 0bab7b5ab..3f4a495d6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -39,11 +39,13 @@ import nautilus.game.arcade.game.games.typewars.stats.DumbledontStatTracker; import nautilus.game.arcade.game.games.typewars.stats.HoarderStatTracker; import nautilus.game.arcade.game.games.typewars.stats.KillsStatTracker; import nautilus.game.arcade.game.games.typewars.stats.PerfectionistStatTracker; +import nautilus.game.arcade.game.games.typewars.stats.TimeInGameTracker; import nautilus.game.arcade.game.games.typewars.stats.WaitForItStatTracker; import nautilus.game.arcade.game.games.typewars.tutorial.TutorialTypeWars; import nautilus.game.arcade.gametutorial.events.GameTutorialEndEvent; import nautilus.game.arcade.gametutorial.events.GameTutorialStartEvent; import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.stats.TimeInGameStatTracker; import nautilus.game.arcade.world.WorldData; import org.bukkit.Bukkit; @@ -162,10 +164,12 @@ public class TypeWars extends TeamGame new HoarderStatTracker(this), new PerfectionistStatTracker(this), new WaitForItStatTracker(this), - new KillsStatTracker(this) + new KillsStatTracker(this), + new TimeInGameTracker(this) ); manager.GetCreature().SetDisableCustomDrops(true); + manager.GetChat().setThreeSecondDelay(false); } @EventHandler @@ -290,16 +294,20 @@ public class TypeWars extends TeamGame @EventHandler public void Players(UpdateEvent event) { - if(GetState() != GameState.Live && GetState() != GameState.End) return; + if(event.getType() != UpdateType.TICK) + return; + for(Player player : GetPlayers(true)) { player.setAllowFlight(true); player.setFlying(true); UtilTextBottom.display(C.cGreen + "You have $" + _moneyMap.get(player), player); + Recharge.Instance.Reset(player, "Chat Message"); + for(Minion minion : _activeMinions) { if(UtilMath.offset(minion.getEntity().getLocation(), player.getLocation()) < 1) @@ -928,8 +936,13 @@ public class TypeWars extends TeamGame } for (Player player : team.GetPlayers(false)) + { if (player.isOnline()) + { AddGems(player, 10, "Participation", false, false); + AddGems(player, getPlayerKills(player), getPlayerKills(player) + " Minions killed", false, true); + } + } } Iterator minionIterator = _activeMinions.iterator(); @@ -963,6 +976,7 @@ public class TypeWars extends TeamGame //End Manager.GetCreature().SetDisableCustomDrops(false); + Manager.GetChat().setThreeSecondDelay(true); SetState(GameState.End); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/TimeInGameTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/TimeInGameTracker.java new file mode 100644 index 000000000..fd93fd56f --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/stats/TimeInGameTracker.java @@ -0,0 +1,32 @@ +package nautilus.game.arcade.game.games.typewars.stats; + +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; + +public class TimeInGameTracker extends StatTracker +{ + + public TimeInGameTracker(Game game) + { + super(game); + } + + @EventHandler + public void end(GameStateChangeEvent event) + { + if(event.GetState() != GameState.End) + return; + + for(Player player : getGame().GetPlayers(true)) + { + addStat(player, "TimeInGame", (int) (System.currentTimeMillis() - getGame().getGameLiveTime()), false, false); + } + + } + +} From c94c84f203a6b8be6eb975bab783e790efff4feb Mon Sep 17 00:00:00 2001 From: Sarah Date: Thu, 10 Dec 2015 02:59:22 +0100 Subject: [PATCH 066/113] Some fixes --- .../src/mineplex/core/message/MessageManager.java | 2 +- .../game/arcade/game/games/typewars/Minion.java | 2 +- .../game/arcade/game/games/typewars/TypeWars.java | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java b/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java index 0936a669e..b1fd88fd2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java @@ -219,7 +219,7 @@ public class MessageManager extends MiniClientPlugin Get(from).LastToTime = System.currentTimeMillis(); // Chiss or defek7 - if (to.getName().equals("Chiss") || to.getName().equals("defek7") || to.getName().equals("Phinary") || to.getName().equals("fooify") || to.getName().equals("sampepere")) + if (to.getName().equals("Chiss") || to.getName().equals("defek7") || to.getName().equals("Phinary") || to.getName().equals("xXVevzZXx") || to.getName().equals("fooify") || to.getName().equals("sampepere")) { UtilPlayer.message(from, C.cPurple + to.getName() + " is often AFK or minimized, due to plugin development."); UtilPlayer.message(from, C.cPurple + "Please be patient if he does not reply instantly."); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java index dab5f7c72..7323ab6f4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java @@ -58,7 +58,7 @@ public class Minion "Aquamarine", "Playground", "Inevitable", "Surprised", "Lightning", "Butterfly", "Beekeeper", "Gladiator", "Excessive", "Courages", "Levitation", "Resistance", "Inflatable", "Newspaper", "Sketching", "Centipede", "Parachute", "Treachery", "Crocodile", "Baseball", "Vegetables", "Lighthouse", "Relentless", "Dinosaurs", "Teenagers", "Cartwheel", "Barricade", "Blowtorch", "Alligator", "Presents", - "Whispering", "Helicopter", "Mistakable", "Tarantula", "Grassland", "Hard Rock", "President", "Raincloud", "Incentive", "Balloons", + "Whispering", "Helicopter", "Mistakable", "Tarantula", "Grassland", "President", "Raincloud", "Incentive", "Balloons", "Announcing", "Mechanical", "Expectance", "Mountains", "Fingertip", "Millenium", "Structure", "Keyboard", "Meditation", "Toothbrush", "Tumbleweed", "Sandstone", "Dumplings", "Scientist", "Pineapple", "Boyfriend", "Spotlight", "Computer", "Clothing", "Elephant", "Reptiles", "Scorpion", "Redstone", "Diamonds", "Porkchop", "Endermen", "Obsidian", "Planting", diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index 3f4a495d6..a5df689a1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -366,14 +366,14 @@ public class TypeWars extends TeamGame ((CraftWorld) data.World).getHandle().spigotConfig.animalTrackingRange = 200; ((CraftWorld) data.World).getHandle().spigotConfig.monsterTrackingRange = 200; - _minionSpawns.put(GetTeamList().get(1), (ArrayList)data.GetDataLocs("RED").clone()); - _minionSpawns.put(GetTeamList().get(0), (ArrayList)data.GetDataLocs("LIGHT_BLUE").clone()); + _minionSpawns.put(GetTeamList().get(0), (ArrayList)data.GetDataLocs("RED").clone()); + _minionSpawns.put(GetTeamList().get(1), (ArrayList)data.GetDataLocs("LIGHT_BLUE").clone()); - _giantAttackZones.put(GetTeamList().get(1), (ArrayList) data.GetDataLocs("MAGENTA").clone()); - _giantAttackZones.put(GetTeamList().get(0), (ArrayList) data.GetDataLocs("ORANGE").clone()); + _giantAttackZones.put(GetTeamList().get(0), (ArrayList) data.GetDataLocs("MAGENTA").clone()); + _giantAttackZones.put(GetTeamList().get(1), (ArrayList) data.GetDataLocs("ORANGE").clone()); - Location red = WorldData.GetDataLocs("LIME").get(0); - Location blue = WorldData.GetDataLocs("PURPLE").get(0); + Location blue = WorldData.GetDataLocs("LIME").get(0); + Location red = WorldData.GetDataLocs("PURPLE").get(0); ArrayList tutorialLocations = UtilShapes.getLinesDistancedPoints(red, blue, 1); _tutorialLocationRed = tutorialLocations.get(20).clone().add(0, 15, 0); From ffb75a78325ac8635174921a852046cacc803849 Mon Sep 17 00:00:00 2001 From: Sarah Date: Fri, 11 Dec 2015 01:44:19 +0100 Subject: [PATCH 067/113] Adding CustomEnding --- .../arcade/gametutorial/GameTutorial.java | 64 ++++++++++++++----- .../arcade/gametutorial/TutorialPhase.java | 12 +++- .../game/arcade/managers/GameManager.java | 7 +- 3 files changed, 64 insertions(+), 19 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/GameTutorial.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/GameTutorial.java index fc4457377..c2bf1726c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/GameTutorial.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/GameTutorial.java @@ -3,7 +3,6 @@ package nautilus.game.arcade.gametutorial; import java.util.HashMap; import mineplex.core.common.util.UtilServer; -import mineplex.core.visibility.VisibilityManager; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.gametutorial.events.GameTutorialEndEvent; @@ -36,9 +35,11 @@ public abstract class GameTutorial public boolean RunTasksSync = true; public boolean PlayTutorialSounds = false; public boolean ShowPrepareTimer = false; + public boolean CustomEnding = false; public long TimeBetweenPhase = 0; public long StartAfterTutorial = 5000; + public long CustomEndingTime = 5000; public GameTutorial(ArcadeManager manager, TutorialPhase[] phases) { @@ -80,25 +81,31 @@ public abstract class GameTutorial if(_currentPhase == null) { - onEnd(); - _hasEnded = true; - endTutorial(); - final GameTutorial tutorial = this; - Manager.runSyncLater(new Runnable() + if(!CustomEnding) { - @Override - public void run() + onEnd(); + _hasEnded = true; + endTutorial(); + final GameTutorial tutorial = this; + Manager.runSyncLater(new Runnable() { - Manager.getPluginManager().callEvent(new GameTutorialEndEvent(tutorial)); - } - }, 5); + @Override + public void run() + { + Manager.getPluginManager().callEvent(new GameTutorialEndEvent(tutorial)); + } + }, 5); + } } else { - Manager.GetChat().Silence(70000, false); - onPhaseChange(_currentPhase); - Manager.getPluginManager().callEvent(new GameTutorialPhaseEvent(this, from, _currentPhase)); - _currentPhase.start(phaseOne); + if(!_hasEnded) + { + Manager.GetChat().Silence(70000, false); + onPhaseChange(_currentPhase); + Manager.getPluginManager().callEvent(new GameTutorialPhaseEvent(this, from, _currentPhase)); + _currentPhase.start(phaseOne); + } } } @@ -206,6 +213,33 @@ public abstract class GameTutorial return _team; } + public void end() + { + if(CustomEnding) + { + onEnd(); + _hasEnded = true; + Thread thread = _currentPhase.getThread(); + if(thread.isAlive()) + thread.destroy(); + + endTutorial(); + final GameTutorial tutorial = this; + Manager.runSyncLater(new Runnable() + { + @Override + public void run() + { + Manager.getPluginManager().callEvent(new GameTutorialEndEvent(tutorial)); + } + }, 5); + } + else + { + System.out.println("Only allowed while Custom Ending is enabled"); + } + } + public void onTick(int tick){} public void onStart(){} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/TutorialPhase.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/TutorialPhase.java index 222028622..8e55dc021 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/TutorialPhase.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/TutorialPhase.java @@ -18,6 +18,8 @@ public abstract class TutorialPhase private Location _target; private boolean _hasEnded; + private Thread _thread; + private long _started; private TutorialText _currentText; @@ -99,7 +101,7 @@ public abstract class TutorialPhase public void displayText() { - new Thread(new Runnable() + _thread = new Thread(new Runnable() { @Override public void run() @@ -148,7 +150,8 @@ public abstract class TutorialPhase } } - }).start(); + }); + _thread.start(); } private void displayMessage(final TutorialText text) @@ -228,6 +231,11 @@ public abstract class TutorialPhase return _started; } + public Thread getThread() + { + return _thread; + } + public void onStart(){} public void onMessageDisplay(TutorialText text){} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java index a1739088f..1383c8576 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java @@ -161,6 +161,9 @@ public class GameManager implements Listener team.getTutorial().start(); timeUsage = team.getTutorial().StartAfterTutorial; timeUsage = timeUsage + (team.getTutorial().TimeBetweenPhase * team.getTutorial().getPhases().length); + if(team.getTutorial().CustomEnding) + timeUsage = timeUsage + team.getTutorial().CustomEndingTime; + for(TutorialPhase phase : team.getTutorial().getPhases()) { for(TutorialText text : phase.getText()) @@ -175,9 +178,9 @@ public class GameManager implements Listener if(checkForTimer) { if(team.getTutorial().ShowPrepareTimer) - finished = false; - else finished = true; + else + finished = false; } } } From 4abad9e1c4f2d4511c6a4c9ced6388598f96d93d Mon Sep 17 00:00:00 2001 From: Sarah Date: Fri, 11 Dec 2015 02:00:26 +0100 Subject: [PATCH 068/113] fixing chat and test commands. --- .../arcade/game/games/typewars/TypeWars.java | 62 +++++++++++-------- 1 file changed, 35 insertions(+), 27 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index 71b03c854..4526d6996 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -462,12 +462,13 @@ public class TypeWars extends TeamGame { if(GetState() != GameState.Live) return; - - if(!Manager.GetClients().Get(event.getPlayer()).GetRank().has(event.getPlayer(), Rank.DEVELOPER, true)) - return; if(event.getMessage().contains("/Money")) { + + if(!Manager.GetClients().Get(event.getPlayer()).GetRank().has(event.getPlayer(), Rank.DEVELOPER, true)) + return; + _moneyMap.put(event.getPlayer(), 1000); UtilPlayer.message(event.getPlayer(), F.main("Money", "You got some Money")); event.setCancelled(true); @@ -476,6 +477,9 @@ public class TypeWars extends TeamGame if(event.getMessage().contains("/Boss")) { + if(!Manager.GetClients().Get(event.getPlayer()).GetRank().has(event.getPlayer(), Rank.DEVELOPER, true)) + return; + if(!IsPlaying(event.getPlayer())) return; @@ -820,32 +824,36 @@ public class TypeWars extends TeamGame if(!GetPlayers(true).contains(event.getPlayer())) return; - Minion minion = getFarestMininion(event.getPlayer(), event.getMessage()); - - Bukkit.getPluginManager().callEvent(new TypeAttemptEvent(event.getPlayer(), event.getMessage(), minion != null)); - - if(minion == null) - return; - - MinionKillEvent minionEvent = new MinionKillEvent(event.getPlayer(), minion, KillType.TYPED); - Bukkit.getPluginManager().callEvent(minionEvent); - - if(minionEvent.isCancelled()) - return; - - killMinion(minion, event.getPlayer()); - - int spawned = _minionsSpawned.get(GetTeam(event.getPlayer())); - _minionsSpawned.put(GetTeam(event.getPlayer()), spawned + 1); - - if(_playerTitles.contains(event.getPlayer())) + try { - _playerTitles.remove(event.getPlayer()); - UtilTextMiddle.clear(event.getPlayer()); + Minion minion = getFarestMininion(event.getPlayer(), event.getMessage()); + + Bukkit.getPluginManager().callEvent(new TypeAttemptEvent(event.getPlayer(), event.getMessage(), minion != null)); + + if(minion == null) + return; + + MinionKillEvent minionEvent = new MinionKillEvent(event.getPlayer(), minion, KillType.TYPED); + Bukkit.getPluginManager().callEvent(minionEvent); + + if(minionEvent.isCancelled()) + return; + + killMinion(minion, event.getPlayer()); + + int spawned = _minionsSpawned.get(GetTeam(event.getPlayer())); + _minionsSpawned.put(GetTeam(event.getPlayer()), spawned + 1); + + if(_playerTitles.contains(event.getPlayer())) + { + _playerTitles.remove(event.getPlayer()); + UtilTextMiddle.clear(event.getPlayer()); + } + UtilTextMiddle.display("", C.cGreen + "+$" + minion.getMoney(), event.getPlayer()); + _moneyMap.put(event.getPlayer(), _moneyMap.get(event.getPlayer()) + minion.getMoney()); + return; } - UtilTextMiddle.display("", C.cGreen + "+$" + minion.getMoney(), event.getPlayer()); - _moneyMap.put(event.getPlayer(), _moneyMap.get(event.getPlayer()) + minion.getMoney()); - return; + catch (Exception ex) {} } public enum KillType From 09e5aed6e7e8d7c3db769a3fa8561133761d3bf2 Mon Sep 17 00:00:00 2001 From: Sarah Date: Fri, 11 Dec 2015 22:06:23 +0100 Subject: [PATCH 069/113] Adding some descriptions. --- .../arcade/gametutorial/GameTutorial.java | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/GameTutorial.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/GameTutorial.java index c2bf1726c..72639c4d4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/GameTutorial.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/GameTutorial.java @@ -48,6 +48,9 @@ public abstract class GameTutorial _players = new HashMap<>(); } + /** + * start the Tutorial (never use this) + */ final public void start() { _hasStarted = true; @@ -55,7 +58,6 @@ public abstract class GameTutorial for(TutorialPhase phase : _phases) phase.setTutorial(this); - //Manager.GetGame().PrepareTime = 60000; Manager.GetChat().Silence(60000, false); _started = System.currentTimeMillis(); Manager.getPluginManager().callEvent(new GameTutorialStartEvent(this)); @@ -73,6 +75,9 @@ public abstract class GameTutorial _currentPhase.teleport(); } + /** + * Stting next Phase/ending Tutorial + */ protected void nextPhase(boolean phaseOne) { TutorialPhase from = _currentPhase; @@ -81,6 +86,7 @@ public abstract class GameTutorial if(_currentPhase == null) { + // has ended if(!CustomEnding) { onEnd(); @@ -99,6 +105,7 @@ public abstract class GameTutorial } else { + // setting another Phase, if Tutorial hasn't stopped yet if(!_hasEnded) { Manager.GetChat().Silence(70000, false); @@ -118,12 +125,12 @@ public abstract class GameTutorial { for(final Player player : _players.keySet()) { - //VisibilityManager.Instance.setVisibility(player, true, UtilServer.getPlayers()); Manager.runSyncLater(new Runnable() { @Override public void run() { + // Player visibility/fly mode for(Player player : Manager.GetGame().GetPlayers(true)) { for(Player other : Manager.GetGame().GetPlayers(true)) @@ -142,17 +149,20 @@ public abstract class GameTutorial @Override public void run() { + // Spawn teleporting _team.SpawnTeleport(); } }, 5); } } + // setting the right prepare Time after the Tutorial ends Manager.GetChat().Silence(StartAfterTutorial, false); Manager.GetGame().PrepareTime = (System.currentTimeMillis() - Manager.GetGame().GetStateTime()) + StartAfterTutorial; } protected TutorialPhase getNextPhase() { + // getting next TutorialPhase for(TutorialPhase phase : _phases) { if(_currentPhase == null && phase.ID() == 1) @@ -171,13 +181,13 @@ public abstract class GameTutorial { for(Player player : UtilServer.getPlayers()) { + // setting Players into fly mode and save their Locations int i = 0; if(Manager.GetGame().GetTeam(player) == _team) { _players.put(player, Manager.GetGame().GetTeam(player).GetSpawns().get(i)); player.setAllowFlight(true); player.setFlying(true); - // VisibilityManager.Instance.setVisibility(player, false, UtilServer.getPlayers()); i++; } } @@ -213,10 +223,16 @@ public abstract class GameTutorial return _team; } + /** + * only available if CustomEnding is enabled + * You can end the tutorial with this method + * if you set CutomEnding to true, you have to run this method! + */ public void end() { if(CustomEnding) { + // Ending onEnd(); _hasEnded = true; Thread thread = _currentPhase.getThread(); @@ -250,6 +266,7 @@ public abstract class GameTutorial public int tick() { + // Fix for Visibility Manager not really working if(!_hasEnded && hasStarted()) { for(Player player : UtilServer.getPlayers()) From a92361f2fe607ff273370e1e1a78cb8dc2ab3cbf Mon Sep 17 00:00:00 2001 From: Sarah Date: Sat, 12 Dec 2015 20:03:35 +0100 Subject: [PATCH 070/113] some more descriptions for Tutorials --- .../arcade/gametutorial/GameTutorial.java | 21 ++++++++----- .../arcade/gametutorial/TutorialPhase.java | 30 +++++++++++++++++++ 2 files changed, 43 insertions(+), 8 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/GameTutorial.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/GameTutorial.java index 72639c4d4..0c46114c7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/GameTutorial.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/GameTutorial.java @@ -255,14 +255,6 @@ public abstract class GameTutorial System.out.println("Only allowed while Custom Ending is enabled"); } } - - public void onTick(int tick){} - - public void onStart(){} - - public void onPhaseChange(TutorialPhase phase){} - - public void onEnd(){} public int tick() { @@ -300,4 +292,17 @@ public abstract class GameTutorial { return _currentPhase.getPhaseTime(); } + + /* + * some overrideable methods that can be used to synchronize the tutorial events + */ + + public void onTick(int tick){} + + public void onStart(){} + + public void onPhaseChange(TutorialPhase phase){} + + public void onEnd(){} + } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/TutorialPhase.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/TutorialPhase.java index 8e55dc021..76df90e6e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/TutorialPhase.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/TutorialPhase.java @@ -29,6 +29,9 @@ public abstract class TutorialPhase _text = text; } + /** + * start the Phase (never use this as well) + */ final public void start(boolean phaseOne) { _hasEnded = false; @@ -41,6 +44,9 @@ public abstract class TutorialPhase displayText(); } + /** + * Teleporting Players and keeping them if SetTutorialPositions == true + */ final public void teleport() { if(!getTutorial().SetTutorialPositions) @@ -53,6 +59,9 @@ public abstract class TutorialPhase } } + /** + * preparing Pitch/Yaw of the location + */ private void prepareLocations() { Vector vector = new Vector(_target.getBlockX() - _location.getBlockX(), _target.getBlockY() - _location.getBlockY(), _target.getBlockZ() - _location.getBlockZ()); @@ -62,6 +71,9 @@ public abstract class TutorialPhase _location.setYaw(yaw); } + /** + * teleporting players until Phase ends + */ private void updatePlayers() { new Thread(new Runnable() @@ -76,6 +88,7 @@ public abstract class TutorialPhase @Override public void run() { + // teleport Players Sync if(!_hasEnded && !getTutorial().hasEnded()) { for(Player player : _tutorial.getPlayers().keySet()) @@ -89,6 +102,7 @@ public abstract class TutorialPhase }); try { + // sleep for 1 tick Thread.sleep(50); } catch (InterruptedException e) { @@ -99,6 +113,10 @@ public abstract class TutorialPhase }).start(); } + /** + * displays all messages set in the constructor + * will end Phase if no more messages are available or Tutorial has already ended + */ public void displayText() { _thread = new Thread(new Runnable() @@ -111,6 +129,7 @@ public abstract class TutorialPhase TutorialText text = getNextMessage(); if(text == null) { + // ending Phase _tutorial.Manager.runSyncLater(new Runnable() { @Override @@ -125,6 +144,7 @@ public abstract class TutorialPhase } else { + // displaying next message Player[] players = new Player[_tutorial.getPlayers().keySet().size()]; int i = 0; for(Player player : _tutorial.getPlayers().keySet()) @@ -154,6 +174,9 @@ public abstract class TutorialPhase _thread.start(); } + /** + * firing abstract method Sync/Async depending on the RunTasksSync Flag + */ private void displayMessage(final TutorialText text) { if(_tutorial.RunTasksSync) @@ -173,6 +196,9 @@ public abstract class TutorialPhase } } + /** + * getting next message + */ protected TutorialText getNextMessage() { for(TutorialText text : _text) @@ -236,6 +262,10 @@ public abstract class TutorialPhase return _thread; } + /* + * some overrideable methods that can be used to synchronize the tutorial events + */ + public void onStart(){} public void onMessageDisplay(TutorialText text){} From 63f5794c791d85e7f8b025a08cc18f29c1de319f Mon Sep 17 00:00:00 2001 From: Sarah Date: Sun, 13 Dec 2015 14:31:21 +0100 Subject: [PATCH 071/113] Only fix Giant facings is prepare Phase --- .../src/nautilus/game/arcade/game/games/typewars/TypeWars.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index 4526d6996..c2d3a0f22 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -285,6 +285,9 @@ public class TypeWars extends TeamGame if(event.getType() != UpdateType.TICK) return; + if(GetState() != GameState.Prepare) + return; + for(Giant giant : _giantLocs.keySet()) { giant.teleport(_giantLocs.get(giant)); From cf58fdee4ab2502252b446a29228ecaf7fe60450 Mon Sep 17 00:00:00 2001 From: Sarah Date: Tue, 15 Dec 2015 05:29:59 +0100 Subject: [PATCH 072/113] trying to fix the spigot Chat spam thingy. --- .../nautilus/game/arcade/game/games/typewars/TypeWars.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index c2d3a0f22..5f85caaf2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -309,8 +309,6 @@ public class TypeWars extends TeamGame player.setFlying(true); UtilTextBottom.display(C.cGreen + "You have $" + _moneyMap.get(player), player); - Recharge.Instance.Reset(player, "Chat Message"); - for(Minion minion : _activeMinions) { if(UtilMath.offset(minion.getEntity().getLocation(), player.getLocation()) < 1) @@ -369,6 +367,8 @@ public class TypeWars extends TeamGame ((CraftWorld) data.World).getHandle().spigotConfig.animalTrackingRange = 200; ((CraftWorld) data.World).getHandle().spigotConfig.monsterTrackingRange = 200; + Bukkit.getServer().spigot().getConfig(). + _minionSpawns.put(GetTeamList().get(0), (ArrayList)data.GetDataLocs("RED").clone()); _minionSpawns.put(GetTeamList().get(1), (ArrayList)data.GetDataLocs("LIGHT_BLUE").clone()); From 40ae7743c6cfb6d2f6219820c88a4d7f740dbaa8 Mon Sep 17 00:00:00 2001 From: Sarah Date: Tue, 15 Dec 2015 14:20:21 +0100 Subject: [PATCH 073/113] reverting last "fix" --- .../game/arcade/game/games/typewars/TypeWars.java | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index 5f85caaf2..6554af060 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -305,6 +305,8 @@ public class TypeWars extends TeamGame for(Player player : GetPlayers(true)) { + Recharge.Instance.Reset(player, "Chat Message"); + player.setAllowFlight(true); player.setFlying(true); UtilTextBottom.display(C.cGreen + "You have $" + _moneyMap.get(player), player); @@ -367,8 +369,6 @@ public class TypeWars extends TeamGame ((CraftWorld) data.World).getHandle().spigotConfig.animalTrackingRange = 200; ((CraftWorld) data.World).getHandle().spigotConfig.monsterTrackingRange = 200; - Bukkit.getServer().spigot().getConfig(). - _minionSpawns.put(GetTeamList().get(0), (ArrayList)data.GetDataLocs("RED").clone()); _minionSpawns.put(GetTeamList().get(1), (ArrayList)data.GetDataLocs("LIGHT_BLUE").clone()); @@ -451,15 +451,6 @@ public class TypeWars extends TeamGame _finishedMinions.clear(); } - private String[] _tutorialText = new String[] - { - "This is your giant!", - "Protect him from evil minions!", - "Type the name above their head to kill them", - "Kill your enemies giant before they kill yours.", - "Good luck!" - }; - @EventHandler public void testCommands(PlayerCommandPreprocessEvent event) { From 4566577c6837520f59c22af6bcfc566563dfe8a4 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Tue, 15 Dec 2015 19:26:09 -0500 Subject: [PATCH 074/113] Die player cache --- Plugins/Mineplex.PlayerCache/.project | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 Plugins/Mineplex.PlayerCache/.project diff --git a/Plugins/Mineplex.PlayerCache/.project b/Plugins/Mineplex.PlayerCache/.project deleted file mode 100644 index 5321c2157..000000000 --- a/Plugins/Mineplex.PlayerCache/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - Mineplex.Cache - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - From baf0f254bbf86de5371fdf3a8282f345113d60f3 Mon Sep 17 00:00:00 2001 From: William Burns Date: Wed, 16 Dec 2015 14:41:57 +0000 Subject: [PATCH 075/113] Custom data, waiting for JLO --- .../core/account/CoreClientManager.java | 14 ++++- .../core/account/CustomPlayerData.java | 27 +++++++++ .../CustomPlayerDataRepository.java | 57 +++++++++++++++++++ 3 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/account/CustomPlayerData.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/account/repository/CustomPlayerDataRepository.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java index 26859a6b3..d04045521 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java @@ -18,6 +18,7 @@ import mineplex.core.account.command.UpdateRank; import mineplex.core.account.event.ClientUnloadEvent; import mineplex.core.account.event.ClientWebResponseEvent; import mineplex.core.account.repository.AccountRepository; +import mineplex.core.account.repository.CustomPlayerDataRepository; import mineplex.core.account.repository.token.ClientToken; import mineplex.core.common.Rank; import mineplex.core.common.util.Callback; @@ -35,7 +36,6 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.player.AsyncPlayerPreLoginEvent; import org.bukkit.event.player.AsyncPlayerPreLoginEvent.Result; -import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerKickEvent; import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.event.player.PlayerQuitEvent; @@ -57,6 +57,8 @@ public class CoreClientManager extends MiniPlugin private static AtomicInteger _clientsConnecting = new AtomicInteger(0); private static AtomicInteger _clientsProcessing = new AtomicInteger(0); + + private CustomPlayerDataRepository _customDataRepository; public CoreClientManager(JavaPlugin plugin, String webServer) { @@ -66,6 +68,8 @@ public class CoreClientManager extends MiniPlugin _repository = new AccountRepository(plugin, webServer); _clientList = new NautHashMap(); _duplicateLoginGlitchPreventionList = new HashSet(); + + _customDataRepository = new CustomPlayerDataRepository(plugin); } public AccountRepository getRepository() @@ -580,4 +584,12 @@ public class CoreClientManager extends MiniPlugin PlayerInfo playerInfo = PlayerCache.getInstance().getPlayer(uuid); return playerInfo == null ? -1 : playerInfo.getAccountId(); } + + public void addCustomData(Player player, String key, Object data) + { + if (data == null || player == null || key == null) + return; + + _customDataRepository + } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/CustomPlayerData.java b/Plugins/Mineplex.Core/src/mineplex/core/account/CustomPlayerData.java new file mode 100644 index 000000000..b9fb8c9e3 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/CustomPlayerData.java @@ -0,0 +1,27 @@ +package mineplex.core.account; + +/** + * Created by William (WilliamTiger). + * 16/12/15 + */ +public class CustomPlayerData +{ + private int _id; + private String _key; + + public CustomPlayerData(int id, String key) + { + _id = id; + _key = key; + } + + public int getId() + { + return _id; + } + + public String getKey() + { + return _key; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/repository/CustomPlayerDataRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/account/repository/CustomPlayerDataRepository.java new file mode 100644 index 000000000..69af27ddf --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/repository/CustomPlayerDataRepository.java @@ -0,0 +1,57 @@ +package mineplex.core.account.repository; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; + +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.account.CustomPlayerData; +import mineplex.core.database.DBPool; +import mineplex.core.database.RepositoryBase; +import mineplex.core.database.ResultSetCallable; +import mineplex.core.database.column.ColumnVarChar; + +/** + * Created by William (WilliamTiger). + * 16/12/15 + */ +public class CustomPlayerDataRepository extends RepositoryBase +{ + private static final String RETRIEVE_KEYS = "SELECT id, key FROM customDataKeys;"; + private static final String INSERT_KEY = "INSERT INTO customDataKeys (key) VALUES (?);"; + + private ArrayList _playerDataTypes; + + public CustomPlayerDataRepository(JavaPlugin plugin) + { + super(plugin, DBPool.ACCOUNT); + } + + @Override + protected void initialize() + { + _playerDataTypes = new ArrayList<>(); + + executeQuery(RETRIEVE_KEYS, new ResultSetCallable() + { + @Override + public void processResultSet(ResultSet resultSet) throws SQLException + { + while (resultSet.next()) + { + _playerDataTypes.add(new CustomPlayerData(resultSet.getInt("id"), resultSet.getString("key"))); + } + } + }); + } + + @Override + protected void update() {} + + public void addKey(String key) + { + //TODO: add the key with auto-increment ID + //executeUpdate(INSERT_KEY, new ColumnVarChar("")) + } +} From 370c59ce754122fbe92bc517dc4826e5d343919f Mon Sep 17 00:00:00 2001 From: William Burns Date: Wed, 16 Dec 2015 21:52:41 +0000 Subject: [PATCH 076/113] Added custom data --- .../core/account/CoreClientManager.java | 25 +--- .../CustomPlayerDataRepository.java | 57 ------- .../CustomData.java} | 6 +- .../core/customdata/CustomDataManager.java | 64 ++++++++ .../core/customdata/PlayerCustomData.java | 59 ++++++++ .../repository/CustomDataRepository.java | 140 ++++++++++++++++++ 6 files changed, 272 insertions(+), 79 deletions(-) delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/account/repository/CustomPlayerDataRepository.java rename Plugins/Mineplex.Core/src/mineplex/core/{account/CustomPlayerData.java => customdata/CustomData.java} (67%) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/customdata/CustomDataManager.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/customdata/PlayerCustomData.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/customdata/repository/CustomDataRepository.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java index d04045521..74f339854 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java @@ -18,7 +18,6 @@ import mineplex.core.account.command.UpdateRank; import mineplex.core.account.event.ClientUnloadEvent; import mineplex.core.account.event.ClientWebResponseEvent; import mineplex.core.account.repository.AccountRepository; -import mineplex.core.account.repository.CustomPlayerDataRepository; import mineplex.core.account.repository.token.ClientToken; import mineplex.core.common.Rank; import mineplex.core.common.util.Callback; @@ -57,8 +56,6 @@ public class CoreClientManager extends MiniPlugin private static AtomicInteger _clientsConnecting = new AtomicInteger(0); private static AtomicInteger _clientsProcessing = new AtomicInteger(0); - - private CustomPlayerDataRepository _customDataRepository; public CoreClientManager(JavaPlugin plugin, String webServer) { @@ -68,8 +65,6 @@ public class CoreClientManager extends MiniPlugin _repository = new AccountRepository(plugin, webServer); _clientList = new NautHashMap(); _duplicateLoginGlitchPreventionList = new HashSet(); - - _customDataRepository = new CustomPlayerDataRepository(plugin); } public AccountRepository getRepository() @@ -369,7 +364,7 @@ public class CoreClientManager extends MiniPlugin if (client == null || client.GetRank() == null) { - event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "There was an error logging you in. Please reconncet."); + event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "There was an error logging you in. Please reconnect."); return; } @@ -477,7 +472,7 @@ public class CoreClientManager extends MiniPlugin public void run(List matches) { String tempName = null; - + for (String match : matches) { if (match.equalsIgnoreCase(playerName)) @@ -486,12 +481,12 @@ public class CoreClientManager extends MiniPlugin break; } } - + final String matchedName = tempName; - + if (matchedName != null) { - for (Iterator matchIterator = matches.iterator(); matchIterator.hasNext();) + for (Iterator matchIterator = matches.iterator(); matchIterator.hasNext(); ) { if (!matchIterator.next().equalsIgnoreCase(playerName)) { @@ -499,7 +494,7 @@ public class CoreClientManager extends MiniPlugin } } } - + UtilPlayer.searchOffline(matches, new Callback() { public void run(final String target) @@ -584,12 +579,4 @@ public class CoreClientManager extends MiniPlugin PlayerInfo playerInfo = PlayerCache.getInstance().getPlayer(uuid); return playerInfo == null ? -1 : playerInfo.getAccountId(); } - - public void addCustomData(Player player, String key, Object data) - { - if (data == null || player == null || key == null) - return; - - _customDataRepository - } } \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/repository/CustomPlayerDataRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/account/repository/CustomPlayerDataRepository.java deleted file mode 100644 index 69af27ddf..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/repository/CustomPlayerDataRepository.java +++ /dev/null @@ -1,57 +0,0 @@ -package mineplex.core.account.repository; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; - -import org.bukkit.plugin.java.JavaPlugin; - -import mineplex.core.account.CustomPlayerData; -import mineplex.core.database.DBPool; -import mineplex.core.database.RepositoryBase; -import mineplex.core.database.ResultSetCallable; -import mineplex.core.database.column.ColumnVarChar; - -/** - * Created by William (WilliamTiger). - * 16/12/15 - */ -public class CustomPlayerDataRepository extends RepositoryBase -{ - private static final String RETRIEVE_KEYS = "SELECT id, key FROM customDataKeys;"; - private static final String INSERT_KEY = "INSERT INTO customDataKeys (key) VALUES (?);"; - - private ArrayList _playerDataTypes; - - public CustomPlayerDataRepository(JavaPlugin plugin) - { - super(plugin, DBPool.ACCOUNT); - } - - @Override - protected void initialize() - { - _playerDataTypes = new ArrayList<>(); - - executeQuery(RETRIEVE_KEYS, new ResultSetCallable() - { - @Override - public void processResultSet(ResultSet resultSet) throws SQLException - { - while (resultSet.next()) - { - _playerDataTypes.add(new CustomPlayerData(resultSet.getInt("id"), resultSet.getString("key"))); - } - } - }); - } - - @Override - protected void update() {} - - public void addKey(String key) - { - //TODO: add the key with auto-increment ID - //executeUpdate(INSERT_KEY, new ColumnVarChar("")) - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/CustomPlayerData.java b/Plugins/Mineplex.Core/src/mineplex/core/customdata/CustomData.java similarity index 67% rename from Plugins/Mineplex.Core/src/mineplex/core/account/CustomPlayerData.java rename to Plugins/Mineplex.Core/src/mineplex/core/customdata/CustomData.java index b9fb8c9e3..052965b5c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/CustomPlayerData.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/customdata/CustomData.java @@ -1,15 +1,15 @@ -package mineplex.core.account; +package mineplex.core.customdata; /** * Created by William (WilliamTiger). * 16/12/15 */ -public class CustomPlayerData +public class CustomData { private int _id; private String _key; - public CustomPlayerData(int id, String key) + public CustomData(int id, String key) { _id = id; _key = key; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/customdata/CustomDataManager.java b/Plugins/Mineplex.Core/src/mineplex/core/customdata/CustomDataManager.java new file mode 100644 index 000000000..8e92d3ffb --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/customdata/CustomDataManager.java @@ -0,0 +1,64 @@ +package mineplex.core.customdata; + +import java.sql.ResultSet; +import java.sql.SQLException; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.MiniDbClientPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.customdata.repository.CustomDataRepository; + +/** + * Created by William (WilliamTiger). + * 16/12/15 + */ +public class CustomDataManager extends MiniDbClientPlugin +{ + private CustomDataRepository _repository; + + public CustomDataManager(JavaPlugin plugin, CoreClientManager clientManager) + { + super("Custom Data Manager", plugin, clientManager); + + _repository = new CustomDataRepository(plugin, clientManager); + } + + @Override + public void processLoginResultSet(String playerName, int accountId, ResultSet resultSet) throws SQLException + { + PlayerCustomData data = new PlayerCustomData(_repository); + while (resultSet.next()) + { + data.incrementData(_repository.getKey(resultSet.getInt("customDataId")), resultSet.getInt("data")); + } + Set(playerName, data); + } + + @Override + public String getQuery(int accountId, String uuid, String name) + { + return "SELECT accountId, customDataId, data FROM accountCustomData WHERE accountId = " + accountId + ";"; + } + + @Override + protected PlayerCustomData AddPlayer(String player) + { + return new PlayerCustomData(_repository); + } + + @EventHandler + public void onQuit(final PlayerQuitEvent e) + { + getScheduler().runTaskAsynchronously(getPlugin(), new Runnable() + { + @Override + public void run() + { + _repository.saveData(e.getPlayer(), Get(e.getPlayer())); + } + }); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/customdata/PlayerCustomData.java b/Plugins/Mineplex.Core/src/mineplex/core/customdata/PlayerCustomData.java new file mode 100644 index 000000000..28e509aa9 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/customdata/PlayerCustomData.java @@ -0,0 +1,59 @@ +package mineplex.core.customdata; + +import java.util.HashMap; + +import mineplex.core.customdata.repository.CustomDataRepository; + +/** + * Created by William (WilliamTiger). + * 16/12/15 + */ +public class PlayerCustomData +{ + private HashMap _data; + private CustomDataRepository _repository; + + public PlayerCustomData(CustomDataRepository repository) + { + _data = new HashMap<>(); + _repository = repository; + } + + public HashMap getData() + { + return _data; + } + + public void incrementData(CustomData cd, int amount) + { + if (!_data.containsKey(cd)) + { + _data.put(cd, amount); + return; + } + + _data.put(cd, _data.get(cd) + amount); + } + + public void incrementData(String key, int amount) + { + if (_repository.doesKeyExist(key)) + { + incrementData(_repository.getKey(key), amount); + return; + } + + _repository.getClientManager().getScheduler().runTaskAsynchronously( + _repository.getClientManager().getPlugin(), + new Runnable() + { + @Override + public void run() + { + _repository.registerKey(key); // Make sure it's in the DB. + + incrementData(_repository.getKey(key), amount); // Input + } + }); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/customdata/repository/CustomDataRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/customdata/repository/CustomDataRepository.java new file mode 100644 index 000000000..7463cb2c5 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/customdata/repository/CustomDataRepository.java @@ -0,0 +1,140 @@ +package mineplex.core.customdata.repository; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; + +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.customdata.CustomData; +import mineplex.core.customdata.PlayerCustomData; +import mineplex.core.database.DBPool; +import mineplex.core.database.RepositoryBase; +import mineplex.core.database.ResultSetCallable; +import mineplex.core.database.column.ColumnInt; +import mineplex.core.database.column.ColumnVarChar; + +/** + * Created by William (WilliamTiger). + * 16/12/15 + */ +public class CustomDataRepository extends RepositoryBase +{ + private static final String SELECT_KEYS = "SELECT id, name FROM customData;"; + private static final String INSERT_KEY = "INSERT INTO customData (name) VALUES (?);"; + private static final String UPDATE_DATA = "UPDATE accountCustomData SET data = ? WHERE accountId = ? AND customDataId = ?;"; + private static final String INSERT_DATA = "INSERT INTO accountCustomData (accountId, customDataId, data) VALUES (?, ?, ?);"; + + private ArrayList _dataKeys; + + private CoreClientManager _clientManager; + + public CustomDataRepository(JavaPlugin plugin, CoreClientManager clientManager) + { + super(plugin, DBPool.ACCOUNT); + + _clientManager = clientManager; + } + + @Override + protected void initialize() + { + downloadDataKeys(); + } + + @Override + protected void update() {} + + private void downloadDataKeys() + { + _dataKeys = new ArrayList<>(); + + executeQuery(SELECT_KEYS, new ResultSetCallable() + { + @Override + public void processResultSet(ResultSet resultSet) throws SQLException + { + while (resultSet.next()) + { + _dataKeys.add(new CustomData(resultSet.getInt("id"), resultSet.getString("name"))); + } + } + }); + } + + public void saveData(Player player, PlayerCustomData data) + { + for (CustomData cd : data.getData().keySet()) + { + executeQuery(UPDATE_DATA, new ResultSetCallable() + { + @Override + public void processResultSet(ResultSet resultSet) throws SQLException + { + if (!resultSet.next()) + { + // Not already in the DB + executeUpdate( + INSERT_DATA, + new ColumnInt("account", _clientManager.getAccountId(player)), + new ColumnInt("customData", cd.getId()), + new ColumnInt("data", data.getData().get(cd)) + ); + } + } + }, + new ColumnInt("data", data.getData().get(cd)), + new ColumnInt("account", _clientManager.getAccountId(player)), + new ColumnInt("customData", cd.getId()) + ); + } + } + + public void registerKey(String key) + { + if (doesKeyExist(key)) + return; + + executeUpdate(INSERT_KEY, new ColumnVarChar("name", 100, key)); + downloadDataKeys(); + } + + public ArrayList getDataKeys() + { + return _dataKeys; + } + + public boolean doesKeyExist(String key) + { + for (CustomData cur : _dataKeys) + if (cur.getKey().equals(key)) + return true; + + return false; + } + + public CustomData getKey(int id) + { + for (CustomData cur : _dataKeys) + if (cur.getId() == id) + return cur; + + return null; + } + + public CustomData getKey(String key) + { + for (CustomData cur : _dataKeys) + if (cur.getKey().equals(key)) + return cur; + + return null; + } + + public CoreClientManager getClientManager() + { + return _clientManager; + } +} From 4077aa808f6f7adace73893c7ed3a7637fbc9507 Mon Sep 17 00:00:00 2001 From: William Burns Date: Wed, 16 Dec 2015 22:01:51 +0000 Subject: [PATCH 077/113] Add to Arcade and Hub --- Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java | 5 ++++- .../Mineplex.Hub/src/mineplex/hub/HubManager.java | 13 +++++++++++-- .../src/nautilus/game/arcade/Arcade.java | 4 +++- .../src/nautilus/game/arcade/ArcadeManager.java | 9 ++++++++- 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java index 9940694cc..2b36e28bc 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java @@ -14,6 +14,7 @@ import mineplex.core.blockrestore.BlockRestore; import mineplex.core.chat.Chat; import mineplex.core.command.CommandCenter; import mineplex.core.creature.Creature; +import mineplex.core.customdata.CustomDataManager; import mineplex.core.disguise.DisguiseManager; import mineplex.core.donation.DonationManager; import mineplex.core.elo.EloManager; @@ -133,9 +134,11 @@ public class Hub extends JavaPlugin implements IRelation PartyManager partyManager = new PartyManager(this, portal, clientManager, preferenceManager); SkillConditionManager conditionManager = new SkillConditionManager(this); + + CustomDataManager customDataManager = new CustomDataManager(this, clientManager); PersonalServerManager personalServerManager = new PersonalServerManager(this, clientManager); - HubManager hubManager = new HubManager(this, blockRestore, clientManager, donationManager, inventoryManager, conditionManager, disguiseManager, new TaskManager(this, clientManager, webServerAddress), portal, partyManager, preferenceManager, petManager, pollManager, statsManager, achievementManager, new HologramManager(this, packetHandler), npcManager, personalServerManager, packetHandler, punish, serverStatusManager, giveawayManager); + HubManager hubManager = new HubManager(this, blockRestore, clientManager, donationManager, inventoryManager, conditionManager, disguiseManager, new TaskManager(this, clientManager, webServerAddress), portal, partyManager, preferenceManager, petManager, pollManager, statsManager, achievementManager, new HologramManager(this, packetHandler), npcManager, personalServerManager, packetHandler, punish, serverStatusManager, giveawayManager, customDataManager); QueueManager queueManager = new QueueManager(this, clientManager, donationManager, new EloManager(this, clientManager), partyManager); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index 52abd753e..738c79422 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -31,6 +31,7 @@ import mineplex.core.common.util.UtilTextBottom; import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilWorld; import mineplex.core.cosmetic.CosmeticManager; +import mineplex.core.customdata.CustomDataManager; import mineplex.core.disguise.DisguiseManager; import mineplex.core.disguise.disguises.DisguiseSlime; import mineplex.core.donation.DonationManager; @@ -159,6 +160,7 @@ public class HubManager extends MiniClientPlugin private PacketHandler _packetHandler; private PersonalServerManager _personalServerManager; private PlayerCountManager _playerCountManager; + private CustomDataManager _customDataManager; // private HalloweenSpookinessManager _halloweenManager; // private TrickOrTreatManager _trickOrTreatManager; @@ -181,7 +183,7 @@ public class HubManager extends MiniClientPlugin // private final String[] _songNames = {"JingleBells.nbs", "TheFirstNoel.nbs", "Hark.nbs", "DeckTheHalls.nbs", "Joy.nbs", "MerryChristmas.nbs"}; private final ArrayList _songs; - public HubManager(JavaPlugin plugin, BlockRestore blockRestore, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, ConditionManager conditionManager, DisguiseManager disguiseManager, TaskManager taskManager, Portal portal, PartyManager partyManager, PreferencesManager preferences, PetManager petManager, PollManager pollManager, StatsManager statsManager, AchievementManager achievementManager, HologramManager hologramManager, NpcManager npcManager, PersonalServerManager personalServerManager, PacketHandler packetHandler, Punish punish, ServerStatusManager serverStatusManager, GiveawayManager giveawayManager) + public HubManager(JavaPlugin plugin, BlockRestore blockRestore, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, ConditionManager conditionManager, DisguiseManager disguiseManager, TaskManager taskManager, Portal portal, PartyManager partyManager, PreferencesManager preferences, PetManager petManager, PollManager pollManager, StatsManager statsManager, AchievementManager achievementManager, HologramManager hologramManager, NpcManager npcManager, PersonalServerManager personalServerManager, PacketHandler packetHandler, Punish punish, ServerStatusManager serverStatusManager, GiveawayManager giveawayManager, CustomDataManager customDataManager) { super("Hub Manager", plugin); @@ -250,6 +252,8 @@ public class HubManager extends MiniClientPlugin _playerCountManager = new PlayerCountManager(plugin); + _customDataManager = new CustomDataManager(plugin, clientManager); + _songs = new ArrayList(); try @@ -856,7 +860,12 @@ public class HubManager extends MiniClientPlugin return _visibilityManager; } -// public HalloweenSpookinessManager getHalloweenManager() + public CustomDataManager getCustomDataManager() + { + return _customDataManager; + } + + // public HalloweenSpookinessManager getHalloweenManager() // { // return _halloweenManager; // } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java index aa1468fdf..e2ca772b3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java @@ -9,6 +9,7 @@ import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.FoodDupeFix; import mineplex.core.PacketsInteractionFix; import mineplex.core.account.CoreClient; +import mineplex.core.customdata.CustomDataManager; import mineplex.core.giveaway.GiveawayManager; import mineplex.core.globalpacket.GlobalPacketManager; import net.minecraft.server.v1_8_R3.BiomeBase; @@ -149,12 +150,13 @@ public class Arcade extends JavaPlugin cosmeticManager.disableTeamArmor(); GiveawayManager giveawayManager = new GiveawayManager(this, _clientManager, serverStatusManager); + CustomDataManager customDataManager = new CustomDataManager(this, _clientManager); new GlobalPacketManager(this, _clientManager, serverStatusManager, inventoryManager, _donationManager, petManager, statsManager, giveawayManager); //Arcade Manager PollManager pollManager = new PollManager(this, _clientManager, _donationManager); - _gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, statsManager, achievementManager, disguiseManager, creature, teleport, new Blood(this), chat, portal, preferenceManager, inventoryManager, packetHandler, cosmeticManager, projectileManager, petManager, hologramManager, webServerAddress, pollManager, npcmanager, giveawayManager); + _gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, statsManager, achievementManager, disguiseManager, creature, teleport, new Blood(this), chat, portal, preferenceManager, inventoryManager, packetHandler, cosmeticManager, projectileManager, petManager, hologramManager, webServerAddress, pollManager, npcmanager, giveawayManager, customDataManager); new MemoryFix(this); new CustomTagFix(this, packetHandler); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index 7e9d4a156..eeecc1a54 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -28,6 +28,7 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.creature.Creature; +import mineplex.core.customdata.CustomDataManager; import mineplex.core.disguise.DisguiseManager; import mineplex.core.donation.DonationManager; import mineplex.core.elo.EloManager; @@ -191,6 +192,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation private PartyManager _partyManager; private PreferencesManager _preferencesManager; private GiveawayManager _giveawayManager; + private CustomDataManager _customDataManager; private TaskManager _taskManager; private PacketHandler _packetHandler; @@ -219,7 +221,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation CoreClientManager clientManager, DonationManager donationManager, DamageManager damageManager, StatsManager statsManager, AchievementManager achievementManager, DisguiseManager disguiseManager, Creature creature, Teleport teleport, Blood blood, Chat chat, Portal portal, PreferencesManager preferences, InventoryManager inventoryManager, PacketHandler packetHandler, - CosmeticManager cosmeticManager, ProjectileManager projectileManager, PetManager petManager, HologramManager hologramManager, String webAddress, PollManager pollManager, NpcManager npcManager, GiveawayManager giveawayManager) + CosmeticManager cosmeticManager, ProjectileManager projectileManager, PetManager petManager, HologramManager hologramManager, String webAddress, PollManager pollManager, + NpcManager npcManager, GiveawayManager giveawayManager, CustomDataManager customDataManager) { super("Game Manager", plugin); @@ -279,6 +282,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation _eventManager = new EventModule(this, getPlugin()); _giveawayManager = giveawayManager; + _customDataManager = customDataManager; + // Shop _arcadeShop = new ArcadeShop(this, clientManager, donationManager); @@ -598,6 +603,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation return _serverStatusManager; } + public CustomDataManager getCustomDataManager() { return _customDataManager; } + public ChatColor GetColor(Player player) { if (_game == null) From ee202bc7f5210b2a066b700fab864fccfc0adc4b Mon Sep 17 00:00:00 2001 From: William Burns Date: Wed, 16 Dec 2015 22:32:34 +0000 Subject: [PATCH 078/113] Add MineplexPlayer -> ArcadePlayer --- .../core/customdata/MineplexPlayer.java | 41 +++++++++++++++++++ .../core/customdata/PlayerCustomData.java | 11 ++++- .../repository/CustomDataRepository.java | 6 +-- .../nautilus/game/arcade/ArcadeManager.java | 6 +++ .../game/arcade/player/ArcadePlayer.java | 27 +++++++++++- 5 files changed, 85 insertions(+), 6 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/customdata/MineplexPlayer.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/customdata/MineplexPlayer.java b/Plugins/Mineplex.Core/src/mineplex/core/customdata/MineplexPlayer.java new file mode 100644 index 000000000..d9e5a54fa --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/customdata/MineplexPlayer.java @@ -0,0 +1,41 @@ +package mineplex.core.customdata; + +import org.bukkit.entity.Player; + +/** + * Created by William (WilliamTiger). + * 16/12/15 + */ +public abstract class MineplexPlayer +{ + private Player _player; + private CustomDataManager _customDataManager; + + public MineplexPlayer(Player player, CustomDataManager customDataManager) + { + _player = player; + _customDataManager = customDataManager; + } + + public Player getPlayer() + { + return _player; + } + + public String getKeyPrefix() + { + return ""; + } + + public void put(String key, int data) + { + key = getKeyPrefix() + key; + _customDataManager.Get(getPlayer()).incrementData(key, data); + } + + public int get(String key) + { + key = getKeyPrefix() + key; + return _customDataManager.Get(getPlayer()).getData(key); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/customdata/PlayerCustomData.java b/Plugins/Mineplex.Core/src/mineplex/core/customdata/PlayerCustomData.java index 28e509aa9..a7150dc81 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/customdata/PlayerCustomData.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/customdata/PlayerCustomData.java @@ -19,7 +19,7 @@ public class PlayerCustomData _repository = repository; } - public HashMap getData() + public HashMap getDataMap() { return _data; } @@ -56,4 +56,13 @@ public class PlayerCustomData } }); } + + public int getData(String key) + { + if (_data.containsKey(_repository.getKey(key))) + return _data.get(_repository.getKey(key)); + + return -1; + } + } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/customdata/repository/CustomDataRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/customdata/repository/CustomDataRepository.java index 7463cb2c5..271133788 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/customdata/repository/CustomDataRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/customdata/repository/CustomDataRepository.java @@ -66,7 +66,7 @@ public class CustomDataRepository extends RepositoryBase public void saveData(Player player, PlayerCustomData data) { - for (CustomData cd : data.getData().keySet()) + for (CustomData cd : data.getDataMap().keySet()) { executeQuery(UPDATE_DATA, new ResultSetCallable() { @@ -80,12 +80,12 @@ public class CustomDataRepository extends RepositoryBase INSERT_DATA, new ColumnInt("account", _clientManager.getAccountId(player)), new ColumnInt("customData", cd.getId()), - new ColumnInt("data", data.getData().get(cd)) + new ColumnInt("data", data.getDataMap().get(cd)) ); } } }, - new ColumnInt("data", data.getData().get(cd)), + new ColumnInt("data", data.getDataMap().get(cd)), new ColumnInt("account", _clientManager.getAccountId(player)), new ColumnInt("customData", cd.getId()) ); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index eeecc1a54..ee5b9e8ea 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -106,6 +106,7 @@ import nautilus.game.arcade.managers.GameWorldManager; import nautilus.game.arcade.managers.HolidayManager; import nautilus.game.arcade.managers.IdleManager; import nautilus.game.arcade.managers.MiscManager; +import nautilus.game.arcade.player.ArcadePlayer; import nautilus.game.arcade.shop.ArcadeShop; import org.bukkit.Bukkit; @@ -428,6 +429,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation } } + public ArcadePlayer getArcadePlayer(Player player) + { + return new ArcadePlayer(player, getCustomDataManager(), this); + } + public GameServerConfig GetServerConfig() { return _serverConfig; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/player/ArcadePlayer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/player/ArcadePlayer.java index 7b5021ae5..13f27be81 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/player/ArcadePlayer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/player/ArcadePlayer.java @@ -1,6 +1,29 @@ package nautilus.game.arcade.player; -public class ArcadePlayer -{ +import org.bukkit.entity.Player; +import mineplex.core.customdata.CustomDataManager; +import mineplex.core.customdata.MineplexPlayer; +import nautilus.game.arcade.ArcadeManager; + +/** + * Created by William (WilliamTiger). + * 16/12/15 + */ +public class ArcadePlayer extends MineplexPlayer +{ + private ArcadeManager _arcadeManager; + + public ArcadePlayer(Player player, CustomDataManager customDataManager, ArcadeManager arcadeManager) + { + super(player, customDataManager); + + _arcadeManager = arcadeManager; + } + + @Override + public String getKeyPrefix() + { + return "arcade." + _arcadeManager.GetGame().GetName() + "."; + } } From d28c2be1c338726287a52ed8aeab5f88ede1f7b2 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Wed, 16 Dec 2015 20:26:04 -0500 Subject: [PATCH 079/113] Epic chnage that saved the day omg --- .../nautilus/game/arcade/game/games/paintball/Paintball.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java index d345843d0..b432d2361 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java @@ -86,6 +86,7 @@ public class Paintball extends TeamGame new KitShotgun(manager), new KitMachineGun(manager), new KitSniper(manager), + }, new String[] { "Shoot enemies to paint them", @@ -98,6 +99,8 @@ public class Paintball extends TeamGame HungerSet = 20; InventoryClick = false; + + TeamArmorHotbar = true; registerStatTrackers( new KillingSpreeTracker(this), @@ -210,7 +213,7 @@ public class Paintball extends TeamGame } @EventHandler - public void PlayerQuit(PlayerQuitEvent event) + public void onQuit(PlayerQuitEvent event) { Player player = event.getPlayer(); From 7d9b97180db3a99fc0e4f1f74589e6d6bc20b53c Mon Sep 17 00:00:00 2001 From: William Burns Date: Thu, 17 Dec 2015 01:48:55 +0000 Subject: [PATCH 080/113] Testing ArcadePlayer implementation --- .../src/mineplex/core/MiniClientPlugin.java | 3 + .../core/customdata/CustomDataManager.java | 16 ++---- .../repository/CustomDataRepository.java | 56 ++++++++++++------- .../game/games/gladiators/Gladiators.java | 18 ++++++ .../game/arcade/player/ArcadePlayer.java | 2 +- 5 files changed, 64 insertions(+), 31 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/MiniClientPlugin.java b/Plugins/Mineplex.Core/src/mineplex/core/MiniClientPlugin.java index b573392b0..4a9de82de 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/MiniClientPlugin.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/MiniClientPlugin.java @@ -26,6 +26,7 @@ public abstract class MiniClientPlugin extends MiniPlug { synchronized (_clientDataLock) { + saveData(event.GetName()); _clientData.remove(event.GetName()); } } @@ -40,6 +41,8 @@ public abstract class MiniClientPlugin extends MiniPlug return _clientData.get(name); } } + + public void saveData(String name) {} public DataType Get(Player player) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/customdata/CustomDataManager.java b/Plugins/Mineplex.Core/src/mineplex/core/customdata/CustomDataManager.java index 8e92d3ffb..9c0f3ff96 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/customdata/CustomDataManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/customdata/CustomDataManager.java @@ -3,6 +3,7 @@ package mineplex.core.customdata; import java.sql.ResultSet; import java.sql.SQLException; +import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.plugin.java.JavaPlugin; @@ -23,7 +24,7 @@ public class CustomDataManager extends MiniDbClientPlugin { super("Custom Data Manager", plugin, clientManager); - _repository = new CustomDataRepository(plugin, clientManager); + _repository = new CustomDataRepository(plugin, clientManager, this); } @Override @@ -49,16 +50,9 @@ public class CustomDataManager extends MiniDbClientPlugin return new PlayerCustomData(_repository); } - @EventHandler - public void onQuit(final PlayerQuitEvent e) + @Override + public void saveData(String name) { - getScheduler().runTaskAsynchronously(getPlugin(), new Runnable() - { - @Override - public void run() - { - _repository.saveData(e.getPlayer(), Get(e.getPlayer())); - } - }); + _repository.saveData(name); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/customdata/repository/CustomDataRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/customdata/repository/CustomDataRepository.java index 271133788..63a8bb0e3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/customdata/repository/CustomDataRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/customdata/repository/CustomDataRepository.java @@ -9,6 +9,7 @@ import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.customdata.CustomData; +import mineplex.core.customdata.CustomDataManager; import mineplex.core.customdata.PlayerCustomData; import mineplex.core.database.DBPool; import mineplex.core.database.RepositoryBase; @@ -30,12 +31,14 @@ public class CustomDataRepository extends RepositoryBase private ArrayList _dataKeys; private CoreClientManager _clientManager; + private CustomDataManager _customDataManager; - public CustomDataRepository(JavaPlugin plugin, CoreClientManager clientManager) + public CustomDataRepository(JavaPlugin plugin, CoreClientManager clientManager, CustomDataManager customDataManager) { super(plugin, DBPool.ACCOUNT); _clientManager = clientManager; + _customDataManager = customDataManager; } @Override @@ -64,32 +67,47 @@ public class CustomDataRepository extends RepositoryBase }); } - public void saveData(Player player, PlayerCustomData data) + public void saveData(String name) { + PlayerCustomData data = _customDataManager.Get(name); + + System.out.println("saving data for " + name); + System.out.println("size = " + data.getDataMap().keySet().size()); + for (CustomData cd : data.getDataMap().keySet()) { - executeQuery(UPDATE_DATA, new ResultSetCallable() - { - @Override - public void processResultSet(ResultSet resultSet) throws SQLException - { - if (!resultSet.next()) + System.out.println(cd.getKey()); + + executeInsert(UPDATE_DATA, new ResultSetCallable() { - // Not already in the DB - executeUpdate( - INSERT_DATA, - new ColumnInt("account", _clientManager.getAccountId(player)), - new ColumnInt("customData", cd.getId()), - new ColumnInt("data", data.getDataMap().get(cd)) - ); - } - } - }, + @Override + public void processResultSet(ResultSet resultSet) throws SQLException + { + System.out.println("executed update data"); + + if (!resultSet.isBeforeFirst()) + { + System.out.println("empty result set"); + + // Not already in the DB + executeUpdate( + INSERT_DATA, + new ColumnInt("account", _clientManager.Get(name).getAccountId()), + new ColumnInt("customData", cd.getId()), + new ColumnInt("data", data.getDataMap().get(cd)) + ); + } + else + System.out.println("no second execute"); + } + }, new ColumnInt("data", data.getDataMap().get(cd)), - new ColumnInt("account", _clientManager.getAccountId(player)), + new ColumnInt("account", _clientManager.Get(name).getAccountId()), new ColumnInt("customData", cd.getId()) ); } + + System.out.println("complete"); } public void registerKey(String key) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Gladiators.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Gladiators.java index ddb562ae1..b90ed49b2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Gladiators.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Gladiators.java @@ -22,6 +22,7 @@ import org.bukkit.entity.Zombie; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityShootBowEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerQuitEvent; @@ -125,6 +126,23 @@ public class Gladiators extends SoloGame _firstRound = true; } + @EventHandler + public void testPlayer(PlayerCommandPreprocessEvent e) + { + if (!e.getPlayer().getName().equals("WilliamTiger")) + return; + + if (e.getMessage().equalsIgnoreCase("/arcadeplayer")) + { + Manager.getArcadePlayer(e.getPlayer()).put("test", 100); + e.getPlayer().sendMessage(C.cGreen + "Added the test value!"); + } + else if (e.getMessage().equalsIgnoreCase("/getback")) + { + e.getPlayer().sendMessage("value: " + Manager.getArcadePlayer(e.getPlayer()).get("test")); + } + } + @EventHandler public void tutorialStart(GameTutorialStartEvent e) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/player/ArcadePlayer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/player/ArcadePlayer.java index 13f27be81..73ebfaf00 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/player/ArcadePlayer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/player/ArcadePlayer.java @@ -24,6 +24,6 @@ public class ArcadePlayer extends MineplexPlayer @Override public String getKeyPrefix() { - return "arcade." + _arcadeManager.GetGame().GetName() + "."; + return "arcade." + _arcadeManager.GetGame().GetName().toLowerCase().replaceAll(" ", ".") + "."; } } From 66372c397bead6bba72959b84766a70999ed03cd Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Fri, 18 Dec 2015 10:03:03 +1300 Subject: [PATCH 081/113] First version of ResourcePackManager that handles all resource packs globally --- .../core/resourcepack/ResPackManager.java | 41 --- .../core/resourcepack/ResUnloadCheck.java | 9 - .../resourcepack/ResourcePackManager.java | 238 ++++++++++++++++++ .../Mineplex.Hub/src/mineplex/hub/Hub.java | 11 +- .../nautilus/game/arcade/ArcadeManager.java | 208 +-------------- .../src/nautilus/game/arcade/game/Game.java | 2 +- 6 files changed, 250 insertions(+), 259 deletions(-) delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/resourcepack/ResPackManager.java delete mode 100644 Plugins/Mineplex.Core/src/mineplex/core/resourcepack/ResUnloadCheck.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/resourcepack/ResourcePackManager.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/resourcepack/ResPackManager.java b/Plugins/Mineplex.Core/src/mineplex/core/resourcepack/ResPackManager.java deleted file mode 100644 index f51ee8b96..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/resourcepack/ResPackManager.java +++ /dev/null @@ -1,41 +0,0 @@ -package mineplex.core.resourcepack; - -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -import mineplex.core.resourcepack.redis.RedisUnloadResPack; -import mineplex.serverdata.commands.CommandCallback; -import mineplex.serverdata.commands.ServerCommand; -import mineplex.serverdata.commands.ServerCommandManager; - -public class ResPackManager implements CommandCallback -{ - private ResUnloadCheck _packUnloadCheck; - - public ResPackManager(ResUnloadCheck packUnloadCheck) - { - _packUnloadCheck = packUnloadCheck; - - ServerCommandManager.getInstance().registerCommandType("RedisUnloadResPack", RedisUnloadResPack.class, this); - } - - @Override - public void run(ServerCommand command) - { - if (command instanceof RedisUnloadResPack) - { - RedisUnloadResPack redisCommand = (RedisUnloadResPack) command; - - Player player = Bukkit.getPlayerExact(redisCommand.getPlayer()); - - if (player != null) - { - if (_packUnloadCheck.canSendUnload(player)) - { - player.setResourcePack("http://file.mineplex.com/ResReset.zip"); - } - } - } - } - -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/resourcepack/ResUnloadCheck.java b/Plugins/Mineplex.Core/src/mineplex/core/resourcepack/ResUnloadCheck.java deleted file mode 100644 index c25175c58..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/resourcepack/ResUnloadCheck.java +++ /dev/null @@ -1,9 +0,0 @@ -package mineplex.core.resourcepack; - -import org.bukkit.entity.Player; - -public interface ResUnloadCheck -{ - - public boolean canSendUnload(Player player); -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/resourcepack/ResourcePackManager.java b/Plugins/Mineplex.Core/src/mineplex/core/resourcepack/ResourcePackManager.java new file mode 100644 index 000000000..31b41dd06 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/resourcepack/ResourcePackManager.java @@ -0,0 +1,238 @@ +package mineplex.core.resourcepack; + +import java.util.Iterator; +import java.util.Map.Entry; + +import org.bukkit.Bukkit; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.PlayerResourcePackStatusEvent; +import org.bukkit.event.player.PlayerResourcePackStatusEvent.Status; +import org.bukkit.plugin.java.JavaPlugin; + +import com.google.common.base.Objects; + +import mineplex.core.MiniPlugin; +import mineplex.core.common.jsonchat.ClickEvent; +import mineplex.core.common.jsonchat.JsonMessage; +import mineplex.core.common.util.C; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.portal.Portal; +import mineplex.core.resourcepack.redis.RedisUnloadResPack; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.serverdata.commands.CommandCallback; +import mineplex.serverdata.commands.ServerCommand; +import mineplex.serverdata.commands.ServerCommandManager; + +public class ResourcePackManager extends MiniPlugin implements CommandCallback +{ + private String _resourcePackUrl; + private boolean _resourcePackRequired; + private NautHashMap _resourcePackUsers = new NautHashMap(); + private NautHashMap _resourcePackNoResponse = new NautHashMap(); + private Portal _portal; + + public ResourcePackManager(JavaPlugin plugin, Portal portal) + { + super("Resource Pack Manager", plugin); + + _portal = portal; + + ServerCommandManager.getInstance().registerCommandType("RedisUnloadResPack", RedisUnloadResPack.class, this); + } + + @EventHandler + public void ResourcePackJoin(PlayerJoinEvent event) + { + Player player = event.getPlayer(); + + if (_resourcePackUrl == null) + { + return; + } + + if (_resourcePackRequired) + { + _resourcePackNoResponse.put(player.getName(), System.currentTimeMillis()); + } + + _resourcePackUsers.put(player.getName(), false); + player.setResourcePack(_resourcePackUrl); + } + + @EventHandler + public void onSecond(UpdateEvent event) + { + Iterator> itel = _resourcePackNoResponse.entrySet().iterator(); + + while (itel.hasNext()) + { + Entry entry = itel.next(); + + if (!UtilTime.elapsed(entry.getValue(), 20000)) + { + continue; + } + + Player player = Bukkit.getPlayerExact(entry.getKey()); + + if (player == null) + { + itel.remove(); + continue; + } + + // Send it again, enforce it! + _resourcePackNoResponse.put(player.getName(), System.currentTimeMillis()); + player.setResourcePack(_resourcePackUrl); + } + } + + @EventHandler + public void onResourcePackStatus(PlayerResourcePackStatusEvent event) + { + if (_resourcePackUrl == null) + { + return; + } + + Player player = event.getPlayer(); + + if (_resourcePackRequired) + { + if (event.getStatus() == Status.ACCEPTED) + { + _resourcePackNoResponse.remove(player.getName()); + } + else if (event.getStatus() == Status.DECLINED) + { + _resourcePackNoResponse.remove(player.getName()); + + UtilPlayer.message(player, " "); + JsonMessage message = new JsonMessage("").color("gold").bold() + .extra("You need to accept the resource pack!\n" + "Click me for instructions on how to fix this!") + + .click(ClickEvent.OPEN_URL, + + "http://mineplex.com/forums/m/11929946/viewthread/21554536-wizards-resource-pack-help"); + + message.sendToPlayer(player); + UtilPlayer.message(player, " "); + + returnHubNoResPack(player); + } + else if (event.getStatus() == Status.FAILED_DOWNLOAD) + { + _resourcePackNoResponse.remove(player.getName()); + + returnHubNoResPack(player, "Failed to download resource pack!"); + + return; + } + } + + if (event.getStatus() == Status.ACCEPTED || event.getStatus() == Status.SUCCESSFULLY_LOADED) + { + _resourcePackUsers.put(player.getName(), true); + } + else + { + _resourcePackUsers.remove(player.getName()); + } + } + + @EventHandler + public void ResourcePackQuit(PlayerQuitEvent event) + { + Player player = event.getPlayer(); + + if (!_resourcePackUsers.containsKey(player.getName()) || !_resourcePackUsers.get(player.getName())) + { + return; + } + + new RedisUnloadResPack(player.getName()).publish(); + + _resourcePackUsers.remove(player.getName()); + } + + private void returnHubNoResPack(Player player) + { + player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 10f, 1f); + _portal.sendPlayerToServer(player, "Lobby"); + } + + private void returnHubNoResPack(Player player, String message) + { + UtilPlayer.message(player, " "); + UtilPlayer.message(player, C.cGold + C.Bold + message); + UtilPlayer.message(player, " "); + + returnHubNoResPack(player); + } + + public void setResourcePack(String resourcePack, boolean forceResourcePack) + { + if (Objects.equal(resourcePack, _resourcePackUrl) && forceResourcePack == _resourcePackRequired) + { + return; + } + + _resourcePackNoResponse.clear(); + _resourcePackUsers.clear(); + _resourcePackUrl = resourcePack == null || resourcePack.isEmpty() ? null : resourcePack; + _resourcePackRequired = forceResourcePack; + + if (_resourcePackUrl == null || _resourcePackUrl.isEmpty()) + { + _resourcePackRequired = false; + + for (Player player : Bukkit.getOnlinePlayers()) + { + player.setResourcePack("http://file.mineplex.com/ResReset.zip"); + } + } + else + { + for (Player player : Bukkit.getOnlinePlayers()) + { + if (_resourcePackRequired) + { + _resourcePackNoResponse.put(player.getName(), System.currentTimeMillis()); + } + + _resourcePackUsers.put(player.getName(), false); + player.setResourcePack(_resourcePackUrl); + } + } + } + + @Override + public void run(ServerCommand command) + { + if (command instanceof RedisUnloadResPack) + { + RedisUnloadResPack redisCommand = (RedisUnloadResPack) command; + + Player player = Bukkit.getPlayerExact(redisCommand.getPlayer()); + + if (player == null) + { + return; + } + + if (_resourcePackUsers.containsKey(player.getName())) + { + return; + } + + player.setResourcePack("http://file.mineplex.com/ResReset.zip"); + } + } + +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java index 9940694cc..e889b76da 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java @@ -42,8 +42,7 @@ import mineplex.core.profileCache.ProfileCacheManager; import mineplex.core.projectile.ProjectileManager; import mineplex.core.punish.Punish; import mineplex.core.recharge.Recharge; -import mineplex.core.resourcepack.ResUnloadCheck; -import mineplex.core.resourcepack.ResPackManager; +import mineplex.core.resourcepack.ResourcePackManager; import mineplex.core.serverConfig.ServerConfiguration; import mineplex.core.stats.StatsManager; import mineplex.core.status.ServerStatusManager; @@ -146,13 +145,7 @@ public class Hub extends JavaPlugin implements IRelation new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion()); new CustomTagFix(this, packetHandler); new PacketsInteractionFix(this, packetHandler); - new ResPackManager(new ResUnloadCheck() - { - public boolean canSendUnload(Player player) - { - return true; - } - }); + new ResourcePackManager(this, portal); new GlobalPacketManager(this, clientManager, serverStatusManager, inventoryManager, donationManager, petManager, statsManager, giveawayManager); //new Replay(this, packetHandler); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index 7e9d4a156..5eed173fb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -3,9 +3,6 @@ package nautilus.game.arcade; import java.io.File; import java.util.ArrayList; import java.util.HashSet; -import java.util.Iterator; -import java.util.Map.Entry; - import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.achievement.AchievementManager; @@ -14,18 +11,14 @@ import mineplex.core.blood.Blood; import mineplex.core.bonuses.BonusManager; import mineplex.core.chat.Chat; import mineplex.core.common.Rank; -import mineplex.core.common.jsonchat.ClickEvent; -import mineplex.core.common.jsonchat.JsonMessage; import mineplex.core.common.util.C; import mineplex.core.common.util.Callback; import mineplex.core.common.util.F; -import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilTime; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.creature.Creature; import mineplex.core.disguise.DisguiseManager; @@ -39,7 +32,6 @@ import mineplex.core.hologram.HologramManager; import mineplex.core.inventory.InventoryManager; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.movement.Movement; -import mineplex.core.notifier.NotificationManager; import mineplex.core.npc.NpcManager; import mineplex.core.packethandler.PacketHandler; import mineplex.core.party.PartyManager; @@ -48,9 +40,7 @@ import mineplex.core.poll.PollManager; import mineplex.core.portal.Portal; import mineplex.core.preferences.PreferencesManager; import mineplex.core.projectile.ProjectileManager; -import mineplex.core.resourcepack.ResPackManager; -import mineplex.core.resourcepack.ResUnloadCheck; -import mineplex.core.resourcepack.redis.RedisUnloadResPack; +import mineplex.core.resourcepack.ResourcePackManager; import mineplex.core.reward.RewardData; import mineplex.core.reward.RewardRarity; import mineplex.core.reward.rewards.PetReward; @@ -60,7 +50,6 @@ import mineplex.core.task.TaskManager; import mineplex.core.teleport.Teleport; import mineplex.core.timing.TimingManager; import mineplex.core.titangiveaway.TitanGiveawayManager; -import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.classcombat.Class.ClassManager; import mineplex.minecraft.game.classcombat.Condition.SkillConditionManager; import mineplex.minecraft.game.classcombat.Skill.SkillFactory; @@ -112,7 +101,6 @@ import org.bukkit.ChatColor; import org.bukkit.GameMode; import org.bukkit.Material; import org.bukkit.OfflinePlayer; -import org.bukkit.Sound; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Entity; @@ -132,13 +120,9 @@ import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.event.player.PlayerResourcePackStatusEvent; -import org.bukkit.event.player.PlayerResourcePackStatusEvent.Status; import org.bukkit.event.server.ServerListPingEvent; import org.bukkit.potion.PotionEffect; import org.bukkit.util.Vector; - -import com.google.common.base.Objects; public class ArcadeManager extends MiniPlugin implements IRelation { @@ -191,15 +175,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation private PartyManager _partyManager; private PreferencesManager _preferencesManager; private GiveawayManager _giveawayManager; + private ResourcePackManager _resourcePackManager; private TaskManager _taskManager; private PacketHandler _packetHandler; - private String _resourcePackUrl; - private boolean _resourcePackRequired; - private NautHashMap _resourcePackUsers = new NautHashMap(); - private NautHashMap _resourcePackNoResponse = new NautHashMap(); - // Observers private HashSet _specList = new HashSet(); @@ -278,6 +258,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation _petManager = petManager; _eventManager = new EventModule(this, getPlugin()); _giveawayManager = giveawayManager; + _resourcePackManager = new ResourcePackManager(plugin, portal); // Shop _arcadeShop = new ArcadeShop(this, clientManager, donationManager); @@ -340,19 +321,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation }, 80L); } - new ResPackManager(new ResUnloadCheck() - { - public boolean canSendUnload(Player player) - { - if (_resourcePackUsers.containsKey(player.getName())) - { - return false; - } - - return true; - } - }); - loadRequiredRank(); } @@ -365,69 +333,17 @@ public class ArcadeManager extends MiniPlugin implements IRelation addCommand(new DisguiseCommand(this)); addCommand(new RequiredRankCommand(this)); } - - @EventHandler - public void onResourcePackStatus(PlayerResourcePackStatusEvent event) - { - if (_resourcePackUrl == null) - { - return; - } - - Player player = event.getPlayer(); - - if (_resourcePackRequired) - { - if (event.getStatus() == Status.ACCEPTED) - { - _resourcePackNoResponse.remove(player.getName()); - } - else if (event.getStatus() == Status.DECLINED) - { - _resourcePackNoResponse.remove(player.getName()); - - UtilPlayer.message(player, " "); - JsonMessage message = new JsonMessage("") - .color("gold") - .bold() - .extra("You need to accept the resource pack!\n" - + "Click me for instructions on how to fix this!") - - .click(ClickEvent.OPEN_URL, - - "http://mineplex.com/forums/m/11929946/viewthread/21554536-wizards-resource-pack-help"); - - message.sendToPlayer(player); - UtilPlayer.message(player, " "); - - returnHubNoResPack(player); - } - else if (event.getStatus() == Status.FAILED_DOWNLOAD) - { - _resourcePackNoResponse.remove(player.getName()); - - returnHubNoResPack(player, "Failed to download resource pack!"); - - return; - } - } - - if (event.getStatus() == Status.ACCEPTED - || event.getStatus() == Status.SUCCESSFULLY_LOADED) - { - _resourcePackUsers.put(player.getName(), true); - } - else - { - _resourcePackUsers.remove(player.getName()); - } - } public GameServerConfig GetServerConfig() { return _serverConfig; } + public ResourcePackManager getResourcePackManager() + { + return _resourcePackManager; + } + public ArrayList GetGameList() { return GetServerConfig().GameList; @@ -1431,116 +1347,10 @@ public class ArcadeManager extends MiniPlugin implements IRelation public boolean isSpectator(Entity player) { if (player instanceof Player) - return UtilPlayer.isSpectator((Player)player); + return UtilPlayer.isSpectator((Player) player); return false; } - @EventHandler - public void onSecond(UpdateEvent event) - { - Iterator> itel = _resourcePackNoResponse.entrySet().iterator(); - - while (itel.hasNext()) - { - Entry entry = itel.next(); - - if (UtilTime.elapsed(entry.getValue(), 20000)) - { - Player player = Bukkit.getPlayerExact(entry.getKey()); - - if (player != null) - { - // Send it again, enforce it! - _resourcePackNoResponse.put(player.getName(), System.currentTimeMillis()); - player.setResourcePack(_resourcePackUrl); - } - else - { - itel.remove(); - } - } - } - } - - @EventHandler - public void ResourcePackQuit(PlayerQuitEvent event) - { - Player player = event.getPlayer(); - - if (_resourcePackUsers.containsKey(player.getName()) && _resourcePackUsers.get(player.getName())) - { - new RedisUnloadResPack(player.getName()).publish(); - - _resourcePackUsers.remove(player.getName()); - } - } - - private void returnHubNoResPack(Player player) - { - player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 10f, 1f); - GetPortal().sendPlayerToServer(player, "Lobby"); - } - - private void returnHubNoResPack(Player player, String message) - { - UtilPlayer.message(player, " "); - UtilPlayer.message(player, C.cGold + C.Bold + message); - UtilPlayer.message(player, " "); - - returnHubNoResPack(player); - } - - @EventHandler - public void ResourcePackJoin(PlayerJoinEvent event) - { - Player player = event.getPlayer(); - - if (_resourcePackUrl != null) - { - if (_resourcePackRequired) - { - _resourcePackNoResponse.put(player.getName(), System.currentTimeMillis()); - } - - _resourcePackUsers.put(player.getName(), false); - player.setResourcePack(_resourcePackUrl); - } - } - - public void setResourcePack(String resourcePack, boolean forceResourcePack) - { - if (!Objects.equal(resourcePack, _resourcePackUrl) || forceResourcePack != _resourcePackRequired) - { - _resourcePackNoResponse.clear(); - _resourcePackUsers.clear(); - _resourcePackUrl = resourcePack == null || resourcePack.isEmpty() ? null : resourcePack; - _resourcePackRequired = forceResourcePack; - - if (_resourcePackUrl == null || _resourcePackUrl.isEmpty()) - { - _resourcePackRequired = false; - - for (Player player : Bukkit.getOnlinePlayers()) - { - player.setResourcePack("http://file.mineplex.com/ResReset.zip"); - } - } - else - { - for (Player player : Bukkit.getOnlinePlayers()) - { - if (_resourcePackRequired) - { - _resourcePackNoResponse.put(player.getName(), System.currentTimeMillis()); - } - - _resourcePackUsers.put(player.getName(), false); - player.setResourcePack(_resourcePackUrl); - } - } - } - } - public void loadRequiredRank() { _requiredRank = null; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index 1d6947f06..6eec52eb7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -383,7 +383,7 @@ public abstract class Game implements Listener new ExperienceStatTracker(this), new WinStatTracker(this), new LoseStatTracker(this), new DamageDealtStatTracker( this), new DamageTakenStatTracker(this), new GamesPlayedStatTracker(this)); - Manager.setResourcePack(gameType.getResourcePackUrl(), gameType.isEnforceResourcePack()); + Manager.getResourcePackManager().setResourcePack(gameType.getResourcePackUrl(), gameType.isEnforceResourcePack()); _useEntityPacketHandler = new IPacketHandler() { From 5c045bfce424190bbf95d41c8747c112d968231b Mon Sep 17 00:00:00 2001 From: William Burns Date: Thu, 17 Dec 2015 21:27:44 +0000 Subject: [PATCH 082/113] Changes to core client manager, and finishing custom data! --- .../src/mineplex/core/MiniClientPlugin.java | 4 ++-- .../core/account/CoreClientManager.java | 12 ++++++----- .../core/account/event/ClientUnloadEvent.java | 11 ++++++++-- .../mineplex/core/customdata/CorePlayer.java | 21 +++++++++++++++++++ .../core/customdata/CustomDataManager.java | 11 +++++++--- .../core/customdata/PlayerCustomData.java | 8 +------ .../repository/CustomDataRepository.java | 16 +++----------- .../game/games/gladiators/Gladiators.java | 17 --------------- 8 files changed, 51 insertions(+), 49 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/customdata/CorePlayer.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/MiniClientPlugin.java b/Plugins/Mineplex.Core/src/mineplex/core/MiniClientPlugin.java index 4a9de82de..397e6d0c5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/MiniClientPlugin.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/MiniClientPlugin.java @@ -26,7 +26,7 @@ public abstract class MiniClientPlugin extends MiniPlug { synchronized (_clientDataLock) { - saveData(event.GetName()); + saveData(event.GetName(), event.getAccountId()); _clientData.remove(event.GetName()); } } @@ -42,7 +42,7 @@ public abstract class MiniClientPlugin extends MiniPlug } } - public void saveData(String name) {} + public void saveData(String name, int accountId) {} public DataType Get(Player player) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java index 74f339854..7228b671e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java @@ -103,14 +103,15 @@ public class CoreClientManager extends MiniPlugin return newClient; } - public void Del(String name) + public void Del(String name, int accountId) { synchronized(_clientLock) { _clientList.remove(name); } - _plugin.getServer().getPluginManager().callEvent(new ClientUnloadEvent(name)); + // rawr added account id for custom data - william + _plugin.getServer().getPluginManager().callEvent(new ClientUnloadEvent(name, accountId)); } public CoreClient Get(String name) @@ -406,7 +407,7 @@ public class CoreClientManager extends MiniPlugin if (!_duplicateLoginGlitchPreventionList.contains(event.getPlayer().getName())) { - Del(event.getPlayer().getName()); + Del(event.getPlayer().getName(), _clientList.get(event.getPlayer().getName()).getAccountId()); _duplicateLoginGlitchPreventionList.remove(event.getPlayer().getName()); } } @@ -528,7 +529,8 @@ public class CoreClientManager extends MiniPlugin { for (Iterator> clientIterator = _clientList.entrySet().iterator(); clientIterator.hasNext();) { - Player clientPlayer = clientIterator.next().getValue().GetPlayer(); + CoreClient client = clientIterator.next().getValue(); // rawr, needed this for custom data - william + Player clientPlayer = client.GetPlayer(); if (clientPlayer != null && !clientPlayer.isOnline()) { @@ -536,7 +538,7 @@ public class CoreClientManager extends MiniPlugin if (clientPlayer != null) { - _plugin.getServer().getPluginManager().callEvent(new ClientUnloadEvent(clientPlayer.getName())); + _plugin.getServer().getPluginManager().callEvent(new ClientUnloadEvent(clientPlayer.getName(), client.getAccountId())); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/event/ClientUnloadEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/account/event/ClientUnloadEvent.java index 972b1f612..d0d2d467a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/event/ClientUnloadEvent.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/event/ClientUnloadEvent.java @@ -8,17 +8,24 @@ public class ClientUnloadEvent extends Event private static final HandlerList handlers = new HandlerList(); private String _name; + private int _accountId; - public ClientUnloadEvent(String name) + public ClientUnloadEvent(String name, int accountId) { _name = name; + _accountId = accountId; } public String GetName() { return _name; } - + + public int getAccountId() + { + return _accountId; + } + public HandlerList getHandlers() { return handlers; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/customdata/CorePlayer.java b/Plugins/Mineplex.Core/src/mineplex/core/customdata/CorePlayer.java new file mode 100644 index 000000000..14aaec660 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/customdata/CorePlayer.java @@ -0,0 +1,21 @@ +package mineplex.core.customdata; + +import org.bukkit.entity.Player; + +/** + * Created by William (WilliamTiger). + * 17/12/15 + */ +public class CorePlayer extends MineplexPlayer +{ + public CorePlayer(Player player, CustomDataManager customDataManager) + { + super(player, customDataManager); + } + + @Override + public String getKeyPrefix() + { + return "core."; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/customdata/CustomDataManager.java b/Plugins/Mineplex.Core/src/mineplex/core/customdata/CustomDataManager.java index 9c0f3ff96..11ca1c388 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/customdata/CustomDataManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/customdata/CustomDataManager.java @@ -41,7 +41,7 @@ public class CustomDataManager extends MiniDbClientPlugin @Override public String getQuery(int accountId, String uuid, String name) { - return "SELECT accountId, customDataId, data FROM accountCustomData WHERE accountId = " + accountId + ";"; + return "SELECT accountId, customDataId, data FROM accountCustomData INNER JOIN customData ON customData.id = accountCustomData.customDataId WHERE accountId = " + accountId + ";"; } @Override @@ -51,8 +51,13 @@ public class CustomDataManager extends MiniDbClientPlugin } @Override - public void saveData(String name) + public void saveData(String name, int accountId) { - _repository.saveData(name); + _repository.saveData(name, accountId); + } + + public CorePlayer getCorePlayer(Player player) + { + return new CorePlayer(player, this); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/customdata/PlayerCustomData.java b/Plugins/Mineplex.Core/src/mineplex/core/customdata/PlayerCustomData.java index a7150dc81..9e1d5db78 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/customdata/PlayerCustomData.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/customdata/PlayerCustomData.java @@ -26,13 +26,7 @@ public class PlayerCustomData public void incrementData(CustomData cd, int amount) { - if (!_data.containsKey(cd)) - { - _data.put(cd, amount); - return; - } - - _data.put(cd, _data.get(cd) + amount); + _data.put(cd, amount); } public void incrementData(String key, int amount) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/customdata/repository/CustomDataRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/customdata/repository/CustomDataRepository.java index 63a8bb0e3..c57e2a03f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/customdata/repository/CustomDataRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/customdata/repository/CustomDataRepository.java @@ -67,47 +67,37 @@ public class CustomDataRepository extends RepositoryBase }); } - public void saveData(String name) + public void saveData(String name, int accountId) { PlayerCustomData data = _customDataManager.Get(name); - System.out.println("saving data for " + name); - System.out.println("size = " + data.getDataMap().keySet().size()); - for (CustomData cd : data.getDataMap().keySet()) { - System.out.println(cd.getKey()); executeInsert(UPDATE_DATA, new ResultSetCallable() { @Override public void processResultSet(ResultSet resultSet) throws SQLException { - System.out.println("executed update data"); if (!resultSet.isBeforeFirst()) { - System.out.println("empty result set"); // Not already in the DB executeUpdate( INSERT_DATA, - new ColumnInt("account", _clientManager.Get(name).getAccountId()), + new ColumnInt("account", accountId), new ColumnInt("customData", cd.getId()), new ColumnInt("data", data.getDataMap().get(cd)) ); } - else - System.out.println("no second execute"); } }, new ColumnInt("data", data.getDataMap().get(cd)), - new ColumnInt("account", _clientManager.Get(name).getAccountId()), + new ColumnInt("account", accountId), new ColumnInt("customData", cd.getId()) ); } - - System.out.println("complete"); } public void registerKey(String key) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Gladiators.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Gladiators.java index b90ed49b2..a9fcae09a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Gladiators.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gladiators/Gladiators.java @@ -126,23 +126,6 @@ public class Gladiators extends SoloGame _firstRound = true; } - @EventHandler - public void testPlayer(PlayerCommandPreprocessEvent e) - { - if (!e.getPlayer().getName().equals("WilliamTiger")) - return; - - if (e.getMessage().equalsIgnoreCase("/arcadeplayer")) - { - Manager.getArcadePlayer(e.getPlayer()).put("test", 100); - e.getPlayer().sendMessage(C.cGreen + "Added the test value!"); - } - else if (e.getMessage().equalsIgnoreCase("/getback")) - { - e.getPlayer().sendMessage("value: " + Manager.getArcadePlayer(e.getPlayer()).get("test")); - } - } - @EventHandler public void tutorialStart(GameTutorialStartEvent e) { From 3e8c3cb9280cc2dfe3b05c222e16102f2509f2d9 Mon Sep 17 00:00:00 2001 From: William Burns Date: Thu, 17 Dec 2015 22:16:05 +0000 Subject: [PATCH 083/113] Changed to setData in PlayerCustomData --- .../core/customdata/CustomDataManager.java | 4 +--- .../core/customdata/MineplexPlayer.java | 2 +- .../core/customdata/PlayerCustomData.java | 22 +++++++++---------- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/customdata/CustomDataManager.java b/Plugins/Mineplex.Core/src/mineplex/core/customdata/CustomDataManager.java index 11ca1c388..cd0543674 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/customdata/CustomDataManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/customdata/CustomDataManager.java @@ -4,8 +4,6 @@ import java.sql.ResultSet; import java.sql.SQLException; import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.MiniDbClientPlugin; @@ -33,7 +31,7 @@ public class CustomDataManager extends MiniDbClientPlugin PlayerCustomData data = new PlayerCustomData(_repository); while (resultSet.next()) { - data.incrementData(_repository.getKey(resultSet.getInt("customDataId")), resultSet.getInt("data")); + data.setData(_repository.getKey(resultSet.getInt("customDataId")), resultSet.getInt("data")); } Set(playerName, data); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/customdata/MineplexPlayer.java b/Plugins/Mineplex.Core/src/mineplex/core/customdata/MineplexPlayer.java index d9e5a54fa..e49f75211 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/customdata/MineplexPlayer.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/customdata/MineplexPlayer.java @@ -30,7 +30,7 @@ public abstract class MineplexPlayer public void put(String key, int data) { key = getKeyPrefix() + key; - _customDataManager.Get(getPlayer()).incrementData(key, data); + _customDataManager.Get(getPlayer()).setData(key, data); } public int get(String key) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/customdata/PlayerCustomData.java b/Plugins/Mineplex.Core/src/mineplex/core/customdata/PlayerCustomData.java index 9e1d5db78..961d68023 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/customdata/PlayerCustomData.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/customdata/PlayerCustomData.java @@ -24,31 +24,31 @@ public class PlayerCustomData return _data; } - public void incrementData(CustomData cd, int amount) + public void setData(CustomData cd, int amount) { _data.put(cd, amount); } - public void incrementData(String key, int amount) + public void setData(String key, int amount) { if (_repository.doesKeyExist(key)) { - incrementData(_repository.getKey(key), amount); + setData(_repository.getKey(key), amount); return; } _repository.getClientManager().getScheduler().runTaskAsynchronously( _repository.getClientManager().getPlugin(), new Runnable() - { - @Override - public void run() - { - _repository.registerKey(key); // Make sure it's in the DB. + { + @Override + public void run() + { + _repository.registerKey(key); // Make sure it's in the DB. - incrementData(_repository.getKey(key), amount); // Input - } - }); + setData(_repository.getKey(key), amount); // Input + } + }); } public int getData(String key) From e7243d4b9c814266ebe3c03a08730b054fadc56b Mon Sep 17 00:00:00 2001 From: William Burns Date: Thu, 17 Dec 2015 22:19:45 +0000 Subject: [PATCH 084/113] Re-add getArcadePlayer(Player player) --- .../src/nautilus/game/arcade/ArcadeManager.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index c4026ff48..d0c003551 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -104,6 +104,7 @@ import nautilus.game.arcade.managers.GameWorldManager; import nautilus.game.arcade.managers.HolidayManager; import nautilus.game.arcade.managers.IdleManager; import nautilus.game.arcade.managers.MiscManager; +import nautilus.game.arcade.player.ArcadePlayer; import nautilus.game.arcade.shop.ArcadeShop; import org.bukkit.Bukkit; @@ -1444,4 +1445,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation event.setCancelled(true); } } + + public ArcadePlayer getArcadePlayer(Player player) + { + return new ArcadePlayer(player, getCustomDataManager(), this); + } } From 2953fe395fb3650b3e058b506c74d53af72f56e2 Mon Sep 17 00:00:00 2001 From: Jonathan Williams Date: Thu, 17 Dec 2015 18:33:49 -0500 Subject: [PATCH 085/113] Changed dns api key to new key. Prevent server monitor redis calls to cause restarts. Added winter chests to customer support. --- .../bungee/api/DnsMadeEasyApiCallBase.java | 4 +- Plugins/Mineplex.Core/.classpath | 2 +- .../mineplex/servermonitor/ServerMonitor.java | 52 +++++++++++-------- .../customerSupport/CustomerSupport.java | 13 +++++ 4 files changed, 47 insertions(+), 24 deletions(-) diff --git a/Plugins/Mineplex.BungeeRotator/src/mineplex/bungee/api/DnsMadeEasyApiCallBase.java b/Plugins/Mineplex.BungeeRotator/src/mineplex/bungee/api/DnsMadeEasyApiCallBase.java index f4e7aac72..57dc55496 100644 --- a/Plugins/Mineplex.BungeeRotator/src/mineplex/bungee/api/DnsMadeEasyApiCallBase.java +++ b/Plugins/Mineplex.BungeeRotator/src/mineplex/bungee/api/DnsMadeEasyApiCallBase.java @@ -51,13 +51,13 @@ public abstract class DnsMadeEasyApiCallBase try { String timeStamp = getServerTime(); - SecretKeySpec keySpec = new SecretKeySpec("35bb3b97-3815-4b63-b60b-eb1882c07b40".getBytes(), "HmacSHA1"); + SecretKeySpec keySpec = new SecretKeySpec("9041bc01-5cbc-49cf-ae09-a23b98350c62".getBytes(), "HmacSHA1"); Mac mac = Mac.getInstance("HmacSHA1"); mac.init(keySpec); byte[] hashBytes = mac.doFinal((timeStamp + "").getBytes()); Hex.encodeHexString(hashBytes); - request.addHeader("x-dnsme-apiKey", "a9750980-b7df-4a7e-a047-2ade43628f0d"); + request.addHeader("x-dnsme-apiKey", "2039c697-6ca9-412f-abda-0aef659a382a"); request.addHeader("x-dnsme-requestDate", timeStamp + ""); request.addHeader("x-dnsme-hmac", Hex.encodeHexString(hashBytes)); request.addHeader("Content-Type", "application/json"); diff --git a/Plugins/Mineplex.Core/.classpath b/Plugins/Mineplex.Core/.classpath index ea3a54132..4213d7778 100644 --- a/Plugins/Mineplex.Core/.classpath +++ b/Plugins/Mineplex.Core/.classpath @@ -13,7 +13,7 @@ - + diff --git a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerMonitor.java b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerMonitor.java index 8056b8d2a..cb57dc313 100644 --- a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerMonitor.java +++ b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerMonitor.java @@ -406,30 +406,40 @@ public class ServerMonitor if (deadServer.getUptime() <= 10 || ignoreServer(deadServer.getGroup())) continue; - if (_count == 0 || deadServers.contains(deadServer.getName())) + try { - copyServerLog(deadServer); - killServer(deadServer.getName(), deadServer.getPublicAddress(), deadServer.getPlayerCount(), "[KILLED] [DEAD] " + deadServer.getName() + ":" + deadServer.getPublicAddress(), true); - - handleUserServerGroup(_serverGroupMap.get(deadServer.getGroup())); - } - else if (!_delayedKill.contains(deadServer.getName())) - { - startTimingReport(deadServer); - - _timer.schedule(new TimerTask() + if (_count == 0 || deadServers.contains(deadServer.getName())) { - public void run() + if (_count != 0) + copyServerLog(deadServer); + + killServer(deadServer.getName(), deadServer.getPublicAddress(), deadServer.getPlayerCount(), "[KILLED] [DEAD] " + deadServer.getName() + ":" + deadServer.getPublicAddress(), true); + + handleUserServerGroup(_serverGroupMap.get(deadServer.getGroup())); + } + else if (!_delayedKill.contains(deadServer.getName())) + { + startTimingReport(deadServer); + + _timer.schedule(new TimerTask() { - _deadServers.add(deadServer.getName()); - _delayedKill.remove(deadServer.getName()); - - stopTimingReport(deadServer); - log("[IMPENDING DEATH] : " + deadServer.getName() + ":" + deadServer.getPublicAddress()); - } - }, 20 * 1000); - - _delayedKill.add(deadServer.getName()); + public void run() + { + _deadServers.add(deadServer.getName()); + _delayedKill.remove(deadServer.getName()); + + stopTimingReport(deadServer); + log("[IMPENDING DEATH] : " + deadServer.getName() + ":" + deadServer.getPublicAddress()); + } + }, 20 * 1000); + + _delayedKill.add(deadServer.getName()); + } + } + catch (Exception exception) + { + log("[ERROR] : Trying to delete " + deadServer.getName() + ":" + deadServer.getPublicAddress()); + exception.printStackTrace(); } } } diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java index 99fd02eb4..1f12a4982 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java @@ -105,6 +105,7 @@ public class CustomerSupport extends MiniPlugin int oldChestsReceived = 0; int ancientChestsReceived = 0; int mythicalChestsReceived = 0; + int winterChestsReceived = 0; for (CoinTransactionToken transaction : donor.getCoinTransactions()) { @@ -150,12 +151,24 @@ public class CustomerSupport extends MiniPlugin } } + if (transaction.SalesPackageName.startsWith("Winter Chest")) + { + if (transaction.Coins == 0 && transaction.Gems == 0) + { + if (transaction.SalesPackageName.split(" ").length == 3) + winterChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]); + else if (transaction.SalesPackageName.split(" ").length == 2) + winterChestsReceived += 1; + } + + } } caller.sendMessage(C.cBlue + "Enjin Coin Total Received : " + C.cYellow + enjinCoinsReceived); caller.sendMessage(C.cBlue + "Old Chests Received : " + C.cYellow + oldChestsReceived); caller.sendMessage(C.cBlue + "Ancient Chests Received : " + C.cYellow + ancientChestsReceived); caller.sendMessage(C.cBlue + "Mythical Chests Received : " + C.cYellow + mythicalChestsReceived); + caller.sendMessage(C.cBlue + "Winter Chests Received : " + C.cYellow + winterChestsReceived); caller.sendMessage(C.cDGreen + C.Strike + "============================================="); _salesPackageManager.displaySalesPackages(caller, playerName); From 53f9a051c585ae4fc5d46c8ce9b1a460d9420ca4 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Thu, 17 Dec 2015 21:52:34 -0500 Subject: [PATCH 086/113] Fix spectator page sorting team list --- .../game/arcade/gui/spectatorMenu/page/SpectatorPage.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/page/SpectatorPage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/page/SpectatorPage.java index a5e801770..9e4c453b3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/page/SpectatorPage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/page/SpectatorPage.java @@ -4,10 +4,8 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; -import java.util.HashMap; import java.util.List; -import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -57,7 +55,7 @@ public class SpectatorPage extends _buttons = new IButton[54]; _items = new ItemStack[54]; - List teamList = _arcadeManager.GetGame().GetTeamList(); + List teamList = new ArrayList(_arcadeManager.GetGame().GetTeamList()); int playerCount = _arcadeManager.GetGame().GetPlayers(true).size(); From 2c09fd969ba997b4c585b42b1e6377a67b7508af Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Thu, 17 Dec 2015 22:24:44 -0500 Subject: [PATCH 087/113] Attempt at fixing spectator page --- .../game/arcade/gui/spectatorMenu/page/SpectatorPage.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/page/SpectatorPage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/page/SpectatorPage.java index 9e4c453b3..1b687bb71 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/page/SpectatorPage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/page/SpectatorPage.java @@ -151,9 +151,8 @@ public class SpectatorPage extends int rowsNeeded = (int) Math.ceil(teamPlayers.size() / 8.0); - _buttons = Arrays.copyOf(_buttons, _buttons.length - + (rowsNeeded * 9)); - _items = Arrays.copyOf(_items, _items.length + (rowsNeeded * 9) + rowsNeeded); + _buttons = Arrays.copyOf(_buttons, _buttons.length + (rowsNeeded * 9)); + _items = Arrays.copyOf(_items, _items.length + (rowsNeeded * 9)); for (int row = 0; row < rowsNeeded; row++) { @@ -176,6 +175,9 @@ public class SpectatorPage extends if (rowsNeeded == 1 && teamList.size() < 4 && playerCount <= 26) { currentRow += 2; + + _buttons = Arrays.copyOf(_buttons, _buttons.length + 9); + _items = Arrays.copyOf(_items, _items.length + 9); } else { From 2bf734a15ca073bcb911baf8644ce0d517e71fa2 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Thu, 17 Dec 2015 23:08:07 -0500 Subject: [PATCH 088/113] DONEONDONFA;SDJF;LADSF;OCAJEFOJ;FJAD;FAJSMLDFAH D --- .../core/achievement/AchievementCategory.java | 8 +- .../nautilus/game/arcade/ArcadeManager.java | 69 +++-- .../game/games/paintball/Paintball.java | 131 ++++---- .../games/paintball/PlayerCopyPaintball.java | 2 + .../game/games/paintball/kits/KitSniper.java | 2 +- .../kits/perks/PerkPaintballMachineGun.java | 6 +- .../kits/perks/PerkPaintballRifle.java | 3 + .../kits/perks/PerkPaintballShotgun.java | 3 + .../kits/perks/PerkPaintballSniper.java | 2 +- .../arcade/managers/GameTestingManager.java | 293 ++++++++++++++++++ 10 files changed, 425 insertions(+), 94 deletions(-) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameTestingManager.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java index 16e65af63..7813b1e09 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java @@ -2,6 +2,10 @@ package mineplex.core.achievement; import java.util.List; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; + import mineplex.core.account.CoreClientManager; import mineplex.core.common.Rank; import mineplex.core.common.util.C; @@ -10,10 +14,6 @@ import mineplex.core.game.GameDisplay; import mineplex.core.stats.PlayerStats; import mineplex.core.stats.StatsManager; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.entity.Player; - public enum AchievementCategory { GLOBAL("Global", null, diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index 7e9d4a156..01ea9b8cf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -6,6 +6,39 @@ import java.util.HashSet; import java.util.Iterator; import java.util.Map.Entry; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.GameMode; +import org.bukkit.Material; +import org.bukkit.OfflinePlayer; +import org.bukkit.Sound; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.HandlerList; +import org.bukkit.event.block.BlockBurnEvent; +import org.bukkit.event.block.BlockFadeEvent; +import org.bukkit.event.block.BlockSpreadEvent; +import org.bukkit.event.block.LeavesDecayEvent; +import org.bukkit.event.entity.CreatureSpawnEvent; +import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.event.inventory.InventoryType; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerLoginEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.PlayerResourcePackStatusEvent; +import org.bukkit.event.player.PlayerResourcePackStatusEvent.Status; +import org.bukkit.event.server.ServerListPingEvent; +import org.bukkit.potion.PotionEffect; +import org.bukkit.util.Vector; + +import com.google.common.base.Objects; + import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.achievement.AchievementManager; @@ -39,7 +72,6 @@ import mineplex.core.hologram.HologramManager; import mineplex.core.inventory.InventoryManager; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.movement.Movement; -import mineplex.core.notifier.NotificationManager; import mineplex.core.npc.NpcManager; import mineplex.core.packethandler.PacketHandler; import mineplex.core.party.PartyManager; @@ -100,45 +132,13 @@ 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.GameTestingManager; import nautilus.game.arcade.managers.GameTournamentManager; import nautilus.game.arcade.managers.GameWorldManager; import nautilus.game.arcade.managers.HolidayManager; import nautilus.game.arcade.managers.IdleManager; import nautilus.game.arcade.managers.MiscManager; import nautilus.game.arcade.shop.ArcadeShop; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.GameMode; -import org.bukkit.Material; -import org.bukkit.OfflinePlayer; -import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; -import org.bukkit.entity.Entity; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.HandlerList; -import org.bukkit.event.block.BlockBurnEvent; -import org.bukkit.event.block.BlockFadeEvent; -import org.bukkit.event.block.BlockSpreadEvent; -import org.bukkit.event.block.LeavesDecayEvent; -import org.bukkit.event.entity.CreatureSpawnEvent; -import org.bukkit.event.entity.EntityExplodeEvent; -import org.bukkit.event.inventory.InventoryType; -import org.bukkit.event.player.PlayerCommandPreprocessEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerLoginEvent; -import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.event.player.PlayerResourcePackStatusEvent; -import org.bukkit.event.player.PlayerResourcePackStatusEvent.Status; -import org.bukkit.event.server.ServerListPingEvent; -import org.bukkit.potion.PotionEffect; -import org.bukkit.util.Vector; - -import com.google.common.base.Objects; public class ArcadeManager extends MiniPlugin implements IRelation { @@ -302,6 +302,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation _idleManager = new IdleManager(this); TitanGiveawayManager titanGiveaway = new TitanGiveawayManager(getPlugin(), clientManager, serverStatusManager); new HolidayManager(this, titanGiveaway); + new GameTestingManager(this); // Game Addons new CompassAddon(plugin, this); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java index b432d2361..f509b43dd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java @@ -18,6 +18,7 @@ import org.bukkit.entity.EnderPearl; import org.bukkit.entity.Player; import org.bukkit.entity.Snowball; import org.bukkit.entity.ThrownPotion; +import org.bukkit.event.Cancellable; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; @@ -26,12 +27,14 @@ import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.player.PlayerInteractAtEntityEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.LeatherArmorMeta; +import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; import org.bukkit.scoreboard.NameTagVisibility; import org.bukkit.scoreboard.Team; @@ -49,6 +52,7 @@ import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.hologram.Hologram.HologramTarget; +import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.condition.Condition.ConditionType; @@ -72,6 +76,7 @@ import nautilus.game.arcade.game.games.paintball.trackers.MedicStatTracker; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.stats.WinFastStatTracker; import nautilus.game.arcade.stats.WinWithoutLosingTeammateStatTracker; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy; public class Paintball extends TeamGame { @@ -156,59 +161,44 @@ public class Paintball extends TeamGame @EventHandler public void Paint(final ProjectileHitEvent event) { - // Fixed projectile wool painting in waiting lobby. - if (IsLive() || GetState() == GameState.End) { if (event.getEntity() instanceof ThrownPotion) return; final byte color = (byte) (event.getEntity() instanceof EnderPearl || (event.getEntity() instanceof Arrow && event.getEntity().hasMetadata("color") && ChatColor.values()[event.getEntity().getMetadata("color").get(0).asInt()] == ChatColor.RED) ? 14 : 3); - - if (event.getEntity() instanceof Arrow) - { - Manager.runSyncLater(new Runnable() // Stupid thing I have to do to make sure the arrow's location is accounted for. Stupid mojang. - Myst - { - @Override - public void run() + + event.getEntity().setVelocity(event.getEntity().getVelocity().normalize().multiply(1.2)); + + PacketPlayOutEntityDestroy destroy = new PacketPlayOutEntityDestroy(new int[]{event.getEntity().getEntityId()}); + for (Player player : UtilServer.getPlayers()) + UtilPlayer.sendPacket(player, destroy); + + Manager.runSyncLater(new Runnable() // Stupid thing I have to do to make sure the arrow's location is accounted for. Stupid mojang. - Myst { - Location loc = event.getEntity().getLocation(); - loc.add(event.getEntity().getVelocity().clone().normalize().multiply(.5)); - - for (Block block : UtilBlock.getInRadius(loc, 1.5d).keySet()) - { - if (block.getType() != Material.WOOL && block.getType() != Material.STAINED_CLAY) - continue; - - block.setData(color); - } - - if (color == 3) loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 8); - else loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 10); - - event.getEntity().remove(); - } - }, 1); - } - else - { - Location loc = event.getEntity().getLocation(); - loc.add(event.getEntity().getVelocity().clone().normalize().multiply(.5)); - - for (Block block : UtilBlock.getInRadius(loc, 1.5d).keySet()) + @Override + public void run() { - if (block.getType() != Material.WOOL && block.getType() != Material.STAINED_CLAY) - continue; + Location loc = event.getEntity().getLocation(); + // loc.add(event.getEntity().getVelocity().clone().normalize().multiply(.5)); - block.setData(color); + for (Block block : UtilBlock.getInRadius(loc, 1.5d).keySet()) + { + if (block.getType() != Material.WOOL && block.getType() != Material.STAINED_CLAY && block.getType() != Material.HARD_CLAY) + continue; + + if (block.getType() == Material.HARD_CLAY) + block.setType(Material.STAINED_CLAY); + + block.setData(color); + } + + if (color == 3) loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 8); + else loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 10); + + event.getEntity().remove(); } - - if (color == 3) loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 8); - else loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 10); - - event.getEntity().remove(); - } - + }, 0); } } @@ -238,7 +228,7 @@ public class Paintball extends TeamGame event.SetCancelled("No Projectile"); } - @EventHandler + @EventHandler(priority = EventPriority.LOW) public void PaintballDamage(CustomDamageEvent event) { if (!IsLive()) @@ -359,7 +349,7 @@ public class Paintball extends TeamGame } public void PlayerOut(Player player, Player killer) - { + { //State SetPlayerState(player, PlayerState.OUT); player.setHealth(20); @@ -368,15 +358,15 @@ public class Paintball extends TeamGame Manager.GetCondition().Factory().Blind("Hit", player, player, 1.5, 0, false, false, false); Manager.GetCondition().Factory().Cloak("Hit", player, player, 9999, false, false); + _doubles.put(player, new PlayerCopyPaintball(this, player, killer, GetTeam(player).GetColor())); + //Settings player.setAllowFlight(true); player.setFlying(true); ((CraftPlayer)player).getHandle().spectating = true; ((CraftPlayer)player).getHandle().k = false; - + UtilAction.velocity(player, new Vector(0,1.2,0)); - - _doubles.put(player, new PlayerCopyPaintball(this, player, killer, GetTeam(player).GetColor())); } // @EventHandler @@ -545,20 +535,55 @@ public class Paintball extends TeamGame @EventHandler public void onHeal(PlayerInteractEvent event) + { + if (!UtilEvent.isAction(event, ActionType.R)) + return; + + LaunchPotion(event.getPlayer(), event); + } + + @EventHandler + public void onHeal(PlayerInteractEntityEvent event) + { + LaunchPotion(event.getPlayer(), event); + } + + @EventHandler(ignoreCancelled = false) + public void onHeal(PlayerInteractAtEntityEvent event) + { + LaunchPotion(event.getPlayer(), event); + } + + public void LaunchPotion(Player player, Cancellable event) { if (!IsLive()) return; - if (!UtilEvent.isAction(event, ActionType.R)) + if (!UtilGear.isMat(player.getItemInHand(), Material.POTION)) return; - if (!UtilGear.isMat(event.getItem(), Material.POTION)) + event.setCancelled(true); + + if (!IsAlive(player) || UtilPlayer.isSpectator(player)) + return; + + if (!Recharge.Instance.use(player, "Water Potion", 250, false, false)) return; + + UtilInv.UseItemInHand(player); - if (!IsAlive(event.getPlayer()) || UtilPlayer.isSpectator(event.getPlayer())) - event.setCancelled(true); + ThrownPotion potion = player.launchProjectile(ThrownPotion.class); + potion.getEffects().clear(); + potion.getEffects().add(new PotionEffect(PotionEffectType.WATER_BREATHING, 100, 100)); - UtilInv.Update(event.getPlayer()); + Manager.runAsync(new Runnable() + { + @Override + public void run() + { + UtilInv.Update(player); + } + }); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopyPaintball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopyPaintball.java index f89e0c66d..a42d2592b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopyPaintball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopyPaintball.java @@ -76,12 +76,14 @@ public class PlayerCopyPaintball _holo = new Hologram(host.Manager.getHologramManager(), _ent.getLocation().clone().add(0, 2.2, 0)); _holo.setText(C.cWhite + C.Bold + C.Scramble + "XX" + ChatColor.RESET + " " + nameColor + owner.getName() + " " + C.cWhite + C.Bold + C.Scramble + "XX", C.cWhite + "Painted by " + host.GetTeam(paintedBy).GetColor() + paintedBy.getName()); _holo.setHologramTarget(HologramTarget.WHITELIST); + _holo.setFollowEntity(_ent); _holo.start(); //Save me _saveMe = new Hologram(host.Manager.getHologramManager(), _ent.getLocation().clone().add(0, 2.8, 0)); _saveMe.setText(C.cRedB + "SAVE ME!"); _saveMe.setHologramTarget(HologramTarget.WHITELIST); + _saveMe.setFollowEntity(_ent); _saveMe.start(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitSniper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitSniper.java index e7d41949a..ac49ab365 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitSniper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitSniper.java @@ -29,7 +29,7 @@ public class KitSniper extends Kit new String[] { "Long range sniper rifle", - C.cGold + "Higher damage every second scoped" + C.cGold + "Higher damage the longer scoped" }, new Perk[] diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballMachineGun.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballMachineGun.java index 9cc331b61..081fef3e3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballMachineGun.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballMachineGun.java @@ -51,6 +51,9 @@ public class PerkPaintballMachineGun extends Perk @EventHandler public void Shoot(PlayerInteractEvent event) { + if (!Manager.GetGame().IsLive()) + return; + if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) return; @@ -95,7 +98,8 @@ public class PerkPaintballMachineGun extends Perk //Energy if (player.getExp() >= 0.97) return; - player.setExp((float) (player.getExp() + 0.025)); + + player.setExp((float) Math.min(.999, player.getExp() + 0.025)); //Shoot Vector rand = new Vector(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballRifle.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballRifle.java index 963da3e0c..944d6ae7a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballRifle.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballRifle.java @@ -39,6 +39,9 @@ public class PerkPaintballRifle extends Perk @EventHandler public void Shoot(PlayerInteractEvent event) { + if (!Manager.GetGame().IsLive()) + return; + if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballShotgun.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballShotgun.java index 6c14682f9..7e6f6646f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballShotgun.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballShotgun.java @@ -42,6 +42,9 @@ public class PerkPaintballShotgun extends Perk @EventHandler public void Shoot(PlayerInteractEvent event) { + if (!Manager.GetGame().IsLive()) + return; + if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballSniper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballSniper.java index 320a71a1c..f863678e3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballSniper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/perks/PerkPaintballSniper.java @@ -237,7 +237,7 @@ public class PerkPaintballSniper extends Perk implements IPacketHandler if (!_crouching.contains(player)) continue; - player.setExp((float) Math.min(.999F, player.getExp() + .01666)); + player.setExp((float) Math.min(.999F, player.getExp() + .03332)); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameTestingManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameTestingManager.java new file mode 100644 index 000000000..ce554376b --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameTestingManager.java @@ -0,0 +1,293 @@ +package nautilus.game.arcade.managers; + +import java.util.HashSet; +import java.util.Set; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.player.PlayerLoginEvent; +import org.bukkit.event.player.PlayerLoginEvent.Result; + +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import nautilus.game.arcade.ArcadeManager; + +public class GameTestingManager implements Listener +{ + /** + * Created by: Mysticate + * Timestamp: November 25, 2015 + */ + + private ArcadeManager _manager; + + private boolean _enabled; + + private boolean _capped = false; + private int _cap = 16; + private String _capMessage = ""; + + private boolean _whitelisted = false; + private Set _whitelistAdded = new HashSet(); + private String _whitelistMessage = ""; + + public GameTestingManager(ArcadeManager manager) + { + _manager = manager; + + _manager.getPluginManager().registerEvents(this, _manager.getPlugin()); + + _enabled = _manager.getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing"); + } + + public ArcadeManager getManager() + { + return _manager; + } + + public void setCapped(boolean cap) + { + _capped = cap; + } + + public boolean isCapped() + { + return _capped; + } + + public void setCap(int cap) + { + _cap = cap; + } + + public int getCap() + { + return _cap; + } + + public boolean isWhitelisted(String name) + { + return _whitelistAdded.contains(new String(name).toLowerCase()); + } + + public void setWhitelisted(String name, boolean whitelist) + { + if (isWhitelisted(name)) + { + _whitelistAdded.remove(name.toLowerCase()); + } + else + { + _whitelistAdded.add(new String(name).toLowerCase()); + } + } + + @EventHandler + public void onLogin(PlayerLoginEvent event) + { + if (!_enabled) + return; + + if (_capped) + { + if (UtilServer.getPlayers().length >= _cap) + { + if (!isWhitelisted(event.getPlayer().getName())) + { + event.disallow(Result.KICK_FULL, C.cGray + "That server has a set cap!\n" + + C.cGray + "Current players " + C.cYellow + UtilServer.getPlayers().length + "/" + _cap + "\n" + + C.cGreen + _capMessage); + } + return; + } + } + + if (_whitelisted) + { + if (!isWhitelisted(event.getPlayer().getName())) + { + event.disallow(Result.KICK_FULL, C.cGray + "That server has a testing whitelist!\n" + + C.cGray + "Current players " + C.cYellow + UtilServer.getPlayers().length + "/" + _cap + "\n" + + C.cGreen + _capMessage); + } + return; + } + } + + @EventHandler + public void onCommandTesting(PlayerCommandPreprocessEvent event) + { + if (!_enabled) + return; + + String[] args = event.getMessage().split(" "); + String cmd = args[0]; + + if (!cmd.equalsIgnoreCase("/testing")) + return; + + event.setCancelled(true); + + if (!_manager.GetClients().Get(event.getPlayer()).GetRank().has(event.getPlayer(), Rank.JNR_DEV, true)) + return; + + if (args.length == 1) // Help + { + sendGlobalHelp(event.getPlayer()); + return; + } + else if (args[1].equalsIgnoreCase("cap")) + { + if (args.length == 2) + { + sendCapHelp(event.getPlayer()); + return; + } + + if (args.length == 3) // No cap arguments + { + if (args[2].equalsIgnoreCase("toggle")) + { + _capped = !_capped; + UtilPlayer.message(event.getPlayer(), F.main("Testing", "Testing cap enabled " + F.tf(_capped) + ".")); + return; + } + + try + { + _cap = Integer.valueOf(args[2]); + UtilPlayer.message(event.getPlayer(), F.main("Testing", "Testing cap set to " + F.elem("" + _cap) + ".")); + } + catch (Exception ex) + { + sendCapHelp(event.getPlayer()); + } + return; + } + + if (args.length >= 4) + { + if (args[2].equalsIgnoreCase("message")) + { + String message = ""; + for (int i = 3 ; i < args.length ; i++) + message += (args[i] + " "); + + _capMessage = message.trim(); + UtilPlayer.message(event.getPlayer(), F.main("Testing", "Testing cap message set to " + F.elem(_capMessage) + ".")); + return; + } + + sendCapHelp(event.getPlayer()); + return; + } + + sendCapHelp(event.getPlayer()); + return; + } + else if (args[1].equalsIgnoreCase("whitelist")) + { + if (args.length == 2) + { + sendWhitelistHelp(event.getPlayer()); + return; + } + + if (args.length == 3) // No cap arguments + { + if (args[2].equalsIgnoreCase("toggle")) + { + _whitelisted = !_whitelisted; + UtilPlayer.message(event.getPlayer(), F.main("Testing", "Testing whitelist enabled " + F.tf(_whitelisted) + ".")); + return; + } + + sendWhitelistHelp(event.getPlayer()); + return; + } + + if (args.length == 4) + { + if (args[2].equalsIgnoreCase("add")) + { + String playerName = args[3]; + + if (isWhitelisted(playerName)) + { + UtilPlayer.message(event.getPlayer(), F.main("Testing", "That player is already whitelisted!")); + } + else + { + setWhitelisted(playerName, true); + UtilPlayer.message(event.getPlayer(), F.main("Testing", "You have whitelisted " + F.name(playerName) + ".")); + } + return; + } + else if (args[2].equalsIgnoreCase("remove")) + { + String playerName = args[3]; + + if (!isWhitelisted(playerName)) + { + UtilPlayer.message(event.getPlayer(), F.main("Testing", "That player is not whitelisted!")); + } + else + { + setWhitelisted(playerName, false); + UtilPlayer.message(event.getPlayer(), F.main("Testing", "You have removed " + F.name(playerName) + " from the whitelist.")); + } + return; + } + } + + if (args.length >= 4) + { + if (args[2].equalsIgnoreCase("message")) + { + String message = ""; + for (int i = 3 ; i < args.length ; i++) + message += (args[i] + " "); + + _whitelistMessage = message.trim(); + UtilPlayer.message(event.getPlayer(), F.main("Testing", "Testing whitelist message set to " + F.elem(_whitelistMessage) + ".")); + return; + } + + sendWhitelistHelp(event.getPlayer()); + return; + } + + sendWhitelistHelp(event.getPlayer()); + return; + } + } + + private void sendGlobalHelp(Player player) + { + UtilPlayer.message(player, ""); + UtilPlayer.message(player, F.main("Testing", "/testing cap")); + UtilPlayer.message(player, F.main("Testing", "/testing whitelist")); + } + + private void sendCapHelp(Player player) + { + UtilPlayer.message(player, ""); + UtilPlayer.message(player, F.main("Testing", "/testing cap toggle")); + UtilPlayer.message(player, F.main("Testing", "/testing cap ")); + UtilPlayer.message(player, F.main("Testing", "/testing cap message ")); + } + + private void sendWhitelistHelp(Player player) + { + UtilPlayer.message(player, ""); + UtilPlayer.message(player, F.main("Testing", "/testing whitelist toggle")); + UtilPlayer.message(player, F.main("Testing", "/testing whitelist add ")); + UtilPlayer.message(player, F.main("Testing", "/testing whitelist remove ")); + UtilPlayer.message(player, F.main("Testing", "/testing whitelist message ")); + } +} \ No newline at end of file From d561915fd32885036b55cc6a05899934a544e131 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Thu, 17 Dec 2015 23:16:57 -0500 Subject: [PATCH 089/113] FORMATTING CHANG EI'M GOING TO CRY UGH --- .../game/arcade/game/games/paintball/kits/KitSniper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitSniper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitSniper.java index ac49ab365..3baa4479e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitSniper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitSniper.java @@ -53,7 +53,7 @@ public class KitSniper extends Kit @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_HOE, (byte)0, 1, C.cWhite + "Paintball Sniper Rifle")); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_HOE, (byte)0, 1, F.item("Paintball Sniper Rifle"))); ItemStack potion = new ItemStack(Material.POTION, 2, (short)16429); // 16422 PotionMeta potionMeta = (PotionMeta)potion.getItemMeta(); From f80648bfbc25db91b295dcbbc917e192b1693f28 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Fri, 18 Dec 2015 00:32:07 -0500 Subject: [PATCH 090/113] Update DBPool to load from file --- .../account/repository/AccountRepository.java | 2 +- .../core/antihack/AntiHackRepository.java | 2 +- .../benefit/BenefitManagerRepository.java | 2 +- .../mineplex/core/bonuses/BonusManager.java | 2 +- .../core/bonuses/BonusRepository.java | 4 +- .../botspam/repository/BotSpamRepository.java | 2 +- .../repository/CustomDataRepository.java | 2 +- .../src/mineplex/core/database/DBPool.java | 98 ++++++++++++++++++- .../core/database/RepositoryBase.java | 2 +- .../repository/DonationRepository.java | 2 +- .../src/mineplex/core/elo/EloRepository.java | 2 +- .../core/friend/data/FriendRepository.java | 2 +- .../core/giveaway/GiveawayRepository.java | 2 +- .../core/ignore/data/IgnoreRepository.java | 2 +- .../inventory/data/InventoryRepository.java | 2 +- .../leaderboard/StatEventsRepository.java | 2 +- .../src/mineplex/core/npc/NpcManager.java | 8 +- .../core/pet/repository/PetRepository.java | 2 +- .../mineplex/core/poll/PollRepository.java | 2 +- .../preferences/PreferencesRepository.java | 2 +- .../core/report/ReportRepository.java | 2 +- .../mineplex/core/spawn/SpawnRepository.java | 2 +- .../mineplex/core/stats/StatsRepository.java | 2 +- .../core/task/repository/TaskRepository.java | 2 +- .../TitanGiveawayRepository.java | 2 +- .../clans/core/repository/ClanRepository.java | 2 +- .../fields/repository/FieldRepository.java | 2 +- .../src/mineplex/hub/HubRepository.java | 10 +- .../src/mineplex/hub/mail/MailRepository.java | 2 +- .../mineplex/hub/queue/QueueRepository.java | 10 +- .../mineplex/votifier/VotifierManager.java | 2 +- .../TitanGiveawayRepository.java | 2 +- 32 files changed, 136 insertions(+), 48 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/repository/AccountRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/account/repository/AccountRepository.java index d8362e33b..d11b9a081 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/repository/AccountRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/repository/AccountRepository.java @@ -46,7 +46,7 @@ public class AccountRepository extends RepositoryBase public AccountRepository(JavaPlugin plugin, String webAddress) { - super(plugin, DBPool.ACCOUNT); + super(plugin, DBPool.getAccount()); _webAddress = webAddress; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHackRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHackRepository.java index 1b7fb4b65..23a0694b0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHackRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHackRepository.java @@ -33,7 +33,7 @@ public class AntiHackRepository { PreparedStatement preparedStatement = null; - try (Connection connection = DBPool.STATS_MINEPLEX.getConnection()) + try (Connection connection = DBPool.getStats().getConnection()) { preparedStatement = connection.prepareStatement(UPDATE_PLAYER_OFFENSES); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/benefit/BenefitManagerRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/benefit/BenefitManagerRepository.java index 39fbfa530..eb5628130 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/benefit/BenefitManagerRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/benefit/BenefitManagerRepository.java @@ -19,7 +19,7 @@ public class BenefitManagerRepository extends RepositoryBase public BenefitManagerRepository(JavaPlugin plugin) { - super(plugin, DBPool.ACCOUNT); + super(plugin, DBPool.getAccount()); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java index e5076f9b0..6c01d3719 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java @@ -789,7 +789,7 @@ public class BonusManager extends MiniClientPlugin implements I { try { - final int newTickets = DSL.using(DBPool.ACCOUNT, SQLDialect.MYSQL).update(Tables.bonus).set(Tables.bonus.tickets, Tables.bonus.tickets.add(tickets)). + final int newTickets = DSL.using(DBPool.getAccount(), SQLDialect.MYSQL).update(Tables.bonus).set(Tables.bonus.tickets, Tables.bonus.tickets.add(tickets)). where(Tables.bonus.accountId.eq(accountId)).returning(Tables.bonus.tickets).fetchOne().getTickets(); runSync(new Runnable() { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusRepository.java index 0c4a1c6f5..2ce772e8c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusRepository.java @@ -36,7 +36,7 @@ public class BonusRepository extends RepositoryBase public BonusRepository(JavaPlugin plugin, BonusManager bonusManager, DonationManager donationManager) { - super(plugin, DBPool.ACCOUNT); + super(plugin, DBPool.getAccount()); _manager = bonusManager; _donationManager = donationManager; } @@ -145,7 +145,7 @@ public class BonusRepository extends RepositoryBase { try { - DSLContext create = DSL.using(DBPool.ACCOUNT, SQLDialect.MYSQL); + DSLContext create = DSL.using(DBPool.getAccount(), SQLDialect.MYSQL); create.update(Tables.bonus).set(Tables.bonus.tickets, Tables.bonus.tickets.add(tickets)). where(Tables.bonus.accountId.eq(accountId)).execute(); final int newTickets = create.select(Tables.bonus.tickets).from(Tables.bonus).where(Tables.bonus.accountId.eq(accountId)).fetchOne().value1(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/botspam/repository/BotSpamRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/botspam/repository/BotSpamRepository.java index d1460fb4a..3af3d0d4f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/botspam/repository/BotSpamRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/botspam/repository/BotSpamRepository.java @@ -24,7 +24,7 @@ public class BotSpamRepository extends RepositoryBase public BotSpamRepository(JavaPlugin plugin) { - super(plugin, DBPool.ACCOUNT); + super(plugin, DBPool.getAccount()); } public ArrayList getSpamText() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/customdata/repository/CustomDataRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/customdata/repository/CustomDataRepository.java index c57e2a03f..51866e26f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/customdata/repository/CustomDataRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/customdata/repository/CustomDataRepository.java @@ -35,7 +35,7 @@ public class CustomDataRepository extends RepositoryBase public CustomDataRepository(JavaPlugin plugin, CoreClientManager clientManager, CustomDataManager customDataManager) { - super(plugin, DBPool.ACCOUNT); + super(plugin, DBPool.getAccount()); _clientManager = clientManager; _customDataManager = customDataManager; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/database/DBPool.java b/Plugins/Mineplex.Core/src/mineplex/core/database/DBPool.java index 8400fa954..06495ff54 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/database/DBPool.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/database/DBPool.java @@ -1,16 +1,26 @@ package mineplex.core.database; import javax.sql.DataSource; + +import java.io.File; +import java.nio.charset.Charset; +import java.nio.file.Files; import java.sql.Connection; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.dbcp2.BasicDataSource; +import mineplex.serverdata.redis.RedisConfig; +import mineplex.serverdata.servers.ConnectionData; +import mineplex.serverdata.servers.ConnectionData.ConnectionType; + public final class DBPool { - public static final DataSource ACCOUNT = openDataSource("jdbc:mysql://db.mineplex.com/Account", "MilitaryPolice", "CUPr6Wuw2Rus$qap"); - public static final DataSource QUEUE = openDataSource("jdbc:mysql://db.mineplex.com/Queue", "MilitaryPolice", "CUPr6Wuw2Rus$qap"); - public static final DataSource MINEPLEX = openDataSource("jdbc:mysql://db.mineplex.com:3306/Mineplex", "MilitaryPolice", "CUPr6Wuw2Rus$qap"); - public static final DataSource STATS_MINEPLEX = openDataSource("jdbc:mysql://sqlstats.mineplex.com:3306/Mineplex", "root", "tAbechAk3wR7tuTh"); + private static DataSource ACCOUNT; + private static DataSource QUEUE; + private static DataSource MINEPLEX; + private static DataSource STATS_MINEPLEX; private static DataSource openDataSource(String url, String username, String password) { @@ -30,8 +40,86 @@ public final class DBPool return source; } - private DBPool() + public static DataSource getAccount() { + if (ACCOUNT == null) + loadDataSources(); + return ACCOUNT; + } + + public static DataSource getQueue() + { + if (QUEUE == null) + loadDataSources(); + + return QUEUE; + } + + public static DataSource getMineplex() + { + if (MINEPLEX == null) + loadDataSources(); + + return MINEPLEX; + } + + public static DataSource getStats() + { + if (STATS_MINEPLEX == null) + loadDataSources(); + + return STATS_MINEPLEX; + } + + private static void loadDataSources() + { + try + { + File configFile = new File("database-config.dat"); + + if (configFile.exists()) + { + List lines = Files.readAllLines(configFile.toPath(), Charset.defaultCharset()); + + for (String line : lines) + { + deserializeConnection(line); + } + } + else + { + System.out.println("database-config.dat not found at " + configFile.toPath().toString()); + } + } + catch (Exception exception) + { + exception.printStackTrace(); + System.out.println("---Unable To Parse DBPOOL Configuration File---"); + } + } + + private static void deserializeConnection(String line) + { + String[] args = line.split(" "); + + if (args.length == 4) + { + String dbSource = args[0]; + String dbHost = args[1]; + String userName = args[2]; + String password = args[3]; + + System.out.println(dbSource + " " + dbHost + " " + userName + " " + password); + + if (dbSource.toUpperCase().equalsIgnoreCase("ACCOUNT")) + ACCOUNT = openDataSource("jdbc:mysql://" + dbHost, userName, password); + else if (dbSource.toUpperCase().equalsIgnoreCase("QUEUE")) + QUEUE = openDataSource("jdbc:mysql://" + dbHost, userName, password); + else if (dbSource.toUpperCase().equalsIgnoreCase("MINEPLEX")) + MINEPLEX = openDataSource("jdbc:mysql://" + dbHost, userName, password); + else if (dbSource.toUpperCase().equalsIgnoreCase("STATS")) + STATS_MINEPLEX = openDataSource("jdbc:mysql://" + dbHost, userName, password); + } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/database/RepositoryBase.java b/Plugins/Mineplex.Core/src/mineplex/core/database/RepositoryBase.java index f96d1b04d..55acc83ed 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/database/RepositoryBase.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/database/RepositoryBase.java @@ -68,7 +68,7 @@ public abstract class RepositoryBase implements Listener protected DSLContext jooq() { - return DSL.using(DBPool.ACCOUNT, SQLDialect.MYSQL); + return DSL.using(DBPool.getAccount(), SQLDialect.MYSQL); } /** diff --git a/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/DonationRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/DonationRepository.java index 910f03c63..98999dbf3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/DonationRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/donation/repository/DonationRepository.java @@ -37,7 +37,7 @@ public class DonationRepository extends RepositoryBase public DonationRepository(JavaPlugin plugin, String webAddress) { - super(plugin, DBPool.ACCOUNT); + super(plugin, DBPool.getAccount()); _webAddress = webAddress; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloRepository.java index 54503474f..2304a75c0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloRepository.java @@ -17,7 +17,7 @@ public class EloRepository extends RepositoryBase public EloRepository(JavaPlugin plugin) { - super(plugin, DBPool.ACCOUNT); + super(plugin, DBPool.getAccount()); initialize(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/friend/data/FriendRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/friend/data/FriendRepository.java index c7ab1ae90..c09fe1703 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/friend/data/FriendRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/friend/data/FriendRepository.java @@ -37,7 +37,7 @@ public class FriendRepository extends RepositoryBase public FriendRepository(JavaPlugin plugin) { - super(plugin, DBPool.ACCOUNT); + super(plugin, DBPool.getAccount()); _repository = new RedisDataRepository(ServerManager.getMasterConnection(), ServerManager.getSlaveConnection(), Region.currentRegion(), PlayerStatus.class, "playerStatus"); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/giveaway/GiveawayRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/giveaway/GiveawayRepository.java index c8cac2179..46844bd07 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/giveaway/GiveawayRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/giveaway/GiveawayRepository.java @@ -26,7 +26,7 @@ public class GiveawayRepository extends RepositoryBase public GiveawayRepository(JavaPlugin plugin) { - super(plugin, DBPool.ACCOUNT); + super(plugin, DBPool.getAccount()); } public boolean canGiveaway(int accountId, String giveawayName, String cooldownName) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/ignore/data/IgnoreRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/ignore/data/IgnoreRepository.java index aad60e65c..14e1918c4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/ignore/data/IgnoreRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/ignore/data/IgnoreRepository.java @@ -17,7 +17,7 @@ public class IgnoreRepository extends RepositoryBase public IgnoreRepository(JavaPlugin plugin) { - super(plugin, DBPool.ACCOUNT); + super(plugin, DBPool.getAccount()); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/inventory/data/InventoryRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/inventory/data/InventoryRepository.java index a21d6c9ec..018eb41e9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/inventory/data/InventoryRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/inventory/data/InventoryRepository.java @@ -29,7 +29,7 @@ public class InventoryRepository extends RepositoryBase public InventoryRepository(JavaPlugin plugin) { - super(plugin, DBPool.ACCOUNT); + super(plugin, DBPool.getAccount()); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/leaderboard/StatEventsRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/leaderboard/StatEventsRepository.java index 1679bc36d..5f0659c03 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/leaderboard/StatEventsRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/leaderboard/StatEventsRepository.java @@ -36,7 +36,7 @@ public class StatEventsRepository extends RepositoryBase */ public StatEventsRepository(JavaPlugin plugin) { - super(plugin, DBPool.ACCOUNT); + super(plugin, DBPool.getAccount()); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcManager.java b/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcManager.java index 5e971bf50..1235a6301 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcManager.java @@ -268,7 +268,7 @@ public class NpcManager extends MiniPlugin public Entity addNpc(Player player, EntityType entityType, double radius, boolean adult, String name, String entityMeta) throws SQLException { - try (Connection connection = DBPool.ACCOUNT.getConnection()) + try (Connection connection = DBPool.getAccount().getConnection()) { String helmet = itemStackToYaml(player.getInventory().getHelmet()); String chestplate = itemStackToYaml(player.getInventory().getChestplate()); @@ -386,7 +386,7 @@ public class NpcManager extends MiniPlugin if (npc != null) { - try (Connection connection = DBPool.ACCOUNT.getConnection()) + try (Connection connection = DBPool.getAccount().getConnection()) { npc.getDatabaseRecord().attach(DSL.using(connection).configuration()); npc.getDatabaseRecord().delete(); @@ -493,7 +493,7 @@ public class NpcManager extends MiniPlugin { String serverType = getServerName(); - try (Connection connection = DBPool.ACCOUNT.getConnection()) + try (Connection connection = DBPool.getAccount().getConnection()) { Result result = DSL.using(connection) .selectFrom(Tables.npcs) @@ -519,7 +519,7 @@ public class NpcManager extends MiniPlugin { String serverType = getServerName(); - try (Connection connection = DBPool.ACCOUNT.getConnection()) + try (Connection connection = DBPool.getAccount().getConnection()) { DSL.using(connection) .delete(Tables.npcs) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/repository/PetRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/repository/PetRepository.java index a79065f4c..40c2d2e1c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/repository/PetRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/repository/PetRepository.java @@ -22,7 +22,7 @@ public class PetRepository extends RepositoryBase public PetRepository(JavaPlugin plugin, String webAddress) { - super(plugin, DBPool.ACCOUNT); + super(plugin, DBPool.getAccount()); _webAddress = webAddress; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/poll/PollRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/poll/PollRepository.java index 588d3d549..9628a5c93 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/poll/PollRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/poll/PollRepository.java @@ -29,7 +29,7 @@ public class PollRepository extends RepositoryBase public PollRepository(JavaPlugin plugin) { - super(plugin, DBPool.ACCOUNT); + super(plugin, DBPool.getAccount()); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesRepository.java index eca4dd35f..3c90a2cce 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesRepository.java @@ -28,7 +28,7 @@ public class PreferencesRepository extends RepositoryBase public PreferencesRepository(JavaPlugin plugin) { - super(plugin, DBPool.ACCOUNT); + super(plugin, DBPool.getAccount()); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportRepository.java index cbae2678c..7b550e058 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportRepository.java @@ -41,7 +41,7 @@ This will be used to determine if staff are handling public ReportRepository(JavaPlugin plugin, String connectionString) { - super(plugin, DBPool.ACCOUNT); + super(plugin, DBPool.getAccount()); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/spawn/SpawnRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/spawn/SpawnRepository.java index eb85bae9d..c6f4191a5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/spawn/SpawnRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/spawn/SpawnRepository.java @@ -23,7 +23,7 @@ public class SpawnRepository extends RepositoryBase public SpawnRepository(JavaPlugin plugin, String serverName) { - super(plugin, DBPool.ACCOUNT); + super(plugin, DBPool.getAccount()); _serverName = serverName; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsRepository.java index d32b5fee3..12deca990 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsRepository.java @@ -32,7 +32,7 @@ public class StatsRepository extends RepositoryBase public StatsRepository(JavaPlugin plugin) { - super(plugin, DBPool.ACCOUNT); + super(plugin, DBPool.getAccount()); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/task/repository/TaskRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/task/repository/TaskRepository.java index 95a427d11..51dfe5726 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/task/repository/TaskRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/task/repository/TaskRepository.java @@ -24,7 +24,7 @@ public class TaskRepository extends RepositoryBase public TaskRepository(JavaPlugin plugin) { - super(plugin, DBPool.ACCOUNT); + super(plugin, DBPool.getAccount()); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/TitanGiveawayRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/TitanGiveawayRepository.java index 4eb95a46d..b6d29c68b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/TitanGiveawayRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/titangiveaway/TitanGiveawayRepository.java @@ -20,7 +20,7 @@ public class TitanGiveawayRepository extends RepositoryBase public TitanGiveawayRepository(JavaPlugin plugin) { - super(plugin, DBPool.ACCOUNT); + super(plugin, DBPool.getAccount()); _titanCount = 0; } diff --git a/Plugins/Mineplex.Game.Clans.Core/src/mineplex/game/clans/core/repository/ClanRepository.java b/Plugins/Mineplex.Game.Clans.Core/src/mineplex/game/clans/core/repository/ClanRepository.java index 037593a54..70f9d082b 100644 --- a/Plugins/Mineplex.Game.Clans.Core/src/mineplex/game/clans/core/repository/ClanRepository.java +++ b/Plugins/Mineplex.Game.Clans.Core/src/mineplex/game/clans/core/repository/ClanRepository.java @@ -86,7 +86,7 @@ public class ClanRepository extends RepositoryBase public ClanRepository(JavaPlugin plugin, String serverName, boolean isClansServer) { - super(plugin, DBPool.ACCOUNT); + super(plugin, DBPool.getAccount()); _serverName = serverName; _serverId = -1; diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/repository/FieldRepository.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/repository/FieldRepository.java index cd45b22bc..2f36fd067 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/repository/FieldRepository.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/repository/FieldRepository.java @@ -34,7 +34,7 @@ public class FieldRepository extends RepositoryBase public FieldRepository(JavaPlugin plugin) { - super(plugin, DBPool.ACCOUNT); + super(plugin, DBPool.getAccount()); } public List getFieldBlocks(String server) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubRepository.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubRepository.java index 5c09e8423..cf07e0012 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubRepository.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubRepository.java @@ -41,7 +41,7 @@ public class HubRepository PreparedStatement preparedStatement = null; HashMap newsEntries = new HashMap(); - try (Connection connection = DBPool.MINEPLEX.getConnection()) + try (Connection connection = DBPool.getMineplex().getConnection()) { preparedStatement = connection.prepareStatement(RETRIEVE_NEWS_ENTRIES); @@ -91,7 +91,7 @@ public class HubRepository int result = 0; PreparedStatement preparedStatement = null; - try (Connection connection = DBPool.MINEPLEX.getConnection()) + try (Connection connection = DBPool.getMineplex().getConnection()) { preparedStatement = connection.prepareStatement(SET_NEWS_ENTRY); preparedStatement.setString(1, newsEntry); @@ -127,7 +127,7 @@ public class HubRepository ResultSet resultSet = null; PreparedStatement preparedStatement = null; - try (Connection connection = DBPool.MINEPLEX.getConnection()) + try (Connection connection = DBPool.getMineplex().getConnection()) { preparedStatement = connection.prepareStatement(RETRIEVE_MAX_NEWS_POSITION); resultSet = preparedStatement.executeQuery(); @@ -165,7 +165,7 @@ public class HubRepository int maxPos = retrieveMaxNewsPosition(); PreparedStatement preparedStatement = null; - try (Connection connection = DBPool.MINEPLEX.getConnection()) + try (Connection connection = DBPool.getMineplex().getConnection()) { preparedStatement = connection.prepareStatement(ADD_NEWS_ENTRY); preparedStatement.setString(1, newsEntry); @@ -201,7 +201,7 @@ public class HubRepository int maxPos = retrieveMaxNewsPosition(); PreparedStatement preparedStatement = null; - try (Connection connection = DBPool.MINEPLEX.getConnection()) + try (Connection connection = DBPool.getMineplex().getConnection()) { //preparedStatement = connection.prepareStatement(DELETE_RECALC_NEWS_ENTRY); preparedStatement = connection.prepareStatement(DELETE_NEWS_ENTRY); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailRepository.java b/Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailRepository.java index af43ab9f5..ae09e592f 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailRepository.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/mail/MailRepository.java @@ -21,7 +21,7 @@ public class MailRepository extends RepositoryBase public MailRepository(JavaPlugin plugin, MailManager manager) { - super(plugin, DBPool.ACCOUNT); + super(plugin, DBPool.getAccount()); _manager = manager; } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/queue/QueueRepository.java b/Plugins/Mineplex.Hub/src/mineplex/hub/queue/QueueRepository.java index 0dfdf8640..d0b0d0a91 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/queue/QueueRepository.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/queue/QueueRepository.java @@ -36,7 +36,7 @@ public class QueueRepository { PreparedStatement preparedStatement = null; - try (Connection connection = DBPool.QUEUE.getConnection()) + try (Connection connection = DBPool.getQueue().getConnection()) { preparedStatement = connection.prepareStatement(DELETE_QUEUE_RECORD); @@ -71,7 +71,7 @@ public class QueueRepository { PreparedStatement preparedStatement = null; - try (Connection connection = DBPool.QUEUE.getConnection()) + try (Connection connection = DBPool.getQueue().getConnection()) { preparedStatement = connection.prepareStatement(SAVE_STATE_VALUE); preparedStatement.setString(1, matchStatus.State); @@ -108,7 +108,7 @@ public class QueueRepository PreparedStatement preparedStatement = null; PlayerMatchStatus matchStatus = new PlayerMatchStatus(); - try (Connection connection = DBPool.QUEUE.getConnection()) + try (Connection connection = DBPool.getQueue().getConnection()) { preparedStatement = connection.prepareStatement(INSERT_ACCOUNT, Statement.RETURN_GENERATED_KEYS); preparedStatement.setString(1, playerList); @@ -165,7 +165,7 @@ public class QueueRepository PreparedStatement preparedStatement = null; PlayerMatchStatus matchStatus = null; - try (Connection connection = DBPool.QUEUE.getConnection()) + try (Connection connection = DBPool.getQueue().getConnection()) { preparedStatement = connection.prepareStatement(RETRIEVE_MATCH_STATUS); preparedStatement.setInt(1, id); @@ -220,7 +220,7 @@ public class QueueRepository ResultSet resultSet = null; PreparedStatement preparedStatement = null; - try (Connection connection = DBPool.QUEUE.getConnection()) + try (Connection connection = DBPool.getQueue().getConnection()) { preparedStatement = connection.prepareStatement(RETRIEVE_OTHER_MATCH_STATUS); preparedStatement.setInt(1, matchStatus.AssignedMatch); diff --git a/Plugins/Mineplex.Votifier/src/mineplex/votifier/VotifierManager.java b/Plugins/Mineplex.Votifier/src/mineplex/votifier/VotifierManager.java index 19a3c37b3..4817371cb 100644 --- a/Plugins/Mineplex.Votifier/src/mineplex/votifier/VotifierManager.java +++ b/Plugins/Mineplex.Votifier/src/mineplex/votifier/VotifierManager.java @@ -179,7 +179,7 @@ public class VotifierManager extends MiniPlugin private void awardBonus(final String playerName, final UUID uuid, final Callback onComplete) { - DSLContext create = DSL.using(DBPool.ACCOUNT, SQLDialect.MYSQL); + DSLContext create = DSL.using(DBPool.getAccount(), SQLDialect.MYSQL); Record1 idRecord = create.select(Tables.accounts.id).from(Tables.accounts).where(Tables.accounts.uuid.eq(uuid.toString())).fetchOne(); if (idRecord != null) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/titangiveaway/TitanGiveawayRepository.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/titangiveaway/TitanGiveawayRepository.java index 0ace10a33..3585b3586 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/titangiveaway/TitanGiveawayRepository.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/titangiveaway/TitanGiveawayRepository.java @@ -15,7 +15,7 @@ public class TitanGiveawayRepository extends RepositoryBase public TitanGiveawayRepository(JavaPlugin plugin) { - super(plugin, DBPool.ACCOUNT); + super(plugin, DBPool.getAccount()); _titanGiveawayCount = 0; } From 13cfc0e12ac492fcdce944d2df7ee3f0c9ad1e43 Mon Sep 17 00:00:00 2001 From: William Burns Date: Fri, 18 Dec 2015 18:16:20 +0000 Subject: [PATCH 091/113] Updated to a better check --- .../repository/CustomDataRepository.java | 34 +++++++------------ 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/customdata/repository/CustomDataRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/customdata/repository/CustomDataRepository.java index c57e2a03f..2b6dc9d08 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/customdata/repository/CustomDataRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/customdata/repository/CustomDataRepository.java @@ -73,30 +73,20 @@ public class CustomDataRepository extends RepositoryBase for (CustomData cd : data.getDataMap().keySet()) { - - executeInsert(UPDATE_DATA, new ResultSetCallable() - { - @Override - public void processResultSet(ResultSet resultSet) throws SQLException - { - - if (!resultSet.isBeforeFirst()) - { - - // Not already in the DB - executeUpdate( - INSERT_DATA, - new ColumnInt("account", accountId), - new ColumnInt("customData", cd.getId()), - new ColumnInt("data", data.getDataMap().get(cd)) - ); - } - } - }, + if (executeUpdate( + UPDATE_DATA, new ColumnInt("data", data.getDataMap().get(cd)), new ColumnInt("account", accountId), - new ColumnInt("customData", cd.getId()) - ); + new ColumnInt("customData", cd.getId())) < 1) + { + // Not already in the DB + executeUpdate( + INSERT_DATA, + new ColumnInt("account", accountId), + new ColumnInt("customData", cd.getId()), + new ColumnInt("data", data.getDataMap().get(cd)) + ); + } } } From 6c5e3d750910c84720266fea57e26e75b7bcd887 Mon Sep 17 00:00:00 2001 From: Sarah Date: Sat, 19 Dec 2015 00:48:42 +0100 Subject: [PATCH 092/113] Fixing visibility. --- .../game/arcade/gametutorial/GameTutorial.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/GameTutorial.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/GameTutorial.java index 0c46114c7..802f41a83 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/GameTutorial.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/GameTutorial.java @@ -131,13 +131,13 @@ public abstract class GameTutorial public void run() { // Player visibility/fly mode - for(Player player : Manager.GetGame().GetPlayers(true)) + for(Player other : Manager.GetGame().GetPlayers(false)) { - for(Player other : Manager.GetGame().GetPlayers(true)) - { - player.showPlayer(other); - } - } + if(player == other) + continue; + + other.showPlayer(player); + } player.setAllowFlight(false); player.setFlying(false); } From b3afa0094ec94f7ab032598399bf732ad6ded057 Mon Sep 17 00:00:00 2001 From: Sarah Date: Sat, 19 Dec 2015 00:59:15 +0100 Subject: [PATCH 093/113] Fixing some nuke stuff, Giant noises only for own Team and "Giant under attack message", spelling fixes --- .../arcade/game/games/typewars/Minion.java | 2 +- .../arcade/game/games/typewars/TypeWars.java | 44 +++++++++++++------ .../games/typewars/kits/KitTypeWarsBase.java | 3 ++ 3 files changed, 34 insertions(+), 15 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java index 63ec4b9a7..c1cf4e97c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java @@ -79,7 +79,7 @@ public class Minion "Conquest", "Province", "Overflow", "Graceful", "Negative", "Doctrine", "Charger", "Carrots", "Spirits", "Robbers", "Karambit", "Solution", "Sandwich", "Catapult", "Positive", "Firework", "Ukulele", "Dragons", "Cobwebs", "Drawing", "Internal", "Japanese", "Atronomy", "Villager", "Tranquil", "Compress", "Glasses", "Nursing", "College", "Magenta", - "Trillion", "Standard", "Atrology", "Infringe", "Fortress", "Prisoner", "Daisies", "Soldier", "Courses", "Serpent", + "Trillion", "Standard", "Astrology", "Infringe", "Fortress", "Prisoner", "Daisies", "Soldier", "Courses", "Serpent", "Carnival", "Parasite", "Porridge", "Variable", "Charcoal", "Decision", "Hazards", "Jupiter", "Buttons", "Camping", "Concrete", "Carriage", "Pressure", "Practice", "Commerce", "Windmill", "Cheetah", "Mercury", "Octopus", "Canyons", "Pavement", "Auxilary", "Demolish", "Maintain", "Barbeque", "Parmesan", "Vulture", "America", "Printer", "Seventy", diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index 6554af060..8bf026e1b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -711,8 +711,12 @@ public class TypeWars extends TeamGame Location loc = giant.getLocation().clone(); loc.setYaw(UtilAlg.GetYaw(new Vector(minion.getEntity().getLocation().getBlockX() - loc.getBlockX(), minion.getEntity().getLocation().getBlockY() - loc.getBlockY(), minion.getEntity().getLocation().getBlockZ() - loc.getBlockZ()))); giant.teleport(loc); - giant.getWorld().playSound(giant.getLocation(), Sound.ZOMBIE_WOODBREAK, 100, 1); - giant.getWorld().playSound(giant.getLocation(), Sound.ZOMBIE_IDLE, 1, 1); + for(Player player : team.GetPlayers(false)) + { + player.playSound(giant.getLocation(), Sound.ZOMBIE_WOODBREAK, 100, 1); + player.playSound(giant.getLocation(), Sound.ZOMBIE_IDLE, 1, 1); + } + UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, minion.getEntity().getLocation(), 0, 0, 0, 1, 1, ViewDist.LONG, UtilServer.getPlayers()); minion.despawn(null, true); @@ -754,19 +758,14 @@ public class TypeWars extends TeamGame _giants.get(team).damage(damage); } } - if(_giantsAttacked.containsKey(team)) - { - if(_giantsAttacked.get(team) != null) + if(!_giantsAttacked.containsKey(team) || UtilTime.elapsed(_giantsAttacked.get(team), 10000)) + { + _giantsAttacked.put(team, System.currentTimeMillis()); + for(Player player : GetPlayers(true)) { - if(UtilTime.elapsed(_giantsAttacked.get(team), 10000)) - { - for(Player player : GetPlayers(true)) - { - if(GetTeam(player) == team) - { - UtilTextMiddle.display("", "Your giant is under Attack!", 0, 30, 9, player); - } - } + if(GetTeam(player) == team) + { + UtilTextMiddle.display("", "Your giant is under Attack!", 0, 30, 9, player); } } } @@ -1257,6 +1256,23 @@ public class TypeWars extends TeamGame _deadMinions.add(minion); } } + Iterator finishedMinionIterator = _finishedMinions.iterator(); + while(finishedMinionIterator.hasNext()) + { + Minion minion = finishedMinionIterator.next(); + if(minion.getTeam() == team) + continue; + + if(UtilMath.offset(location, minion.getEntity().getLocation()) > 3) + continue; + + minion.despawn(player, true); + if(!minion.hasLives()) + { + minionIterator.remove(); + _deadMinions.add(minion); + } + } i++; } _nukeFrame++; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTypeWarsBase.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTypeWarsBase.java index ae36d5c21..f71c2cf8f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTypeWarsBase.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTypeWarsBase.java @@ -63,6 +63,9 @@ public abstract class KitTypeWarsBase extends Kit @EventHandler public void activateSpell(PlayerInteractEvent event) { + if(!Manager.GetGame().IsLive()) + return; + if(event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK) return; From f8bffc9f8828b53f41ad1e4e52be9e91c3a1e875 Mon Sep 17 00:00:00 2001 From: Sarah Date: Sat, 19 Dec 2015 12:45:06 +0100 Subject: [PATCH 094/113] nuke delay and Stats --- .../arcade/game/games/typewars/Minion.java | 7 ++- .../game/games/typewars/MinionSize.java | 19 ++++--- .../arcade/game/games/typewars/TypeWars.java | 50 ++++++++++++++----- .../typewars/spells/SpellKillEverything.java | 2 +- 4 files changed, 57 insertions(+), 21 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java index c1cf4e97c..45494c974 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java @@ -387,7 +387,7 @@ public class Minion return; } _killed = killed; - _player = player; + _killer = player; _die = true; _hologram.stop(); try @@ -569,6 +569,11 @@ public class Minion return _money; } + public Player getKiller() + { + return _player; + } + public Player getPlayer() { return _player; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionSize.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionSize.java index 0d52ae230..af5f91434 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionSize.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/MinionSize.java @@ -10,24 +10,26 @@ import org.bukkit.inventory.ItemStack; public enum MinionSize { - EASY("Easy", 2, ItemStackFactory.Instance.CreateStack(Material.MONSTER_EGG, (byte) 0, 1, (short) 55, "", new String[]{}), 1), - MEDIUM("Medium", 4, ItemStackFactory.Instance.CreateStack(Material.MONSTER_EGG, (byte) 0, 1, (short) 61, "", new String[]{}), 1), - HARD("Hard", 6, ItemStackFactory.Instance.CreateStack(Material.MONSTER_EGG, (byte) 0, 1, (short) 52, "", new String[]{}), 1), - FREAK("Freak", 10000, new ItemStack(Material.MONSTER_EGG), 1), - BOSS("Boss", 10000, new ItemStack(Material.MONSTER_EGG), 7); + EASY("Easy", 2, ItemStackFactory.Instance.CreateStack(Material.MONSTER_EGG, (byte) 0, 1, (short) 55, "", new String[]{}), 1, 1), + MEDIUM("Medium", 4, ItemStackFactory.Instance.CreateStack(Material.MONSTER_EGG, (byte) 0, 1, (short) 61, "", new String[]{}), 1, 2), + HARD("Hard", 6, ItemStackFactory.Instance.CreateStack(Material.MONSTER_EGG, (byte) 0, 1, (short) 52, "", new String[]{}), 1, 4), + FREAK("Freak", 10000, new ItemStack(Material.MONSTER_EGG), 1, 999999), + BOSS("Boss", 10000, new ItemStack(Material.MONSTER_EGG), 7, 999999999); private int _cost; private ItemStack _displayItem; private int _lives; + private int _gemReward; private String _displayName; - private MinionSize(String name, int cost, ItemStack displayItem, int lives) + private MinionSize(String name, int cost, ItemStack displayItem, int lives, int gemReward) { _displayName = name; _cost = cost; _displayItem = displayItem; _lives = lives; + _gemReward = gemReward; } public int getCost() @@ -45,6 +47,11 @@ public enum MinionSize return _displayName; } + public int getGemReward() + { + return _gemReward; + } + public MinionType getRandomType() { ArrayList minionList = new ArrayList<>(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index 8bf026e1b..676e11cad 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -765,7 +765,10 @@ public class TypeWars extends TeamGame { if(GetTeam(player) == team) { - UtilTextMiddle.display("", "Your giant is under Attack!", 0, 30, 9, player); + if(IsLive()) + { + UtilTextMiddle.display("", "Your giant is under Attack!", 0, 30, 9, player); + } } } } @@ -927,6 +930,15 @@ public class TypeWars extends TeamGame GameTeam winner = winners.get(UtilMath.r(winners.size())); AnnounceEnd(winner); + + Iterator minionIterator = _activeMinions.iterator(); + + while (minionIterator.hasNext()) + { + Minion minion = minionIterator.next(); + minion.despawn(null, false); + minionIterator.remove(); + } for (GameTeam team : GetTeamList()) { @@ -942,19 +954,17 @@ public class TypeWars extends TeamGame { AddGems(player, 10, "Participation", false, false); AddGems(player, getPlayerKills(player), getPlayerKills(player) + " Minions killed", false, true); + + for(MinionSize size : MinionSize.values()) + { + if(size == MinionSize.BOSS || size == MinionSize.FREAK) + continue; + + AddGems(player, size.getGemReward() * getSpawnedMinions(player, size), getSpawnedMinions(player, size) + " " + size.getDisplayName() + " Minions spawned", false, true); + } } } } - - Iterator minionIterator = _activeMinions.iterator(); - - while (minionIterator.hasNext()) - { - Minion minion = minionIterator.next(); - minion.despawn(null, false); - minionIterator.remove(); - } - Scoreboard.Reset(); @@ -1283,9 +1293,9 @@ public class TypeWars extends TeamGame int kills = 0; for(Minion minion : _deadMinions) { - if(minion.getPlayer() != null) + if(minion.getKiller() != null) { - if(minion.getPlayer().getName().contentEquals(player.getName())) + if(minion.getKiller().getName().contentEquals(player.getName())) { kills++; } @@ -1304,6 +1314,20 @@ public class TypeWars extends TeamGame return kills; } + public int getSpawnedMinions(Player player, MinionSize size) + { + int spawns = 0; + for(Minion minion : _deadMinions) + { + if(minion.getPlayer() == null) + continue; + + if(minion.getPlayer().getName().contentEquals(player.getName())) + spawns++; + } + return spawns; + } + public HashMap getMoneyMap() { return _moneyMap; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellKillEverything.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellKillEverything.java index 12b1cd34e..26bae0d4b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellKillEverything.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/spells/SpellKillEverything.java @@ -21,7 +21,7 @@ public class SpellKillEverything extends Spell public SpellKillEverything(ArcadeManager manager) { - super(manager, "Zombie Smash", 0, Material.TNT, 1000L, 0, 10000, true); + super(manager, "Zombie Smash", 0, Material.TNT, 1000L, 0, 20000, true); } @Override From 7cb002ca8607537c54d888448cfb63a3dd2985a5 Mon Sep 17 00:00:00 2001 From: Sarah Date: Sat, 19 Dec 2015 12:55:28 +0100 Subject: [PATCH 095/113] Adding Tutorial notification --- .../arcade/gametutorial/GameTutorial.java | 25 +++++++++++++++++++ .../arcade/gametutorial/TutorialPhase.java | 5 ++++ .../arcade/gametutorial/TutorialText.java | 5 ++++ 3 files changed, 35 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/GameTutorial.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/GameTutorial.java index 802f41a83..52f7cf050 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/GameTutorial.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/GameTutorial.java @@ -36,6 +36,7 @@ public abstract class GameTutorial public boolean PlayTutorialSounds = false; public boolean ShowPrepareTimer = false; public boolean CustomEnding = false; + public boolean TutorialNotification = false; public long TimeBetweenPhase = 0; public long StartAfterTutorial = 5000; @@ -58,6 +59,30 @@ public abstract class GameTutorial for(TutorialPhase phase : _phases) phase.setTutorial(this); + if(TutorialNotification) + { + TutorialPhase phase = getPhase(1); + for(TutorialText text : phase.getText()) + { + int index = text.ID(); + text.setID(index + 1); + } + TutorialText[] newText = new TutorialText[phase.getText().length + 1]; + for(int i = 0; i < newText.length; i++) + { + if(i == 0) + { + newText[i] = new TutorialText("Please notice that this is a Tutorial", 1); + continue; + } + else + { + newText[i] = phase.getText()[i]; + } + } + phase.setText(newText); + } + Manager.GetChat().Silence(60000, false); _started = System.currentTimeMillis(); Manager.getPluginManager().callEvent(new GameTutorialStartEvent(this)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/TutorialPhase.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/TutorialPhase.java index aa975b856..8b45496ee 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/TutorialPhase.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/TutorialPhase.java @@ -222,6 +222,11 @@ public abstract class TutorialPhase return _text; } + public void setText(TutorialText[] text) + { + _text = text; + } + public Location getLocation() { return _location; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/TutorialText.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/TutorialText.java index dba1d39a6..2711b10fa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/TutorialText.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/TutorialText.java @@ -59,4 +59,9 @@ public class TutorialText _text = text; } + public void setID(int id) + { + _id = id; + } + } From 32a0dd6668e85011e239830ac6dc0446e5293eb7 Mon Sep 17 00:00:00 2001 From: Sarah Date: Sat, 19 Dec 2015 12:59:37 +0100 Subject: [PATCH 096/113] adding Tutorial notification --- .../arcade/game/games/typewars/tutorial/TutorialTypeWars.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java index dfff09de9..e630a6ffb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java @@ -21,6 +21,8 @@ public class TutorialTypeWars extends GameTutorial public TutorialTypeWars(ArcadeManager manager) { super(manager, new TutorialPhase[]{new TutorialPhaseTypeWars()}); + + TutorialNotification = true; } @Override From 8a543884804e6eca2cdf195f4794685818a1c0b0 Mon Sep 17 00:00:00 2001 From: Sarah Date: Sat, 19 Dec 2015 13:00:12 +0100 Subject: [PATCH 097/113] fixing last commit --- .../src/nautilus/game/arcade/gametutorial/GameTutorial.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/GameTutorial.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/GameTutorial.java index 52f7cf050..0df5c81b0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/GameTutorial.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/GameTutorial.java @@ -77,7 +77,7 @@ public abstract class GameTutorial } else { - newText[i] = phase.getText()[i]; + newText[i] = phase.getText()[i - 1]; } } phase.setText(newText); From 35966d88cffeaad0f96aa823c259a1a69f0dec13 Mon Sep 17 00:00:00 2001 From: Sarah Date: Sat, 19 Dec 2015 13:05:39 +0100 Subject: [PATCH 098/113] Fixing Tutorial Minion --- .../arcade/game/games/typewars/tutorial/TutorialTypeWars.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java index e630a6ffb..6c4cd2600 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/tutorial/TutorialTypeWars.java @@ -37,7 +37,7 @@ public class TutorialTypeWars extends GameTutorial ArrayList locations = UtilShapes.getLinesDistancedPoints(_typeWars.getMinionSpawns().get(getTeam()).get(4), _typeWars.getMinionSpawns().get(team).get(4), 1); _manager.GetCreature().SetForce(true); _manager.GetGame().CreatureAllowOverride = true; - Minion minion = new Minion(_manager, locations.get(locations.size() - 27), _typeWars.getMinionSpawns().get(team).get(4), getTeam(), 4); + Minion minion = new Minion(_manager, locations.get(locations.size() - 35), _typeWars.getMinionSpawns().get(team).get(4), getTeam(), 4); minion.changeName("Fishing"); ((TypeWars) _manager.GetGame()).getActiveMinions().add(minion); _manager.GetGame().CreatureAllowOverride = false; From c56cd0d56e404587c86b44bac5930a9767b7f9e0 Mon Sep 17 00:00:00 2001 From: Sarah Date: Sat, 19 Dec 2015 13:08:53 +0100 Subject: [PATCH 099/113] adjusting some timings --- .../src/nautilus/game/arcade/gametutorial/GameTutorial.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/GameTutorial.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/GameTutorial.java index 0df5c81b0..96ac7ad5a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/GameTutorial.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gametutorial/GameTutorial.java @@ -72,7 +72,7 @@ public abstract class GameTutorial { if(i == 0) { - newText[i] = new TutorialText("Please notice that this is a Tutorial", 1); + newText[i] = new TutorialText("Please notice that this is a Tutorial", 20, 1); continue; } else From 816da0f6333b74dabc7425203a1c9f6d0211567b Mon Sep 17 00:00:00 2001 From: Sarah Date: Sun, 20 Dec 2015 12:00:32 +0100 Subject: [PATCH 100/113] Fixing Gems --- .../src/nautilus/game/arcade/game/games/typewars/TypeWars.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index 676e11cad..d1379f1b5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -960,7 +960,7 @@ public class TypeWars extends TeamGame if(size == MinionSize.BOSS || size == MinionSize.FREAK) continue; - AddGems(player, size.getGemReward() * getSpawnedMinions(player, size), getSpawnedMinions(player, size) + " " + size.getDisplayName() + " Minions spawned", false, true); + AddGems(player, getSpawnedMinions(player, size) * size.getGemReward(), getSpawnedMinions(player, size) + " " + size.getDisplayName() + " Minions spawned", false, true); } } } From 0f5be6444b2dfb888a383dc484af6e39ba326ca7 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Mon, 21 Dec 2015 02:23:59 -0500 Subject: [PATCH 101/113] Yo shaun debug this m8 ty --- .../mineplex/core/itemstack/ItemBuilder.java | 7 +- .../enjinTranslator/TempRepository.java | 2 +- .../purchase/data/PurchaseRepository.java | 2 +- .../mineplex/hub/server/ServerManager.java | 26 +- .../hub/server/ui/ServerGameMenu.java | 525 ++++++++++-------- .../server/ui/button/SelectCLANSButton.java | 23 + .../hub/server/ui/button/SelectCTFButton.java | 23 + .../server/ui/button/SelectFEATButton.java | 25 + .../hub/server/ui/button/SelectTWButton.java | 23 + .../password/PasswordRepository.java | 2 +- 10 files changed, 408 insertions(+), 250 deletions(-) create mode 100644 Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectCLANSButton.java create mode 100644 Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectCTFButton.java create mode 100644 Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectFEATButton.java create mode 100644 Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectTWButton.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemBuilder.java b/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemBuilder.java index 8ea88cc70..fa7070511 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemBuilder.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemBuilder.java @@ -11,16 +11,17 @@ import java.util.Map; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Color; +import org.bukkit.DyeColor; import org.bukkit.FireworkEffect; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; import org.bukkit.inventory.ItemFlag; import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.BannerMeta; import org.bukkit.inventory.meta.FireworkEffectMeta; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.LeatherArmorMeta; import org.bukkit.inventory.meta.SkullMeta; -import org.bukkit.potion.Potion; import mineplex.core.common.util.C; @@ -254,6 +255,10 @@ public class ItemBuilder { ((FireworkEffectMeta) meta).setEffect(FireworkEffect.builder().withColor(_color).build()); } + else if (meta instanceof BannerMeta) + { + ((BannerMeta) meta).setBaseColor(DyeColor.getByColor(_color)); + } meta.addItemFlags(getItemFlags().toArray(new ItemFlag[0])); meta.spigot().setUnbreakable(isUnbreakable()); diff --git a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/TempRepository.java b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/TempRepository.java index ba4cd2729..e96d4a42a 100644 --- a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/TempRepository.java +++ b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/TempRepository.java @@ -13,7 +13,7 @@ public class TempRepository extends RepositoryBase public TempRepository(JavaPlugin plugin) { - super(plugin, DBPool.ACCOUNT); + super(plugin, DBPool.getAccount()); } public void addGemBooster(String name, int amount) diff --git a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/purchase/data/PurchaseRepository.java b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/purchase/data/PurchaseRepository.java index d71d09552..048c1fc99 100644 --- a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/purchase/data/PurchaseRepository.java +++ b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/purchase/data/PurchaseRepository.java @@ -23,7 +23,7 @@ public class PurchaseRepository extends RepositoryBase public PurchaseRepository(JavaPlugin plugin) { - super(plugin, DBPool.ACCOUNT); + super(plugin, DBPool.getAccount()); } @Override diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java index 10f889fce..12fa009d3 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java @@ -87,6 +87,8 @@ public class ServerManager extends MiniPlugin private NautHashMap _serverInfoMap = new NautHashMap(); private NautHashMap _serverUpdate = new NautHashMap(); private NautHashMap _serverPortalLocations = new NautHashMap(); + + private ClansServerShop _clansShop; // Join Time for Free Players Timer private NautHashMap _joinTime = new NautHashMap(); @@ -121,7 +123,7 @@ public class ServerManager extends MiniPlugin //_domShop = new new QueueShop(_queueManager, clientManager, donationManager, "Dominate"); // TODO: Find more appropriate place to initialize Clans server shop? - new ClansServerShop(this, _clientManager, _donationManager); + _clansShop = new ClansServerShop(this, _clientManager, _donationManager); } @EventHandler(priority = EventPriority.LOW) @@ -786,6 +788,11 @@ public class ServerManager extends MiniPlugin { return _serverNpcShopMap.get("Dominate"); } + + public ServerNpcShop getCtfShop() + { + return _serverNpcShopMap.get("Capture the Flag"); + } public ServerNpcShop getBridgesShop() { @@ -806,7 +813,7 @@ public class ServerManager extends MiniPlugin { return _serverNpcShopMap.get("Beta Games"); } - + public ServerNpcShop getUHCShop() { return _serverNpcShopMap.get("Ultra Hardcore"); @@ -822,6 +829,11 @@ public class ServerManager extends MiniPlugin return _serverNpcShopMap.get("Mineplex Player Servers"); } + public ServerNpcShop getShop(String name) + { + return _serverNpcShopMap.get(name); + } + private Vector ParseVector(String vectorString) { Vector vector = new Vector(); @@ -882,4 +894,14 @@ public class ServerManager extends MiniPlugin { return _serverNpcShopMap.get("Master Builders"); } + + public ClansServerShop getClansShop() + { + return _clansShop; + } + + public ShopBase getTypeWarsShop() + { + return _serverNpcShopMap.get("Type Wars"); + } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java index 6b1411ecd..4e61341f8 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.List; import org.bukkit.ChatColor; +import org.bukkit.Color; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -12,15 +13,18 @@ import mineplex.core.account.CoreClientManager; import mineplex.core.common.util.C; import mineplex.core.donation.DonationManager; import mineplex.core.itemstack.ItemBuilder; -import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.shop.page.ShopPageBase; import mineplex.hub.server.ServerManager; +import mineplex.hub.server.ui.button.SelectBETAButton; import mineplex.hub.server.ui.button.SelectBHButton; import mineplex.hub.server.ui.button.SelectBLDButton; import mineplex.hub.server.ui.button.SelectBRButton; +import mineplex.hub.server.ui.button.SelectCLANSButton; import mineplex.hub.server.ui.button.SelectCSButton; +import mineplex.hub.server.ui.button.SelectCTFButton; import mineplex.hub.server.ui.button.SelectDMTButton; import mineplex.hub.server.ui.button.SelectDOMButton; +import mineplex.hub.server.ui.button.SelectFEATButton; import mineplex.hub.server.ui.button.SelectMINButton; import mineplex.hub.server.ui.button.SelectMSButton; import mineplex.hub.server.ui.button.SelectPLAYERButton; @@ -28,6 +32,7 @@ import mineplex.hub.server.ui.button.SelectSGButton; import mineplex.hub.server.ui.button.SelectSKYButton; import mineplex.hub.server.ui.button.SelectSSMButton; import mineplex.hub.server.ui.button.SelectTDMButton; +import mineplex.hub.server.ui.button.SelectTWButton; import mineplex.hub.server.ui.button.SelectUHCButton; import mineplex.hub.server.ui.button.SelectWIZButton; @@ -38,6 +43,7 @@ public class ServerGameMenu extends ShopPageBase private int _ssmIndex; private int _minigameIndex; + private boolean _extraValue; public ServerGameMenu(ServerManager plugin, QuickShop quickShop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) @@ -50,246 +56,246 @@ public class ServerGameMenu extends ShopPageBase buildPage(); } - @SuppressWarnings("deprecation") @Override protected void buildPage() { - setItem(0, new ItemBuilder(Material.IRON_PICKAXE) - .setTitle(C.Reset + C.Bold + C.cYellow + "The Bridges " + C.cGray + "4 Team Survival").addLore(new String[] - { - C.Reset + "", - C.Reset + "4 Teams get 10 minutes to prepare.", - C.Reset + "Then the bridges drop, and all hell", - C.Reset + "breaks loose as you battle to the", - C.Reset + "death with the other teams.", - C.Reset + "", - C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("BR") + C.Reset + " other players!" - }).setHideInfo(true).build()); - - setItem(2, new ItemBuilder(Material.DIAMOND_SWORD) - .setTitle(C.Reset + C.Bold + C.cYellow + "Survival Games " + C.cGray + "Solo/Team Survival").addLore(new String[] - { - C.Reset + "", - C.Reset + "Search for chests to find loot and ", - C.Reset + "fight others to be the last man standing. ", - C.Reset + "Stay away from the borders!", - C.Reset + "", - C.Reset + "Join " + C.cGreen - + (getPlugin().getGroupTagPlayerCount("HG") + getPlugin().getGroupTagPlayerCount("SG2")) + C.Reset - + " other players!" - }).setHideInfo(true).build()); - - setItem(4, new ItemBuilder(Material.FEATHER) - .setTitle(C.Reset + C.Bold + C.cYellow + "Skywars " + C.cGray + "Solo/Team Survival").addLore(new String[] - { - C.Reset + "", - C.Reset + "16 contenders fight to rule the skies!", - C.Reset + "Spawn on a sky island and build your path!", - C.Reset + "Find weapons to take your enemies down!", - C.Reset + "Up in the skies, death looming if you fall..", - C.Reset + "Win! Fight! Send enemies flying in Skywars!", - C.Reset + "", - C.Reset + "Join " + C.cGreen - + (getPlugin().getGroupTagPlayerCount("SKY") + getPlugin().getGroupTagPlayerCount("SKY2")) + C.Reset - + " other players!", - }).setHideInfo(true).build()); - - setItem(6, new ItemBuilder(Material.GOLDEN_APPLE) - .setTitle(C.Reset + C.Bold + C.cYellow + "UHC " + C.cGray + "Ultra Hardcore Mode").addLore(new String[] - { - C.Reset + "", - C.Reset + "Extremely hard team-based survival ", - C.Reset + "Gather materials and fight your way", - C.Reset + "to become the last team standing!", - C.Reset + "", - C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("UHC") + C.Reset + " other players!", - }).setHideInfo(true).build()); - - setItem(8, new ItemBuilder(Material.BLAZE_ROD) - .setTitle(C.Reset + C.Bold + C.cYellow + "Wizards " + C.cGray + "Last Man Standing").addLore(new String[] - { - C.Reset + "", - C.Reset + "Wield powerful spells to fight", - C.Reset + "against other players in this", - C.Reset + "exciting free-for-all brawl!", - C.Reset + "", - C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("WIZ") + C.Reset + " other players!", - }).setHideInfo(true).build()); - - setItem(18, new ItemBuilder(Material.DIAMOND_CHESTPLATE) - .setTitle(C.Reset + C.Bold + C.cYellow + "Castle Siege " + C.cGray + "Team Game").addLore(new String[] - { - C.Reset + "", - C.Reset + "Defenders must protect King Sparklez", - C.Reset + "from the endless waves of Undead", - C.Reset + "until the sun rises!", - C.Reset + "", - C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("CS") + C.Reset + " other players!", - }).setHideInfo(true).build()); - - setItem(20, new ItemBuilder(Material.GRASS) - .setTitle(C.Reset + C.Bold + C.cYellow + "Block Hunt " + C.cGray + "Cat and Mouse").addLore(new String[] - { - C.Reset + "", - C.Reset + "Hide as blocks/animals, upgrade your ", - C.Reset + "weapon and fight to survive against", - C.Reset + "the Hunters!", - C.Reset + "", - C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("BH") + C.Reset + " other players!", - }).setHideInfo(true).build()); - - setItem(22, _superSmashCycle.get(_ssmIndex)); - - setItem(24, ItemStackFactory.Instance.CreateStack(Material.TNT.getId(), (byte) 0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Mine-Strike" + C.cGray + "Team Survival", new String[] + addButton(13, new ItemBuilder(Material.IRON_SWORD).setTitle(C.cYellowB + "Gladiators" + C.cGray + " Bracketted Deathmatch").addLore(new String[] { - ChatColor.RESET + "", - ChatColor.RESET + "One team must defend two bomb sites from", - ChatColor.RESET + "the other team, who are trying to plant a bomb", - ChatColor.RESET + "and blow them up!", - ChatColor.RESET + "", - ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("MS") + ChatColor.RESET + " other players!", - })); - - setItem(26, ItemStackFactory.Instance.CreateStack(Material.BOOK_AND_QUILL.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Draw My Thing " + C.cGray + "Pictionary!", new String[] + (_extraValue ? C.cAquaB : C.cWhiteB) + "FEATURED GAME " + C.cGray + "Arcade", + C.Reset + "", + C.Reset + "A 1v1 tournament.", + C.Reset + "Kill your enemy and then", + C.Reset + "run to the next arena!", + C.Reset + "", + C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("GLD") + C.Reset + " other players!" + }).setHideInfo(true).build(), new SelectFEATButton(this, "Gladiators")); + + addButton(18, new ItemBuilder(Material.IRON_PICKAXE).setTitle(C.cYellowB + "The Bridges " + C.cGray + "4 Team Survival").addLore(new String[] + { + C.Reset + "", + C.Reset + "4 Teams get 10 minutes to prepare.", + C.Reset + "Then the bridges drop, and all hell", + C.Reset + "breaks loose as you battle to the", + C.Reset + "death with the other teams.", + C.Reset + "", + C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("BR") + C.Reset + " other players!" + }).setHideInfo(true).build(), new SelectBRButton(this)); + + addButton(19, new ItemBuilder(Material.DIAMOND_SWORD).setTitle(C.cYellowB + "Survival Games " + C.cGray + "Solo/Team Survival").addLore(new String[] + { + C.Reset + "", + C.Reset + "Search for chests to find loot and ", + C.Reset + "fight others to be the last man standing. ", + C.Reset + "Stay away from the borders!", + C.Reset + "", + C.Reset + "Join " + C.cGreen + (getPlugin().getGroupTagPlayerCount("HG") + getPlugin().getGroupTagPlayerCount("SG2")) + C.Reset + " other players!" + }).setHideInfo(true).build(), new SelectSGButton(this)); + + addButton(20, new ItemBuilder(Material.FEATHER).setTitle(C.cYellowB + "Skywars " + C.cGray + "Solo/Team Survival").addLore(new String[] + { + C.Reset + "", + C.Reset + "16 contenders fight to rule the skies!", + C.Reset + "Spawn on a sky island and build your path!", + C.Reset + "Find weapons to take your enemies down!", + C.Reset + "Up in the skies, death looming if you fall..", + C.Reset + "Win! Fight! Send enemies flying in Skywars!", + C.Reset + "", + C.Reset + "Join " + C.cGreen + (getPlugin().getGroupTagPlayerCount("SKY") + getPlugin().getGroupTagPlayerCount("SKY2")) + C.Reset + " other players!", + }).setHideInfo(true).build(), new SelectSKYButton(this)); + + addButton(21, new ItemBuilder(Material.GOLDEN_APPLE).setTitle(C.cYellowB + "UHC " + C.cGray + "Ultra Hardcore Mode").addLore(new String[] + { + C.Reset + "", + C.Reset + "Extremely hard team-based survival ", + C.Reset + "Gather materials and fight your way", + C.Reset + "to become the last team standing!", + C.Reset + "", + C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("UHC") + C.Reset + " other players!", + }).setHideInfo(true).build(), new SelectUHCButton(this)); + + addButton(23, new ItemBuilder(Material.TNT).setTitle(C.cYellowB + "MineStrike " + C.cGray + "Team Survival").addLore(new String[] + { + C.Reset + "", + C.Reset + "One team must defend two bomb sites from", + C.Reset + "the other team, who are trying to plant a bomb", + C.Reset + "and blow them up!", + C.Reset + "", + C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("MS") + C.Reset + " other players!", + }).setHideInfo(true).build(), new SelectMSButton(this)); + + addButton(24, new ItemBuilder(Material.BANNER).setColor(Color.RED).setTitle(C.cYellowB + "Capture the Flag " + C.cGray + "Team Game").addLore(new String[] + { + C.Reset + "", + C.Reset + "One team must steal the other", + C.Reset + "team's flag. Capture it", + C.Reset + "three times to win.", + C.Reset + "", + C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("CTF") + C.Reset + " other players!", + }).setHideInfo(true).build(), new SelectCTFButton(this)); + + addButton(25, new ItemBuilder(Material.BEACON).setTitle(C.cYellowB + "Dominate " + C.cGray + "Team Game").addLore(new String[] + { + C.Reset + "", + C.Reset + "Customize one of five exciting champions", + C.Reset + "and battle with the opposing team for the", + C.Reset + "control points on the map.", + C.Reset + "", + C.Reset + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("DOM") + C.Reset + " other players!", + }).setHideInfo(true).build(), new SelectDOMButton(this)); + + addButton(26, new ItemBuilder(Material.GOLD_SWORD).setTitle(C.cYellowB + "Team Deathmatch " + C.cGray + "Team Game").addLore(new String[] + { + C.Reset + "", + C.Reset + "Customize one of five exciting champions", + C.Reset + "and battle with the opposing team to the", + C.Reset + "last man standing.", + C.Reset + "", + C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("TDM") + C.Reset + " other players!", + }).setHideInfo(true).build(), new SelectTDMButton(this)); + + addButton(27, new ItemBuilder(Material.BLAZE_ROD).setTitle(C.cYellowB + "Wizards " + C.cGray + "Last Man Standing").addLore(new String[] + { + C.Reset + "", + C.Reset + "Wield powerful spells to fight", + C.Reset + "against other players in this", + C.Reset + "exciting free-for-all brawl!", + C.Reset + "", + C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("WIZ") + C.Reset + " other players!", + }).setHideInfo(true).build(), new SelectWIZButton(this)); + + addButton(28, new ItemBuilder(Material.DIAMOND_CHESTPLATE).setTitle(C.cYellowB + "Castle Siege " + C.cGray + "Team Game").addLore(new String[] + { + C.Reset + "", + C.Reset + "Defenders must protect King Sparklez", + C.Reset + "from the endless waves of Undead", + C.Reset + "until the sun rises!", + C.Reset + "", + C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("CS") + C.Reset + " other players!", + }).setHideInfo(true).build(), new SelectCSButton(this)); + + addButton(29, new ItemBuilder(Material.GRASS).setTitle(C.cYellowB + "Block Hunt " + C.cGray + "Cat and Mouse").addLore(new String[] + { + C.Reset + "", + C.Reset + "Hide as blocks/animals, upgrade your ", + C.Reset + "weapon and fight to survive against", + C.Reset + "the Hunters!", + C.Reset + "", + C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("BH") + C.Reset + " other players!", + }).setHideInfo(true).build(), new SelectBHButton(this)); + + addButton(30, _superSmashCycle.get(_ssmIndex), new SelectSSMButton(this)); + + addButton(32, _minigameCycle.get(_minigameIndex), new SelectMINButton(this)); + + addButton(33, new ItemBuilder(Material.WOOD).setTitle(C.cYellowB + "Master Builders " + C.cGray + "Creative Build").setLore(new String[] { - ChatColor.RESET + "", - ChatColor.RESET + "Players take turns at drawing a random", - ChatColor.RESET + "word. Whoever guesses it within the time", - ChatColor.RESET + "limit gets some points!", - ChatColor.RESET + "", - ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("DMT") + ChatColor.RESET + " other players!", - })); - - setItem(36, ItemStackFactory.Instance.CreateStack(Material.BEACON.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Dominate " + C.cGray + "Team Game", new String[] - { - ChatColor.RESET + "", - ChatColor.RESET + "Customize one of five exciting champions", - ChatColor.RESET + "and battle with the opposing team for the", - ChatColor.RESET + "control points on the map.", - ChatColor.RESET + "", - ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("DOM") + ChatColor.RESET + " other players!", - })); - - setItem(38, ItemStackFactory.Instance.CreateStack(Material.GOLD_SWORD.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Team Deathmatch " + C.cGray + "Team Game", new String[] - { - ChatColor.RESET + "", - ChatColor.RESET + "Customize one of five exciting champions", - ChatColor.RESET + "and battle with the opposing team to the", - ChatColor.RESET + "last man standing.", - ChatColor.RESET + "", - ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("TDM") + ChatColor.RESET + " other players!", - })); - - setItem(40, ItemStackFactory.Instance.CreateStack(Material.WOOD.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Master Builders " + C.cGray + "Creative Build", new String[] + C.Reset + "", + C.Reset + "Players are given a Build Theme and ", + C.Reset + "must use blocks, monsters and more", + C.Reset + "to create a masterpiece!", + C.Reset + "", + C.Reset + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("BLD") + C.Reset + " other players!", + }).setHideInfo(true).build(), new SelectBLDButton(this)); + + addButton(34, new ItemBuilder(Material.NAME_TAG).setTitle(C.cYellowB + "Type Wars " + C.cGray + "Team Deathmatch").addLore(new String[] { - ChatColor.RESET + "", - ChatColor.RESET + "Players are given a Build Theme and ", - ChatColor.RESET + "must use blocks, monsters and more", - ChatColor.RESET + "to create a masterpiece!", - ChatColor.RESET + "", - ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("BLD") + ChatColor.RESET + " other players!", - })); - - setItem(24, new ItemBuilder(Material.TNT) - .setTitle(C.Reset + C.Bold + C.cYellow + "Mine-Strike " + C.cGray + "Team Survival").addLore(new String[] - { - C.Reset + "", - C.Reset + "One team must defend two bomb sites from", - C.Reset + "the other team, who are trying to plant a bomb", - C.Reset + "and blow them up!", - C.Reset + "", - C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("MS") + C.Reset + " other players!", - }).setHideInfo(true).build()); + C.Reset + "", + C.Reset + "Attack your enemies with", + C.Reset + "waves of mobs. Defend your giant", + C.Reset + "by typing the name of an enemy mob", + C.Reset + "to kill it.", + C.Reset + "", + C.Reset + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("TW") + C.Reset + " other players!", + }).setHideInfo(true).build(), new SelectTWButton(this)); - setItem(26, new ItemBuilder(Material.BOOK_AND_QUILL) - .setTitle(C.Reset + C.Bold + C.cYellow + "Draw My Thing " + C.cGray + "Pictionary!").addLore(new String[] - { - C.Reset + "", - C.Reset + "Players take turns at drawing a random", - C.Reset + "word. Whoever guesses it within the time", - C.Reset + "limit gets some points!", - C.Reset + "", - C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("DMT") + C.Reset + " other players!", - }).setHideInfo(true).build()); + addButton(35, new ItemBuilder(Material.BOOK_AND_QUILL).setTitle(C.cYellowB + "Draw My Thing " + C.cGray + "Pictionary").addLore(new String[] + { + C.Reset + "", + C.Reset + "Players take turns at drawing a random", + C.Reset + "word. Whoever guesses it within the time", + C.Reset + "limit gets some points!", + C.Reset + "", + C.Reset + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("DMT") + C.Reset + " other players!", + }).setHideInfo(true).build(), new SelectDMTButton(this)); - setItem(36, new ItemBuilder(Material.BEACON).setTitle(C.Reset + C.Bold + C.cYellow + "Dominate " + C.cGray + "Team Game") - .addLore(new String[] - { - C.Reset + "", - C.Reset + "Customize one of five exciting champions", - C.Reset + "and battle with the opposing team for the", - C.Reset + "control points on the map.", - C.Reset + "", - C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("DOM") + C.Reset + " other players!", - }).setHideInfo(true).build()); + addButton(46, new ItemBuilder(Material.SNOW_BALL).setTitle(C.cYellowB + "Snow Fight " + C.cGray + "Team Survival").addLore(new String[] + { + (_extraValue ? C.cAquaB : C.cWhiteB) + "LIMITED TIME", + C.Reset + "", + C.Reset + "Harness the power of snow", + C.Reset + "to vanquish your enemies in", + C.Reset + "this ULTIMATE snowball fight!", + C.Reset + "", + C.Reset + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("SF") + C.Reset + " other players!", + }).setHideInfo(true).build(), new SelectFEATButton(this, "Snow Fight")); - setItem(38, new ItemBuilder(Material.GOLD_SWORD) - .setTitle(C.Reset + C.Bold + C.cYellow + "Team Deathmatch " + C.cGray + "Team Game").addLore(new String[] - { - C.Reset + "", - C.Reset + "Customize one of five exciting champions", - C.Reset + "and battle with the opposing team to the", - C.Reset + "last man standing.", - C.Reset + "", - C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("TDM") + C.Reset + " other players!", - }).setHideInfo(true).build()); + addButton(48, new ItemBuilder(Material.SKULL_ITEM, 1, (byte) 3).setTitle(C.cYellowB + "Player Servers " + C.cGray + "Player Hosted Games").addLore(new String[] + { + C.Reset + "", + C.Reset + "Join your friends in their own ", + C.Reset + "Mineplex Player Server. You can play", + C.Reset + "the games you want, when you want.", + }).setHideInfo(true).build(), new SelectPLAYERButton(this)); - setItem(40, new ItemBuilder(Material.WOOD) - .setTitle(C.Reset + C.Bold + C.cYellow + "Master Builders " + C.cGray + "Creative Build").addLore(new String[] - { - C.Reset + "", - C.Reset + "Players are given a Build Theme and ", - C.Reset + "must use blocks, monsters and more", - C.Reset + "to create a masterpiece!", - C.Reset + "", - C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("BLD") + C.Reset + " other players!", - }).setHideInfo(true).build()); + addButton(49, new ItemBuilder(Material.IRON_DOOR).setTitle(C.cYellowB + "Mineplex Clans " + C.cGray + "Champions Teams").addLore(new String[] + { + (_extraValue ? C.cAquaB : C.cWhiteB) + "ALPHA RELEASE", + C.Reset + "", + C.Reset + "Equip custom skills and builds", + C.Reset + "and join your clan to destroy", + C.Reset + "and raid others!", + C.Reset + "", + C.Reset + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("Clans") + C.Reset + " other players!", + }).setHideInfo(true).build(), new SelectCLANSButton(this)); - setItem(42, _minigameCycle.get(_minigameIndex)); + addButton(50, new ItemBuilder(Material.BREWING_STAND_ITEM).setTitle(C.cYellowB + "Monster Maze " + C.cGray + "Snow Sprint").addLore(new String[] + { + (_extraValue ? C.cAquaB : C.cWhiteB) + "BETA GAME", + C.Reset + "", + C.Reset + "Run along a maze avoiding", + C.Reset + "evil monsters. Get to the", + C.Reset + "Safe-Pad or be killed!", + C.Reset + "", + C.Reset + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("BETA") + C.Reset + " other players!", + }).setHideInfo(true).build(), new SelectBETAButton(this)); - setItem(44, new ItemBuilder(Material.SKULL_ITEM, 1, (byte) 3) - .setTitle(C.Reset + C.Bold + C.cYellow + "Player Servers " + C.cGray + "Player Hosted Games").addLore(new String[] - { - C.Reset + "", - C.Reset + "Join your friends in their own ", - C.Reset + "Mineplex Player Server. You can play", - C.Reset + "the games you want, when you want.", - C.Reset + "", - }).setHideInfo(true).build()); - - getButtonMap().put(0, new SelectBRButton(this)); - getButtonMap().put(2, new SelectSGButton(this)); - getButtonMap().put(4, new SelectSKYButton(this)); - getButtonMap().put(6, new SelectUHCButton(this)); - getButtonMap().put(8, new SelectWIZButton(this)); - - getButtonMap().put(18, new SelectCSButton(this)); - getButtonMap().put(20, new SelectBHButton(this)); - getButtonMap().put(22, new SelectSSMButton(this)); - getButtonMap().put(24, new SelectMSButton(this)); - getButtonMap().put(26, new SelectDMTButton(this)); - getButtonMap().put(36, new SelectDOMButton(this)); - getButtonMap().put(38, new SelectTDMButton(this)); - getButtonMap().put(40, new SelectBLDButton(this)); - getButtonMap().put(42, new SelectMINButton(this)); - getButtonMap().put(44, new SelectPLAYERButton(this)); - // getButtonMap().put(44, new SelectBETAButton(this)); + addButton(52, new ItemBuilder(Material.BOOKSHELF).setTitle(C.cYellowB + "Christmas Chaos " + C.cGray + "Help Save Christmas").addLore(new String[] + { + (_extraValue ? C.cAquaB : C.cWhiteB) + "LIMITED TIME", + C.Reset + "", + C.Reset + "Band together with your friends", + C.Reset + "and help Santa save Christmas from", + C.Reset + "a deadly enemy...", + C.Reset + "", + C.Reset + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("CC") + C.Reset + " other players!", + }).setHideInfo(true).build(), new SelectFEATButton(this, "Christmas Chaos")); } - @SuppressWarnings("deprecation") private void createMinigameCycle() { - int playerCount = getPlugin().getGroupTagPlayerCount("MIN") + getPlugin().getGroupTagPlayerCount("DR") - + getPlugin().getGroupTagPlayerCount("DE") + getPlugin().getGroupTagPlayerCount("PB") - + getPlugin().getGroupTagPlayerCount("TF") + getPlugin().getGroupTagPlayerCount("RUN") - + getPlugin().getGroupTagPlayerCount("SN") + getPlugin().getGroupTagPlayerCount("DT") - + getPlugin().getGroupTagPlayerCount("SQ") + getPlugin().getGroupTagPlayerCount("SA") - + getPlugin().getGroupTagPlayerCount("SS") + getPlugin().getGroupTagPlayerCount("OITQ"); + int playerCount = 0 + + getPlugin().getGroupTagPlayerCount("MIN") + + getPlugin().getGroupTagPlayerCount("DR") + + getPlugin().getGroupTagPlayerCount("DE") + + getPlugin().getGroupTagPlayerCount("PB") + + getPlugin().getGroupTagPlayerCount("TF") + + getPlugin().getGroupTagPlayerCount("RUN") + + getPlugin().getGroupTagPlayerCount("SN") + + getPlugin().getGroupTagPlayerCount("DT") + + getPlugin().getGroupTagPlayerCount("SQ") + + getPlugin().getGroupTagPlayerCount("SA") + + getPlugin().getGroupTagPlayerCount("SS") + + getPlugin().getGroupTagPlayerCount("OITQ") + + getPlugin().getGroupTagPlayerCount("BB") + + getPlugin().getGroupTagPlayerCount("MB") + + getPlugin().getGroupTagPlayerCount("EVO") + + getPlugin().getGroupTagPlayerCount("GLD") + + getPlugin().getGroupTagPlayerCount("BL"); _minigameCycle.add(new ItemBuilder(Material.SMOOTH_BRICK) .setTitle(C.Reset + C.Bold + C.cYellow + "Arcade " + C.cGray + "Mixed Games").addLore(new String[] { C.Reset + "", - C.Reset + "Play all of these fun minigames:", + C.Reset + "Play all of these fun minigames and more!", C.Reset + "", C.Reset + C.Bold + C.cGreen + "Super Spleef", C.Reset + "Runner", @@ -310,7 +316,7 @@ public class ServerGameMenu extends ShopPageBase .setTitle(C.Reset + C.Bold + C.cYellow + "Arcade " + C.cGray + "Mixed Games").addLore(new String[] { C.Reset + "", - C.Reset + "Play all of these fun minigames:", + C.Reset + "Play all of these fun minigames and more!", C.Reset + "", C.Reset + "Super Spleef", C.Reset + C.Bold + C.cGreen + "Runner", @@ -331,7 +337,7 @@ public class ServerGameMenu extends ShopPageBase .setTitle(C.Reset + C.Bold + C.cYellow + "Arcade " + C.cGray + "Mixed Games").addLore(new String[] { C.Reset + "", - C.Reset + "Play all of these fun minigames:", + C.Reset + "Play all of these fun minigames and more!", C.Reset + "", C.Reset + "Super Spleef", C.Reset + "Runner", @@ -352,7 +358,7 @@ public class ServerGameMenu extends ShopPageBase .setTitle(C.Reset + C.Bold + C.cYellow + "Arcade " + C.cGray + "Mixed Games").addLore(new String[] { C.Reset + "", - C.Reset + "Play all of these fun minigames:", + C.Reset + "Play all of these fun minigames and more!", C.Reset + "", C.Reset + "Super Spleef", C.Reset + "Runner", @@ -373,7 +379,7 @@ public class ServerGameMenu extends ShopPageBase .setTitle(C.Reset + C.Bold + C.cYellow + "Arcade " + C.cGray + "Mixed Games").addLore(new String[] { C.Reset + "", - C.Reset + "Play all of these fun minigames:", + C.Reset + "Play all of these fun minigames and more!", C.Reset + "", C.Reset + "Super Spleef", C.Reset + "Runner", @@ -394,7 +400,7 @@ public class ServerGameMenu extends ShopPageBase .setTitle(C.Reset + C.Bold + C.cYellow + "Arcade " + C.cGray + "Mixed Games").addLore(new String[] { C.Reset + "", - C.Reset + "Play all of these fun minigames:", + C.Reset + "Play all of these fun minigames and more!", C.Reset + "", C.Reset + "Super Spleef", C.Reset + "Runner", @@ -415,7 +421,7 @@ public class ServerGameMenu extends ShopPageBase .setTitle(C.Reset + C.Bold + C.cYellow + "Arcade " + C.cGray + "Mixed Games").addLore(new String[] { C.Reset + "", - C.Reset + "Play all of these fun minigames:", + C.Reset + "Play all of these fun minigames and more!", C.Reset + "", C.Reset + "Super Spleef", C.Reset + "Runner", @@ -436,7 +442,7 @@ public class ServerGameMenu extends ShopPageBase .setTitle(C.Reset + C.Bold + C.cYellow + "Arcade " + C.cGray + "Mixed Games").addLore(new String[] { C.Reset + "", - C.Reset + "Play all of these fun minigames:", + C.Reset + "Play all of these fun minigames and more!", C.Reset + "", C.Reset + "Super Spleef", C.Reset + "Runner", @@ -457,7 +463,7 @@ public class ServerGameMenu extends ShopPageBase .setTitle(C.Reset + C.Bold + C.cYellow + "Arcade " + C.cGray + "Mixed Games").addLore(new String[] { C.Reset + "", - C.Reset + "Play all of these fun minigames:", + C.Reset + "Play all of these fun minigames and more!", C.Reset + "", C.Reset + "Super Spleef", C.Reset + "Runner", @@ -478,7 +484,7 @@ public class ServerGameMenu extends ShopPageBase .setTitle(C.Reset + C.Bold + C.cYellow + "Arcade " + C.cGray + "Mixed Games").addLore(new String[] { C.Reset + "", - C.Reset + "Play all of these fun minigames:", + C.Reset + "Play all of these fun minigames and more!", C.Reset + "", C.Reset + "Super Spleef", C.Reset + "Runner", @@ -499,7 +505,7 @@ public class ServerGameMenu extends ShopPageBase .setTitle(C.Reset + C.Bold + C.cYellow + "Arcade " + C.cGray + "Mixed Games").addLore(new String[] { C.Reset + "", - C.Reset + "Play all of these fun minigames:", + C.Reset + "Play all of these fun minigames and more!", C.Reset + "", C.Reset + "Super Spleef", C.Reset + "Runner", @@ -520,26 +526,37 @@ public class ServerGameMenu extends ShopPageBase private void createSuperSmashCycle() { String[] desc = new String[] - { - C.Reset + "", - C.Reset + "Pick from a selection of monsters,", - C.Reset + "then battle other players to the ", - C.Reset + "death with your monsters skills!", - C.Reset + "", - C.Reset + "Join " + C.cGreen - + (getPlugin().getGroupTagPlayerCount("SSM") + getPlugin().getGroupTagPlayerCount("SSM2")) + C.Reset - + " other players!", - }; + { + C.Reset + "", + C.Reset + "Pick from a selection of monsters,", + C.Reset + "then battle other players to the ", + C.Reset + "death with your monsters skills!", + C.Reset + "", + C.Reset + "Join " + C.cGreen + (getPlugin().getGroupTagPlayerCount("SSM") + getPlugin().getGroupTagPlayerCount("SSM2")) + C.Reset + " other players!", + }; - _superSmashCycle.add(new ItemBuilder(Material.SKULL_ITEM, 1, (byte) 4) - .setTitle(C.Reset + C.Bold + C.cYellow + "Super Smash Mobs " + C.cGray + "Solo/Team Deathmatch").addLore(desc) - .setHideInfo(true).build()); + _superSmashCycle.add(new ItemBuilder(Material.SKULL_ITEM, 1, (byte) 0).setTitle(C.cYellowB + "Super Smash Mobs " + C.cGray + "Solo/Team Deathmatch").addLore(desc).setHideInfo(true).build()); + _superSmashCycle.add(new ItemBuilder(Material.SKULL_ITEM, 1, (byte) 1).setTitle(C.cYellowB + "Super Smash Mobs " + C.cGray + "Solo/Team Deathmatch").addLore(desc).setHideInfo(true).build()); + _superSmashCycle.add(new ItemBuilder(Material.SKULL_ITEM, 1, (byte) 2).setTitle(C.cYellowB + "Super Smash Mobs " + C.cGray + "Solo/Team Deathmatch").addLore(desc).setHideInfo(true).build()); + _superSmashCycle.add(new ItemBuilder(Material.SKULL_ITEM, 1, (byte) 3).setPlayerHead("MHF_LavaSlime").setTitle(C.cYellowB + "Super Smash Mobs " + C.cGray + "Solo/Team Deathmatch").addLore(desc).setHideInfo(true).build()); + _superSmashCycle.add(new ItemBuilder(Material.SKULL_ITEM, 1, (byte) 3).setPlayerHead("MHF_Golem").setTitle(C.cYellowB + "Super Smash Mobs " + C.cGray + "Solo/Team Deathmatch").addLore(desc).setHideInfo(true).build()); + _superSmashCycle.add(new ItemBuilder(Material.SKULL_ITEM, 1, (byte) 3).setPlayerHead("MHF_Enderman").setTitle(C.cYellowB + "Super Smash Mobs " + C.cGray + "Solo/Team Deathmatch").addLore(desc).setHideInfo(true).build()); + _superSmashCycle.add(new ItemBuilder(Material.SKULL_ITEM, 1, (byte) 3).setPlayerHead("MHF_Cow").setTitle(C.cYellowB + "Super Smash Mobs " + C.cGray + "Solo/Team Deathmatch").addLore(desc).setHideInfo(true).build()); + _superSmashCycle.add(new ItemBuilder(Material.SKULL_ITEM, 1, (byte) 3).setPlayerHead("MHF_Chicken").setTitle(C.cYellowB + "Super Smash Mobs " + C.cGray + "Solo/Team Deathmatch").addLore(desc).setHideInfo(true).build()); + _superSmashCycle.add(new ItemBuilder(Material.SKULL_ITEM, 1, (byte) 3).setPlayerHead("MHF_Blaze").setTitle(C.cYellowB + "Super Smash Mobs " + C.cGray + "Solo/Team Deathmatch").addLore(desc).setHideInfo(true).build()); + _superSmashCycle.add(new ItemBuilder(Material.SKULL_ITEM, 1, (byte) 3).setPlayerHead("MHF_Squid").setTitle(C.cYellowB + "Super Smash Mobs " + C.cGray + "Solo/Team Deathmatch").addLore(desc).setHideInfo(true).build()); + _superSmashCycle.add(new ItemBuilder(Material.SKULL_ITEM, 1, (byte) 3).setPlayerHead("MHF_Spider").setTitle(C.cYellowB + "Super Smash Mobs " + C.cGray + "Solo/Team Deathmatch").addLore(desc).setHideInfo(true).build()); + _superSmashCycle.add(new ItemBuilder(Material.SKULL_ITEM, 1, (byte) 3).setPlayerHead("MHF_Slime").setTitle(C.cYellowB + "Super Smash Mobs " + C.cGray + "Solo/Team Deathmatch").addLore(desc).setHideInfo(true).build()); + _superSmashCycle.add(new ItemBuilder(Material.SKULL_ITEM, 1, (byte) 3).setPlayerHead("MHF_Sheep").setTitle(C.cYellowB + "Super Smash Mobs " + C.cGray + "Solo/Team Deathmatch").addLore(desc).setHideInfo(true).build()); + _superSmashCycle.add(new ItemBuilder(Material.SKULL_ITEM, 1, (byte) 3).setPlayerHead("MHF_Pig").setTitle(C.cYellowB + "Super Smash Mobs " + C.cGray + "Solo/Team Deathmatch").addLore(desc).setHideInfo(true).build()); + _superSmashCycle.add(new ItemBuilder(Material.SKULL_ITEM, 1, (byte) 4).setTitle(C.cYellowB + "Super Smash Mobs " + C.cGray + "Solo/Team Deathmatch").addLore(desc).setHideInfo(true).build()); } public void Update() { _ssmIndex++; _minigameIndex++; + _extraValue = !_extraValue; if (_ssmIndex >= _superSmashCycle.size()) _ssmIndex = 0; @@ -565,6 +582,11 @@ public class ServerGameMenu extends ShopPageBase getPlugin().getDominateShop().attemptShopOpen(player); } + public void openCtf(Player player) + { + getPlugin().getCtfShop().attemptShopOpen(player); + } + public void openCS(Player player) { getPlugin().getCastleSiegeShop().attemptShopOpen(player); @@ -614,6 +636,11 @@ public class ServerGameMenu extends ShopPageBase { getPlugin().getBetaShop().attemptShopOpen(player); } + + public void openFeatured(Player player, String name) + { + getPlugin().getShop(name).attemptShopOpen(player); + } public void openUHC(Player player) { @@ -629,4 +656,14 @@ public class ServerGameMenu extends ShopPageBase { getPlugin().getPlayerGamesShop().attemptShopOpen(player); } + + public void openClans(Player player) + { + getPlugin().getClansShop().attemptShopOpen(player); + } + + public void openTypeWars(Player player) + { + getPlugin().getTypeWarsShop().attemptShopOpen(player); + } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectCLANSButton.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectCLANSButton.java new file mode 100644 index 000000000..49b4a270f --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectCLANSButton.java @@ -0,0 +1,23 @@ +package mineplex.hub.server.ui.button; + +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + +import mineplex.core.shop.item.IButton; +import mineplex.hub.server.ui.ServerGameMenu; + +public class SelectCLANSButton implements IButton +{ + private ServerGameMenu _menu; + + public SelectCLANSButton(ServerGameMenu menu) + { + _menu = menu; + } + + @Override + public void onClick(Player player, ClickType clickType) + { + _menu.openClans(player); + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectCTFButton.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectCTFButton.java new file mode 100644 index 000000000..78633dffc --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectCTFButton.java @@ -0,0 +1,23 @@ +package mineplex.hub.server.ui.button; + +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + +import mineplex.core.shop.item.IButton; +import mineplex.hub.server.ui.ServerGameMenu; + +public class SelectCTFButton implements IButton +{ + private ServerGameMenu _menu; + + public SelectCTFButton(ServerGameMenu menu) + { + _menu = menu; + } + + @Override + public void onClick(Player player, ClickType clickType) + { + _menu.openCtf(player); + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectFEATButton.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectFEATButton.java new file mode 100644 index 000000000..2174481bb --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectFEATButton.java @@ -0,0 +1,25 @@ +package mineplex.hub.server.ui.button; + +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + +import mineplex.core.shop.item.IButton; +import mineplex.hub.server.ui.ServerGameMenu; + +public class SelectFEATButton implements IButton +{ + private ServerGameMenu _menu; + private String _name; + + public SelectFEATButton(ServerGameMenu menu, String name) + { + _menu = menu; + _name = name; + } + + @Override + public void onClick(Player player, ClickType clickType) + { + _menu.openFeatured(player, _name); + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectTWButton.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectTWButton.java new file mode 100644 index 000000000..daecaad39 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/button/SelectTWButton.java @@ -0,0 +1,23 @@ +package mineplex.hub.server.ui.button; + +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + +import mineplex.core.shop.item.IButton; +import mineplex.hub.server.ui.ServerGameMenu; + +public class SelectTWButton implements IButton +{ + private ServerGameMenu _menu; + + public SelectTWButton(ServerGameMenu menu) + { + _menu = menu; + } + + @Override + public void onClick(Player player, ClickType clickType) + { + _menu.openTypeWars(player); + } +} diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/password/PasswordRepository.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/password/PasswordRepository.java index f0cf867d4..33b63e8a5 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/password/PasswordRepository.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/password/PasswordRepository.java @@ -24,7 +24,7 @@ public class PasswordRepository extends RepositoryBase public PasswordRepository(JavaPlugin plugin, String serverName) { - super(plugin, DBPool.ACCOUNT); + super(plugin, DBPool.getAccount()); _serverName = serverName; } From f4050fb1ff54dbe4639b0258eff53360d800d0b9 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Mon, 21 Dec 2015 04:35:57 -0500 Subject: [PATCH 102/113] Adjust GUI, fix beta button --- .../mineplex/hub/server/ServerManager.java | 2 +- .../hub/server/ui/ServerGameMenu.java | 159 +++++++++--------- 2 files changed, 81 insertions(+), 80 deletions(-) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java index 12fa009d3..a80aa4503 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java @@ -811,7 +811,7 @@ public class ServerManager extends MiniPlugin public ServerNpcShop getBetaShop() { - return _serverNpcShopMap.get("Beta Games"); + return _serverNpcShopMap.get("Beta Monster Maze"); } public ServerNpcShop getUHCShop() diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java index 4e61341f8..3a062a401 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java @@ -48,7 +48,7 @@ public class ServerGameMenu extends ShopPageBase public ServerGameMenu(ServerManager plugin, QuickShop quickShop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) { - super(plugin, quickShop, clientManager, donationManager, name, player, 47); + super(plugin, quickShop, clientManager, donationManager, name, player, 45); createSuperSmashCycle(); createMinigameCycle(); @@ -59,9 +59,21 @@ public class ServerGameMenu extends ShopPageBase @Override protected void buildPage() { - addButton(13, new ItemBuilder(Material.IRON_SWORD).setTitle(C.cYellowB + "Gladiators" + C.cGray + " Bracketted Deathmatch").addLore(new String[] + addButton(3, new ItemBuilder(Material.NAME_TAG).setTitle(C.cYellowB + "Type Wars " + C.cGray + "Team Deathmatch").addLore(new String[] { - (_extraValue ? C.cAquaB : C.cWhiteB) + "FEATURED GAME " + C.cGray + "Arcade", + (_extraValue ? C.cAquaB : C.cWhiteB) + "NEW GAME", + C.Reset + "", + C.Reset + "Attack your enemies with", + C.Reset + "waves of mobs. Defend your giant", + C.Reset + "by typing the name of an enemy mob", + C.Reset + "to kill it.", + C.Reset + "", + C.Reset + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("TW") + C.Reset + " other players!", + }).setHideInfo(true).build(), new SelectTWButton(this)); + + addButton(5, new ItemBuilder(Material.IRON_SWORD).setTitle(C.cYellowB + "Gladiators" + C.cGray + " Bracketted Deathmatch").addLore(new String[] + { + (_extraValue ? C.cAquaB : C.cWhiteB) + "FEATURED ARCADE GAME", C.Reset + "", C.Reset + "A 1v1 tournament.", C.Reset + "Kill your enemy and then", @@ -70,7 +82,7 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("GLD") + C.Reset + " other players!" }).setHideInfo(true).build(), new SelectFEATButton(this, "Gladiators")); - addButton(18, new ItemBuilder(Material.IRON_PICKAXE).setTitle(C.cYellowB + "The Bridges " + C.cGray + "4 Team Survival").addLore(new String[] + addButton(9, new ItemBuilder(Material.IRON_PICKAXE).setTitle(C.cYellowB + "The Bridges " + C.cGray + "4 Team Survival").addLore(new String[] { C.Reset + "", C.Reset + "4 Teams get 10 minutes to prepare.", @@ -81,7 +93,7 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("BR") + C.Reset + " other players!" }).setHideInfo(true).build(), new SelectBRButton(this)); - addButton(19, new ItemBuilder(Material.DIAMOND_SWORD).setTitle(C.cYellowB + "Survival Games " + C.cGray + "Solo/Team Survival").addLore(new String[] + addButton(11, new ItemBuilder(Material.DIAMOND_SWORD).setTitle(C.cYellowB + "Survival Games " + C.cGray + "Solo/Team Survival").addLore(new String[] { C.Reset + "", C.Reset + "Search for chests to find loot and ", @@ -91,7 +103,7 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Join " + C.cGreen + (getPlugin().getGroupTagPlayerCount("HG") + getPlugin().getGroupTagPlayerCount("SG2")) + C.Reset + " other players!" }).setHideInfo(true).build(), new SelectSGButton(this)); - addButton(20, new ItemBuilder(Material.FEATHER).setTitle(C.cYellowB + "Skywars " + C.cGray + "Solo/Team Survival").addLore(new String[] + addButton(13, new ItemBuilder(Material.FEATHER).setTitle(C.cYellowB + "Skywars " + C.cGray + "Solo/Team Survival").addLore(new String[] { C.Reset + "", C.Reset + "16 contenders fight to rule the skies!", @@ -103,7 +115,7 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Join " + C.cGreen + (getPlugin().getGroupTagPlayerCount("SKY") + getPlugin().getGroupTagPlayerCount("SKY2")) + C.Reset + " other players!", }).setHideInfo(true).build(), new SelectSKYButton(this)); - addButton(21, new ItemBuilder(Material.GOLDEN_APPLE).setTitle(C.cYellowB + "UHC " + C.cGray + "Ultra Hardcore Mode").addLore(new String[] + addButton(15, new ItemBuilder(Material.GOLDEN_APPLE).setTitle(C.cYellowB + "UHC " + C.cGray + "Ultra Hardcore Mode").addLore(new String[] { C.Reset + "", C.Reset + "Extremely hard team-based survival ", @@ -113,47 +125,7 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("UHC") + C.Reset + " other players!", }).setHideInfo(true).build(), new SelectUHCButton(this)); - addButton(23, new ItemBuilder(Material.TNT).setTitle(C.cYellowB + "MineStrike " + C.cGray + "Team Survival").addLore(new String[] - { - C.Reset + "", - C.Reset + "One team must defend two bomb sites from", - C.Reset + "the other team, who are trying to plant a bomb", - C.Reset + "and blow them up!", - C.Reset + "", - C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("MS") + C.Reset + " other players!", - }).setHideInfo(true).build(), new SelectMSButton(this)); - - addButton(24, new ItemBuilder(Material.BANNER).setColor(Color.RED).setTitle(C.cYellowB + "Capture the Flag " + C.cGray + "Team Game").addLore(new String[] - { - C.Reset + "", - C.Reset + "One team must steal the other", - C.Reset + "team's flag. Capture it", - C.Reset + "three times to win.", - C.Reset + "", - C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("CTF") + C.Reset + " other players!", - }).setHideInfo(true).build(), new SelectCTFButton(this)); - - addButton(25, new ItemBuilder(Material.BEACON).setTitle(C.cYellowB + "Dominate " + C.cGray + "Team Game").addLore(new String[] - { - C.Reset + "", - C.Reset + "Customize one of five exciting champions", - C.Reset + "and battle with the opposing team for the", - C.Reset + "control points on the map.", - C.Reset + "", - C.Reset + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("DOM") + C.Reset + " other players!", - }).setHideInfo(true).build(), new SelectDOMButton(this)); - - addButton(26, new ItemBuilder(Material.GOLD_SWORD).setTitle(C.cYellowB + "Team Deathmatch " + C.cGray + "Team Game").addLore(new String[] - { - C.Reset + "", - C.Reset + "Customize one of five exciting champions", - C.Reset + "and battle with the opposing team to the", - C.Reset + "last man standing.", - C.Reset + "", - C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("TDM") + C.Reset + " other players!", - }).setHideInfo(true).build(), new SelectTDMButton(this)); - - addButton(27, new ItemBuilder(Material.BLAZE_ROD).setTitle(C.cYellowB + "Wizards " + C.cGray + "Last Man Standing").addLore(new String[] + addButton(17, new ItemBuilder(Material.BLAZE_ROD).setTitle(C.cYellowB + "Wizards " + C.cGray + "Last Man Standing").addLore(new String[] { C.Reset + "", C.Reset + "Wield powerful spells to fight", @@ -163,7 +135,37 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("WIZ") + C.Reset + " other players!", }).setHideInfo(true).build(), new SelectWIZButton(this)); - addButton(28, new ItemBuilder(Material.DIAMOND_CHESTPLATE).setTitle(C.cYellowB + "Castle Siege " + C.cGray + "Team Game").addLore(new String[] + addButton(18, new ItemBuilder(Material.BANNER).setColor(Color.RED).setTitle(C.cYellowB + "Capture the Flag " + C.cGray + "Team Game").addLore(new String[] + { + C.Reset + "", + C.Reset + "One team must steal the other", + C.Reset + "team's flag. Capture it", + C.Reset + "three times to win.", + C.Reset + "", + C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("CTF") + C.Reset + " other players!", + }).setHideInfo(true).build(), new SelectCTFButton(this)); + + addButton(20, new ItemBuilder(Material.BEACON).setTitle(C.cYellowB + "Dominate " + C.cGray + "Team Game").addLore(new String[] + { + C.Reset + "", + C.Reset + "Customize one of five exciting champions", + C.Reset + "and battle with the opposing team for the", + C.Reset + "control points on the map.", + C.Reset + "", + C.Reset + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("DOM") + C.Reset + " other players!", + }).setHideInfo(true).build(), new SelectDOMButton(this)); + + addButton(22, new ItemBuilder(Material.GOLD_SWORD).setTitle(C.cYellowB + "Team Deathmatch " + C.cGray + "Team Game").addLore(new String[] + { + C.Reset + "", + C.Reset + "Customize one of five exciting champions", + C.Reset + "and battle with the opposing team to the", + C.Reset + "last man standing.", + C.Reset + "", + C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("TDM") + C.Reset + " other players!", + }).setHideInfo(true).build(), new SelectTDMButton(this)); + + addButton(24, new ItemBuilder(Material.DIAMOND_CHESTPLATE).setTitle(C.cYellowB + "Castle Siege " + C.cGray + "Team Game").addLore(new String[] { C.Reset + "", C.Reset + "Defenders must protect King Sparklez", @@ -173,7 +175,7 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("CS") + C.Reset + " other players!", }).setHideInfo(true).build(), new SelectCSButton(this)); - addButton(29, new ItemBuilder(Material.GRASS).setTitle(C.cYellowB + "Block Hunt " + C.cGray + "Cat and Mouse").addLore(new String[] + addButton(26, new ItemBuilder(Material.GRASS).setTitle(C.cYellowB + "Block Hunt " + C.cGray + "Cat and Mouse").addLore(new String[] { C.Reset + "", C.Reset + "Hide as blocks/animals, upgrade your ", @@ -183,33 +185,18 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("BH") + C.Reset + " other players!", }).setHideInfo(true).build(), new SelectBHButton(this)); - addButton(30, _superSmashCycle.get(_ssmIndex), new SelectSSMButton(this)); - - addButton(32, _minigameCycle.get(_minigameIndex), new SelectMINButton(this)); - - addButton(33, new ItemBuilder(Material.WOOD).setTitle(C.cYellowB + "Master Builders " + C.cGray + "Creative Build").setLore(new String[] - { + addButton(27, new ItemBuilder(Material.TNT).setTitle(C.cYellowB + "MineStrike " + C.cGray + "Team Survival").addLore(new String[] + { C.Reset + "", - C.Reset + "Players are given a Build Theme and ", - C.Reset + "must use blocks, monsters and more", - C.Reset + "to create a masterpiece!", + C.Reset + "One team must defend two bomb sites from", + C.Reset + "the other team, who are trying to plant a bomb", + C.Reset + "and blow them up!", C.Reset + "", - C.Reset + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("BLD") + C.Reset + " other players!", - }).setHideInfo(true).build(), new SelectBLDButton(this)); + C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("MS") + C.Reset + " other players!", + }).setHideInfo(true).build(), new SelectMSButton(this)); - addButton(34, new ItemBuilder(Material.NAME_TAG).setTitle(C.cYellowB + "Type Wars " + C.cGray + "Team Deathmatch").addLore(new String[] - { - C.Reset + "", - C.Reset + "Attack your enemies with", - C.Reset + "waves of mobs. Defend your giant", - C.Reset + "by typing the name of an enemy mob", - C.Reset + "to kill it.", - C.Reset + "", - C.Reset + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("TW") + C.Reset + " other players!", - }).setHideInfo(true).build(), new SelectTWButton(this)); - - addButton(35, new ItemBuilder(Material.BOOK_AND_QUILL).setTitle(C.cYellowB + "Draw My Thing " + C.cGray + "Pictionary").addLore(new String[] - { + addButton(29, new ItemBuilder(Material.BOOK_AND_QUILL).setTitle(C.cYellowB + "Draw My Thing " + C.cGray + "Pictionary").addLore(new String[] + { C.Reset + "", C.Reset + "Players take turns at drawing a random", C.Reset + "word. Whoever guesses it within the time", @@ -218,7 +205,21 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("DMT") + C.Reset + " other players!", }).setHideInfo(true).build(), new SelectDMTButton(this)); - addButton(46, new ItemBuilder(Material.SNOW_BALL).setTitle(C.cYellowB + "Snow Fight " + C.cGray + "Team Survival").addLore(new String[] + addButton(31, _superSmashCycle.get(_ssmIndex), new SelectSSMButton(this)); + + addButton(33, _minigameCycle.get(_minigameIndex), new SelectMINButton(this)); + + addButton(35, new ItemBuilder(Material.WOOD).setTitle(C.cYellowB + "Master Builders " + C.cGray + "Creative Build").setLore(new String[] + { + C.Reset + "", + C.Reset + "Players are given a Build Theme and ", + C.Reset + "must use blocks, monsters and more", + C.Reset + "to create a masterpiece!", + C.Reset + "", + C.Reset + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("BLD") + C.Reset + " other players!", + }).setHideInfo(true).build(), new SelectBLDButton(this)); + + addButton(37, new ItemBuilder(Material.SNOW_BALL).setTitle(C.cYellowB + "Snow Fight " + C.cGray + "Team Survival").addLore(new String[] { (_extraValue ? C.cAquaB : C.cWhiteB) + "LIMITED TIME", C.Reset + "", @@ -229,7 +230,7 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("SF") + C.Reset + " other players!", }).setHideInfo(true).build(), new SelectFEATButton(this, "Snow Fight")); - addButton(48, new ItemBuilder(Material.SKULL_ITEM, 1, (byte) 3).setTitle(C.cYellowB + "Player Servers " + C.cGray + "Player Hosted Games").addLore(new String[] + addButton(39, new ItemBuilder(Material.SKULL_ITEM, 1, (byte) 3).setTitle(C.cYellowB + "Player Servers " + C.cGray + "Player Hosted Games").addLore(new String[] { C.Reset + "", C.Reset + "Join your friends in their own ", @@ -237,7 +238,7 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "the games you want, when you want.", }).setHideInfo(true).build(), new SelectPLAYERButton(this)); - addButton(49, new ItemBuilder(Material.IRON_DOOR).setTitle(C.cYellowB + "Mineplex Clans " + C.cGray + "Champions Teams").addLore(new String[] + addButton(40, new ItemBuilder(Material.IRON_DOOR).setTitle(C.cYellowB + "Mineplex Clans " + C.cGray + "Champions Teams").addLore(new String[] { (_extraValue ? C.cAquaB : C.cWhiteB) + "ALPHA RELEASE", C.Reset + "", @@ -248,7 +249,7 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("Clans") + C.Reset + " other players!", }).setHideInfo(true).build(), new SelectCLANSButton(this)); - addButton(50, new ItemBuilder(Material.BREWING_STAND_ITEM).setTitle(C.cYellowB + "Monster Maze " + C.cGray + "Snow Sprint").addLore(new String[] + addButton(41, new ItemBuilder(Material.BREWING_STAND_ITEM).setTitle(C.cYellowB + "Monster Maze " + C.cGray + "Snow Sprint").addLore(new String[] { (_extraValue ? C.cAquaB : C.cWhiteB) + "BETA GAME", C.Reset + "", @@ -259,7 +260,7 @@ public class ServerGameMenu extends ShopPageBase C.Reset + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("BETA") + C.Reset + " other players!", }).setHideInfo(true).build(), new SelectBETAButton(this)); - addButton(52, new ItemBuilder(Material.BOOKSHELF).setTitle(C.cYellowB + "Christmas Chaos " + C.cGray + "Help Save Christmas").addLore(new String[] + addButton(43, new ItemBuilder(Material.BOOKSHELF).setTitle(C.cYellowB + "Christmas Chaos " + C.cGray + "Help Save Christmas").addLore(new String[] { (_extraValue ? C.cAquaB : C.cWhiteB) + "LIMITED TIME", C.Reset + "", From fae2a5d2bfa3413f44c05dd147a5b26b7892f0b2 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Mon, 21 Dec 2015 04:40:30 -0500 Subject: [PATCH 103/113] Update game display --- .../Mineplex.Core/src/mineplex/core/game/GameDisplay.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java index ba6beef4b..31d6434d6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java @@ -68,8 +68,9 @@ public enum GameDisplay Lobbers("Bomb Lobbers", Material.FIREBALL, (byte) 0, GameCategory.ARCADE, 54), ChampionsCTF("Champions CTF", "Champions", Material.BANNER, DyeColor.RED.getDyeData(), GameCategory.CHAMPIONS, 56), - BouncyBalls("Bouncy Balls", Material.SLIME_BALL, (byte)0, GameCategory.ARCADE, 57), Gladiators("Gladiators", Material.IRON_SWORD, (byte)0, GameCategory.ARCADE, 58), -TypeWars("Type Wars", Material.BOOK_AND_QUILL, (byte) 0, GameCategory.ARCADE, 59), + BouncyBalls("Bouncy Balls", Material.SLIME_BALL, (byte)0, GameCategory.ARCADE, 57), + Gladiators("Gladiators", Material.IRON_SWORD, (byte)0, GameCategory.ARCADE, 58), + TypeWars("Type Wars", Material.NAME_TAG, (byte) 0, GameCategory.ARCADE, 59), Event("Mineplex Event", Material.CAKE, (byte)0, GameCategory.EVENT, 999); From 5469289d82b80c3b3c377e6095b78ecca6ae76f4 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Mon, 21 Dec 2015 06:57:56 -0500 Subject: [PATCH 104/113] Wrong iterator! --- .../src/nautilus/game/arcade/game/games/typewars/TypeWars.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index d1379f1b5..d7fa332ac 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -1279,7 +1279,7 @@ public class TypeWars extends TeamGame minion.despawn(player, true); if(!minion.hasLives()) { - minionIterator.remove(); + finishedMinionIterator.remove(); _deadMinions.add(minion); } } From ff5761cc1d9a179bef334d0e68d54b63818c5097 Mon Sep 17 00:00:00 2001 From: Sarah Date: Mon, 21 Dec 2015 17:44:15 +0100 Subject: [PATCH 105/113] Fixing ending Stats. --- .../src/nautilus/game/arcade/game/games/typewars/Minion.java | 2 +- .../src/nautilus/game/arcade/game/games/typewars/TypeWars.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java index 45494c974..b4c4832cf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java @@ -571,7 +571,7 @@ public class Minion public Player getKiller() { - return _player; + return _killer; } public Player getPlayer() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java index d1379f1b5..fb72ba85d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/TypeWars.java @@ -1319,6 +1319,9 @@ public class TypeWars extends TeamGame int spawns = 0; for(Minion minion : _deadMinions) { + if(minion.getType().getSize() != size) + continue; + if(minion.getPlayer() == null) continue; From 082b5e156c922b13c770faf7ebb91bfe69bd5159 Mon Sep 17 00:00:00 2001 From: Sarah Date: Mon, 21 Dec 2015 17:48:17 +0100 Subject: [PATCH 106/113] fixing Kit NPEs --- .../game/arcade/game/games/typewars/kits/KitTypeWarsBase.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTypeWarsBase.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTypeWarsBase.java index f71c2cf8f..3e813d0f9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTypeWarsBase.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/kits/KitTypeWarsBase.java @@ -66,6 +66,9 @@ public abstract class KitTypeWarsBase extends Kit if(!Manager.GetGame().IsLive()) return; + if(!Manager.GetGame().IsPlaying(event.getPlayer())) + return; + if(event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK) return; From f15c318e5cbd7c29285561fe1cf10e4df0165430 Mon Sep 17 00:00:00 2001 From: Sarah Date: Mon, 21 Dec 2015 18:02:25 +0100 Subject: [PATCH 107/113] adding PM message. --- .../src/mineplex/core/message/MessageManager.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java b/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java index 6c2f331f6..59dc27148 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java @@ -219,11 +219,16 @@ public class MessageManager extends MiniClientPlugin Get(from).LastToTime = System.currentTimeMillis(); // Chiss or defek7 - if (to.getName().equals("Chiss") || to.getName().equals("defek7") || to.getName().equals("Phinary") || to.getName().equals("xXVevzZXx") || to.getName().equals("fooify") || to.getName().equals("sampepere")) + if (to.getName().equals("Chiss") || to.getName().equals("defek7") || to.getName().equals("Phinary") || to.getName().equals("fooify") || to.getName().equals("sampepere")) { UtilPlayer.message(from, C.cPurple + to.getName() + " is often AFK or minimized, due to plugin development."); UtilPlayer.message(from, C.cPurple + "Please be patient if he does not reply instantly."); } + if (to.getName().equals("xXVevzZXx")) + { + UtilPlayer.message(from, C.cPurple + to.getName() + " is often AFK or minimized, due to plugin development."); + UtilPlayer.message(from, C.cPurple + "Please be patient if she does not reply instantly."); + } /*if(to.getName().equals("ishh")) { From 6e3274ff2f0098f2402844373d79edc074a0dc19 Mon Sep 17 00:00:00 2001 From: Sarah Date: Mon, 21 Dec 2015 18:06:00 +0100 Subject: [PATCH 108/113] changing Category --- .../src/mineplex/core/achievement/AchievementCategory.java | 2 ++ Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java index 9202f38b6..6f36451bb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java @@ -158,6 +158,8 @@ public enum AchievementCategory TYPE_WARS("Type Wars", null, new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, new StatDisplay("Minions killed", "MinionKills"), new StatDisplay("Words Per Minute", false, true, "MinionKills", "TimeInGame"), StatDisplay.GEMS_EARNED}, Material.FEATHER, 0, GameCategory.ARCADE, null); + + private String _name; private String[] _statsToPull; private StatDisplay[] _statDisplays; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java index ba6beef4b..9e042cb5e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java @@ -69,7 +69,7 @@ public enum GameDisplay Lobbers("Bomb Lobbers", Material.FIREBALL, (byte) 0, GameCategory.ARCADE, 54), ChampionsCTF("Champions CTF", "Champions", Material.BANNER, DyeColor.RED.getDyeData(), GameCategory.CHAMPIONS, 56), BouncyBalls("Bouncy Balls", Material.SLIME_BALL, (byte)0, GameCategory.ARCADE, 57), Gladiators("Gladiators", Material.IRON_SWORD, (byte)0, GameCategory.ARCADE, 58), -TypeWars("Type Wars", Material.BOOK_AND_QUILL, (byte) 0, GameCategory.ARCADE, 59), + TypeWars("Type Wars", Material.BOOK_AND_QUILL, (byte) 0, GameCategory.CLASSICS, 59), Event("Mineplex Event", Material.CAKE, (byte)0, GameCategory.EVENT, 999); From 010b1b0a5d77b9362919c82a94bd54d914cab4d1 Mon Sep 17 00:00:00 2001 From: Sarah Date: Mon, 21 Dec 2015 18:08:11 +0100 Subject: [PATCH 109/113] Achievements.... --- .../src/mineplex/core/achievement/AchievementCategory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java index 6f36451bb..8ad7ab273 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java @@ -157,7 +157,7 @@ public enum AchievementCategory TYPE_WARS("Type Wars", null, new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, new StatDisplay("Minions killed", "MinionKills"), new StatDisplay("Words Per Minute", false, true, "MinionKills", "TimeInGame"), StatDisplay.GEMS_EARNED}, - Material.FEATHER, 0, GameCategory.ARCADE, null); + Material.FEATHER, 0, GameCategory.CLASSICS, null); private String _name; From 7c66bdbbde3ba7f0ede3b9298bf4fabd15e52ee8 Mon Sep 17 00:00:00 2001 From: Sarah Date: Mon, 21 Dec 2015 18:25:44 +0100 Subject: [PATCH 110/113] Updating Stats GUI --- .../mineplex/core/achievement/ui/page/AchievementMainPage.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/page/AchievementMainPage.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/page/AchievementMainPage.java index 7056d8b8e..40ec84525 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/page/AchievementMainPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/page/AchievementMainPage.java @@ -49,7 +49,7 @@ public class AchievementMainPage extends ShopPageBase Date: Mon, 21 Dec 2015 18:45:26 +0100 Subject: [PATCH 111/113] Updating Holiday Achievements --- .../src/mineplex/core/achievement/Achievement.java | 7 +++++++ .../src/mineplex/core/achievement/AchievementCategory.java | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java index a38435696..d7e71c18e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java @@ -23,6 +23,13 @@ public enum Achievement new int[]{200}, AchievementCategory.HOLIDAY), + GLOBAL_PRESENT_HOARDER_2015("2015 Present Hoarder", 4000, + new String[]{"Global.Christmas Presents 2015"}, + new String[]{"Open 200 Christmas Presents,", + "during Christmas 2015!"}, + new int[]{200}, + AchievementCategory.HOLIDAY), + //Bridges BRIDGES_WINS("Bridge Champion", 600, new String[]{"The Bridges.Wins"}, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java index 8ad7ab273..5b6a7bee5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java @@ -23,7 +23,7 @@ public enum AchievementCategory HOLIDAY("Holiday Achievements", null, new StatDisplay[] {}, - Material.PUMPKIN_PIE, 0, GameCategory.HOLIDAY, "None"), + Material.CAKE, 0, GameCategory.HOLIDAY, "None"), BRIDGES("The Bridges", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, From 7a72762c78ff56b3390fef809e3f57f51e755d14 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Mon, 21 Dec 2015 12:56:37 -0500 Subject: [PATCH 112/113] Update MOTD --- .../src/mineplex/bungee/motd/MotdManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java index 1f2835f13..daeb8bae3 100644 --- a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java +++ b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java @@ -56,7 +56,7 @@ public class MotdManager implements Listener, Runnable //String motdLine = "§f§l◄ §c§lMaintenance§f§l ►"; //String motdLine = "§f§l◄ §a§lCarl the Creeper§f§l ►"; // String motdLine = " §2§l§n M O N S T E R M A Z E B E T A §f"; - String motdLine = " §f❄ §2§lWinter Update §f❄ §2§lSnow Fight §f❄"; + String motdLine = " §f❄ §2§lNew Game §f❄ §2§lType Wars §f❄"; //String motdLine = " §d§lRank Sale §a§l40% Off"); //String motdLine = " §f§l◄§c§lMAINTENANCE§f§l►"); From 2ccd7a5de01011ab938edb92af535b9577eb8948 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Mon, 21 Dec 2015 13:20:04 -0500 Subject: [PATCH 113/113] Fix Type Wars stat icon --- .../src/mineplex/core/achievement/AchievementCategory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java index 5b6a7bee5..4a12d45cb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java @@ -157,7 +157,7 @@ public enum AchievementCategory TYPE_WARS("Type Wars", null, new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, new StatDisplay("Minions killed", "MinionKills"), new StatDisplay("Words Per Minute", false, true, "MinionKills", "TimeInGame"), StatDisplay.GEMS_EARNED}, - Material.FEATHER, 0, GameCategory.CLASSICS, null); + Material.NAME_TAG, 0, GameCategory.CLASSICS, null); private String _name;