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

Conflicts:
	Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/CosmeticShop.java
This commit is contained in:
Jonathan Williams 2014-08-25 23:58:54 -07:00
commit 162a86d4b2
111 changed files with 2825 additions and 247 deletions

View File

@ -18,6 +18,7 @@
<processorPath useClasspath="true" /> <processorPath useClasspath="true" />
</profile> </profile>
</annotationProcessing> </annotationProcessing>
<bytecodeTargetLevel target="1.7" />
</component> </component>
<component name="JavacSettings"> <component name="JavacSettings">
<option name="GENERATE_NO_WARNINGS" value="true" /> <option name="GENERATE_NO_WARNINGS" value="true" />

View File

@ -5,53 +5,486 @@ public enum Achievement
GLOBAL_GEM_HUNTER("Gem Hunter", GLOBAL_GEM_HUNTER("Gem Hunter",
new String[] {"Global.GemsEarned"}, new String[] {"Global.GemsEarned"},
new String[] {"+1 for every Gem earned in any game."}, new String[] {"+1 for every Gem earned in any game."},
new int[] {10000, 15000, 20000, 25000, 30000, 35000, 40000, 45000, 50000, 55000, 60000, 65000}), new int[] {10000, 15000, 20000, 25000, 30000, 35000, 40000, 45000, 50000, 55000, 60000, 65000},
AchievementCategory.GLOBAL),
//Bridges
BRIDGES_WINS("Bridge Champion",
new String[] {"The Bridges.Wins"},
new String[] {"Win 50 games of Survival Games"},
new int[] {50},
AchievementCategory.BRIDGES),
BRIDGES_FOOD("Food for the Masses",
new String[] {"The Bridges.FoodForTheMasses"},
new String[] {"Get 20 kills with Apples"},
new int[] {20},
AchievementCategory.BRIDGES),
BRIDGES_SNIPER("Sniper",
new String[] {"The Bridges.Sniper"},
new String[] {"Kill an enemy with Bow before Bridges fall"},
new int[] {1},
AchievementCategory.BRIDGES),
BRIDGES_FORTUNE_BOMBER("Fortune Bomber",
new String[] {"The Bridges.FortuneBomber"},
new String[] {"Mine 30 Diamond Ore using TNT"},
new int[] {30},
AchievementCategory.BRIDGES),
BRIDGES_RAMPAGE("Rampage",
new String[] {"The Bridges.Rampage"},
new String[] {"Get 4 kills in a row, with no more than", "10 seconds between each kill"},
new int[] {1},
AchievementCategory.BRIDGES),
BRIDGES_DEATH_BOMBER("Death Bomber",
new String[] {"The Bridges.DeathBomber"},
new String[] {"Get 5 Kills in a single game with TNT"},
new int[] {1},
AchievementCategory.BRIDGES),
//Survival Games //Survival Games
SURVIVAL_GAMES_WINS("Katniss Everdeen", SURVIVAL_GAMES_WINS("Katniss Everdeen",
new String[] {"Survival Games.Wins"}, new String[] {"Survival Games.Wins"},
new String[] {"Win 50 games of Survival Games"}, new String[] {"Win 50 games of Survival Games"},
new int[] {50}), new int[] {50},
AchievementCategory.SURVIVAL_GAMES),
SURVIVAL_GAMES_NUDIST("Nudist", SURVIVAL_GAMES_LIGHT_WEIGHT("Light Weight",
new String[] {"Survival Games.NoArmor"}, new String[] {"Survival Games.NoArmor"},
new String[] {"Win a game without wearing any armor"}, new String[] {"Win a game without wearing any armor"},
new int[] {1}), new int[] {1},
AchievementCategory.SURVIVAL_GAMES),
SURVIVAL_GAMES_BLOODLUST("Bloodlust", SURVIVAL_GAMES_BLOODLUST("Bloodlust",
new String[] {"Survival Games.Bloodlust"}, new String[] {"Survival Games.Bloodlust"},
new String[] {"Kill 3 other players in the first minute"}, new String[] {"Kill 3 other players in the first minute"},
new int[] {1}), new int[] {1},
AchievementCategory.SURVIVAL_GAMES),
SURVIVAL_GAMES_LOOT("Loot Hoarder", SURVIVAL_GAMES_LOOT("Loot Hoarder",
new String[] {"Survival Games.SupplyDropsOpened"}, new String[] {"Survival Games.SupplyDropsOpened"},
new String[] {"Be the first to open 50 Supply Drops"}, new String[] {"Be the first to open 50 Supply Drops"},
new int[] {50}), new int[] {50},
AchievementCategory.SURVIVAL_GAMES),
SURVIVAL_GAMES_SKELETONS("Skeletal Army", SURVIVAL_GAMES_SKELETONS("Skeletal Army",
new String[] {"Survival Games.Skeletons"}, new String[] {"Survival Games.Skeletons"},
new String[] {"Have 5 Necromanced Skeletons alive"}, new String[] {"Have 5 Necromanced Skeletons alive"},
new int[] {1}); new int[] {1},
AchievementCategory.SURVIVAL_GAMES),
//Survival Games
UHC_WINS("Ultimate Winner",
new String[] {"Ultra Hardcore.Wins"},
new String[] {"Win 20 games of Ultra Hardcore"},
new int[] {20},
AchievementCategory.UHC),
//Smash Mobs
SMASH_MOBS_WINS("SO SUPER!",
new String[] {"Super Smash Mobs.Wins"},
new String[] {"Win 100 games of Super Smash Mobs"},
new int[] {100},
AchievementCategory.SMASH_MOBS),
SMASH_MOBS_MLG_PRO("MLG Pro",
new String[] {"Super Smash Mobs.MLGPro"},
new String[] {"Win a game without dying"},
new int[] {1},
AchievementCategory.SMASH_MOBS),
SMASH_MOBS_FREE_KITS("Free Kits Forever",
new String[] {"Super Smash Mobs.FreeKitsForever"},
new String[] {"Win 100 games using only Free Kits"},
new int[] {100},
AchievementCategory.SMASH_MOBS),
SMASH_MOBS_1V3("1v3",
new String[] {"Super Smash Mobs.1v3"},
new String[] {"Get 10 kills in a game with 4 players"},
new int[] {1},
AchievementCategory.SMASH_MOBS),
SMASH_MOBS_TRIPLE_KILL("Triple Kill",
new String[] {"Super Smash Mobs.TripleKill"},
new String[] {"Get 3 kills in a row, with no more than", "10 seconds between each kill"},
new int[] {1},
AchievementCategory.SMASH_MOBS),
SMASH_MOBS_RECOVERY_MASTER("Recovery Master",
new String[] {"Super Smash Mobs.RecoveryMaster"},
new String[] {"Take 200 damage in a single life"},
new int[] {1},
AchievementCategory.SMASH_MOBS),
//Block Hunt
BLOCK_HUNT_WINS("The Blockiest Block",
new String[] {"Block Hunt.Wins"},
new String[] {"Win 100 games of Block Hunt"},
new int[] {100},
AchievementCategory.BLOCK_HUNT),
BLOCK_HUNT_HUNTER_KILLER("Hunter Killer",
new String[] {"Block Hunt.HunterKiller"},
new String[] {"Kill 10 Hunters in a single game"},
new int[] {1},
AchievementCategory.BLOCK_HUNT),
BLOCK_HUNT_MEOW("Meow Meow Meow Meow",
new String[] {"Block Hunt.Meow"},
new String[] {"Meow 50 times in a single game"},
new int[] {1},
AchievementCategory.BLOCK_HUNT),
BLOCK_HUNT_HUNTER_OF_THE_YEAR("Hunter of the Year",
new String[] {"Block Hunt.HunterOfTheYear"},
new String[] {"Kill 7 Hiders in a single game"},
new int[] {100},
AchievementCategory.BLOCK_HUNT),
BLOCK_HUNT_BAD_HIDER("Bad Hider",
new String[] {"Block Hunt.BadHider"},
new String[] {"Win as Hider without disguising"},
new int[] {100},
AchievementCategory.BLOCK_HUNT),
//Draw My Thing
DRAW_MY_THING_WINS("Art Hipster",
new String[] {"Draw My Thing.Wins"},
new String[] {"Win 50 games of Block Hunt"},
new int[] {50},
AchievementCategory.DRAW_MY_THING),
DRAW_MY_THING_MR_SQUIGGLE("Mr. Squiggle",
new String[] {"Draw My Thing.MrSquiggle"},
new String[] {"Both your drawings are guessed", "within the first 15 seconds."},
new int[] {1},
AchievementCategory.DRAW_MY_THING),
DRAW_MY_THING_KEEN_EYE("Keen Eye",
new String[] {"Draw My Thing.KeenEye"},
new String[] {"Guess every single drawing in a game"},
new int[] {1},
AchievementCategory.DRAW_MY_THING),
DRAW_MY_THING_PURE_LUCK("Pure Luck",
new String[] {"Draw My Thing.PureLuck"},
new String[] {"Guess a word in the first 5 seconds"},
new int[] {1},
AchievementCategory.DRAW_MY_THING),
/* //Castle Siege
GAME_SPLEEF_SMASHER("Spleef Smasher", CASTLE_SIEGE_WINS("FOR THE KING!",
new String[] {"Super Spleef.BlocksBroken"}, new String[] {"Castle Siege.ForTheKing"},
new String[] {"+1 for every broken Block in Spleef."}, new String[] {"Win as Defenders 50 times"},
new int[] {100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200}); new int[] {50},
*/ AchievementCategory.CASTLE_SIEGE),
CASTLE_SIEGE_KINGSLAYER("Kingslayer",
new String[] {"Castle Siege.Kingslayer"},
new String[] {"Get the killing blow on the King"},
new int[] {1},
AchievementCategory.CASTLE_SIEGE),
CASTLE_SIEGE_BLOOD_THIRSTY("Blood Thirsty",
new String[] {"Castle Siege.BloodThirsty"},
new String[] {"Kill 50 Undead in a single game"},
new int[] {1},
AchievementCategory.CASTLE_SIEGE),
CASTLE_SIEGE_ASSASSIN("Assassin",
new String[] {"Castle Siege.Assassin"},
new String[] {"Do 50% or more of the damage to the king"},
new int[] {1},
AchievementCategory.CASTLE_SIEGE),
//Champions
CHAMPIONS_WINS("Champion",
new String[] {"Champions Domination.Wins", "Champions TDM.Wins"},
new String[] {"Win 80 games of Dominate or TDM"},
new int[] {80},
AchievementCategory.CHAMPIONS),
CHAMPIONS_FLAWLESS_VICTORY("Flawless Victory",
new String[] {"Champions TDM.FlawlessVictory"},
new String[] {"Win TDM without losing a player"},
new int[] {1},
AchievementCategory.CHAMPIONS),
CHAMPIONS_ACE("Ace",
new String[] {"Champions TDM.Ace"},
new String[] {"Kill all enemies in a game of TDM"},
new int[] {1},
AchievementCategory.CHAMPIONS),
CHAMPIONS_ASSASSINATION("Assassination",
new String[] {"Champions Domination.Assassination", "Champions TDM.Assassination"},
new String[] {"Kill 40 players with Backstab without", "taking any damage from them"},
new int[] {40},
AchievementCategory.CHAMPIONS),
CHAMPIONS_MASS_ELECTROCUTION("Mass Electrocution",
new String[] {"Champions Domination.MassElectrocution", "Champions TDM.MassElectrocution"},
new String[] {"Hit 4 enemies with a Lightning Orb"},
new int[] {1},
AchievementCategory.CHAMPIONS),
CHAMPIONS_THE_LONGEST_SHOT("The Longest Shot",
new String[] {"Champions Domination.TheLongestShot", "Champions TDM.TheLongestShot"},
new String[] {"Kill someone using Longshot who", "is over 64 Blocks away from you"},
new int[] {1},
AchievementCategory.CHAMPIONS),
CHAMPIONS_EARTHQUAKE("Earthquake",
new String[] {"Champions Domination.Earthquake", "Champions TDM.Earthquake"},
new String[] {"Launch 5 enemies using Seismic Slam"},
new int[] {1},
AchievementCategory.CHAMPIONS),
//Paintball
SUPER_PAINTBALL_WINS("Paintball King",
new String[] {"Super Paintball.Wins"},
new String[] {"Win 50 games of Paintball"},
new int[] {50},
AchievementCategory.SUPER_PAINTBALL),
SUPER_PAINTBALL_KILLING_SPREE("Killing Spree",
new String[] {"Super Paintball.KillingSpree"},
new String[] {"Get 4 kills in a row, with no more than", "5 seconds between each kill"},
new int[] {1},
AchievementCategory.SUPER_PAINTBALL),
SUPER_PAINTBALL_FLAWLESS_VICTORY("Flawless Victory",
new String[] {"Super Paintball.Wins"},
new String[] {"Win a team with your entire team alive"},
new int[] {1},
AchievementCategory.SUPER_PAINTBALL),
SUPER_PAINTBALL_MEDIC("Medic!",
new String[] {"Super Paintball.Medic"},
new String[] {"Revive 200 team members"},
new int[] {200},
AchievementCategory.SUPER_PAINTBALL),
SUPER_PAINTBALL_SPEEDRUNNER("Speedrunner",
new String[] {"Super Paintball.Speedrunner"},
new String[] {"Win a game in 20 seconds"},
new int[] {1},
AchievementCategory.SUPER_PAINTBALL),
SUPER_PAINTBALL_LAST_STAND("Last Stand",
new String[] {"Super Paintball.LastStand"},
new String[] {"Be the last alive on your team", "and kill 3 enemy players"},
new int[] {1},
AchievementCategory.SUPER_PAINTBALL),
//Sheep Quest
SHEEP_QUEST_WINS("Hungry Hungry Hippo",
new String[] {"Sheep Quest.Wins"},
new String[] {"Win 50 games of Sheep Quest"},
new int[] {50},
AchievementCategory.SHEEP_QUEST),
SHEEP_QUEST_THIEF("Thief",
new String[] {"Sheep Quest.Thief"},
new String[] {"Steal 300 Sheep from enemy pens"},
new int[] {300},
AchievementCategory.SHEEP_QUEST),
SHEEP_QUEST_ANIMAL_RESCUE("Animal Rescue",
new String[] {"Sheep Quest.AnimalRescue"},
new String[] {"Make 300 enemies drop their Sheep"},
new int[] {300},
AchievementCategory.SHEEP_QUEST),
SHEEP_QUEST_SELFISH("Selfish",
new String[] {"Sheep Quest.Selfish"},
new String[] {"Win with more than 12 Sheep"},
new int[] {1},
AchievementCategory.SHEEP_QUEST),
//Snake
SNAKE_WINS("Nokia 3310",
new String[] {"Snake.Wins"},
new String[] {"Win 50 games of Snake"},
new int[] {50},
AchievementCategory.SNAKE),
SNAKE_CANNIBAL("Cannibal",
new String[] {"Snake.Cannibal"},
new String[] {"Kill 8 players in a single game"},
new int[] {1},
AchievementCategory.SNAKE),
SNAKE_CHOO_CHOO("Choo Choo",
new String[] {"Snake.ChooChoo"},
new String[] {"Grow to be 60 Sheep or longer"},
new int[] {1},
AchievementCategory.SNAKE),
SNAKE_SLIMY_SHEEP("Slimy Sheep",
new String[] {"Snake.SlimySheep"},
new String[] {"Eat 20 slimes in a single game"},
new int[] {1},
AchievementCategory.SNAKE),
//Dragons
DRAGONS_WINS("Dragon Tamer",
new String[] {"Dragons.Wins"},
new String[] {"Win 50 games of Snake"},
new int[] {50},
AchievementCategory.DRAGONS),
DRAGONS_SPARKLEZ("Sparklez",
new String[] {"Dragons.Sparklez"},
new String[] {"Throw 100 Sparklers"},
new int[] {100},
AchievementCategory.DRAGONS),
//Turf Wars
TURF_WARS_WINS("Turf Master 3000",
new String[] {"Turf Wars.Wins"},
new String[] {"Win 50 games of Turf Wars"},
new int[] {50},
AchievementCategory.TURF_WARS),
TURF_WARS_SHREDDINATOR("The Shreddinator",
new String[] {"Turf Wars.TheShreddinator"},
new String[] {"Destroy 2000 blocks as Shredder"},
new int[] {2000},
AchievementCategory.TURF_WARS),
TURF_WARS_BEHIND_ENEMY_LINES("Behind Enemy Lines",
new String[] {"Turf Wars.BehindEnemyLines"},
new String[] {"Stay on enemy turf for 15 seconds"},
new int[] {1},
AchievementCategory.TURF_WARS),
TURF_WARS_COMEBACK("The Comeback",
new String[] {"Turf Wars.TheComeback"},
new String[] {"Win a game after having 5 or less turf"},
new int[] {1},
AchievementCategory.TURF_WARS),
//Death Tag
DEATH_TAG_WINS("Death Proof",
new String[] {"Death Tag.Wins"},
new String[] {"Win 50 games of Turf Wars"},
new int[] {50},
AchievementCategory.DEATH_TAG),
DEATH_TAG_COME_AT_ME_BRO("Come At Me Bro!",
new String[] {"Death Tag.ComeAtMeBro"},
new String[] {"Kill 2 Undead Chasers in a single game"},
new int[] {1},
AchievementCategory.DEATH_TAG),
//Runner
RUNNER_WINS("Hot Feet",
new String[] {"Runner.Wins"},
new String[] {"Win 50 games of Runner"},
new int[] {50},
AchievementCategory.RUNNER),
//Dragon Escape
DRAGON_ESCAPE_WINS("Douglas Defeater",
new String[] {"Dragon Escape.Wins"},
new String[] {"Win 50 games of Dragon Escape"},
new int[] {50},
AchievementCategory.DRAGON_ESCAPE),
DRAGON_ESCAPE_PARALYMPICS("Paralympics",
new String[] {"Dragon Escape.Wins"},
new String[] {"Win a game without using Leap"},
new int[] {1},
AchievementCategory.DRAGON_ESCAPE),
DRAGON_ESCAPE_SKYLANDS("Skylands Master",
new String[] {"Dragon Escape.Win.Skylands"},
new String[] {"Win by finishing Skylands 5 times"},
new int[] {5},
AchievementCategory.DRAGON_ESCAPE),
DRAGON_ESCAPE_THROUGH_HELL("To Hell and Back",
new String[] {"Dragon Escape.Win.Through Hell"},
new String[] {"Win by finishing Through Hell 5 times"},
new int[] {5},
AchievementCategory.DRAGON_ESCAPE),
DRAGON_ESCAPE_PIRATE_BAY("Plundered",
new String[] {"Dragon Escape.Win.Pirate Bay"},
new String[] {"Win by finishing Pirate Bay 5 times"},
new int[] {5},
AchievementCategory.DRAGON_ESCAPE),
//OITQ
OITQ_WINS("One of a Kind",
new String[] {"One in the Quiver.Wins"},
new String[] {"Win 50 games of One in the Quiver"},
new int[] {50},
AchievementCategory.ONE_IN_THE_QUIVER),
OITQ_PERFECTIONIST("The Perfect Game",
new String[] {"One in the Quiver.Perfectionist"},
new String[] {"Win without dying"},
new int[] {1},
AchievementCategory.ONE_IN_THE_QUIVER),
OITQ_SHARPSHOOTER("SharpShooter",
new String[] {"One in the Quiver.Sharpshooter"},
new String[] {"Hit with 8 Arrows in a row"},
new int[] {1},
AchievementCategory.ONE_IN_THE_QUIVER),
//Super Spleef
SPLEEF_WINS("Spleef King (or Queen)",
new String[] {"Super Spleef.Wins"},
new String[] {"Win 50 games of Super Spleef"},
new int[] {50},
AchievementCategory.SPLEEF),
//Bacon Brawl
BACON_BRAWL_WINS("King of Bacon",
new String[] {"Bacon Brawl.Wins"},
new String[] {"Win 50 games of Bacon Brawl"},
new int[] {50},
AchievementCategory.BACON_BRAWL),
//Sneaky Assassins
SNEAKY_ASSASSINS_WINS("So So Sneaky",
new String[] {"Sneaky Assassins.Wins"},
new String[] {"Win 50 games of Sneaky Assassins"},
new int[] {50},
AchievementCategory.SNEAKY_ASSASSINS),
//Micro Battle
MICRO_BATTLE_WINS("Micro Champion",
new String[] {"Micro Battle.Wins"},
new String[] {"Win 100 games of Micro Battle"},
new int[] {100},
AchievementCategory.MICRO_BATTLE),
;
private String _name; private String _name;
private String[] _desc; private String[] _desc;
private String[] _stats; private String[] _stats;
private int[] _levels; private int[] _levels;
private AchievementCategory _category;
Achievement(String name, String[] stats, String[] desc, int[] levels) Achievement(String name, String[] stats, String[] desc, int[] levels, AchievementCategory category)
{ {
_name = name; _name = name;
_desc = desc; _desc = desc;
_stats = stats; _stats = stats;
_levels = levels; _levels = levels;
_category = category;
} }
public String getName() public String getName()
@ -83,8 +516,18 @@ public enum Achievement
{ {
return _levels[0] > 1; return _levels[0] > 1;
} }
public boolean isSingleLevel()
{
return _levels.length == 1;
}
public AchievementCategory getCategory()
{
return _category;
}
public AchivementData getLevelData(int exp) public AchievementData getLevelData(int exp)
{ {
for (int i=0 ; i<_levels.length ; i++) for (int i=0 ; i<_levels.length ; i++)
{ {
@ -97,9 +540,9 @@ public enum Achievement
continue; continue;
} }
return new AchivementData(i, exp, req); return new AchievementData(i, exp, req);
} }
return new AchivementData(getMaxLevel(), -1, -1); return new AchievementData(getMaxLevel(), -1, -1);
} }
} }

