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

This commit is contained in:
Jonathan Williams 2015-07-25 01:38:54 -07:00
commit 6d367e3cee
42 changed files with 357 additions and 225 deletions

View File

@ -75,7 +75,7 @@ public enum Rank
{
UtilPlayer.message(player, C.mHead + "Permissions> " +
C.mBody + "This requires Permission Rank [" +
C.mHead + rank +
C.mHead + rank.Name.toUpperCase() +
C.mBody + "].");
}

View File

@ -326,7 +326,7 @@ public enum Achievement
SUPER_PAINTBALL_FLAWLESS_VICTORY("Flawless Victory", 1000,
new String[]{"Super Paintball.Wins"},
new String[]{"Win a team with your entire team alive"},
new String[]{"Win a game with your entire team alive"},
new int[]{1},
AchievementCategory.SUPER_PAINTBALL),

View File

@ -16,7 +16,7 @@ public enum AchievementCategory
{
GLOBAL("Global", null,
new StatDisplay[] { StatDisplay.GEMS_EARNED, null, new StatDisplay("Games Played", "GamesPlayed"), StatDisplay.TIME_IN_GAME },
Material.EMERALD, 0, GameCategory.GLOBAL, null),
Material.EMERALD, 0, GameCategory.GLOBAL, "None"),
BRIDGES("The Bridges", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
@ -32,11 +32,11 @@ public enum AchievementCategory
UHC("Ultra Hardcore", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.GOLDEN_APPLE, 0, GameCategory.SURVIVAL, "Extra Class Skills"),
Material.GOLDEN_APPLE, 0, GameCategory.SURVIVAL, "None"),
WIZARDS("Wizards", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.BLAZE_ROD, 0, GameCategory.SURVIVAL, "Extra Class Skills"),
Material.BLAZE_ROD, 0, GameCategory.SURVIVAL, "Witch Doctor Kit"),
CASTLE_SIEGE("Castle Siege", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, new StatDisplay("Kills as Defenders"), new StatDisplay("Deaths as Defenders"),
@ -45,7 +45,7 @@ public enum AchievementCategory
BLOCK_HUNT("Block Hunt", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.GRASS, 0, GameCategory.CLASSICS, null),
Material.GRASS, 0, GameCategory.CLASSICS, "Infestor Kit"),
SMASH_MOBS("Super Smash Mobs", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
@ -53,11 +53,11 @@ public enum AchievementCategory
MINE_STRIKE("MineStrike", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.TNT, 0, GameCategory.CLASSICS, null),
Material.TNT, 0, GameCategory.CLASSICS, "None"),
DRAW_MY_THING("Draw My Thing", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED },
Material.BOOK_AND_QUILL, 0, GameCategory.CLASSICS, null),
Material.BOOK_AND_QUILL, 0, GameCategory.CLASSICS, "Extra Tools Kit"),
CHAMPIONS("Champions", new String[] {"Champions Domination", "Champions TDM"},
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
@ -65,7 +65,7 @@ public enum AchievementCategory
MASTER_BUILDERS("Master Builders", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED },
Material.WOOD, 0, GameCategory.CLASSICS, null),
Material.WOOD, 0, GameCategory.CLASSICS, "None"),
//Arcade
DRAGONS("Dragons", null,
@ -74,7 +74,7 @@ public enum AchievementCategory
DRAGON_ESCAPE("Dragon Escape", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED },
Material.DRAGON_EGG, 0, GameCategory.ARCADE, null),
Material.DRAGON_EGG, 0, GameCategory.ARCADE, "Digger Kit"),
SHEEP_QUEST("Sheep Quest", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
@ -82,11 +82,11 @@ public enum AchievementCategory
SNEAKY_ASSASSINS("Sneaky Assassins", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.INK_SACK, 0, GameCategory.ARCADE, null),
Material.INK_SACK, 0, GameCategory.ARCADE, "Briber Kit"),
ONE_IN_THE_QUIVER("One in the Quiver", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.BOW, 0, GameCategory.ARCADE, null),
Material.BOW, 0, GameCategory.ARCADE, "Slam Shooter Kit"),
SUPER_PAINTBALL("Super Paintball", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
@ -97,11 +97,11 @@ public enum AchievementCategory
Material.HARD_CLAY, 14, GameCategory.ARCADE, null),
RUNNER("Runner", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.LEATHER_BOOTS, 0, GameCategory.ARCADE, null),
SPLEEF("Super Spleef", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.IRON_SPADE, 0, GameCategory.ARCADE, null),
DEATH_TAG("Death Tag", null,
@ -110,7 +110,7 @@ public enum AchievementCategory
SNAKE("Snake", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
Material.WOOL, 4, GameCategory.ARCADE, null),
Material.WOOL, 4, GameCategory.ARCADE, "Reversal Snake Kit"),
BACON_BRAWL("Bacon Brawl", null,
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },

