implement Dukes of decoration, OP Gladiators, Countdown, Heroes of the ewe, OP Skywars, Ultra spleef, Assassins and Blood diamonds

This commit is contained in:
xXVevzZXx 2016-05-02 01:06:00 +02:00
parent 6c2caac800
commit 71f8640189
18 changed files with 972 additions and 41 deletions

View File

@ -1388,6 +1388,19 @@ public class ArcadeManager extends MiniPlugin implements IRelation
});
}
public void enableChampionsModules()
{
_classManager.setEnabled(true);
_classShopManager.registerSelf();
_skillFactory.registerSelf();
_itemFactory.registerSelf();
_energy.registerSelf();
_eloManager.registerSelf();
//Class Shop
_plugin.getServer().getPluginManager().registerEvents(_classShop, _plugin);
}
public void toggleChampionsModules(GameType gameType)
{
boolean isChamps = gameType == GameType.ChampionsDominate || gameType == GameType.ChampionsTDM || gameType == GameType.ChampionsCTF || gameType == GameType.BossBattles;
@ -1403,15 +1416,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
if (_enabled)
{
_classManager.setEnabled(true);
_classShopManager.registerSelf();
_skillFactory.registerSelf();
_itemFactory.registerSelf();
_energy.registerSelf();
_eloManager.registerSelf();
//Class Shop
_plugin.getServer().getPluginManager().registerEvents(_classShop, _plugin);
enableChampionsModules();
}
else
{

View File

@ -15,6 +15,7 @@ import nautilus.game.arcade.game.games.bridge.Bridge;
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;
import nautilus.game.arcade.game.games.build.modes.DukesOfDecoration;
import nautilus.game.arcade.game.games.build.modes.TeamBuild;
import nautilus.game.arcade.game.games.cards.Cards;
import nautilus.game.arcade.game.games.castlesiege.CastleSiege;
@ -32,9 +33,11 @@ import nautilus.game.arcade.game.games.draw.Draw;
import nautilus.game.arcade.game.games.event.EventGame;
import nautilus.game.arcade.game.games.evolution.Evolution;
import nautilus.game.arcade.game.games.gladiators.Gladiators;
import nautilus.game.arcade.game.games.gladiators.modes.OverpoweredGladiators;
import nautilus.game.arcade.game.games.gravity.Gravity;
import nautilus.game.arcade.game.games.halloween.Halloween;
import nautilus.game.arcade.game.games.hideseek.HideSeek;
import nautilus.game.arcade.game.games.hideseek.modes.Countdown;
import nautilus.game.arcade.game.games.holeinwall.HoleInTheWall;
import nautilus.game.arcade.game.games.horsecharge.Horse;
import nautilus.game.arcade.game.games.lobbers.BombLobbers;
@ -55,8 +58,10 @@ import nautilus.game.arcade.game.games.runner.Runner;
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.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.smash.SoloSuperSmash;
import nautilus.game.arcade.game.games.smash.SuperSmashDominate;
import nautilus.game.arcade.game.games.smash.TeamSuperSmash;
@ -66,6 +71,7 @@ import nautilus.game.arcade.game.games.snowfight.SnowFight;
import nautilus.game.arcade.game.games.speedbuilders.SpeedBuilders;
import nautilus.game.arcade.game.games.spleef.Spleef;
import nautilus.game.arcade.game.games.spleef.SpleefTeams;
import nautilus.game.arcade.game.games.spleef.modes.UltraSpleef;
import nautilus.game.arcade.game.games.squidshooter.SquidShooter;
import nautilus.game.arcade.game.games.stacker.Stacker;
import nautilus.game.arcade.game.games.survivalgames.SoloSurvivalGames;
@ -75,7 +81,10 @@ import nautilus.game.arcade.game.games.tug.Tug;
import nautilus.game.arcade.game.games.turfforts.TurfForts;
import nautilus.game.arcade.game.games.typewars.TypeWars;
import nautilus.game.arcade.game.games.uhc.UHC;
import nautilus.game.arcade.game.games.uhc.modes.Assassins;
import nautilus.game.arcade.game.games.uhc.modes.BloodDiamonds;
import nautilus.game.arcade.game.games.uhc.modes.CutClean ;
import nautilus.game.arcade.game.games.uhc.modes.GodBattles;
import nautilus.game.arcade.game.games.valentines.Valentines;
import nautilus.game.arcade.game.games.wither.WitherGame;
import nautilus.game.arcade.game.games.wizards.Wizards;
@ -113,7 +122,7 @@ public enum GameType
{
Pair.create(MinecraftVersion.ALL, "http://file.mineplex.com/ResHalloween.zip")
}, true),
HideSeek(HideSeek.class, GameDisplay.HideSeek),
HideSeek(HideSeek.class, new GameMode[]{new GameMode(Countdown.class, "Countdown")}, GameDisplay.HideSeek),
HoleInTheWall(HoleInTheWall.class, GameDisplay.HoleInTheWall),
Horse(Horse.class, GameDisplay.Horse),
Lobbers(BombLobbers.class, GameDisplay.Lobbers),
@ -131,7 +140,7 @@ public enum GameType
QuiverTeams(QuiverTeams.class, GameDisplay.QuiverTeams),
Runner(Runner.class, new GameMode[]{new GameMode(FasterThanLight.class, "Gotta Go Fast")}, GameDisplay.Runner),
SearchAndDestroy(SearchAndDestroy.class, GameDisplay.SearchAndDestroy),
Sheep(SheepGame.class, GameDisplay.Sheep),
Sheep(SheepGame.class, new GameMode[]{new GameMode(EweHeroes.class, "Heroes Of The Ewe")}, GameDisplay.Sheep),
TypeWars(TypeWars.class, GameDisplay.TypeWars),
Smash(SoloSuperSmash.class, GameDisplay.Smash),
@ -141,7 +150,7 @@ public enum GameType
SneakyAssassins(SneakyAssassins.class, GameDisplay.SneakyAssassins),
SnowFight(SnowFight.class, GameDisplay.SnowFight),
SpeedBuilders(SpeedBuilders.class, GameDisplay.SpeedBuilders),
Spleef(Spleef.class, GameDisplay.Spleef),
Spleef(Spleef.class, new GameMode[]{new GameMode(UltraSpleef.class, "Ultra Spleef")}, GameDisplay.Spleef),
SpleefTeams(SpleefTeams.class, GameDisplay.SpleefTeams),
SquidShooter(SquidShooter.class, GameDisplay.SquidShooter),
Stacker(Stacker.class, GameDisplay.Stacker),
@ -149,20 +158,20 @@ public enum GameType
SurvivalGamesTeams(TeamSurvivalGames.class, GameDisplay.SurvivalGamesTeams, new GameType[]{GameType.SurvivalGames}, false),
Tug(Tug.class, GameDisplay.Tug),
TurfWars(TurfForts.class, GameDisplay.TurfWars),
UHC(UHC.class, new GameMode[]{new GameMode(CutClean.class, "Cut Clean")}, GameDisplay.UHC),
UHC(UHC.class, new GameMode[]{new GameMode(CutClean.class, "Cut Clean"), new GameMode(GodBattles.class, "God Battles"), new GameMode(BloodDiamonds.class, "Blood Diamonds"), new GameMode(Assassins.class, "Assassins")}, GameDisplay.UHC),
WitherAssault(WitherGame.class, GameDisplay.WitherAssault),
Wizards(Wizards.class, GameDisplay.Wizards, new Pair[]
{
Pair.create(MinecraftVersion.ALL, "http://file.mineplex.com/ResWizards.zip")
}, true),
ZombieSurvival(ZombieSurvival.class, GameDisplay.ZombieSurvival),
Build(Build.class, new GameMode[]{new GameMode(TeamBuild.class, "Team Master Builders")}, GameDisplay.Build),
Build(Build.class, new GameMode[]{new GameMode(TeamBuild.class, "Team Master Builders"), new GameMode(DukesOfDecoration.class, "Dukes Of Decoration")}, GameDisplay.Build),
Cards(Cards.class, GameDisplay.Cards),
Skywars(SoloSkywars.class, GameDisplay.Skywars),
SkywarsTeams(TeamSkywars.class, GameDisplay.SkywarsTeams, new GameType[]{GameType.Skywars}, false),
SkywarsTeams(TeamSkywars.class, new GameMode[]{new GameMode(OverpoweredSkywars.class, "OP Skywars")}, GameDisplay.SkywarsTeams, new GameType[]{GameType.Skywars}, false),
MonsterMaze(MonsterMaze.class, GameDisplay.MonsterMaze),
MonsterLeague(MonsterLeague.class, GameDisplay.MonsterLeague),
Gladiators(Gladiators.class, GameDisplay.Gladiators),
Gladiators(Gladiators.class, new GameMode[]{new GameMode(OverpoweredGladiators.class, "OP Gladiators")}, GameDisplay.Gladiators),
BouncyBalls(BouncyBalls.class, GameDisplay.BouncyBalls),

View File

@ -0,0 +1,101 @@
package nautilus.game.arcade.game.games.build.modes;
import java.util.ArrayList;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.games.build.Build;
/**
* DukesOfDecoration
*
* @author xXVevzZXx
*/
public class DukesOfDecoration extends Build
{
private ArrayList<Material> _blocks;
public DukesOfDecoration(ArcadeManager manager)
{
super(manager);
_blocks = new ArrayList<>();
for (int i = 0; i < 22; i++)
{
Material mat = Material.values()[1 + UtilMath.r(174)];
while (_blocks.contains(mat) || mat == Material.COMMAND || mat == Material.COMMAND_MINECART)
{
mat = Material.values()[1 + UtilMath.r(174)];
}
_blocks.add(mat);
}
}
@EventHandler
public void giveBlocks(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Live)
return;
for (Player player : GetPlayers(true))
{
giveBlocks(player);
}
}
@EventHandler
public void giveBlockCommand(PlayerCommandPreprocessEvent event)
{
if (!IsPlaying(event.getPlayer()))
return;
if (!event.getMessage().equalsIgnoreCase("/giveblocks"))
return;
event.setCancelled(true);
UtilInv.Clear(event.getPlayer());
giveBlocks(event.getPlayer());
}
public void giveBlocks(Player player)
{
for (Material mat : _blocks)
{
UtilInv.insert(player, new ItemStack(mat));
}
UtilPlayer.message(player, F.main("Game", "You have been given your building blocks. If you want to get them once again type " + F.game("/giveblocks")));
}
@EventHandler
public void placeBlock(BlockPlaceEvent event)
{
if (!_blocks.contains(event.getBlockPlaced().getType()))
{
event.setCancelled(true);
UtilPlayer.message(event.getPlayer(), F.main("Game", "You can not place this Block"));
}
}
@Override
public String GetMode()
{
return "Dukes Of Decoration";
}
}