View File

@ -0,0 +1,191 @@
package mineplex.core.achievement;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
/**
* Created by Shaun on 8/21/2014.
* Edited by Chris on 9/13/2059.
*/
public enum AchievementCategory
{
GLOBAL("Global", null,
new String[] { "GemsEarned" },
new String[] { "Gems Earned" },
Material.EMERALD, 0, GameCategory.GLOBAL),
//Survival
BRIDGES("The Bridges", null,
new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"},
new String[] { "Wins", "Losses", "Kills", "Deaths", "Gems Earned" },
Material.IRON_PICKAXE, 0, GameCategory.SURVIVAL),
SURVIVAL_GAMES("Survival Games", null,
new String[] { "Wins", "Losses", "Kills", "Deaths", "GemsEarned" },
new String[] { "Wins", "Losses", "Kills", "Deaths", "Gems Earned" },
Material.IRON_SWORD, 0, GameCategory.SURVIVAL),
UHC("Ultra Hardcore", null,
new String[] { "Wins", "Losses", "Kills", "Deaths", "GemsEarned" },
new String[] { "Wins", "Losses", "Kills", "Deaths", "Gems Earned" },
Material.GOLD_INGOT, 0, GameCategory.SURVIVAL),
//Classics
SMASH_MOBS("Super Smash Mobs", null,
new String[] { "Wins", "Losses", "Kills", "Deaths", "GemsEarned" },
new String[] { "Wins", "Losses", "Kills", "Deaths", "Gems Earned" },
Material.SKULL_ITEM, 4, GameCategory.CLASSICS),
BLOCK_HUNT("Block Hunt", null,
new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"},
new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"},
Material.GRASS, 0, GameCategory.CLASSICS),
DRAW_MY_THING("Draw My Thing", null,
new String[] {"Wins", "Losses", "GemsEarned"},
new String[] {"Wins", "Losses", "GemsEarned"},
Material.BOOK_AND_QUILL, 0, GameCategory.CLASSICS),
CASTLE_SIEGE("Castle Siege", null,
new String[] {"Wins", "Losses", "Kills as Defenders", "Deaths as Defenders", "Kills as Undead", "Deaths as Undead", "GemsEarned"},
new String[] {"Wins", "Losses", "Kills as Defenders", "Deaths as Defenders", "Kills as Undead", "Deaths as Undead", "Gems Earned"},
Material.DIAMOND_CHESTPLATE, 0, GameCategory.CLASSICS),
//Champions
CHAMPIONS("Champions", new String[] {"Champions Domination", "Champions TDM"},
new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"},
new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"},
Material.BEACON, 0, GameCategory.CHAMPIONS),
//Arcade
DRAGONS("Dragons", null,
new String[] {"Wins", "Losses", "GemsEarned"},
new String[] {"Wins", "Losses", "Gems Earned"},
Material.ENDER_STONE, 0, GameCategory.ARCADE),
DRAGON_ESCAPE("Dragon Escape", null,
new String[] {"Wins", "Losses", "GemsEarned"},
new String[] {"Wins", "Losses", "Gems Earned"},
Material.DRAGON_EGG, 0, GameCategory.ARCADE),
SHEEP_QUEST("Sheep Quest", null,
new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"},
new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"},
Material.WOOL, 0, GameCategory.ARCADE),
SNEAKY_ASSASSINS("Sneaky Assassins", null,
new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"},
new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"},
Material.INK_SACK, 0, GameCategory.ARCADE),
ONE_IN_THE_QUIVER("One in the Quiver", null,
new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"},
new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"},
Material.BOW, 0, GameCategory.ARCADE),
SUPER_PAINTBALL("Super Paintball", null,
new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"},
new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"},
Material.ENDER_PEARL, 0, GameCategory.ARCADE),
TURF_WARS("Turf Wars", null,
new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"},
new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"},
Material.HARD_CLAY, 14, GameCategory.ARCADE),
RUNNER("Runner", null,
new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"},
new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"},
Material.LEATHER_BOOTS, 0, GameCategory.ARCADE),
SPLEEF("Super Spleef", null,
new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"},
new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"},
Material.IRON_SPADE, 0, GameCategory.ARCADE),
DEATH_TAG("Death Tag", null,
new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"},
new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"},
Material.SKULL_ITEM, 0, GameCategory.ARCADE),
SNAKE("Snake", null,
new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"},
new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"},
Material.WOOL, 4, GameCategory.ARCADE),
BACON_BRAWL("Bacon Brawl", null,
new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"},
new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"},
Material.PORK, 0, GameCategory.ARCADE),
MICRO_BATTLE("Micro Battle", null,
new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"},
new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"},
Material.LAVA, 0, GameCategory.ARCADE);
private String _name;
private String[] _statsToPull;
private String[] _statsToDisplay;
private String[] _friendlyStatNames;
private Material _icon;
private GameCategory _gameCategory;
private byte _iconData;
AchievementCategory(String name, String[] statsToPull, String[] statsToDisplay, String[] friendlyStatNames, Material icon, int iconData, GameCategory gameCategory)
{
_name = name;
if (statsToPull != null)
_statsToPull = statsToPull;
else
_statsToPull = new String[] {name};
_statsToDisplay = statsToDisplay;
_friendlyStatNames = friendlyStatNames;
_icon = icon;
_iconData = (byte)iconData;
_gameCategory = gameCategory;
}
public String getFriendlyName()
{
return _name;
}
public Material getIcon()
{
return _icon;
}
public String[] getStatsToPull()
{
return _statsToPull;
}
public String[] getStatsToDisplay()
{
return _statsToDisplay;
}
public byte getIconData()
{
return _iconData;
}
public GameCategory getGameCategory()
{
return _gameCategory;
}
public String[] getFriendlyStatNames()
{
return _friendlyStatNames;
}
public static enum GameCategory
{
GLOBAL, SURVIVAL, CLASSICS, CHAMPIONS, ARCADE;
}
}

View File

