This commit is contained in:
Sam 2018-07-22 01:02:40 +01:00 committed by Alexander Meech
parent 662087a0b3
commit ba665dd463
14 changed files with 386 additions and 38 deletions

View File

@ -110,8 +110,8 @@ public enum GameDisplay
BattleRoyale("Battle Royale", Material.DIAMOND_SWORD, (byte)0, GameCategory.EVENT, 72, false),
CakeWars4("Cake Wars Standard", Material.CAKE, (byte)0, GameCategory.INTERMEDIATE, 73, true),
CakeWarsDuos("Cake Wars Duos", Material.SUGAR, (byte)0, GameCategory.INTERMEDIATE, 74, false),
CakeWars4("Cake Wars Standard", "Cake Wars", Material.CAKE, (byte)0, GameCategory.INTERMEDIATE, 73, true),
CakeWarsDuos("Cake Wars Duos", "Cake Wars", Material.SUGAR, (byte)0, GameCategory.INTERMEDIATE, 74, false),
GemHunters("Gem Hunters", Material.EMERALD, (byte) 0, GameCategory.EVENT, 71, false),

View File

@ -74,6 +74,8 @@ import nautilus.game.arcade.game.games.spleef.Spleef;
import nautilus.game.arcade.game.games.squidshooters.SquidShooters;
import nautilus.game.arcade.game.games.survivalgames.SurvivalGamesNewSolo;
import nautilus.game.arcade.game.games.survivalgames.SurvivalGamesNewTeams;
import nautilus.game.arcade.game.games.survivalgames.modes.OverpoweredSGSolo;
import nautilus.game.arcade.game.games.survivalgames.modes.OverpoweredSGTeams;
import nautilus.game.arcade.game.games.tug.TugOfWool;
import nautilus.game.arcade.game.games.turfforts.TurfForts;
import nautilus.game.arcade.game.games.typewars.TypeWars;
@ -169,8 +171,14 @@ public enum GameType implements Voteable
SnowFight(SnowFight.class, GameDisplay.SnowFight),
SpeedBuilders(SpeedBuilders.class, GameDisplay.SpeedBuilders),
Spleef(Spleef.class, GameDisplay.Spleef),
SurvivalGames(SurvivalGamesNewSolo.class, GameDisplay.SurvivalGames),
SurvivalGamesTeams(SurvivalGamesNewTeams.class, GameDisplay.SurvivalGamesTeams, new GameType[]{GameType.SurvivalGames}, false),
SurvivalGames(SurvivalGamesNewSolo.class, new GameMode[]
{
new GameMode(OverpoweredSGSolo.class, "Overpowered")
}, GameDisplay.SurvivalGames),
SurvivalGamesTeams(SurvivalGamesNewTeams.class, new GameMode[]
{
new GameMode(OverpoweredSGTeams.class, "Overpowered")
}, GameDisplay.SurvivalGamesTeams, new GameType[]{GameType.SurvivalGames}, false),
TurfWars(TurfForts.class, GameDisplay.TurfWars),
UHC(UHCTeams.class, GameDisplay.UHC),
UHCSolo(UHCSolo.class, GameDisplay.UHCSolo, new GameType[] { GameType.UHC }, false),

View File

@ -8,6 +8,8 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.inventory.ItemStack;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.PlayerPrepareTeleportEvent;
@ -52,6 +54,12 @@ public class OverpoweredBridge extends Bridge
player.getInventory().addItem(_items);
}
@EventHandler
public void damage(CustomDamageEvent event)
{
event.SetDamageToLevel(false);
}
@Override
public String GetMode()
{

View File

@ -624,6 +624,12 @@ public class CakeWars extends TeamGame
return DeathMessageType.Detailed;
}
@Override
public String GetMode()
{
return "Standard";
}
public int getGeneratorRate(CakeResource resource, int current)
{
return current;

View File

@ -20,4 +20,10 @@ public class CakeWarsDuos extends CakeWars
new TeamRequestsModule()
.register(this);
}
@Override
public String GetMode()
{
return "Duos";
}
}

View File

