Merge branch 'update/brawl-games' into develop

This commit is contained in:
cnr 2016-07-12 06:45:32 -05:00
commit daddaa477e
56 changed files with 3867 additions and 1739 deletions

View File

@ -22,9 +22,9 @@ public class TestRank extends CommandBase<CoreClientManager>
@Override
public void Execute(final Player caller, String[] args)
{
if (!Plugin.Get(caller).GetRank(true).has(Rank.JNR_DEV))
if (!Plugin.Get(caller).GetRank(true).has(Rank.SNR_MODERATOR))
{
UtilPlayer.message(caller, F.main("Permissions", "This requires Permission Rank [" + Rank.JNR_DEV.getTag(false, true) + C.cGray + "]."));
UtilPlayer.message(caller, F.main("Permissions", "This requires Permission Rank [" + Rank.SNR_MODERATOR.getTag(false, true) + C.cGray + "]."));
return;
}
@ -65,6 +65,14 @@ public class TestRank extends CommandBase<CoreClientManager>
UtilPlayer.message(caller, F.main(Plugin.getName(), ChatColor.RED + "" + ChatColor.BOLD + "Invalid rank!"));
return;
}
if (Plugin.Get(caller).GetRank(true) == Rank.SNR_MODERATOR)
{
if (tempRank.has(Rank.TWITCH))
{
UtilPlayer.message(caller, F.main("Command", "You can only test Player ranks!"));
return;
}
}
Plugin.Get(caller).SetRank(tempRank, true);
UtilPlayer.message(caller, F.main(Plugin.getName(), "Your rank has been set to " + tempRank.getTag(false, false) + C.cGray + "!"));

View File

@ -368,6 +368,7 @@ public class ServerGroup
_dataMap.put("tournament", _tournament + "");
_dataMap.put("tournamentPoints", _tournamentPoints + "");
_dataMap.put("games", _games);
_dataMap.put("modes", _modes);
_dataMap.put("serverType", _serverType);
_dataMap.put("addNoCheat", _addNoCheat + "");
_dataMap.put("teamRejoin", _teamRejoin + "");

View File

@ -1,5 +1,7 @@
package nautilus.game.arcade;
import mineplex.core.common.MinecraftVersion;
import mineplex.core.common.Pair;
import nautilus.game.arcade.game.Game;
/**
@ -14,16 +16,34 @@ public class GameMode
private GameType _gameType;
private String _name;
private Pair<MinecraftVersion, String>[] _resourcePackUrls;
private boolean _enforceResourcePack;
/**
*
* @param gameMode Game class that in most cases extends the host game class
* @param name Gamemode name
*/
public GameMode(Class<? extends Game> gameMode, GameType gameType, String name)
{
this(gameMode, gameType, name, null, false);
}
/**
*
* @param gameMode Game class that in most cases extends the host game class
* @param gameType original GameType of modded game
* @param name Gamemode name
* @param resourcePackUrls URLs to 1.8/1.9 resource pack
* @param enforceResourcePack enforece resource pack on players
*/
public GameMode(Class<? extends Game> gameMode, GameType gameType, String name, Pair<MinecraftVersion, String>[] resourcePackUrls, boolean enforceResourcePack)
{
_gameMode = gameMode;
_gameType = gameType;
_name = name;
_resourcePackUrls = resourcePackUrls;
_enforceResourcePack = enforceResourcePack;
}
/**
@ -53,4 +73,22 @@ public class GameMode
return _gameType;
}
/**
*
* @return Gamemode resource pack URLs
*/
public Pair<MinecraftVersion, String>[] getResPackURLs()
{
return _resourcePackUrls;
}
/**
*
* @return Gamemode enforcing of resource packs
*/
public boolean enforceResourcePack()
{
return _enforceResourcePack;
}
}

View File

@ -1,5 +1,7 @@
package nautilus.game.arcade;
import org.bukkit.Material;
import mineplex.core.common.MinecraftVersion;
import mineplex.core.common.Pair;
import mineplex.core.game.GameCategory;
@ -10,6 +12,7 @@ import nautilus.game.arcade.game.games.barbarians.Barbarians;
import nautilus.game.arcade.game.games.bossbattles.BossBattles;
import nautilus.game.arcade.game.games.bouncyballs.BouncyBalls;
import nautilus.game.arcade.game.games.bridge.Bridge;
import nautilus.game.arcade.game.games.bridge.modes.LuckyBridges;
import nautilus.game.arcade.game.games.bridge.modes.OverpoweredBridge;
import nautilus.game.arcade.game.games.bridge.modes.SpeedBridges ;
import nautilus.game.arcade.game.games.build.Build;
@ -20,6 +23,7 @@ import nautilus.game.arcade.game.games.castlesiege.CastleSiege;
import nautilus.game.arcade.game.games.champions.ChampionsCTF;
import nautilus.game.arcade.game.games.champions.ChampionsDominate;
import nautilus.game.arcade.game.games.champions.ChampionsTDM;
import nautilus.game.arcade.game.games.champions.modes.SmashDom;
import nautilus.game.arcade.game.games.christmas.Christmas;
import nautilus.game.arcade.game.games.deathtag.DeathTag;
import nautilus.game.arcade.game.games.dragonescape.DragonEscape;
@ -33,6 +37,7 @@ import nautilus.game.arcade.game.games.evolution.Evolution;
import nautilus.game.arcade.game.games.gladiators.Gladiators;
import nautilus.game.arcade.game.games.gladiators.modes.ChampionsGladiators;
import nautilus.game.arcade.game.games.gladiators.modes.OverpoweredGladiators;
import nautilus.game.arcade.game.games.gladiators.modes.SmashGladiators;
import nautilus.game.arcade.game.games.gravity.Gravity;
import nautilus.game.arcade.game.games.halloween.Halloween;
import nautilus.game.arcade.game.games.hideseek.HideSeek;
@ -41,10 +46,13 @@ import nautilus.game.arcade.game.games.holeinwall.HoleInTheWall;
import nautilus.game.arcade.game.games.horsecharge.Horse;
import nautilus.game.arcade.game.games.lobbers.BombLobbers;
import nautilus.game.arcade.game.games.micro.Micro;
import nautilus.game.arcade.game.games.micro.modes.CookieFight;
import nautilus.game.arcade.game.games.micro.modes.OverpoweredMicroBattles;
import nautilus.game.arcade.game.games.micro.modes.TinySmash;
import nautilus.game.arcade.game.games.micro.modes.TinyWinners;
import nautilus.game.arcade.game.games.milkcow.MilkCow;
import nautilus.game.arcade.game.games.minecraftleague.MinecraftLeague;
import nautilus.game.arcade.game.games.minestrike.MineStrike;
import nautilus.game.arcade.game.games.minestrike.Minestrike;
import nautilus.game.arcade.game.games.mineware.MineWare;
import nautilus.game.arcade.game.games.monsterleague.MonsterLeague;
import nautilus.game.arcade.game.games.monstermaze.MonsterMaze;
@ -59,9 +67,12 @@ import nautilus.game.arcade.game.games.runner.modes.FasterThanLight;
import nautilus.game.arcade.game.games.searchanddestroy.SearchAndDestroy;
import nautilus.game.arcade.game.games.sheep.SheepGame;
import nautilus.game.arcade.game.games.sheep.modes.EweHeroes;
import nautilus.game.arcade.game.games.sheep.modes.OverpoweredSheepQuest;
import nautilus.game.arcade.game.games.sheep.modes.SmashSheep;
import nautilus.game.arcade.game.games.skywars.SoloSkywars;
import nautilus.game.arcade.game.games.skywars.TeamSkywars;
import nautilus.game.arcade.game.games.skywars.modes.OverpoweredSkywars;
import nautilus.game.arcade.game.games.skywars.modes.SkySmash;
import nautilus.game.arcade.game.games.skywars.modes.UHCSkywars;
import nautilus.game.arcade.game.games.smash.SoloSuperSmash;
import nautilus.game.arcade.game.games.smash.SuperSmashDominate;
@ -78,7 +89,9 @@ import nautilus.game.arcade.game.games.squidshooter.SquidShooter;
import nautilus.game.arcade.game.games.stacker.Stacker;
import nautilus.game.arcade.game.games.survivalgames.SoloSurvivalGames;
import nautilus.game.arcade.game.games.survivalgames.TeamSurvivalGames;
import nautilus.game.arcade.game.games.survivalgames.modes.ChangingKits;
import nautilus.game.arcade.game.games.survivalgames.modes.OverpoweredSurvival;
import nautilus.game.arcade.game.games.survivalgames.modes.StrikeGames;
import nautilus.game.arcade.game.games.survivalgames.modes.UHCSurvivalgames;
import nautilus.game.arcade.game.games.tug.Tug;
import nautilus.game.arcade.game.games.turfforts.TurfForts;
@ -92,7 +105,6 @@ import nautilus.game.arcade.game.games.valentines.Valentines;
import nautilus.game.arcade.game.games.wither.WitherGame;
import nautilus.game.arcade.game.games.wizards.Wizards;
import nautilus.game.arcade.game.games.zombiesurvival.ZombieSurvival;
import org.bukkit.Material;
public enum GameType
{
@ -132,7 +144,7 @@ public enum GameType
Lobbers(BombLobbers.class, GameDisplay.Lobbers),
Micro(Micro.class, GameDisplay.Micro),
MilkCow(MilkCow.class, GameDisplay.MilkCow),
MineStrike(MineStrike.class, GameDisplay.MineStrike, new Pair[]
MineStrike(Minestrike.class, GameDisplay.MineStrike, new Pair[]
{
Pair.create(MinecraftVersion.Version1_8, "http://file.mineplex.com/ResMinestrike.zip"),
Pair.create(MinecraftVersion.Version1_9, "http://file.mineplex.com/ResMinestrike19.zip")
@ -195,20 +207,42 @@ public enum GameType
GameType.WitherAssault, GameType.Wizards, GameType.ZombieSurvival}, true),
Brawl(null, new GameMode[]{
new GameMode(OverpoweredBridge.class, GameType.Bridge, "OP Bridges"), new GameMode(SpeedBridges.class, GameType.Bridge, "Speed Bridges"),
new GameMode(OverpoweredGladiators.class, GameType.Gladiators, "OP Gladiators"), new GameMode(ChampionsGladiators.class, GameType.Gladiators, "Champions Gladiators"),
new GameMode(OverpoweredSkywars.class, GameType.Skywars, "OP Skywars"), new GameMode(UHCSkywars.class, GameType.Skywars, "UHC Skywars"),
new GameMode(TeamBuild.class, GameType.Build, "Team Master Builders"), new GameMode(DukesOfDecoration.class, GameType.Build, "Dukes Of Decoration"),
new GameMode(CutClean.class, GameType.UHC, "Cut Clean"), new GameMode(GodBattles.class, GameType.UHC, "God Battles"),
new GameMode(BloodDiamonds.class, GameType.UHC, "Blood Diamonds"), new GameMode(Assassins.class, GameType.UHC, "Assassins"),
new GameMode(OverpoweredSurvival.class, GameType.SurvivalGames, "OP Survival Games"), new GameMode(UHCSurvivalgames.class, GameType.SurvivalGames, "UHC Survivalgames"),
new GameMode(OverpoweredBridge.class, GameType.Bridge, "OP Bridges"),
new GameMode(SpeedBridges.class, GameType.Bridge, "Speed Bridges"),
new GameMode(LuckyBridges.class, GameType.Bridge, "Lucky Bridges"),
new GameMode(OverpoweredGladiators.class, GameType.Gladiators, "OP Gladiators"),
new GameMode(ChampionsGladiators.class, GameType.Gladiators, "Champions Gladiators"),
new GameMode(SmashGladiators.class, GameType.Gladiators, "Smash Gladiators"),
new GameMode(OverpoweredSkywars.class, GameType.Skywars, "OP Skywars"),
new GameMode(UHCSkywars.class, GameType.Skywars, "UHC Skywars"),
new GameMode(SkySmash.class, GameType.Skywars, "Sky Smash"),
new GameMode(TeamBuild.class, GameType.Build, "Team Master Builders"),
new GameMode(DukesOfDecoration.class, GameType.Build, "Dukes Of Decoration"),
new GameMode(CutClean.class, GameType.UHC, "Cut Clean"),
new GameMode(GodBattles.class, GameType.UHC, "God Battles"),
new GameMode(BloodDiamonds.class, GameType.UHC, "Blood Diamonds"),
new GameMode(Assassins.class, GameType.UHC, "Assassins"),
new GameMode(OverpoweredSurvival.class, GameType.SurvivalGames, "OP Survival Games"),
new GameMode(UHCSurvivalgames.class, GameType.SurvivalGames, "UHC Survivalgames"),
new GameMode(ChangingKits.class, GameType.SurvivalGames, "Changing Kits"),
new GameMode(StrikeGames.class, GameType.SurvivalGames, "Strike Games", new Pair[]
{
Pair.create(MinecraftVersion.Version1_8, "http://file.mineplex.com/ResStrikeGames18.zip"),
Pair.create(MinecraftVersion.Version1_9, "http://file.mineplex.com/ResStrikeGames19.zip")
}, true),
new GameMode(TinyWinners.class, GameType.Micro, "Tiny Winners"),
new GameMode(OverpoweredMicroBattles.class, GameType.Micro, "OP Micro Battles"),
new GameMode(CookieFight.class, GameType.Micro, "Cookie Fight"),
new GameMode(TinySmash.class, GameType.Micro, "Tiny Smash"),
new GameMode(UltraSpleef.class, GameType.Spleef, "Ultra Spleef"),
new GameMode(RandomKitSSM.class, GameType.Smash, "Random Kit SSM"),
new GameMode(EweHeroes.class, GameType.Sheep, "Heroes Of The Ewe"),
new GameMode(SmashSheep.class, GameType.Sheep, "Smash Sheep"),
new GameMode(OverpoweredSheepQuest.class, GameType.Sheep, "OP Sheep Quest"),
new GameMode(FasterThanLight.class, GameType.Runner, "Faster Than Light"),
new GameMode(BunnyHop.class, GameType.Quiver, "Bunny Hop"),
new GameMode(TinyWinners.class, GameType.Micro, "Tiny Winners"),
new GameMode(Countdown.class, GameType.HideSeek, "Countdown"),
new GameMode(SmashDom.class, GameType.ChampionsDominate, "Smash Dominate"),
}, GameDisplay.Brawl, null, false, null, false, true);
GameDisplay _display;
@ -277,13 +311,21 @@ public enum GameType
return _gameModes;
}
public boolean isEnforceResourcePack()
public boolean isEnforceResourcePack(Game game)
{
if (hasGamemodes())
{
return getGameMode(game.getClass()).enforceResourcePack();
}
return _enforceResourcePack;
}
public Pair<MinecraftVersion, String>[] getResourcePackUrls()
public Pair<MinecraftVersion, String>[] getResourcePackUrls(Game game)
{
if (hasGamemodes())
{
return getGameMode(game.getClass()).getResPackURLs();
}
return _resourcePacks;
}
@ -331,18 +373,28 @@ public enum GameType
return _display.getKitGameName();
}
public GameType getModeGameType(Class<? extends Game> game)
public boolean isUsingGameModes()
{
return _gameMaps;
}
public GameMode getGameMode(Class<? extends Game> game)
{
for (GameMode mode : getGameModes())
{
if (mode.getGameClass() != null && mode.getGameClass().getName().contentEquals(game.getName()))
{
return mode.getType();
return mode;
}
}
return null;
}
public GameType getModeGameType(Class<? extends Game> game)
{
return getGameMode(game).getType();
}
public boolean isUsingGameModesMaps()
{
return _gameMaps;

View File

@ -399,7 +399,7 @@ public abstract class Game implements Listener
new ExperienceStatTracker(this), new WinStatTracker(this), new LoseStatTracker(this), new DamageDealtStatTracker(
this), new DamageTakenStatTracker(this), new GamesPlayedStatTracker(this));
Manager.getResourcePackManager().setResourcePack(gameType.getResourcePackUrls(), gameType.isEnforceResourcePack());
Manager.getResourcePackManager().setResourcePack(gameType.getResourcePackUrls(this), gameType.isEnforceResourcePack(this));
_useEntityPacketHandler = new IPacketHandler()
{
@ -868,6 +868,11 @@ public abstract class Game implements Listener
}
public void SetKit(Player player, Kit kit, boolean announce)
{
SetKit(player, kit, announce, true);
}
public void SetKit(Player player, Kit kit, boolean announce, boolean apply)
{
GameTeam team = GetTeam(player);
if (team != null)
@ -898,7 +903,7 @@ public abstract class Game implements Listener
UtilPlayer.message(player, F.main("Kit", "You equipped " + F.elem(kit.GetFormattedName() + " Kit") + "."));
}
if (InProgress())
if (InProgress() && apply)
{
kit.ApplyKit(player);
}

