GI changes from testing session

This commit is contained in:
Sam 2016-07-16 11:15:33 +01:00
parent f012e8d4ed
commit 951e07488a
23 changed files with 417 additions and 1094 deletions

View File

@ -1,24 +1,19 @@
package nautilus.game.arcade.game.games.skywars;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilTime.TimeUnit;
import mineplex.core.recharge.Recharge;
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.GameTeam;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.modules.TeamModule;
import nautilus.game.arcade.stats.DeathBomberStatTracker;
import nautilus.game.arcade.stats.SkywarsKillZombieStatTracker;
@ -26,20 +21,10 @@ import nautilus.game.arcade.stats.SkywarsTNTStatTracker;
import nautilus.game.arcade.stats.WinWithoutOpeningChestStatTracker;
import nautilus.game.arcade.stats.WinWithoutWearingArmorStatTracker;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerQuitEvent;
public class TeamSkywars extends Skywars
{
@SuppressWarnings("unchecked")
public TeamSkywars(ArcadeManager manager)
{
this(manager, GameType.SkywarsTeams);

View File

@ -20,7 +20,40 @@ public class KitAir extends ProgressingKit
private static final String[] DESCRIPTION = {
"Start with " + C.cGreen + "Wood Sword" + C.cGray + " and " + C.cGreen + "Eye of Ender",
"",
"Right-Click " + C.cGreen + "Eye of Ender" + C.cWhite + " to teleport back to your",
"last safe location",
C.cRedB + "ONE" + C.cWhite + " use only.",
"",
C.cYellow + "Double-Tap Space " + C.cWhite + "to " + C.cGreen + "Double Jump" + C.cWhite + ". " + C.cGreen + "30" + C.cWhite + " second cooldown.",
};
private static final Perk[][] PERKS =
{
{
new PerkVoidSaver(),
new PerkDoubleJump("Leap", 1, 1, true, 30000, true)
},
{
new PerkVoidSaver(),
new PerkDoubleJump("Leap", 1, 1, true, 29000, true)
},
{
new PerkVoidSaver(),
new PerkDoubleJump("Leap", 1.1, 1, true, 29000, true)
},
{
new PerkVoidSaver(),
new PerkDoubleJump("Leap", 1.1, 1, true, 28000, true)
},
{
new PerkVoidSaver(),
new PerkDoubleJump("Leap", 1.2, 1, true, 28000, true)
},
{
new PerkVoidSaver(),
new PerkDoubleJump("Leap", 1.2, 1, true, 27000, true)
},
};
private static final ItemStack[] PLAYER_ITEMS = { new ItemStack(Material.WOOD_SWORD), new ItemBuilder(Material.EYE_OF_ENDER).setTitle(C.cGreen + "Eye of Ender").build() };
@ -28,12 +61,7 @@ public class KitAir extends ProgressingKit
public KitAir(ArcadeManager manager)
{
super(manager, "Air", "skywarsair", KitAvailability.Free, DESCRIPTION, new Perk[] { new PerkVoidSaver(), new PerkDoubleJump("Leap", 1, 1, true, 30000, true) }, EntityType.ZOMBIE, IN_HAND);
setPerks(1, new Perk[] { new PerkVoidSaver(), new PerkDoubleJump("Leap", 1, 1, true, 29000, true) });
setPerks(2, new Perk[] { new PerkVoidSaver(), new PerkDoubleJump("Leap", 1.1, 1, true, 29000, true) });
setPerks(3, new Perk[] { new PerkVoidSaver(), new PerkDoubleJump("Leap", 1.1, 1, true, 28000, true) });
setPerks(4, new Perk[] { new PerkVoidSaver(), new PerkDoubleJump("Leap", 1.2, 1, true, 28000, true) });
setPerks(5, new Perk[] { new PerkVoidSaver(), new PerkDoubleJump("Leap", 1.2, 1, true, 27000, true) });
super(manager, "Air", "skywarsair", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND);
}
@Override

View File

@ -1,68 +0,0 @@
package nautilus.game.arcade.game.games.skywars.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 nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
public class KitBuilder extends ProgressingKit
{
private static final String[] DESCRIPTION = {
"Start with " + C.cGreen + "Wood Axe" + C.cGray + " and " + C.cGreen + "Wooden Pickaxe",
"",
};
private static final ItemStack[] PLAYER_ITEMS = {
new ItemStack(Material.WOOD_AXE),
new ItemStack(Material.WOOD_PICKAXE)
};
private static final ItemStack IN_HAND = new ItemStack(Material.COBBLESTONE);
public KitBuilder(ArcadeManager manager)
{
super(manager, "Bulider", "skywarsbuilder", KitAvailability.Free, DESCRIPTION, new Perk[] { }, EntityType.ZOMBIE, IN_HAND);
}
@Override
public void GiveItems(Player player)
{
int level = getUpgradeLevel(player.getUniqueId());
int amount = 1;
player.getInventory().addItem(PLAYER_ITEMS);
switch (level)
{
case 0:
amount = 15;
break;
case 1:
amount = 20;
break;
case 2:
amount = 25;
break;
case 3:
amount = 30;
break;
case 4:
amount = 35;
break;
case 5:
amount = 40;
break;
default:
break;
}
player.getInventory().addItem(new ItemStack(Material.COBBLESTONE, amount));
}
}

View File

@ -1,80 +0,0 @@
package nautilus.game.arcade.game.games.skywars.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 nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
import nautilus.game.arcade.kit.perks.PerkArmorUpgrade;
public class KitDevourer extends ProgressingKit
{
private static final String[] DESCRIPTION = {
"Start with " + C.cGreen + "Wood Sword" + C.cGray + " and " + C.cGreen + "25 Cobblestone",
"",
"Each kill upgrades your lowest armor piece by 1 tier"
};
private static final Perk[] PERKS = {
new PerkArmorUpgrade()
};
private static final ItemStack[] PLAYER_ITEMS = {
new ItemStack(Material.COBBLESTONE, 25)
};
private static final ItemStack IN_HAND = new ItemStack(Material.DIAMOND_CHESTPLATE);
public KitDevourer(ArcadeManager manager)
{
super(manager, "Devourer", "skywarsdevourer", KitAvailability.Gem, 4000, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND);
setPerks(PERKS);
}
@Override
public void GiveItems(Player player)
{
int level = getUpgradeLevel(player.getUniqueId());
switch (level)
{
case 0:
player.getInventory().addItem(new ItemStack(Material.WOOD_SWORD));
break;
case 1:
player.getInventory().addItem(new ItemStack(Material.STONE_SWORD));
break;
case 2:
player.getInventory().addItem(new ItemStack(Material.STONE_SWORD));
player.getInventory().addItem(new ItemStack(Material.GOLD_BOOTS));
break;
case 3:
player.getInventory().addItem(new ItemStack(Material.STONE_SWORD));
player.getInventory().addItem(new ItemStack(Material.GOLD_BOOTS));
player.getInventory().addItem(new ItemStack(Material.GOLD_HELMET));
break;
case 4:
player.getInventory().addItem(new ItemStack(Material.STONE_SWORD));
player.getInventory().addItem(new ItemStack(Material.GOLD_BOOTS));
player.getInventory().addItem(new ItemStack(Material.GOLD_HELMET));
player.getInventory().addItem(new ItemStack(Material.GOLD_LEGGINGS));
break;
case 5:
player.getInventory().addItem(new ItemStack(Material.STONE_SWORD));
player.getInventory().addItem(new ItemStack(Material.GOLD_BOOTS));
player.getInventory().addItem(new ItemStack(Material.GOLD_HELMET));
player.getInventory().addItem(new ItemStack(Material.GOLD_LEGGINGS));
player.getInventory().addItem(new ItemStack(Material.GOLD_CHESTPLATE));
break;
}
player.getInventory().addItem(PLAYER_ITEMS);
}
}

View File

@ -6,7 +6,6 @@ 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.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
@ -19,20 +18,41 @@ public class KitEarth extends ProgressingKit
private static final String[] DESCRIPTION = {
"Start with " + C.cGreen + "Wood Sword" + C.cGray + " and " + C.cGreen + "Wood Shovel",
"",
receiveItem("Dirt", 1, 20, 4),
"Right Click " + C.cGreen + "Dirt" + C.cWhite + " to fire a " + C.cGreen + "Dirt" + C.cWhite + " block that deals",
"knockback and damage to any player it hits.",
"You also take recoil knockback."
};
private static final Perk[][] PERKS =
{
{
new PerkDirtCannon(2, 1)
},
{
new PerkDirtCannon(2, .5)
},
{
new PerkDirtCannon(2, .5)
},
{
new PerkDirtCannon(2, .5)
},
{
new PerkDirtCannon(2.5, .5)
},
{
new PerkDirtCannon(2.5, .5)
},
};
private static final ItemStack[] PLAYER_ITEMS = { new ItemStack(Material.WOOD_SWORD), new ItemBuilder(Material.WOOD_SPADE).setTitle(C.cGreen + "Dirt Cannon").build() };
private static final ItemStack[] PLAYER_ITEMS = { new ItemStack(Material.WOOD_SWORD), new ItemStack(Material.WOOD_SPADE) };
private static final ItemStack IN_HAND = new ItemStack(Material.DIRT);
public KitEarth(ArcadeManager manager)
{
super(manager, "Earth", "skywarsearth", KitAvailability.Free, DESCRIPTION, new Perk[] { new PerkDirtCannon(20000, 2, 1) }, EntityType.ZOMBIE, IN_HAND);
setPerks(1, new Perk[] { new PerkDirtCannon(19000, 2, .25) });
setPerks(2, new Perk[] { new PerkDirtCannon(19000, 2, .2) });
setPerks(3, new Perk[] { new PerkDirtCannon(18000, 2, .2) });
setPerks(4, new Perk[] { new PerkDirtCannon(18000, 2.5, .2) });
setPerks(5, new Perk[] { new PerkDirtCannon(17000, 2.5, .2) });
super(manager, "Earth", "skywarsearth", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND);
}
@Override

View File

@ -19,8 +19,34 @@ public class KitFire extends ProgressingKit
private static final String[] DESCRIPTION = {
"Start with " + C.cGreen + "Wood Sword" + C.cGray + " and " + C.cGreen + "Blaze Rod",
"",
"Right click blaze rod to send a ring of fire burst around you for 3 blocks. Provides knockback and 3 damage. 45 second cooldown."
"Right Click " + C.cGreen + "Blaze Rod" + C.cWhite + " to send a fire burst",
"around you for " + C.cGreen + "3" + C.cWhite + " blocks.",
"Provides knockback and " + C.cGreen + "3" + C.cWhite + " damage.",
C.cGreen + "45" + C.cWhite + " second cooldown."
};
private static final Perk[][] PERKS =
{
{
new PerkFireBurst(44000, 3, 3)
},
{
new PerkFireBurst(44000, 4, 3)
},
{
new PerkFireBurst(43000, 4, 3)
},
{
new PerkFireBurst(43000, 4, 3)
},
{
new PerkFireBurst(43000, 4, 4)
},
{
new PerkFireBurst(42000, 4, 4)
},
};
private static final ItemStack[] PLAYER_ITEMS = { new ItemStack(Material.WOOD_SWORD), new ItemBuilder(Material.BLAZE_ROD).setTitle(C.cGreen + "Fire Burst").build() };
@ -28,12 +54,8 @@ public class KitFire extends ProgressingKit
public KitFire(ArcadeManager manager)
{
super(manager, "Fire", "skywarsfire", KitAvailability.Free, DESCRIPTION, new Perk[] { new PerkFireBurst(45000, 3, 3) }, EntityType.ZOMBIE, IN_HAND);
setPerks(1, new Perk[] { new PerkFireBurst(44000, 3, 3) });
setPerks(2, new Perk[] { new PerkFireBurst(44000, 4, 3) });
setPerks(3, new Perk[] { new PerkFireBurst(43000, 4, 3) });
setPerks(4, new Perk[] { new PerkFireBurst(43000, 4, 4) });
setPerks(5, new Perk[] { new PerkFireBurst(42000, 4, 4) });
super(manager, "Fire", "skywarsfire", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND);
}
@Override

View File

@ -1,97 +0,0 @@
package nautilus.game.arcade.game.games.skywars.kits;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import mineplex.core.common.util.C;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
import nautilus.game.arcade.kit.perks.PerkIncreaseOre;
public class KitGatherer extends ProgressingKit
{
private static final String[] DESCRIPTION = {
"Start with " + C.cGreen + "Wood Pickaxe" + C.cGray + " and " + C.cGreen + "Wood Sword",
"",
"Each ore mined drops double"
};
private static final ItemStack[] PLAYER_ITEMS = {
new ItemStack(Material.WOOD_SWORD)
};
private static final Material[] TYPES = {
Material.COAL_ORE,
Material.GOLD_ORE,
Material.IRON_ORE,
};
private static final Material[] TYPES_5 = {
Material.COAL_ORE,
Material.GOLD_ORE,
Material.IRON_ORE,
Material.DIAMOND_ORE,
};
private static final ItemStack IN_HAND = new ItemStack(Material.WOOD_PICKAXE);
public KitGatherer(ArcadeManager manager)
{
super(manager, "Gatherer", "skywarsgartherer", KitAvailability.Free, DESCRIPTION, new Perk[] { new PerkIncreaseOre(1, TYPES) }, EntityType.ZOMBIE, IN_HAND);
for (int i = 0; i < 5; i++)
{
setPerks(i, new Perk[] { new PerkIncreaseOre(1, TYPES) });
}
setPerks(5, new Perk[] { new PerkIncreaseOre(1, TYPES_5) });
setOtherPerks(2, "Gain Haste I");
setOtherPerks(3, "Gain Haste I");
setOtherPerks(4, "Gain Haste II");
setOtherPerks(5, "Gain Haste III", "Diamond ore drops double");
}
@Override
public void GiveItems(Player player)
{
int level = getUpgradeLevel(player.getUniqueId());
player.getInventory().addItem(PLAYER_ITEMS);
switch (level)
{
case 0:
player.getInventory().addItem(new ItemStack(Material.WOOD_PICKAXE));
break;
case 1:
player.getInventory().addItem(new ItemStack(Material.STONE_PICKAXE));
break;
case 2:
player.getInventory().addItem(new ItemStack(Material.STONE_PICKAXE));
player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, Integer.MAX_VALUE, 0));
break;
case 3:
player.getInventory().addItem(new ItemStack(Material.IRON_PICKAXE));
player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, Integer.MAX_VALUE, 0));
break;
case 4:
player.getInventory().addItem(new ItemStack(Material.IRON_PICKAXE));
player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, Integer.MAX_VALUE, 1));
break;
case 5:
player.getInventory().addItem(new ItemStack(Material.IRON_PICKAXE));
player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, Integer.MAX_VALUE, 2));
break;
default:
break;
}
}
}

