Add new Brawl Games (#260)

* add more Brawl games

* fix some bugs in new brawl games

* fix even more bugs

* Fix some super paintstrike bugs

* Add some Javadoc
This commit is contained in:
Sarah 2016-11-10 02:38:49 +01:00 committed by Shaun Bennett
parent 3b83a9bdc3
commit e71187aa33
21 changed files with 1767 additions and 56 deletions

View File

@ -14,9 +14,12 @@ import nautilus.game.arcade.game.games.basketball.Basketball;
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.AppleAttack;
import nautilus.game.arcade.game.games.bridge.modes.InsaneBridges;
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.bridge.modes.UHCBridges;
import nautilus.game.arcade.game.games.build.Build;
import nautilus.game.arcade.game.games.build.modes.DukesOfDecoration;
import nautilus.game.arcade.game.games.build.modes.TeamBuild;
@ -57,6 +60,7 @@ 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.modes.SuperPaintstrike;
import nautilus.game.arcade.game.games.mineware.BawkBawkBattles;
import nautilus.game.arcade.game.games.monsterleague.MonsterLeague;
import nautilus.game.arcade.game.games.monstermaze.MonsterMaze;
@ -66,6 +70,7 @@ import nautilus.game.arcade.game.games.quiver.Quiver;
import nautilus.game.arcade.game.games.quiver.QuiverTeamBase;
import nautilus.game.arcade.game.games.quiver.QuiverTeams;
import nautilus.game.arcade.game.games.quiver.modes.BunnyHop;
import nautilus.game.arcade.game.games.quiver.modes.UltimateOITQ;
import nautilus.game.arcade.game.games.rings.ElytraRings;
import nautilus.game.arcade.game.games.runner.Runner;
import nautilus.game.arcade.game.games.runner.modes.FasterThanLight;
@ -73,11 +78,13 @@ 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.SheepMania;
import nautilus.game.arcade.game.games.sheep.modes.SmashSheep;
import nautilus.game.arcade.game.games.skyfall.SoloSkyfall;
import nautilus.game.arcade.game.games.skyfall.TeamSkyfall;
import nautilus.game.arcade.game.games.skywars.SoloSkywars;
import nautilus.game.arcade.game.games.skywars.TeamSkywars;
import nautilus.game.arcade.game.games.skywars.modes.Elementalist;
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;
@ -222,13 +229,17 @@ public enum GameType
Brawl(null, new GameMode[]{
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(LuckyBridges.class, GameType.Bridge, "Lucky Bridges"),
new GameMode(AppleAttack.class, GameType.Bridge, "Apple Attack"),
new GameMode(UHCBridges.class, GameType.Bridge, "UHC Bridges"),
new GameMode(InsaneBridges.class, GameType.Bridge, "Insane 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(Elementalist.class, GameType.Skywars, "Elementalist"),
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"),
@ -250,12 +261,19 @@ public enum GameType
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(SheepMania.class, GameType.Sheep, "Sheep Mania"),
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(BunnyHop.class, GameType.Quiver, "Bunny Hop"),
new GameMode(UltimateOITQ.class, GameType.Quiver, "Ultimate OITQ"),
new GameMode(Countdown.class, GameType.HideSeek, "Countdown"),
new GameMode(SmashDom.class, GameType.ChampionsDominate, "Smash Dominate"),
new GameMode(SmashDom.class, GameType.ChampionsDominate, "Smash Dominate"),
new GameMode(SuperPaintstrike.class, GameType.MineStrike, "Super Paintstrike", new Pair[]
{
Pair.create(MinecraftVersion.Version1_8, "http://file.mineplex.com/ResMinestrike.zip"),
Pair.create(MinecraftVersion.Version1_9, "http://file.mineplex.com/ResMinestrike19.zip")
}, true),
}, GameDisplay.Brawl, null, false, null, false, true);
GameDisplay _display;

View File

@ -129,19 +129,22 @@ public class Bridge extends TeamGame implements OreObsfucation
public Bridge(ArcadeManager manager, GameType type)
{
super(manager, type,
new Kit[]
{
new KitApple(manager),
new KitBerserker(manager),
new KitBrawler(manager),
new KitMammoth(manager),
new KitArcher(manager),
new KitMiner(manager),
new KitBomber(manager),
new KitDestructor(manager),
},
this(manager, new Kit[]
{
new KitApple(manager),
new KitBerserker(manager),
new KitBrawler(manager),
new KitMammoth(manager),
new KitArcher(manager),
new KitMiner(manager),
new KitBomber(manager),
new KitDestructor(manager),
}, type);
}
public Bridge(ArcadeManager manager, Kit[] kitarray, GameType type)
{
super(manager, type, kitarray,
new String[] {
"Gather resources and prepare for combat.",

View File

@ -21,7 +21,7 @@ public class KitApple extends ProgressingKit
};
private static final Perk[] PERKS = {
new PerkApple()
new PerkApple(10000)
};
private static final ItemStack IN_HAND = new ItemStack(Material.APPLE);

View File

@ -0,0 +1,28 @@
package nautilus.game.arcade.game.games.bridge.modes;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.games.bridge.Bridge;
import nautilus.game.arcade.game.games.bridge.modes.kits.KitBrawlAppler;
import nautilus.game.arcade.kit.Kit;
/**
* AppleAttack is a mode for [{@link Bridge} which will remove all kits except for a custom appler {@link KitBrawlAppler}
*
* @author xXVevzZXx
*/
public class AppleAttack extends Bridge
{
public AppleAttack(ArcadeManager manager)
{
super(manager, new Kit[]{new KitBrawlAppler(manager)}, GameType.Brawl);
}
@Override
public String GetMode()
{
return "Apple Attack";
}
}

View File

@ -0,0 +1,197 @@
package nautilus.game.arcade.game.games.bridge.modes;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Chest;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.EnchantmentStorageMeta;
import org.bukkit.potion.Potion;
import org.bukkit.potion.PotionType;
import mineplex.core.common.util.UtilMath;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.games.AbsorptionFix;
import nautilus.game.arcade.game.games.bridge.Bridge;
/**
* InsaneBridges is a mode of {@link Bridge} which provides players with starting equipement, better loot and shorter bridge time
*
* @author xXVevzZXx
*/
public class InsaneBridges extends Bridge
{
private int _untilBridges;
public InsaneBridges(ArcadeManager manager)
{
super(manager, GameType.Brawl);
new AbsorptionFix(this);
Manager.GetDamage().SetEnabled(false);
_untilBridges = 60000; // 60 Seconds
WorldBoundaryKill = true;
}
@EventHandler
public void fallBridges(GameStateChangeEvent event)
{
if (event.GetState() == GameState.Live)
{
setBridgeTime(_untilBridges);
for (Player player : GetPlayers(true))
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD, 4, Enchantment.DAMAGE_ALL));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET, 2, Enchantment.PROTECTION_ENVIRONMENTAL));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE, 2, Enchantment.PROTECTION_ENVIRONMENTAL));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS, 2, Enchantment.PROTECTION_ENVIRONMENTAL));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS, 2, Enchantment.PROTECTION_ENVIRONMENTAL));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW, 2, Enchantment.ARROW_DAMAGE));
player.getInventory().addItem(new ItemStack(Material.ARROW, 64));
player.getInventory().addItem(new ItemStack(Material.GOLDEN_APPLE, 5));
player.getInventory().addItem(new ItemStack(Material.FISHING_ROD));
player.getInventory().addItem(new ItemStack(Material.COOKED_BEEF, 32));
player.getInventory().addItem(new ItemStack(Material.IRON_PICKAXE));
player.getInventory().addItem(new ItemStack(Material.COBBLESTONE, 32));
}
}
}
@Override
protected void ParseChests()
{
for (Location loc : WorldData.GetCustomLocs("54"))
{
if (loc.getBlock().getType() != Material.CHEST)
loc.getBlock().setType(Material.CHEST);
Chest chest = (Chest) loc.getBlock().getState();
chest.getBlockInventory().clear();
int count = 22 + UtilMath.r(4);
for (int i = 0; i < count; i++)
{
chest.getBlockInventory().addItem(GetChestItem());
}
}
}
@Override
protected ItemStack GetChestItem()
{
if (getChestLoot().isEmpty())
{
for (int i = 0; i < 2; i++)
getChestLoot().add(new ItemStack(Material.DIAMOND_HELMET));
for (int i = 0; i < 2; i++)
getChestLoot().add(new ItemStack(Material.DIAMOND_CHESTPLATE));
for (int i = 0; i < 2; i++)
getChestLoot().add(new ItemStack(Material.DIAMOND_LEGGINGS));
for (int i = 0; i < 2; i++)
getChestLoot().add(new ItemStack(Material.DIAMOND_BOOTS));
for (int i = 0; i < 2; i++)
getChestLoot().add(new ItemStack(Material.DIAMOND_SWORD));
for (int i = 0; i < 2; i++)
getChestLoot().add(new ItemStack(Material.DIAMOND_AXE));
for (int i = 0; i < 2; i++)
getChestLoot().add(new ItemStack(Material.DIAMOND_PICKAXE));
for (int i = 0; i < 13; i++)
{
getChestLoot().add(new ItemStack(Material.GOLDEN_APPLE));
getChestLoot().add(new ItemStack(Material.ANVIL));
}
for (int i = 0; i < 5; i++)
{
Potion potionHealth = new Potion(PotionType.INSTANT_HEAL);
potionHealth.setLevel(2);
potionHealth.setSplash(true);
getChestLoot().add(potionHealth.toItemStack(1));
Potion potionDamage = new Potion(PotionType.INSTANT_DAMAGE);
potionDamage.setLevel(2);
potionDamage.setSplash(true);
getChestLoot().add(potionDamage.toItemStack(1));
Potion potionStrenght = new Potion(PotionType.STRENGTH);
potionStrenght.setLevel(1);
potionStrenght.setSplash(true);
getChestLoot().add(potionStrenght.toItemStack(1));
}
for (int i = 0; i < 5; i++)
{
ItemStack sharpness = new ItemStack(Material.ENCHANTED_BOOK);
EnchantmentStorageMeta sharpnessMeta = (EnchantmentStorageMeta) sharpness
.getItemMeta();
sharpnessMeta.addStoredEnchant(Enchantment.DAMAGE_ALL, 1 + UtilMath.r(5), true);
sharpness.setItemMeta(sharpnessMeta);
getChestLoot().add(sharpness);
ItemStack protection = new ItemStack(Material.ENCHANTED_BOOK);
EnchantmentStorageMeta protectionMeta = (EnchantmentStorageMeta) protection
.getItemMeta();
protectionMeta.addStoredEnchant(Enchantment.PROTECTION_ENVIRONMENTAL,
1 + UtilMath.r(4), true);
protection.setItemMeta(protectionMeta);
getChestLoot().add(protection);
ItemStack power = new ItemStack(Material.ENCHANTED_BOOK);
EnchantmentStorageMeta powerMeta = (EnchantmentStorageMeta) power.getItemMeta();
powerMeta.addStoredEnchant(Enchantment.ARROW_DAMAGE, 1 + UtilMath.r(5), true);
power.setItemMeta(powerMeta);
getChestLoot().add(power);
}
for (int i = 0; i < 10; i++)
getChestLoot().add(new ItemStack(Material.EXP_BOTTLE, 10));
for (int i = 0; i < 6; i++)
getChestLoot().add(new ItemStack(Material.BOW));
for (int i = 0; i < 8; i++)
getChestLoot().add(new ItemStack(Material.ARROW, 8));
for (int i = 0; i < 12; i++)
getChestLoot().add(new ItemStack(Material.MUSHROOM_SOUP));
for (int i = 0; i < 12; i++)
getChestLoot().add(new ItemStack(Material.COOKED_CHICKEN, 2));
}
ItemStack stack = getChestLoot().get(UtilMath.r(getChestLoot().size()));
int amount = 1;
if (stack.getType().getMaxStackSize() > 1)
amount = stack.getAmount() + UtilMath.r(stack.getAmount());
ItemStack item = stack.clone();
item.setAmount(amount);
return item;
}
@Override
public String GetMode()
{
return "Insane Bridges";
}
}

