Added more achievements

This commit is contained in:
Jeremiah Bishop 2015-06-24 22:59:28 -04:00
parent cd10a2ad79
commit ed667fedee
8 changed files with 170 additions and 37 deletions

View File

@ -324,9 +324,27 @@ public enum Achievement
SKYWARS_ZOMBIE_KILLS("Left For Dead",1000,
new String[]{"SkyWars.ZombieKills"},
new String[]{"Kill 500 Zombies"},
new int[]{500},
AchievementCategory.SKYWARS),
new String[]{"Kill 100 Zombie Guardians"},
new int[]{100},
AchievementCategory.SKYWARS),
SKYWARS_PLAYER_KILLS("War Machine",500,
new String[]{"SkyWars.Kills"},
new String[]{"Kill a total of 250 players"},
new int[]{250},
AchievementCategory.SKYWARS),
SKYWARS_NOCHEST("Survivalist",500,
new String[] {"SkyWars.NoChest"},
new String[] {"Win a game without opening any chests"},
new int[] {1},
AchievementCategory.SKYWARS),
SKYWARS_NOARMOR("Bare Minimum",750,
new String[] {"SkyWars.NoArmor"},
new String[] {"Win a game without wearing any armor"},
new int[] {1},
AchievementCategory.SKYWARS),
//Sheep Quest
SHEEP_QUEST_WINS("Hungry Hungry Hippo", 600,

View File

@ -44,9 +44,9 @@ public class AchievementMainPage extends ShopPageBase<AchievementManager, Achiev
"XXXXOXXXX",
"XOXOXOXOX",
"XOXOXOXOX",
"XOXOXOXOX").getItemSlots();
"OXOXOXOXO").getItemSlots();
int listSlot = 0;
for (AchievementCategory category : AchievementCategory.values())
{
if (category.getGameCategory() == AchievementCategory.GameCategory.ARCADE)

View File

@ -2,7 +2,6 @@ package nautilus.game.arcade.game.games.skywars;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import mineplex.core.common.util.C;
import mineplex.core.common.util.MapUtil;
@ -10,6 +9,7 @@ import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
@ -28,14 +28,18 @@ import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.games.skywars.data.TNTGenerator;
import nautilus.game.arcade.game.games.skywars.events.PlayerKillZombieEvent;
import nautilus.game.arcade.game.games.skywars.events.PlayerOpenChestEvent;
import nautilus.game.arcade.game.games.skywars.events.TNTKillEvent;
import nautilus.game.arcade.game.games.skywars.events.TNTPickupEvent;
import nautilus.game.arcade.game.games.skywars.kits.KitChicken;
import nautilus.game.arcade.game.games.skywars.kits.KitZoo;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.KillsStatTracker;
import nautilus.game.arcade.stats.SkyWarsKillZombieStatTracker;
import nautilus.game.arcade.stats.SkyWarsTNTKillStatTracker;
import nautilus.game.arcade.stats.SkyWarsTNTStatTracker;
import nautilus.game.arcade.stats.WinWithoutOpeningChestStatTracker;
import nautilus.game.arcade.stats.WinWithoutWearingArmorStatTracker;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -99,7 +103,7 @@ public class SkyWars extends SoloGame
this.GameTimeout = 1500000L;
this.QuitDropItems = true;
this.WorldTimeSet = 0;
this.WorldBoundaryKill = false;
@ -141,7 +145,10 @@ public class SkyWars extends SoloGame
registerStatTrackers(
new SkyWarsTNTStatTracker(this),
new SkyWarsTNTKillStatTracker(this),
new SkyWarsKillZombieStatTracker(this));
new SkyWarsKillZombieStatTracker(this),
new WinWithoutWearingArmorStatTracker(this),
new WinWithoutOpeningChestStatTracker(this),
new KillsStatTracker(this));
}
@ -168,16 +175,7 @@ public class SkyWars extends SoloGame
{
this._tnt = new TNTGenerator(this, loc);
}
Iterator<Creature> mobIterator = this._mobs.iterator();
while (mobIterator.hasNext())
{
Creature mob = (Creature) mobIterator.next();
if (!mob.isValid())
{
mob.remove();
mobIterator.remove();
}
}
for (Location loc : this.WorldData.GetDataLocs("RED"))
{
if (this._mobs.size() < 15)
@ -188,18 +186,22 @@ public class SkyWars extends SoloGame
zombie.setRemoveWhenFarAway(false);
zombie.setCustomName(C.cDRed + "Zombie Guardian");
zombie.setCustomNameVisible(true);
zombie.setMaxHealth(25.0D);
zombie.setMaxHealth(20.0D);
UtilEnt.ghost(zombie, true, false);
// Armor - Make sure the player can't get it!
zombie.getEquipment().setHelmet(
new ItemStack(Material.GOLD_HELMET));
zombie.getEquipment().setHelmetDropChance(0F);
zombie.getEquipment().setChestplate(
new ItemStack(Material.GOLD_CHESTPLATE));
zombie.getEquipment().setChestplateDropChance(0F);
zombie.getEquipment().setLeggings(
new ItemStack(Material.GOLD_LEGGINGS));
zombie.getEquipment().setLeggingsDropChance(0F);
zombie.getEquipment().setBoots(
new ItemStack(Material.GOLD_BOOTS));
zombie.getEquipment().setBootsDropChance(0F);
@ -211,13 +213,12 @@ public class SkyWars extends SoloGame
// Store which chests are closest to which spawn
NautHashMap<Location, ArrayList<Location>> islandChests = new NautHashMap<Location, ArrayList<Location>>();
// Allocate chests to their nearest spawn point
for (Location chestLoc : WorldData.GetDataLocs("BROWN"))
{
// Gets the spawn point closest to the current chest
Location closestSpawn = UtilAlg.findClosest(chestLoc,
GetTeam(ChatColor.GREEN).GetSpawns());
@ -237,7 +238,7 @@ public class SkyWars extends SoloGame
{
Location chest = UtilAlg.Random(chests);
chests.remove(chest);
}
}
}
for (Location loc : chests)
@ -379,6 +380,9 @@ public class SkyWars extends SoloGame
{
fillChest(event.getPlayer(), block);
}
Bukkit.getPluginManager().callEvent(new PlayerOpenChestEvent(event.getPlayer()));
}
@EventHandler
@ -459,7 +463,6 @@ public class SkyWars extends SoloGame
this._tnt.Update();
}
@EventHandler
public void noZombieBurn(EntityCombustEvent e)
{
@ -497,15 +500,14 @@ public class SkyWars extends SoloGame
event.setCancelled(true);
}
@EventHandler
public void onBlockPlaceAdd(BlockPlaceEvent e) {
public void onBlockPlaceAdd(BlockPlaceEvent e)
{
Block block = e.getBlock();
_worldBlocks.add(block);
}
@EventHandler
public void PlayerKillAward(CombatDeathEvent event)
{

View File

@ -114,9 +114,9 @@ public class TNTGenerator
Material.TNT,
(byte) 0,
1,
F.item(C.cYellow + C.Bold + "Left Click - Far "
F.item(C.cYellow + C.Bold + "Left Click -"+C.cRed+" Far "
+ C.cWhite + "/" + C.cYellow + C.Bold
+ " Right Click - Short")));
+ " Right Click - "+C.cRed+"Short")));
player.playSound(player.getLocation(), Sound.ENDERDRAGON_HIT, 3F, 1F);