@ -1,14 +1,12 @@
package mineplex.core.achievement; package mineplex.core.achievement;
import org.bukkit.ChatColor; public class AchievementData
public class AchivementData
{ {
private int _level; private int _level;
private int _expRemainder; private int _expRemainder;
private int _expNextLevel; private int _expNextLevel;
public AchivementData(int level, int expRemainder, int expNextLevel) public AchievementData(int level, int expRemainder, int expNextLevel)
{ {
_level = level; _level = level;
_expRemainder = expRemainder; _expRemainder = expRemainder;

View File

@ -1,52 +1,69 @@
package mineplex.core.achievement; package mineplex.core.achievement;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.command.StatsCommand;
import mineplex.core.achievement.ui.AchievementShop;
import mineplex.core.common.util.C;
import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.donation.DonationManager;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.stats.StatsManager; import mineplex.core.stats.StatsManager;
import mineplex.core.stats.event.StatChangeEvent; import mineplex.core.stats.event.StatChangeEvent;
public class AchievementManager extends MiniPlugin public class AchievementManager extends MiniPlugin
{ {
private StatsManager _statsManager; private StatsManager _statsManager;
private AchievementShop _shop;
private int _interfaceSlot = 7;
private boolean _giveInterfaceItem = false;
private NautHashMap<String, NautHashMap<Achievement, AchievementLog>> _log = new NautHashMap<String, NautHashMap<Achievement, AchievementLog>>(); private NautHashMap<String, NautHashMap<Achievement, AchievementLog>> _log = new NautHashMap<String, NautHashMap<Achievement, AchievementLog>>();
public AchievementManager(StatsManager statsManager) public AchievementManager(StatsManager statsManager, CoreClientManager clientManager, DonationManager donationManager)
{ {
super("Achievement Manager", statsManager.GetPlugin()); super("Achievement Manager", statsManager.GetPlugin());
_statsManager = statsManager; _statsManager = statsManager;
_shop = new AchievementShop(this, _statsManager, clientManager, donationManager, "Achievement");
} }
public AchivementData get(Player player, Achievement type) public AchievementData get(Player player, Achievement type)
{ {
return get(player.getName(), type); return get(player.getName(), type);
} }
public AchivementData get(String playerName, Achievement type) public AchievementData get(String playerName, Achievement type)
{ {
int exp = 0; int exp = 0;
for (String stat : type.getStats()) for (String stat : type.getStats())
{ {
exp += _statsManager.Get(playerName).getStat(stat); exp += _statsManager.Get(playerName).getStat(stat);
} }
return type.getLevelData(exp); return type.getLevelData(exp);
} }
@EventHandler @EventHandler
public void informLevelUp(StatChangeEvent event) public void informLevelUp(StatChangeEvent event)
{ {
Player player = UtilPlayer.searchExact(event.getPlayerName()); Player player = UtilPlayer.searchExact(event.getPlayerName());
if (player == null) if (player == null)
return; return;
for (Achievement type : Achievement.values()) for (Achievement type : Achievement.values())
{ {
for (String stat : type.getStats()) for (String stat : type.getStats())
@ -55,7 +72,7 @@ public class AchievementManager extends MiniPlugin
{ {
if (!_log.containsKey(player.getName())) if (!_log.containsKey(player.getName()))
_log.put(player.getName(), new NautHashMap<Achievement, AchievementLog>()); _log.put(player.getName(), new NautHashMap<Achievement, AchievementLog>());
//Record that achievement has leveled up //Record that achievement has leveled up
if (type.getLevelData(event.getValueAfter()).getLevel() > type.getLevelData(event.getValueBefore()).getLevel()) if (type.getLevelData(event.getValueAfter()).getLevel() > type.getLevelData(event.getValueBefore()).getLevel())
{ {
@ -71,7 +88,7 @@ public class AchievementManager extends MiniPlugin
log.Amount += event.getValueAfter() - event.getValueBefore(); log.Amount += event.getValueAfter() - event.getValueBefore();
log.LevelUp = true; log.LevelUp = true;
} }
} }
//Record that there has been changes in this Achievement //Record that there has been changes in this Achievement
else if (!_log.get(player.getName()).containsKey(type)) else if (!_log.get(player.getName()).containsKey(type))
@ -92,20 +109,71 @@ public class AchievementManager extends MiniPlugin
} }
} }
} }
@Override
public void AddCommands()
{
AddCommand(new StatsCommand(this));
}
public void openShop(Player player)
{
_shop.attemptShopOpen(player);
}
public void openShop(Player player, Player target)
{
_shop.attemptShopOpen(player, target);
}
@EventHandler @EventHandler
public void playerQuit(PlayerQuitEvent event) public void playerQuit(PlayerQuitEvent event)
{ {
_log.remove(event.getPlayer().getName()); _log.remove(event.getPlayer().getName());
} }
@EventHandler
public void playerJoin(PlayerJoinEvent event)
{
if (_giveInterfaceItem)
{
giveInterfaceItem(event.getPlayer());
}
}
public void clearLog(Player player) public void clearLog(Player player)
{ {
_log.remove(player.getName()); _log.remove(player.getName());
} }
public NautHashMap<Achievement, AchievementLog> getLog(Player player) public NautHashMap<Achievement, AchievementLog> getLog(Player player)
{ {
return _log.remove(player.getName()); return _log.remove(player.getName());
} }
public void setGiveInterfaceItem(boolean giveInterfaceItem)
{
_giveInterfaceItem = giveInterfaceItem;
}
public void giveInterfaceItem(Player player)
{
if (!UtilGear.isMat(player.getInventory().getItem(_interfaceSlot), Material.CHEST))
{
player.getInventory().setItem(_interfaceSlot, ItemStackFactory.Instance.CreateStack(Material.PAPER, (byte)0, 1, ChatColor.RESET + C.cGreen + "/stats"));
UtilInv.Update(player);
}
}
@EventHandler
public void openShop(PlayerInteractEvent event)
{
if (event.hasItem() && event.getItem().getType() == Material.PAPER)
{
event.setCancelled(true);
openShop(event.getPlayer());
}
}
} }

View File

@ -0,0 +1,40 @@
package mineplex.core.achievement.command;
import org.bukkit.entity.Player;
import mineplex.core.achievement.AchievementManager;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.stats.StatsManager;
/**
* Created by Shaun on 8/22/2014.
*/
public class StatsCommand extends CommandBase<AchievementManager>
{
public StatsCommand(AchievementManager plugin)
{
super(plugin, Rank.ALL, "stats");
}
@Override
public void Execute(Player caller, String[] args)
{
if (args == null || args.length == 0)
{
Plugin.openShop(caller);
}
else
{
Player target = UtilPlayer.searchOnline(caller, args[0], true);
if (target == null)
{
return;
}
Plugin.openShop(caller, target);
}
}
}

View File

@ -0,0 +1,59 @@
package mineplex.core.achievement.ui;
import org.bukkit.entity.Player;
import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.AchievementManager;
import mineplex.core.achievement.ui.page.AchievementMainPage;
import mineplex.core.donation.DonationManager;
import mineplex.core.shop.ShopBase;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.core.stats.StatsManager;
/**
* Created by Shaun on 8/21/2014.
*/
public class AchievementShop extends ShopBase<AchievementManager>
{
private StatsManager _statsManager;
public AchievementShop(AchievementManager plugin, StatsManager statsManager, CoreClientManager clientManager, DonationManager donationManager, String name)
{
super(plugin, clientManager, donationManager, name);
_statsManager = statsManager;
}
@Override
protected ShopPageBase<AchievementManager, ? extends ShopBase<AchievementManager>> BuildPagesFor(Player player)
{
return BuildPagesFor(player, player);
}
protected ShopPageBase<AchievementManager, ? extends ShopBase<AchievementManager>> BuildPagesFor(Player player, Player target)
{
return new AchievementMainPage(Plugin, _statsManager, this, ClientManager, DonationManager, target.getName() + "'s Stats", player, target);
}
public boolean attemptShopOpen(Player player, Player target)
{
if (!OpenedShop.contains(player.getName()))
{
if (!CanOpenShop(player))
return false;
OpenedShop.add(player.getName());
OpenShopForPlayer(player);
if (!PlayerPageMap.containsKey(player.getName()))
{
PlayerPageMap.put(player.getName(), BuildPagesFor(player, target));
}
OpenPageForPlayer(player, GetOpeningPageForPlayer(player));
return true;
}
return false;
}
}

View File

@ -0,0 +1,44 @@
package mineplex.core.achievement.ui.button;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.AchievementCategory;
import mineplex.core.achievement.AchievementManager;
import mineplex.core.achievement.ui.AchievementShop;
import mineplex.core.achievement.ui.page.ArcadeMainPage;
import mineplex.core.donation.DonationManager;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.stats.StatsManager;
/**
* Created by Shaun on 8/22/2014.
*/
public class ArcadeButton extends SingleButton
{
private AchievementShop _shop;
private AchievementManager _achievementManager;
private StatsManager _statsManager;
private DonationManager _donationManager;
private CoreClientManager _clientManager;
private Player _target;
public ArcadeButton(AchievementShop shop, AchievementManager achievementManager, StatsManager statsManager, DonationManager donationManager, CoreClientManager clientManager, Player target)
{
_shop = shop;
_achievementManager = achievementManager;
_statsManager = statsManager;
_donationManager = donationManager;
_clientManager = clientManager;
_target = target;
}
@Override
public void Clicked(Player player)
{
_shop.OpenPageForPlayer(player, new ArcadeMainPage(_achievementManager, _statsManager, _shop, _clientManager, _donationManager, "Arcade Games", player, _target));
player.playSound(player.getLocation(), Sound.CLICK, 1, 1);
}
}

View File

@ -0,0 +1,46 @@
package mineplex.core.achievement.ui.button;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.AchievementCategory;
import mineplex.core.achievement.AchievementManager;
import mineplex.core.achievement.ui.AchievementShop;
import mineplex.core.achievement.ui.page.AchievementPage;
import mineplex.core.donation.DonationManager;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.stats.StatsManager;
/**
* Created by Shaun on 8/22/2014.
*/
public class CategoryButton extends SingleButton
{
private AchievementShop _shop;
private AchievementCategory _category;
private AchievementManager _achievementManager;
private StatsManager _statsManager;
private DonationManager _donationManager;
private CoreClientManager _clientManager;
private Player _target;
public CategoryButton(AchievementShop shop, AchievementManager achievementManager, StatsManager statsManager, AchievementCategory category, DonationManager donationManager, CoreClientManager clientManager, Player target)
{
_category = category;
_shop = shop;
_achievementManager = achievementManager;
_statsManager = statsManager;
_donationManager = donationManager;
_clientManager = clientManager;
_target = target;
}
@Override
public void Clicked(Player player)
{
_shop.OpenPageForPlayer(player, new AchievementPage(_achievementManager, _statsManager, _category, _shop, _clientManager, _donationManager, player, _target));
player.playSound(player.getLocation(), Sound.CLICK, 1, 1);
}
}

View File

@ -0,0 +1,130 @@
package mineplex.core.achievement.ui.page;
import java.util.ArrayList;
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.achievement.Achievement;
import mineplex.core.achievement.AchievementCategory;
import mineplex.core.achievement.AchievementData;
import mineplex.core.achievement.AchievementManager;
import mineplex.core.achievement.ui.AchievementShop;
import mineplex.core.achievement.ui.button.ArcadeButton;
import mineplex.core.achievement.ui.button.CategoryButton;
import mineplex.core.common.util.C;
import mineplex.core.donation.DonationManager;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.core.stats.PlayerStats;
import mineplex.core.stats.StatsManager;
/**
* Created by Shaun on 8/21/2014.
*/
public class AchievementMainPage extends ShopPageBase<AchievementManager, AchievementShop>
{
protected Player _target;
protected StatsManager _statsManager;
public AchievementMainPage(AchievementManager plugin, StatsManager statsManager, AchievementShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player, Player target)
{
super(plugin, shop, clientManager, donationManager, name, player);
_target = target;
_statsManager = statsManager;
BuildPage();
}
@Override
protected void BuildPage()
{
int globalSlot = 4;
int normalSlot = 18;
for (AchievementCategory category : AchievementCategory.values())
{
if (category.getGameCategory() == AchievementCategory.GameCategory.ARCADE)
continue;
CategoryButton button = new CategoryButton(Shop, Plugin, _statsManager, category, DonationManager, ClientManager, _target);
ArrayList<String> lore = new ArrayList<String>();
lore.add(" ");
addStats(category, lore, 2);
lore.add(" ");
addAchievements(category, lore, 9);
lore.add(" ");
lore.add(ChatColor.RESET + "Click for more details!");
int slot;
switch(category.getGameCategory())
{
case GLOBAL:
slot = globalSlot;
break;
default:
slot = normalSlot;
normalSlot += 2;
}
if (normalSlot == 28)
normalSlot = 36;
ShopItem shopItem = new ShopItem(category.getIcon(), category.getIconData(), C.Bold + category.getFriendlyName(), lore.toArray(new String[0]), 1, false, false);
AddButton(slot, shopItem, button);
}
addArcadeButton();
}
protected void addStats(AchievementCategory category, List<String> lore, int max)
{
String[] statsToDisplay = category.getStatsToDisplay();
String[] friendlyStatNames = category.getFriendlyStatNames();
PlayerStats stats = _statsManager.Get(_target);
for (int i = 0; i < statsToDisplay.length && i < max; i++)
{
String statName = statsToDisplay[i];
int statNumber = 0;
for (String statToPull : category.getStatsToPull())
statNumber += stats.getStat(statToPull + "." + statName);
lore.add(C.cYellow + friendlyStatNames[i] + ": " + C.cWhite + statNumber);
}
}
protected void addArcadeButton()
{
ArcadeButton button = new ArcadeButton(Shop, Plugin, _statsManager, DonationManager, ClientManager, _target);
ShopItem shopItem = new ShopItem(Material.TNT, (byte) 0, C.Bold + "Arcade Games", new String[] {" ", ChatColor.RESET + "Click for more!"}, 1, false, false);
AddButton(42, shopItem, button);
}
protected void addAchievements(AchievementCategory category, List<String> lore, int max)
{
int achievementCount = 0;
for (int i = 0; i < Achievement.values().length && achievementCount < max; i++)
{
Achievement achievement = Achievement.values()[i];
if (achievement.getCategory() == category)
{
// Don't display achievements that have multiple levels
if (achievement.getMaxLevel() > 1)
continue;
AchievementData data = Plugin.get(_target, achievement);
boolean finished = data.getLevel() >= achievement.getMaxLevel();
lore.add((finished ? C.cGreen : C.cRed) + achievement.getName());
achievementCount++;
}
}
}
}

View File

@ -0,0 +1,177 @@
package mineplex.core.achievement.ui.page;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.Achievement;
import mineplex.core.achievement.AchievementCategory;
import mineplex.core.achievement.AchievementData;
import mineplex.core.achievement.AchievementManager;
import mineplex.core.achievement.ui.AchievementShop;
import mineplex.core.common.util.C;
import mineplex.core.donation.DonationManager;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.core.stats.PlayerStats;
import mineplex.core.stats.StatsManager;
/**
* Created by Shaun on 8/22/2014.
*/
public class AchievementPage extends ShopPageBase<AchievementManager, AchievementShop>
{
private static int ACHIEVEMENT_MIDDLE_INDEX = 31;
private AchievementCategory _category;
private StatsManager _statsManager;
private Player _target;
public AchievementPage(AchievementManager plugin, StatsManager statsManager, AchievementCategory category, AchievementShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player, Player target)
{
super(plugin, shop, clientManager, donationManager, category.getFriendlyName(), player);
_statsManager = statsManager;
_category = category;
_target = target;
BuildPage();
}
@Override
protected void BuildPage()
{
int currentIndex = ACHIEVEMENT_MIDDLE_INDEX - (getAchievements().size() / 2);
PlayerStats stats = _statsManager.Get(_target);
boolean hasAllAchievements = true;
int achievementCount = 0;
ArrayList<String> masterAchievementLore = new ArrayList<String>();
masterAchievementLore.add(" ");
List<Achievement> achievements = getAchievements();
for (Achievement achievement : achievements)
{
AchievementData data = Plugin.get(_target, achievement);
boolean singleLevel = achievement.isSingleLevel();
boolean hasUnlocked = data.getLevel() >= achievement.getMaxLevel();
if (!hasUnlocked)
{
hasAllAchievements = false;
}
{
Material material = hasUnlocked ? Material.EMERALD : Material.INK_SACK;
String itemName = hasUnlocked ? C.cGreen : C.cRed + achievement.getName();
if (!singleLevel)
itemName += ChatColor.WHITE + " Level " + data.getLevel() + "/" + achievement.getMaxLevel();
ArrayList<String> lore = new ArrayList<String>();
lore.add(" ");
for (String descLine : achievement.getDesc())
{
lore.add(ChatColor.RESET + descLine);
}
lore.add(" ");
if (!hasUnlocked && achievement.isOngoing())
lore.add(C.cYellow + (singleLevel ? "To Unlock: " : "Next Level: ") + C.cWhite + data.getExpRemainder() + "/" + data.getExpNextLevel());
AddItem(currentIndex, new ShopItem(material, (byte) (hasUnlocked ? 0 : 8), itemName, lore.toArray(new String[0]), 1, false, false));
}
masterAchievementLore.add((hasUnlocked ? C.cGreen : C.cRed) + achievement.getName());
currentIndex++;
achievementCount++;
}
// Master Achievement
if (!_category.getFriendlyName().startsWith("Global") && achievementCount > 0)
{
String itemName = ChatColor.RESET + _category.getFriendlyName() + " Master Achievement";
masterAchievementLore.add(" ");
if (Player.equals(_target))
masterAchievementLore.add(ChatColor.RESET + "Kit Reward Coming Soon!");
AddItem(40, new ShopItem(Material.WOOL, (byte) (hasAllAchievements ? 5 : 14), itemName, masterAchievementLore.toArray(new String[0]), 1, false, true));
}
addBackButton();
addStats();
}
private void addBackButton()
{
AddButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[] { }, 1, false), new SingleButton()
{
@Override
public void Clicked(Player player)
{
AchievementMainPage page;
if (_category.getGameCategory() == AchievementCategory.GameCategory.ARCADE)
page = new ArcadeMainPage(Plugin, _statsManager, Shop, ClientManager, DonationManager, "Arcade Games", player, _target);
else
page = new AchievementMainPage(Plugin, _statsManager, Shop, ClientManager, DonationManager, _target.getName() + "'s Stats", player, _target);;
Shop.OpenPageForPlayer(Player, page);
player.playSound(player.getLocation(), Sound.CLICK, 1, 1);
}
});
}
private void addStats()
{
// Don't show if this category has no stats to display
if (_category.getStatsToDisplay().length == 0)
return;
Material material = Material.BOOK;
String itemName = C.Bold + _category.getFriendlyName() + " Stats";
List<String> lore = new ArrayList<String>();
lore.add("");
PlayerStats stats = _statsManager.Get(_target);
String[] statsToDisplay = _category.getStatsToDisplay();
String[] friendlyStatNames = _category.getFriendlyStatNames();
for (int i = 0; i < statsToDisplay.length; i++)
{
int statNumber = 0;
for (String statToPull : _category.getStatsToPull())
statNumber += stats.getStat(statToPull + "." + statsToDisplay[i]);
lore.add(C.cYellow + friendlyStatNames[i] + ": " + C.cWhite + statNumber);
}
ItemStack item = new ItemStack(material);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(ChatColor.RESET + itemName);
meta.setLore(lore);
item.setItemMeta(meta);
setItem(22, item);
}
public List<Achievement> getAchievements()
{
List<Achievement> achievements = new ArrayList<Achievement>();
for (Achievement achievement : Achievement.values())
{
if (achievement.getCategory() == _category)
achievements.add(achievement);
}
return achievements;
}
}

View File

@ -0,0 +1,77 @@
package mineplex.core.achievement.ui.page;
import java.util.ArrayList;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.AchievementCategory;
import mineplex.core.achievement.AchievementManager;
import mineplex.core.achievement.ui.AchievementShop;
import mineplex.core.achievement.ui.button.CategoryButton;
import mineplex.core.common.util.C;
import mineplex.core.donation.DonationManager;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.core.stats.StatsManager;
/**
* Created by Shaun on 8/25/2014.
*/
public class ArcadeMainPage extends AchievementMainPage
{
public ArcadeMainPage(AchievementManager plugin, StatsManager statsManager, AchievementShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player, Player target)
{
super(plugin, statsManager, shop, clientManager, donationManager, name, player, target);
}
@Override
protected void BuildPage()
{
int slot = 10;
for (AchievementCategory category : AchievementCategory.values())
{
if (category.getGameCategory() != AchievementCategory.GameCategory.ARCADE)
continue;
CategoryButton button = new CategoryButton(Shop, Plugin, _statsManager, category, DonationManager, ClientManager, _target);
ArrayList<String> lore = new ArrayList<String>();
lore.add(" ");
addStats(category, lore, 2);
lore.add(" ");
addAchievements(category, lore, 9);
lore.add(" ");
lore.add(ChatColor.RESET + "Click for more details!");
if (slot == 18 || slot == 27 || slot == 36)
slot++;
ShopItem shopItem = new ShopItem(category.getIcon(), category.getIconData(), C.Bold + category.getFriendlyName(), lore.toArray(new String[0]), 1, false, false);
AddButton(slot, shopItem, button);
slot += 2;
}
addBackButton();
}
private void addBackButton()
{
AddButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[] { }, 1, false), new SingleButton()
{
@Override
public void Clicked(Player player)
{
Shop.OpenPageForPlayer(Player, new AchievementMainPage(Plugin, _statsManager, Shop, ClientManager, DonationManager, _target.getName() + "'s Stats", player, _target));
player.playSound(player.getLocation(), Sound.CLICK, 1, 1);
}
});
}
}

View File

@ -10,11 +10,14 @@ import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.page.GadgetPage; import mineplex.core.cosmetic.ui.page.GadgetPage;
import mineplex.core.cosmetic.ui.page.Menu; import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.cosmetic.ui.page.PetTagPage; import mineplex.core.cosmetic.ui.page.PetTagPage;
import mineplex.core.cosmetic.ui.page.TreasurePage;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.event.ItemGadgetOutOfAmmoEvent; import mineplex.core.gadget.event.ItemGadgetOutOfAmmoEvent;
import mineplex.core.inventory.InventoryManager; import mineplex.core.inventory.InventoryManager;
import mineplex.core.shop.ShopBase; import mineplex.core.shop.ShopBase;
import mineplex.core.shop.page.ShopPageBase; import mineplex.core.shop.page.ShopPageBase;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class CosmeticShop extends ShopBase<CosmeticManager> implements PluginMessageListener public class CosmeticShop extends ShopBase<CosmeticManager> implements PluginMessageListener
{ {
@ -47,10 +50,21 @@ public class CosmeticShop extends ShopBase<CosmeticManager> implements PluginMes
} }
} }
} }
@EventHandler @EventHandler
public void itemGadgetEmptyAmmo(ItemGadgetOutOfAmmoEvent event) public void itemGadgetEmptyAmmo(ItemGadgetOutOfAmmoEvent event)
{ {
new GadgetPage(Plugin, this, ClientManager, DonationManager, "Gadgets", event.getPlayer()).purchaseGadget(event.getPlayer(), event.getGadget()); new GadgetPage(Plugin, this, ClientManager, DonationManager, "Gadgets", event.getPlayer()).purchaseGadget(event.getPlayer(), event.getGadget());
} }
} @EventHandler
public void updateTreasure(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (ShopPageBase<CosmeticManager, ? extends ShopBase<CosmeticManager>> shop : PlayerPageMap.values())
{
if (shop instanceof TreasurePage)
((TreasurePage) shop).update();
}
}}

View File

@ -0,0 +1,26 @@
package mineplex.core.cosmetic.ui.button;
import org.bukkit.entity.Player;
import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.SingleButton;
public class TreasureButton extends SingleButton
{
private Menu _menu;
public TreasureButton(Menu menu)
{
_menu = menu;
}
@Override
public void Clicked(Player player)
{
_menu.openTreasure(player);
}
}

View File