View File

@ -1,45 +0,0 @@
package nautilus.game.arcade.game.games.skywars.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.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
import nautilus.game.arcade.kit.perks.PerkGrapple;
public class KitGrappler extends ProgressingKit
{
private static final String[] DESCRIPTION = {
"Start with " + C.cGreen + "Wood Axe" + C.cGray + " and " + C.cGreen + "Wood Pickaxe",
"",
"Hook has a 10 block radius. Fires a lead that sticks into the ground. Pulls the player to it with a second right click. 45 Second cooldown."
};
private static final ItemStack[] PLAYER_ITEMS = { new ItemStack(Material.WOOD_AXE), new ItemStack(Material.WOOD_PICKAXE), new ItemBuilder(Material.TRIPWIRE_HOOK).setTitle(C.cGreen + "Grapple").build() };
private static final ItemStack IN_HAND = new ItemStack(Material.TRIPWIRE_HOOK);
public KitGrappler(ArcadeManager manager)
{
super(manager, "Grappler", "skywarsgrappler", KitAvailability.Free, DESCRIPTION, new Perk[] { new PerkGrapple(45) }, EntityType.ZOMBIE, IN_HAND);
setPerks(1, new Perk[] { new PerkGrapple(44) });
setPerks(2, new Perk[] { new PerkGrapple(43) });
setPerks(3, new Perk[] { new PerkGrapple(42) });
setPerks(4, new Perk[] { new PerkGrapple(41) });
setPerks(5, new Perk[] { new PerkGrapple(40) });
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(PLAYER_ITEMS);
}
}