View File

@ -9,7 +9,6 @@ import org.bukkit.inventory.ItemStack;
*/
public enum ArenaType
{
RED(1, new Loadout()
{
@Override

View File

@ -357,7 +357,7 @@ public class Gladiators extends SoloGame
}
}
private void findGameArenaSet()
protected void findGameArenaSet()
{
_gameArenaSet = new ArrayList<>();
@ -753,7 +753,7 @@ public class Gladiators extends SoloGame
p.setHealth(p.getMaxHealth()); //Heal
}
private void giveLoadout(Player p, ArenaType type)
protected void giveLoadout(Player p, ArenaType type)
{
if (!GetPlayers(true).contains(p))
return;
@ -1113,4 +1113,15 @@ public class Gladiators extends SoloGame
_hotbarEditor.deregisterSelf(); // De-register as listener
_hotbarEditor.onDisable(); // Fully disable
}
public HashMap<Player, Arena> getArenas()
{
return _playerArenas;
}
public HotbarEditor getHotbarEditor()
{
return _hotbarEditor;
}
}

View File

@ -0,0 +1,92 @@
package nautilus.game.arcade.game.games.gladiators.modes;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilItem;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.gladiators.Arena;
import nautilus.game.arcade.game.games.gladiators.ArenaType;
import nautilus.game.arcade.game.games.gladiators.Gladiators;
import nautilus.game.arcade.game.games.gladiators.hotbar.HotbarLayout;
/**
* OverpoweredGladiators
*
* @author xXVevzZXx
*/
public class OverpoweredGladiators extends Gladiators
{
public OverpoweredGladiators(ArcadeManager manager)
{
super(manager);
}
@Override
protected void giveLoadout(Player p, ArenaType type)
{
if (!GetPlayers(true).contains(p))
return;
HotbarLayout layout = getHotbarEditor().getLayout(p);
int enchantMentLevel = 0;
switch(type)
{
case RED: enchantMentLevel = 4;
case ORANGE: enchantMentLevel = 3;
case YELLOW: enchantMentLevel = 2;
case GREEN: enchantMentLevel = 1;
}
p.getInventory().clear();
p.getInventory().setArmorContents(null);
p.getInventory().setItem(layout.getRod(), UtilItem.makeUnbreakable(type.getLoadout().getRod()));
p.getInventory().setItem(layout.getBow(), type.getLoadout().getBow());
p.getInventory().setItem(layout.getArrows(), type.getLoadout().getArrows());
ItemStack sword = new ItemStack(Material.DIAMOND_SWORD);
ItemStack helmet = new ItemStack(Material.DIAMOND_HELMET);
ItemStack chest = new ItemStack(Material.DIAMOND_CHESTPLATE);
ItemStack leggings = new ItemStack(Material.DIAMOND_LEGGINGS);
ItemStack boots = new ItemStack(Material.DIAMOND_BOOTS);
if(enchantMentLevel != 0)
{
sword.addEnchantment(Enchantment.DAMAGE_ALL, enchantMentLevel);
helmet.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, enchantMentLevel);
chest.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, enchantMentLevel);
leggings.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, enchantMentLevel);
boots.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, enchantMentLevel);
if(enchantMentLevel >= 4)
{
UtilInv.insert(p, new ItemStack(Material.GOLDEN_APPLE,1 , (short) 1));
}
}
p.getInventory().setItem(layout.getSword(), UtilItem.makeUnbreakable(sword));
p.getInventory().setHelmet(helmet);
p.getInventory().setChestplate(chest);
p.getInventory().setLeggings(leggings);
p.getInventory().setBoots(boots);
p.playSound(p.getLocation(), Sound.LEVEL_UP, 1f, 1f);
}
@Override
public String GetMode()
{
return "OP Gladiators";
}
}