@ -134,8 +134,8 @@ public class OPCakeWars extends CakeWars
return;
}
event.AddMod(GetMode(), event.GetDamage() * 0.25);
event.AddKnockback(GetMode(), 1.25);
event.AddMod(GetName(), event.GetDamage() * 0.25);
event.AddKnockback(GetName(), 1.25);
}
@EventHandler

View File

@ -290,7 +290,7 @@ public class Spleef extends SoloGame
{
if (player.getFoodLevel() <= 0)
{
Manager.GetDamage().NewDamageEvent(player, null, null, DamageCause.STARVATION, 1, false, true, false, GetMode(), "Starvation");
Manager.GetDamage().NewDamageEvent(player, null, null, DamageCause.STARVATION, 1, false, true, false, GetName(), "Starvation");
player.sendMessage(F.main("Game", C.cRedB + "Break blocks to restore hunger!"));
}

View File

@ -1,6 +1,7 @@
package nautilus.game.arcade.game.games.survivalgames;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@ -37,6 +38,8 @@ import org.bukkit.inventory.BeaconInventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scoreboard.NameTagVisibility;
import com.google.common.collect.Lists;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.MapUtil;
@ -467,7 +470,15 @@ public abstract class SurvivalGamesNew extends Game
ChestLootModule lootModule = new ChestLootModule();
lootModule.registerChestType("Tier 1", _chests, 0.35,
setupTier1Loot(lootModule, compassModule, tnt, _chests);
setupTier2Loot(lootModule, compassModule, tnt, midChests);
lootModule.register(this);
}
protected void setupTier1Loot(ChestLootModule lootModule, TrackingCompassModule compassModule, ItemStack tnt, List<Location> chests)
{
lootModule.registerChestType("Tier 1", chests, 0.35,
new ChestLootPool()
.addItem(new ItemStack(Material.WOOD_AXE), 240)
@ -524,8 +535,11 @@ public abstract class SurvivalGamesNew extends Game
.addItem(compassModule.getCompass(5))
.addItem(tnt, 50)
);
}
lootModule.registerChestType("Tier 2", midChests,
protected void setupTier2Loot(ChestLootModule lootModule, TrackingCompassModule compassModule, ItemStack tnt, List<Location> chests)
{
lootModule.registerChestType("Tier 2", chests,
new ChestLootPool()
.addItem(new ItemStack(Material.WOOD_AXE), 240)
@ -591,8 +605,29 @@ public abstract class SurvivalGamesNew extends Game
.addItem(tnt, 50)
);
}
lootModule.register(this);
public void setupSupplyDropLoot(Map<Integer, List<ItemStack>> items)
{
items.put(1, Lists.newArrayList
(
new ItemStack(Material.IRON_BOOTS),
new ItemStack(Material.IRON_SWORD),
new ItemStack(Material.DIAMOND_AXE)
));
items.put(2, Lists.newArrayList
(
new ItemStack(Material.IRON_CHESTPLATE),
new ItemStack(Material.IRON_LEGGINGS),
new ItemStack(Material.DIAMOND_HELMET),
new ItemStack(Material.DIAMOND_BOOTS)
));
items.put(3, Lists.newArrayList
(
new ItemStack(Material.DIAMOND_CHESTPLATE),
new ItemStack(Material.DIAMOND_LEGGINGS),
new ItemStack(Material.DIAMOND_SWORD)
));
}
@EventHandler

View File

@ -0,0 +1,183 @@
package nautilus.game.arcade.game.games.survivalgames.modes;
import java.util.List;
import java.util.Map;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;
import com.google.common.collect.Lists;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.game.games.survivalgames.modules.TrackingCompassModule;
import nautilus.game.arcade.game.modules.Module;
import nautilus.game.arcade.game.modules.chest.ChestLootModule;
import nautilus.game.arcade.game.modules.chest.ChestLootPool;
class OverpoweredSGModule extends Module
{
void setupTier1Loot(ChestLootModule lootModule, TrackingCompassModule compassModule, ItemStack tnt, List<Location> chests)
{
lootModule.registerChestType("Tier 1", chests, 0.35,
new ChestLootPool()
.addItem(new ItemStack(Material.DIAMOND_AXE), 240)
.addItem(new ItemStack(Material.DIAMOND_SWORD), 210)
.setUnbreakable(true)
,
new ChestLootPool()
.addItem(new ItemStack(Material.DIAMOND_HELMET))
.addItem(new ItemStack(Material.DIAMOND_CHESTPLATE))
.addItem(new ItemStack(Material.DIAMOND_LEGGINGS))
.addItem(new ItemStack(Material.DIAMOND_BOOTS))
.setAmountsPerChest(1, 2)
.setUnbreakable(true)
.setEnchantmentRarity(0.3)
.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2)
.addEnchantment(Enchantment.PROTECTION_PROJECTILE, 2)
,
new ChestLootPool()
.addItem(new ItemStack(Material.BOW))
.setProbability(0.2)
.setUnbreakable(true)
.setEnchantmentRarity(0.5)
.addEnchantment(Enchantment.ARROW_DAMAGE, 2)
.addEnchantment(Enchantment.ARROW_KNOCKBACK, 2)
,
new ChestLootPool()
.addItem(new ItemStack(Material.FISHING_ROD))
.addItem(new ItemStack(Material.ARROW), 10, 20, 50)
.addItem(new ItemStack(Material.SNOW_BALL), 10, 20)
.addItem(new ItemStack(Material.EGG), 10, 20)
.setUnbreakable(true)
,
new ChestLootPool()
.addItem(new ItemStack(Material.COOKED_BEEF), 4, 8)
.addItem(new ItemStack(Material.COOKED_CHICKEN), 4, 8)
.addItem(new ItemStack(Material.GRILLED_PORK), 4, 8)
.addItem(new ItemStack(Material.MUSHROOM_SOUP))
,
new ChestLootPool()
.addItem(new ItemStack(Material.EXP_BOTTLE), 16, 32)
.addItem(new ItemStack(Material.STICK), 1, 2)
.addItem(new ItemStack(Material.BOAT), 50)
.addItem(new ItemStack(Material.FLINT), 1, 2, 70)
.addItem(new ItemStack(Material.FEATHER), 1, 2, 70)
.addItem(new ItemStack(Material.GOLD_INGOT), 1, 1, 80)
.addItem(compassModule.getCompass(10))
.addItem(tnt)
);
}
void setupTier2Loot(ChestLootModule lootModule, TrackingCompassModule compassModule, ItemStack tnt, List<Location> chests)
{
lootModule.registerChestType("Tier 2", chests,
new ChestLootPool()
.addItem(new ItemStack(Material.DIAMOND_SWORD))
.setUnbreakable(true)
.setEnchantmentRarity(0.5)
.addEnchantment(Enchantment.DAMAGE_ALL, 2)
.addEnchantment(Enchantment.KNOCKBACK, 2)
,
new ChestLootPool()
.addItem(new ItemStack(Material.DIAMOND_HELMET))
.addItem(new ItemStack(Material.DIAMOND_CHESTPLATE))
.addItem(new ItemStack(Material.DIAMOND_LEGGINGS))
.addItem(new ItemStack(Material.DIAMOND_BOOTS))
.setAmountsPerChest(1, 2)
.setUnbreakable(true)
.setEnchantmentRarity(0.5)
.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 3)
.addEnchantment(Enchantment.PROTECTION_PROJECTILE, 3)
,
new ChestLootPool()
.addItem(new ItemStack(Material.BOW))
.setProbability(0.2)
.setUnbreakable(true)
.setEnchantmentRarity(0.5)
.addEnchantment(Enchantment.ARROW_DAMAGE, 3)
.addEnchantment(Enchantment.ARROW_KNOCKBACK, 3),
new ChestLootPool()
.addItem(new ItemStack(Material.FISHING_ROD))
.addItem(new ItemStack(Material.ARROW), 10, 20, 50)
.addItem(new ItemStack(Material.SNOW_BALL), 10, 20)
.addItem(new ItemStack(Material.EGG), 10, 20)
.setUnbreakable(true)
,
new ChestLootPool()
.addItem(new ItemStack(Material.COOKED_BEEF), 4, 8)
.addItem(new ItemStack(Material.COOKED_CHICKEN), 4, 8)
.addItem(new ItemStack(Material.GRILLED_PORK), 4, 8)
.addItem(new ItemStack(Material.MUSHROOM_SOUP))
,
new ChestLootPool()
.addItem(new ItemStack(Material.EXP_BOTTLE), 16, 32)
.addItem(new ItemStack(Material.STICK), 1, 2)
.addItem(new ItemStack(Material.BOAT), 50)
.addItem(new ItemStack(Material.FLINT), 1, 2, 70)
.addItem(new ItemStack(Material.FEATHER), 1, 2, 70)
.addItem(new ItemStack(Material.GOLD_INGOT), 1, 1, 80)
.addItem(new ItemStack(Material.DIAMOND), 1, 1, 70)
.addItem(compassModule.getCompass(10))
.addItem(tnt)
);
}
void setupSupplyDropLoot(Map<Integer, List<ItemStack>> items)
{
items.put(1, Lists.newArrayList
(
new ItemBuilder(Material.DIAMOND_HELMET)
.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 3)
.setUnbreakable(true)
.build(),
new ItemBuilder(Material.DIAMOND_CHESTPLATE)
.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 3)
.setUnbreakable(true)
.build(),
new ItemBuilder(Material.DIAMOND_LEGGINGS)
.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 3)
.setUnbreakable(true)
.build(),
new ItemBuilder(Material.DIAMOND_BOOTS)
.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 3)
.setUnbreakable(true)
.build()
));
items.put(2, Lists.newArrayList
(
new ItemBuilder(Material.DIAMOND_SWORD)
.addEnchantment(Enchantment.DAMAGE_ALL, 2)
.addEnchantment(Enchantment.KNOCKBACK, 2)
.setUnbreakable(true)
.build(),
new ItemBuilder(Material.DIAMOND_SWORD)
.addEnchantment(Enchantment.DAMAGE_ALL, 1)
.addEnchantment(Enchantment.KNOCKBACK, 1)
.setUnbreakable(true)
.build()
));
items.put(3, Lists.newArrayList
(
new ItemBuilder(Material.STICK)
.addEnchantment(Enchantment.KNOCKBACK, 4)
.build()
));
}
}