View File

@ -329,7 +329,7 @@ public class Chat extends MiniPlugin
UtilPlayer.message(sender, F.main("Chat",
"Accusing players of cheating in-game is against the rules."
+ "If you think someone is cheating, please gather evidence and report it at "
+ F.link("www.mineplex.com/supporthub/")));
+ F.link("www.mineplex.com/reports")));
event.setCancelled(true);
}
else if (_playerLastMessage.containsKey(sender.getUniqueId()))

View File

@ -52,6 +52,9 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
" ",
ChatColor.RESET + C.cPurple + "Hero Rank",
ChatColor.RESET + "Receives 15000 Coins per Month",
" ",
ChatColor.RESET + C.cGreen + "Legend Rank",
ChatColor.RESET + "Recieves 30000 Coins per Month"
}, 1, false));
addButton(18, new ShopItem(Material.NETHER_STAR, "Particle Effects", 1, false), new OpenParticles(this));

View File

@ -3,7 +3,6 @@ package mineplex.core.gadget.gadgets;
import java.util.ArrayList;
import java.util.List;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.MapUtil;
import mineplex.core.common.util.UtilBlock;
@ -64,6 +63,7 @@ public class BlockForm
DisguiseChicken disguise = new DisguiseChicken(_player);
disguise.setBaby();
disguise.setSoundDisguise(new DisguiseCat(_player));
disguise.setInvisible(true);
_host.Manager.getDisguiseManager().disguise(disguise);
//Apply Falling Block

View File

@ -126,7 +126,8 @@ public class ItemMelonLauncher extends ItemGadget implements IThrown
event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.EAT, 1f, 1f);
event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 80, 1), true);
if (!event.getPlayer().hasPotionEffect(PotionEffectType.SPEED))
event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 80, 1), true);
}
@EventHandler

View File

@ -60,7 +60,7 @@ public enum GameDisplay
Build("Master Builders", Material.WOOD, (byte)0, GameCategory.CLASSICS, 50),
Cards("Craft Against Humanity", Material.MAP, (byte)0, GameCategory.CLASSICS, 51),
Skywars("Skywars", Material.FEATHER, (byte)5, GameCategory.SURVIVAL, 52),
Skywars("Skywars", Material.FEATHER, (byte) 0, GameCategory.SURVIVAL, 52),
Event("Mineplex Event", Material.CAKE, (byte)0, GameCategory.EVENT, 999);

View File

@ -99,7 +99,10 @@ public class TreasureLocation implements Listener
setHoloChestVisible(false);
if (treasureType == TreasureType.ANCIENT || treasureType == TreasureType.MYTHICAL)
if (treasureType == TreasureType.ANCIENT)
Bukkit.broadcastMessage(F.main("Treasure", F.name(player.getName()) + " is opening an " + treasureType.getName()));
if (treasureType == TreasureType.MYTHICAL)
Bukkit.broadcastMessage(F.main("Treasure", F.name(player.getName()) + " is opening a " + treasureType.getName()));
Reward[] rewards = _treasureManager.getRewards(player, treasureType.getRewardType());

View File

@ -318,7 +318,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
+ "§r\n"
+ "§lHow do I apply for Trainee?\n"
+ "\n"
+ "§rYou may only apply for Helper if you have §bUltra§0, §5Hero§0, or §aLegend§0.\n"
+ "§rYou may only apply for Trainee if you have §bUltra§0, §5Hero§0, or §aLegend§0.\n"
+ "Apply at:\n"
+ "§omineplex.com/application\n");

View File