View File

@ -22,8 +22,33 @@ public class KitIce extends ProgressingKit
private static final String[] DESCRIPTION = {
"Start with " + C.cGreen + "Wood Sword" + C.cGray + " and " + C.cGreen + "Snow Block",
"",
"Right Click snowblock to create an ice bridge that extendes from you for 12x2 blocks and lasts 4 seconds. 30 second cooldown"
"Right Click " + C.cYellow + "Snow Block" + C.cWhite + " to create an ice bridge",
"that extendes from you.",
"For " + C.cGreen + "12x2" + C.cWhite + " blocks and lasts " + C.cGreen + "4" + C.cWhite + " seconds.",
C.cGreen + "30" + C.cWhite + " second cooldown"
};
private static final Perk[][] PERKS =
{
{
new PerkIceBridge(30000, 4000)
},
{
new PerkIceBridge(29000, 4000)
},
{
new PerkIceBridge(29000, 5000)
},
{
new PerkIceBridge(28000, 5000)
},
{
new PerkIceBridge(28000, 6000)
},
{
new PerkIceBridge(27000, 6000)
},
};
private static final ItemStack[] PLAYER_ITEMS = { new ItemStack(Material.WOOD_SWORD), new ItemBuilder(Material.SNOW_BLOCK).setTitle(C.cGreen + "Ice Bridge").build() };
@ -31,12 +56,7 @@ public class KitIce extends ProgressingKit
public KitIce(ArcadeManager manager)
{
super(manager, "Ice", "skywarsice", KitAvailability.Free, DESCRIPTION, new Perk[] { new PerkIceBridge(30000, 4000) }, EntityType.ZOMBIE, IN_HAND);
setPerks(1, new Perk[] { new PerkIceBridge(29000, 4000) });
setPerks(2, new Perk[] { new PerkIceBridge(29000, 5000) });
setPerks(3, new Perk[] { new PerkIceBridge(28000, 5000) });
setPerks(4, new Perk[] { new PerkIceBridge(28000, 6000) });
setPerks(5, new Perk[] { new PerkIceBridge(27000, 6000) });
super(manager, "Ice", "skywarsice", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND);
}
@Override

View File

@ -1,44 +0,0 @@
package nautilus.game.arcade.game.games.skywars.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 nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
import nautilus.game.arcade.kit.perks.PerkLeap;
public class KitJumper extends ProgressingKit
{
private static final String[] DESCRIPTION = {
"Start with " + C.cGreen + "Stone Axe" + C.cGray + " and " + C.cGreen + "Wooden Pickaxe",
"",
"Right click Axe to use Leap. Cannot use in the first 30 seconds of the game. 30 second cooldown"
};
private static final ItemStack[] PLAYER_ITEMS = { new ItemStack(Material.STONE_AXE), new ItemStack(Material.WOOD_PICKAXE) };
private static final ItemStack IN_HAND = new ItemStack(Material.STONE_AXE);
public KitJumper(ArcadeManager manager)
{
super(manager, "Jumper", "skywarsjumper", KitAvailability.Free, DESCRIPTION, new Perk[] { new PerkLeap("Leap", 1, 1, 30000) }, EntityType.ZOMBIE, IN_HAND);
setPerks(1, new Perk[] { new PerkLeap("Leap", 1, 1, 29000) });
setPerks(2, new Perk[] { new PerkLeap("Leap", 1, 1, 28000) });
setPerks(3, new Perk[] { new PerkLeap("Leap", 1, 1, 27000) });
setPerks(4, new Perk[] { new PerkLeap("Leap", 1, 1, 26000) });
setPerks(5, new Perk[] { new PerkLeap("Leap", 1, 1, 25000) });
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(PLAYER_ITEMS);
}
}