View File

@ -0,0 +1,74 @@
package nautilus.game.arcade.game.games.bridge.modes;
import mineplex.core.common.util.UtilMath;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.games.AbsorptionFix;
import nautilus.game.arcade.game.games.bridge.Bridge;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.inventory.ItemStack;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
/**
* LuckyBridges gamemode for Bridges
*
* @author xXVevzZXx
*/
public class LuckyBridges extends Bridge
{
private HashMap<Material, List<Material>> _drops;
public LuckyBridges(ArcadeManager manager)
{
super(manager, GameType.Brawl);
_drops = new HashMap<>();
_drops.put(Material.DIAMOND_ORE, Arrays.asList(
Material.DIAMOND_HELMET, Material.DIAMOND_CHESTPLATE, Material.DIAMOND_LEGGINGS, Material.DIAMOND_BOOTS,
Material.DIAMOND_PICKAXE, Material.DIAMOND_AXE, Material.DIAMOND_SWORD));
_drops.put(Material.IRON_ORE, Arrays.asList(
Material.IRON_HELMET, Material.IRON_CHESTPLATE, Material.IRON_LEGGINGS, Material.IRON_BOOTS,
Material.IRON_PICKAXE, Material.IRON_AXE, Material.IRON_SWORD));
_drops.put(Material.GOLD_ORE, Arrays.asList(
Material.GOLD_HELMET, Material.GOLD_CHESTPLATE, Material.GOLD_LEGGINGS, Material.GOLD_BOOTS,
Material.GOLD_PICKAXE, Material.GOLD_AXE, Material.GOLD_SWORD, Material.GOLDEN_APPLE));
new AbsorptionFix(this);
}
@EventHandler
public void mine(BlockBreakEvent event)
{
List<Material> blockDrops = _drops.get(event.getBlock().getType());
if (blockDrops != null)
{
event.setCancelled(true);
event.getBlock().setType(Material.AIR);
Bukkit.getScheduler().runTask(Manager.getPlugin(), () ->
event.getBlock().getWorld().dropItem(
event.getBlock().getLocation().add(0.5, 0.2, 0.5),
new ItemStack(blockDrops.get(UtilMath.r(blockDrops.size()))))
);
}
}
@Override
public String GetMode()
{
return "Lucky Bridges";
}
}

View File