View File

@ -0,0 +1,56 @@
package nautilus.game.arcade.game.games.survivalgames.modes;
import java.util.List;
import java.util.Map;
import org.bukkit.Location;
import org.bukkit.inventory.ItemStack;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.survivalgames.SurvivalGamesNewSolo;
import nautilus.game.arcade.game.games.survivalgames.modules.TrackingCompassModule;
import nautilus.game.arcade.game.modules.chest.ChestLootModule;
public class OverpoweredSGSolo extends SurvivalGamesNewSolo
{
private final OverpoweredSGModule _opModule;
public OverpoweredSGSolo(ArcadeManager manager)
{
super(manager);
_opModule = new OverpoweredSGModule();
_opModule.register(this);
}
@Override
protected void setupTier1Loot(ChestLootModule lootModule, TrackingCompassModule compassModule, ItemStack tnt, List<Location> chests)
{
_opModule.setupTier1Loot(lootModule, compassModule, tnt, chests);
}
@Override
protected void setupTier2Loot(ChestLootModule lootModule, TrackingCompassModule compassModule, ItemStack tnt, List<Location> chests)
{
_opModule.setupTier2Loot(lootModule, compassModule, tnt, chests);
}
@Override
public void setupSupplyDropLoot(Map<Integer, List<ItemStack>> items)
{
_opModule.setupSupplyDropLoot(items);
}
@Override
public boolean isAllowingGameStats()
{
return false;
}
@Override
public String GetMode()
{
return "Overpowered";
}
}