View File

@ -1,47 +0,0 @@
package nautilus.game.arcade.game.games.skywars.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 nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
import nautilus.game.arcade.kit.perks.PerkThorns;
public class KitPricklyPete extends ProgressingKit
{
private static final String[] DESCRIPTION = {
"Start with " + C.cGreen + "Wood Pickaxe" + C.cGray + " and " + C.cGreen + "Wood Sword",
"",
"Each armor piece reflects 0.5 damage per hit every 10 seconds"
};
private static final ItemStack[] PLAYER_ITEMS = {
new ItemStack(Material.WOOD_PICKAXE),
new ItemStack(Material.WOOD_SWORD)
};
private static final ItemStack IN_HAND = new ItemStack(Material.CACTUS);
public KitPricklyPete(ArcadeManager manager)
{
super(manager, "Prickly Pete", "skywarspricklypete", KitAvailability.Gem, 4000, DESCRIPTION, new Perk[] { new PerkThorns(0.5, 10) }, EntityType.ZOMBIE, IN_HAND);
setPerks(1, new Perk[] { new PerkThorns(1, 10) });
setPerks(2, new Perk[] { new PerkThorns(1, 9) });
setPerks(3, new Perk[] { new PerkThorns(1.5, 9) });
setPerks(4, new Perk[] { new PerkThorns(1.5, 8) });
setPerks(5, new Perk[] { new PerkThorns(2, 8) });
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(PLAYER_ITEMS);
}
}

View File

@ -1,47 +0,0 @@
package nautilus.game.arcade.game.games.skywars.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 nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
import nautilus.game.arcade.kit.perks.PerkIronSkin;
public class KitRock extends ProgressingKit
{
private static final String[] DESCRIPTION = {
"Start with " + C.cGreen + "Wood Pickaxe" + C.cGray + " and " + C.cGreen + "Wood Sword",
"",
"Take 0.1 less damage from all attacks"
};
private static final ItemStack[] PLAYER_ITEMS = {
new ItemStack(Material.WOOD_PICKAXE),
new ItemStack(Material.WOOD_SWORD)
};
private static final ItemStack IN_HAND = new ItemStack(Material.STONE);
public KitRock(ArcadeManager manager)
{
super(manager, "The Rock", "skywarsrock", KitAvailability.Gem, 4000, DESCRIPTION, new Perk[] { new PerkIronSkin(0.1) }, EntityType.ZOMBIE, IN_HAND);
setPerks(1, new Perk[] { new PerkIronSkin(0.15) });
setPerks(2, new Perk[] { new PerkIronSkin(0.2) });
setPerks(3, new Perk[] { new PerkIronSkin(0.25) });
setPerks(4, new Perk[] { new PerkIronSkin(0.3) });
setPerks(5, new Perk[] { new PerkIronSkin(0.35) });
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(PLAYER_ITEMS);
}
}

View File

@ -1,47 +0,0 @@
package nautilus.game.arcade.game.games.skywars.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 nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
import nautilus.game.arcade.kit.perks.PerkFletcher;
public class KitSharpshooter extends ProgressingKit
{
private static final String[] DESCRIPTION = {
"Start with " + C.cGreen + "Wood Pickaxe" + C.cGray + " and " + C.cGreen + "Bow",
"",
receiveArrowString(1, 12, 64)
};
private static final ItemStack[] PLAYER_ITEMS = {
new ItemStack(Material.WOOD_PICKAXE),
new ItemStack(Material.BOW)
};
private static final ItemStack IN_HAND = new ItemStack(Material.BOW);
public KitSharpshooter(ArcadeManager manager)
{
super(manager, "Sharpshooter", "skywarssharpshooter", KitAvailability.Gem, 4000, DESCRIPTION, new Perk[] { new PerkFletcher(12, 64, true, false) }, EntityType.ZOMBIE, IN_HAND);
setPerks(1, new Perk[] { new PerkFletcher(11, 4, true, false) });
setPerks(2, new Perk[] { new PerkFletcher(10, 4, true, false) });
setPerks(3, new Perk[] { new PerkFletcher(9, 4, true, false) });
setPerks(4, new Perk[] { new PerkFletcher(8, 4, true, false) });
setPerks(5, new Perk[] { new PerkFletcher(7, 4, true, false) });
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(PLAYER_ITEMS);
}
}

View File

@ -1,44 +0,0 @@
package nautilus.game.arcade.game.games.skywars.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 nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
import nautilus.game.arcade.kit.perks.PerkKnockback;
public class KitTank extends ProgressingKit
{
private static final String[] DESCRIPTION = {
"Start with " + C.cGreen + "Wood Sword",
"",
"Take 25% Less Knockback from all sources"
};
private static final ItemStack[] PLAYER_ITEMS = { new ItemStack(Material.WOOD_SWORD), };
private static final ItemStack IN_HAND = new ItemStack(Material.WOOD_SWORD);
public KitTank(ArcadeManager manager)
{
super(manager, "Tank", "skywarstank", KitAvailability.Free, DESCRIPTION, new Perk[] { new PerkKnockback(0.75) }, EntityType.ZOMBIE, IN_HAND);
setPerks(1, new Perk[] { new PerkKnockback(0.76) });
setPerks(2, new Perk[] { new PerkKnockback(0.77) });
setPerks(3, new Perk[] { new PerkKnockback(0.78) });
setPerks(4, new Perk[] { new PerkKnockback(0.79) });
setPerks(5, new Perk[] { new PerkKnockback(0.80) });
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(PLAYER_ITEMS);
}
}

View File