@ -1,5 +1,6 @@
package mineplex.core.cosmetic.ui.page; package mineplex.core.cosmetic.ui.page;
import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -17,6 +18,7 @@ import mineplex.core.cosmetic.ui.button.OpenMorphs;
import mineplex.core.cosmetic.ui.button.OpenMounts; import mineplex.core.cosmetic.ui.button.OpenMounts;
import mineplex.core.cosmetic.ui.button.OpenParticles; import mineplex.core.cosmetic.ui.button.OpenParticles;
import mineplex.core.cosmetic.ui.button.OpenPets; import mineplex.core.cosmetic.ui.button.OpenPets;
import mineplex.core.cosmetic.ui.button.TreasureButton;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType; import mineplex.core.gadget.types.GadgetType;
@ -40,18 +42,29 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
protected void BuildPage() protected void BuildPage()
{ {
AddItem(11, new ShopItem(175, DonationManager.Get(Player.getName()).getCoins() + " Coins", 1, false)); AddItem(11, new ShopItem(175, DonationManager.Get(Player.getName()).getCoins() + " Coins", 1, false));
AddItem(13, new ShopItem(Material.CHEST, C.cGold + Plugin.getInventoryManager().Get(Player).getItemCount("Treasure Chest") + " Treasure Chests", 1, false));
int treasureChestCount = Plugin.getInventoryManager().Get(Player).getItemCount("Treasure Chest");
/*
if (treasureChestCount >= 0)
{
AddButton(13, new ShopItem(Material.CHEST, C.cGold + treasureChestCount + " Treasure Chests", new String[] { ChatColor.RESET + "Click to Open Treasure Chest" }, 1, false), new TreasureButton(this));
}
else
{
*/
AddItem(13, new ShopItem(Material.CHEST, C.cGold + treasureChestCount + " Treasure Chests", 1, false));
//}
final GemBooster gemBoosterItem = new GemBooster(Plugin.getInventoryManager().Get(Player).getItemCount("Gem Booster")); final GemBooster gemBoosterItem = new GemBooster(Plugin.getInventoryManager().Get(Player).getItemCount("Gem Booster"));
if (DonationManager.Get(Player.getName()).GetBalance(CurrencyType.Coins) >= gemBoosterItem.GetCost(CurrencyType.Coins)) if (DonationManager.Get(Player.getName()).GetBalance(CurrencyType.Coins) >= gemBoosterItem.GetCost(CurrencyType.Coins))
{ {
AddButton(15, new ShopItem( AddButton(15, new ShopItem(
gemBoosterItem.GetDisplayMaterial(), gemBoosterItem.GetDisplayMaterial(),
gemBoosterItem.GetDisplayName(), gemBoosterItem.GetDisplayName(),
gemBoosterItem.GetDescription(), gemBoosterItem.GetDescription(),
1, 1,
false), false),
new SingleButton() new SingleButton()
{ {
@Override @Override
@ -72,24 +85,24 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
else else
{ {
AddItem(15, new ShopItem( AddItem(15, new ShopItem(
gemBoosterItem.GetDisplayMaterial(), gemBoosterItem.GetDisplayMaterial(),
gemBoosterItem.GetDisplayName(), gemBoosterItem.GetDisplayName(),
gemBoosterItem.GetDescription(), gemBoosterItem.GetDescription(),
1, 1,
false)); false));
} }
AddButton(27, new ShopItem(Material.NETHER_STAR, "Particle Effects", 1, false), new OpenParticles(this)); AddButton(27, new ShopItem(Material.NETHER_STAR, "Particle Effects", 1, false), new OpenParticles(this));
AddButton(29, new ShopItem(Material.BOW, "Gadgets", 1, false), new OpenGadgets(this)); AddButton(29, new ShopItem(Material.BOW, "Gadgets", 1, false), new OpenGadgets(this));
AddButton(31, new ShopItem(Material.LEASH, "Pets", 1, false), new OpenPets(this)); AddButton(31, new ShopItem(Material.LEASH, "Pets", 1, false), new OpenPets(this));
AddButton(33, new ShopItem(Material.IRON_BARDING, "Mounts", 1, false), new OpenMounts(this)); AddButton(33, new ShopItem(Material.IRON_BARDING, "Mounts", 1, false), new OpenMounts(this));
AddButton(35, new ShopItem(Material.LEATHER, "Morphs", 1, false), new OpenMorphs(this)); AddButton(35, new ShopItem(Material.LEATHER, "Morphs", 1, false), new OpenMorphs(this));
if (Plugin.getGadgetManager().getActive(Player, GadgetType.Particle) != null) if (Plugin.getGadgetManager().getActive(Player, GadgetType.Particle) != null)
{ {
final Gadget gadget = Plugin.getGadgetManager().getActive(Player, GadgetType.Particle); final Gadget gadget = Plugin.getGadgetManager().getActive(Player, GadgetType.Particle);
AddButton(36, AddButton(36,
new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), C.mItem + gadget.GetName(), new String[] {}, 1, false, false), new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), C.mItem + gadget.GetName(), new String[] {}, 1, false, false),
new SingleButton() new SingleButton()
{ {
@ -102,12 +115,12 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
} }
}); });
} }
if (Plugin.getGadgetManager().getActive(Player, GadgetType.Item) != null) if (Plugin.getGadgetManager().getActive(Player, GadgetType.Item) != null)
{ {
final Gadget gadget = Plugin.getGadgetManager().getActive(Player, GadgetType.Item); final Gadget gadget = Plugin.getGadgetManager().getActive(Player, GadgetType.Item);
AddButton(38, AddButton(38,
new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), C.mItem + gadget.GetName(), new String[] {}, 1, false, false), new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), C.mItem + gadget.GetName(), new String[] {}, 1, false, false),
new SingleButton() new SingleButton()
{ {
@ -120,7 +133,7 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
} }
}); });
} }
if (Plugin.getPetManager().hasActivePet(Player.getName())) if (Plugin.getPetManager().hasActivePet(Player.getName()))
{ {
AddButton(40, new ShopItem(Material.MONSTER_EGG, (byte)Plugin.getPetManager().getActivePet(Player.getName()).getType().getTypeId(), C.mItem + Plugin.getPetManager().getActivePet(Player.getName()).getCustomName(), new String[] {}, 1, false, false), AddButton(40, new ShopItem(Material.MONSTER_EGG, (byte)Plugin.getPetManager().getActivePet(Player.getName()).getType().getTypeId(), C.mItem + Plugin.getPetManager().getActivePet(Player.getName()).getCustomName(), new String[] {}, 1, false, false),
@ -135,12 +148,12 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
} }
}); });
} }
if (Plugin.getMountManager().getActive(Player) != null) if (Plugin.getMountManager().getActive(Player) != null)
{ {
final Mount<?> mount = Plugin.getMountManager().getActive(Player); final Mount<?> mount = Plugin.getMountManager().getActive(Player);
AddButton(42, AddButton(42,
new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), C.mItem + mount.GetName(), new String[] {}, 1, false, false), new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), C.mItem + mount.GetName(), new String[] {}, 1, false, false),
new SingleButton() new SingleButton()
{ {
@ -153,12 +166,12 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
} }
}); });
} }
if (Plugin.getGadgetManager().getActive(Player, GadgetType.Morph) != null) if (Plugin.getGadgetManager().getActive(Player, GadgetType.Morph) != null)
{ {
final Gadget gadget = Plugin.getGadgetManager().getActive(Player, GadgetType.Morph); final Gadget gadget = Plugin.getGadgetManager().getActive(Player, GadgetType.Morph);
AddButton(44, AddButton(44,
new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), C.mItem + gadget.GetName(), new String[] {}, 1, false, false), new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), C.mItem + gadget.GetName(), new String[] {}, 1, false, false),
new SingleButton() new SingleButton()
{ {
@ -178,6 +191,11 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
Shop.OpenPageForPlayer(player, new ParticlePage(Plugin, Shop, ClientManager, DonationManager, "Particles", player)); Shop.OpenPageForPlayer(player, new ParticlePage(Plugin, Shop, ClientManager, DonationManager, "Particles", player));
} }
public void openTreasure(Player player)
{
Shop.OpenPageForPlayer(player, new TreasurePage(Plugin, Shop, ClientManager, DonationManager, "Open Treasure Chest", player));
}
public void openGadgets(Player player) public void openGadgets(Player player)
{ {
Shop.OpenPageForPlayer(player, new GadgetPage(Plugin, Shop, ClientManager, DonationManager, "Gadgets", player)); Shop.OpenPageForPlayer(player, new GadgetPage(Plugin, Shop, ClientManager, DonationManager, "Gadgets", player));

View File

@ -0,0 +1,178 @@
package mineplex.core.cosmetic.ui.page;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import mineplex.core.account.CoreClientManager;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.page.ShopPageBase;
/**
* Created by Shaun on 8/22/2014.
*/
public class TreasurePage extends ShopPageBase<CosmeticManager, CosmeticShop>
{
/**
* This is unfinished
* TODO
*/
private static final int[] ROTATION_SLOTS = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 17, 26, 35, 34, 33, 32, 31, 30, 29, 28, 27, 18, 9 };
private static final List<Integer> CHEST_SLOTS = Arrays.asList(new Integer[] {3 + 9 + 9, 6 + 9 + 9, 2 + 9 + 9, 4 + 9 + 9, 5 + 9 + 9});
private static final List<ChatColor> CHEST_COLORS = Arrays.asList(new ChatColor[] {ChatColor.RED, ChatColor.GREEN, ChatColor.YELLOW, ChatColor.BLUE, ChatColor.AQUA, ChatColor.GOLD});
// Used to animate the gui
private int _ticks;
private Random _random;
// Used for blocks that rotate around the gui
private short _rotationColorOne = 0;
private short _rotationColorTwo = 0;
private boolean _rotationForwardOne = true;
private boolean _rotationForwardTwo = false;
private int _currentIndexOne = 4;
private int _currentIndexTwo = 4;
// Is the animation done, can the player select a chest?
public boolean _canSelectChest = false;
// Queues for Chest Colors and Slots
private LinkedList<ChatColor> _colors;
private LinkedList<Integer> _chestSlots;
public TreasurePage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, mineplex.core.donation.DonationManager donationManager, String name, Player player)
{
super(plugin, shop, clientManager, donationManager, name, player, 9 * 4);
_random = new Random();
// Shuffle random _colors and chest positions
_colors = new LinkedList<ChatColor>(CHEST_COLORS);
_chestSlots = new LinkedList<Integer>(CHEST_SLOTS);
Collections.shuffle(_colors, _random);
Collections.shuffle(_chestSlots, _random);
}
@Override
protected void BuildPage()
{
int treasureCount = Plugin.getInventoryManager().Get(Player).getItemCount("Treasure Chest");
_rotationColorOne = _ticks % 2 == 0 ? ((short) _random.nextInt(15)) : _rotationColorOne;
_rotationColorTwo = _ticks % 20 == 0 ? ((short) _random.nextInt(15)) : _rotationColorTwo;
ItemStack borderPane = new ItemStack(Material.STAINED_GLASS_PANE, 1, _canSelectChest ? (short) 7 : (short) 15);
// Set all the border panes
for (int row = 0; row < 4; row++)
{
if (row == 0 || row == 3)
{
for (int column = 0; column < 9; column++)
{
setItem(column, row, borderPane);
}
}
else
{
setItem(0, row, borderPane);
setItem(8, row, borderPane);
}
}
if (_ticks <= 21)
{
rotateBorderPanes();
}
if (_ticks == 0)
{
Player.playSound(Player.getEyeLocation(), Sound.ANVIL_USE, 4, 1);
}
else if (_ticks == 20)
{
Player.playSound(Player.getEyeLocation(), Sound.CHEST_OPEN, 4, 1);
}
else if (_ticks >= 30 && _ticks <= 120 && _ticks % 20 == 0)
{
ChatColor color = _colors.poll();
String colorName = color.name().toLowerCase();
colorName = colorName.substring(0, 1).toUpperCase() + colorName.substring(1);
String chestName = color + colorName + " Chest";
String[] lore = new String[] { ChatColor.RESET.toString() + ChatColor.WHITE + "Click to Open" };
Player.playSound(Player.getEyeLocation(), Sound.NOTE_PLING, 4, 1);
final int slot = _chestSlots.poll();
AddButton(slot, new ShopItem(Material.CHEST, chestName, lore, 1, false), new SingleButton()
{
@Override
public void Clicked(Player player)
{
if (_canSelectChest)
{
player.playSound(player.getLocation(), Sound.CHEST_OPEN, 1, 1);
}
}
});
}
else if (_ticks == 140)
{
Player.playSound(Player.getEyeLocation(), Sound.LEVEL_UP, 4, 1F);
ItemStack is = new ItemStack(Material.BOOK);
ItemMeta meta = is.getItemMeta();
meta.setDisplayName(ChatColor.RESET.toString() + "Select a Chest");
is.setItemMeta(meta);
setItem(9 + 4, is);
addGlow(9 + 4);
_canSelectChest = true;
}
_ticks++;
}
public void rotateBorderPanes()
{
ItemStack whitePane = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short) 0);
ItemStack paneOne = new ItemStack(Material.STAINED_GLASS_PANE, 1, _rotationColorOne);
ItemStack paneTwo = new ItemStack(Material.STAINED_GLASS_PANE, 1, _rotationColorTwo);
_currentIndexOne = (_currentIndexOne + (_rotationForwardOne ? 1 : -1)) % ROTATION_SLOTS.length;
if (_currentIndexOne < 0)
_currentIndexOne = _currentIndexOne + ROTATION_SLOTS.length;
_currentIndexTwo = (_currentIndexTwo + (_rotationForwardTwo ? 1 : -1)) % ROTATION_SLOTS.length;
if (_currentIndexTwo < 0)
_currentIndexTwo = _currentIndexTwo + ROTATION_SLOTS.length;
if (_currentIndexOne == _currentIndexTwo)
{
setItem(ROTATION_SLOTS[_currentIndexOne], whitePane);
}
else
{
setItem(ROTATION_SLOTS[_currentIndexOne], paneOne);
setItem(ROTATION_SLOTS[_currentIndexTwo], paneTwo);
}
}
public void update()
{
BuildPage();
}
}

View File

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -25,11 +26,12 @@ import mineplex.core.disguise.DisguiseManager;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.event.GadgetCollideEntityEvent; import mineplex.core.gadget.event.GadgetCollideEntityEvent;
import mineplex.core.gadget.gadgets.*; import mineplex.core.gadget.gadgets.*;
import mineplex.core.gadget.types.OutfitGadget.ArmorSlot;
import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType; import mineplex.core.gadget.types.GadgetType;
import mineplex.core.gadget.types.ItemGadget; import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.gadget.types.MorphGadget; import mineplex.core.gadget.types.MorphGadget;
import mineplex.core.gadget.types.MorphGadget.ArmorSlot; import mineplex.core.gadget.types.OutfitGadget;
import mineplex.core.gadget.types.MusicGadget; import mineplex.core.gadget.types.MusicGadget;
import mineplex.core.gadget.types.ParticleGadget; import mineplex.core.gadget.types.ParticleGadget;
import mineplex.core.inventory.InventoryManager; import mineplex.core.inventory.InventoryManager;
@ -80,36 +82,48 @@ public class GadgetManager extends MiniPlugin
_gadgets = new NautHashMap<GadgetType, List<Gadget>>(); _gadgets = new NautHashMap<GadgetType, List<Gadget>>();
// Items // Items
addGadget(new ItemPaintballGun(this)); addGadget(new ItemEtherealPearl(this));
addGadget(new ItemBatGun(this));
//addGadget(new ItemGemBomb(this));
addGadget(new ItemCoinBomb(this));
addGadget(new ItemFirework(this)); addGadget(new ItemFirework(this));
addGadget(new ItemTNT(this)); addGadget(new ItemTNT(this));
addGadget(new ItemFleshHook(this));
addGadget(new ItemMelonLauncher(this)); addGadget(new ItemMelonLauncher(this));
addGadget(new ItemFleshHook(this));
addGadget(new ItemPaintballGun(this));
addGadget(new ItemBatGun(this));
addGadget(new ItemCoinBomb(this));
//addGadget(new ItemFootball(this)); //addGadget(new ItemFootball(this));
//addGadget(new ItemDuelingSword(this)); //addGadget(new ItemDuelingSword(this));
// Costume
addGadget(new OutfitRaveSuit(this, "Rave Helmet", 10000, ArmorSlot.Helmet, Material.LEATHER_HELMET, (byte)0));
addGadget(new OutfitRaveSuit(this, "Rave Shirt", 10000, ArmorSlot.Chest, Material.LEATHER_CHESTPLATE, (byte)0));
addGadget(new OutfitRaveSuit(this, "Rave Pants", 10000, ArmorSlot.Legs, Material.LEATHER_LEGGINGS, (byte)0));
addGadget(new OutfitRaveSuit(this, "Rave Boots", 10000, ArmorSlot.Boots, Material.LEATHER_BOOTS, (byte)0));
addGadget(new OutfitSpaceSuit(this, "Space Helmet", 10000, ArmorSlot.Helmet, Material.GLASS, (byte)0));
addGadget(new OutfitSpaceSuit(this, "Space Suit", 10000, ArmorSlot.Chest, Material.GOLD_CHESTPLATE, (byte)0));
addGadget(new OutfitSpaceSuit(this, "Space Pants", 10000, ArmorSlot.Legs, Material.GOLD_LEGGINGS, (byte)0));
addGadget(new OutfitSpaceSuit(this, "Space Boots", 10000, ArmorSlot.Boots, Material.GOLD_BOOTS, (byte)0));
// Morphs // Morphs
addGadget(new MorphBlaze(this));
addGadget(new MorphPumpkinKing(this));
addGadget(new MorphCreeper(this));
addGadget(new MorphChicken(this));
addGadget(new MorphPig(this));
addGadget(new MorphBat(this));
addGadget(new MorphBlock(this));
addGadget(new MorphVillager(this)); addGadget(new MorphVillager(this));
addGadget(new MorphCow(this)); addGadget(new MorphCow(this));
addGadget(new MorphChicken(this));
addGadget(new MorphBlock(this));
addGadget(new MorphEnderman(this));
addGadget(new MorphBat(this));
addGadget(new MorphNotch(this)); addGadget(new MorphNotch(this));
addGadget(new MorphPumpkinKing(this));
addGadget(new MorphPig(this));
addGadget(new MorphCreeper(this));
addGadget(new MorphBlaze(this));
// Particles // Particles
addGadget(new ParticleGreen(this));
addGadget(new ParticleFoot(this)); addGadget(new ParticleFoot(this));
addGadget(new ParticleEnchant(this)); addGadget(new ParticleEnchant(this));
addGadget(new ParticleFireRings(this)); addGadget(new ParticleFireRings(this));
addGadget(new ParticleRain(this)); addGadget(new ParticleRain(this));
addGadget(new ParticleHelix(this)); addGadget(new ParticleHelix(this));
addGadget(new ParticleGreen(this));
// Music // Music
addGadget(new MusicGadget(this, "13 Disc", new String[] {""}, 5000, 2256, 178000)); addGadget(new MusicGadget(this, "13 Disc", new String[] {""}, 5000, 2256, 178000));
@ -158,7 +172,7 @@ public class GadgetManager extends MiniPlugin
} }
// Disallows two armor gadgets in same slot. // Disallows two armor gadgets in same slot.
public void RemoveArmor(Player player, ArmorSlot slot) public void RemoveOutfit(Player player, ArmorSlot slot)
{ {
for (GadgetType gadgetType : _gadgets.keySet()) for (GadgetType gadgetType : _gadgets.keySet())
{ {
@ -166,7 +180,7 @@ public class GadgetManager extends MiniPlugin
{ {
if (gadget instanceof MorphGadget) if (gadget instanceof MorphGadget)
{ {
MorphGadget armor = (MorphGadget) gadget; OutfitGadget armor = (OutfitGadget) gadget;
if (armor.GetSlot() == slot) if (armor.GetSlot() == slot)
{ {
@ -224,7 +238,7 @@ public class GadgetManager extends MiniPlugin
} }
} }
} }
public void DisableAll() public void DisableAll()
{ {
for (GadgetType gadgetType : _gadgets.keySet()) for (GadgetType gadgetType : _gadgets.keySet())
@ -320,6 +334,8 @@ public class GadgetManager extends MiniPlugin
@EventHandler @EventHandler
public void quit(PlayerQuitEvent event) public void quit(PlayerQuitEvent event)
{ {
DisableAll(event.getPlayer());
_lastMove.remove(event.getPlayer()); _lastMove.remove(event.getPlayer());
_playerActiveGadgetMap.remove(event.getPlayer()); _playerActiveGadgetMap.remove(event.getPlayer());

View File

@ -0,0 +1,94 @@
package mineplex.core.gadget.gadgets;
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
import org.bukkit.Material;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.EnderPearl;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class ItemEtherealPearl extends ItemGadget
{
public ItemEtherealPearl(GadgetManager manager)
{
super(manager, "Ethereal Pearl", new String[]
{
C.cWhite + "Take a ride through the skies",
C.cWhite + "on your very own Ethereal Pearl!",
},
-1,
Material.ENDER_PEARL, (byte)0,
500, new Ammo("Ethereal Pearl", "50 Bats", Material.ENDER_PEARL, (byte)0, new String[] { C.cWhite + "50 Pearls to get around with!" }, 500, 50));
}
@Override
public void DisableCustom(Player player)
{
super.DisableCustom(player);
}
@Override
public void ActivateCustom(Player player)
{
player.eject();
player.leaveVehicle();
EnderPearl pearl = player.launchProjectile(EnderPearl.class);
pearl.setPassenger(player);
//Inform
UtilPlayer.message(player, F.main("Skill", "You threw " + F.skill(GetName()) + "."));
//Dont Collide
((CraftPlayer)player).getHandle().spectating = true;
UtilInv.Update(player);
}
@EventHandler
public void teleportCancel(PlayerTeleportEvent event)
{
if (event.getCause() == TeleportCause.ENDER_PEARL)
{
//Firework
FireworkEffect effect = FireworkEffect.builder().flicker(false).withColor(Color.PURPLE).with(Type.BALL).trail(true).build();
try
{
UtilFirework.playFirework(event.getTo(), effect);
}
catch (Exception e)
{
e.printStackTrace();
}
event.setCancelled(true);
}
}
@EventHandler
public void disableNoCollide(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
return;
for (Player player : UtilServer.getPlayers())
if (player.getVehicle() == null)
((CraftPlayer)player).getHandle().spectating = false;
}
}

View File

@ -50,7 +50,7 @@ public class MorphBat extends MorphGadget implements IThrown
C.cYellow + "Tap Sneak" + C.cGray + " to use " + C.cGreen + "Poop", C.cYellow + "Tap Sneak" + C.cGray + " to use " + C.cGreen + "Poop",
}, },
40000, 40000,
ArmorSlot.Helmet, Material.SKULL_ITEM, (byte)1); Material.SKULL_ITEM, (byte)1);
} }
@Override @Override

View File

@ -31,7 +31,7 @@ public class MorphBlaze extends MorphGadget
C.cPurple + "Unlocked with Hero Rank", C.cPurple + "Unlocked with Hero Rank",
}, },
-1, -1,
ArmorSlot.Helmet, Material.FIRE, (byte)0); Material.FIRE, (byte)0);
} }
@Override @Override