View File

@ -0,0 +1,56 @@
package nautilus.game.arcade.game.games.survivalgames.modes;
import java.util.List;
import java.util.Map;
import org.bukkit.Location;
import org.bukkit.inventory.ItemStack;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.survivalgames.SurvivalGamesNewTeams;
import nautilus.game.arcade.game.games.survivalgames.modules.TrackingCompassModule;
import nautilus.game.arcade.game.modules.chest.ChestLootModule;
public class OverpoweredSGTeams extends SurvivalGamesNewTeams
{
private final OverpoweredSGModule _opModule;
public OverpoweredSGTeams(ArcadeManager manager)
{
super(manager);
_opModule = new OverpoweredSGModule();
_opModule.register(this);
}
@Override
protected void setupTier1Loot(ChestLootModule lootModule, TrackingCompassModule compassModule, ItemStack tnt, List<Location> chests)
{
_opModule.setupTier1Loot(lootModule, compassModule, tnt, chests);
}
@Override
protected void setupTier2Loot(ChestLootModule lootModule, TrackingCompassModule compassModule, ItemStack tnt, List<Location> chests)
{
_opModule.setupTier2Loot(lootModule, compassModule, tnt, chests);
}
@Override
public void setupSupplyDropLoot(Map<Integer, List<ItemStack>> items)
{
_opModule.setupSupplyDropLoot(items);
}
@Override
public boolean isAllowingGameStats()
{
return false;
}
@Override
public String GetMode()
{
return "Overpowered";
}
}