@ -51,17 +51,36 @@ import net.minecraft.server.v1_8_R3.World;
*/
public abstract class ProgressingKit extends Kit implements ProgressiveKit
{
private static final FireworkEffect EFFECT = FireworkEffect.builder()
.withColor(Color.AQUA)
.with(Type.BALL)
.build();
private static final FireworkEffect EFFECT = FireworkEffect.builder().withColor(Color.AQUA).with(Type.BALL).build();
private String _internalName;
private PlayerKitDataManager _dataManager;
private HashMap<Integer, ArrayList<KitAbilityDetail>> _kitAbilityDetails;
private Perk[][] _perks;
public ProgressingKit(ArcadeManager manager, String name, String internalName, KitAvailability kitAvailability, String[] kitDesc, Perk[][] kitPerks, EntityType entityType, ItemStack itemInHand)
{
super(manager, name, kitAvailability, kitDesc, kitPerks[0], entityType, itemInHand);
_internalName = internalName;
_dataManager = manager.getKitProgressionManager().getDataManager();
_kitAbilityDetails = Maps.newHashMap();
_perks = new Perk[6][kitPerks.length];
ArrayList<KitAbilityDetail> details = Lists.newArrayList();
for (int level = 0; level < kitPerks.length; level++)
{
Perk[] perks = kitPerks[level];
for (Perk perk : perks)
{
details.add(new KitAbilityDetail(perk.getIcon(), perk.GetName(), perk.GetDesc()));
perk.SetHost(this);
}
_kitAbilityDetails.put(level, details);
}
}
public ProgressingKit(ArcadeManager manager, String name, String internalName, KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand)
{
super(manager, name, kitAvailability, kitDesc, kitPerks, entityType, itemInHand);
@ -69,7 +88,7 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
_dataManager = manager.getKitProgressionManager().getDataManager();
_kitAbilityDetails = Maps.newHashMap();
_perks = new Perk[6][kitPerks.length];
ArrayList<KitAbilityDetail> details = Lists.newArrayList();
for (Perk perk : kitPerks)
{
@ -78,14 +97,15 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
_kitAbilityDetails.put(0, details);
}
public ProgressingKit(ArcadeManager manager, String name, String internalName, KitAvailability kitAvailability, int cost, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand)
public ProgressingKit(ArcadeManager manager, String name, String internalName, KitAvailability kitAvailability, int cost, String[] kitDesc, Perk[] kitPerks, EntityType entityType,
ItemStack itemInHand)
{
super(manager, name, kitAvailability, cost, kitDesc, kitPerks, entityType, itemInHand);
_internalName = internalName;
_dataManager = manager.getKitProgressionManager().getDataManager();
_kitAbilityDetails = Maps.newHashMap();
_perks = new Perk[6][kitPerks.length];
ArrayList<KitAbilityDetail> details = Lists.newArrayList();
for (Perk perk : kitPerks)
{
@ -94,7 +114,6 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
_kitAbilityDetails.put(0, details);
}
@Override
public String getDisplayName()
{
@ -188,7 +207,7 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
@Override
public void onSelected(UUID player)
{
if(Manager.GetGame().GetType() == GameType.Evolution)
if (Manager.GetGame().GetType() == GameType.Evolution)
{
Evolution evolution = (Evolution) Manager.GetGame();
evolution.select(player, this);
@ -207,7 +226,7 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
bukkitPlayer.sendMessage(F.main("Kit", "Set " + C.cYellowB + getDisplayName() + C.cGray + " as your default kit."));
bukkitPlayer.closeInventory();
//Undefault any kits and update the DB
// Undefault any kits and update the DB
for (Kit kit : Manager.GetGame().GetKits())
{
if (kit instanceof ProgressingKit)
@ -307,19 +326,15 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
{
Donor donor = Manager.GetDonation().Get(player);
if (this.GetAvailability() == KitAvailability.Free ||
Manager.hasKitsUnlocked(player) ||
(this.GetAvailability() == KitAvailability.Achievement && Manager.GetAchievement().hasCategory(player, this.getAchievementRequirement())) ||
donor.OwnsUnknownPackage(Manager.GetGame().GetType().GetKitGameName(Manager.GetGame()) + " " + this.GetName()) ||
Manager.GetClients().Get(player).GetRank().has(Rank.MAPDEV) ||
donor.OwnsUnknownPackage(Manager.GetServerConfig().ServerType + " ULTRA") || Manager.GetServerConfig().Tournament)
if (this.GetAvailability() == KitAvailability.Free || Manager.hasKitsUnlocked(player) || (this.GetAvailability() == KitAvailability.Achievement && Manager.GetAchievement().hasCategory(player,
this.getAchievementRequirement())) || donor.OwnsUnknownPackage(Manager.GetGame().GetType().GetKitGameName(Manager.GetGame()) + " " + this.GetName()) || Manager.GetClients().Get(player)
.GetRank().has(Rank.MAPDEV) || donor.OwnsUnknownPackage(Manager.GetServerConfig().ServerType + " ULTRA") || Manager.GetServerConfig().Tournament)
{
return true;
}
else if (this.GetAvailability() == KitAvailability.Gem && donor.GetBalance(CurrencyType.GEM) >= this.GetCost())
{
Manager.GetShop().openPageForPlayer(player, new ConfirmationPage<>(
Manager, Manager.GetShop(), Manager.GetClients(), Manager.GetDonation(), () -> {
Manager.GetShop().openPageForPlayer(player, new ConfirmationPage<>(Manager, Manager.GetShop(), Manager.GetClients(), Manager.GetDonation(), () -> {
if (player.isOnline())
{
Manager.GetGame().SetKit(player, this, true);
@ -338,34 +353,6 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
}
return false;
}
public void setPerks(int level, Perk[] perks)
{
_perks[level] = perks;
ArrayList<KitAbilityDetail> details = Lists.newArrayList();
for (Perk perk : perks)
{
details.add(new KitAbilityDetail(perk.getIcon(), perk.GetName(), perk.GetDesc()));
perk.SetHost(this);
}
_kitAbilityDetails.put(level, details);
}
public void setPerks(Perk[] perks)
{
for (int i = 1; i <= 5; i++)
{
setPerks(i, perks);
}
}
public void setOtherPerks(int level, String... detail)
{
ArrayList<KitAbilityDetail> details = _kitAbilityDetails.get(level);
//details.add(new KitAbilityDetail(getIcon(), KitMenu.OTHER_PERK_META, detail));
_kitAbilityDetails.put(level, details);
}
public Perk[][] getPerks()
{
@ -379,8 +366,7 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
public static String receiveItem(String item, int amount, double time, int max)
{
return "Receive " + C.cGreen + amount + C.cWhite + " " + item + " every " + C.cGreen + time + C.cWhite + " second" + (time == 1 ? "" : "s") +
(max > 0 ? ". Max " + C.cGreen + max : "");
return "Receive " + C.cGreen + amount + C.cWhite + " " + item + " every " + C.cGreen + time + C.cWhite + " second" + (time == 1 ? "" : "s") + (max > 0 ? ". Max " + C.cGreen + max : "");
}
public static String click(boolean left, String comp)
@ -406,7 +392,6 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
this.a(0.25F, 0.25F);
}
@Override
public void t_()
{
@ -427,7 +412,8 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
{
(((CraftPlayer) player).getHandle()).playerConnection.sendPacket(new PacketPlayOutEntityStatus(this, (byte) 17));
}
} else
}
else
{
world.broadcastEntityEffect(this, (byte) 17);
}
@ -451,7 +437,8 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
firework.setInvisible(true);
}
} catch (Exception e)
}
catch (Exception e)
{
e.printStackTrace();
}

View File

@ -1,100 +0,0 @@
package nautilus.game.arcade.kit.perks;
import org.bukkit.Material;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilItem.ArmorMaterial;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import nautilus.game.arcade.kit.Perk;
public class PerkArmorUpgrade extends Perk
{
private static final ArmorMaterial[] ARMOR_PRIORTY = new ArmorMaterial[] {
ArmorMaterial.LEATHER,
ArmorMaterial.GOLD,
ArmorMaterial.CHAINMAIL,
ArmorMaterial.IRON,
ArmorMaterial.DIAMOND
};
public PerkArmorUpgrade()
{
super("Armor Upgrade", new String[] { "Every time you kill a player your weakest piece of armor is upgrade by 1 tier" });
}
@EventHandler(priority = EventPriority.LOWEST)
public void onDeath(CombatDeathEvent event)
{
LivingEntity player = event.GetEvent().getEntity().getKiller();
if (!(player instanceof Player))
{
return;
}
if (!Kit.HasKit((Player) player))
{
return;
}
ItemStack[] armorContents = player.getEquipment().getArmorContents();
ItemStack worstItem = null;
int worst = ARMOR_PRIORTY.length - 1;
int index = 0;
for (int i = 0; i < armorContents.length; i++)
{
ItemStack itemStack = armorContents[i];
if (!UtilItem.isArmor(itemStack))
{
continue;
}
int cur = getIndex(ArmorMaterial.of(itemStack.getType()));
if (cur <= worst)
{
worstItem = itemStack;
worst = cur;
index = i;
}
}
if (worst == ARMOR_PRIORTY.length - 1)
{
return;
}
String worstItemPart = worstItem.getType().name().split("_")[1];
String worstItemTier = ARMOR_PRIORTY[worst].name();
String newItemTier = ARMOR_PRIORTY[worst + 1].name();
worstItem = new ItemStack(Material.valueOf(newItemTier + "_" + worstItemPart));
armorContents[index] = worstItem;
player.getEquipment().setArmorContents(armorContents);
player.sendMessage(F.main("Skill", "Your " + C.mSkill + formatItem(worstItemTier, worstItemPart) + C.cGray + " just upgraded to " + C.mSkill + formatItem(newItemTier, worstItemPart) + C.cGray + " by " + C.mSkill + "Armor Upgrade" + C.cGray + "."));
}
private int getIndex(ArmorMaterial armorMaterial)
{
for (int i = 0; i < ARMOR_PRIORTY.length; i++)
{
ArmorMaterial armorMaterial2 = ARMOR_PRIORTY[i];
if (armorMaterial == armorMaterial2)
return i;
}
return 0;
}
private String formatItem(String tier, String part)
{
return Character.toUpperCase(tier.charAt(0)) + tier.substring(1).toLowerCase() + " " + Character.toUpperCase(part.charAt(0)) + part.substring(1).toLowerCase();
}
}

View File

@ -8,60 +8,82 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
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.UtilTime;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.kit.Perk;
public class PerkDirtCannon extends Perk implements IThrown
{
private long _cooldown;
private long _lastDirt;
private double _targetKnockback;
private double _playerKnockback;
public PerkDirtCannon(long cooldown, double targetKnockback, double playerKnockback)
private static final ItemStack DIRT_ITEM = new ItemBuilder(Material.DIRT).setTitle(C.cGreen + "Throwable Dirt").setGlow(true).build();
public PerkDirtCannon(double targetKnockback, double playerKnockback)
{
super("Dirt Cannon", new String[] { C.cYellow + "Right-Click" + C.cGray + " to fire " + C.cGreen + "Dirt Cannon" });
_cooldown = cooldown;
_targetKnockback = targetKnockback;
_playerKnockback = playerKnockback;
_lastDirt = 0;
}
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event)
{
if (event.isCancelled())
return;
if (event.getAction() != Action.RIGHT_CLICK_AIR)
{
return;
}
Player player = event.getPlayer();
if (player.getItemInHand() == null)
{
return;
if (player.getItemInHand().getType() != Material.WOOD_SPADE)
}
if (!isDirtItem(player.getItemInHand()))
{
return;
}
if (!Kit.HasKit(player))
{
return;
if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true))
return;
}
if (UtilEnt.isGrounded(player))
{
player.setVelocity(player.getLocation().getDirection().setY(0).multiply(-_playerKnockback));
player.setVelocity(player.getLocation().getDirection().setY(0.25).multiply(-_playerKnockback));
}
int amount = player.getInventory().getItemInHand().getAmount() - 1;
if (amount == 0)
{
player.getInventory().remove(DIRT_ITEM);
}
else
{
player.getItemInHand().setAmount(amount);
}
@SuppressWarnings("deprecation")
FallingBlock fallingBlock = player.getWorld().spawnFallingBlock(player.getEyeLocation(), Material.DIRT, (byte) 0);
fallingBlock.setDropItem(false);
@ -69,6 +91,29 @@ public class PerkDirtCannon extends Perk implements IThrown
Manager.GetProjectile().AddThrow(fallingBlock, player, this, -1, true, true, true, true, false, 0);
}
@EventHandler
public void onUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
{
return;
}
if (UtilTime.elapsed(_lastDirt, 20000))
{
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (!Kit.HasKit(player) || player.getInventory().contains(DIRT_ITEM, 4))
{
continue;
}
player.getInventory().addItem(DIRT_ITEM);
}
_lastDirt = System.currentTimeMillis();
}
}
@EventHandler
public void onEntityChangeBlock(EntityChangeBlockEvent event)
{
@ -78,6 +123,26 @@ public class PerkDirtCannon extends Perk implements IThrown
}
}
@EventHandler
public void onBlockPlace(BlockPlaceEvent event)
{
if (isDirtItem(event.getItemInHand()))
{
event.getPlayer().sendMessage(F.main("Game", "You cannot place your skill item."));
event.setCancelled(true);
}
}
@EventHandler
public void onPlayerDropItem(PlayerDropItemEvent event)
{
if (isDirtItem(event.getItemDrop().getItemStack()))
{
event.getPlayer().sendMessage(F.main("Game", "You cannot drop this item."));
event.setCancelled(true);
}
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
@ -107,5 +172,25 @@ public class PerkDirtCannon extends Perk implements IThrown
{
}
private boolean isDirtItem(ItemStack itemStack)
{
if (itemStack == null)
{
return false;
}
if (itemStack.getItemMeta() == null)
{
return false;
}
if (itemStack.getItemMeta().getDisplayName().equals(DIRT_ITEM.getItemMeta().getDisplayName()))
{
return true;
}
return false;
}
}

View File

@ -1,19 +1,17 @@
package nautilus.game.arcade.kit.perks;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.scheduler.BukkitRunnable;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
@ -40,29 +38,45 @@ public class PerkFireBurst extends Perk
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event)
{
if (event.isCancelled())
return;
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
{
return;
}
Player player = event.getPlayer();
if (player.getItemInHand() == null)
{
return;
}
if (player.getItemInHand().getType() != Material.BLAZE_ROD)
{
return;
}
if (!Kit.HasKit(player))
{
return;
}
if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true))
{
return;
}
final Location location = player.getLocation().add(0, .25, 0);
Set<UUID> _damagedPlayers = new HashSet<>();
for (Player other : UtilPlayer.getNearby(location, _range, true))
{
if (other.getUniqueId().equals(player.getUniqueId()))
{
continue;
}
other.setFireTicks(60);
Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, _damage, true, false, true, player.getName(), "Fire Burst");
}
new BukkitRunnable()
{
@ -91,20 +105,18 @@ public class PerkFireBurst extends Perk
}
curRange += 0.5;
for (Player other : UtilPlayer.getNearby(location, _range, true))
{
if (_damagedPlayers.contains(other.getUniqueId()) || other.getUniqueId().equals(player.getUniqueId()))
{
continue;
}
_damagedPlayers.add(other.getUniqueId());
Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.FIRE, _damage, true, false, true, player.getName(), "Fire Burst");
}
}
}.runTaskTimer(Manager.getPlugin(), 0, 5);
}.runTaskTimer(Manager.getPlugin(), 0, 3);
}
@EventHandler
public void onPlayerDropItem(PlayerDropItemEvent event)
{
if (event.getItemDrop().getItemStack().getType() == Material.BLAZE_ROD)
{
event.getPlayer().sendMessage(F.main("Game", "You cannot drop this item."));
event.setCancelled(true);
}
}
}

