Changes from QA

This commit is contained in:
Sam 2018-07-22 23:50:16 +01:00 committed by Alexander Meech
parent ba665dd463
commit 78ed973d26
2 changed files with 84 additions and 17 deletions

View File

@ -5,13 +5,22 @@ import java.util.Map;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.Potion;
import org.bukkit.potion.PotionType;
import com.google.common.collect.Lists;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilServer;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.survivalgames.modules.TrackingCompassModule;
import nautilus.game.arcade.game.modules.Module;
import nautilus.game.arcade.game.modules.chest.ChestLootModule;
@ -20,6 +29,8 @@ import nautilus.game.arcade.game.modules.chest.ChestLootPool;
class OverpoweredSGModule extends Module
{
private static final int GRACE_PERIOD = 30;
void setupTier1Loot(ChestLootModule lootModule, TrackingCompassModule compassModule, ItemStack tnt, List<Location> chests)
{
lootModule.registerChestType("Tier 1", chests, 0.35,
@ -38,8 +49,8 @@ class OverpoweredSGModule extends Module
.setAmountsPerChest(1, 2)
.setUnbreakable(true)
.setEnchantmentRarity(0.3)
.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2)
.addEnchantment(Enchantment.PROTECTION_PROJECTILE, 2)
.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1)
.addEnchantment(Enchantment.PROTECTION_PROJECTILE, 1)
,
new ChestLootPool()
@ -47,8 +58,8 @@ class OverpoweredSGModule extends Module
.setProbability(0.2)
.setUnbreakable(true)
.setEnchantmentRarity(0.5)
.addEnchantment(Enchantment.ARROW_DAMAGE, 2)
.addEnchantment(Enchantment.ARROW_KNOCKBACK, 2)
.addEnchantment(Enchantment.ARROW_DAMAGE, 1)
.addEnchantment(Enchantment.ARROW_KNOCKBACK, 1)
,
new ChestLootPool()
@ -56,6 +67,11 @@ class OverpoweredSGModule extends Module
.addItem(new ItemStack(Material.ARROW), 10, 20, 50)
.addItem(new ItemStack(Material.SNOW_BALL), 10, 20)
.addItem(new ItemStack(Material.EGG), 10, 20)
.addItem(new Potion(PotionType.INSTANT_HEAL, 1)
.splash()
.toItemStack(1), 40)
.addItem(new Potion(PotionType.INSTANT_HEAL, 2)
.toItemStack(1), 30)
.setUnbreakable(true)
,
@ -64,6 +80,7 @@ class OverpoweredSGModule extends Module
.addItem(new ItemStack(Material.COOKED_CHICKEN), 4, 8)
.addItem(new ItemStack(Material.GRILLED_PORK), 4, 8)
.addItem(new ItemStack(Material.MUSHROOM_SOUP))
.addItem(new ItemStack(Material.GOLDEN_APPLE))
,
new ChestLootPool()
@ -97,9 +114,9 @@ class OverpoweredSGModule extends Module
.addItem(new ItemStack(Material.DIAMOND_BOOTS))
.setAmountsPerChest(1, 2)
.setUnbreakable(true)
.setEnchantmentRarity(0.5)
.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 3)
.addEnchantment(Enchantment.PROTECTION_PROJECTILE, 3)
.setEnchantmentRarity(0.6)
.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2)
.addEnchantment(Enchantment.PROTECTION_PROJECTILE, 2)
,
new ChestLootPool()
@ -107,14 +124,19 @@ class OverpoweredSGModule extends Module
.setProbability(0.2)
.setUnbreakable(true)
.setEnchantmentRarity(0.5)
.addEnchantment(Enchantment.ARROW_DAMAGE, 3)
.addEnchantment(Enchantment.ARROW_KNOCKBACK, 3),
.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)
.addItem(new Potion(PotionType.INSTANT_HEAL, 1)
.splash()
.toItemStack(1), 50)
.addItem(new Potion(PotionType.INSTANT_HEAL, 2)
.toItemStack(1), 40)
.setUnbreakable(true)
,
@ -123,6 +145,7 @@ class OverpoweredSGModule extends Module
.addItem(new ItemStack(Material.COOKED_CHICKEN), 4, 8)
.addItem(new ItemStack(Material.GRILLED_PORK), 4, 8)
.addItem(new ItemStack(Material.MUSHROOM_SOUP))
.addItem(new ItemStack(Material.GOLDEN_APPLE))
,
new ChestLootPool()
@ -144,32 +167,30 @@ class OverpoweredSGModule extends Module
items.put(1, Lists.newArrayList
(
new ItemBuilder(Material.DIAMOND_HELMET)
.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 3)
.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2)
.setUnbreakable(true)
.build(),
new ItemBuilder(Material.DIAMOND_CHESTPLATE)
.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 3)
.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2)
.setUnbreakable(true)
.build(),
new ItemBuilder(Material.DIAMOND_LEGGINGS)
.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 3)
.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2)
.setUnbreakable(true)
.build(),
new ItemBuilder(Material.DIAMOND_BOOTS)
.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 3)
.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2)
.setUnbreakable(true)
.build()
));
items.put(2, Lists.newArrayList
(
new ItemBuilder(Material.DIAMOND_SWORD)
.addEnchantment(Enchantment.DAMAGE_ALL, 2)
.addEnchantment(Enchantment.KNOCKBACK, 2)
.addEnchantment(Enchantment.DAMAGE_ALL, 3)
.setUnbreakable(true)
.build(),
new ItemBuilder(Material.DIAMOND_SWORD)
.addEnchantment(Enchantment.DAMAGE_ALL, 1)
.addEnchantment(Enchantment.KNOCKBACK, 1)
.addEnchantment(Enchantment.KNOCKBACK, 2)
.setUnbreakable(true)
.build()
));
@ -180,4 +201,33 @@ class OverpoweredSGModule extends Module
.build()
));
}
@EventHandler
public void live(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Live)
{
return;
}
getGame().DamagePvP = false;
getGame().Announce(C.cGreenB + "PvP is disabled for " + GRACE_PERIOD + " seconds.");
getGame().getArcadeManager().runSyncLater(() ->
{
if (!getGame().IsLive())
{
return;
}
getGame().DamagePvP = true;
getGame().Announce(C.cRedB + "PvP has been enabled!", false);
for (Player player : UtilServer.getPlayersCollection())
{
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1, 1);
}
}, GRACE_PERIOD * 20);
}
}