@ -54,12 +54,6 @@ public class OverpoweredBridge extends Bridge
Manager.GetDamage().SetEnabled(false);
new AbsorptionFix(this);
}
@Override
public void ParseData()
{
_starterChests = new HashMap<>();
_starterItems = new HashMap<>();
_starterItems.put(Material.WOOD, 64);
@ -72,6 +66,12 @@ public class OverpoweredBridge extends Bridge
_starterItems.put(Material.EXP_BOTTLE, 64);
_starterItems.put(Material.COOKED_BEEF, 64);
_starterItems.put(Material.DIAMOND, 300);
}
@Override
public void ParseData()
{
_starterChests = new HashMap<>();
ParseLavaBridge();
ParseWoodBridge();

View File

@ -0,0 +1,109 @@
package nautilus.game.arcade.game.games.champions.modes;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.games.common.Domination;
import nautilus.game.arcade.game.games.smash.kits.KitBlaze;
import nautilus.game.arcade.game.games.smash.kits.KitChicken;
import nautilus.game.arcade.game.games.smash.kits.KitCow;
import nautilus.game.arcade.game.games.smash.kits.KitCreeper;
import nautilus.game.arcade.game.games.smash.kits.KitEnderman;
import nautilus.game.arcade.game.games.smash.kits.KitGolem;
import nautilus.game.arcade.game.games.smash.kits.KitMagmaCube;
import nautilus.game.arcade.game.games.smash.kits.KitPig;
import nautilus.game.arcade.game.games.smash.kits.KitSheep;
import nautilus.game.arcade.game.games.smash.kits.KitSkeletalHorse;
import nautilus.game.arcade.game.games.smash.kits.KitSkeleton;
import nautilus.game.arcade.game.games.smash.kits.KitSkySquid;
import nautilus.game.arcade.game.games.smash.kits.KitSlime;
import nautilus.game.arcade.game.games.smash.kits.KitSnowman;
import nautilus.game.arcade.game.games.smash.kits.KitSpider;
import nautilus.game.arcade.game.games.smash.kits.KitWitch;
import nautilus.game.arcade.game.games.smash.kits.KitWitherSkeleton;
import nautilus.game.arcade.game.games.smash.kits.KitWolf;
import nautilus.game.arcade.game.games.smash.kits.KitZombie;
import nautilus.game.arcade.kit.Kit;
/**
* SmashDom
*
* @author xXVevzZXx
*/
public class SmashDom extends Domination
{
public SmashDom(ArcadeManager manager)
{
super(manager, GameType.Brawl, new Kit[]
{
new KitSkeleton(manager),
new KitGolem(manager),
new KitSpider(manager),
new KitSlime(manager),
new KitCreeper(manager),
new KitEnderman(manager),
new KitSnowman(manager),
new KitWolf(manager),
new KitBlaze(manager),
new KitWitch(manager),
new KitChicken(manager),
new KitSkeletalHorse(manager),
new KitPig(manager),
new KitSkySquid(manager),
new KitWitherSkeleton(manager),
new KitMagmaCube(manager),
new KitZombie(manager),
new KitCow(manager),
new KitSheep(manager)
});
Manager.GetDamage().UseSimpleWeaponDamage = false;
Manager.getCosmeticManager().setHideParticles(true);
Manager.getClassManager().GetItemFactory().getProximityManager().setProxyLimit(6);
Manager.getClassManager().deregisterSelf();
StrictAntiHack = true;
InventoryOpenChest = true;
EnableSupply = false;
}
@EventHandler(priority = EventPriority.LOWEST)
public void noFallDamage(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
if (event.GetCause() == DamageCause.FALL)
event.SetCancelled("No Fall Damage");
}
@EventHandler(priority = EventPriority.HIGH)
public void customKnockback(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
if (event.GetDamageePlayer() != null)
event.AddKnockback("Smash Knockback", 1 + 0.1 * (20 - event.GetDamageePlayer().getHealth()));
}
@Override
public String GetMode()
{
return "Smash Dominate";
}
}

View File

@ -48,6 +48,10 @@ import nautilus.game.arcade.kit.Kit;
public class Domination extends TeamGame
{
//Configuration
public boolean EnableEmerald = true;
public boolean EnableSupply = true;
//Map Data
private ArrayList<CapturePoint> _points = new ArrayList<CapturePoint>();
private ArrayList<Emerald> _emerald = new ArrayList<Emerald>();
@ -179,10 +183,20 @@ public class Domination extends TeamGame
public void PowerupPickup(PlayerPickupItemEvent event)
{
for (Emerald cur : _emerald)
cur.Pickup(event.getPlayer(), event.getItem());
{
if (EnableEmerald)
cur.Pickup(event.getPlayer(), event.getItem());
else
return;
}
for (Resupply cur : _resupply)
cur.Pickup(event.getPlayer(), event.getItem());
{
if (EnableSupply)
cur.Pickup(event.getPlayer(), event.getItem());
else
return;
}
}
@EventHandler

View File

@ -0,0 +1,109 @@
package nautilus.game.arcade.game.games.gladiators.modes;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.games.gladiators.ArenaType;
import nautilus.game.arcade.game.games.gladiators.Gladiators;
import nautilus.game.arcade.game.games.smash.kits.KitBlaze;
import nautilus.game.arcade.game.games.smash.kits.KitChicken;
import nautilus.game.arcade.game.games.smash.kits.KitCow;
import nautilus.game.arcade.game.games.smash.kits.KitCreeper;
import nautilus.game.arcade.game.games.smash.kits.KitEnderman;
import nautilus.game.arcade.game.games.smash.kits.KitGolem;
import nautilus.game.arcade.game.games.smash.kits.KitMagmaCube;
import nautilus.game.arcade.game.games.smash.kits.KitPig;
import nautilus.game.arcade.game.games.smash.kits.KitSheep;
import nautilus.game.arcade.game.games.smash.kits.KitSkeletalHorse;
import nautilus.game.arcade.game.games.smash.kits.KitSkeleton;
import nautilus.game.arcade.game.games.smash.kits.KitSkySquid;
import nautilus.game.arcade.game.games.smash.kits.KitSlime;
import nautilus.game.arcade.game.games.smash.kits.KitSnowman;
import nautilus.game.arcade.game.games.smash.kits.KitSpider;
import nautilus.game.arcade.game.games.smash.kits.KitWitch;
import nautilus.game.arcade.game.games.smash.kits.KitWitherSkeleton;
import nautilus.game.arcade.game.games.smash.kits.KitWolf;
import nautilus.game.arcade.game.games.smash.kits.KitZombie;
import nautilus.game.arcade.kit.Kit;
/**
* SmashGladiators
*
* @author xXVevzZXx
*/
public class SmashGladiators extends Gladiators
{
public SmashGladiators(ArcadeManager manager)
{
super(manager, new Kit[]
{
new KitSkeleton(manager),
new KitGolem(manager),
new KitSpider(manager),
new KitSlime(manager),
new KitCreeper(manager),
new KitEnderman(manager),
new KitSnowman(manager),
new KitWolf(manager),
new KitBlaze(manager),
new KitWitch(manager),
new KitChicken(manager),
new KitSkeletalHorse(manager),
new KitPig(manager),
new KitSkySquid(manager),
new KitWitherSkeleton(manager),
new KitMagmaCube(manager),
new KitZombie(manager),
new KitCow(manager),
new KitSheep(manager)
}, GameType.Brawl);
}
@EventHandler(priority = EventPriority.LOWEST)
public void noFallDamage(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
if (event.GetCause() == DamageCause.FALL)
event.SetCancelled("No Fall Damage");
}
@EventHandler(priority = EventPriority.HIGH)
public void customKnockback(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
if (event.GetDamageePlayer() != null)
event.AddKnockback("Smash Knockback", 1 + 0.1 * (20 - event.GetDamageePlayer().getHealth()));
}
@Override
protected void giveLoadout(Player p, ArenaType type)
{
if (!GetPlayers(true).contains(p))
return;
GetKit(p).ApplyKit(p);
p.playSound(p.getLocation(), Sound.LEVEL_UP, 1f, 1f);
}
@Override
public String GetMode()
{
return "Smash Gladiators";
}
}

View File

@ -30,6 +30,19 @@ public class Micro extends TeamGame
private ArrayList<Block> _blocks = new ArrayList<Block>();
private ArrayList<Block> _glass = new ArrayList<Block>();
public Micro(ArcadeManager manager, GameType type)
{
this(manager,
new Kit[]
{
new KitArcher(manager),
new KitWorker(manager),
new KitFighter(manager)
},
GameType.Micro);
}
public Micro(ArcadeManager manager, Kit[] kits, GameType type)
{
super(manager, type, kits,
@ -54,15 +67,7 @@ public class Micro extends TeamGame
public Micro(ArcadeManager manager)
{
this(manager,
new Kit[]
{
new KitArcher(manager),
new KitWorker(manager),
new KitFighter(manager)
},
GameType.Micro);
this(manager, GameType.Micro);
registerStatTrackers(
new KillsWithinGameStatTracker(this, 8, "Annihilation")

View File

@ -0,0 +1,55 @@
package nautilus.game.arcade.game.games.micro.modes;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.games.micro.Micro;
/**
* CookieFight
*
* @author xXVevzZXx
*/
public class CookieFight extends Micro
{
private int _enchantmentLevel;
public CookieFight(ArcadeManager manager)
{
super(manager, GameType.Brawl);
_enchantmentLevel = 250;
}
@EventHandler
public void cookie(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Live)
return;
for (Player player : GetPlayers(true))
{
ItemStack item = new ItemStack(Material.COOKIE);
item.addUnsafeEnchantment(Enchantment.KNOCKBACK, _enchantmentLevel);
player.getInventory().addItem(item);
UtilPlayer.message(player, F.main("Game", "Oh look, you got a Cookie!"));
}
}
@Override
public String GetMode()
{
return "Cookie Fight";
}
}

View File

@ -0,0 +1,38 @@
package nautilus.game.arcade.game.games.micro.modes;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.games.AbsorptionFix;
import nautilus.game.arcade.game.games.micro.Micro;
import nautilus.game.arcade.game.games.micro.modes.kits.KitOverlord;
import nautilus.game.arcade.kit.Kit;
/**
* OPMicroBattles
*
* @author xXVevzZXx
*/
public class OverpoweredMicroBattles extends Micro
{
public OverpoweredMicroBattles(ArcadeManager manager)
{
super(manager,
new Kit[]
{
new KitOverlord(manager)
},
GameType.Brawl);
TeamArmor = false;
new AbsorptionFix(this);
}
@Override
public String GetMode()
{
return "OP Micro Battles";
}
}

View File

@ -0,0 +1,96 @@
package nautilus.game.arcade.game.games.micro.modes;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.games.micro.Micro;
import nautilus.game.arcade.game.games.smash.kits.KitBlaze;
import nautilus.game.arcade.game.games.smash.kits.KitChicken;
import nautilus.game.arcade.game.games.smash.kits.KitCow;
import nautilus.game.arcade.game.games.smash.kits.KitCreeper;
import nautilus.game.arcade.game.games.smash.kits.KitEnderman;
import nautilus.game.arcade.game.games.smash.kits.KitGolem;
import nautilus.game.arcade.game.games.smash.kits.KitMagmaCube;
import nautilus.game.arcade.game.games.smash.kits.KitPig;
import nautilus.game.arcade.game.games.smash.kits.KitSheep;
import nautilus.game.arcade.game.games.smash.kits.KitSkeletalHorse;
import nautilus.game.arcade.game.games.smash.kits.KitSkeleton;
import nautilus.game.arcade.game.games.smash.kits.KitSkySquid;
import nautilus.game.arcade.game.games.smash.kits.KitSlime;
import nautilus.game.arcade.game.games.smash.kits.KitSnowman;
import nautilus.game.arcade.game.games.smash.kits.KitSpider;
import nautilus.game.arcade.game.games.smash.kits.KitWitch;
import nautilus.game.arcade.game.games.smash.kits.KitWitherSkeleton;
import nautilus.game.arcade.game.games.smash.kits.KitWolf;
import nautilus.game.arcade.game.games.smash.kits.KitZombie;
import nautilus.game.arcade.kit.Kit;
/**
* TinySmash
*
* @author xXVevzZXx
*/
public class TinySmash extends Micro
{
public TinySmash(ArcadeManager manager)
{
super(manager, new Kit[]
{
new KitSkeleton(manager),
new KitGolem(manager),
new KitSpider(manager),
new KitSlime(manager),
new KitCreeper(manager),
new KitEnderman(manager),
new KitSnowman(manager),
new KitWolf(manager),
new KitBlaze(manager),
new KitWitch(manager),
new KitChicken(manager),
new KitSkeletalHorse(manager),
new KitPig(manager),
new KitSkySquid(manager),
new KitWitherSkeleton(manager),
new KitMagmaCube(manager),
new KitZombie(manager),
new KitCow(manager),
new KitSheep(manager)
}, GameType.Brawl);
}
@EventHandler(priority = EventPriority.LOWEST)
public void noFallDamage(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
if (event.GetCause() == DamageCause.FALL)
event.SetCancelled("No Fall Damage");
}
@EventHandler(priority = EventPriority.HIGH)
public void customKnockback(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
if (event.GetDamageePlayer() != null)
event.AddKnockback("Smash Knockback", 1 + 0.1 * (20 - event.GetDamageePlayer().getHealth()));
}
@Override
public String GetMode()
{
return "Tiny Smash";
}
}

View File

@ -0,0 +1,49 @@
package nautilus.game.arcade.game.games.micro.modes.kits;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
import nautilus.game.arcade.kit.perks.PerkFletcher;
public class KitOverlord extends ProgressingKit
{
private static final String[] DESCRIPTION = {
"You tell me I'm OP?!",
};
private static final Perk[] PERKS = {
new PerkFletcher(3, 16, true)
};
private static final ItemStack IN_HAND = new ItemStack(Material.GOLDEN_APPLE);
private static final ItemStack[] PLAYER_ITEMS = {
ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD),
ItemStackFactory.Instance.CreateStack(Material.DIAMOND_PICKAXE),
ItemStackFactory.Instance.CreateStack(Material.BOW),
ItemStackFactory.Instance.CreateStack(Material.GOLDEN_APPLE, 5)
};
public KitOverlord(ArcadeManager manager)
{
super(manager, "Overlord", "microoverlord", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND);
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(PLAYER_ITEMS);
player.getInventory().setHelmet(new ItemStack(Material.DIAMOND_HELMET));
player.getInventory().setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE));
player.getInventory().setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS));
player.getInventory().setBoots(new ItemStack(Material.DIAMOND_BOOTS));
}
}

View File

@ -0,0 +1,59 @@
package nautilus.game.arcade.game.games.minestrike;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.games.minestrike.data.Bullet;
public class CustomGunDamageEvent extends PlayerEvent
{
private static final HandlerList handlers = new HandlerList();
public static HandlerList getHandlerList()
{
return handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
private Bullet _bullet;
private final boolean _headshot;
private CustomDamageEvent _damageEvent;
private GunModule _game;
public CustomGunDamageEvent(Bullet _bullet, Player _target, boolean _headshot, CustomDamageEvent _damageEvent, GunModule game)
{
super(_target);
this._bullet = _bullet;
this._headshot = _headshot;
this._damageEvent = _damageEvent;
this._game = game;
}
public Bullet getBullet()
{
return _bullet;
}
public boolean isHeadshot()
{
return _headshot;
}
public CustomDamageEvent getDamageEvent()
{
return _damageEvent;
}
public GunModule getGame()
{
return _game;
}
}

View File

@ -0,0 +1,35 @@
package nautilus.game.arcade.game.games.minestrike;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
public class PlayerHeadshotEvent extends PlayerEvent
{
private static final HandlerList handlers = new HandlerList();
public static HandlerList getHandlerList()
{
return handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
private final Player _shooter;
public PlayerHeadshotEvent(Player who, Player shooter)
{
super(who);
_shooter = shooter;
}
public Player getShooter()
{
return _shooter;
}
}

View File

@ -35,15 +35,15 @@ import org.bukkit.event.inventory.InventoryClickEvent;
public class ShopManager
{
private MineStrike Host;
private Minestrike Host;
private HashMap<Player, HashMap<Integer, StrikeItem>> _shop = new HashMap<Player, HashMap<Integer, StrikeItem>>();
private HashMap<Player, Integer> _money = new HashMap<Player, Integer>();
private HashSet<Player> _inShop = new HashSet<Player>();
public ShopManager(MineStrike host)
public ShopManager(Minestrike minestrike)
{
Host = host;
Host = minestrike;
}
public void enterShop(Player player)
@ -60,27 +60,27 @@ public class ShopManager
//Pistols
slot = 9;
addItem(team.GetColor() == ChatColor.RED ? new Gun(GunStats.GLOCK_18) : new Gun(GunStats.P2000), player, slot++);
addItem(new Gun(GunStats.P250), player, slot++);
addItem(new Gun(GunStats.CZ75), player, slot++);
addItem(new Gun(GunStats.DEAGLE), player, slot++);
addItem(team.GetColor() == ChatColor.RED ? new Gun(GunStats.GLOCK_18, Host.getGunModule()) : new Gun(GunStats.P2000, Host.getGunModule()), player, slot++);
addItem(new Gun(GunStats.P250, Host.getGunModule()), player, slot++);
addItem(new Gun(GunStats.CZ75, Host.getGunModule()), player, slot++);
addItem(new Gun(GunStats.DEAGLE, Host.getGunModule()), player, slot++);
//Shotgun
slot = 18;
addItem(new Shotgun(GunStats.NOVA), player, slot++);
addItem(new Shotgun(GunStats.XM1014), player, slot++);
addItem(new Shotgun(GunStats.NOVA, Host.getGunModule()), player, slot++);
addItem(new Shotgun(GunStats.XM1014, Host.getGunModule()), player, slot++);
//SMG
addItem(new Gun(GunStats.PPBIZON), player, slot++);
addItem(new Gun(GunStats.P90), player, slot++);
addItem(new Gun(GunStats.PPBIZON, Host.getGunModule()), player, slot++);
addItem(new Gun(GunStats.P90, Host.getGunModule()), player, slot++);
//Rifles
slot = 27;
addItem(team.GetColor() == ChatColor.RED ? new Gun(GunStats.GALIL) : new Gun(GunStats.FAMAS), player, slot++);
addItem(team.GetColor() == ChatColor.RED ? new Gun(GunStats.AK47) : new Gun(GunStats.M4A4), player, slot++);
addItem(team.GetColor() == ChatColor.RED ? new Gun(GunStats.SG553) : new Gun(GunStats.AUG), player, slot++);
addItem(new Gun(GunStats.SSG08), player, slot++);
addItem(new Gun(GunStats.AWP), player, slot++);
addItem(team.GetColor() == ChatColor.RED ? new Gun(GunStats.GALIL, Host.getGunModule()) : new Gun(GunStats.FAMAS, Host.getGunModule()), player, slot++);
addItem(team.GetColor() == ChatColor.RED ? new Gun(GunStats.AK47, Host.getGunModule()) : new Gun(GunStats.M4A4, Host.getGunModule()), player, slot++);
addItem(team.GetColor() == ChatColor.RED ? new Gun(GunStats.SG553, Host.getGunModule()) : new Gun(GunStats.AUG, Host.getGunModule()), player, slot++);
addItem(new Gun(GunStats.SSG08, Host.getGunModule()), player, slot++);
addItem(new Gun(GunStats.AWP, Host.getGunModule()), player, slot++);
//Grenades
addItem(new FlashBang(), player, 14);
@ -207,6 +207,7 @@ public class ShopManager
if (hasItem(player, item))
return;
if (getMoney(player) < item.getCost())
{
player.playSound(player.getLocation(), Sound.NOTE_BASS, 1f, 1f);
@ -217,11 +218,11 @@ public class ShopManager
if (item instanceof Gun)
{
Gun gun = (Gun)item;
Host.dropSlotItem(player, gun.getSlot());
Host.getGunModule().dropSlotItem(player, gun.getSlot());
gun.giveToPlayer(player, true);
gun.updateWeaponName(player, Host);
gun.updateWeaponName(player, Host.getGunModule());
gun.updateSkin(player, Host.getArcadeManager().getCosmeticManager().getGadgetManager());
Host.registerGun(gun, player);
Host.getGunModule().registerGun(gun, player);
}
//Grenade
@ -235,7 +236,7 @@ public class ShopManager
return;
}
Host.registerGrenade(grenade, player);
Host.getGunModule().registerGrenade(grenade, player);
}
//Use 250 instead of 255, to show that its kevlar/helmet

View File

@ -2,7 +2,7 @@ package nautilus.game.arcade.game.games.minestrike.data;
import java.util.HashSet;
import nautilus.game.arcade.game.games.minestrike.MineStrike;
import nautilus.game.arcade.game.games.minestrike.GunModule;
import nautilus.game.arcade.game.games.minestrike.items.guns.Gun;
import org.bukkit.Location;
@ -25,7 +25,7 @@ public class Bullet
public HashSet<Player> WhizzSound = new HashSet<Player>();
public Bullet(Entity bullet, Gun gun, Player shooter, MineStrike game)
public Bullet(Entity bullet, Gun gun, Player shooter, GunModule game)
{
Bullet = bullet;
Gun = gun;

View File

@ -1,6 +1,7 @@
package nautilus.game.arcade.game.games.minestrike.items;
import java.util.ArrayList;
import java.util.Arrays;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -17,9 +18,10 @@ import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.game.games.minestrike.MineStrike;
import nautilus.game.arcade.game.games.minestrike.GunModule;
import nautilus.game.arcade.game.games.minestrike.items.grenades.Grenade;
import nautilus.game.arcade.game.games.minestrike.items.guns.Gun;
@ -37,6 +39,8 @@ public abstract class StrikeItem
private ItemStack _stack = null;
private int _identifier;
public StrikeItem(StrikeItemType type, String name, String[] desc, int cost, int gemCost, Material skin)
{
_type = type;
@ -48,6 +52,11 @@ public abstract class StrikeItem
//Make Stack
_stack = new ItemStack(skin);
_identifier = UtilMath.r(9000) + 1000;
addID();
fixStackName();
}
@ -86,12 +95,20 @@ public abstract class StrikeItem
return _skinData;
}
public void addID()
{
ItemMeta meta = _stack.getItemMeta();
meta.setLore(Arrays.asList(ChatColor.RED + "" + ChatColor.BOLD + "Identifier: " + _identifier));
_stack.setItemMeta(meta);
}
public void setSkin(Material skinMaterial, byte skinData)
{
_skinMaterial = skinMaterial;
_skinData = skinData;
_stack = new ItemStack(skinMaterial, 1, (short) 0, skinData);
addID();
}
public String getOwnerName()
@ -104,7 +121,7 @@ public abstract class StrikeItem
_ownerName = ownerName;
}
public void drop(MineStrike game, Player player, boolean natural, boolean onlyDeregisterAndRemove)
public void drop(GunModule game, Player player, boolean natural, boolean onlyDeregisterAndRemove)
{
_stack.setAmount(1);
@ -160,6 +177,22 @@ public abstract class StrikeItem
public boolean isStack(ItemStack stack)
{
if (stack.hasItemMeta())
{
if (stack.getItemMeta().hasLore())
{
if (getStack().hasItemMeta())
{
if (getStack().getItemMeta().hasLore())
{
if (UtilGear.isMat(stack, _skinMaterial))
return stack.getItemMeta().getLore().get(0).equalsIgnoreCase(getStack().getItemMeta().getLore().get(0));
else
return false;
}
}
}
}
return UtilGear.isMat(stack, _skinMaterial);
}
@ -184,7 +217,7 @@ public abstract class StrikeItem
_stack.setItemMeta(meta);
}
public abstract boolean pickup(MineStrike game, Player player);
public abstract boolean pickup(GunModule game, Player player);
public ItemStack getShopItem(int money, boolean alreadyHas)
{

View File

@ -8,7 +8,7 @@ import org.bukkit.entity.Player;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import nautilus.game.arcade.game.games.minestrike.MineStrike;
import nautilus.game.arcade.game.games.minestrike.GunModule;
import nautilus.game.arcade.game.games.minestrike.items.StrikeItem;
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
@ -24,7 +24,7 @@ public class DefusalKit extends StrikeItem
}
@Override
public boolean pickup(MineStrike game, Player player)
public boolean pickup(GunModule game, Player player)
{
return false;
}

View File

@ -11,7 +11,7 @@ import org.bukkit.inventory.meta.LeatherArmorMeta;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import nautilus.game.arcade.game.games.minestrike.MineStrike;
import nautilus.game.arcade.game.games.minestrike.GunModule;
import nautilus.game.arcade.game.games.minestrike.items.StrikeItem;
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
@ -23,7 +23,7 @@ public class Armor extends StrikeItem
}
@Override
public boolean pickup(MineStrike game, Player player)
public boolean pickup(GunModule game, Player player)
{
return false;
}