View File

@ -34,7 +34,7 @@ public class MorphBlock extends MorphGadget
C.cYellow + "Stay Still" + C.cGray + " to use " + C.cGreen + "Solidify", C.cYellow + "Stay Still" + C.cGray + " to use " + C.cGreen + "Solidify",
}, },
30000, 30000,
ArmorSlot.Helmet, Material.EMERALD_BLOCK, (byte)0); Material.EMERALD_BLOCK, (byte)0);
} }
@Override @Override
@ -78,7 +78,7 @@ public class MorphBlock extends MorphGadget
if (event.getClickedBlock() == null) if (event.getClickedBlock() == null)
return; return;
if (UtilEvent.isAction(event, ActionType.L_BLOCK) || UtilEvent.isAction(event, ActionType.R_BLOCK)) if (!UtilEvent.isAction(event, ActionType.L_BLOCK) && !UtilEvent.isAction(event, ActionType.R_BLOCK))
return; return;
if (!Recharge.Instance.use(event.getPlayer(), GetName(), 500, false, false)) if (!Recharge.Instance.use(event.getPlayer(), GetName(), 500, false, false))

View File

@ -35,13 +35,13 @@ public class MorphChicken extends MorphGadget
{ {
super(manager, "Chicken Morph", new String[] super(manager, "Chicken Morph", new String[]
{ {
C.cWhite + "Soar through the air like an fat Chicken!", C.cWhite + "Soar through the air like a fat Chicken!",
" ", " ",
C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Egg Shot", C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Egg Shot",
C.cYellow + "Double Jump" + C.cGray + " to use " + C.cGreen + "Flap", C.cYellow + "Double Jump" + C.cGray + " to use " + C.cGreen + "Flap",
}, },
20000, 20000,
ArmorSlot.Helmet, Material.FEATHER, (byte)0); Material.FEATHER, (byte)0);
} }
@Override @Override

View File

@ -25,7 +25,7 @@ public class MorphCow extends MorphGadget
C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Moo", C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Moo",
}, },
6000, 6000,
ArmorSlot.Helmet, Material.LEATHER, (byte)0); Material.LEATHER, (byte)0);
} }
@Override @Override

View File

@ -40,7 +40,7 @@ public class MorphCreeper extends MorphGadget
C.cPurple + "Unlocked with Hero Rank", C.cPurple + "Unlocked with Hero Rank",
}, },
-1, -1,
ArmorSlot.Helmet, Material.SKULL_ITEM, (byte)4); Material.SKULL_ITEM, (byte)4);
} }
@Override @Override

View File

@ -0,0 +1,162 @@
package mineplex.core.gadget.gadgets;
import org.bukkit.Color;
import org.bukkit.Effect;
import org.bukkit.FireworkEffect;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerToggleFlightEvent;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.disguise.disguises.DisguiseEnderman;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.MorphGadget;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class MorphEnderman extends MorphGadget
{
public MorphEnderman(GadgetManager manager)
{
super(manager, "Enderman Morph", new String[]
{
C.cWhite + "Transforms the wearer into an Enderman!",
" ",
C.cYellow + "Double Jump" + C.cGray + " to use " + C.cGreen + "Blink",
},
30000,
Material.ENDER_PEARL, (byte)0);
}
@Override
public void EnableCustom(final Player player)
{
this.ApplyArmor(player);
DisguiseEnderman disguise = new DisguiseEnderman(player);
disguise.SetName(player.getName(), Manager.getClientManager().Get(player).GetRank());
disguise.SetCustomNameVisible(true);
Manager.getDisguiseManager().disguise(disguise);
}
@Override
public void DisableCustom(Player player)
{
this.RemoveArmor(player);
Manager.getDisguiseManager().undisguise(player);
}
@EventHandler
public void teleport(PlayerToggleFlightEvent event)
{
Player player = event.getPlayer();
if (player.getGameMode() == GameMode.CREATIVE)
return;
if (!IsActive(player))
return;
event.setCancelled(true);
player.setFlying(false);
//Disable Flight
player.setAllowFlight(false);
//Set Recharge
Recharge.Instance.use(player, GetName(), 2000, false, false);
//Smoke Trail
Block lastSmoke = player.getLocation().getBlock();
double curRange = 0;
while (curRange <= 16)
{
Location newTarget = player.getLocation().add(new Vector(0,0.2,0)).add(player.getLocation().getDirection().multiply(curRange));
if (!UtilBlock.airFoliage(newTarget.getBlock()) ||
!UtilBlock.airFoliage(newTarget.getBlock().getRelative(BlockFace.UP)))
break;
//Progress Forwards
curRange += 0.2;
//Smoke Trail
if (!lastSmoke.equals(newTarget.getBlock()))
{
lastSmoke.getWorld().playEffect(lastSmoke.getLocation(), Effect.SMOKE, 4);
}
lastSmoke = newTarget.getBlock();
}
//Modify Range
curRange -= 0.4;
if (curRange < 0)
curRange = 0;
//Destination
Location loc = player.getLocation().add(player.getLocation().getDirection().multiply(curRange).add(new Vector(0, 0.4, 0)));
if (curRange > 0)
{
//Firework
FireworkEffect effect = FireworkEffect.builder().flicker(false).withColor(Color.BLACK).with(Type.BALL).trail(false).build();
try
{
UtilFirework.playFirework(player.getEyeLocation(), effect);
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f);
}
catch (Exception e)
{
e.printStackTrace();
}
player.teleport(loc);
//Firework
try
{
UtilFirework.playFirework(player.getEyeLocation(), effect);
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f);
}
catch (Exception e)
{
e.printStackTrace();
}
}
player.setFallDistance(0);
}
@EventHandler
public void teleportUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player player : GetActive())
{
if (player.getGameMode() == GameMode.CREATIVE)
continue;
if (Recharge.Instance.usable(player, GetName()))
{
player.setAllowFlight(true);
}
}
}
}

View File

@ -24,12 +24,12 @@ public class MorphNotch extends MorphGadget
public MorphNotch(GadgetManager manager) public MorphNotch(GadgetManager manager)
{ {
super(manager, "Notch", new String[] super(manager, "Notch", new String[]
{ {
" ", " ",
C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Enforce EULA", C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Enforce EULA",
}, },
50000, 50000,
ArmorSlot.Helmet, Material.SKULL_ITEM, (byte)3); Material.SKULL_ITEM, (byte)3);
_notchProfile = new ProfileLoader(UUIDFetcher.getUUIDOf("Notch").toString(), "Notch").loadProfile(); _notchProfile = new ProfileLoader(UUIDFetcher.getUUIDOf("Notch").toString(), "Notch").loadProfile();
} }

View File

@ -41,7 +41,7 @@ public class MorphPig extends MorphGadget
C.cPurple + "Unlocked with Ultra Rank", C.cPurple + "Unlocked with Ultra Rank",
}, },
-1, -1,
ArmorSlot.Helmet, Material.PORK, (byte)0); Material.PORK, (byte)0);
} }
@Override @Override

View File

@ -26,7 +26,7 @@ public class MorphPumpkinKing extends MorphGadget
C.cYellow + "in the 2013 Halloween Horror Event.", C.cYellow + "in the 2013 Halloween Horror Event.",
}, },
-1, -1,
ArmorSlot.Helmet, Material.PUMPKIN, (byte)0); Material.PUMPKIN, (byte)0);
} }

View File

@ -27,7 +27,7 @@ public class MorphVillager extends MorphGadget
C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "HURRR", C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "HURRR",
}, },
12000, 12000,
ArmorSlot.Helmet, Material.EMERALD, (byte)0); Material.EMERALD, (byte)0);
} }
@Override @Override

View File

@ -0,0 +1,166 @@
package mineplex.core.gadget.gadgets;
import java.util.HashMap;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.LeatherArmorMeta;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilServer;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.OutfitGadget;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class OutfitRaveSuit extends OutfitGadget
{
private HashMap<String, Integer> _colorPhase = new HashMap<String, Integer>();
public OutfitRaveSuit(GadgetManager manager, String name,
int cost, ArmorSlot slot, Material mat, byte data)
{
super(manager, name, new String[] {"Wear the complete set for","awesome bonus effects!", "Bonus coming soon..."}, cost, slot, mat, data);
}
@Override
public void EnableCustom(Player player)
{
ApplyArmor(player);
_colorPhase.put(player.getName(), -1);
}
@Override
public void DisableCustom(Player player)
{
RemoveArmor(player);
_colorPhase.remove(player.getName());
}
@EventHandler
public void updateColor(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player player : UtilServer.getPlayers())
{
if (!IsActive(player))
continue;
//Get Item
ItemStack stack;
if (GetSlot() == ArmorSlot.Helmet)
{
stack = player.getInventory().getHelmet();
if (!UtilGear.isMat(stack, GetDisplayMaterial()))
{
Disable(player);
continue;
}
}
else if (GetSlot() == ArmorSlot.Chest)
{
stack = player.getInventory().getChestplate();
if (!UtilGear.isMat(stack, GetDisplayMaterial()))
{
Disable(player);
continue;
}
}
else if (GetSlot() == ArmorSlot.Legs)
{
stack = player.getInventory().getLeggings();
if (!UtilGear.isMat(stack, GetDisplayMaterial()))
{
Disable(player);
continue;
}
}
else if (GetSlot() == ArmorSlot.Boots)
{
stack = player.getInventory().getBoots();
if (!UtilGear.isMat(stack, GetDisplayMaterial()))
{
Disable(player);
continue;
}
}
else
{
continue;
}
//Rainbow
int phase = _colorPhase.get(player.getName());
LeatherArmorMeta meta = (LeatherArmorMeta)stack.getItemMeta();
if (phase == -1)
{
meta.setColor(Color.fromRGB(250, 0, 0));
_colorPhase.put(player.getName(), 0);
}
//Red > Yellow
else if (phase == 0)
{
meta.setColor(Color.fromRGB(250, Math.min(250, meta.getColor().getGreen() + 25), 0));
if (meta.getColor().getGreen() >= 250)
_colorPhase.put(player.getName(), 1);
}
//Yellow > Green
else if (phase == 1)
{
meta.setColor(Color.fromRGB(Math.max(0, meta.getColor().getRed() - 25), 250, 0));
if (meta.getColor().getRed() <= 0)
_colorPhase.put(player.getName(), 2);
}
//Green > Blue
else if (phase == 2)
{
meta.setColor(Color.fromRGB(0, Math.max(0, meta.getColor().getGreen() - 25), Math.min(250, meta.getColor().getBlue() + 25)));
if (meta.getColor().getGreen() <= 0)
_colorPhase.put(player.getName(), 3);
}
//Blue > Red
else if (phase == 3)
{
meta.setColor(Color.fromRGB(Math.min(250, meta.getColor().getRed() + 25), 0, Math.max(0, meta.getColor().getBlue() - 25)));
if (meta.getColor().getBlue() <= 0)
_colorPhase.put(player.getName(), 0);
}
stack.setItemMeta(meta);
}
}
//@EventHandler
public void debug(PlayerCommandPreprocessEvent event)
{
if (event.getMessage().contains("on"))
{
this.Enable(event.getPlayer());
event.setCancelled(true);
}
if (event.getMessage().contains("off"))
{
this.Disable(event.getPlayer());
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,28 @@
package mineplex.core.gadget.gadgets;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.OutfitGadget;
public class OutfitSpaceSuit extends OutfitGadget
{
public OutfitSpaceSuit(GadgetManager manager, String name,
int cost, ArmorSlot slot, Material mat, byte data)
{
super(manager, name, new String[] {"Wear the complete set for","awesome bonus effects!", "Bonus coming soon..."}, cost, slot, mat, data);
}
@Override
public void EnableCustom(Player player)
{
ApplyArmor(player);
}
@Override
public void DisableCustom(Player player)
{
RemoveArmor(player);
}
}

View File

@ -6,4 +6,5 @@ public enum GadgetType
Morph, Morph,
Particle, Particle,
MusicDisc, MusicDisc,
Costume,
} }

View File