View File

@ -1,154 +0,0 @@
package nautilus.game.arcade.kit.perks;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Bat;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilTime;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.kit.Perk;
public class PerkGrapple extends Perk
{
private long _cooldown;
private Map<UUID, Entity> _hooks = new HashMap<>();
private Map<UUID, Long> _lastUse = new HashMap<>();
public PerkGrapple(long cooldown)
{
super("Grapple", new String[] { "Hook has a 10 block radius. Fires a lead that sticks into the ground.", "Pulls the player to it with a second right click. 45 Second cooldown." });
_cooldown = cooldown;
}
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event)
{
if (event.getAction() != Action.RIGHT_CLICK_AIR)
{
return;
}
Player player = event.getPlayer();
if (!Kit.HasKit(player))
{
return;
}
if (player.getItemInHand() == null)
{
return;
}
if (player.getItemInHand().getType() != Material.TRIPWIRE_HOOK)
{
return;
}
if (_hooks.get(player.getUniqueId()) == null)
{
if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true))
{
return;
}
Vector direction = player.getLocation().getDirection();
Location location = player.getEyeLocation().add(direction);
for (int i = 0; i < 14; i++)
{
if (location.getBlock().getType() != Material.AIR)
{
Manager.GetGame().CreatureAllowOverride = true;
Bat bat = location.getWorld().spawn(location, Bat.class);
bat.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 0));
UtilEnt.Vegetate(bat);
bat.setLeashHolder(player);
_hooks.put(player.getUniqueId(), bat);
player.sendMessage(F.main("Game", "Your graple caught a block!"));
Manager.GetGame().CreatureAllowOverride = false;
break;
}
UtilParticle.PlayParticleToAll(ParticleType.CLOUD, location, 0F, 0F, 0F, 0.01F, 4, ViewDist.NORMAL);
location.add(direction);
}
}
else
{
Bat bat = (Bat) _hooks.get(player.getUniqueId());
Vector vector = UtilAlg.getTrajectory(player, bat).multiply(1.5);
if (vector.getY() < 1)
{
vector.setY(Math.max(1, 1 + vector.getY()));
}
player.setVelocity(vector);
bat.setLeashHolder(null);
bat.remove();
_hooks.put(player.getUniqueId(), null);
_lastUse.put(player.getUniqueId(), System.currentTimeMillis());
player.sendMessage(F.main("Game", "You used " + F.skill(GetName())));
}
}
@EventHandler
public void onUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
for (UUID uuid : _lastUse.keySet())
{
if (UtilTime.elapsed(_lastUse.get(uuid), 3000))
{
continue;
}
Player player = Bukkit.getPlayer(uuid);
if (UtilEnt.isGrounded(player))
{
continue;
}
UtilParticle.PlayParticleToAll(ParticleType.CLOUD, player.getLocation(), 0F, 0F, 0F, 0.01F, 4, ViewDist.NORMAL);
}
}
@EventHandler
public void onEntityDamage(EntityDamageEvent event)
{
if (_hooks.containsValue(event.getEntity()))
{
event.setCancelled(true);
}
}
}