View File

@ -1653,4 +1653,9 @@ public class HideSeek extends TeamGame
return ent.getVehicle() != null;
}
public HashMap<Player, Form> getForms()
{
return _forms;
}
}

View File

@ -0,0 +1,103 @@
package nautilus.game.arcade.game.games.hideseek.modes;
import java.util.ArrayList;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
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.events.GameStateChangeEvent;
import nautilus.game.arcade.game.games.hideseek.HideSeek;
import nautilus.game.arcade.game.games.hideseek.forms.BlockForm;
import nautilus.game.arcade.game.games.hideseek.forms.Form;
/**
* Countdown
*
* @author xXVevzZXx
*/
public class Countdown extends HideSeek
{
private int _changeInterval;
private long _lastChanged = 0;
private ArrayList<Material> _blocks;
public Countdown(ArcadeManager manager)
{
super(manager);
_changeInterval = 30;
_blocks = new ArrayList<>();
for (Material mat : Material.values())
{
_blocks.add(mat);
}
}
@EventHandler
public void gameState(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Live)
return;
_lastChanged = System.currentTimeMillis();
}
@EventHandler
public void changeForms(UpdateEvent event)
{
if (!IsLive())
return;
if (event.getType() != UpdateType.SEC)
return;
if(UtilTime.elapsed(_lastChanged, _changeInterval*1000))
{
_lastChanged = System.currentTimeMillis();
Material mat = _blocks.get(UtilMath.r(_blocks.size()));
int i = 0;
while (i < 20 && UtilBlock.isBlock(new ItemStack(mat)))
{
mat = _blocks.get(UtilMath.r(_blocks.size()));
i++;
}
if (i >= 20)
{
mat = Material.JUKEBOX;
}
for (Player player : GetPlayers(true))
{
getForms().get(player).Remove();
Form form = new BlockForm(this, player, mat);
getForms().put(player, form);
form.Apply();
Bukkit.getPluginManager().callEvent(new PlayerChangeFormEvent(player, form));
}
}
}
@Override
public String GetMode()
{
return "Countdown";
}
}