@ -140,7 +140,10 @@ public abstract class ItemGadget extends Gadget
//Recharge //Recharge
if (!Recharge.Instance.use(player, GetName(), _recharge, _recharge > 1000, false)) if (!Recharge.Instance.use(player, GetName(), _recharge, _recharge > 1000, false))
return; {
UtilInv.Update(player);
return;
}
if (Manager.getInventoryManager().Get(player).getItemCount(GetName()) <= 0) if (Manager.getInventoryManager().Get(player).getItemCount(GetName()) <= 0)
{ {

View File

@ -10,28 +10,11 @@ import mineplex.core.itemstack.ItemStackFactory;
public abstract class MorphGadget extends Gadget public abstract class MorphGadget extends Gadget
{ {
public enum ArmorSlot public MorphGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data)
{
Helmet,
Chest,
Legs,
Boots
}
private ArmorSlot _slot;
public MorphGadget(GadgetManager manager, String name, String[] desc, int cost, ArmorSlot slot, Material mat, byte data)
{ {
super(manager, GadgetType.Morph, name, desc, cost, mat, data); super(manager, GadgetType.Morph, name, desc, cost, mat, data);
_slot = slot;
} }
public ArmorSlot GetSlot()
{
return _slot;
}
public void ApplyArmor(Player player) public void ApplyArmor(Player player)
{ {
Manager.RemoveMorph(player); Manager.RemoveMorph(player);

View File

@ -0,0 +1,68 @@
package mineplex.core.gadget.types;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.itemstack.ItemStackFactory;
public abstract class OutfitGadget extends Gadget
{
public enum ArmorSlot
{
Helmet,
Chest,
Legs,
Boots
}
private ArmorSlot _slot;
public OutfitGadget(GadgetManager manager, String name, String[] desc, int cost, ArmorSlot slot, Material mat, byte data)
{
super(manager, GadgetType.Costume, name, desc, cost, mat, data);
_slot = slot;
}
public ArmorSlot GetSlot()
{
return _slot;
}
public void ApplyArmor(Player player)
{
Manager.RemoveMorph(player);
_active.add(player);
UtilPlayer.message(player, F.main("Gadget", "You put on " + F.elem(GetName()) + "."));
if (_slot == ArmorSlot.Helmet) player.getInventory().setHelmet(
ItemStackFactory.Instance.CreateStack(GetDisplayMaterial().getId(), GetDisplayData(), 1, GetName()));
else if (_slot == ArmorSlot.Chest) player.getInventory().setChestplate(
ItemStackFactory.Instance.CreateStack(GetDisplayMaterial().getId(), GetDisplayData(), 1, GetName()));
else if (_slot == ArmorSlot.Legs) player.getInventory().setLeggings(
ItemStackFactory.Instance.CreateStack(GetDisplayMaterial().getId(), GetDisplayData(), 1, GetName()));
else if (_slot == ArmorSlot.Boots) player.getInventory().setBoots(
ItemStackFactory.Instance.CreateStack(GetDisplayMaterial().getId(), GetDisplayData(), 1, GetName()));
}
public void RemoveArmor(Player player)
{
if (!_active.remove(player))
return;
UtilPlayer.message(player, F.main("Gadget", "You took off " + F.elem(GetName()) + "."));
if (_slot == ArmorSlot.Helmet) player.getInventory().setHelmet(null);
else if (_slot == ArmorSlot.Chest) player.getInventory().setChestplate(null);
else if (_slot == ArmorSlot.Legs) player.getInventory().setLeggings(null);
else if (_slot == ArmorSlot.Boots) player.getInventory().setBoots(null);
}
}

View File

@ -53,7 +53,7 @@ public class MountSheep extends HorseMount
DisguiseSheep disguise = new DisguiseSheep(horse); DisguiseSheep disguise = new DisguiseSheep(horse);
disguise.SetName(player.getName(), Manager.getClientManager().Get(player).GetRank()); disguise.SetName(player.getName(), Manager.getClientManager().Get(player).GetRank());
disguise.SetCustomNameVisible(true); disguise.SetCustomNameVisible(true);
disguise.setColor(DyeColor.getByColor(org.bukkit.Color.fromRGB(100, 0, 200))); //disguise.setColor(DyeColor.getByColor(org.bukkit.Color.fromRGB(100, 0, 200)));
Manager.getDisguiseManager().disguise(disguise); Manager.getDisguiseManager().disguise(disguise);
//Inform //Inform

View File

@ -6,6 +6,7 @@ import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftInventoryCustom;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.ItemStack;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClient; import mineplex.core.account.CoreClient;
@ -73,7 +74,7 @@ public abstract class ShopPageBase<PluginType extends MiniPlugin, ShopType exten
} }
protected abstract void BuildPage(); protected abstract void BuildPage();
protected void AddItem(int slot, ShopItem item) protected void AddItem(int slot, ShopItem item)
{ {
if (slot > inventory.getSize() - 1) if (slot > inventory.getSize() - 1)
@ -169,4 +170,9 @@ public abstract class ShopPageBase<PluginType extends MiniPlugin, ShopType exten
clear(); clear();
BuildPage(); BuildPage();
} }
public void setItem(int column, int row, ItemStack itemStack)
{
setItem(column + (row * 9), itemStack);
}
} }

View File

@ -66,7 +66,7 @@ public class Hub extends JavaPlugin implements IRelation
saveConfig(); saveConfig();
String webServerAddress = getConfig().getString(WEB_CONFIG); String webServerAddress = getConfig().getString(WEB_CONFIG);
Logger.initialize(this); Logger.initialize(this);
//Static Modules //Static Modules

View File

@ -1,7 +1,7 @@
package mineplex.hub; package mineplex.hub;
public class HubClient public class HubClient
{ {
public String ScoreboardString = " Hello, I am a big friendly cat!"; public String ScoreboardString = " Hello, I am a big friendly cat!";
public int ScoreboardIndex = 0; public int ScoreboardIndex = 0;
@ -23,7 +23,7 @@ public class HubClient
private int _lastGemCount = 0; private int _lastGemCount = 0;
private int _lastCoinCount = 0; private int _lastCoinCount = 0;
public HubClient(String name) public HubClient(String name)
{ {

View File

@ -41,6 +41,7 @@ import mineplex.core.MiniClientPlugin;
import mineplex.core.account.CoreClient; import mineplex.core.account.CoreClient;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.account.event.RetrieveClientInformationEvent; import mineplex.core.account.event.RetrieveClientInformationEvent;
import mineplex.core.achievement.AchievementManager;
import mineplex.core.blockrestore.BlockRestore; import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
@ -91,35 +92,36 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent;
public class HubManager extends MiniClientPlugin<HubClient> public class HubManager extends MiniClientPlugin<HubClient>
{ {
public String Mode = "Normal"; public String Mode = "Normal";
private BlockRestore _blockRestore; private BlockRestore _blockRestore;
private CoreClientManager _clientManager; private CoreClientManager _clientManager;
private ConditionManager _conditionManager; private ConditionManager _conditionManager;
private DonationManager _donationManager; private DonationManager _donationManager;
private DisguiseManager _disguiseManager; private DisguiseManager _disguiseManager;
private PartyManager _partyManager; private PartyManager _partyManager;
private ForcefieldManager _forcefieldManager; private ForcefieldManager _forcefieldManager;
private Portal _portal; private Portal _portal;
private StatsManager _statsManager; private StatsManager _statsManager;
private GadgetManager _gadgetManager; private GadgetManager _gadgetManager;
private MountManager _mountManager; private MountManager _mountManager;
private VisibilityManager _visibilityManager; private VisibilityManager _visibilityManager;
private TutorialManager _tutorialManager; private TutorialManager _tutorialManager;
private TextManager _textCreator; private TextManager _textCreator;
private ParkourManager _parkour; private ParkourManager _parkour;
private PreferencesManager _preferences; private PreferencesManager _preferences;
private InventoryManager _inventoryManager; private InventoryManager _inventoryManager;
private NewsManager _news; private NewsManager _news;
private PollManager _pollManager; private AchievementManager _achievementManager;
private PollManager _pollManager;
private Location _spawn; private Location _spawn;
private int _scoreboardTick = 0; private int _scoreboardTick = 0;
private HashMap<Player, Scoreboard> _scoreboards = new HashMap<Player, Scoreboard>(); private HashMap<Player, Scoreboard> _scoreboards = new HashMap<Player, Scoreboard>();
private String _pigStacker = "0 - Nobody"; private String _pigStacker = "0 - Nobody";
private ItemStack _ruleBook = null; private ItemStack _ruleBook = null;
private boolean _shuttingDown; private boolean _shuttingDown;
@ -167,6 +169,8 @@ public class HubManager extends MiniClientPlugin<HubClient>
AddCommand(new ForcefieldRadius(_forcefieldManager)); AddCommand(new ForcefieldRadius(_forcefieldManager));
_statsManager = new StatsManager(plugin); _statsManager = new StatsManager(plugin);
_achievementManager = new AchievementManager(_statsManager, _clientManager, _donationManager);
_achievementManager.setGiveInterfaceItem(true);
((CraftWorld)Bukkit.getWorlds().get(0)).getHandle().pvpMode = true; ((CraftWorld)Bukkit.getWorlds().get(0)).getHandle().pvpMode = true;

View File

@ -36,7 +36,7 @@ public class HubRepository
private Connection _connection = null; private Connection _connection = null;
public void initialize(boolean us) public void initialize(boolean us)
{ {
_us = us; _us = us;

View File

@ -19,6 +19,7 @@ import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.disguise.disguises.DisguiseBat; import mineplex.core.disguise.disguises.DisguiseBat;
import mineplex.core.disguise.disguises.DisguiseChicken; import mineplex.core.disguise.disguises.DisguiseChicken;
import mineplex.core.disguise.disguises.DisguiseCreeper; import mineplex.core.disguise.disguises.DisguiseCreeper;
import mineplex.core.disguise.disguises.DisguiseEnderman;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.hub.HubManager; import mineplex.hub.HubManager;
@ -44,7 +45,7 @@ public class JumpManager extends MiniPlugin
//Chicken Cancel //Chicken Cancel
DisguiseBase disguise = Manager.GetDisguise().getDisguise(player); DisguiseBase disguise = Manager.GetDisguise().getDisguise(player);
if (disguise != null && (disguise instanceof DisguiseChicken || disguise instanceof DisguiseBat)) if (disguise != null && (disguise instanceof DisguiseChicken || disguise instanceof DisguiseBat || disguise instanceof DisguiseEnderman))
return; return;
event.setCancelled(true); event.setCancelled(true);

View File

@ -43,16 +43,9 @@ public class TextManager extends MiniPlugin
arcadeGames = new String[] arcadeGames = new String[]
{ {
"ONE IN THE QUIVER",
"DRAGON ESCAPE", "DRAGON ESCAPE",
"MILK THE COW",
"SUPER SPLEEF", "SUPER SPLEEF",
"DEATH TAG", "SHEEP QUEST",
"TURF WARS",
"DRAGONS",
"RUNNER",
"BACON BRAWL",
"SQUID SAUCE"
}; };
CreateText(); CreateText();
@ -77,6 +70,15 @@ public class TextManager extends MiniPlugin
UtilText.MakeText("ARCADE", locArcade, faceArcade, 159, (byte)5, TextAlign.CENTER); UtilText.MakeText("ARCADE", locArcade, faceArcade, 159, (byte)5, TextAlign.CENTER);
UtilText.MakeText("ARCADE", locArcade.clone().add(0, 0, 1), faceArcade, 159, (byte)15, TextAlign.CENTER); UtilText.MakeText("ARCADE", locArcade.clone().add(0, 0, 1), faceArcade, 159, (byte)15, TextAlign.CENTER);
UtilText.MakeText(GetArcadeText(0), locArcade.clone().add(0, 14, 15), faceArcade, 159, (byte)4, TextAlign.CENTER);
UtilText.MakeText(GetArcadeText(0), locArcade.clone().add(0, 14, 16), faceArcade, 159, (byte)15, TextAlign.CENTER);
UtilText.MakeText(GetArcadeText(1), locArcade.clone().add(0, 21, 15), faceArcade, 159, (byte)1, TextAlign.CENTER);
UtilText.MakeText(GetArcadeText(1), locArcade.clone().add(0, 21, 16), faceArcade, 159, (byte)15, TextAlign.CENTER);
UtilText.MakeText(GetArcadeText(2), locArcade.clone().add(0, 28, 15), faceArcade, 159, (byte)14, TextAlign.CENTER);
UtilText.MakeText(GetArcadeText(2), locArcade.clone().add(0, 28, 16), faceArcade, 159, (byte)15, TextAlign.CENTER);
//Survival //Survival
UtilText.MakeText("SURVIVAL", locSurvival, faceSurvival, 159, (byte)5, TextAlign.CENTER); UtilText.MakeText("SURVIVAL", locSurvival, faceSurvival, 159, (byte)5, TextAlign.CENTER);
UtilText.MakeText("SURVIVAL", locSurvival.clone().add(-1, 0, 0), faceSurvival, 159, (byte)15, TextAlign.CENTER); UtilText.MakeText("SURVIVAL", locSurvival.clone().add(-1, 0, 0), faceSurvival, 159, (byte)15, TextAlign.CENTER);

View File

@ -287,9 +287,9 @@ public class MapParser extends JavaPlugin implements Listener
for (Player player : UtilServer.getPlayers()) for (Player player : UtilServer.getPlayers())
{ {
player.sendMessage(C.cGold + msg); player.sendMessage(C.cGold + msg);
System.out.println("[Announce] " + msg);
} }
System.out.println("[Announce] " + msg);
} }
public boolean DoesMapExist(String mapName, GameType gameType) public boolean DoesMapExist(String mapName, GameType gameType)

View File

@ -22,36 +22,6 @@ import org.bukkit.event.player.*;
public class Longshot extends Skill public class Longshot extends Skill
{ {
public static class LongshotHitEvent extends ProjectileHitEvent
{
private static final HandlerList handlers = new HandlerList();
public static HandlerList getHandlerList()
{
return handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
private final double _length;
public LongshotHitEvent(Projectile projectile, double length)
{
super(projectile);
_length = length;
}
public double getLength()
{
return _length;
}
}
private HashMap<Entity, Location> _arrows = new HashMap<Entity, Location>(); private HashMap<Entity, Location> _arrows = new HashMap<Entity, Location>();
public Longshot(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) public Longshot(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels)
@ -109,8 +79,6 @@ public class Longshot extends Skill
double damage = Math.min(5 + 5 * level, (length / (4 - 0.5 * level)) - 3); double damage = Math.min(5 + 5 * level, (length / (4 - 0.5 * level)) - 3);
event.AddMod(damager.getName(), GetName(), damage, damage > 0); event.AddMod(damager.getName(), GetName(), damage, damage > 0);
Bukkit.getPluginManager().callEvent(new LongshotHitEvent(projectile, length));
} }
@EventHandler @EventHandler

View File

@ -210,8 +210,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation
} }
_statsManager = new StatsManager(plugin); _statsManager = new StatsManager(plugin);
_taskManager = new TaskManager(plugin, webAddress); _taskManager = new TaskManager(plugin, webAddress);
_achievementManager = new AchievementManager(_statsManager); _achievementManager = new AchievementManager(_statsManager, clientManager, donationManager);
_inventoryManager = inventoryManager; _inventoryManager = inventoryManager;
_cosmeticManager = cosmeticManager; _cosmeticManager = cosmeticManager;
_portal = portal; _portal = portal;
@ -814,6 +814,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation
{ {
return _serverConfig.Tournament; return _serverConfig.Tournament;
} }
public int GetDesiredPlayerAmount()
{
return _serverConfig.MaxPlayers;
}
@EventHandler @EventHandler
public void ObserverQuit(GameStateChangeEvent event) public void ObserverQuit(GameStateChangeEvent event)

View File

@ -26,6 +26,7 @@ import nautilus.game.arcade.game.games.halloween.Halloween;
import nautilus.game.arcade.game.games.hideseek.HideSeek; import nautilus.game.arcade.game.games.hideseek.HideSeek;
import nautilus.game.arcade.game.games.micro.Micro; import nautilus.game.arcade.game.games.micro.Micro;
import nautilus.game.arcade.game.games.milkcow.MilkCow; import nautilus.game.arcade.game.games.milkcow.MilkCow;
import nautilus.game.arcade.game.games.minestrike.MineStrike;
import nautilus.game.arcade.game.games.mineware.MineWare; import nautilus.game.arcade.game.games.mineware.MineWare;
import nautilus.game.arcade.game.games.quiver.Quiver; import nautilus.game.arcade.game.games.quiver.Quiver;
import nautilus.game.arcade.game.games.quiver.QuiverTeams; import nautilus.game.arcade.game.games.quiver.QuiverTeams;
@ -78,6 +79,7 @@ public class GameFactory
else if (gameType == GameType.Halloween) return new Halloween(_manager); else if (gameType == GameType.Halloween) return new Halloween(_manager);
else if (gameType == GameType.HideSeek) return new HideSeek(_manager); else if (gameType == GameType.HideSeek) return new HideSeek(_manager);
else if (gameType == GameType.Micro) return new Micro(_manager); else if (gameType == GameType.Micro) return new Micro(_manager);
//else if (gameType == GameType.MineStrike) return new MineStrike(_manager);
else if (gameType == GameType.MineWare) return new MineWare(_manager); else if (gameType == GameType.MineWare) return new MineWare(_manager);
else if (gameType == GameType.MilkCow) return new MilkCow(_manager); else if (gameType == GameType.MilkCow) return new MilkCow(_manager);
else if (gameType == GameType.Paintball) return new Paintball(_manager); else if (gameType == GameType.Paintball) return new Paintball(_manager);

View File

@ -27,6 +27,7 @@ public enum GameType
SurvivalGames("Survival Games"), SurvivalGames("Survival Games"),
SurvivalGamesTeams("Survival Games Teams"), SurvivalGamesTeams("Survival Games Teams"),
Micro("Micro Battle"), Micro("Micro Battle"),
MineStrike("MineStrike"),
MineWare("MineWare"), MineWare("MineWare"),
MilkCow("Milk the Cow"), MilkCow("Milk the Cow"),
Paintball("Super Paintball"), Paintball("Super Paintball"),

View File

@ -25,6 +25,8 @@ import nautilus.game.arcade.stats.DeathsStatTracker;
import nautilus.game.arcade.stats.KillsStatTracker; import nautilus.game.arcade.stats.KillsStatTracker;
import nautilus.game.arcade.stats.LoseStatTracker; import nautilus.game.arcade.stats.LoseStatTracker;
import nautilus.game.arcade.stats.StatTracker; import nautilus.game.arcade.stats.StatTracker;
import nautilus.game.arcade.stats.TeamDeathsStatTracker;
import nautilus.game.arcade.stats.TeamKillsStatTracker;
import nautilus.game.arcade.stats.WinStatTracker; import nautilus.game.arcade.stats.WinStatTracker;
import nautilus.game.arcade.world.WorldData; import nautilus.game.arcade.world.WorldData;
@ -250,7 +252,9 @@ public abstract class Game implements Listener
new WinStatTracker(this), new WinStatTracker(this),
new LoseStatTracker(this), new LoseStatTracker(this),
new DamageDealtStatTracker(this), new DamageDealtStatTracker(this),
new DamageTakenStatTracker(this) new DamageTakenStatTracker(this),
new TeamDeathsStatTracker(this),
new TeamKillsStatTracker(this)
); );
System.out.println("Loading " + GetName() + "..."); System.out.println("Loading " + GetName() + "...");
@ -680,6 +684,9 @@ public abstract class Game implements Listener
public GameTeam GetTeam(Player player) public GameTeam GetTeam(Player player)
{ {
if (player == null)
return null;
for (GameTeam team : _teamList) for (GameTeam team : _teamList)
if (team.HasPlayer(player)) if (team.HasPlayer(player))
return team; return team;

View File

@ -8,6 +8,9 @@ import nautilus.game.arcade.*;
import nautilus.game.arcade.events.*; import nautilus.game.arcade.events.*;
import nautilus.game.arcade.game.GameTeam.*; import nautilus.game.arcade.game.GameTeam.*;
import nautilus.game.arcade.kit.*; import nautilus.game.arcade.kit.*;
import nautilus.game.arcade.stats.TeamDeathsStatTracker;
import nautilus.game.arcade.stats.TeamKillsStatTracker;
import org.bukkit.entity.*; import org.bukkit.entity.*;
import org.bukkit.event.*; import org.bukkit.event.*;
import org.bukkit.event.player.*; import org.bukkit.event.player.*;

View File

@ -39,6 +39,7 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilWorld;
import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
@ -48,6 +49,7 @@ import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType; import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.events.GameStateChangeEvent;
@ -63,6 +65,7 @@ import nautilus.game.arcade.ore.OreObsfucation;
import nautilus.game.arcade.stats.BridgesSniperStatTracker; import nautilus.game.arcade.stats.BridgesSniperStatTracker;
import nautilus.game.arcade.stats.DeathBomberStatTracker; import nautilus.game.arcade.stats.DeathBomberStatTracker;
import nautilus.game.arcade.stats.FastKillsStatTracker; import nautilus.game.arcade.stats.FastKillsStatTracker;
import nautilus.game.arcade.stats.FoodForTheMassesStatTracker;
import nautilus.game.arcade.stats.TntMinerStatTracker; import nautilus.game.arcade.stats.TntMinerStatTracker;
public class Bridge extends TeamGame implements OreObsfucation public class Bridge extends TeamGame implements OreObsfucation
@ -180,6 +183,7 @@ public class Bridge extends TeamGame implements OreObsfucation
_tournament = Manager.IsTournamentServer(); _tournament = Manager.IsTournamentServer();
registerStatTrackers( registerStatTrackers(
new FoodForTheMassesStatTracker(this),
new BridgesSniperStatTracker(this), new BridgesSniperStatTracker(this),
new TntMinerStatTracker(this), new TntMinerStatTracker(this),
new FastKillsStatTracker(this, 4, 10, "Rampage"), new FastKillsStatTracker(this, 4, 10, "Rampage"),
@ -343,24 +347,7 @@ public class Bridge extends TeamGame implements OreObsfucation
} }
} }
@EventHandler
public void ChestDeny(BlockBreakEvent event)
{
if (_bridgesDown)
return;
if (event.getBlock().getType() != Material.CHEST)
return;
for (Location loc : WorldData.GetCustomLocs("54"))
{
if (loc.getBlock().equals(event.getBlock()))
{
event.setCancelled(true);
return;
}
}
}
private void ParseOre(ArrayList<Location> teamOre) private void ParseOre(ArrayList<Location> teamOre)
{ {
@ -1038,6 +1025,8 @@ public class Bridge extends TeamGame implements OreObsfucation
blockIterator.remove(); blockIterator.remove();
} }
} }
@EventHandler(priority = EventPriority.LOW) @EventHandler(priority = EventPriority.LOW)
public void BucketEmpty(PlayerBucketEmptyEvent event) public void BucketEmpty(PlayerBucketEmptyEvent event)
@ -1363,4 +1352,91 @@ public class Bridge extends TeamGame implements OreObsfucation
{ {
return _bridgesDown; return _bridgesDown;
} }
@EventHandler
public void CheatChestBreak(BlockBreakEvent event)
{
if (_bridgesDown)
return;
if (event.getBlock().getType() != Material.CHEST)
return;
for (Location loc : WorldData.GetCustomLocs("54"))
{
if (loc.getBlock().equals(event.getBlock()))
{
cheaterKill(event.getPlayer());
event.setCancelled(true);
return;
}
}
}
@EventHandler
public void CheatChestInteract(PlayerInteractEvent event)
{
if (_bridgesDown)
return;
if (event.getClickedBlock() == null)
return;
if (event.getClickedBlock().getType() != Material.CHEST)
return;
for (Location loc : WorldData.GetCustomLocs("54"))
{
if (loc.getBlock().equals(event.getClickedBlock()))
{
cheaterKill(event.getPlayer());
event.setCancelled(true);
return;
}
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void PreBridgeDamage(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
if (_bridgesDown || event.GetProjectile() != null)
return;
GameTeam damageeTeam = GetTeam(event.GetDamageePlayer());
GameTeam damagerTeam = GetTeam(event.GetDamagerPlayer(false));
if (damageeTeam == null || damagerTeam == null)
return;
if (damageeTeam.equals(damagerTeam))
return;
Player damagee = event.GetDamageePlayer();
Player damager = event.GetDamagerPlayer(false);
//Damagee is closer to Damagers Island
if (UtilMath.offset(damagee.getLocation(), UtilWorld.averageLocation(damageeTeam.GetSpawns())) >
UtilMath.offset(damagee.getLocation(), UtilWorld.averageLocation(damagerTeam.GetSpawns())))
{
cheaterKill(damagee);
}
//Damagee is closer to Damagees Island
if (UtilMath.offset(damager.getLocation(), UtilWorld.averageLocation(damagerTeam.GetSpawns())) >
UtilMath.offset(damager.getLocation(), UtilWorld.averageLocation(damageeTeam.GetSpawns())))
{
cheaterKill(damager);
}
}
public void cheaterKill(Player player)
{
Announce(C.Bold + player.getName() + " was killed for cheating!");
_usedLife.add(player.getName());
player.damage(9999);
}
} }

View File

@ -68,7 +68,9 @@ import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.NullKit; import nautilus.game.arcade.kit.NullKit;
import nautilus.game.arcade.stats.AssistsStatTracker; import nautilus.game.arcade.stats.AssistsStatTracker;
import nautilus.game.arcade.stats.BloodThirstyStatTracker; import nautilus.game.arcade.stats.BloodThirstyStatTracker;
import nautilus.game.arcade.stats.KingDamageStatTracker;
import nautilus.game.arcade.stats.KingSlayerStatTracker; import nautilus.game.arcade.stats.KingSlayerStatTracker;
import nautilus.game.arcade.stats.WinAsTeamStatTracker;
public class CastleSiege extends TeamGame public class CastleSiege extends TeamGame
{ {
@ -190,10 +192,21 @@ public class CastleSiege extends TeamGame
_kingName = C.cYellow + C.Bold + "King Sparklez"; _kingName = C.cYellow + C.Bold + "King Sparklez";
GameTeam notRedTeam = null;
for (GameTeam team : GetTeamList())
{
if (team.GetColor() != ChatColor.RED)
{
notRedTeam = team;
break;
}
}
registerStatTrackers( registerStatTrackers(
new WinAsTeamStatTracker(this, notRedTeam, "ForTheKing"),
new KingSlayerStatTracker(this), new KingSlayerStatTracker(this),
new BloodThirstyStatTracker(this), new BloodThirstyStatTracker(this),
new AssistsStatTracker(this) new KingDamageStatTracker(this)
); );
} }

View File

@ -13,8 +13,10 @@ import nautilus.game.arcade.game.games.champions.kits.KitMage;
import nautilus.game.arcade.game.games.champions.kits.KitRanger; import nautilus.game.arcade.game.games.champions.kits.KitRanger;
import nautilus.game.arcade.game.games.common.Domination; import nautilus.game.arcade.game.games.common.Domination;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.BackstabKillStatTracker;
import nautilus.game.arcade.stats.ElectrocutionStatTracker; import nautilus.game.arcade.stats.ElectrocutionStatTracker;
import nautilus.game.arcade.stats.SeismicSlamStatTracker; import nautilus.game.arcade.stats.SeismicSlamStatTracker;
import nautilus.game.arcade.stats.TheLongestShotStatTracker;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -55,7 +57,9 @@ public class ChampionsDominate extends Domination
EloStart = 1000; EloStart = 1000;
registerStatTrackers( registerStatTrackers(
new BackstabKillStatTracker(this),
new ElectrocutionStatTracker(this), new ElectrocutionStatTracker(this),
new TheLongestShotStatTracker(this),
new SeismicSlamStatTracker(this) new SeismicSlamStatTracker(this)
); );
} }