View File

@ -5,6 +5,8 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
import mineplex.minecraft.game.core.condition.ConditionManager;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
@ -24,7 +26,7 @@ public class SpeedBridges extends Bridge
{
super(manager, GameType.Brawl);
_untilBridges = 20000;
_untilBridges = 10000;
}
@EventHandler
@ -36,11 +38,15 @@ public class SpeedBridges extends Bridge
for (Player player : GetPlayers(true))
{
player.getInventory().addItem(new ItemStack(Material.WOOD_SWORD));
player.getInventory().addItem(new ItemStack(Material.LEATHER_HELMET));
player.getInventory().addItem(new ItemStack(Material.LEATHER_CHESTPLATE));
player.getInventory().addItem(new ItemStack(Material.LEATHER_LEGGINGS));
player.getInventory().addItem(new ItemStack(Material.LEATHER_BOOTS));
player.getInventory().addItem(new ItemStack(Material.IRON_SWORD));
player.getInventory().addItem(new ItemStack(Material.IRON_HELMET));
player.getInventory().addItem(new ItemStack(Material.IRON_CHESTPLATE));
player.getInventory().addItem(new ItemStack(Material.IRON_LEGGINGS));
player.getInventory().addItem(new ItemStack(Material.IRON_BOOTS));
player.getInventory().addItem(new ItemStack(Material.COOKED_BEEF, 10));
Manager.GetCondition().Factory().Speed("Game", player, player, GameTimeout, 2, true, true, true);
}
}
}

View File