View File

@ -125,14 +125,17 @@ public class SheepGame extends TeamGame
public SheepGame(ArcadeManager manager)
{
super(manager, GameType.Sheep,
this(manager, new Kit[]
{
new KitBeserker(manager),
new KitArcher(manager),
new KitBrute(manager)
});
}
new Kit[]
{
new KitBeserker(manager),
new KitArcher(manager),
new KitBrute(manager)
},
public SheepGame(ArcadeManager manager, Kit[] kits)
{
super(manager, GameType.Sheep, kits,
new String[]
{
@ -333,8 +336,7 @@ public class SheepGame extends TeamGame
}
//Put Wool in Inventory
player.getInventory().setItem(4 + count, ItemStackFactory.Instance.CreateStack(35, ((Sheep)sheep).getColor().getWoolData()));
UtilInv.Update(player);
inventoryWool(player, count, sheep);
//Effect
sheep.getWorld().playEffect(sheep.getLocation(), Effect.STEP_SOUND, 35);
@ -351,6 +353,12 @@ public class SheepGame extends TeamGame
return true;
}
public void inventoryWool(Player player, int count, Entity sheep)
{
player.getInventory().setItem(4 + count, ItemStackFactory.Instance.CreateStack(35, ((Sheep)sheep).getColor().getWoolData()));
UtilInv.Update(player);
}
@EventHandler
public void StackPlayer(PlayerInteractEntityEvent event)
{

View File

@ -0,0 +1,82 @@
package nautilus.game.arcade.game.games.sheep.modes;
import org.bukkit.Material;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Sheep;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.UtilInv;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.champions.ChampionsFixes;
import nautilus.game.arcade.game.games.champions.kits.KitAssassin;
import nautilus.game.arcade.game.games.champions.kits.KitBrute;
import nautilus.game.arcade.game.games.champions.kits.KitKnight;
import nautilus.game.arcade.game.games.champions.kits.KitMage;
import nautilus.game.arcade.game.games.champions.kits.KitRanger;
import nautilus.game.arcade.game.games.sheep.SheepGame;
import nautilus.game.arcade.kit.Kit;
/**
* EweHeroes
*
* @author xXVevzZXx
*/
public class EweHeroes extends SheepGame
{
public EweHeroes(ArcadeManager manager)
{
super(manager,
new Kit[]
{
new KitBrute(manager),
new KitRanger(manager),
new KitKnight(manager),
new KitMage(manager),
new KitAssassin(manager),
});
Manager.GetDamage().UseSimpleWeaponDamage = false;
Manager.getCosmeticManager().setHideParticles(true);
Manager.getClassManager().GetItemFactory().getProximityManager().setProxyLimit(6);
StrictAntiHack = true;
TeamArmor = false;
new ChampionsFixes(this);
manager.enableChampionsModules();
}
@EventHandler
public void saddle(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTER)
return;
for (Player player : GetPlayers(true))
{
player.getInventory().setItem(7, new ItemStack(Material.SADDLE));
}
}
@Override
public void inventoryWool(Player player, int count, Entity sheep)
{
}
@Override
public String GetMode()
{
return "Heroes Of The Ewe";
}
}

View File

@ -1027,7 +1027,7 @@ public abstract class Skywars extends Game
}
}
private void fillChest(Player looter, Block block)
public void fillChest(Player looter, Block block)
{
_lootedBlocks.add(block.getLocation());
Chest chest = (Chest) block.getState();
@ -1122,7 +1122,7 @@ public abstract class Skywars extends Game
}
private void setupPlayerLoot()
public void setupPlayerLoot()
{
//Armor
_playerArmor.addLoot(new RandomItem(Material.LEATHER_HELMET, 20));
@ -1168,7 +1168,7 @@ public abstract class Skywars extends Game
_playerBlock.addLoot(new RandomItem(Material.WOOD, 30, 8, 16));
}
private void setupMiddleLoot()
public void setupMiddleLoot()
{
//Armor
_middleArmor.addLoot(new RandomItem(Material.GOLD_HELMET, 20));
@ -1365,4 +1365,19 @@ public abstract class Skywars extends Game
return this._crumbleTime;
}
public ArrayList<Block> getSpawnChests()
{
return _spawnChests;
}
public ArrayList<Block> getMiddleChests()
{
return _middleChests;
}
public HashSet<Location> getLooted()
{
return _lootedBlocks;
}
}