View File

@ -9,13 +9,13 @@ import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerInteractEvent;
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.UtilPlayer;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
@ -41,29 +41,33 @@ public class PerkIceBridge extends Perk
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event)
{
if (event.isCancelled())
return;
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
{
return;
if (UtilBlock.usable(event.getClickedBlock()))
return;
}
Player player = event.getPlayer();
if (player.getItemInHand() == null)
{
return;
}
if (player.getItemInHand().getType() != Material.SNOW_BLOCK)
{
return;
}
if (!Kit.HasKit(player))
{
return;
}
if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true))
{
return;
}
player.teleport(player.getLocation().add(0, 1, 0));
UtilAction.velocity(player, new Vector(0, 0.5, 0));
@ -72,6 +76,7 @@ public class PerkIceBridge extends Perk
// Inform
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
}
@EventHandler
public void onUpdate(UpdateEvent event)
@ -99,4 +104,14 @@ public class PerkIceBridge extends Perk
}
}
@EventHandler
public void onPlayerDropItem(PlayerDropItemEvent event)
{
if (event.getItemDrop().getItemStack().getType() == Material.SNOW_BLOCK)
{
event.getPlayer().sendMessage(F.main("Game", "You cannot drop this item."));
event.setCancelled(true);
}
}
}

View File