@ -0,0 +1,146 @@
package nautilus.game.arcade.game.games.bridge.modes;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import org.bukkit.event.inventory.PrepareItemCraftEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.inventory.CraftingInventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.ShapedRecipe;
import org.bukkit.material.MaterialData;
import org.bukkit.scoreboard.DisplaySlot;
import org.bukkit.scoreboard.Objective;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.games.AbsorptionFix;
import nautilus.game.arcade.game.games.bridge.Bridge;
/**
* UHCBridges is a mode of {@link Bridge} which is a UHC like gamemode
*
* @author xXVevzZXx
*/
public class UHCBridges extends Bridge
{
public UHCBridges(ArcadeManager manager)
{
super(manager, GameType.Brawl);
SoupEnabled = false;
new AbsorptionFix(this);
ShapedRecipe headApple = new ShapedRecipe(new ItemStack(Material.GOLDEN_APPLE, 1));
headApple.shape("GGG", "GHG", "GGG");
headApple.setIngredient('G', Material.GOLD_INGOT);
headApple.setIngredient('H', new MaterialData(Material.SKULL_ITEM, (byte) 3));
UtilServer.getServer().addRecipe(headApple);
}
@EventHandler
public void registerObj(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Prepare)
return;
Objective objective = Scoreboard.getScoreboard().registerNewObjective("Health", "health");
objective.setDisplaySlot(DisplaySlot.PLAYER_LIST);
}
@EventHandler
public void regenHealth(EntityRegainHealthEvent event)
{
if (event.getRegainReason() == RegainReason.SATIATED)
event.setCancelled(true);
}
@EventHandler
public void gappleDrop(EntityDeathEvent event)
{
if (event.getEntity() instanceof Player)
{
event.getDrops().add(new ItemStack(Material.GOLDEN_APPLE, 1));
}
}
@EventHandler
public void giveItems(GameStateChangeEvent event)
{
if (event.GetState() == GameState.Live)
{
for (Player player : GetPlayers(true))
{
player.getInventory().addItem(new ItemStack(Material.GOLDEN_APPLE, 3));
}
}
}
@EventHandler
public void headPlaceCancel(BlockPlaceEvent event)
{
if (event.getItemInHand().getType() == Material.SKULL || event.getItemInHand().getType() == Material.SKULL_ITEM)
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.MONITOR)
public void headPickup(PlayerPickupItemEvent event)
{
if (!IsLive())
return;
if (event.isCancelled())
return;
if (event.getItem().getItemStack().getType() == Material.SKULL_ITEM)
{
UtilPlayer.message(event.getPlayer(), " ");
UtilPlayer.message(event.getPlayer(), C.cGreen + C.Bold + "You picked up a Player Head!");
UtilPlayer.message(event.getPlayer(), C.cWhite + "Use the recipe for Golden Apple, but Head replaces Apple.");
UtilPlayer.message(event.getPlayer(), " ");
}
}
@EventHandler(priority = EventPriority.HIGH)
public void craftGoldenAppleDeny(PrepareItemCraftEvent event)
{
if (event.getRecipe().getResult() == null)
return;
Material type = event.getRecipe().getResult().getType();
if (type != Material.GOLDEN_APPLE)
return;
if (!(event.getInventory() instanceof CraftingInventory))
return;
CraftingInventory inv = (CraftingInventory) event.getInventory();
for (ItemStack item : inv.getMatrix())
if (item != null && item.getType() != Material.AIR)
if (item.getType() == Material.GOLD_INGOT)
return;
inv.setResult(null);
}
@Override
public String GetMode()
{
return "UHC Bridges";
}
}

View File

@ -0,0 +1,46 @@
package nautilus.game.arcade.game.games.bridge.modes.kits;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.bridge.kits.KitApple;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
import nautilus.game.arcade.kit.perks.PerkApple;
/**
* KitBrawlAppler is a variation of the Kit [{@link KitApple} which has a shorter delay of spawning apples
*
* @author xXVevzZXx
*/
public class KitBrawlAppler extends ProgressingKit
{
private static final String[] DESCRIPTION =
{
"Possess the rare skill of finding apples frequently!",
"",
receiveItem("apple", 1, 3, 0), click(true, "the apple to throw it")
};
private static final Perk[] PERKS =
{
new PerkApple(3000)
};
private static final ItemStack IN_HAND = new ItemStack(Material.APPLE);
public KitBrawlAppler(ArcadeManager manager)
{
super(manager, "Apple", "bridgeapple", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND);
}
@Override
public void GiveItems(Player player)
{
}
}

View File

@ -5,6 +5,8 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import net.minecraft.server.v1_8_R3.EntityArrow;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Effect;
@ -76,8 +78,8 @@ import mineplex.core.recharge.RechargedEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
@ -91,7 +93,6 @@ import nautilus.game.arcade.game.games.minestrike.items.equipment.armor.Armor;
import nautilus.game.arcade.game.games.minestrike.items.grenades.Grenade;
import nautilus.game.arcade.game.games.minestrike.items.guns.Gun;
import nautilus.game.arcade.game.games.minestrike.items.guns.GunType;
import net.minecraft.server.v1_8_R3.EntityArrow;
public class GunModule implements Listener
{
@ -141,6 +142,7 @@ public class GunModule implements Listener
public boolean EnablePickup = true;
public boolean EnableDrop = true;
public boolean EnableCleaning = true;
private boolean _disableDamage;
private long _freezeTime = -1;
@ -878,6 +880,9 @@ public class GunModule implements Listener
@EventHandler(priority=EventPriority.HIGH)
public void damage(CustomDamageEvent event)
{
if (_disableDamage)
return;
if (event.GetDamageePlayer() == null)
return;
@ -2068,4 +2073,9 @@ public class GunModule implements Listener
{
return _scoped;
}
public void setDisableDamage(boolean disabled)
{
_disableDamage = disabled;
}
}

View File

@ -57,6 +57,7 @@ import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
@ -121,25 +122,18 @@ public class Minestrike extends TeamGame
//Scoreboard
private Objective _scoreObj;
public Minestrike(ArcadeManager manager)
public Minestrike(ArcadeManager manager, Kit[] kits, GameType type)
{
super(manager, GameType.MineStrike,
new Kit[]
{
new KitPlayer(manager),
},
super(manager, type, kits,
new String[]
{
C.cAqua + "SWAT" + C.cWhite + " Defend the Bomb Sites",
C.cAqua + "SWAT" + C.cWhite + " Kill the Bombers",
" ",
C.cRed + "Bombers" + C.cWhite + " Plant the Bomb at Bomb Site",
C.cRed + "Bombers" + C.cWhite + " Kill the SWAT Team",
});
{
C.cAqua + "SWAT" + C.cWhite + " Defend the Bomb Sites",
C.cAqua + "SWAT" + C.cWhite + " Kill the Bombers",
" ",
C.cRed + "Bombers" + C.cWhite + " Plant the Bomb at Bomb Site",
C.cRed + "Bombers" + C.cWhite + " Kill the SWAT Team",
});
_shopManager = new ShopManager(this);
Manager.getCosmeticManager().setHideParticles(true);
this.StrictAntiHack = true;
@ -181,6 +175,14 @@ public class Minestrike extends TeamGame
"Pick up better weapons from dead players"
};
_gunModule = new GunModule(this);
_shopManager = new ShopManager(this);
}
public Minestrike(ArcadeManager manager)
{
this(manager, new Kit[]{new KitPlayer(manager)}, GameType.MineStrike);
registerStatTrackers(
new KillReasonStatTracker(this, "Headshot", "BoomHeadshot", true),
new KillAllOpposingMineStrikeRoundStatTracker(this),
@ -204,8 +206,6 @@ public class Minestrike extends TeamGame
new ChatStatData("BoomHeadshot", "Headshots", true),
Assists
);
_gunModule = new GunModule(this);
}
@EventHandler
@ -313,6 +313,15 @@ public class Minestrike extends TeamGame
public void giveTeamArmor(Player player, Color color)
{
if (_shopManager.isDisabled())
{
ItemStack armor = new ItemStack(Material.LEATHER_HELMET);
LeatherArmorMeta meta = (LeatherArmorMeta)armor.getItemMeta();
meta.setColor(color);
armor.setItemMeta(meta);
player.getInventory().setHelmet(armor);
}
ItemStack armor = new ItemStack(Material.LEATHER_CHESTPLATE);
LeatherArmorMeta meta = (LeatherArmorMeta)armor.getItemMeta();
meta.setColor(color);
@ -934,9 +943,13 @@ public class Minestrike extends TeamGame
{
player.playSound(player.getLocation(), Sound.HORSE_ARMOR, 1f, 2f);
Manager.GetCondition().Factory().Blind("Respawn", player, null, 2, 0, false, false, false);
UtilPlayer.message(player, F.main("Game", "You have " + F.elem(C.cGreen + "$" + _shopManager.getMoney(player)) + ". Open your Inventory to spend it."));
if (!_shopManager.isDisabled())
{
UtilPlayer.message(player, F.main("Game", "You have " + F.elem(C.cGreen + "$" + _shopManager.getMoney(player)) + ". Open your Inventory to spend it."));
UtilTextMiddle.display(C.cGreen + "$" + _shopManager.getMoney(player), "Open your Inventory to buy new equipment", 10, 120, 10, player);
UtilTextMiddle.display(C.cGreen + "$" + _shopManager.getMoney(player), "Open your Inventory to buy new equipment", 10, 120, 10, player);
}
}
//Reset grenades
@ -1362,4 +1375,9 @@ public class Minestrike extends TeamGame
{
return _gunModule;
}
public ShopManager getShopManager()
{
return _shopManager;
}
}