View File

@ -2,16 +2,6 @@ package nautilus.game.arcade.game.games.minestrike.items.grenades;
import java.util.HashMap;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.minestrike.MineStrike;
import nautilus.game.arcade.game.games.minestrike.Radio;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
@ -21,6 +11,15 @@ import org.bukkit.block.BlockFace;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilServer;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.minestrike.GunModule;
import nautilus.game.arcade.game.games.minestrike.Radio;
public abstract class FireGrenadeBase extends Grenade
{
private long _baseTime;
@ -37,7 +36,7 @@ public abstract class FireGrenadeBase extends Grenade
}
@Override
public boolean updateCustom(MineStrike game, Entity ent)
public boolean updateCustom(GunModule game, Entity ent)
{
// Fixed grenade effect not being activated when thrown in the ground.
// Looks like ent.isOnGround() worked, while we previously used UtilEnt.isGrounded(ent).
@ -52,7 +51,7 @@ public abstract class FireGrenadeBase extends Grenade
return false;
}
private void createFire(final MineStrike game, final Location loc)
private void createFire(final GunModule game, final Location loc)
{
//Sound
loc.getWorld().playSound(loc, Sound.IRONGOLEM_THROW, 1f, 1f);
@ -114,9 +113,9 @@ public abstract class FireGrenadeBase extends Grenade
}
@Override
public void playSound(MineStrike game, Player player)
public void playSound(GunModule game, Player player)
{
GameTeam team = game.GetTeam(player);
GameTeam team = game.getHost().GetTeam(player);
if (team == null)
return;

View File

@ -9,7 +9,7 @@ import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.minestrike.MineStrike;
import nautilus.game.arcade.game.games.minestrike.GunModule;
import nautilus.game.arcade.game.games.minestrike.Radio;
import org.bukkit.ChatColor;
@ -33,7 +33,7 @@ public class FlashBang extends Grenade
}
@Override
public boolean updateCustom(MineStrike game, Entity ent)
public boolean updateCustom(GunModule game, Entity ent)
{
if (UtilTime.elapsed(_throwTime, 2000))
{
@ -43,7 +43,7 @@ public class FlashBang extends Grenade
HashMap<Player, Double> players = UtilPlayer.getInRadius(ent.getLocation(), 48);
for (Player player : players.keySet())
{
if (!game.IsAlive(player))
if (!game.getHost().IsAlive(player))
continue;
//Line of Sight
@ -83,9 +83,9 @@ public class FlashBang extends Grenade
}
@Override
public void playSound(MineStrike game, Player player)
public void playSound(GunModule game, Player player)
{
GameTeam team = game.GetTeam(player);
GameTeam team = game.getHost().GetTeam(player);
if (team == null)
return;

View File

@ -11,6 +11,7 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
@ -20,7 +21,7 @@ import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import nautilus.game.arcade.game.games.minestrike.MineStrike;
import nautilus.game.arcade.game.games.minestrike.GunModule;
import nautilus.game.arcade.game.games.minestrike.items.StrikeItem;
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
@ -132,9 +133,20 @@ public abstract class Grenade extends StrikeItem
return true;
}
public void throwGrenade(Player player, boolean wasLeftClick, MineStrike game)
public void throwGrenade(Player player, boolean wasLeftClick, GunModule game)
{
player.setItemInHand(null);
if (player.getItemInHand().getAmount() < 2)
{
player.setItemInHand(null);
}
else
{
int amount = player.getItemInHand().getAmount();
ItemStack stack = getStack();
stack.setAmount(amount - 1);
player.setItemInHand(stack);
}
_thrower = player;
@ -153,7 +165,11 @@ public abstract class Grenade extends StrikeItem
UtilPlayer.message(player, F.main("Game", "You threw " + getName() + "."));
game.registerThrownGrenade(ent, this);
game.deregisterGrenade(this);
if (player.getItemInHand().getAmount() < 2)
{
game.deregisterGrenade(this);
}
//Sound
playSound(game, player);
@ -161,7 +177,7 @@ public abstract class Grenade extends StrikeItem
_throwTime = System.currentTimeMillis();
}
public boolean update(MineStrike game, Entity ent)
public boolean update(GunModule game, Entity ent)
{
if (UtilTime.elapsed(_throwTime, 20000))
return true;
@ -233,10 +249,10 @@ public abstract class Grenade extends StrikeItem
_lastLoc = ent.getLocation();
}
public abstract boolean updateCustom(MineStrike game, Entity ent);
public abstract boolean updateCustom(GunModule game, Entity ent);
@Override
public boolean pickup(MineStrike game, Player player)
public boolean pickup(GunModule game, Player player)
{
if (giveToPlayer(player, false))
{
@ -255,5 +271,5 @@ public abstract class Grenade extends StrikeItem
return C.cDGreen + C.Bold + "Grenade" + ChatColor.RESET;
}
public abstract void playSound(MineStrike game, Player player);
public abstract void playSound(GunModule game, Player player);
}

View File

@ -11,7 +11,7 @@ import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.minestrike.MineStrike;
import nautilus.game.arcade.game.games.minestrike.GunModule;
import nautilus.game.arcade.game.games.minestrike.Radio;
import org.bukkit.Bukkit;
@ -34,7 +34,7 @@ public class HighExplosive extends Grenade
}
@Override
public boolean updateCustom(MineStrike game, Entity ent)
public boolean updateCustom(GunModule game, Entity ent)
{
if (UtilTime.elapsed(_throwTime, 2000))
{
@ -48,12 +48,12 @@ public class HighExplosive extends Grenade
List<Player> damagedPlayers = new ArrayList<>();
for (Player player : players.keySet())
{
if (!game.IsAlive(player))
if (!game.getHost().IsAlive(player))
continue;
// Damage Event
Player damager = null;
if (game.IsAlive(_thrower))
if (game.getHost().IsAlive(_thrower))
{
damager = _thrower;
}
@ -74,9 +74,9 @@ public class HighExplosive extends Grenade
}
@Override
public void playSound(MineStrike game, Player player)
public void playSound(GunModule game, Player player)
{
GameTeam team = game.GetTeam(player);
GameTeam team = game.getHost().GetTeam(player);
if (team == null)
return;

View File

@ -10,7 +10,7 @@ import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.minestrike.MineStrike;
import nautilus.game.arcade.game.games.minestrike.GunModule;
import nautilus.game.arcade.game.games.minestrike.Radio;
import org.bukkit.ChatColor;
@ -36,7 +36,7 @@ public class Smoke extends Grenade
}
@Override
public boolean updateCustom(final MineStrike game, Entity ent)
public boolean updateCustom(final GunModule game, Entity ent)
{
if (UtilTime.elapsed(_throwTime, 2000) && (UtilEnt.isGrounded(ent) || !ent.isValid()))
{
@ -95,9 +95,9 @@ public class Smoke extends Grenade
}
@Override
public void playSound(MineStrike game, Player player)
public void playSound(GunModule game, Player player)
{
GameTeam team = game.GetTeam(player);
GameTeam team = game.getHost().GetTeam(player);
if (team == null)
return;

View File

@ -1,5 +1,6 @@
package nautilus.game.arcade.game.games.minestrike.items.guns;
import java.util.Arrays;
import java.util.HashMap;
import org.bukkit.ChatColor;
@ -32,10 +33,11 @@ import mineplex.core.common.util.UtilTime;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType;
import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.GameModifierMineStrikeSkin;
import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.MineStrikeSkin;
import mineplex.core.recharge.Recharge;
import mineplex.core.recharge.RechargedEvent;
import mineplex.core.stats.PlayerStats;
import nautilus.game.arcade.game.games.minestrike.MineStrike;
import nautilus.game.arcade.game.games.minestrike.GunModule;
import nautilus.game.arcade.game.games.minestrike.data.Bullet;
import nautilus.game.arcade.game.games.minestrike.items.StrikeItem;
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
@ -60,10 +62,14 @@ public class Gun extends StrikeItem
protected int _kills = -1;
protected String _activeSkinName = "Default";
public Gun(GunStats gunStats)
protected GunModule _module;
public Gun(GunStats gunStats, GunModule module)
{
super(gunStats.getItemType(), gunStats.getName(), gunStats.getDesc(), gunStats.getCost(), gunStats.getGemCost(), gunStats.getSkin());
_module = module;
_gunStats = gunStats;
if (gunStats.getItemType() == StrikeItemType.PRIMARY_WEAPON)
@ -79,7 +85,7 @@ public class Gun extends StrikeItem
updateWeaponName(null, null);
}
public void shoot(final Player player, final MineStrike game)
public void shoot(final Player player, final GunModule game)
{
if (_reloading)
return;
@ -94,7 +100,7 @@ public class Gun extends StrikeItem
{
public void run()
{
if (game.IsAlive(player))
if (game.getHost().IsAlive(player))
shootOnce(player, game);
}
}, 2);
@ -109,7 +115,7 @@ public class Gun extends StrikeItem
{
public void run()
{
if (game.IsAlive(player))
if (game.getHost().IsAlive(player))
shootOnce(player, game);
}
}, i);
@ -117,7 +123,7 @@ public class Gun extends StrikeItem
}
}
public void shootOnce(Player player, MineStrike game)
public void shootOnce(Player player, GunModule game)
{
if (_reloading)
return;
@ -167,7 +173,7 @@ public class Gun extends StrikeItem
reload(player);
}
public Bullet fireBullet(Player player, MineStrike game)
public Bullet fireBullet(Player player, GunModule game)
{
//Instant?
boolean instant = game.getBulletType() == 1 || (game.getBulletType() == 2 && _gunStats.getGunType() == GunType.SNIPER);
@ -186,7 +192,7 @@ public class Gun extends StrikeItem
Vector cof = new Vector(Math.random() - 0.5, (Math.random() - 0.2) * (5d/8d), Math.random() - 0.5);
cof.normalize();
cof.multiply(cone);
cof.multiply(MineStrike.CONE);
cof.multiply(_module.CONE);
cof.add(player.getLocation().getDirection());
cof.normalize();
@ -307,12 +313,12 @@ public class Gun extends StrikeItem
public void displayAmmo(Player player)
{
if (!UtilGear.isMat(player.getItemInHand(), getStack().getType()))
if (_module.getGunInHand(player, null) != this)
return;
//Weapon Bob during reload
if (_reloading)
updateWeaponName(player, null);
updateWeaponName(player, null, false);
if (!Recharge.Instance.usable(player, getName() + " Reload"))
return;
@ -323,7 +329,7 @@ public class Gun extends StrikeItem
UtilTextBottom.display(C.cRed + "No Ammo", player);
}
public void updateWeaponName(Player player, MineStrike game)
public void updateWeaponName(Player player, GunModule game, boolean setItem)
{
if(game != null)
{
@ -331,24 +337,24 @@ public class Gun extends StrikeItem
{
new BukkitRunnable() {
public void run() {
PlayerStats remoteStats = game.getArcadeManager().GetStatsManager().Get(player);
_kills = (int) remoteStats.getStat(game.GetName() + "." + getStatNameKills(true));
PlayerStats remoteStats = game.getHost().getArcadeManager().GetStatsManager().Get(player);;
_kills = (int) remoteStats.getStat(game.getHost().GetName() + "." + getStatNameKills(true));
Player owner = UtilPlayer.searchExact(getOwnerName());
if(owner != null) {
HashMap<String, Integer> localStatsMap = game.GetStats().get(owner);
HashMap<String, Integer> localStatsMap = game.getHost().GetStats().get(owner);
if(localStatsMap != null)
{
Integer kills = localStatsMap.get(game.GetName() + "." + getStatNameKills(true));
Integer kills = localStatsMap.get(game.getHost().GetName() + "." + getStatNameKills(true));
if(kills != null)
{
_kills += kills.intValue();
}
}
}
updateWeaponName(player, null);
updateWeaponName(player, null, setItem);
}
}.runTaskAsynchronously(game.getArcadeManager().getPlugin());
}.runTaskAsynchronously(game.getHost().getArcadeManager().getPlugin());
}
}
int kls = _kills;
@ -368,11 +374,18 @@ public class Gun extends StrikeItem
if (player != null)
{
player.getInventory().setItem(_slot, getStack());
if (setItem)
player.getInventory().setItem(_slot, getStack());
_reloadTick = !_reloadTick;
}
}
public void updateWeaponName(Player player, GunModule module)
{
updateWeaponName(player, module, true);
}
public void incrementKill() {
_kills++;
}
@ -399,7 +412,7 @@ public class Gun extends StrikeItem
loc.getWorld().playSound(loc, Sound.PISTON_RETRACT, 1f, 0.8f);
}
public void cancelReloadCheck(Player player, MineStrike game)
public void cancelReloadCheck(Player player, GunModule game)
{
if (!_reloading)
return;
@ -458,6 +471,19 @@ public class Gun extends StrikeItem
owner.getInventory().setItem(_slot, getStack());
}
public void enableSkin()
{
MineStrikeSkin skin = null;
for (MineStrikeSkin otherSkin : MineStrikeSkin.values())
{
if (otherSkin.getWeaponName().equalsIgnoreCase(_gunStats.getName()))
skin = otherSkin;
}
setSkin(skin.getSkinMaterial(), skin.getSkinData());
_activeSkinName = skin.getSkinName();
}
public int getSlot()
{
return _slot;
@ -492,7 +518,7 @@ public class Gun extends StrikeItem
}
@Override
public boolean pickup(MineStrike game, Player player)
public boolean pickup(GunModule game, Player player)
{
if (player.getInventory().getItem(_slot) != null && player.getInventory().getItem(_slot).getType() != Material.AIR)
return false;

View File

@ -1,12 +1,14 @@
package nautilus.game.arcade.game.games.minestrike.items.guns;
import nautilus.game.arcade.game.games.minestrike.GunModule;
public class GunFactory
{
public Gun createGun(GunStats gun)
public Gun createGun(GunStats gun, GunModule module)
{
if (gun.getGunType() == GunType.SHOTGUN)
return new Shotgun(gun);
return new Shotgun(gun, module);
return new Gun(gun);
return new Gun(gun, module);
}
}

View File

@ -1,6 +1,6 @@
package nautilus.game.arcade.game.games.minestrike.items.guns;
import nautilus.game.arcade.game.games.minestrike.MineStrike;
import nautilus.game.arcade.game.games.minestrike.GunModule;
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
import org.bukkit.Material;
@ -375,7 +375,7 @@ public enum GunStats
public double getConeIncreaseRate()
{
return _coneIncreaseRate * MineStrike.RECOIL;
return _coneIncreaseRate * GunModule.RECOIL;
}
public boolean getScope()

View File

@ -1,6 +1,6 @@
package nautilus.game.arcade.game.games.minestrike.items.guns;
import nautilus.game.arcade.game.games.minestrike.MineStrike;
import nautilus.game.arcade.game.games.minestrike.GunModule;
public enum GunType
{
@ -40,17 +40,17 @@ public enum GunType
public double getMovePenalty()
{
return _movePenalty * MineStrike.MOVE_PENALTY;
return _movePenalty * GunModule.MOVE_PENALTY;
}
public double getSprintPenalty()
{
return _sprintPentalty * MineStrike.MOVE_PENALTY;
return _sprintPentalty * GunModule.MOVE_PENALTY;
}
public double getJumpPenalty()
{
return _jumpPenalty * MineStrike.MOVE_PENALTY;
return _jumpPenalty * GunModule.MOVE_PENALTY;
}
public float getVolume()

View File

@ -5,7 +5,7 @@ import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.game.games.minestrike.MineStrike;
import nautilus.game.arcade.game.games.minestrike.GunModule;
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
import org.bukkit.Location;
@ -18,15 +18,15 @@ public class Shotgun extends Gun
{
private int _pellets;
public Shotgun(GunStats gunStats)
public Shotgun(GunStats gunStats, GunModule module)
{
super(gunStats);
super(gunStats, module);
_pellets = gunStats.getPellets();
}
@Override
public void shoot(Player player, MineStrike game)
public void shoot(Player player, GunModule game)
{
if (_reloading)
return;

View File

@ -60,6 +60,9 @@ public class EweHeroes extends SheepGame
if (event.getType() != UpdateType.FASTER)
return;
if (!IsLive())
return;
for (Player player : GetPlayers(true))
{
player.getInventory().setItem(7, new ItemStack(Material.SADDLE));

View File

@ -0,0 +1,36 @@
package nautilus.game.arcade.game.games.sheep.modes;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.games.AbsorptionFix;
import nautilus.game.arcade.game.games.sheep.SheepGame;
import nautilus.game.arcade.game.games.sheep.modes.kits.KitShepherd;
import nautilus.game.arcade.kit.Kit;
/**
* OverpoweredSheepQuest
*
* @author xXVevzZXx
*/
public class OverpoweredSheepQuest extends SheepGame
{
public OverpoweredSheepQuest(ArcadeManager manager)
{
super(manager, new Kit[]
{
new KitShepherd(manager)
}, GameType.Brawl);
TeamArmor = false;
new AbsorptionFix(this);
}
@Override
public String GetMode()
{
return "OP Sheep Quest";
}
}

View File

@ -0,0 +1,116 @@
package nautilus.game.arcade.game.games.sheep.modes;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.inventory.ItemStack;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.games.sheep.SheepGame;
import nautilus.game.arcade.game.games.smash.kits.KitBlaze;
import nautilus.game.arcade.game.games.smash.kits.KitChicken;
import nautilus.game.arcade.game.games.smash.kits.KitCow;
import nautilus.game.arcade.game.games.smash.kits.KitCreeper;
import nautilus.game.arcade.game.games.smash.kits.KitEnderman;
import nautilus.game.arcade.game.games.smash.kits.KitGolem;
import nautilus.game.arcade.game.games.smash.kits.KitMagmaCube;
import nautilus.game.arcade.game.games.smash.kits.KitPig;
import nautilus.game.arcade.game.games.smash.kits.KitSheep;
import nautilus.game.arcade.game.games.smash.kits.KitSkeletalHorse;
import nautilus.game.arcade.game.games.smash.kits.KitSkeleton;
import nautilus.game.arcade.game.games.smash.kits.KitSkySquid;
import nautilus.game.arcade.game.games.smash.kits.KitSlime;
import nautilus.game.arcade.game.games.smash.kits.KitSnowman;
import nautilus.game.arcade.game.games.smash.kits.KitSpider;
import nautilus.game.arcade.game.games.smash.kits.KitWitch;
import nautilus.game.arcade.game.games.smash.kits.KitWitherSkeleton;
import nautilus.game.arcade.game.games.smash.kits.KitWolf;
import nautilus.game.arcade.game.games.smash.kits.KitZombie;
import nautilus.game.arcade.kit.Kit;
/**
* SheepSmash
*
* @author xXVevzZXx
*/
public class SmashSheep extends SheepGame
{
public SmashSheep(ArcadeManager manager)
{
super(manager, new Kit[]
{
new KitSkeleton(manager),
new KitGolem(manager),
new KitSpider(manager),
new KitSlime(manager),
new KitCreeper(manager),
new KitEnderman(manager),
new KitSnowman(manager),
new KitWolf(manager),
new KitBlaze(manager),
new KitWitch(manager),
new KitChicken(manager),
new KitSkeletalHorse(manager),
new KitPig(manager),
new KitSkySquid(manager),
new KitWitherSkeleton(manager),
new KitMagmaCube(manager),
new KitZombie(manager),
new KitCow(manager),
new KitSheep(manager)
}, GameType.Brawl);
}
@EventHandler
public void saddle(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTER)
return;
if (!IsLive())
return;
for (Player player : GetPlayers(true))
{
player.getInventory().setItem(7, new ItemStack(Material.SADDLE));
}
}
@EventHandler(priority = EventPriority.LOWEST)
public void noFallDamage(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
if (event.GetCause() == DamageCause.FALL)
event.SetCancelled("No Fall Damage");
}
@EventHandler(priority = EventPriority.HIGH)
public void customKnockback(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
if (event.GetDamageePlayer() != null)
event.AddKnockback("Smash Knockback", 1 + 0.1 * (20 - event.GetDamageePlayer().getHealth()));
}
@Override
public String GetMode()
{
return "Smash Sheep";
}
}

View File

@ -0,0 +1,65 @@
package nautilus.game.arcade.game.games.sheep.modes.kits;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
import nautilus.game.arcade.kit.perks.PerkFletcher;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class KitShepherd extends ProgressingKit
{
private static final String[] DESCRIPTION = {
"Most skilled Shepherd from all over the World",
"",
C.cYellow + "Double tap " + C.cWhite + "your jump key to " + C.cGreen + "Double Jump"
};
private static final Perk[] PERKS = {
new PerkDoubleJump("Double Jump", 1.2, 1.2, true, 8000, true),
new PerkFletcher(4, 10, true)
};
private static final ItemStack IN_HAND = new ItemStack(Material.IRON_AXE);
private static final ItemStack[] PLAYER_ITEMS = {
ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD),
ItemStackFactory.Instance.CreateStack(Material.GOLDEN_APPLE, 2),
ItemStackFactory.Instance.CreateStack(Material.BOW),
ItemStackFactory.Instance.CreateStack(Material.SADDLE, (byte) 0, 1,
C.cYellow + C.Bold + "Hold This" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Grab/Hold Sheep")
};
public KitShepherd(ArcadeManager manager)
{
super(manager, "Shepherd of the gods", "sheepsheperd", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND);
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(PLAYER_ITEMS);
player.getInventory().setHelmet(new ItemStack(Material.DIAMOND_HELMET));
player.getInventory().setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE));
player.getInventory().setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS));
player.getInventory().setBoots(new ItemStack(Material.DIAMOND_BOOTS));
}
@Override
public void SpawnCustom(LivingEntity ent)
{
ent.getEquipment().setHelmet(new ItemStack(Material.DIAMOND_HELMET));
ent.getEquipment().setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE));
ent.getEquipment().setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS));
ent.getEquipment().setBoots(new ItemStack(Material.DIAMOND_BOOTS));
}
}