View File

@ -0,0 +1,214 @@
package nautilus.game.arcade.game.games.skywars.modes;
import java.util.HashSet;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Chest;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.UtilMath;
import mineplex.core.loot.ChestLoot;
import mineplex.core.loot.RandomItem;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.skywars.TeamSkywars;
/**
* OverpoweredSkywars
*
* @author xXVevzZXx
*/
public class OverpoweredSkywars extends TeamSkywars
{
private ChestLoot _playerArmor = new ChestLoot();
private ChestLoot _playerFood = new ChestLoot();
private ChestLoot _playerTool = new ChestLoot();
private ChestLoot _playerProjectile = new ChestLoot();
private ChestLoot _playerBlock = new ChestLoot();
private ChestLoot _middleArmor = new ChestLoot();
private ChestLoot _middleFood = new ChestLoot();
private ChestLoot _middleTool = new ChestLoot();
private ChestLoot _middleProjectile = new ChestLoot();
private ChestLoot _middleBlock = new ChestLoot();
public OverpoweredSkywars(ArcadeManager manager)
{
super(manager);
}
@Override
public void fillChest(Player looter, Block block)
{
getLooted().add(block.getLocation());
Chest chest = (Chest) block.getState();
chest.getBlockInventory().clear();
//Prevents same inventory spot being used twice
HashSet<Integer> used = new HashSet<Integer>();
//Player Island
if (getSpawnChests().contains(block))
{
//Armor
for (int i=0 ; i<1 + UtilMath.r(2) ; i++)
{
ItemStack item = _playerArmor.getLoot();
item.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1 + UtilMath.r(3));
chest.getBlockInventory().setItem(getIndex(used), item);
}
//Food
for (int i=0 ; i<1 + UtilMath.r(3) ; i++)
chest.getBlockInventory().setItem(getIndex(used), _playerFood.getLoot());
//Tool
for (int i=0 ; i<1 + UtilMath.r(2) ; i++)
chest.getBlockInventory().setItem(getIndex(used), _playerTool.getLoot());
//Projectile
for (int i=0 ; i<1 + UtilMath.r(2) ; i++)
chest.getBlockInventory().setItem(getIndex(used), _playerProjectile.getLoot());
//Block
for (int i=0 ; i<1 + UtilMath.r(2) ; i++)
chest.getBlockInventory().setItem(getIndex(used), _playerBlock.getLoot());
}
//Other
else if (getMiddleChests().contains(block))
{
//Armor
for (int i=0 ; i<1 + UtilMath.r(2) ; i++)
{
ItemStack item = _middleArmor.getLoot();
item.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1 + UtilMath.r(3));
chest.getBlockInventory().setItem(getIndex(used), item);
}
//Food
for (int i=0 ; i<1 + UtilMath.r(3) ; i++)
chest.getBlockInventory().setItem(getIndex(used), _middleFood.getLoot());
//Tool
for (int i=0 ; i<1 + UtilMath.r(2) ; i++)
chest.getBlockInventory().setItem(getIndex(used), _middleTool.getLoot());
//Projectile
for (int i=0 ; i<1 + UtilMath.r(2) ; i++)
chest.getBlockInventory().setItem(getIndex(used), _middleProjectile.getLoot());
//Block
for (int i=0 ; i<1 + UtilMath.r(2) ; i++)
chest.getBlockInventory().setItem(getIndex(used), _middleBlock.getLoot());
}
else
{
//Armor
for (int i=0 ; i<UtilMath.r(2) ; i++)
chest.getBlockInventory().setItem(getIndex(used), _middleArmor.getLoot());
//Food
for (int i=0 ; i<UtilMath.r(3) ; i++)
chest.getBlockInventory().setItem(getIndex(used), _middleFood.getLoot());
//Tool
for (int i=0 ; i<UtilMath.r(2) ; i++)
chest.getBlockInventory().setItem(getIndex(used), _middleTool.getLoot());
//Projectile
for (int i=0 ; i<UtilMath.r(2) ; i++)
chest.getBlockInventory().setItem(getIndex(used), _middleProjectile.getLoot());
//Block
for (int i=0 ; i<UtilMath.r(2) ; i++)
chest.getBlockInventory().setItem(getIndex(used), _middleBlock.getLoot());
}
}
@Override
public void setupPlayerLoot()
{
//Armor
_playerArmor.addLoot(new RandomItem(Material.DIAMOND_HELMET, 20));
_playerArmor.addLoot(new RandomItem(Material.DIAMOND_CHESTPLATE, 32));
_playerArmor.addLoot(new RandomItem(Material.DIAMOND_LEGGINGS, 28));
_playerArmor.addLoot(new RandomItem(Material.DIAMOND_BOOTS, 16));
//Food
_playerFood.addLoot(new RandomItem(Material.BAKED_POTATO, 1, 1, 4));
_playerFood.addLoot(new RandomItem(Material.COOKED_BEEF, 1, 1, 2));
_playerFood.addLoot(new RandomItem(Material.COOKED_CHICKEN, 1, 1, 2));
//Tools
_playerTool.addLoot(new RandomItem(Material.DIAMOND_SWORD, 2));
_playerTool.addLoot(new RandomItem(Material.FISHING_ROD, 2));
_playerTool.addLoot(new RandomItem(Material.DIAMOND_PICKAXE, 3));
_playerTool.addLoot(new RandomItem(Material.IRON_AXE, 1));
//Projectile
_playerProjectile.addLoot(new RandomItem(Material.ARROW, 18, 2, 8));
_playerProjectile.addLoot(new RandomItem(Material.SNOW_BALL, 60, 2, 5));
_playerProjectile.addLoot(new RandomItem(Material.EGG, 60, 2, 5));
//Block
_playerBlock.addLoot(new RandomItem(Material.COBBLESTONE, 30, 8, 16));
_playerBlock.addLoot(new RandomItem(Material.WOOD, 30, 8, 16));
}
@Override
public void setupMiddleLoot()
{
_middleArmor.addLoot(new RandomItem(Material.DIAMOND_HELMET, 5));
_middleArmor.addLoot(new RandomItem(Material.DIAMOND_CHESTPLATE, 8));
_middleArmor.addLoot(new RandomItem(Material.DIAMOND_LEGGINGS, 7));
_middleArmor.addLoot(new RandomItem(Material.DIAMOND_BOOTS, 4));
//Food
_middleFood.addLoot(new RandomItem(Material.COOKED_BEEF, 1, 1, 3));
_middleFood.addLoot(new RandomItem(Material.COOKED_CHICKEN, 1, 1, 3));
_middleFood.addLoot(new RandomItem(Material.MUSHROOM_SOUP, 1));
_middleFood.addLoot(new RandomItem(Material.GRILLED_PORK, 1, 1, 3));
//Tools
_middleTool.addLoot(new RandomItem(Material.DIAMOND_SWORD, 1));
_middleTool.addLoot(new RandomItem(Material.FISHING_ROD, 1));
//Projectile
_middleTool.addLoot(new RandomItem(Material.BOW, 1));
_middleProjectile.addLoot(new RandomItem(Material.ARROW, 2, 4, 12));
_middleProjectile.addLoot(new RandomItem(Material.ENDER_PEARL, 1, 1, 2));
//Block
_middleBlock.addLoot(new RandomItem(Material.BRICK, 30, 12, 24));
_middleBlock.addLoot(new RandomItem(Material.GLASS, 30, 12, 24));
_middleBlock.addLoot(new RandomItem(Material.SOUL_SAND, 30, 12, 24));
}
private int getIndex(HashSet<Integer> used)
{
int i = UtilMath.r(27);
while (used.contains(i))
{
i = UtilMath.r(27);
}
used.add(i);
return i;
}
@Override
public String GetMode()
{
return "OP Skywars";
}
}