View File

@ -26,9 +26,6 @@ import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitRunnable;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.common.Pair;
import mineplex.core.common.util.C;
@ -51,6 +48,9 @@ import mineplex.core.treasure.util.TreasureUtil;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.survivalgames.SurvivalGamesNew;
import nautilus.game.arcade.game.modules.Module;
public class SupplyDropModule extends Module
@ -85,7 +85,7 @@ public class SupplyDropModule extends Module
2, 3
}
};
private final ImmutableMap<Integer, List<ItemStack>> _lootTable;
private final Map<Integer, List<ItemStack>> _lootTable;
private final Inventory _chestInventory;
private SupplyDrop _supplyDrop;
private Block _lastBlock;
@ -94,28 +94,7 @@ public class SupplyDropModule extends Module
public SupplyDropModule()
{
_lootTable = ImmutableMap.<Integer, List<ItemStack>>builder()
.put(1, Lists.newArrayList
(
new ItemStack(Material.IRON_BOOTS),
new ItemStack(Material.IRON_SWORD),
new ItemStack(Material.DIAMOND_AXE)
))
.put(2, Lists.newArrayList
(
new ItemStack(Material.IRON_CHESTPLATE),
new ItemStack(Material.IRON_LEGGINGS),
new ItemStack(Material.DIAMOND_HELMET),
new ItemStack(Material.DIAMOND_BOOTS)
))
.put(3, Lists.newArrayList
(
new ItemStack(Material.DIAMOND_CHESTPLATE),
new ItemStack(Material.DIAMOND_LEGGINGS),
new ItemStack(Material.DIAMOND_SWORD)
))
.build();
_lootTable = new HashMap<>(3);
_chestInventory = Bukkit.createInventory(null, 27, "Supply Drop");
}
@ -127,6 +106,17 @@ public class SupplyDropModule extends Module
_lastBlock = null;
}
@EventHandler
public void prepare(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Prepare)
{
return;
}
((SurvivalGamesNew) getGame()).setupSupplyDropLoot(_lootTable);
}
@EventHandler
public void update(UpdateEvent event)
{

View File

@ -514,7 +514,7 @@ public class TurfForts extends TeamGame
}
else
{
event.AddMod(GetMode(), "One Hit Kill", 500, false);
event.AddMod(GetName(), "One Hit Kill", 500, false);
}
}
else if (event.GetCause() == DamageCause.ENTITY_ATTACK)

View File

@ -40,7 +40,7 @@ public class GamePlayerManager implements Listener
public static final String FOOTER = "Visit " + C.cGreen + "www.mineplex.com" + C.Reset + " for News, Forums and Shop";
public static String getHeader(Game game)
{
return C.cGoldB + (game == null ? "Waiting For Players" : game.GetType().getName() + (game.GetMode() == null ? "" : C.cWhiteB + " - " + C.cYellowB + game.GetMode()));
return C.cGoldB + (game == null ? "Waiting For Players" : game.GetType().GetLobbyName() + (game.GetMode() == null ? "" : C.cWhiteB + " - " + C.cYellowB + game.GetMode()));
}
final ArcadeManager Manager;