View File

@ -0,0 +1,36 @@
package nautilus.game.arcade.game.games.skywars.events;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class PlayerOpenChestEvent extends Event
{
private static final HandlerList handlers = new HandlerList();
private Player _who;
public PlayerOpenChestEvent(Player who)
{
this._who = who;
}
public static HandlerList getHandlerList()
{
return handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
public Player getPlayer() {
return _who;
}
}

View File

@ -1,12 +1,13 @@
package nautilus.game.arcade.stats;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.skywars.events.PlayerKillZombieEvent;
import org.bukkit.entity.Player;
import org.bukkit.entity.Zombie;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.sheep.SheepGame;
import nautilus.game.arcade.game.games.skywars.events.PlayerKillZombieEvent;
public class SkyWarsKillZombieStatTracker extends StatTracker<Game>
{
@ -16,12 +17,22 @@ public class SkyWarsKillZombieStatTracker extends StatTracker<Game>
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onSheepStolen(PlayerKillZombieEvent event)
public void onKillZombie(PlayerKillZombieEvent event)
{
if (getGame().GetState() != Game.GameState.Live)
return;
if (!(event.getWho() instanceof Player))
{
return;
}
if (!(event.getZombie() instanceof Zombie))
{
return;
}
addStat(event.getWho(), "ZombieKills", 1, false, false);
}
}

View File

@ -3,6 +3,7 @@ package nautilus.game.arcade.stats;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.skywars.events.TNTKillEvent;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@ -20,7 +21,17 @@ public class SkyWarsTNTKillStatTracker extends StatTracker<Game>
if (getGame().GetState() != Game.GameState.Live)
return;
if (!(event.getKiller() instanceof Player))
{
return;
}
if (!(event.getVictim() instanceof Player))
{
return;
}
addStat(event.getKiller(), "BombKills", 1, false, false);
}
}

View File

@ -0,0 +1,55 @@
package nautilus.game.arcade.stats;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.skywars.events.PlayerOpenChestEvent;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
public class WinWithoutOpeningChestStatTracker extends StatTracker<Game>
{
private final Set<UUID> _openChest = new HashSet<>();
public WinWithoutOpeningChestStatTracker(Game game)
{
super(game);
}
@EventHandler
public void onOpenChest(PlayerOpenChestEvent e) {
Player player = e.getPlayer();
UUID uuid = player.getUniqueId();
_openChest.add(uuid);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onGameStateChange(GameStateChangeEvent event)
{
if (event.GetState() == Game.GameState.End)
{
List<Player> winners = getGame().getWinners();
if (winners != null)
{
for (Player winner : winners)
{
if (!_openChest.contains(winner.getUniqueId()))
addStat(winner, "NoChest", 1, true, false);
}
}
}
}
}