View File

@ -50,6 +50,8 @@ public class ShopManager
private HashSet<Player> _inShop = new HashSet<Player>();
private Map<UUID, Integer> _boughtGrenades = new HashMap<>();
private boolean _disabled;
public ShopManager(Minestrike minestrike)
{
@ -58,6 +60,9 @@ public class ShopManager
public void enterShop(Player player)
{
if (_disabled)
return;
GameTeam team = Host.GetTeam(player);
if (team == null)
return;
@ -174,6 +179,9 @@ public class ShopManager
public int getMoney(Player player)
{
if (_disabled)
return 0;
if (!_money.containsKey(player))
_money.put(player, 800);
@ -182,6 +190,9 @@ public class ShopManager
public void addMoney(Player player, int amount, String reason)
{
if (_disabled)
return;
_money.put(player, Math.min(16000, getMoney(player) + amount));
UtilPlayer.message(player, F.main("Game", "Received " + F.elem(C.cDGreen + "$" + amount) + " for " + reason + "."));
@ -189,6 +200,9 @@ public class ShopManager
public void inventoryClick(InventoryClickEvent event)
{
if (_disabled)
return;
event.setCancelled(true);
Player player = UtilPlayer.searchExact(event.getWhoClicked().getName());
@ -282,6 +296,9 @@ public class ShopManager
public void leaveShop(Player player, boolean showShopItem, boolean wipeMoney)
{
if (_disabled)
return;
_shop.remove(player);
_inShop.remove(player);
@ -310,7 +327,10 @@ public class ShopManager
}
public void update()
{
{
if (_disabled)
return;
for (Player player : Host.GetPlayers(false))
{
GameTeam team = Host.GetTeam(player);
@ -345,8 +365,18 @@ public class ShopManager
}
}
public void setDisabled(boolean disabled)
{
_disabled = disabled;
}
public void resetGrenades()
{
_boughtGrenades.clear();
}
public boolean isDisabled()
{
return _disabled;
}
}

View File

@ -0,0 +1,657 @@
package nautilus.game.arcade.game.games.minestrike.modes;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.Effect;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.EnderPearl;
import org.bukkit.entity.Player;
import org.bukkit.entity.Snowball;
import org.bukkit.entity.ThrownPotion;
import org.bukkit.event.Cancellable;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.LeatherArmorMeta;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.scoreboard.NameTagVisibility;
import org.bukkit.scoreboard.Team;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.hologram.Hologram.HologramTarget;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerKitGiveEvent;
import nautilus.game.arcade.events.PlayerPrepareTeleportEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.game.games.minestrike.Minestrike;
import nautilus.game.arcade.game.games.paintball.Paintball;
import nautilus.game.arcade.game.games.paintball.PlayerCopyPaintball;
import nautilus.game.arcade.game.games.paintball.events.PaintballEvent;
import nautilus.game.arcade.game.games.paintball.events.ReviveEvent;
import nautilus.game.arcade.game.games.paintball.kits.KitMachineGun;
import nautilus.game.arcade.game.games.paintball.kits.KitRifle;
import nautilus.game.arcade.game.games.paintball.kits.KitShotgun;
import nautilus.game.arcade.game.games.paintball.kits.KitSniper;
import nautilus.game.arcade.kit.Kit;
/**
* SuperPaintstrike is a mode of {@link Minestrike} which implements {@link Paintball} kits
*
* @author xXVevzZXx
*/
public class SuperPaintstrike extends Minestrike
{
private HashMap<Player, PlayerCopyPaintball> _doubles = new HashMap<Player, PlayerCopyPaintball>();
public SuperPaintstrike(ArcadeManager manager)
{
super(manager, new Kit[]
{
new KitRifle(manager),
new KitShotgun(manager),
new KitMachineGun(manager),
new KitSniper(manager),
}, GameType.Brawl);
getShopManager().setDisabled(true);
getGunModule().setDisableDamage(true);
getGunModule().setEnableCleaning(false);
}
@Override
@EventHandler
public void giveStartEquipment(PlayerKitGiveEvent event)
{
GameTeam team = GetTeam(event.getPlayer());
if (team == null)
return;
if (team.GetColor() == ChatColor.RED)
{
if (IsAlive(event.getPlayer()))
{
//Armor
giveTeamArmor(event.getPlayer(), Color.RED);
}
}
else if (team.GetColor() == ChatColor.AQUA)
{
if (IsAlive(event.getPlayer()))
{
//Armor
giveTeamArmor(event.getPlayer(), Color.AQUA);
}
}
}
@EventHandler
public void onHeal(PlayerInteractEvent event)
{
if (!UtilEvent.isAction(event, ActionType.R))
return;
LaunchPotion(event.getPlayer(), event);
}
@EventHandler
public void onHeal(PlayerInteractEntityEvent event)
{
LaunchPotion(event.getPlayer(), event);
}
@EventHandler(ignoreCancelled = false)
public void onHeal(PlayerInteractAtEntityEvent event)
{
LaunchPotion(event.getPlayer(), event);
}
public void LaunchPotion(Player player, Cancellable event)
{
if (!IsLive())
return;
if (!UtilGear.isMat(player.getItemInHand(), Material.POTION))
return;
event.setCancelled(true);
if (!IsAlive(player) || UtilPlayer.isSpectator(player))
return;
if (!Recharge.Instance.use(player, "Water Potion", 250, false, false))
return;
UtilInv.UseItemInHand(player);
ThrownPotion potion = player.launchProjectile(ThrownPotion.class);
potion.getEffects().clear();
potion.getEffects().add(new PotionEffect(PotionEffectType.WATER_BREATHING, 100, 100));
Manager.runAsync(new Runnable()
{
@Override
public void run()
{
UtilInv.Update(player);
}
});
}
@EventHandler
public void removePotionEffect(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player player : GetPlayers(true))
player.removePotionEffect(PotionEffectType.WATER_BREATHING);
}
public void cleanColorArmor(Player player)
{
Color color = Color.RED;
if (Manager.GetColor(player) != ChatColor.RED)
color = Color.AQUA;
for (ItemStack stack : player.getEquipment().getArmorContents())
{
if (!(stack.getItemMeta() instanceof LeatherArmorMeta))
continue;
LeatherArmorMeta meta = (LeatherArmorMeta)stack.getItemMeta();
meta.setColor(color);
stack.setItemMeta(meta);
}
}
@EventHandler
public void cleanHit(ProjectileHitEvent event)
{
if (!IsLive())
return;
if (!(event.getEntity() instanceof ThrownPotion))
return;
if (event.getEntity().getShooter() == null)
return;
if (!(event.getEntity().getShooter() instanceof Player))
return;
Player thrower = (Player)event.getEntity().getShooter();
if (!IsAlive(thrower))
return;
GameTeam throwerTeam = GetTeam(thrower);
if (throwerTeam == null) return;
//Revive
Iterator<PlayerCopyPaintball> copyIterator = _doubles.values().iterator();
while (copyIterator.hasNext())
{
PlayerCopyPaintball copy = copyIterator.next();
GameTeam otherTeam = GetTeam(copy.GetPlayer());
if (otherTeam == null || !otherTeam.equals(throwerTeam))
continue;
if (UtilMath.offset(copy.GetEntity().getLocation().add(0,1,0), event.getEntity().getLocation()) > 3)
continue;
playerIn(copy.GetPlayer(), copy);
copyIterator.remove();
AddGems(thrower, 3, "Revived Ally", true, true);
Bukkit.getPluginManager().callEvent(new ReviveEvent(thrower, copy.GetPlayer()));
}
//Clean
for (Player player : GetPlayers(true))
{
GameTeam otherTeam = GetTeam(player);
if (otherTeam == null || !otherTeam.equals(throwerTeam))
continue;
if (UtilMath.offset(player.getLocation().add(0,1,0), event.getEntity().getLocation()) > 3)
continue;
playerIn(player, null);
}
}
public void playerIn(final Player player, final PlayerCopyPaintball copy)
{
//State
SetPlayerState(player, PlayerState.IN);
player.setHealth(20);
//Teleport
if (copy != null)
{
Location loc = player.getLocation();
loc.setX(copy.GetEntity().getLocation().getX());
loc.setY(copy.GetEntity().getLocation().getY());
loc.setZ(copy.GetEntity().getLocation().getZ());
player.teleport(loc);
}
//Settings
if (player.getGameMode() == GameMode.SPECTATOR)
player.setSpectatorTarget(null);
player.setGameMode(GameMode.SURVIVAL);
player.setAllowFlight(false);
player.setFlying(false);
((CraftPlayer)player).getHandle().spectating = false;
((CraftPlayer)player).getHandle().k = true;
//Items
player.getInventory().remove(Material.WATCH);
player.getInventory().remove(Material.COMPASS);
//Clean Armor
cleanColorArmor(player);
//Inform
UtilPlayer.message(player, F.main("Game", "You have been cleaned!"));
//Delayed Visibility
if (copy != null)
{
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable()
{
public void run()
{
//Remove Invis
if (IsAlive(player))
Manager.GetCondition().EndCondition(player, ConditionType.CLOAK, null);
//Remove Copy
copy.GetEntity().remove();
copy.GetHolo().stop();
copy.GetSaveMe().stop();
}
}, 4);
}
}
@EventHandler
public void updateCloneHolograms(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
for (PlayerCopyPaintball clone : _doubles.values())
{
if (clone.GetHolo().getHologramTarget() == HologramTarget.WHITELIST)
{
//Other team blacklist
clone.GetHolo().setHologramTarget(HologramTarget.BLACKLIST);
for (Player cur : GetPlayers(false))
{
if (!IsAlive(cur))
{
if (clone.GetHolo().containsPlayer(cur))
clone.GetHolo().removePlayer(cur);
}
}
clone.GetHolo().start();
}
clone.setSaveMeFlop(!clone.getSaveMeFlop());
clone.GetSaveMe().setText((clone.getSaveMeFlop() ? C.cRedB : C.cWhiteB) + "SAVE ME!");
for (Player player : GetTeam(clone.GetPlayer()).GetPlayers(false))
{
if (!IsAlive(player)) // Remove if it's not alive
{
if (clone.GetSaveMe().containsPlayer(player))
clone.GetSaveMe().removePlayer(player);
}
else
{
boolean hasPotion = UtilInv.contains(player, Material.POTION, (byte) -1, 1);
if (clone.GetSaveMe().containsPlayer(player))
{
if (!hasPotion) // No potions left
{
clone.GetSaveMe().removePlayer(player);
}
}
else if (hasPotion)
{
clone.GetSaveMe().addPlayer(player);
}
}
}
}
}
@EventHandler
public void CustomTeamGeneration(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Recruit)
return;
this.GetTeamList().get(0).SetColor(ChatColor.AQUA);
this.GetTeamList().get(0).SetName("Frost");
this.GetTeamList().get(1).SetColor(ChatColor.RED);
this.GetTeamList().get(1).SetName("Nether");
}
@EventHandler
public void onNameTag(GameStateChangeEvent event)
{
if (event.GetState() == GameState.Prepare)
for (Team team : Scoreboard.getScoreboard().getTeams())
team.setNameTagVisibility(NameTagVisibility.HIDE_FOR_OTHER_TEAMS);
}
@EventHandler(priority = EventPriority.HIGHEST)
public void colorArmor(PlayerPrepareTeleportEvent event)
{
cleanColorArmor(event.GetPlayer());
}
@EventHandler
public void healthRegen(EntityRegainHealthEvent event)
{
if (event.getRegainReason() == RegainReason.SATIATED)
event.setCancelled(true);
}
@EventHandler
public void teleport(PlayerTeleportEvent event)
{
if (event.getCause() == TeleportCause.ENDER_PEARL)
event.setCancelled(true);
}
@SuppressWarnings("deprecation")
@EventHandler
public void paint(final ProjectileHitEvent event)
{
if (IsLive() || GetState() == GameState.End)
{
if (event.getEntity() instanceof ThrownPotion)
return;
final byte color = (byte) (event.getEntity() instanceof EnderPearl || (event.getEntity() instanceof Arrow && event.getEntity().hasMetadata("color") && ChatColor.values()[event.getEntity().getMetadata("color").get(0).asInt()] == ChatColor.RED) ? 14 : 3);
event.getEntity().setVelocity(event.getEntity().getVelocity().normalize().multiply(1.2));
PacketPlayOutEntityDestroy destroy = new PacketPlayOutEntityDestroy(new int[]{event.getEntity().getEntityId()});
for (Player player : UtilServer.getPlayers())
UtilPlayer.sendPacket(player, destroy);
Manager.runSyncLater(new Runnable() // Stupid thing I have to do to make sure the arrow's location is accounted for. Stupid mojang. - Myst
{
@Override
public void run()
{
Location loc = event.getEntity().getLocation();
// loc.add(event.getEntity().getVelocity().clone().normalize().multiply(.5));
for (Block block : UtilBlock.getInRadius(loc, 1.5d).keySet())
{
if (block.getType() != Material.WOOL && block.getType() != Material.STAINED_CLAY && block.getType() != Material.HARD_CLAY)
continue;
if (block.getType() == Material.HARD_CLAY)
block.setType(Material.STAINED_CLAY);
block.setData(color);
}
if (color == 3) loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 8);
else loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 10);
event.getEntity().remove();
}
}, 0);
}
}
@EventHandler
public void onQuit(PlayerQuitEvent event)
{
Player player = event.getPlayer();
if (_doubles.containsKey(player))
{
PlayerCopyPaintball copy = _doubles.remove(player);
copy.GetEntity().remove();
copy.GetHolo().stop();
copy.GetSaveMe().stop();
}
}
@EventHandler
public void damageCancel(CustomDamageEvent event)
{
if (event.GetDamageePlayer() == null)
event.SetCancelled("Not Player");
// Fixed void damage being blocked from this check.
if (event.GetProjectile() == null && event.GetCause() != DamageCause.VOID)
event.SetCancelled("No Projectile");
}
@EventHandler(priority = EventPriority.LOW)
public void paintballDamage(CustomDamageEvent event)
{
if (!IsLive())
return;
if (event.GetProjectile() == null)
return;
if (!(event.GetProjectile() instanceof Snowball) && !(event.GetProjectile() instanceof EnderPearl) && !(event.GetProjectile() instanceof Arrow))
return;
//Negate
event.AddMod("Negate", "Negate", -event.GetDamageInitial(), false);
event.AddMod("Paintball", "Paintball", 2, true);
event.AddKnockback("Paintball", 2);
event.setShowArrows(false);
Player damagee = event.GetDamageePlayer();
if (damagee == null)
return;
Player damager = event.GetDamagerPlayer(true);
if (damager == null)
return;
GameTeam damageeTeam = GetTeam(damagee);
if (damageeTeam == null)
return;
GameTeam damagerTeam = GetTeam(damager);
if (damagerTeam == null)
return;
if (damagerTeam.equals(damageeTeam))
return;
//Count
int count = 1;
if (GetKit(damager) != null)
{
if (GetKit(damager) instanceof KitRifle)
{
count = 3;
}
if (GetKit(damager) instanceof KitSniper && event.GetProjectile() instanceof Arrow)
{
count = ((KitSniper) GetKit(damager)).getPaintDamage((Arrow) event.GetProjectile());
if (count == -1)
count = 1;
}
}
//Out
if (color(damagee, count))
{
for (Player player : UtilServer.getPlayers())
UtilPlayer.message(player, damageeTeam.GetColor() + damagee.getName() + ChatColor.RESET + " was painted by " +
damagerTeam.GetColor() + damager.getName() + ChatColor.RESET + "!");
playerOut(damagee, damager);
AddGems(damager, 2, "Kills", true, true);
AddStat(damager, "Kills", 1, false, false);
AddStat(damagee, "Deaths", 1, false, false);
Bukkit.getPluginManager().callEvent(new PaintballEvent(damagee, damager));
}
//Hit Sound
Player player = event.GetDamagerPlayer(true);
if (player != null)
player.playSound(player.getLocation(), Sound.ORB_PICKUP, 1f, 3f);
}
@EventHandler
public void armorRemoveCancel(InventoryClickEvent event)
{
if (IsLive())
event.setCancelled(true);
}
public boolean color(Player player, int amount)
{
//Get Non-Coloured
ArrayList<ItemStack> nonColored = new ArrayList<ItemStack>();
for (ItemStack stack : player.getInventory().getArmorContents())
{
if (!(stack.getItemMeta() instanceof LeatherArmorMeta))
continue;
LeatherArmorMeta meta = (LeatherArmorMeta)stack.getItemMeta();
if (meta.getColor().equals(Color.RED) || meta.getColor().equals(Color.AQUA))
nonColored.add(stack);
}
//Color Piece
for (int i=0 ; i<amount ; i++)
{
if (nonColored.isEmpty())
break;
ItemStack armor = nonColored.remove(UtilMath.r(nonColored.size()));
LeatherArmorMeta meta = (LeatherArmorMeta)armor.getItemMeta();
meta.setColor(Color.PURPLE);
armor.setItemMeta(meta);
}
player.setHealth(Math.min(20, Math.max(2, nonColored.size() * 5 + 1)));
return nonColored.isEmpty();
}
public void playerOut(Player player, Player killer)
{
//State
SetPlayerState(player, PlayerState.OUT);
player.setHealth(20);
//Conditions
Manager.GetCondition().Factory().Blind("Hit", player, player, 1.5, 0, false, false, false);
Manager.GetCondition().Factory().Cloak("Hit", player, player, 9999, false, false);
_doubles.put(player, new PlayerCopyPaintball(this, player, killer, GetTeam(player).GetColor()));
//Settings
player.setAllowFlight(true);
player.setFlying(true);
((CraftPlayer)player).getHandle().spectating = true;
((CraftPlayer)player).getHandle().k = false;
UtilAction.velocity(player, new Vector(0,1.2,0));
}
@Override
public void restartRound()
{
super.restartRound();
Iterator<PlayerCopyPaintball> copyIterator = _doubles.values().iterator();
while (copyIterator.hasNext())
{
PlayerCopyPaintball copy = copyIterator.next();
copy.GetEntity().remove();
copy.GetHolo().stop();
copy.GetSaveMe().stop();
copyIterator.remove();
}
}
@Override
public String GetMode()
{
return "Super Paintstrike";
}
}