View File

@ -133,17 +133,22 @@ public abstract class Skywars extends Game
private ChestLoot _middleProjectile = new ChestLoot();
private ChestLoot _middleBlock = new ChestLoot();
@SuppressWarnings("unchecked")
public Skywars(ArcadeManager manager, GameType type, String[] description)
{
super(manager, type, new Kit[]
this(manager, new Kit[]
{
new KitChicken(manager),
new KitMiner(manager),
new KitMadScientist(manager),
new KitDestructor(manager),
}, description);
}, type, description);
}
@SuppressWarnings("unchecked")
public Skywars(ArcadeManager manager, Kit[] kits, GameType type, String[] description)
{
super(manager, type, kits, description);
PrepareFreeze = true;

View File

@ -17,7 +17,7 @@ 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.Game.GameState;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.DeathBomberStatTracker;
import nautilus.game.arcade.stats.SkywarsKillZombieStatTracker;
import nautilus.game.arcade.stats.SkywarsTNTStatTracker;
@ -62,24 +62,19 @@ public class SoloSkywars extends Skywars
});
this.DamageTeamSelf = true;
}
registerStatTrackers(
new SkywarsTNTStatTracker(this),
new DeathBomberStatTracker(this, 3), //TNT Kills
new SkywarsKillZombieStatTracker(this),
new WinWithoutOpeningChestStatTracker(this),
new WinWithoutWearingArmorStatTracker(this));
registerChatStats(
Kills,
Deaths,
KDRatio,
BlankLine,
Assists,
DamageTaken,
DamageDealt
);
public SoloSkywars(ArcadeManager manager, Kit[] kits, GameType type)
{
super(manager, kits, type,
new String[]
{
"Free for all battle in the sky!",
"Craft or loot gear for combat",
"Last player alive wins!"
});
this.DamageTeamSelf = true;
}
@EventHandler