View File

@ -0,0 +1,122 @@
package nautilus.game.arcade.game.games.spleef.modes;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.BlockDamageEvent;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.spleef.Spleef;
import nautilus.game.arcade.game.games.spleef.kits.KitSnowballer;
/**
* UltraSpleef
*
* @author xXVevzZXx
*/
public class UltraSpleef extends Spleef
{
public UltraSpleef(ArcadeManager manager)
{
super(manager);
}
@Override
@EventHandler(priority = EventPriority.LOW)
public void BlockDamage(BlockDamageEvent event)
{
if (!this.IsLive())
return;
if (!this.IsAlive(event.getPlayer()))
return;
event.setCancelled(true);
if (event.getBlock().getType() == Material.BEDROCK)
return;
BlockFade(event.getBlock(), event.getPlayer(), false);
for (Block block : UtilBlock.getSurrounding(event.getBlock(), false))
{
BlockFade(block, event.getPlayer(), false);
}
//Snowball
if (GetKit(event.getPlayer()) instanceof KitSnowballer && event.getBlock().getType() != Material.BEDROCK)
if (!UtilInv.contains(event.getPlayer(), Material.SNOW_BALL, (byte)0, 16))
event.getPlayer().getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.SNOW_BALL));
}
@Override
public void BlockFade(Block block, Player player, boolean slowDamage)
{
if (block.getType() == Material.BEDROCK || block.getType() == Material.LAVA || block.getType() == Material.STATIONARY_LAVA)
return;
//Prevent Super Hunger from Bow
if (Recharge.Instance.use(player, GetName() + " Hunger", 50, false, false))
UtilPlayer.hunger(player, 1);
if (!slowDamage)
{
Break(block, player);
return;
}
//Wool and Stained Clay
if (block.getTypeId() == 35 || block.getTypeId() == 159)
{
//Greens
if (block.getData() == 5 || block.getData() == 13)
block.setData((byte)14);
else
Break(block, player);
}
//Stone Brick
else if (block.getTypeId() == 98)
{
Break(block, player);
}
//Grass
else if (block.getTypeId() == 2)
{
Break(block, player);
}
//Wood Planks
else if (block.getTypeId() == 5)
{
if (block.getData() == 1)
block.setData((byte)0);
else
Break(block, player);
}
//Other
else if (block.getTypeId() != 7)
{
Break(block, player);
}
}
@Override
public String GetMode()
{
return "Ultra Spleef";
}
}