View File

@ -17,9 +17,11 @@ import nautilus.game.arcade.game.games.champions.kits.KitMage;
import nautilus.game.arcade.game.games.champions.kits.KitRanger; import nautilus.game.arcade.game.games.champions.kits.KitRanger;
import nautilus.game.arcade.game.games.common.TeamDeathmatch; import nautilus.game.arcade.game.games.common.TeamDeathmatch;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.BackstabKillStatTracker;
import nautilus.game.arcade.stats.ElectrocutionStatTracker; import nautilus.game.arcade.stats.ElectrocutionStatTracker;
import nautilus.game.arcade.stats.KillAllOpposingStatTracker; import nautilus.game.arcade.stats.KillAllOpposingStatTracker;
import nautilus.game.arcade.stats.SeismicSlamStatTracker; import nautilus.game.arcade.stats.SeismicSlamStatTracker;
import nautilus.game.arcade.stats.TheLongestShotStatTracker;
import nautilus.game.arcade.stats.WinWithoutLosingTeammateStatTracker; import nautilus.game.arcade.stats.WinWithoutLosingTeammateStatTracker;
public class ChampionsTDM extends TeamDeathmatch public class ChampionsTDM extends TeamDeathmatch
@ -48,14 +50,16 @@ public class ChampionsTDM extends TeamDeathmatch
"Gold/Iron Weapons deal 6 damage", "Gold/Iron Weapons deal 6 damage",
"Diamond Weapons deal 7 damage", "Diamond Weapons deal 7 damage",
}; };
this.Manager.GetDamage().UseSimpleWeaponDamage = false; this.Manager.GetDamage().UseSimpleWeaponDamage = false;
registerStatTrackers( registerStatTrackers(
new WinWithoutLosingTeammateStatTracker(this, "FlawlessVictory"), new WinWithoutLosingTeammateStatTracker(this, "FlawlessVictory"),
new KillAllOpposingStatTracker(this), new KillAllOpposingStatTracker(this),
new BackstabKillStatTracker(this),
new ElectrocutionStatTracker(this), new ElectrocutionStatTracker(this),
new TheLongestShotStatTracker(this),
new SeismicSlamStatTracker(this) new SeismicSlamStatTracker(this)
); );
} }

View File

@ -81,6 +81,7 @@ import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.NullKit; import nautilus.game.arcade.kit.NullKit;
import nautilus.game.arcade.stats.BadHiderStatTracker; import nautilus.game.arcade.stats.BadHiderStatTracker;
import nautilus.game.arcade.stats.HunterKillerStatTracker; import nautilus.game.arcade.stats.HunterKillerStatTracker;
import nautilus.game.arcade.stats.HunterOfTheYearStatTracker;
import nautilus.game.arcade.stats.MeowStatTracker; import nautilus.game.arcade.stats.MeowStatTracker;
import net.minecraft.server.v1_7_R4.EntityCreature; import net.minecraft.server.v1_7_R4.EntityCreature;
@ -213,6 +214,7 @@ public class HideSeek extends TeamGame
new HunterKillerStatTracker(this), new HunterKillerStatTracker(this),
new MeowStatTracker(this), new MeowStatTracker(this),
new HunterKillerStatTracker(this), new HunterKillerStatTracker(this),
new HunterOfTheYearStatTracker(this),
new BadHiderStatTracker(this) new BadHiderStatTracker(this)
); );
} }

View File

@ -34,7 +34,7 @@ public class QuiverTeams extends TeamGame
private HashMap<GameTeam, Integer> _teamKills = new HashMap<GameTeam, Integer>(); private HashMap<GameTeam, Integer> _teamKills = new HashMap<GameTeam, Integer>();
private HashMap<Player, Long> _deathTime = new HashMap<Player, Long>(); private HashMap<Player, Long> _deathTime = new HashMap<Player, Long>();
private int _reqKills = 6; private int _reqKills = 60;
public QuiverTeams(ArcadeManager manager) public QuiverTeams(ArcadeManager manager)
{ {

View File

@ -3,8 +3,8 @@ package nautilus.game.arcade.managers;
import java.util.HashMap; import java.util.HashMap;
import mineplex.core.achievement.Achievement; import mineplex.core.achievement.Achievement;
import mineplex.core.achievement.AchievementData;
import mineplex.core.achievement.AchievementLog; import mineplex.core.achievement.AchievementLog;
import mineplex.core.achievement.AchivementData;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.Callback; import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
@ -84,7 +84,7 @@ public class GameAchievementManager implements Listener
{ {
UtilPlayer.message(player, ""); UtilPlayer.message(player, "");
AchivementData data = Manager.GetAchievement().get(player, type); AchievementData data = Manager.GetAchievement().get(player, type);
String nameLevel = F.elem(C.cGold + C.Bold + type.getName() + " " + ChatColor.RESET + C.cYellow + data.getLevel() + C.cGold + "/" + C.cYellow + type.getMaxLevel()); String nameLevel = F.elem(C.cGold + C.Bold + type.getName() + " " + ChatColor.RESET + C.cYellow + data.getLevel() + C.cGold + "/" + C.cYellow + type.getMaxLevel());
String progress = F.elem(C.cGreen + "+" + log.get(type).Amount); String progress = F.elem(C.cGreen + "+" + log.get(type).Amount);

View File

@ -165,7 +165,7 @@ public class GameGemManager implements Listener
total += (int)(earned * game.GetGemBoostAmount()); total += (int)(earned * game.GetGemBoostAmount());
//Gem Finder //Gem Finder
int gemFinder = Manager.GetAchievement().get(player.getName(), Achievement.GLOBAL_GEM_HUNTER).getLevel(); int gemFinder = Manager.GetAchievement().get(player.getName(), Achievement.GLOBAL_GEM_HUNTER).getLevel();
if (gemFinder > 0) if (gemFinder > 0)
{ {
total += (int)(earned * (gemFinder * 0.25)); total += (int)(earned * (gemFinder * 0.25));

View File

@ -1,11 +1,13 @@
package nautilus.game.arcade.stats; package nautilus.game.arcade.stats;
import mineplex.core.common.util.*; import org.bukkit.entity.Player;
import mineplex.minecraft.game.core.combat.*; import org.bukkit.event.EventHandler;
import mineplex.minecraft.game.core.combat.event.*; import org.bukkit.event.EventPriority;
import nautilus.game.arcade.game.*;
import org.bukkit.entity.*; import mineplex.core.common.util.UtilPlayer;
import org.bukkit.event.*; import mineplex.minecraft.game.core.combat.CombatComponent;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import nautilus.game.arcade.game.Game;
public class AssistsStatTracker extends StatTracker<Game> public class AssistsStatTracker extends StatTracker<Game>
{ {
@ -17,6 +19,9 @@ public class AssistsStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event) public void onCombatDeath(CombatDeathEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
for (CombatComponent log : event.GetLog().GetAttackers()) for (CombatComponent log : event.GetLog().GetAttackers())
{ {
if (event.GetLog().GetKiller() != null && log.equals(event.GetLog().GetKiller())) if (event.GetLog().GetKiller() != null && log.equals(event.GetLog().GetKiller()))
@ -24,8 +29,13 @@ public class AssistsStatTracker extends StatTracker<Game>
Player player = UtilPlayer.searchExact(log.GetName()); Player player = UtilPlayer.searchExact(log.GetName());
getGame().AddStat(player, "Assists", 1, false, false); if (player != null)
getGame().AddStat(player, getGame().GetKit(player).GetName() + " Assists", 1, false, false); {
getGame().AddStat(player, "Assists", 1, false, false);
if (getGame().GetKit(player) != null)
getGame().AddStat(player, getGame().GetKit(player).GetName() + " Assists", 1, false, false);
}
} }
} }
} }

View File

@ -0,0 +1,81 @@
package nautilus.game.arcade.stats;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.Game;
public class BackstabKillStatTracker extends StatTracker<Game>
{
private final Map<UUID, Set<UUID>> _hasDamaged = new HashMap<>();
public BackstabKillStatTracker(Game 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 (event.GetLog().GetLastDamager().GetReason() != null && event.GetLog().GetLastDamager().GetReason().equalsIgnoreCase("Backstab"))
{
Set<UUID> hasDamaged = _hasDamaged.get(player.getUniqueId());
if (hasDamaged == null || !hasDamaged.contains(killer.getUniqueId()))
getGame().AddStat(killer, "Assassination", 1, false, false);
}
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCustomDamage(CustomDamageEvent event)
{
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.GetDamageePlayer() != null && event.GetDamagerPlayer(true) != null)
{
Set<UUID> hasDamaged = _hasDamaged.get(event.GetDamagerPlayer(true).getUniqueId());
if (hasDamaged == null)
{
hasDamaged = new HashSet<>();
_hasDamaged.put(event.GetDamagerPlayer(true).getUniqueId(), hasDamaged);
}
hasDamaged.add(event.GetDamageePlayer().getUniqueId());
}
}
}

View File

@ -26,6 +26,9 @@ public class BadHiderStatTracker extends StatTracker<HideSeek>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onChangeForm(HideSeek.ChangeFormEvent event) public void onChangeForm(HideSeek.ChangeFormEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.getForm() instanceof CreatureForm) if (event.getForm() instanceof CreatureForm)
_disqualified.add(event.getPlayer().getUniqueId()); _disqualified.add(event.getPlayer().getUniqueId());
} }
@ -33,6 +36,9 @@ public class BadHiderStatTracker extends StatTracker<HideSeek>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onPlayerDeath(PlayerDeathEvent event) public void onPlayerDeath(PlayerDeathEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
_disqualified.add(event.getEntity().getUniqueId()); _disqualified.add(event.getEntity().getUniqueId());
} }

View File

@ -5,6 +5,7 @@ import org.bukkit.event.EventHandler;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.turfforts.TurfForts; import nautilus.game.arcade.game.games.turfforts.TurfForts;
public class BehindEnemyLinesStatTracker extends StatTracker<TurfForts> public class BehindEnemyLinesStatTracker extends StatTracker<TurfForts>
@ -17,6 +18,9 @@ public class BehindEnemyLinesStatTracker extends StatTracker<TurfForts>
@EventHandler @EventHandler
public void onUpdate(UpdateEvent event) public void onUpdate(UpdateEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.getType() == UpdateType.SEC) if (event.getType() == UpdateType.SEC)
{ {
for (Player player : getGame().GetPlayers(true)) for (Player player : getGame().GetPlayers(true))

View File

@ -18,6 +18,9 @@ public class BlockShreadStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onShredBlock(TurfForts.ShredBlockEvent event) public void onShredBlock(TurfForts.ShredBlockEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.getArrow().getShooter() instanceof Player) if (event.getArrow().getShooter() instanceof Player)
{ {
Player shooter = (Player) event.getArrow().getShooter(); Player shooter = (Player) event.getArrow().getShooter();

View File

@ -26,6 +26,9 @@ public class BloodThirstyStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event) public void onCombatDeath(CombatDeathEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.GetLog().GetKiller() == null) if (event.GetLog().GetKiller() == null)
return; return;

View File

@ -2,6 +2,7 @@ package nautilus.game.arcade.stats;
import mineplex.core.common.util.*; import mineplex.core.common.util.*;
import mineplex.minecraft.game.core.combat.event.*; import mineplex.minecraft.game.core.combat.event.*;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.bridge.*; import nautilus.game.arcade.game.games.bridge.*;
import org.bukkit.entity.*; import org.bukkit.entity.*;
import org.bukkit.event.*; import org.bukkit.event.*;
@ -17,6 +18,9 @@ public class BridgesSniperStatTracker extends StatTracker<Bridge>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event) public void onCombatDeath(CombatDeathEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (getGame().isBridgesDown()) if (getGame().isBridgesDown())
return; return;

View File

@ -22,6 +22,9 @@ public class CannibalStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onTailCollision(Snake.TailCollisionEvent event) public void onTailCollision(Snake.TailCollisionEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
Integer killCount = _kills.get(event.getKiller().getUniqueId()); Integer killCount = _kills.get(event.getKiller().getUniqueId());
killCount = (killCount == null ? 0 : killCount) + 1; killCount = (killCount == null ? 0 : killCount) + 1;

View File

@ -16,6 +16,9 @@ public class ChooChooStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onTailGrow(Snake.TailGrowEvent event) public void onTailGrow(Snake.TailGrowEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.getLength() >= 60) if (event.getLength() >= 60)
getGame().AddStat(event.getPlayer(), "ChooChoo", 1, true, false); getGame().AddStat(event.getPlayer(), "ChooChoo", 1, true, false);
} }

View File

@ -25,6 +25,9 @@ public class ComeAtMeBroStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event) public void onCombatDeath(CombatDeathEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.GetLog().GetKiller() == null) if (event.GetLog().GetKiller() == null)
return; return;

View File

@ -15,13 +15,16 @@ public class DamageDealtStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCustomDamage(CustomDamageEvent event) public void onCustomDamage(CustomDamageEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
Player damager = event.GetDamagerPlayer(false); Player damager = event.GetDamagerPlayer(false);
if (damager == null) if (damager == null)
return; return;
getGame().AddStat(damager, "Damage Dealt", (int) Math.round(event.GetDamage()), false, false); getGame().AddStat(damager, "Damage Dealt", (int) Math.round(event.GetDamage()), false, false);
if (getGame() != null && getGame().GetKit(damager) != null) if (getGame().GetKit(damager) != null)
getGame().AddStat(damager, getGame().GetKit(damager).GetName() + " Damage Dealt", (int) Math.round(event.GetDamage()), false, false); getGame().AddStat(damager, getGame().GetKit(damager).GetName() + " Damage Dealt", (int) Math.round(event.GetDamage()), false, false);
} }
} }