@ -64,7 +64,7 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("BR") + ChatColor.RESET + " other players!",
}));
setItem(2, ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Survival Games " + C.cGray + "Last Man Standing", new String[]
setItem(2, ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Survival Games " + C.cGray + "Last Man Standing", new String[]
{
ChatColor.RESET + "",
ChatColor.RESET + "Search for chests to find loot and ",

View File

@ -137,7 +137,7 @@ public class BlockToss extends SkillCharge implements IThrown
}
//Block to Item
FallingBlock block = player.getWorld().spawnFallingBlock(player.getEyeLocation(), event.getClickedBlock().getType(), (byte)0);
FallingBlock block = player.getWorld().spawnFallingBlock(player.getEyeLocation(), event.getClickedBlock().getType(), event.getClickedBlock().getData());
//Action
player.eject();
@ -242,7 +242,7 @@ public class BlockToss extends SkillCharge implements IThrown
{
FallingBlock thrown = (FallingBlock) data.GetThrown();
FallingBlock newThrown = data.GetThrown().getWorld().spawnFallingBlock(data.GetThrown().getLocation(), thrown.getMaterial(), (byte)0);
FallingBlock newThrown = data.GetThrown().getWorld().spawnFallingBlock(data.GetThrown().getLocation(), thrown.getMaterial(), thrown.getBlockData());
//Remove Old
_falling.remove(thrown);

View File

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

View File

@ -31,6 +31,7 @@ import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.server.ServerListPingEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.util.Vector;
import com.google.common.base.Objects;
@ -840,6 +841,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation
{
player.setGameMode(GameMode.SURVIVAL);
player.setAllowFlight(false);
player.setFlySpeed(0.1F);
UtilInv.Clear(player);
((CraftEntity) player).getHandle().getDataWatcher().watch(0, Byte.valueOf((byte) 0));
@ -871,6 +874,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation
//Remove all conditions
GetCondition().EndCondition(player, null, null);
for (PotionEffect potion : player.getActivePotionEffects())
player.removePotionEffect(potion.getType());
HubClock(player);

View File

@ -40,6 +40,9 @@ public class SoupAddon extends MiniPlugin
Player player = event.getPlayer();
if (!Manager.GetGame().IsAlive(player))
return;
if (!UtilGear.isMat(player.getItemInHand(), Material.MUSHROOM_SOUP))
return;

View File

@ -20,7 +20,7 @@ public class KitBeserker extends Kit
new String[]
{
"Agile warrior trained in the ways axe combat."
"Agile warrior trained in the ways of axe combat."
},
new Perk[]

View File

@ -98,7 +98,15 @@ public class BuildData
return false;
}
Particles.put(Player.getEyeLocation().add(Player.getLocation().getDirection()), particleType);
Location toPlace = Player.getEyeLocation().add(Player.getLocation().getDirection());
if (!inBuildArea(toPlace.getBlock()))
{
UtilPlayer.message(Player, F.main("Game", "You cannot place particles outside your plot!"));
return false;
}
Particles.put(toPlace, particleType);
UtilPlayer.message(Player, F.main("Game", "You placed " + particleType.getFriendlyName() + "!"));

View File

@ -1924,7 +1924,18 @@ public class MineStrike extends TeamGame
Announce(color + "===================================", false);
for (Player player : UtilServer.getPlayers())
{
player.playSound(player.getLocation(), Sound.LEVEL_UP, 1f, 1f);
//Clear reloading things
for (String recharge : Recharge.Instance.Get(player).keySet())
{
if (!recharge.toLowerCase().contains("reload"))
continue;
Recharge.Instance.recharge(player, recharge);
}
}
UtilTextMiddle.display(null, winnerLine, 20, 120, 20);

View File

@ -6,7 +6,6 @@ import java.util.HashSet;
import java.util.Iterator;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.MapUtil;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAction;
@ -25,7 +24,6 @@ import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilTime.TimeUnit;
import mineplex.core.explosion.ExplosionEvent;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.loot.ChestLoot;
import mineplex.core.loot.RandomItem;
import mineplex.core.updater.UpdateType;
@ -43,8 +41,8 @@ import nautilus.game.arcade.game.games.skywars.data.TNTGenerator;
import nautilus.game.arcade.game.games.skywars.events.PlayerKillZombieEvent;
import nautilus.game.arcade.game.games.skywars.kits.KitChicken;
import nautilus.game.arcade.game.games.skywars.kits.KitDestructor;
import nautilus.game.arcade.game.games.skywars.kits.KitMiner;
import nautilus.game.arcade.game.games.skywars.kits.KitMadScientist;
import nautilus.game.arcade.game.games.skywars.kits.KitMiner;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.ore.OreHider;
import nautilus.game.arcade.stats.DeathBomberStatTracker;
@ -67,7 +65,6 @@ import org.bukkit.entity.Chicken;
import org.bukkit.entity.Egg;
import org.bukkit.entity.EnderPearl;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;

View File

@ -172,7 +172,7 @@ public class SuperSmash extends SoloGame
if (lives > 0)
{
UtilPlayer.message(player, C.cRed + C.Bold + "You have died!");
UtilPlayer.message(player, C.cRed + C.Bold + "You have " + lives + " lives left!");
UtilPlayer.message(player, C.cRed + C.Bold + "You have " + lives + (lives == 1 ? "life" : "lives") + " left!");
player.playSound(player.getLocation(), Sound.NOTE_BASS_GUITAR, 2f, 0.5f);
_lives.put(player, lives);

View File

@ -40,7 +40,7 @@ public class KitChicken extends SmashKit
},
EntityType.CHICKEN,
new ItemStack(Material.EGG),
"Airial Gunner", 20000, Sound.CHICKEN_HURT);
"Aerial Gunner", 20000, Sound.CHICKEN_HURT);
}