View File

@ -0,0 +1,81 @@
package nautilus.game.arcade.game.games.quiver.modes;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
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.game.games.quiver.Quiver;
import nautilus.game.arcade.game.games.quiver.QuiverTeamBase;
import nautilus.game.arcade.game.games.quiver.kits.KitBarrage;
import nautilus.game.arcade.game.games.quiver.kits.KitBeserker;
import nautilus.game.arcade.game.games.quiver.kits.KitNecromancer;
import nautilus.game.arcade.game.games.quiver.kits.KitNewNinja;
import nautilus.game.arcade.game.games.quiver.kits.KitPyromancer;
import nautilus.game.arcade.game.games.quiver.kits.KitSkyWarrior;
import nautilus.game.arcade.game.games.quiver.modes.module.ModuleStandaloneUltimate;
import nautilus.game.arcade.kit.Kit;
/**
* UltimateOITQ is a mode of {@link Quiver} which implements the ultimate kits from {@link QuiverTeamBase}
*
* @author xXVevzZXx
*/
public class UltimateOITQ extends Quiver
{
public UltimateOITQ(ArcadeManager manager)
{
super(manager, new Kit[]
{
new KitBeserker(manager),
new KitNewNinja(manager),
new KitBarrage(manager),
new KitSkyWarrior(manager),
new KitPyromancer(manager),
new KitNecromancer(manager)
}, GameType.Brawl);
registerModule(new ModuleStandaloneUltimate(30F));
}
@EventHandler
public void clearArmor(UpdateEvent event)
{
if (!IsLive())
return;
if (Manager.GetGame() == null)
return;
if (event.getType() != UpdateType.FASTER)
return;
for (Player player : GetPlayers(true))
{
if (player.getInventory().getBoots() != null && player.getInventory().getBoots().getType() == Material.LEATHER_BOOTS)
player.getInventory().setBoots(null);
if (player.getInventory().getLeggings() != null && player.getInventory().getLeggings().getType() == Material.LEATHER_LEGGINGS)
player.getInventory().setLeggings(null);
if (player.getInventory().getChestplate() != null && player.getInventory().getChestplate().getType() == Material.LEATHER_CHESTPLATE)
player.getInventory().setChestplate(null);
if (player.getInventory().getHelmet() != null && player.getInventory().getHelmet().getType() == Material.LEATHER_HELMET)
player.getInventory().setHelmet(null);
}
}
@Override
public String GetMode()
{
return "Ultimate OITQ";
}
}