View File

@ -0,0 +1,118 @@
package nautilus.game.arcade.game.games.uhc.modes;
import java.util.HashMap;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.PlayerDeathEvent;
import mineplex.core.common.util.F;
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.ArcadeManager;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.games.uhc.UHC;
/**
* Assassins
*
* @author xXVevzZXx
*/
public class Assassins extends UHC
{
private HashMap<Player, Player> _assassins;
public Assassins(ArcadeManager manager)
{
super(manager);
}
@EventHandler
public void setTargets(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Live)
return;
for (Player player : GetPlayers(true))
{
for (Player other : GetPlayers(true))
{
if (GetTeam(player) == GetTeam(other))
continue;
if (_assassins.containsValue(other))
continue;
_assassins.put(player, other);
UtilPlayer.message(player, F.main("Game", "Your target is " + F.game(other.getName()) + ". If you kill another Player no loot will drop."));
}
}
for (Player player : GetPlayers(true))
{
if (!_assassins.containsKey(player))
{
getNewTarget(player);
}
}
}
@EventHandler
public void killPlayer(PlayerDeathEvent event)
{
Player player = event.getEntity();
for (Player other : _assassins.keySet())
{
if (_assassins.get(other) == player)
{
UtilPlayer.message(other, F.main("Game", "Your target has died."));
Player newTarget = _assassins.get(player);
if (GetTeam(newTarget) != GetTeam(other))
{
_assassins.put(other, newTarget);
}
else
{
getNewTarget(other);
}
}
}
if (event.getEntity().getKiller() instanceof Player)
{
Player killer = event.getEntity().getKiller();
if (_assassins.get(killer) != event.getEntity())
{
event.getDrops().clear();
event.setDroppedExp(0);
}
}
}
public void getNewTarget(Player player)
{
Player other = GetPlayers(true).get(UtilMath.r(GetPlayers(true).size()));
while (other == player || GetTeam(player) == GetTeam(other))
{
other = GetPlayers(true).get(UtilMath.r(GetPlayers(true).size()));
}
_assassins.put(player, other);
UtilPlayer.message(player, F.main("Game", "Your target is " + F.game(other.getName()) + ". If you kill another Player no loot will drop."));
UtilInv.insert(player, ItemStackFactory.Instance.CreateStack(Material.PAPER, (byte) 0, 1, "Your target is: " + F.game(other.getName())));
}
@Override
public String GetMode()
{
return "Assassins";
}
}