View File

@ -76,7 +76,7 @@ public class KitSheep extends SmashKit
{
ChatColor.RESET + "Shear yourself and use the wool as",
ChatColor.RESET + "an explosive device. You can Right-Click",
ChatColor.RESET + "as second time to solidify the bomb, and",
ChatColor.RESET + "a second time to solidify the bomb, and",
ChatColor.RESET + "a third time to detonate it on command.",
}));
@ -98,7 +98,7 @@ public class KitSheep extends SmashKit
{
ChatColor.RESET + "Release one Homing Sheeple towards every player.",
ChatColor.RESET + "They will slowly home in on their target and",
ChatColor.RESET + "explode to deal devestating damage.",
ChatColor.RESET + "explode to deal devastating damage.",
}));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE));

View File

@ -172,6 +172,9 @@ public class Spleef extends SoloGame
event.setCancelled(true);
if (event.getBlock().getType() == Material.BEDROCK)
return;
BlockFade(event.getBlock(), event.getPlayer(), false);
//Snowball

View File

@ -21,7 +21,7 @@ public class KitSnowballer extends Kit
new String[]
{
"Throw snowballs to break blocks!",
"Receives 2 Snowball when you punch blocks!"
"Receives 1 Snowball when you punch blocks!"
},
new Perk[]

View File

@ -4,33 +4,6 @@ import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftArrow;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
import net.minecraft.server.v1_7_R4.EntityArrow;
import net.minecraft.server.v1_7_R4.Item;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.MapUtil;
@ -57,6 +30,32 @@ import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.BehindEnemyLinesStatTracker;
import nautilus.game.arcade.stats.BlockShreadStatTracker;
import nautilus.game.arcade.stats.TheComebackStatTracker;
import net.minecraft.server.v1_7_R4.EntityArrow;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftArrow;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
public class TurfForts extends TeamGame
{
@ -328,6 +327,16 @@ public class TurfForts extends TeamGame
}
}
@EventHandler(priority = EventPriority.HIGH)
public void BlockBreak(BlockBreakEvent event)
{
if (!IsAlive(event.getPlayer()))
{
event.setCancelled(true);
return;
}
}
@EventHandler
public void BlockDamage(ProjectileHitEvent event)

View File

@ -6,24 +6,6 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.EntityEffect;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.ThrownPotion;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
@ -43,14 +25,32 @@ import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.games.paintball.PlayerCopy;
import nautilus.game.arcade.game.games.wither.kit.*;
import nautilus.game.arcade.game.games.wither.kit.KitHumanArcher;
import nautilus.game.arcade.game.games.wither.kit.KitWitherMinion;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.NullKit;
import nautilus.game.arcade.kit.perks.data.IBlockRestorer;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.EntityEffect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.ThrownPotion;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
public class WitherGame extends TeamGame implements IBlockRestorer
{
private GameTeam _runners;
@ -110,13 +110,7 @@ public class WitherGame extends TeamGame implements IBlockRestorer
this.KitRegisterState = GameState.Prepare;
this.TeamArmor = true;
this.TeamArmorHotbar = false;
_help = new String[]
{
C.cRed + C.Bold + "This game is still under development!",
};
this.TeamArmorHotbar = false;
}
@Override

View File