View File

@ -0,0 +1,247 @@
package nautilus.game.arcade.game.games.quiver.modes.module;
import java.text.DecimalFormat;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerToggleSneakEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextBottom;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.CombatComponent;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import nautilus.game.arcade.game.games.quiver.QuiverTeamBase;
import nautilus.game.arcade.game.games.quiver.module.ModuleUltimate;
import nautilus.game.arcade.game.games.quiver.ultimates.UltimatePerk;
import nautilus.game.arcade.game.modules.Module;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
/**
* Stanalone version of the QuiverTeamBase Module {@link ModuleUltimate}
* This needed to be done because the {@link QuiverTeamBase} Module
* is made for QuiverTeamBase only
*
* @author xXVevzZXx
*/
public class ModuleStandaloneUltimate extends Module
{
private static final int ULTIMATE_PERCENTAGE_INCREASE_KILL = 5;
private static final int ULTIMATE_PERCENTAGE_INCREASE_ASSIST = 2;
private float _percentage;
private Map<UUID, Float> _ultimatePercentage = new HashMap<>();
private boolean _colouredMessage;
public ModuleStandaloneUltimate(float percentage)
{
_percentage = percentage;
}
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
{
return;
}
_colouredMessage = !_colouredMessage;
for (Player player : getGame().GetPlayers(true))
{
Kit kit = getGame().GetKit(player);
if (kit == null || UtilPlayer.isSpectator(player))
{
continue;
}
if (!_ultimatePercentage.containsKey(player.getUniqueId()))
{
_ultimatePercentage.put(player.getUniqueId(), 0F);
}
double percentage = _ultimatePercentage.get(player.getUniqueId());
if (percentage >= _percentage)
{
UtilTextBottom.display((_colouredMessage ? C.cWhiteB : C.cAquaB) + "ULTIMATE READY (PRESS SNEAK)", player);
player.setExp(0.999F);
player.setLevel(100);
continue;
}
String percentageFormatted = new DecimalFormat("0.0").format(percentage/_percentage*100);
UtilTextBottom.displayProgress("Ultimate", percentage / _percentage, percentageFormatted + "%", player);
player.setExp((float) percentage / _percentage);
player.setLevel((int) Math.round(percentage/_percentage*100));
for (Perk perk : kit.GetPerks())
{
if (perk instanceof UltimatePerk)
{
UltimatePerk ultimate = (UltimatePerk) perk;
if (ultimate.isUsingUltimate(player))
{
continue;
}
incrementUltimate(player, ultimate.getChargePassive());
}
}
}
}
@EventHandler
public void onCombatDeath(CombatDeathEvent event)
{
if (event.GetEvent().getEntity() == null || event.GetLog().GetKiller() == null)
{
return;
}
if (!(event.GetEvent().getEntity() instanceof Player))
{
return;
}
Player player = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
if (player == null)
{
return;
}
incrementUltimate(player, ULTIMATE_PERCENTAGE_INCREASE_KILL);
for (CombatComponent combatComponent : event.GetLog().GetAttackers())
{
if (event.GetLog().GetKiller() != null && combatComponent.equals(event.GetLog().GetKiller()))
{
continue;
}
if (combatComponent.IsPlayer())
{
Player assitedPlayer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
if (assitedPlayer != null)
{
incrementUltimate(assitedPlayer, ULTIMATE_PERCENTAGE_INCREASE_ASSIST);
}
}
}
}
public void incrementUltimate(Player player, float percentage)
{
ProgressingKit kit = (ProgressingKit) getGame().GetKit(player);
for (Perk perk : kit.getPerks()[kit.getUpgradeLevel(player.getUniqueId())])
{
if (perk instanceof UltimatePerk)
{
UltimatePerk ultimate = (UltimatePerk) perk;
if (ultimate.isUsingUltimate(player))
{
return;
}
}
}
_ultimatePercentage.put(player.getUniqueId(), _ultimatePercentage.get(player.getUniqueId()) + percentage);
}
public void resetUltimate(Player player, boolean inform)
{
if (inform)
{
player.sendMessage(F.main("Game", "Your Ultimate charge has been reset!"));
}
_ultimatePercentage.put(player.getUniqueId(), 0F);
}
@EventHandler
public void onPlayerToggleSneak(PlayerToggleSneakEvent event)
{
if (!getGame().IsLive())
{
return;
}
Player player = event.getPlayer();
ProgressingKit kit = (ProgressingKit) getGame().GetKit(player);
if (!event.isSneaking())
{
return;
}
if (kit == null || UtilPlayer.isSpectator(player))
{
return;
}
if (_ultimatePercentage.get(player.getUniqueId()) < _percentage)
{
return;
}
for (Perk perk : kit.getPerks()[kit.getUpgradeLevel(player.getUniqueId())])
{
if (perk instanceof UltimatePerk)
{
UltimatePerk ultimate = (UltimatePerk) perk;
if (ultimate.isUsable(player))
{
ultimate.activate(player);
resetUltimate(player, false);
}
}
}
}
@Override
public void cleanup()
{
UtilServer.Unregister(this);
for (UUID uuid : _ultimatePercentage.keySet())
{
Player player = UtilPlayer.searchExact(uuid);
for (Perk perk : getGame().GetKit(player).GetPerks())
{
if (!(perk instanceof UltimatePerk))
{
continue;
}
UltimatePerk ultimate = (UltimatePerk) perk;
if (ultimate.isUsingUltimate(player))
{
ultimate.cancel(player);
}
}
}
}
}