View File

@ -0,0 +1,48 @@
package nautilus.game.arcade.game.games.uhc.modes;
import java.util.HashMap;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.BlockBreakEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.uhc.UHC;
/**
* BloodDiamonds
*
* @author xXVevzZXx
*/
public class BloodDiamonds extends UHC
{
private HashMap<Material, Double> _oreDamage;
public BloodDiamonds(ArcadeManager manager)
{
super(manager);
_oreDamage = new HashMap<>();
_oreDamage.put(Material.DIAMOND_ORE, 1D);
}
@EventHandler
public void damageOres(BlockBreakEvent event)
{
for (Material mat : _oreDamage.keySet())
{
if (event.getBlock().getType() == mat)
{
event.getPlayer().damage(_oreDamage.get(mat));
}
}
}
@Override
public String GetMode()
{
return "Blood Diamonds";
}
}

View File

@ -39,7 +39,7 @@ public class GodBattles extends UHC
}
@EventHandler
public void smeltOres(BlockBreakEvent event)
public void blockOres(BlockBreakEvent event)
{
for (Material mat : _oreDrops.keySet())
{

View File

@ -313,13 +313,12 @@ public class GameCreationManager implements Listener
private void modifyGameConfiguration(Class<? extends Game> gameClass, GameMode mode, Game game)
{
ArrayList<Class<? extends Game>> classes = new ArrayList<>();
classes.add(gameClass);
classes.add((Class<? extends Game>) gameClass.getSuperclass());
if (gameClass.getSuperclass() != Game.class)
Class<? extends Game> superClass = gameClass;
while(superClass != Game.class)
{
Class<? extends Game> gameType = (Class<? extends Game>) gameClass.getSuperclass();
classes.add((Class<? extends Game>) gameType.getSuperclass());
classes.add(superClass);
superClass = (Class<? extends Game>) superClass.getSuperclass();
}
HashMap<String, String> varSet = Manager.GetServerConfig().GameModeMods.get(mode.getName());