@ -2,16 +2,17 @@ package nautilus.game.arcade.kit.perks;
import java.util.HashMap;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.kit.Perk;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
public class PerkArcticAura extends Perk
{
public PerkArcticAura()
@ -32,7 +33,10 @@ public class PerkArcticAura extends Perk
{
if (!Kit.HasKit(player))
continue;
if (((CraftPlayer) player).getHandle().spectating)
continue;
double range = 5*player.getExp();
//Blocks

View File

@ -89,8 +89,8 @@ public class PerkDestructor extends Perk
{
if (event.isCancelled())
return;
if (!UtilInv.IsItem(event.getItemDrop().getItemStack(), Material.ENDER_PEARL, (byte) 0))
if (!UtilInv.IsItem(event.getItemDrop().getItemStack(), "Seismic Charge", Material.ENDER_PEARL, (byte) 0))
return;
//Cancel

View File

@ -2,6 +2,19 @@ package nautilus.game.arcade.kit.perks;
import java.util.HashMap;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.Perk;
import org.bukkit.Effect;
import org.bukkit.Sound;
import org.bukkit.block.Block;
@ -11,23 +24,10 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.Perk;
public class PerkSeismicSlam extends Perk
{
private HashMap<LivingEntity, Long> _live = new HashMap<LivingEntity, Long>();
@ -39,6 +39,21 @@ public class PerkSeismicSlam extends Perk
C.cYellow + "Right-Click" + C.cGray + " with Spade to " + C.cGreen + "Seismic Slam"
});
}
@EventHandler
public void deactivateDeath(PlayerDeathEvent event)
{
if (!Manager.GetGame().IsLive())
return;
if (!Kit.HasKit(event.getEntity()))
return;
if (_live.containsKey(event.getEntity()))
{
_live.remove(event.getEntity());
}
}
@EventHandler
public void Leap(PlayerInteractEvent event)
@ -109,6 +124,9 @@ public class PerkSeismicSlam extends Perk
if (cur.equals(player))
continue;
if (cur instanceof Player && !Manager.IsAlive((Player) cur))
continue;
//Damage Event
Manager.GetDamage().NewDamageEvent(cur, player, null,
DamageCause.CUSTOM, damage * targets.get(cur) + 0.5, true, true, false,

View File

@ -28,7 +28,7 @@ public class PerkSheepHoming extends SmashPerk
public PerkSheepHoming()
{
super("Homing Sheepiles", new String[]
super("Homing Sheeples", new String[]
{
}, false);
}

View File

@ -3,17 +3,6 @@ package nautilus.game.arcade.kit.perks;
import java.util.HashMap;
import java.util.Iterator;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
@ -30,6 +19,18 @@ import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.SmashPerk;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.util.Vector;
public class PerkZombieBile extends SmashPerk implements IThrown
{
private HashMap<Player, Long> _active = new HashMap<Player, Long>();
@ -70,6 +71,21 @@ public class PerkZombieBile extends SmashPerk implements IThrown
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
}
@EventHandler
public void deactivateDeath(PlayerDeathEvent event)
{
if (!Manager.GetGame().IsLive())
return;
if (!Kit.HasKit(event.getEntity()))
return;
if (_active.containsKey(event.getEntity()))
{
_active.remove(event.getEntity());
}
}
@EventHandler
public void update(UpdateEvent event)
{

View File

@ -721,6 +721,12 @@ public class GameFlagManager implements Listener
UtilAction.velocity(player, new Vector(0,0,0), 1, true, 0.4, 0, 1, true);
if (!game.IsAlive(player))
{
Manager.addSpectator(player, true);
return;
}
UtilPlayer.message(player, C.cWhite + C.Bold + "You will respawn in " + time + " seconds...");
UtilTextMiddle.display(null, "Respawning in " + time + " seconds...", 5, 40, 5, player);
@ -732,7 +738,7 @@ public class GameFlagManager implements Listener
if (game.IsAlive(player))
{
game.RespawnPlayer(player);
}
}
else
{
Manager.addSpectator(player, true);

View File

@ -308,6 +308,7 @@ public class GameHostManager implements Listener
if (!event.getMessage().toLowerCase().startsWith("/menu"))
return;
event.setCancelled(true);
openMenu(event.getPlayer());
}

View File

@ -177,18 +177,18 @@ public class GamePlayerManager implements Listener
Player player = event.getPlayer();
GameTeam team = Manager.GetLobby().GetClickedTeam(event.getRightClicked());
if (team == null)
return;
//Observer
if (Manager.IsObserver(player))
{
UtilPlayer.message(player, F.main("Game", "Spectators cannot partake in games."));
return;
}
GameTeam team = Manager.GetLobby().GetClickedTeam(event.getRightClicked());
if (team == null)
return;
TeamClick(player, team);
}
@ -198,20 +198,20 @@ public class GamePlayerManager implements Listener
Player player = event.GetDamagerPlayer(false);
if (player == null) return;
//Observer
if (Manager.IsObserver(player))
{
UtilPlayer.message(player, F.main("Game", "Spectators cannot partake in games."));
return;
}
LivingEntity target = event.GetDamageeEntity();
GameTeam team = Manager.GetLobby().GetClickedTeam(target);
if (team == null)
return;
//Observer
if (Manager.IsObserver(player))
{
UtilPlayer.message(player, F.main("Game", "Spectators cannot partake in games."));
return;
}
TeamClick(player, team);
}
@ -265,6 +265,13 @@ public class GamePlayerManager implements Listener
Player player = event.getPlayer();
Kit kit = Manager.GetLobby().GetClickedKit(event.getRightClicked());
if (kit == null)
return;
//Observer
if (Manager.IsObserver(player) || Manager.isSpectator(player))
{
@ -272,11 +279,6 @@ public class GamePlayerManager implements Listener
return;
}
Kit kit = Manager.GetLobby().GetClickedKit(event.getRightClicked());
if (kit == null)
return;
KitClick(player, kit, event.getRightClicked());
event.setCancelled(true);
@ -294,12 +296,7 @@ public class GamePlayerManager implements Listener
Player player = event.GetDamagerPlayer(false);
if (player == null) return;
//Observer
if (Manager.IsObserver(player) || Manager.isSpectator(player))
{
UtilPlayer.message(player, F.main("Game", "Spectators cannot partake in games."));
return;
}
LivingEntity target = event.GetDamageeEntity();
@ -307,7 +304,14 @@ public class GamePlayerManager implements Listener
if (kit == null)
return;
//Observer
if (Manager.IsObserver(player) || Manager.isSpectator(player))
{
UtilPlayer.message(player, F.main("Game", "Spectators cannot partake in games."));
return;
}
KitClick(player, kit, target);
}
@ -340,7 +344,7 @@ public class GamePlayerManager implements Listener
{
Manager.GetGame().SetKit(player, kit, true);
}
else if (kit.GetAvailability() == KitAvailability.Gem && donor.GetBalance(CurrencyType.Gems) > kit.GetCost())
else if (kit.GetAvailability() == KitAvailability.Gem && donor.GetBalance(CurrencyType.Gems) >= kit.GetCost())
{
Manager.GetShop().openPageForPlayer(player, new ConfirmationPage<ArcadeManager, ArcadeShop>(
Manager, Manager.GetShop(), Manager.GetClients(), Manager.GetDonation(), new Runnable()

View File

@ -1,12 +1,12 @@
package nautilus.game.arcade.stats;
import mineplex.core.common.util.*;
import mineplex.minecraft.game.core.combat.event.*;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.bridge.*;
import org.bukkit.entity.*;
import org.bukkit.event.*;
import org.bukkit.event.entity.*;
import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import nautilus.game.arcade.game.games.bridge.Bridge;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
public class BridgesSniperStatTracker extends StatTracker<Bridge>
{
@ -18,7 +18,7 @@ public class BridgesSniperStatTracker extends StatTracker<Bridge>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event)
{
if (getGame().GetState() != Game.GameState.Live)
if (!getGame().IsLive())
return;
if (getGame().isBridgesDown())
@ -31,6 +31,7 @@ public class BridgesSniperStatTracker extends StatTracker<Bridge>
return;
Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
if (killer == null)
return;
@ -41,13 +42,16 @@ public class BridgesSniperStatTracker extends StatTracker<Bridge>
return;
Player player = UtilPlayer.searchExact(event.GetLog().GetPlayer().GetName());
if (player == null)
return;
if (player == killer)
return;
if ("Archery".equals(event.GetLog().GetLastDamager().GetLastDamageSource()))
if (event.GetLog().GetLastDamager().GetLastDamageSource().contains("Archery"))
{
addStat(killer, "Sniper", 1, true, false);
}
}
}

View File

@ -1,8 +1,15 @@
package nautilus.game.arcade.stats;
import mineplex.minecraft.game.classcombat.Skill.Mage.*;
import nautilus.game.arcade.game.*;
import org.bukkit.event.*;
import java.util.ArrayList;
import java.util.List;
import mineplex.minecraft.game.classcombat.Skill.Mage.LightningOrb.LightningOrbEvent;
import nautilus.game.arcade.game.Game;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
public class ElectrocutionStatTracker extends StatTracker<Game>
{
@ -12,12 +19,24 @@ public class ElectrocutionStatTracker extends StatTracker<Game>
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onLightningOrb(LightningOrb.LightningOrbEvent event)
public void onLightningOrb(LightningOrbEvent event)
{
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.getStruck().size() >= 4)
List<Player> viable = new ArrayList<Player>();
for (LivingEntity en : event.getStruck())
{
if (en instanceof Player)
{
viable.add((Player) en);
}
}
if (viable.size() >= 4)
{
addStat(event.getPlayer(), "MassElectrocution", 1, true, false);
}
}
}

View File

@ -1,12 +1,18 @@
package nautilus.game.arcade.stats;
import nautilus.game.arcade.game.*;
import nautilus.game.arcade.game.games.survivalgames.*;
import org.bukkit.event.*;
import java.util.HashSet;
import java.util.Set;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.survivalgames.SupplyChestOpenEvent;
import org.bukkit.block.Block;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
public class FirstSupplyDropOpenStatTracker extends StatTracker<Game>
{
private boolean first = true;
private Set<Block> _opened = new HashSet<Block>();
public FirstSupplyDropOpenStatTracker(Game game)
{
@ -19,11 +25,11 @@ public class FirstSupplyDropOpenStatTracker extends StatTracker<Game>
if (getGame().GetState() != Game.GameState.Live)
return;
if (first)
{
addStat(event.getPlayer(), "SupplyDropsOpened", 1, false, false);
if (_opened.contains(event.getChest()))
return;
_opened.add(event.getChest());
first = false;
}
addStat(event.getPlayer(), "SupplyDropsOpened", 1, false, false);
}
}

View File

@ -4,15 +4,14 @@ import java.util.HashMap;
import java.util.Map;
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 nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.games.castlesiege.kits.KitUndead;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
public class LastStandStatTracker extends StatTracker<TeamGame>
{

View File

@ -18,7 +18,7 @@ public class TheLongestShotStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event)
{
if (getGame().GetState() != Game.GameState.Live)
if (!getGame().IsLive())
return;
if (event.GetLog().GetKiller() == null)
@ -38,13 +38,16 @@ public class TheLongestShotStatTracker extends StatTracker<Game>
return;
Player player = UtilPlayer.searchExact(event.GetLog().GetPlayer().GetName());
if (player == null)
if (player == null || !player.isOnline())
return;
if (event.GetLog().GetLastDamager().GetReason() != null && event.GetLog().GetLastDamager().GetReason().contains("Longshot"))
if (event.GetLog().GetLastDamager().GetReason() != null && event.GetLog().GetLastDamager().GetReason().toLowerCase().contains("longshot"))
{
if (killer.getLocation().distanceSquared(player.getLocation()) >= 64 * 64)
if (killer.getLocation().distance(player.getLocation()) >= 64)
{
addStat(killer, "TheLongestShot", 1, false, false);
}
}
}
}