@ -1,60 +0,0 @@
package nautilus.game.arcade.kit.perks;
import nautilus.game.arcade.kit.Perk;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.inventory.ItemStack;
public class PerkIncreaseOre extends Perk
{
private int extra;
private Material[] type;
public PerkIncreaseOre(int extra, Material[] type)
{
super("Lucky Miner", new String[] { "Every ore you mine drops another " + extra + " extra" });
this.extra = extra;
this.type = type;
}
@EventHandler(priority = EventPriority.LOWEST)
public void onBlockBreak(BlockBreakEvent event)
{
if (!Kit.HasKit(event.getPlayer()))
{
return;
}
Block block = event.getBlock();
boolean contains = false;
for (Material type : this.type)
{
if (block.getType() == type)
{
contains = true;
break;
}
}
if (!contains)
{
return;
}
String type = block.getType() == Material.DIAMOND_ORE || block.getType() == Material.COAL_ORE ? block.getType().name().split("_")[0] : block.getType().name().split("_")[0] + "_INGOT";
for (int i = 0; i < extra; i++)
{
event.getBlock().getWorld().dropItem(block.getLocation(), new ItemStack(Material.valueOf(type)));
}
}
}

View File

@ -1,65 +0,0 @@
package nautilus.game.arcade.kit.perks;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.recharge.Recharge;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.Perk;
public class PerkThorns extends Perk
{
private double _damage;
private double _cooldown;
public PerkThorns(double damage, double cooldown)
{
super("Thorns", new String[] { "For each piece of armor you equip you reflect " + damage, "Cooldown of " + cooldown + " seconds" });
this._damage = damage;
this._cooldown = cooldown;
}
@EventHandler
public void onDamage(CustomDamageEvent event)
{
if (!Kit.HasKit(event.GetDamageePlayer()))
{
return;
}
if (event.GetCause() == DamageCause.FALL || event.GetCause() == DamageCause.PROJECTILE)
{
return;
}
if(!Recharge.Instance.use(event.GetDamageePlayer(), "Thorns", (long) _cooldown * 1000, false, false))
return;
double totalDamage = 0;
for (ItemStack itemStack : event.GetDamageeEntity().getEquipment().getArmorContents())
{
if (itemStack == null || itemStack.getType() == Material.AIR)
{
continue;
}
totalDamage += _damage;
}
if (totalDamage == 0)
{
return;
}
Manager.GetDamage().NewDamageEvent(event.GetDamagerEntity(false), event.GetDamageeEntity(), event.GetProjectile(), DamageCause.THORNS, totalDamage * 2, false, true, true, event.GetDamageeEntity().getName(), "Thorns");
event.GetDamagerPlayer(false).sendMessage(F.main("Skill", C.cYellow + event.GetDamageeEntity().getName() + C.cGray + " used" + C.mSkill + " Thorns" + C.cGray + "."));
event.GetDamageePlayer().sendMessage(F.main("Skill", "You used" + C.mSkill + " Thorns" + C.cGray + " on " + C.cYellow + event.GetDamagerEntity(false).getName() + C.cGray + "."));
}
}

View File

@ -1,16 +1,23 @@
package nautilus.game.arcade.kit.perks;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
@ -20,58 +27,21 @@ import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
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.kit.Perk;
public class PerkVoidSaver extends Perk
{
private Map<UUID, Location> _safeLocations = new HashMap<>();
private List<UUID> _used = new ArrayList<>();
public PerkVoidSaver()
{
super("Void Saver", new String[] { C.cGray + "If you fall into the void you are teleported to a safe location" });
}
@EventHandler
public void onUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
{
return;
}
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (!Kit.HasKit(player) || !player.getInventory().contains(Material.EYE_OF_ENDER))
{
continue;
}
if (player.getFallDistance() > 20)
{
if (_safeLocations.get(player.getUniqueId()) == null)
{
continue;
}
player.setFallDistance(0);
player.teleport(_safeLocations.get(player.getUniqueId()));
player.getInventory().remove(Material.EYE_OF_ENDER);
player.sendMessage(F.main("Game", "You used your safe teleport."));
player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1, 0);
UtilParticle.PlayParticleToAll(ParticleType.WITCH_MAGIC, player.getEyeLocation(), 0.5F, 0.5F, 0.5F, 0.5F, 10, ViewDist.NORMAL);
continue;
}
if (!UtilEnt.isGrounded(player))
{
continue;
}
_safeLocations.put(player.getUniqueId(), player.getLocation());
}
}
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event)
{
@ -79,16 +49,93 @@ public class PerkVoidSaver extends Perk
{
return;
}
Player player = event.getPlayer();
if (player.getItemInHand() == null)
{
return;
}
if (player.getItemInHand().getType() != Material.EYE_OF_ENDER)
{
return;
}
event.setCancelled(true);
if (!Kit.HasKit(player) || _used.contains(player.getUniqueId()))
{
return;
}
if (_safeLocations.get(player.getUniqueId()) == null)
{
return;
}
player.setFallDistance(0);
player.teleport(_safeLocations.get(player.getUniqueId()));
player.getInventory().remove(Material.EYE_OF_ENDER);
player.sendMessage(F.main("Game", "You used your safe teleport."));
player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1, 0);
UtilParticle.PlayParticleToAll(ParticleType.WITCH_MAGIC, player.getEyeLocation(), 0.5F, 0.5F, 0.5F, 0.5F, 10, ViewDist.NORMAL);
_used.add(player.getUniqueId());
}
@EventHandler
public void onUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
{
return;
}
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (!Kit.HasKit(player) || _used.contains(player.getUniqueId()) || !UtilEnt.isGrounded(player))
{
continue;
}
_safeLocations.put(player.getUniqueId(), player.getLocation());
}
}
@EventHandler
public void onPlayerDropItem(PlayerDropItemEvent event)
{
if (event.getItemDrop().getItemStack().getType() == Material.EYE_OF_ENDER)
{
event.getPlayer().sendMessage(F.main("Game", "You cannot drop this item."));
event.setCancelled(true);
}
}
@EventHandler
public void onPlayerDeath(PlayerDeathEvent event)
{
Iterator<ItemStack> iterator = event.getDrops().iterator();
while (iterator.hasNext())
{
ItemStack itemStack = iterator.next();
if (itemStack.getType() == Material.EYE_OF_ENDER)
{
iterator.remove();
}
}
}
@EventHandler
public void onGameStateChange(GameStateChangeEvent event)
{
if (event.GetState() == GameState.WinRoom)
{
Bukkit.broadcastMessage("Clearing!");
_used.clear();
}
}
}