View File

@ -15,13 +15,16 @@ public class DamageTakenStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCustomDamage(CustomDamageEvent event) public void onCustomDamage(CustomDamageEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
Player damagee = event.GetDamageePlayer(); Player damagee = event.GetDamageePlayer();
if (damagee == null) if (damagee == null)
return; return;
getGame().AddStat(damagee, "Damage Taken", (int) Math.round(event.GetDamage()), false, false); getGame().AddStat(damagee, "Damage Taken", (int) Math.round(event.GetDamage()), false, false);
if (getGame() != null && getGame().GetKit(damagee) != null) if (getGame().GetKit(damagee) != null)
getGame().AddStat(damagee, getGame().GetKit(damagee).GetName() + " Damage Taken", (int) Math.round(event.GetDamage()), false, false); getGame().AddStat(damagee, getGame().GetKit(damagee).GetName() + " Damage Taken", (int) Math.round(event.GetDamage()), false, false);
} }
} }

View File

@ -25,6 +25,9 @@ public class DeathBomberStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event) public void onCombatDeath(CombatDeathEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.GetLog().GetKiller() == null) if (event.GetLog().GetKiller() == null)
return; return;

View File

@ -1,10 +1,12 @@
package nautilus.game.arcade.stats; package nautilus.game.arcade.stats;
import mineplex.core.common.util.*; import org.bukkit.entity.Player;
import mineplex.minecraft.game.core.combat.event.*; import org.bukkit.event.EventHandler;
import nautilus.game.arcade.game.*; import org.bukkit.event.EventPriority;
import org.bukkit.entity.*;
import org.bukkit.event.*; import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import nautilus.game.arcade.game.Game;
public class DeathsStatTracker extends StatTracker<Game> public class DeathsStatTracker extends StatTracker<Game>
{ {
@ -16,6 +18,9 @@ public class DeathsStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event) public void onCombatDeath(CombatDeathEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.GetLog().GetPlayer() == null) if (event.GetLog().GetPlayer() == null)
return; return;
@ -27,6 +32,8 @@ public class DeathsStatTracker extends StatTracker<Game>
return; return;
getGame().AddStat(player, "Deaths", 1, false, false); getGame().AddStat(player, "Deaths", 1, false, false);
getGame().AddStat(player, getGame().GetKit(player).GetName() + " Deaths", 1, false, false);
if (getGame().GetKit(player) != null)
getGame().AddStat(player, getGame().GetKit(player).GetName() + " Deaths", 1, false, false);
} }
} }

View File

@ -14,6 +14,9 @@ public class ElectrocutionStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onLightningOrb(LightningOrb.LightningOrbEvent event) public void onLightningOrb(LightningOrb.LightningOrbEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.getStruck().size() >= 4) if (event.getStruck().size() >= 4)
getGame().AddStat(event.getPlayer(), "MassElectrocution", 1, true, false); getGame().AddStat(event.getPlayer(), "MassElectrocution", 1, true, false);
} }

View File

@ -33,6 +33,9 @@ public class FastKillsStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event) public void onCombatDeath(CombatDeathEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.GetLog().GetKiller() == null) if (event.GetLog().GetKiller() == null)
return; return;

View File

@ -16,6 +16,9 @@ public class FirstSupplyDropOpenStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onSupplyChestOpen(SupplyChestOpenEvent event) public void onSupplyChestOpen(SupplyChestOpenEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (first) if (first)
{ {
getGame().AddStat(event.getPlayer(), "SupplyDropsOpened", 1, false, false); getGame().AddStat(event.getPlayer(), "SupplyDropsOpened", 1, false, false);

View File

@ -0,0 +1,47 @@
package nautilus.game.arcade.stats;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import nautilus.game.arcade.game.Game;
public class FoodForTheMassesStatTracker extends StatTracker<Game>
{
public FoodForTheMassesStatTracker(Game game)
{
super(game);
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeathEvent(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 (event.GetLog().GetLastDamager().GetReason() != null && event.GetLog().GetLastDamager().GetReason().equalsIgnoreCase("Apple Thrower"))
getGame().AddStat(killer, "FoodForTheMasses", 1, false, false);
}
}

View File

@ -28,8 +28,11 @@ public class FreeKitWinStatTracker extends StatTracker<Game>
{ {
for (Player winner : winners) for (Player winner : winners)
{ {
if (getGame().GetKit(winner).GetAvailability() == KitAvailability.Free) if (getGame().GetKit(winner) != null)
getGame().AddStat(winner, "FreeKitsForever", 1, false, false); {
if (getGame().GetKit(winner).GetAvailability() == KitAvailability.Free)
getGame().AddStat(winner, "FreeKitsForever", 1, false, false);
}
} }
} }
} }

View File

@ -25,6 +25,9 @@ public class HunterKillerStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event) public void onCombatDeath(CombatDeathEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.GetLog().GetKiller() == null) if (event.GetLog().GetKiller() == null)
return; return;

View File

@ -26,6 +26,9 @@ public class HunterOfTheYearStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event) public void onCombatDeath(CombatDeathEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.GetLog().GetKiller() == null) if (event.GetLog().GetKiller() == null)
return; return;
@ -55,7 +58,7 @@ public class HunterOfTheYearStatTracker extends StatTracker<Game>
_hidersKilled.put(killer.getUniqueId(), hidersKilled); _hidersKilled.put(killer.getUniqueId(), hidersKilled);
if (hidersKilled >= 7) if (hidersKilled >= 7)
getGame().AddStat(killer, "HiderOfTheYear", 1, true, false); getGame().AddStat(killer, "HunterOfTheYear", 1, true, false);
} }
} }
} }

View File

@ -25,6 +25,9 @@ public class KeenEyeStatTracker extends StatTracker<Draw>
@EventHandler @EventHandler
public void onDrawRoundEnd(DrawRoundEndEvent event) public void onDrawRoundEnd(DrawRoundEndEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
for (Iterator<Player> it = _guessAll.iterator(); it.hasNext(); ) for (Iterator<Player> it = _guessAll.iterator(); it.hasNext(); )
{ {
Player player = it.next(); Player player = it.next();

View File

@ -21,6 +21,9 @@ public class KillAllOpposingStatTracker extends StatTracker<TeamGame>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event) public void onCombatDeath(CombatDeathEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.GetLog().GetKiller() == null) if (event.GetLog().GetKiller() == null)
return; return;

View File

@ -1,10 +1,12 @@
package nautilus.game.arcade.stats; package nautilus.game.arcade.stats;
import mineplex.core.common.util.*; import org.bukkit.entity.Player;
import mineplex.minecraft.game.core.combat.event.*; import org.bukkit.event.EventHandler;
import nautilus.game.arcade.game.*; import org.bukkit.event.EventPriority;
import org.bukkit.entity.*;
import org.bukkit.event.*; import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import nautilus.game.arcade.game.Game;
public class KillsStatTracker extends StatTracker<Game> public class KillsStatTracker extends StatTracker<Game>
{ {
@ -16,6 +18,9 @@ public class KillsStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event) public void onCombatDeath(CombatDeathEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.GetLog().GetKiller() == null) if (event.GetLog().GetKiller() == null)
return; return;
@ -27,6 +32,8 @@ public class KillsStatTracker extends StatTracker<Game>
return; return;
getGame().AddStat(player, "Kills", 1, false, false); getGame().AddStat(player, "Kills", 1, false, false);
getGame().AddStat(player, getGame().GetKit(player).GetName() + " Kills", 1, false, false);
if (getGame().GetKit(player) != null)
getGame().AddStat(player, getGame().GetKit(player).GetName() + " Kills", 1, false, false);
} }
} }

View File

@ -38,6 +38,9 @@ public class KillsWithinTimeLimitStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event) public void onCombatDeath(CombatDeathEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.GetLog().GetKiller() == null) if (event.GetLog().GetKiller() == null)
return; return;

View File

@ -25,6 +25,9 @@ public class KingDamageStatTracker extends StatTracker<CastleSiege>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onKingDamage(CastleSiege.KingDamageEvent event) public void onKingDamage(CastleSiege.KingDamageEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
_totalKingDamage += event.getDamage(); _totalKingDamage += event.getDamage();
Double damage = _kingDamage.get(event.getPlayer().getUniqueId()); Double damage = _kingDamage.get(event.getPlayer().getUniqueId());

View File

@ -15,6 +15,9 @@ public class KingSlayerStatTracker extends StatTracker<Game>
@EventHandler @EventHandler
public void onKingSlaughtered(CastleSiege.KingSlaughterEvent event) public void onKingSlaughtered(CastleSiege.KingSlaughterEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
getGame().AddStat(event.getPlayer(), "KingSlayer", 1, true, false); getGame().AddStat(event.getPlayer(), "KingSlayer", 1, true, false);
} }
} }

View File

@ -10,6 +10,7 @@ import org.bukkit.event.EventPriority;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.TeamGame; import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.games.castlesiege.kits.KitUndead; import nautilus.game.arcade.game.games.castlesiege.kits.KitUndead;
@ -25,6 +26,9 @@ public class LastStandStatTracker extends StatTracker<TeamGame>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event) public void onCombatDeath(CombatDeathEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.GetLog().GetKiller() == null) if (event.GetLog().GetKiller() == null)
return; return;

View File

@ -1,11 +1,13 @@
package nautilus.game.arcade.stats; package nautilus.game.arcade.stats;
import nautilus.game.arcade.events.*; import java.util.List;
import nautilus.game.arcade.game.*;
import org.bukkit.entity.*;
import org.bukkit.event.*;
import java.util.*; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
public class LoseStatTracker extends StatTracker<Game> public class LoseStatTracker extends StatTracker<Game>
{ {
@ -26,7 +28,9 @@ public class LoseStatTracker extends StatTracker<Game>
for (Player loser : losers) for (Player loser : losers)
{ {
getGame().AddStat(loser, "Losses", 1, false, false); getGame().AddStat(loser, "Losses", 1, false, false);
getGame().AddStat(loser, getGame().GetKit(loser).GetName() + " Losses", 1, false, false);
if (getGame().GetKit(loser) != null)
getGame().AddStat(loser, getGame().GetKit(loser).GetName() + " Losses", 1, false, false);
} }
} }
} }

View File

@ -16,6 +16,9 @@ public class MedicStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(Paintball.ReviveEvent event) public void onCombatDeath(Paintball.ReviveEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
getGame().AddStat(event.getPlayer(), "Medic", 1, false, false); getGame().AddStat(event.getPlayer(), "Medic", 1, false, false);
} }
} }

View File

@ -22,6 +22,9 @@ public class MeowStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onMeow(HideSeek.MeowEvent event) public void onMeow(HideSeek.MeowEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
Integer meows = _meowCount.get(event.getPlayer().getUniqueId()); Integer meows = _meowCount.get(event.getPlayer().getUniqueId());
meows = (meows == null ? 0 : meows) + 1; meows = (meows == null ? 0 : meows) + 1;

View File

@ -10,6 +10,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.draw.Draw; import nautilus.game.arcade.game.games.draw.Draw;
import nautilus.game.arcade.game.games.draw.DrawGuessCorrectlyEvent; import nautilus.game.arcade.game.games.draw.DrawGuessCorrectlyEvent;
@ -25,6 +26,9 @@ public class MrSquiggleStatTracker extends StatTracker<Draw>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onDrawGuessCorrectly(DrawGuessCorrectlyEvent event) public void onDrawGuessCorrectly(DrawGuessCorrectlyEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.getRank() != 1) if (event.getRank() != 1)
return; return;

View File

@ -26,6 +26,9 @@ public class OneVThreeStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event) public void onCombatDeath(CombatDeathEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.GetLog().GetKiller() == null) if (event.GetLog().GetKiller() == null)
return; return;

View File

@ -25,6 +25,9 @@ public class ParalympicsStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onePerkLeap(PerkLeapEvent event) public void onePerkLeap(PerkLeapEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
_hasLeaped.add(event.GetPlayer().getUniqueId()); _hasLeaped.add(event.GetPlayer().getUniqueId());
} }

View File

@ -3,6 +3,7 @@ package nautilus.game.arcade.stats;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.draw.Draw; import nautilus.game.arcade.game.games.draw.Draw;
import nautilus.game.arcade.game.games.draw.DrawGuessCorrectlyEvent; import nautilus.game.arcade.game.games.draw.DrawGuessCorrectlyEvent;
@ -16,6 +17,9 @@ public class PureLuckStatTracker extends StatTracker<Draw>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onDrawGuessCorrectly(DrawGuessCorrectlyEvent event) public void onDrawGuessCorrectly(DrawGuessCorrectlyEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (System.currentTimeMillis() - event.getDrawRound().Time < 5000) if (System.currentTimeMillis() - event.getDrawRound().Time < 5000)
getGame().AddStat(event.getPlayer(), "PureLuck", 1, true, false); getGame().AddStat(event.getPlayer(), "PureLuck", 1, true, false);
} }

View File

@ -25,6 +25,9 @@ public class RecoveryMasterStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event) public void onCombatDeath(CombatDeathEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.GetLog().GetPlayer() == null) if (event.GetLog().GetPlayer() == null)
return; return;
@ -41,6 +44,9 @@ public class RecoveryMasterStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCustomDamage(CustomDamageEvent event) public void onCustomDamage(CustomDamageEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
Player damagee = event.GetDamageePlayer(); Player damagee = event.GetDamageePlayer();
if (damagee == null) if (damagee == null)
return; return;

View File

@ -14,6 +14,9 @@ public class SeismicSlamStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onLongshotHit(SeismicSlam.SeismicSlamEvent event) public void onLongshotHit(SeismicSlam.SeismicSlamEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.getTargets().size() >= 5) if (event.getTargets().size() >= 5)
getGame().AddStat(event.getPlayer(), "Earthquake", 1, true, false); getGame().AddStat(event.getPlayer(), "Earthquake", 1, true, false);
} }

View File

@ -27,7 +27,10 @@ public class SharpShooterStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onProjectileLaunch(ProjectileLaunchEvent event) public void onProjectileLaunch(ProjectileLaunchEvent event)
{ {
if (event.getEntity().getShooter() instanceof Player) if (getGame().GetState() != Game.GameState.Live)
return;
if (event.getEntity().getShooter() instanceof Player && event.getEntity() instanceof Arrow)
{ {
Player player = (Player) event.getEntity(); Player player = (Player) event.getEntity();
@ -40,6 +43,9 @@ public class SharpShooterStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onArrowHit(CustomDamageEvent event) public void onArrowHit(CustomDamageEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.GetProjectile() instanceof Arrow && event.GetDamageePlayer() != null) if (event.GetProjectile() instanceof Arrow && event.GetDamageePlayer() != null)
{ {
if (event.GetProjectile().getShooter() instanceof Player && event.GetProjectile().getShooter() != event.GetDamageePlayer()) if (event.GetProjectile().getShooter() instanceof Player && event.GetProjectile().getShooter() != event.GetDamageePlayer())

View File

@ -16,6 +16,9 @@ public class SheepDropStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onSheepStolen(SheepGame.DropEnemySheepEvent event) public void onSheepStolen(SheepGame.DropEnemySheepEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
getGame().AddStat(event.getPlayer(), "AnimalRescue", 1, false, false); getGame().AddStat(event.getPlayer(), "AnimalRescue", 1, false, false);
} }
} }

View File

@ -16,6 +16,9 @@ public class SheepThiefStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onSheepStolen(SheepGame.SheepStolenEvent event) public void onSheepStolen(SheepGame.SheepStolenEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
getGame().AddStat(event.getPlayer(), "Thief", 1, false, false); getGame().AddStat(event.getPlayer(), "Thief", 1, false, false);
} }
} }

View File

@ -21,6 +21,9 @@ public class SimultaneousSkeletonStatTracker extends StatTracker<Game>
@EventHandler @EventHandler
public void onMinionSpawn(PerkSkeletons.MinionSpawnEvent event) public void onMinionSpawn(PerkSkeletons.MinionSpawnEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
List<Skeleton> skeletons = event.getPerkSkeletons().getSkeletons(event.getPlayer()); List<Skeleton> skeletons = event.getPerkSkeletons().getSkeletons(event.getPlayer());
if (skeletons != null) if (skeletons != null)

View File

@ -22,6 +22,9 @@ public class SlimySheepStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onTailCollision(Snake.SlimeUpgradeEvent event) public void onTailCollision(Snake.SlimeUpgradeEvent event)
{ {
if (getGame().GetState() != Game.GameState.Live)
return;
Integer count = _count.get(event.getPlayer().getUniqueId()); Integer count = _count.get(event.getPlayer().getUniqueId());
count = (count == null ? 0 : count) + 1; count = (count == null ? 0 : count) + 1;

Some files were not shown because too many files have changed in this diff Show More