View File

@ -3,20 +3,19 @@ package nautilus.game.arcade.stats;
import java.util.HashSet;
import java.util.List;
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 nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
public class WinWithoutDyingStatTracker extends StatTracker<Game>
{
private final Set<UUID> _hasDied = new HashSet<>();
private final Set<String> _hasDied = new HashSet<String>();
private final String _stat;
public WinWithoutDyingStatTracker(Game game, String stat)
@ -29,7 +28,7 @@ public class WinWithoutDyingStatTracker extends StatTracker<Game>
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onCombatDeath(CombatDeathEvent event)
{
if (getGame().GetState() != Game.GameState.Live)
if (!getGame().IsLive())
return;
if (event.GetLog().GetPlayer() == null)
@ -39,13 +38,14 @@ public class WinWithoutDyingStatTracker extends StatTracker<Game>
return;
Player player = UtilPlayer.searchExact(event.GetLog().GetPlayer().GetName());
if (player == null)
if (player == null || !player.isOnline())
{
return;
_hasDied.add(player.getUniqueId());
}
_hasDied.add(player.getUniqueId().toString());
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
@EventHandler(priority = EventPriority.MONITOR)
public void onGameStateChange(GameStateChangeEvent event)
{
if (event.GetState() == Game.GameState.End)
@ -56,8 +56,10 @@ public class WinWithoutDyingStatTracker extends StatTracker<Game>
{
for (Player winner : winners)
{
if (!_hasDied.contains(winner.getUniqueId()))
addStat(winner, getStat(), 1, true, false);
if (!_hasDied.contains(winner.getUniqueId().toString()))
{
addStat(winner, _stat, 1, true, false);
}
}
}
}

View File

@ -3,24 +3,22 @@ package nautilus.game.arcade.stats;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.skywars.events.PlayerOpenChestEvent;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.player.PlayerInteractEvent;
public class WinWithoutOpeningChestStatTracker extends StatTracker<Game>
{
private final Set<UUID> _openChest = new HashSet<>();
private final Set<String> _openChest = new HashSet<String>();
public WinWithoutOpeningChestStatTracker(Game game)
{
@ -28,14 +26,18 @@ public class WinWithoutOpeningChestStatTracker extends StatTracker<Game>
}
@EventHandler
@EventHandler(priority = EventPriority.HIGH)
public void onOpenChest(PlayerInteractEvent event)
{
if (event.getAction() == Action.RIGHT_CLICK_BLOCK)
if (event.isCancelled())
{
return;
}
if (UtilEvent.isAction(event, ActionType.R_BLOCK))
{
if (event.getClickedBlock() != null && event.getClickedBlock().getType() == Material.CHEST)
{
_openChest.add(event.getPlayer().getUniqueId());
_openChest.add(event.getPlayer().getUniqueId().toString());
}
}
}
@ -44,10 +46,12 @@ public class WinWithoutOpeningChestStatTracker extends StatTracker<Game>
public void onBreakChest(BlockBreakEvent event)
{
if (event.getBlock().getType() == Material.CHEST)
_openChest.add(event.getPlayer().getUniqueId());
{
_openChest.add(event.getPlayer().getUniqueId().toString());
}
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
@EventHandler(priority = EventPriority.MONITOR)
public void onGameStateChange(GameStateChangeEvent event)
{
if (event.GetState() == Game.GameState.End)
@ -58,8 +62,10 @@ public class WinWithoutOpeningChestStatTracker extends StatTracker<Game>
{
for (Player winner : winners)
{
if (!_openChest.contains(winner.getUniqueId()))
if (!_openChest.contains(winner.getUniqueId().toString()))
{
addStat(winner, "NoChest", 1, true, false);
}
}
}
}

View File

@ -1,19 +1,23 @@
package nautilus.game.arcade.stats;
import mineplex.core.updater.*;
import mineplex.core.updater.event.*;
import nautilus.game.arcade.events.*;
import nautilus.game.arcade.game.*;
import org.bukkit.*;
import org.bukkit.entity.*;
import org.bukkit.event.*;
import org.bukkit.inventory.*;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.*;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.inventory.ItemStack;
public class WinWithoutWearingArmorStatTracker extends StatTracker<Game>
{
private final Set<UUID> _armorWearers = new HashSet<>();
private final Set<String> _wearing = new HashSet<String>();
public WinWithoutWearingArmorStatTracker(Game game)
{
@ -26,19 +30,20 @@ public class WinWithoutWearingArmorStatTracker extends StatTracker<Game>
if (getGame().GetState() != Game.GameState.Live)
return;
if (event.getType() == UpdateType.FAST)
if (event.getType() == UpdateType.TICK)
{
for (Player player : getGame().GetPlayers(true))
{
if (_armorWearers.contains(player.getUniqueId()))
if (_wearing.contains(player.getUniqueId().toString()))
{
continue;
}
for (ItemStack armor : player.getInventory().getArmorContents())
{
if (armor != null && armor.getType() != Material.AIR)
{
_armorWearers.add(player.getUniqueId());
_wearing.add(player.getUniqueId().toString());
break;
}
}
@ -46,7 +51,7 @@ public class WinWithoutWearingArmorStatTracker extends StatTracker<Game>
}
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
@EventHandler(priority = EventPriority.MONITOR)
public void onGameStateChange(GameStateChangeEvent event)
{
if (event.GetState() == Game.GameState.End)
@ -57,8 +62,10 @@ public class WinWithoutWearingArmorStatTracker extends StatTracker<Game>
{
for (Player winner : winners)
{
if (!_armorWearers.contains(winner.getUniqueId()))
if (!_wearing.contains(winner.getUniqueId().toString()))
{
addStat(winner, "NoArmor", 1, true, false);
}
}
}
}