View File

@ -1,5 +1,6 @@
package nautilus.game.arcade.game.games.quiver.ultimates;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
@ -122,7 +123,13 @@ public class UltimateNecromancer extends UltimatePerk
entities.add(livingEntity);
UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, livingEntity.getEyeLocation(), 1F, 1F, 1F, 0.1F, 20, ViewDist.NORMAL);
((Creature) livingEntity).setTarget(UtilPlayer.getClosest(livingEntity.getLocation(), Manager.GetGame().GetTeam(player).GetPlayers(true)));
ArrayList<Player> players = Manager.GetGame().GetTeam(player).GetPlayers(true);
if (Manager.GetGame().GetTeamList().size() == 1)
{
players.clear();
players.add(player);
}
((Creature) livingEntity).setTarget(UtilPlayer.getClosest(livingEntity.getLocation(), players));
}
Manager.GetGame().CreatureAllowOverride = false;

View File

@ -4,16 +4,15 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import mineplex.core.common.Pair;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.Effect;
import org.bukkit.FireworkEffect;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
@ -22,37 +21,41 @@ import org.bukkit.entity.Sheep;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerItemHeldEvent;
import mineplex.core.common.Pair;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTextTop;
import mineplex.core.common.util.UtilTime;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerGameRespawnEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.games.sheep.kits.*;
import nautilus.game.arcade.game.games.sheep.kits.KitArcher;
import nautilus.game.arcade.game.games.sheep.kits.KitBeserker;
import nautilus.game.arcade.game.games.sheep.kits.KitBrute;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.managers.chat.ChatStatData;
import nautilus.game.arcade.stats.SheepDropStatTracker;
@ -149,6 +152,16 @@ public class SheepGame extends TeamGame
);
}
public SheepGame(ArcadeManager manager, GameType type)
{
this(manager, new Kit[]
{
new KitBeserker(manager),
new KitArcher(manager),
new KitBrute(manager)
}, type);
}
public SheepGame(ArcadeManager manager, Kit[] kits, GameType type)
{
super(manager, type, kits,
@ -752,6 +765,11 @@ public class SheepGame extends TeamGame
{
event.SetCancelled("True");
}*/
public void setSheepDelay(long delay)
{
_sheepDelay = delay;
}
public int getSheepCount(GameTeam team)
{
@ -765,4 +783,19 @@ public class SheepGame extends TeamGame
return score;
}
public HashMap<GameTeam, ArrayList<Block>> getSheepPens()
{
return _sheepPens;
}
public long getGameTime()
{
return _gameTime;
}
public HashMap<GameTeam, Integer> getTeamScores()
{
return _teamScore;
}
}

View File

@ -0,0 +1,77 @@
package nautilus.game.arcade.game.games.sheep.modes;
import org.bukkit.event.EventHandler;
import mineplex.core.common.Pair;
import mineplex.core.common.util.C;
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.games.sheep.SheepGame;
/**
* SheepMania is a mode of {@link SheepGame} in which only one Sheep will spawn
*
* @author xXVevzZXx
*/
public class SheepMania extends SheepGame
{
public SheepMania(ArcadeManager manager)
{
super(manager, GameType.Brawl);
setSheepDelay(GameTimeout);
}
@Override
@EventHandler
public void ScoreboardUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
if (!InProgress())
return;
Scoreboard.reset();
Scoreboard.writeNewLine();
Scoreboard.writeGroup(getSheepPens().keySet(), team ->
{
getTeamScores().put(team, getSheepCount(team));
return Pair.create(team.GetColor() + team.GetName(), getSheepCount(team));
}, true);
if (!IsLive())
return;
long time = getGameTime()
- (System.currentTimeMillis() - this.GetStateTime());
Scoreboard.writeNewLine();
Scoreboard.write(C.cYellow + C.Bold + "Time Left");
Scoreboard.write(UtilTime.MakeStr(Math.max(0, time), 0));
Scoreboard.draw();
}
@Override
@EventHandler
public void SheepSpawnStart(GameStateChangeEvent event)
{
if (event.GetState() == GameState.Live)
SheepSpawn();
}
@Override
public String GetMode()
{
return "Sheep Mania";
}
}