View File

@ -7,8 +7,14 @@ import org.bukkit.block.Block;
import org.bukkit.block.Chest;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilMath;
import mineplex.core.loot.ChestLoot;
import mineplex.core.loot.RandomItem;

View File

@ -0,0 +1,121 @@
package nautilus.game.arcade.game.games.skywars.modes;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.recharge.Recharge;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.games.skywars.SoloSkywars;
import nautilus.game.arcade.game.games.smash.kits.KitBlaze;
import nautilus.game.arcade.game.games.smash.kits.KitChicken;
import nautilus.game.arcade.game.games.smash.kits.KitCow;
import nautilus.game.arcade.game.games.smash.kits.KitCreeper;
import nautilus.game.arcade.game.games.smash.kits.KitEnderman;
import nautilus.game.arcade.game.games.smash.kits.KitGolem;
import nautilus.game.arcade.game.games.smash.kits.KitMagmaCube;
import nautilus.game.arcade.game.games.smash.kits.KitPig;
import nautilus.game.arcade.game.games.smash.kits.KitSheep;
import nautilus.game.arcade.game.games.smash.kits.KitSkeletalHorse;
import nautilus.game.arcade.game.games.smash.kits.KitSkeleton;
import nautilus.game.arcade.game.games.smash.kits.KitSkySquid;
import nautilus.game.arcade.game.games.smash.kits.KitSlime;
import nautilus.game.arcade.game.games.smash.kits.KitSnowman;
import nautilus.game.arcade.game.games.smash.kits.KitSpider;
import nautilus.game.arcade.game.games.smash.kits.KitWitch;
import nautilus.game.arcade.game.games.smash.kits.KitWitherSkeleton;
import nautilus.game.arcade.game.games.smash.kits.KitWolf;
import nautilus.game.arcade.game.games.smash.kits.KitZombie;
import nautilus.game.arcade.kit.Kit;
/**
* SkySmash
*
* @author xXVevzZXx
*/
public class SkySmash extends SoloSkywars
{
public SkySmash(ArcadeManager manager)
{
super(manager, new Kit[]
{
new KitSkeleton(manager),
new KitGolem(manager),
new KitSpider(manager),
new KitSlime(manager),
new KitCreeper(manager),
new KitEnderman(manager),
new KitSnowman(manager),
new KitWolf(manager),
new KitBlaze(manager),
new KitWitch(manager),
new KitChicken(manager),
new KitSkeletalHorse(manager),
new KitPig(manager),
new KitSkySquid(manager),
new KitWitherSkeleton(manager),
new KitMagmaCube(manager),
new KitZombie(manager),
new KitCow(manager),
new KitSheep(manager)
}, GameType.Brawl);
}
@EventHandler(priority = EventPriority.LOWEST)
public void noFallDamage(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
if (event.GetCause() == DamageCause.FALL)
event.SetCancelled("No Fall Damage");
}
@EventHandler(priority = EventPriority.HIGH)
public void customKnockback(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
if (event.GetDamageePlayer() != null)
event.AddKnockback("Smash Knockback", 1 + 0.1 * (20 - event.GetDamageePlayer().getHealth()));
}
@EventHandler(priority = EventPriority.MONITOR)
public void hungerOnHit(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
Player damager = event.GetDamagerPlayer(true);
if (damager == null)
return;
if (damager.equals(event.GetDamageeEntity()))
return;
if (!(event.GetDamageeEntity() instanceof Player))
return;
if (!Recharge.Instance.use(damager, "Hunger Restore", 250, false, false))
return;
int amount = Math.max(1, (int)(event.GetDamage()/2));
UtilPlayer.hunger(damager, amount);
}
@Override
public String GetMode()
{
return "Sky Smash";
}
}

View File