View File

@ -3,6 +3,7 @@ package nautilus.game.arcade.game.games.survivalgames.modules;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.bukkit.Location;
import org.bukkit.WorldBorder;
@ -13,6 +14,7 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilTime;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
@ -29,8 +31,12 @@ public class BorderModule extends Module
private static final int RATE_CONSTANT = 60;
private static final int PLAYER_CONSTANT = 24;
private static final long FINAL_BORDER_TIME = TimeUnit.SECONDS.toMillis(3);
private static final int FINAL_BORDER_MOVE_TIME = 300;
private double _initialBorder, _initialPlayers, _deathmatchSize = 61;
private boolean _finalBorderCheck, _finalBorderMove;
private long _finalBorderTime;
@Override
protected void setup()
@ -132,6 +138,17 @@ public class BorderModule extends Module
return;
}
if (!_finalBorderCheck)
{
_finalBorderTime = System.currentTimeMillis();
_finalBorderCheck = true;
}
else if (!_finalBorderMove && UtilTime.elapsed(_finalBorderTime, FINAL_BORDER_TIME))
{
getGame().WorldData.World.getWorldBorder().setSize(1, FINAL_BORDER_MOVE_TIME);
_finalBorderMove = true;
}
Location center = UtilAlg.getAverageLocation(getGame().GetTeamList().get(0).GetSpawns());
if (center == null)