View File

@ -73,6 +73,7 @@ import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.CombatComponent;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
@ -85,6 +86,7 @@ import nautilus.game.arcade.game.games.skywars.kits.KitEarth;
import nautilus.game.arcade.game.games.skywars.kits.KitFire;
import nautilus.game.arcade.game.games.skywars.kits.KitIce;
import nautilus.game.arcade.game.games.skywars.kits.KitMetal;
import nautilus.game.arcade.game.games.skywars.modes.kits.KitElementalist;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.ore.OreHider;
@ -519,7 +521,7 @@ public abstract class Skywars extends Game
for (Player player : GetPlayers(true))
{
if (GetKit(player) instanceof KitAir)
if (GetKit(player) instanceof KitAir || GetKit(player) instanceof KitElementalist)
{
player.sendMessage(F.main("Game", "Your " + F.skill("Leap") + " is on a 30 second cooldown."));
Recharge.Instance.use(player, "Leap", 30000, true, false);

View File

@ -0,0 +1,29 @@
package nautilus.game.arcade.game.games.skywars.modes;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.games.skywars.Skywars;
import nautilus.game.arcade.game.games.skywars.SoloSkywars;
import nautilus.game.arcade.game.games.skywars.modes.kits.KitElementalist;
import nautilus.game.arcade.kit.Kit;
/**
* Elementalist is a mode of {@link Skywars} which combines all kits to one
*
* @author xXVevzZXx
*/
public class Elementalist extends SoloSkywars
{
public Elementalist(ArcadeManager manager)
{
super(manager, new Kit[]{new KitElementalist(manager)}, GameType.Brawl);
}
@Override
public String GetMode()
{
return "Elementalist";
}
}

View File

@ -0,0 +1,72 @@
package nautilus.game.arcade.game.games.skywars.modes.kits;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.skywars.Skywars;
import nautilus.game.arcade.game.games.skywars.modes.Elementalist;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
import nautilus.game.arcade.kit.perks.PerkDirtCannon;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
import nautilus.game.arcade.kit.perks.PerkFireBurst;
import nautilus.game.arcade.kit.perks.PerkIceBridge;
import nautilus.game.arcade.kit.perks.PerkKnockback;
import nautilus.game.arcade.kit.perks.PerkMagnetism;
import nautilus.game.arcade.kit.perks.PerkVoidSaver;
/**
* KitElementalist is a kit for the Brawl mode {@link Elementalist} which combines all {@link Skywars} kits
*
* @author xXVevzZXx
*/
public class KitElementalist extends ProgressingKit
{
private static final String DOUBLE_JUMP = "Leap";
private static final String[] DESCRIPTION = {
"You have the power of a true Elementalist which can",
"use all sorts of Elements for their own use"
};
private static final Perk[] PERKS =
{
new PerkVoidSaver(),
new PerkDoubleJump(DOUBLE_JUMP, 1.2, 1, true, 27000, true),
new PerkDirtCannon(1.5),
new PerkKnockback(0.75, true),
new PerkFireBurst(35000, 4, 6),
new PerkIceBridge(25000, 6000),
//new PerkMagnetism(15000, 10, 1.5)
};
private static final ItemStack[] PLAYER_ITEMS =
{
new ItemStack(Material.WOOD_SWORD), new ItemBuilder(Material.EYE_OF_ENDER).setTitle(C.cGreen + "Eye of Ender").build(),
//new ItemStack(Material.WOOD_SPADE),
new ItemBuilder(Material.BLAZE_ROD).setTitle(C.cGreen + "Fire Burst").build(),
new ItemBuilder(Material.ICE).setTitle(C.cGreen + "Ice Bridge").build(),
};
private static final ItemStack IN_HAND = new ItemStack(Material.EYE_OF_ENDER);
public KitElementalist(ArcadeManager manager)
{
super(manager, "Avatar", "avatar", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.SKELETON, IN_HAND);
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(PLAYER_ITEMS);
}
}

View File

@ -26,13 +26,17 @@ import org.bukkit.event.player.PlayerInteractEvent;
public class PerkApple extends Perk implements IThrown
{
public PerkApple()
private long _spawnDelay;
public PerkApple(long delay)
{
super("Apple Thrower", new String[]
{
C.cGray + "Receive 1 Apple every 10 seconds",
C.cYellow + "Left-Click" + C.cGray + " with Apple to " + C.cGreen + "Throw Apple",
});
_spawnDelay = delay;
}
@EventHandler
@ -52,7 +56,7 @@ public class PerkApple extends Perk implements IThrown
if (!Manager.GetGame().IsAlive(player))
continue;
if (!Recharge.Instance.use(player, getMessage(player), 10000, false, false))
if (!Recharge.Instance.use(player, getMessage(player), _spawnDelay, false, false))
continue;
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(getMaterial(player)));