@ -31,7 +31,7 @@ import nautilus.game.arcade.game.games.smash.kits.KitWitch;
import nautilus.game.arcade.game.games.smash.kits.KitWitherSkeleton;
import nautilus.game.arcade.game.games.smash.kits.KitWolf;
import nautilus.game.arcade.game.games.smash.kits.KitZombie;
import nautilus.game.arcade.game.games.smash.modes.kits.KitPlayer;
import nautilus.game.arcade.game.games.smash.modes.kits.KitHipster;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.Perk;
@ -49,7 +49,7 @@ public class RandomKitSSM extends SoloSuperSmash
public RandomKitSSM(ArcadeManager manager)
{
super(manager, new Kit[]{new KitPlayer(manager)}, GameType.Brawl);
super(manager, new Kit[]{new KitHipster(manager)}, GameType.Brawl);
_maxLives = 5;

View File

@ -16,10 +16,10 @@ import nautilus.game.arcade.kit.SmashKit;
*
* @author xXVevzZXx
*/
public class KitPlayer extends SmashKit
public class KitHipster extends SmashKit
{
public KitPlayer(ArcadeManager manager)
public KitHipster(ArcadeManager manager)
{
super(manager, "Hipster", KitAvailability.Free, 0,
new String[]{"Always get another kit!"}, new Perk[]{}, EntityType.ZOMBIE, new ItemStack(Material.RECORD_10), "Super",

View File

@ -4,6 +4,10 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilTime.TimeUnit;
@ -13,17 +17,13 @@ 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.Game.GameState;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.managers.chat.ChatStatData;
import nautilus.game.arcade.stats.FirstSupplyDropOpenStatTracker;
import nautilus.game.arcade.stats.KillsWithinTimeLimitStatTracker;
import nautilus.game.arcade.stats.SimultaneousSkeletonStatTracker;
import nautilus.game.arcade.stats.WinWithoutWearingArmorStatTracker;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
public class SoloSurvivalGames extends SurvivalGames
{
@ -66,6 +66,23 @@ public class SoloSurvivalGames extends SurvivalGames
this.DamageTeamSelf = true;
}
public SoloSurvivalGames(ArcadeManager manager, Kit[] kits, GameType type)
{
super(manager, kits, type,
new String[]
{
"Search for chests to find loot",
"Slaughter your opponents",
"Stay away from the borders!",
"Last tribute alive wins!"
});
this.DamageTeamSelf = true;
}
@EventHandler
public void CustomTeamGeneration(GameStateChangeEvent event)
{

View File

@ -145,35 +145,38 @@ public abstract class SurvivalGames extends Game
private int _chestRefillTime = 60 * 7;
public SurvivalGames(ArcadeManager manager, GameType type,
public SurvivalGames(ArcadeManager manager, GameType type, String[] description)
{
this(manager, new Kit[]
{
new KitAxeman(manager),
// new KitLooter(manager),
new KitKnight(manager),
new KitArcher(manager),
new KitBrawler(manager),
new KitAssassin(manager),
new KitBeastmaster(manager),
new KitBomber(manager),
new KitNecromancer(manager),
new KitBarbarian(manager),
new KitHorseman(manager),
}, type, description);
}
public SurvivalGames(ArcadeManager manager, Kit[] kits, GameType type,
String[] description)
{
super(manager, type,
new Kit[]
{
new KitAxeman(manager),
// new KitLooter(manager),
new KitKnight(manager),
new KitArcher(manager),
new KitBrawler(manager),
new KitAssassin(manager),
new KitBeastmaster(manager),
new KitBomber(manager),
new KitNecromancer(manager),
new KitBarbarian(manager),
new KitHorseman(manager),
}, description);
super(manager, type, kits, description);
_help = new String[]
{

View File

@ -0,0 +1,173 @@
package nautilus.game.arcade.game.games.survivalgames.modes;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.entity.EntityDeathEvent;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextBottom;
import mineplex.core.common.util.UtilTime;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.smash.modes.kits.KitHipster;
import nautilus.game.arcade.game.games.survivalgames.SoloSurvivalGames;
import nautilus.game.arcade.game.games.survivalgames.kit.KitArcher;
import nautilus.game.arcade.game.games.survivalgames.kit.KitAssassin;
import nautilus.game.arcade.game.games.survivalgames.kit.KitAxeman;
import nautilus.game.arcade.game.games.survivalgames.kit.KitBarbarian;
import nautilus.game.arcade.game.games.survivalgames.kit.KitBeastmaster;
import nautilus.game.arcade.game.games.survivalgames.kit.KitBomber;
import nautilus.game.arcade.game.games.survivalgames.kit.KitBrawler;
import nautilus.game.arcade.game.games.survivalgames.kit.KitHorseman;
import nautilus.game.arcade.game.games.survivalgames.kit.KitKnight;
import nautilus.game.arcade.game.games.survivalgames.kit.KitNecromancer;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.Perk;
/**
* ChangingKits
*
* @author xXVevzZXx
*/
public class ChangingKits extends SoloSurvivalGames
{
private Kit[] _kits;
private long _lastChanged;
private int _changeInterval;
public ChangingKits(ArcadeManager manager)
{
super(manager, new Kit[]
{
new KitHipster(manager)
}, GameType.Brawl);
_kits = new Kit[]
{
new KitAxeman(manager),
// new KitLooter(manager),
new KitKnight(manager),
new KitArcher(manager),
new KitBrawler(manager),
new KitAssassin(manager),
new KitBeastmaster(manager),
new KitBomber(manager),
new KitNecromancer(manager),
new KitBarbarian(manager),
};
_lastChanged = 0;
_changeInterval = 60;
}
@EventHandler
public void countdown(UpdateEvent event)
{
if (!IsLive())
return;
if (event.getType() == UpdateType.SEC)
{
if (System.currentTimeMillis() > _lastChanged + 25000)
{
for (Player player : UtilServer.getPlayers())
{
player.playSound(player.getLocation(), Sound.NOTE_PLING, 2F, 2F);
}
}
}
if (event.getType() != UpdateType.TICK)
return;
double percentage = (double) (System.currentTimeMillis() - _lastChanged) / (_changeInterval*1000);
for (Player player : UtilServer.getPlayers())
{
UtilTextBottom.displayProgress("New Kit", percentage,
UtilTime.MakeStr(Math.max(0, (_changeInterval*1000) - (System.currentTimeMillis() - _lastChanged))), player);
}
}
@EventHandler
public void KitRegister(GameStateChangeEvent event)
{
if (event.GetState() != event.GetGame().KitRegisterState)
return;
for (Kit kit : _kits)
{
UtilServer.getServer().getPluginManager().registerEvents(kit, Manager.getPlugin());
for (Perk perk : kit.GetPerks())
{
UtilServer.getServer().getPluginManager().registerEvents(perk, Manager.getPlugin());
perk.registeredEvents();
}
}
}
@EventHandler
public void end(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Dead)
return;
for (Kit kit : _kits)
{
HandlerList.unregisterAll(kit);
for (Perk perk : kit.GetPerks())
{
HandlerList.unregisterAll(perk);
perk.unregisteredEvents();
}
}
}
@EventHandler
public void kitSwitch(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
return;
if (!IsLive())
return;
if (!UtilTime.elapsed(_lastChanged, _changeInterval*1000))
return;
_lastChanged = System.currentTimeMillis();
for (Player player : GetPlayers(true))
{
Kit kit = _kits[UtilMath.r(_kits.length)];
SetKit((Player) player, kit, true, false);
}
}
@Override
public String GetMode()
{
return "Changing Kits";
}
}

View File

@ -0,0 +1,571 @@
package nautilus.game.arcade.game.games.survivalgames.modes;
import java.util.HashMap;
import java.util.Iterator;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Chest;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.enchantment.EnchantItemEvent;
import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerItemDamageEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.event.player.PlayerToggleSneakEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.inventory.meta.ItemMeta;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilTime;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.loot.RandomItem;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerKitGiveEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.minestrike.GunModule;
import nautilus.game.arcade.game.games.minestrike.items.grenades.FlashBang;
import nautilus.game.arcade.game.games.minestrike.items.grenades.Grenade;
import nautilus.game.arcade.game.games.minestrike.items.grenades.HighExplosive;
import nautilus.game.arcade.game.games.minestrike.items.grenades.Incendiary;
import nautilus.game.arcade.game.games.minestrike.items.grenades.Molotov;
import nautilus.game.arcade.game.games.minestrike.items.grenades.Smoke;
import nautilus.game.arcade.game.games.minestrike.items.guns.Gun;
import nautilus.game.arcade.game.games.minestrike.items.guns.GunStats;
import nautilus.game.arcade.game.games.survivalgames.SoloSurvivalGames;
import nautilus.game.arcade.game.games.survivalgames.SupplyChestOpenEvent;
import nautilus.game.arcade.game.games.survivalgames.kit.KitLooter;
import nautilus.game.arcade.game.games.survivalgames.modes.kit.KitPlayer;
import nautilus.game.arcade.kit.Kit;
/**
* StrikeGames
*
* @author xXVevzZXx
*/
public class StrikeGames extends SoloSurvivalGames
{
private GunModule _gunModule;
private long _peacePhase;
private HashMap<Player, ItemStack> _helmets;
public StrikeGames(ArcadeManager manager)
{
super(manager, new Kit[]
{
new KitPlayer(manager)
}, GameType.Brawl);
Damage = false;
_helmets = new HashMap<>();
_peacePhase = 20000;
_gunModule = new GunModule(this);
_gunModule.EnableCleaning = false;
_gunModule.EnableDrop = false;
_gunModule.EnablePickup = false;
}
@EventHandler
public void enableDamage(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
return;
if (!IsLive())
return;
if (!UtilTime.elapsed(GetStateTime(), _peacePhase))
return;
if (Damage)
return;
Announce(F.main("Game", "The Peace Phase has ended! You can now fight each other!"));
Damage = true;
}
@EventHandler
public void informPeace(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Live)
return;
Announce(F.main("Game", "A Peace Phase of " + F.time((_peacePhase/1000) + "") + " seconds has started!"));
}
@EventHandler(priority=EventPriority.HIGHEST)
public void addHelmet(PlayerToggleSneakEvent event)
{
if (!IsLive())
return;
if (!IsAlive(event.getPlayer()))
return;
if (_gunModule.getScoped().containsKey(event.getPlayer()))
return;
if (event.getPlayer().getInventory().getHelmet() != null)
_helmets.put(event.getPlayer(), event.getPlayer().getInventory().getHelmet());
}
@EventHandler(priority=EventPriority.HIGHEST)
public void pumpkinDrop(PlayerDeathEvent event)
{
Iterator<ItemStack> itemIterator = event.getDrops().iterator();
while (itemIterator.hasNext())
{
ItemStack item = itemIterator.next();
if (item.getType() == Material.PUMPKIN
|| item.getType() == Material.PUMPKIN_STEM)
{
itemIterator.remove();
}
}
if (_helmets.containsKey(event.getEntity()))
event.getDrops().add(_helmets.get(event.getEntity()));
}
@EventHandler
public void disableCrafting(PlayerInteractEvent event)
{
if (!UtilEvent.isAction(event, ActionType.R_BLOCK))
return;
if (event.getClickedBlock().getType() == Material.WORKBENCH)
event.setCancelled(true);
}
@EventHandler
public void weaponEnchantment(EnchantItemEvent event)
{
if (!UtilItem.isArmor(event.getItem()))
event.setCancelled(true);
}
public void setupLoot()
{
// Food
getBaseLoot().addLoot(new RandomItem(Material.BAKED_POTATO, 30, 1, 3));
getBaseLoot().addLoot(new RandomItem(Material.COOKED_BEEF, 30, 1, 2));
getBaseLoot().addLoot(new RandomItem(Material.COOKED_CHICKEN, 30, 1, 2));
getBaseLoot().addLoot(new RandomItem(Material.MUSHROOM_SOUP, 15, 1, 1));
getBaseLoot().addLoot(new RandomItem(Material.WHEAT, 30, 1, 6));
getBaseLoot().addLoot(new RandomItem(Material.ROTTEN_FLESH, 40, 1, 6));
// Weapons
getBaseLoot().addLoot(new RandomItem(Material.WOOD_SWORD, 70));
getBaseLoot().addLoot(new RandomItem(Material.STONE_SWORD, 30));
// Leather armor
getBaseLoot().addLoot(new RandomItem(Material.LEATHER_BOOTS, 30));
getBaseLoot().addLoot(new RandomItem(Material.LEATHER_LEGGINGS, 30));
// Gold armor
getBaseLoot().addLoot(new RandomItem(Material.GOLD_BOOTS, 25));
getBaseLoot().addLoot(new RandomItem(Material.GOLD_CHESTPLATE, 25));
getBaseLoot().addLoot(new RandomItem(Material.GOLD_HELMET, 25));
getBaseLoot().addLoot(new RandomItem(Material.GOLD_LEGGINGS, 25));
// Grenades
getBaseLoot().addLoot(new RandomItem(Material.CARROT_ITEM, 15));
getBaseLoot().addLoot(new RandomItem(Material.APPLE, 15));
getBaseLoot().addLoot(new RandomItem(Material.PORK, 15));
getBaseLoot().addLoot(new RandomItem(Material.GRILLED_PORK, 15));
getBaseLoot().addLoot(new RandomItem(Material.POTATO_ITEM, 15));
// Chain armor
getBaseLoot().addLoot(new RandomItem(Material.CHAINMAIL_BOOTS, 20));
getBaseLoot().addLoot(new RandomItem(Material.CHAINMAIL_CHESTPLATE, 20));
getBaseLoot().addLoot(new RandomItem(Material.CHAINMAIL_HELMET, 20));
getBaseLoot().addLoot(new RandomItem(Material.CHAINMAIL_LEGGINGS, 20));
// Throwable
getBaseLoot().addLoot(new RandomItem(Material.FISHING_ROD, 30));
getBaseLoot().addLoot(new RandomItem(Material.EGG, 30, 1, 2));
// Misc
getBaseLoot().addLoot(new RandomItem(Material.EXP_BOTTLE, 30, 1, 2));
getBaseLoot().addLoot(new RandomItem(Material.COMPASS, 20));
getBaseLoot().addLoot(new RandomItem(Material.STICK, 30, 1, 2));
getBaseLoot().addLoot(new RandomItem(Material.BOAT, 15));
getBaseLoot().addLoot(new RandomItem(Material.FLINT, 30, 1, 2));
getBaseLoot().addLoot(new RandomItem(Material.FEATHER, 30, 1, 2));
getBaseLoot().addLoot(new RandomItem(Material.GOLD_INGOT, 20));
getSpawnLoot().addLoot(new RandomItem(Material.MUSHROOM_SOUP, 15));
getSpawnLoot().cloneLoot(getBaseLoot());
// Food
getSpawnLoot().addLoot(new RandomItem(Material.BAKED_POTATO, 30, 1, 5));
getSpawnLoot().addLoot(new RandomItem(Material.CAKE, 30));
getSpawnLoot().addLoot(new RandomItem(Material.MUSHROOM_SOUP, 30, 1, 1));
getSpawnLoot().addLoot(new RandomItem(Material.COOKED_BEEF, 30, 1, 3));
getSpawnLoot().addLoot(new RandomItem(Material.COOKED_CHICKEN, 30, 1, 3));
getSpawnLoot().addLoot(new RandomItem(Material.COOKED_FISH, 30, 1, 6));
getSpawnLoot().addLoot(new RandomItem(Material.COOKIE, 30));
getSpawnLoot().addLoot(new RandomItem(Material.PUMPKIN_PIE, 30, 1, 3));
// Loot for chests in spawn
// Weaponry and ores
getSpawnLoot().addLoot(new RandomItem(Material.STONE_SWORD, 30));
getSpawnLoot().addLoot(new RandomItem(Material.IRON_INGOT, 30, 1, 2));
// Iron gear
getSpawnLoot().addLoot(new RandomItem(Material.IRON_BOOTS, 30));
getSpawnLoot().addLoot(new RandomItem(Material.IRON_CHESTPLATE, 30));
getSpawnLoot().addLoot(new RandomItem(Material.IRON_HELMET, 30));
getSpawnLoot().addLoot(new RandomItem(Material.IRON_LEGGINGS, 30));
// Supply crate loot
// Diamond gear
getCrateLoot().addLoot(new RandomItem(Material.DIAMOND_HELMET, 10));
getCrateLoot().addLoot(new RandomItem(Material.DIAMOND_CHESTPLATE, 6));
getCrateLoot().addLoot(new RandomItem(Material.DIAMOND_LEGGINGS, 8));
getCrateLoot().addLoot(new RandomItem(Material.DIAMOND_BOOTS, 10));
// Iron gear
getCrateLoot().addLoot(new RandomItem(Material.IRON_HELMET, 30));
getCrateLoot().addLoot(new RandomItem(Material.IRON_CHESTPLATE, 24));
getCrateLoot().addLoot(new RandomItem(Material.IRON_LEGGINGS, 27));
getCrateLoot().addLoot(new RandomItem(Material.IRON_BOOTS, 30));
// Weapons
getCrateLoot().addLoot(new RandomItem(Material.IRON_SWORD, 24));
getCrateLoot().addLoot(new RandomItem(Material.DIAMOND_SWORD, 8));
getCrateLoot().addLoot(new RandomItem(Material.GOLD_SPADE, 12));
// Cooked furnace
getFurnace().addLoot(new RandomItem(Material.COOKED_BEEF, 3, 1, 2));
getFurnace().addLoot(new RandomItem(Material.COOKED_CHICKEN, 3, 1, 2));
getFurnace().addLoot(new RandomItem(Material.COOKED_FISH, 3, 1, 2));
getFurnace().addLoot(new RandomItem(Material.BAKED_POTATO, 3, 1, 1));
getFurnace().addLoot(new RandomItem(Material.PUMPKIN_PIE, 3, 1, 1));
getFurnace().addLoot(new RandomItem(Material.IRON_INGOT, 1, 1, 1));
// Raw furnace
getRawFurnace().addLoot(new RandomItem(Material.RAW_BEEF, 1, 1, 3));
getRawFurnace().addLoot(new RandomItem(Material.RAW_CHICKEN, 1, 1, 3));
getRawFurnace().addLoot(new RandomItem(Material.RAW_FISH, 1, 1, 3));
// Deathmatch Loot
getDeathMatch().addLoot(new RandomItem(Material.PUMPKIN_PIE, 4));
getDeathMatch().addLoot(new RandomItem(Material.BAKED_POTATO, 4));
getDeathMatch().addLoot(new RandomItem(Material.CAKE, 4));
getDeathMatch().addLoot(new RandomItem(Material.WOOD_SWORD, 3));
getDeathMatch().addLoot(new RandomItem(Material.STONE_SWORD, 1));
}
@Override
public void fillChest(Player looter, Block block)
{
getLootedBlocks().add(block.getLocation());
Chest chest = (Chest) block.getState();
chest.getBlockInventory().clear();
int items = 2;
if (Math.random() > 0.50)
items++;
if (Math.random() > 0.65)
items++;
if (Math.random() > 0.80)
items++;
if (Math.random() > 0.95)
items++;
boolean spawnChest = getChestRefillTime() > 0
&& UtilMath.offset(chest.getLocation(), getSpawn()) < 8;
if (spawnChest)
items += 3;
if (GetKit(looter) instanceof KitLooter)
{
items += UtilMath.r(3);
}
if (getSupplyBlocks().contains(block))
{
items = 5;
if (Math.random() > 0.50)
items++;
if (Math.random() > 0.60)
items++;
if (Math.random() > 0.70)
items++;
if (Math.random() > 0.80)
items++;
if (Math.random() > 0.90)
items++;
if (Math.random() > 0.95)
items++;
}
for (int i = 0; i < items; i++)
{
ItemStack item;
if (spawnChest)
{
item = getSpawnLoot().getLoot();
}
else if (isDeathMatchTeleported())
{
item = getDeathMatch().getLoot();
}
else
{
item = GetChestItem(getSupplyBlocks().contains(block));
}
if (item.getType() == Material.COMPASS)
{
item = buildCompass(5);
}
if (UtilItem.isWeapon(item))
{
GunStats gunStat = GunStats.values()[UtilMath.r(GunStats.values().length)];
int e = 0;
while (gunStat == GunStats.AWP && e < 20)
{
gunStat = GunStats.values()[UtilMath.r(GunStats.values().length)];
e++;
}
item = ItemStackFactory.Instance.CreateStack(gunStat.getSkin(), (byte) 0, 1, gunStat.getName());
}
String name = null;
if (item.getType() == Material.APPLE)
{
name = "High Explosive";
}
else if (item.getType() == Material.CARROT_ITEM)
{
name = "Flash Bang";
}
else if (item.getType() == Material.POTATO_ITEM)
{
name = "Smoke";
}
else if (item.getType() == Material.PORK)
{
name = "Incendiary";
}
else if (item.getType() == Material.GRILLED_PORK)
{
name = "Molotov";
}
if (name != null)
{
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(name);
item.setItemMeta(meta);
}
chest.getBlockInventory().setItem(UtilMath.r(27), item);
}
if (getSupplyBlocks().contains(block))
{
Bukkit.getPluginManager().callEvent(new SupplyChestOpenEvent(looter, block));
}
getSupplyBlocks().remove(block);
}
@EventHandler
public void addEquipment(InventoryClickEvent event)
{
if (event.getCurrentItem() == null)
return;
if (!(event.getWhoClicked() instanceof Player))
return;
Player player = (Player) event.getWhoClicked();
if (!(event.getClickedInventory() instanceof PlayerInventory))
{
ItemStack stack = event.getCurrentItem();
for (GunStats stat : GunStats.values())
{
if (stat.getSkin() == stack.getType())
{
Gun gun = new Gun(stat, _gunModule);
gun.setStack(stack);
gun.updateWeaponName(player, null, false);
gun.addID();
_gunModule.registerGun(gun, player);
return;
}
}
Grenade grenade = null;
if (stack.getType() == Material.APPLE)
{
grenade = new HighExplosive();
}
else if (stack.getType() == Material.CARROT_ITEM)
{
grenade = new FlashBang();
}
else if (stack.getType() == Material.POTATO_ITEM)
{
grenade = new Smoke();
}
else if (stack.getType() == Material.PORK)
{
grenade = new Incendiary();
}
else if (stack.getType() == Material.GRILLED_PORK)
{
grenade = new Molotov();
}
if (grenade != null)
{
ItemMeta meta = stack.getItemMeta();
meta.setDisplayName(grenade.getName());
stack.setItemMeta(meta);
grenade.setStack(stack);
_gunModule.registerGrenade(grenade, player);
}
}
}
@EventHandler
public void triggerPickup(PlayerPickupItemEvent event)
{
if (!InProgress())
return;
if (!IsAlive(event.getPlayer()))
return;
//Guns
Gun gun = _gunModule.getDroppedGuns().get(event.getItem());
if (gun != null)
{
_gunModule.deregisterDroppedGun(gun);
_gunModule.registerGun(gun, event.getPlayer());
gun.setStack(event.getItem().getItemStack());
}
//Grenades
Grenade grenade = _gunModule.getDroppedGrenades().get(event.getItem());
if (grenade != null)
{
_gunModule.deregisterDroppedGrenade(grenade);
_gunModule.registerGrenade(grenade, event.getPlayer());
grenade.setStack(event.getItem().getItemStack());
}
}
@EventHandler
public void triggerDrop(PlayerDropItemEvent event)
{
if (!InProgress())
return;
//Guns
Gun gun = _gunModule.getGunInHand(event.getPlayer(), event.getItemDrop().getItemStack());
if (gun != null)
{
gun.drop(_gunModule, event.getPlayer(), false, false);
event.getItemDrop().remove();
event.getPlayer().setItemInHand(null);
return;
}
//Grenades
Grenade grenade = _gunModule.getGrenadeInHand(event.getPlayer(), event.getItemDrop().getItemStack());
if (grenade != null)
{
grenade.drop(_gunModule, event.getPlayer(), false, false);
event.getItemDrop().remove();
event.getPlayer().setItemInHand(null);
return;
}
}
@EventHandler
@Override
public void ItemSpawn(ItemSpawnEvent event)
{
if (event.getEntity().getItemStack().hasItemMeta())
return;
Material mat = event.getEntity().getItemStack().getType();
switch (mat)
{
case SEEDS:
case SAPLING:
case VINE:
case LEAVES:
case LONG_GRASS:
case RED_ROSE:
case YELLOW_FLOWER:
case DEAD_BUSH:
case WATER_LILY:
event.setCancelled(true);
return;
case CARROT_ITEM:
event.setCancelled(true);
return;
case POTATO_ITEM:
event.setCancelled(true);
return;
case WHEAT:
event.setCancelled(true);
return;
case WOOD:
event.setCancelled(true);
return;
default:
break;
}
for (Player player : GetPlayers(true))
if (UtilMath.offset(player, event.getEntity()) < 6)
return;
event.setCancelled(true);
}
@Override
public String GetMode()
{
return "Strike Games";
}
}

View File

@ -0,0 +1,46 @@
package nautilus.game.arcade.game.games.survivalgames.modes.kit;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
public class KitPlayer extends Kit
{
public KitPlayer(ArcadeManager manager)
{
super(manager, "Player", KitAvailability.Free,
new String[]
{
C.cGreen + "Right-Click" + C.cWhite + " - " + C.cYellow + "Fire Gun",
C.cGreen + "Left-Click" + C.cWhite + " - " + C.cYellow + "Reload Gun",
C.cGreen + "Crouch" + C.cWhite + " - " + C.cYellow + "Sniper Scope",
},
new Perk[]
{
},
EntityType.PLAYER,
new ItemStack(Material.AIR));
}
@Override
public void GiveItems(Player player)
{
}
@Override
public void SpawnCustom(LivingEntity ent)
{
}
}

View File

@ -1,12 +1,15 @@
package nautilus.game.arcade.managers;
import java.lang.reflect.Array;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.bukkit.ChatColor;
@ -328,7 +331,7 @@ public class GameCreationManager implements Listener
}
classes.add(Game.class);
HashMap<String, String> varSet = Manager.GetServerConfig().GameModeMods.get(mode.getName());
HashMap<String, String> varSet = Manager.GetServerConfig().GameModeMods.get(mode.getName().replaceAll(" ", ""));
if (varSet == null)
return;
@ -346,9 +349,15 @@ public class GameCreationManager implements Listener
value = value.split("\\(")[1];
value = value.replace(")", "");
processList(clazz, game, var,
value.contains(":") ? value.split("\\:") : new String[]
{ value }, add, remove);
Field f = getField(clazz, var);
if (f == null)
continue;
processList(clazz, game, var, value.contains(":") ? value.split("\\:") : new String[]
{
value
},
add, remove, !List.class.isAssignableFrom(f.getType()));
}
else if (value.contains("["))
{
@ -414,7 +423,7 @@ public class GameCreationManager implements Listener
@SuppressWarnings("unchecked")
private void processList(Class<? extends Game> clazz, Game game, String var, String[] value,
boolean add, boolean remove)
boolean add, boolean remove, boolean array)
{
Field f = getField(clazz, var);
if (f == null)
@ -424,26 +433,37 @@ public class GameCreationManager implements Listener
{
f.setAccessible(true);
ParameterizedType type = (ParameterizedType) f.getGenericType();
Type generic = type.getActualTypeArguments()[0];
Class<?> genericClazz = Class.forName(generic.getTypeName());
ArrayList<Object> currentList = (ArrayList<Object>) f.get(game);
if (!add && !remove)
if (array)
{
add = true;
currentList.clear();
}
for (String finalValue : value)
{
if (add)
f.set(game, Array.newInstance(f.getType().getComponentType(), value.length));
for (int i = 0; i < value.length; i++)
{
currentList.add(parseValue(genericClazz, finalValue, game));
((Object[])f.get(game))[i] = parseValue(f.getType().getComponentType(), value[i], game);
}
else if (remove)
}
else
{
ParameterizedType type = (ParameterizedType) f.getGenericType();
Type generic = type.getActualTypeArguments()[0];
Class<?> genericClazz = Class.forName(generic.getTypeName());
ArrayList<Object> currentList = (ArrayList<Object>) f.get(game);
if (!add && !remove)
{
currentList.remove(parseValue(genericClazz, finalValue, game));
add = true;
currentList.clear();
}
for (String finalValue : value)
{
if (add)
{
currentList.add(parseValue(genericClazz, finalValue, game));
}
else if (remove)
{
currentList.remove(parseValue(genericClazz, finalValue, game));
}
}
}
@ -452,6 +472,7 @@ public class GameCreationManager implements Listener
catch (Exception ex)
{
System.out.println("Error while editing list");
ex.printStackTrace();
}
}
@ -516,7 +537,7 @@ public class GameCreationManager implements Listener
}
else if (clazz == Material.class)
{
return Material.getMaterial(value);
return Material.valueOf(value);
}
else if (clazz == ChatColor.class)
{

View File

@ -1263,7 +1263,7 @@ public class GameFlagManager implements Listener
if (Manager.GetGame() == null)
return;
if (Manager.GetGame().GetType().getResourcePackUrls() == null || Manager.GetGame().GetType().getResourcePackUrls().length == 0)
if (Manager.GetGame().GetType().getResourcePackUrls(Manager.GetGame()) == null || Manager.GetGame().GetType().getResourcePackUrls(Manager.GetGame()).length == 0)
return;
UtilTextMiddle.display(C.cGold + C.Bold + Manager.GetGame().GetType().GetName(), "Make sure you accept the Resource Pack", 20, 120, 20, event.getPlayer());

View File

@ -4,7 +4,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.minestrike.MineStrike;
import nautilus.game.arcade.game.games.minestrike.PlayerHeadshotEvent;
public class HeadShotStatTracker extends StatTracker<Game>
{
@ -23,7 +23,7 @@ public class HeadShotStatTracker extends StatTracker<Game>
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onPlayerHeadshot(MineStrike.PlayerHeadshotEvent event)
public void onPlayerHeadshot(PlayerHeadshotEvent event)
{
addStat(event.getShooter(), "Headshot", 1, false, false);
}

View File

@ -4,13 +4,13 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import nautilus.game.arcade.game.games.minestrike.MineStrike;
import nautilus.game.arcade.game.games.minestrike.Minestrike;
import nautilus.game.arcade.game.games.minestrike.items.grenades.Grenade;
import nautilus.game.arcade.game.games.minestrike.items.grenades.HighExplosive;
public class KaboomStatTracker extends StatTracker<MineStrike>
public class KaboomStatTracker extends StatTracker<Minestrike>
{
public KaboomStatTracker(MineStrike game)
public KaboomStatTracker(Minestrike game)
{
super(game);
}

View File

@ -14,14 +14,14 @@ 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.GameTeam;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.games.minestrike.MineStrike;
import nautilus.game.arcade.game.games.minestrike.GunModule;
import nautilus.game.arcade.game.games.minestrike.Minestrike;
public class KillAllOpposingMineStrikeRoundStatTracker extends StatTracker<MineStrike>
public class KillAllOpposingMineStrikeRoundStatTracker extends StatTracker<Minestrike>
{
private final Map<UUID, Set<UUID>> _kills = new HashMap<>();
public KillAllOpposingMineStrikeRoundStatTracker(MineStrike game)
public KillAllOpposingMineStrikeRoundStatTracker(Minestrike game)
{
super(game);
}
@ -63,7 +63,7 @@ public class KillAllOpposingMineStrikeRoundStatTracker extends StatTracker<MineS
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onRoundOver(MineStrike.RoundOverEvent event)
public void onRoundOver(GunModule.RoundOverEvent event)
{
for (GameTeam team : getGame().GetTeamList())
{

View File

@ -5,7 +5,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.minestrike.MineStrike.CustomGunDamageEvent;
import nautilus.game.arcade.game.games.minestrike.CustomGunDamageEvent;
public class MineStrikeGunStats extends StatTracker<Game>
{

View File

@ -13,13 +13,14 @@ 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.GameTeam;
import nautilus.game.arcade.game.games.minestrike.MineStrike;
import nautilus.game.arcade.game.games.minestrike.GunModule;
import nautilus.game.arcade.game.games.minestrike.Minestrike;
public class MineStrikeLastAliveKillStatTracker extends StatTracker<MineStrike>
public class MineStrikeLastAliveKillStatTracker extends StatTracker<Minestrike>
{
private final Map<UUID, Integer> _killCount = new HashMap<>();
public MineStrikeLastAliveKillStatTracker(MineStrike game)
public MineStrikeLastAliveKillStatTracker(Minestrike game)
{
super(game);
}
@ -45,7 +46,7 @@ public class MineStrikeLastAliveKillStatTracker extends StatTracker<MineStrike>
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onRoundOver(MineStrike.RoundOverEvent event)
public void onRoundOver(GunModule.RoundOverEvent event)
{
for (GameTeam team : getGame().GetTeamList())
{