SG Update
This commit is contained in:
parent
7aec2d572b
commit
0a683416ff
@ -100,10 +100,12 @@ public class WorldUtil
|
|||||||
internal.setSpawnFlags(true, true);
|
internal.setSpawnFlags(true, true);
|
||||||
server.getServer().worlds.add(internal);
|
server.getServer().worlds.add(internal);
|
||||||
|
|
||||||
|
/*
|
||||||
for (WorldServer worlder : server.getServer().worlds)
|
for (WorldServer worlder : server.getServer().worlds)
|
||||||
{
|
{
|
||||||
System.out.println(worlder.getWorldData().getName() + " with dimension: " + worlder.dimension);
|
System.out.println(worlder.getWorldData().getName() + " with dimension: " + worlder.dimension);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if (generator != null)
|
if (generator != null)
|
||||||
{
|
{
|
||||||
@ -113,10 +115,12 @@ public class WorldUtil
|
|||||||
server.getPluginManager().callEvent(new WorldInitEvent(internal.getWorld()));
|
server.getPluginManager().callEvent(new WorldInitEvent(internal.getWorld()));
|
||||||
server.getPluginManager().callEvent(new WorldLoadEvent(internal.getWorld()));
|
server.getPluginManager().callEvent(new WorldLoadEvent(internal.getWorld()));
|
||||||
|
|
||||||
|
/*
|
||||||
for (WorldServer worlder : server.getServer().worlds)
|
for (WorldServer worlder : server.getServer().worlds)
|
||||||
{
|
{
|
||||||
System.out.println(worlder.getWorldData().getName() + " with dimension: " + worlder.dimension);
|
System.out.println(worlder.getWorldData().getName() + " with dimension: " + worlder.dimension);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
return internal.getWorld();
|
return internal.getWorld();
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,6 @@ import org.bukkit.event.block.BlockBreakEvent;
|
|||||||
import org.bukkit.event.entity.ItemSpawnEvent;
|
import org.bukkit.event.entity.ItemSpawnEvent;
|
||||||
import org.bukkit.event.inventory.InventoryPickupItemEvent;
|
import org.bukkit.event.inventory.InventoryPickupItemEvent;
|
||||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
public class AntiStack extends MiniPlugin
|
public class AntiStack extends MiniPlugin
|
||||||
@ -33,6 +32,9 @@ public class AntiStack extends MiniPlugin
|
|||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void BlockBreak(BlockBreakEvent event)
|
public void BlockBreak(BlockBreakEvent event)
|
||||||
{
|
{
|
||||||
|
if (!_enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
if (event.isCancelled())
|
if (event.isCancelled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -42,6 +44,9 @@ public class AntiStack extends MiniPlugin
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void ClearIgnoreAround(UpdateEvent event)
|
public void ClearIgnoreAround(UpdateEvent event)
|
||||||
{
|
{
|
||||||
|
if (!_enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
if (event.getType() != UpdateType.TICK)
|
if (event.getType() != UpdateType.TICK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -21,6 +21,11 @@ import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
|||||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.block.BlockBurnEvent;
|
||||||
|
import org.bukkit.event.block.BlockFadeEvent;
|
||||||
|
import org.bukkit.event.block.BlockSpreadEvent;
|
||||||
|
import org.bukkit.event.block.LeavesDecayEvent;
|
||||||
|
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerLoginEvent;
|
import org.bukkit.event.player.PlayerLoginEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
@ -527,4 +532,39 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
|||||||
{
|
{
|
||||||
_classCustomBuildShop.attemptShopOpen(player);
|
_classCustomBuildShop.attemptShopOpen(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void BlockBurn(BlockBurnEvent event)
|
||||||
|
{
|
||||||
|
if (_game == null)
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void BlockSpread(BlockSpreadEvent event)
|
||||||
|
{
|
||||||
|
if (_game == null)
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void BlockFade(BlockFadeEvent event)
|
||||||
|
{
|
||||||
|
if (_game == null)
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void BlockDecay(LeavesDecayEvent event)
|
||||||
|
{
|
||||||
|
if (_game == null)
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void MobSpawn(CreatureSpawnEvent event)
|
||||||
|
{
|
||||||
|
if (_game == null)
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ public enum GameType
|
|||||||
Halloween("Halloween Horror"),
|
Halloween("Halloween Horror"),
|
||||||
HideSeek("Block Hunt"),
|
HideSeek("Block Hunt"),
|
||||||
Horse("Horseback"),
|
Horse("Horseback"),
|
||||||
HungerGames("Hunger Games"),
|
HungerGames("Survival Games"),
|
||||||
MineWare("MineWare"),
|
MineWare("MineWare"),
|
||||||
MilkCow("Milk the Cow"),
|
MilkCow("Milk the Cow"),
|
||||||
Paintball("Super Paintball"),
|
Paintball("Super Paintball"),
|
||||||
|
@ -45,6 +45,7 @@ import org.bukkit.inventory.meta.FireworkMeta;
|
|||||||
|
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.common.util.UtilBlock;
|
||||||
import mineplex.core.common.util.UtilEvent;
|
import mineplex.core.common.util.UtilEvent;
|
||||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||||
import mineplex.core.common.util.UtilInv;
|
import mineplex.core.common.util.UtilInv;
|
||||||
@ -690,7 +691,6 @@ public class HideSeek extends TeamGame
|
|||||||
else if (UtilGear.isMat(player.getItemInHand(), Material.STONE_AXE))
|
else if (UtilGear.isMat(player.getItemInHand(), Material.STONE_AXE))
|
||||||
{
|
{
|
||||||
Manager.GetCondition().Factory().Speed("Boost", player, player, 4, 1, false, false, false);
|
Manager.GetCondition().Factory().Speed("Boost", player, player, 4, 1, false, false, false);
|
||||||
Manager.GetCondition().Factory().Regen("Boost", player, player, 4, 0, false, false, false);
|
|
||||||
|
|
||||||
//Inform
|
//Inform
|
||||||
UtilPlayer.message(player, F.main("Game", "You used " + F.elem("Ultra Boost") + "!"));
|
UtilPlayer.message(player, F.main("Game", "You used " + F.elem("Ultra Boost") + "!"));
|
||||||
@ -700,8 +700,8 @@ public class HideSeek extends TeamGame
|
|||||||
}
|
}
|
||||||
else if (UtilGear.isMat(player.getItemInHand(), Material.IRON_AXE))
|
else if (UtilGear.isMat(player.getItemInHand(), Material.IRON_AXE))
|
||||||
{
|
{
|
||||||
Manager.GetCondition().Factory().Speed("Boost", player, player, 4, 2, false, false, false);
|
Manager.GetCondition().Factory().Speed("Boost", player, player, 4, 1, false, false, false);
|
||||||
Manager.GetCondition().Factory().Regen("Boost", player, player, 4, 1, false, false, false);
|
Manager.GetCondition().Factory().Regen("Boost", player, player, 4, 0, false, false, false);
|
||||||
|
|
||||||
//Inform
|
//Inform
|
||||||
UtilPlayer.message(player, F.main("Game", "You used " + F.elem("Mega Boost") + "!"));
|
UtilPlayer.message(player, F.main("Game", "You used " + F.elem("Mega Boost") + "!"));
|
||||||
@ -711,8 +711,8 @@ public class HideSeek extends TeamGame
|
|||||||
}
|
}
|
||||||
else if (UtilGear.isMat(player.getItemInHand(), Material.DIAMOND_AXE))
|
else if (UtilGear.isMat(player.getItemInHand(), Material.DIAMOND_AXE))
|
||||||
{
|
{
|
||||||
Manager.GetCondition().Factory().Speed("Boost", player, player, 4, 3, false, false, false);
|
Manager.GetCondition().Factory().Speed("Boost", player, player, 4, 2, false, false, false);
|
||||||
Manager.GetCondition().Factory().Regen("Boost", player, player, 4, 2, false, false, false);
|
Manager.GetCondition().Factory().Regen("Boost", player, player, 4, 1, false, false, false);
|
||||||
|
|
||||||
//Inform
|
//Inform
|
||||||
UtilPlayer.message(player, F.main("Game", "You used " + F.elem("Hyper Boost") + "!"));
|
UtilPlayer.message(player, F.main("Game", "You used " + F.elem("Hyper Boost") + "!"));
|
||||||
@ -1037,4 +1037,14 @@ public class HideSeek extends TeamGame
|
|||||||
{
|
{
|
||||||
return DeathMessageType.Detailed;
|
return DeathMessageType.Detailed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void UsableCancel(PlayerInteractEvent event)
|
||||||
|
{
|
||||||
|
if (event.getClickedBlock() == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (UtilBlock.usable(event.getClickedBlock()))
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
package nautilus.game.arcade.game.games.hungergames;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
|
||||||
|
public class BlockChange
|
||||||
|
{
|
||||||
|
public Location Location;
|
||||||
|
public int Id;
|
||||||
|
public byte Data;
|
||||||
|
|
||||||
|
public BlockChange(Location loc, int id, byte data)
|
||||||
|
{
|
||||||
|
Location = loc;
|
||||||
|
Id = id;
|
||||||
|
Data = data;
|
||||||
|
}
|
||||||
|
}
|
@ -4,34 +4,59 @@ import java.util.AbstractMap;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Chunk;
|
||||||
|
import org.bukkit.Color;
|
||||||
import org.bukkit.Effect;
|
import org.bukkit.Effect;
|
||||||
|
import org.bukkit.FireworkEffect;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.FireworkEffect.Type;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.block.Chest;
|
import org.bukkit.block.Chest;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Snowball;
|
import org.bukkit.entity.Snowball;
|
||||||
|
import org.bukkit.entity.TNTPrimed;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.block.Action;
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
|
import org.bukkit.event.block.BlockBurnEvent;
|
||||||
|
import org.bukkit.event.block.BlockFadeEvent;
|
||||||
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
|
import org.bukkit.event.block.BlockSpreadEvent;
|
||||||
|
import org.bukkit.event.block.LeavesDecayEvent;
|
||||||
|
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||||
import org.bukkit.event.entity.ItemSpawnEvent;
|
import org.bukkit.event.entity.ItemSpawnEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.MapUtil;
|
import mineplex.core.common.util.MapUtil;
|
||||||
|
import mineplex.core.common.util.UtilAction;
|
||||||
import mineplex.core.common.util.UtilAlg;
|
import mineplex.core.common.util.UtilAlg;
|
||||||
import mineplex.core.common.util.UtilBlock;
|
import mineplex.core.common.util.UtilBlock;
|
||||||
import mineplex.core.common.util.UtilEnt;
|
import mineplex.core.common.util.UtilEnt;
|
||||||
|
import mineplex.core.common.util.UtilFirework;
|
||||||
|
import mineplex.core.common.util.UtilInv;
|
||||||
import mineplex.core.common.util.UtilMath;
|
import mineplex.core.common.util.UtilMath;
|
||||||
|
import mineplex.core.common.util.UtilParticle;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||||
import mineplex.core.common.util.UtilServer;
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||||
|
import mineplex.core.common.util.UtilWorld;
|
||||||
import mineplex.core.itemstack.ItemStackFactory;
|
import mineplex.core.itemstack.ItemStackFactory;
|
||||||
|
import mineplex.core.recharge.Recharge;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||||
@ -45,8 +70,15 @@ import nautilus.game.arcade.kit.Kit;
|
|||||||
public class HungerGames extends SoloGame
|
public class HungerGames extends SoloGame
|
||||||
{
|
{
|
||||||
private HashSet<Location> _openedChest = new HashSet<Location>();
|
private HashSet<Location> _openedChest = new HashSet<Location>();
|
||||||
private ArrayList<ItemStack> _chestLoot = new ArrayList<ItemStack>();
|
private ArrayList<ItemStack> _baseChestLoot = new ArrayList<ItemStack>();
|
||||||
|
private ArrayList<ItemStack> _superChestLoot = new ArrayList<ItemStack>();
|
||||||
|
|
||||||
|
//Misc
|
||||||
|
private HashMap<Entity, Player> _tntMap = new HashMap<Entity, Player>();
|
||||||
|
private HashSet<Location> _placedBlocks = new HashSet<Location>();
|
||||||
|
|
||||||
|
//Creep
|
||||||
|
private int _maxSpreadRate = 60;
|
||||||
private ArrayList<Location> _redLocations = new ArrayList<Location>();
|
private ArrayList<Location> _redLocations = new ArrayList<Location>();
|
||||||
private int _spreadType = 0;
|
private int _spreadType = 0;
|
||||||
private String _spreadName = "";
|
private String _spreadName = "";
|
||||||
@ -55,6 +87,15 @@ public class HungerGames extends SoloGame
|
|||||||
private Location _spreadSafe = null;
|
private Location _spreadSafe = null;
|
||||||
private HashMap<Player, Long> _redOutTime = new HashMap<Player, Long>();
|
private HashMap<Player, Long> _redOutTime = new HashMap<Player, Long>();
|
||||||
|
|
||||||
|
private ArrayList<BlockChange> _redQueue = new ArrayList<BlockChange>();
|
||||||
|
|
||||||
|
//Supply Drop
|
||||||
|
private ArrayList<Location> _supplyLocations = new ArrayList<Location>();
|
||||||
|
private Location _supplyCurrent = null;
|
||||||
|
private Location _supplyEffect = null;
|
||||||
|
private ArrayList<Block> _supplyChests = new ArrayList<Block>();
|
||||||
|
|
||||||
|
//Debug
|
||||||
private long totalTime = 0;
|
private long totalTime = 0;
|
||||||
|
|
||||||
public HungerGames(ArcadeManager manager)
|
public HungerGames(ArcadeManager manager)
|
||||||
@ -63,14 +104,14 @@ public class HungerGames extends SoloGame
|
|||||||
|
|
||||||
new Kit[]
|
new Kit[]
|
||||||
{
|
{
|
||||||
new KitHunter(manager),
|
new KitAxeman(manager),
|
||||||
new KitLooter(manager),
|
//new KitLooter(manager),
|
||||||
new KitKnight(manager),
|
new KitKnight(manager),
|
||||||
|
|
||||||
new KitArcher(manager),
|
new KitArcher(manager),
|
||||||
new KitAssassin(manager),
|
|
||||||
new KitBrawler(manager),
|
new KitBrawler(manager),
|
||||||
|
|
||||||
|
new KitAssassin(manager),
|
||||||
new KitBeastmaster(manager),
|
new KitBeastmaster(manager),
|
||||||
new KitBomber(manager),
|
new KitBomber(manager),
|
||||||
new KitNecromancer(manager)
|
new KitNecromancer(manager)
|
||||||
@ -78,11 +119,16 @@ public class HungerGames extends SoloGame
|
|||||||
|
|
||||||
new String[]
|
new String[]
|
||||||
{
|
{
|
||||||
"Scavenge supplies to survive.",
|
"Search for chests to find loot",
|
||||||
"Playable area shrinks over time!",
|
"Slaughter your opponents",
|
||||||
"Last player alive wins!"
|
"Stay away from the Deep Freeze!",
|
||||||
|
"Last tribute alive wins!"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Manager.GetAntiStack().SetEnabled(false);
|
||||||
|
|
||||||
|
this.WorldTimeSet = 13000;
|
||||||
|
|
||||||
this.SpawnDistanceRequirement = 48;
|
this.SpawnDistanceRequirement = 48;
|
||||||
|
|
||||||
this.DamageSelf = true;
|
this.DamageSelf = true;
|
||||||
@ -98,10 +144,27 @@ public class HungerGames extends SoloGame
|
|||||||
|
|
||||||
this.GemMultiplier = 2;
|
this.GemMultiplier = 2;
|
||||||
|
|
||||||
|
//Blocks
|
||||||
|
this.BlockBreakAllow.add(30); //Web
|
||||||
|
this.BlockPlaceAllow.add(30);
|
||||||
|
|
||||||
|
this.BlockBreakAllow.add(132); //Tripwire
|
||||||
|
this.BlockPlaceAllow.add(132);
|
||||||
|
|
||||||
|
this.BlockBreakAllow.add(131); //Wire Hook
|
||||||
|
this.BlockPlaceAllow.add(131);
|
||||||
|
|
||||||
|
this.BlockBreakAllow.add(55); //Redstone Dust
|
||||||
|
this.BlockPlaceAllow.add(55);
|
||||||
|
|
||||||
|
this.BlockBreakAllow.add(72); //Wood Pressure Plate
|
||||||
|
this.BlockPlaceAllow.add(72);
|
||||||
|
|
||||||
|
this.BlockBreakAllow.add(69); //Lever
|
||||||
|
this.BlockPlaceAllow.add(69);
|
||||||
|
|
||||||
|
//SPREAD
|
||||||
_spreadType = 1;//UtilMath.r(3);
|
_spreadType = 1;//UtilMath.r(3);
|
||||||
System.out.println("===================");
|
|
||||||
System.out.println("SPREAD TYPE: " + _spreadType);
|
|
||||||
System.out.println("===================");
|
|
||||||
|
|
||||||
_spreadTypeBlocks = new ArrayList<Entry<Integer, Integer>>();
|
_spreadTypeBlocks = new ArrayList<Entry<Integer, Integer>>();
|
||||||
|
|
||||||
@ -122,11 +185,17 @@ public class HungerGames extends SoloGame
|
|||||||
else if (_spreadType == 2)
|
else if (_spreadType == 2)
|
||||||
{
|
{
|
||||||
_spreadName = "Nether Corruption";
|
_spreadName = "Nether Corruption";
|
||||||
|
_ignoreLiquids = false;
|
||||||
|
_spreadTypeBlocks.add(new AbstractMap.SimpleEntry<Integer, Integer>(49, 0));
|
||||||
_spreadTypeBlocks.add(new AbstractMap.SimpleEntry<Integer, Integer>(87, 0));
|
_spreadTypeBlocks.add(new AbstractMap.SimpleEntry<Integer, Integer>(87, 0));
|
||||||
_spreadTypeBlocks.add(new AbstractMap.SimpleEntry<Integer, Integer>(88, 0));
|
_spreadTypeBlocks.add(new AbstractMap.SimpleEntry<Integer, Integer>(88, 0));
|
||||||
_spreadTypeBlocks.add(new AbstractMap.SimpleEntry<Integer, Integer>(89, 0));
|
_spreadTypeBlocks.add(new AbstractMap.SimpleEntry<Integer, Integer>(89, 0));
|
||||||
_spreadTypeBlocks.add(new AbstractMap.SimpleEntry<Integer, Integer>(153, 0));
|
_spreadTypeBlocks.add(new AbstractMap.SimpleEntry<Integer, Integer>(153, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
System.out.println("===================");
|
||||||
|
System.out.println("CREEP TYPE: " + _spreadName);
|
||||||
|
System.out.println("===================");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -135,16 +204,54 @@ public class HungerGames extends SoloGame
|
|||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@Override
|
||||||
public void BlockBreak(BlockBreakEvent event)
|
public void ParseData()
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
CreateChestCraftEnchant();
|
||||||
event.getBlock().setTypeId(0);
|
|
||||||
event.getBlock().getWorld().playEffect(event.getBlock().getLocation(), Effect.STEP_SOUND, event.getBlock().getTypeId());
|
_supplyLocations = WorldData.GetDataLocs("WHITE");
|
||||||
|
|
||||||
|
if (!WorldData.GetCustomLocs("VARS").isEmpty())
|
||||||
|
_maxSpreadRate = WorldData.GetCustomLocs("VARS").get(0).getBlockX();
|
||||||
}
|
}
|
||||||
|
|
||||||
//@EventHandler
|
private void CreateChestCraftEnchant()
|
||||||
public void CreateChests(GameStateChangeEvent event)
|
{
|
||||||
|
ArrayList<Location> chests = WorldData.GetCustomLocs("54");
|
||||||
|
|
||||||
|
System.out.println("Map Chest Locations: " + chests.size());
|
||||||
|
|
||||||
|
//Enchants
|
||||||
|
System.out.println("Enchanting Tables: " + Math.min(10, chests.size()));
|
||||||
|
for (int i=0 ; i<10 && !chests.isEmpty() ; i++)
|
||||||
|
{
|
||||||
|
Location loc = chests.remove(UtilMath.r(chests.size()));
|
||||||
|
loc.getBlock().setType(Material.ENCHANTMENT_TABLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Crafting
|
||||||
|
System.out.println("Crafting Benches: " + Math.min(20, chests.size()));
|
||||||
|
for (int i=0 ; i<20 && !chests.isEmpty() ; i++)
|
||||||
|
{
|
||||||
|
Location loc = chests.remove(UtilMath.r(chests.size()));
|
||||||
|
loc.getBlock().setType(Material.WORKBENCH);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Chests
|
||||||
|
System.out.println("Chests: " + Math.min(180, chests.size()));
|
||||||
|
for (int i=0 ; i<180 && !chests.isEmpty() ; i++)
|
||||||
|
{
|
||||||
|
chests.remove(UtilMath.r(chests.size()));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Location loc : chests)
|
||||||
|
{
|
||||||
|
loc.getBlock().setType(Material.AIR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void CreateRandomChests(GameStateChangeEvent event)
|
||||||
{
|
{
|
||||||
if (event.GetState() != GameState.Recruit)
|
if (event.GetState() != GameState.Recruit)
|
||||||
return;
|
return;
|
||||||
@ -158,7 +265,7 @@ public class HungerGames extends SoloGame
|
|||||||
|
|
||||||
int done = 0;
|
int done = 0;
|
||||||
|
|
||||||
while (done < 256)
|
while (done < 20)
|
||||||
{
|
{
|
||||||
|
|
||||||
Block block = UtilBlock.getHighest(WorldData.World, WorldData.MinX + UtilMath.r(xDiff), WorldData.MinZ + UtilMath.r(zDiff), ignore);
|
Block block = UtilBlock.getHighest(WorldData.World, WorldData.MinX + UtilMath.r(xDiff), WorldData.MinZ + UtilMath.r(zDiff), ignore);
|
||||||
@ -169,32 +276,6 @@ public class HungerGames extends SoloGame
|
|||||||
block.setTypeIdAndData(54, (byte)UtilMath.r(4), true);
|
block.setTypeIdAndData(54, (byte)UtilMath.r(4), true);
|
||||||
done++;
|
done++;
|
||||||
}
|
}
|
||||||
|
|
||||||
done = 0;
|
|
||||||
|
|
||||||
while (done < 64)
|
|
||||||
{
|
|
||||||
|
|
||||||
Block block = UtilBlock.getHighest(WorldData.World, WorldData.MinX + UtilMath.r(xDiff), WorldData.MinZ + UtilMath.r(zDiff), ignore);
|
|
||||||
|
|
||||||
if (!UtilBlock.airFoliage(block) || !UtilBlock.solid(block.getRelative(BlockFace.DOWN)))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
block.setTypeIdAndData(58, (byte)0, true);
|
|
||||||
done++;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (done < 32)
|
|
||||||
{
|
|
||||||
|
|
||||||
Block block = UtilBlock.getHighest(WorldData.World, WorldData.MinX + UtilMath.r(xDiff), WorldData.MinZ + UtilMath.r(zDiff), ignore);
|
|
||||||
|
|
||||||
if (!UtilBlock.airFoliage(block) || !UtilBlock.solid(block.getRelative(BlockFace.DOWN)))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
block.setType(Material.ENCHANTMENT_TABLE);
|
|
||||||
done++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -218,76 +299,101 @@ public class HungerGames extends SoloGame
|
|||||||
|
|
||||||
chest.getBlockInventory().clear();
|
chest.getBlockInventory().clear();
|
||||||
|
|
||||||
int count = 1 + UtilMath.r(4);
|
int count = 1 + UtilMath.r(3);
|
||||||
|
|
||||||
if (GetKit(event.getPlayer()) instanceof KitLooter)
|
if (GetKit(event.getPlayer()) instanceof KitLooter)
|
||||||
{
|
{
|
||||||
count += UtilMath.r(3);
|
count += UtilMath.r(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
chest.getBlockInventory().setItem(UtilMath.r(27), GetChestItem(_supplyChests.contains(event.getClickedBlock())));
|
||||||
chest.getBlockInventory().addItem(GetChestItem());
|
|
||||||
}
|
_supplyChests.remove(event.getClickedBlock());
|
||||||
}
|
}
|
||||||
|
|
||||||
private ItemStack GetChestItem()
|
private ItemStack GetChestItem(boolean superChest)
|
||||||
{
|
{
|
||||||
if (_chestLoot.isEmpty())
|
if (_baseChestLoot.isEmpty())
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 1; i++) _chestLoot.add(new ItemStack(Material.DIAMOND_HELMET));
|
//Armor
|
||||||
for (int i = 0; i < 1; i++) _chestLoot.add(new ItemStack(Material.DIAMOND_CHESTPLATE));
|
for (int i = 0; i < 12; i++) _baseChestLoot.add(new ItemStack(Material.CHAINMAIL_HELMET));
|
||||||
for (int i = 0; i < 1; i++) _chestLoot.add(new ItemStack(Material.DIAMOND_LEGGINGS));
|
for (int i = 0; i < 12; i++) _baseChestLoot.add(new ItemStack(Material.CHAINMAIL_CHESTPLATE));
|
||||||
for (int i = 0; i < 1; i++) _chestLoot.add(new ItemStack(Material.DIAMOND_BOOTS));
|
for (int i = 0; i < 12; i++) _baseChestLoot.add(new ItemStack(Material.CHAINMAIL_LEGGINGS));
|
||||||
for (int i = 0; i < 1; i++) _chestLoot.add(new ItemStack(Material.DIAMOND_SWORD));
|
for (int i = 0; i < 12; i++) _baseChestLoot.add(new ItemStack(Material.CHAINMAIL_BOOTS));
|
||||||
|
|
||||||
for (int i = 0; i < 3; i++) _chestLoot.add(new ItemStack(Material.IRON_HELMET));
|
for (int i = 0; i < 15; i++) _baseChestLoot.add(new ItemStack(Material.GOLD_HELMET));
|
||||||
for (int i = 0; i < 3; i++) _chestLoot.add(new ItemStack(Material.IRON_CHESTPLATE));
|
for (int i = 0; i < 15; i++) _baseChestLoot.add(new ItemStack(Material.GOLD_CHESTPLATE));
|
||||||
for (int i = 0; i < 3; i++) _chestLoot.add(new ItemStack(Material.IRON_LEGGINGS));
|
for (int i = 0; i < 15; i++) _baseChestLoot.add(new ItemStack(Material.GOLD_LEGGINGS));
|
||||||
for (int i = 0; i < 3; i++) _chestLoot.add(new ItemStack(Material.IRON_BOOTS));
|
for (int i = 0; i < 15; i++) _baseChestLoot.add(new ItemStack(Material.GOLD_BOOTS));
|
||||||
for (int i = 0; i < 3; i++) _chestLoot.add(new ItemStack(Material.IRON_SWORD));
|
|
||||||
|
|
||||||
for (int i = 0; i < 12; i++) _chestLoot.add(new ItemStack(Material.CHAINMAIL_HELMET));
|
for (int i = 0; i < 32; i++) _baseChestLoot.add(new ItemStack(Material.LEATHER_HELMET));
|
||||||
for (int i = 0; i < 12; i++) _chestLoot.add(new ItemStack(Material.CHAINMAIL_CHESTPLATE));
|
for (int i = 0; i < 32; i++) _baseChestLoot.add(new ItemStack(Material.LEATHER_CHESTPLATE));
|
||||||
for (int i = 0; i < 12; i++) _chestLoot.add(new ItemStack(Material.CHAINMAIL_LEGGINGS));
|
for (int i = 0; i < 32; i++) _baseChestLoot.add(new ItemStack(Material.LEATHER_LEGGINGS));
|
||||||
for (int i = 0; i < 12; i++) _chestLoot.add(new ItemStack(Material.CHAINMAIL_BOOTS));
|
for (int i = 0; i < 32; i++) _baseChestLoot.add(new ItemStack(Material.LEATHER_BOOTS));
|
||||||
for (int i = 0; i < 12; i++) _chestLoot.add(new ItemStack(Material.STONE_SWORD));
|
|
||||||
|
|
||||||
for (int i = 0; i < 15; i++) _chestLoot.add(new ItemStack(Material.GOLD_HELMET));
|
//Weapons
|
||||||
for (int i = 0; i < 15; i++) _chestLoot.add(new ItemStack(Material.GOLD_CHESTPLATE));
|
for (int i = 0; i < 48; i++) _baseChestLoot.add(new ItemStack(Material.WOOD_AXE));
|
||||||
for (int i = 0; i < 15; i++) _chestLoot.add(new ItemStack(Material.GOLD_LEGGINGS));
|
for (int i = 0; i < 48; i++) _baseChestLoot.add(new ItemStack(Material.GOLD_AXE));
|
||||||
for (int i = 0; i < 15; i++) _chestLoot.add(new ItemStack(Material.GOLD_BOOTS));
|
for (int i = 0; i < 12; i++) _baseChestLoot.add(new ItemStack(Material.STONE_AXE));
|
||||||
for (int i = 0; i < 15; i++) _chestLoot.add(new ItemStack(Material.GOLD_SWORD));
|
for (int i = 0; i < 6; i++) _baseChestLoot.add(new ItemStack(Material.IRON_AXE));
|
||||||
|
|
||||||
for (int i = 0; i < 32; i++) _chestLoot.add(new ItemStack(Material.LEATHER_HELMET));
|
for (int i = 0; i < 32; i++) _baseChestLoot.add(new ItemStack(Material.WOOD_SWORD));
|
||||||
for (int i = 0; i < 32; i++) _chestLoot.add(new ItemStack(Material.LEATHER_CHESTPLATE));
|
for (int i = 0; i < 48; i++) _baseChestLoot.add(new ItemStack(Material.GOLD_SWORD));
|
||||||
for (int i = 0; i < 32; i++) _chestLoot.add(new ItemStack(Material.LEATHER_LEGGINGS));
|
for (int i = 0; i < 32; i++) _baseChestLoot.add(new ItemStack(Material.STONE_SWORD));
|
||||||
for (int i = 0; i < 32; i++) _chestLoot.add(new ItemStack(Material.LEATHER_BOOTS));
|
for (int i = 0; i < 32; i++) _baseChestLoot.add(new ItemStack(Material.IRON_SWORD));
|
||||||
for (int i = 0; i < 32; i++) _chestLoot.add(new ItemStack(Material.WOOD_SWORD));
|
|
||||||
|
|
||||||
for (int i = 0; i < 24; i++) _chestLoot.add(new ItemStack(Material.BOW));
|
for (int i = 0; i < 24; i++) _baseChestLoot.add(new ItemStack(Material.BOW));
|
||||||
for (int i = 0; i < 24; i++) _chestLoot.add(new ItemStack(Material.ARROW, 8));
|
for (int i = 0; i < 24; i++) _baseChestLoot.add(new ItemStack(Material.ARROW, 8));
|
||||||
|
|
||||||
for (int i = 0; i < 24; i++) _chestLoot.add(new ItemStack(Material.MUSHROOM_SOUP));
|
for (int i = 0; i < 24; i++) _baseChestLoot.add(new ItemStack(Material.TNT, 1));
|
||||||
for (int i = 0; i < 24; i++) _chestLoot.add(new ItemStack(Material.COOKED_CHICKEN));
|
for (int i = 0; i < 64; i++) _baseChestLoot.add(new ItemStack(Material.WEB, 2));
|
||||||
for (int i = 0; i < 24; i++) _chestLoot.add(new ItemStack(Material.RAW_BEEF, 1));
|
|
||||||
for (int i = 0; i < 24; i++) _chestLoot.add(new ItemStack(Material.GRILLED_PORK, 2));
|
|
||||||
for (int i = 0; i < 24; i++) _chestLoot.add(new ItemStack(Material.BREAD, 3));
|
|
||||||
|
|
||||||
for (int i = 0; i < 24; i++) _chestLoot.add(new ItemStack(Material.EXP_BOTTLE, 1));
|
//Food
|
||||||
|
for (int i = 0; i < 24; i++) _baseChestLoot.add(new ItemStack(Material.MUSHROOM_SOUP));
|
||||||
|
for (int i = 0; i < 24; i++) _baseChestLoot.add(new ItemStack(Material.COOKED_CHICKEN));
|
||||||
|
for (int i = 0; i < 24; i++) _baseChestLoot.add(new ItemStack(Material.RAW_BEEF, 1));
|
||||||
|
for (int i = 0; i < 24; i++) _baseChestLoot.add(new ItemStack(Material.GRILLED_PORK, 2));
|
||||||
|
for (int i = 0; i < 24; i++) _baseChestLoot.add(new ItemStack(Material.BREAD, 3));
|
||||||
|
|
||||||
for (int i = 0; i < 48; i++) _chestLoot.add(new ItemStack(Material.WOOD_AXE));
|
//Misc
|
||||||
for (int i = 0; i < 12; i++) _chestLoot.add(new ItemStack(Material.STONE_AXE));
|
for (int i = 0; i < 24; i++) _baseChestLoot.add(new ItemStack(Material.EXP_BOTTLE, 1));
|
||||||
for (int i = 0; i < 6; i++) _chestLoot.add(new ItemStack(Material.IRON_AXE));
|
for (int i = 0; i < 24; i++) _baseChestLoot.add(new ItemStack(Material.GOLD_INGOT, 2));
|
||||||
for (int i = 0; i < 4; i++) _chestLoot.add(new ItemStack(Material.DIAMOND_AXE));
|
for (int i = 0; i < 12; i++) _baseChestLoot.add(new ItemStack(Material.IRON_INGOT, 2));
|
||||||
|
for (int i = 0; i < 3; i++) _baseChestLoot.add(new ItemStack(Material.DIAMOND));
|
||||||
|
for (int i = 0; i < 128; i++) _baseChestLoot.add(new ItemStack(Material.STICK, 4));
|
||||||
|
for (int i = 0; i < 64; i++) _baseChestLoot.add(new ItemStack(Material.FLINT, 4));
|
||||||
|
for (int i = 0; i < 64; i++) _baseChestLoot.add(new ItemStack(Material.FEATHER, 4));
|
||||||
|
|
||||||
for (int i = 0; i < 24; i++) _chestLoot.add(new ItemStack(Material.GOLD_INGOT));
|
//Building Supplies
|
||||||
for (int i = 0; i < 12; i++) _chestLoot.add(new ItemStack(Material.IRON_INGOT));
|
for (int i = 0; i < 64; i++) _baseChestLoot.add(new ItemStack(Material.PISTON_BASE, 4));
|
||||||
for (int i = 0; i < 3; i++) _chestLoot.add(new ItemStack(Material.DIAMOND));
|
for (int i = 0; i < 64; i++) _baseChestLoot.add(new ItemStack(Material.REDSTONE, 4));
|
||||||
for (int i = 0; i < 128; i++) _chestLoot.add(new ItemStack(Material.STICK));
|
for (int i = 0; i < 64; i++) _baseChestLoot.add(new ItemStack(Material.STRING, 4));
|
||||||
|
for (int i = 0; i < 64; i++) _baseChestLoot.add(new ItemStack(Material.TRIPWIRE_HOOK, 4));
|
||||||
|
for (int i = 0; i < 64; i++) _baseChestLoot.add(new ItemStack(Material.WOOD_PLATE));
|
||||||
|
for (int i = 0; i < 64; i++) _baseChestLoot.add(new ItemStack(Material.LEVER));
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack stack = _chestLoot.get(UtilMath.r(_chestLoot.size()));
|
if (_superChestLoot.isEmpty())
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 1; i++) _baseChestLoot.add(new ItemStack(Material.DIAMOND_HELMET));
|
||||||
|
for (int i = 0; i < 1; i++) _superChestLoot.add(new ItemStack(Material.DIAMOND_CHESTPLATE));
|
||||||
|
for (int i = 0; i < 1; i++) _superChestLoot.add(new ItemStack(Material.DIAMOND_LEGGINGS));
|
||||||
|
for (int i = 0; i < 1; i++) _superChestLoot.add(new ItemStack(Material.DIAMOND_BOOTS));
|
||||||
|
|
||||||
|
for (int i = 0; i < 3; i++) _superChestLoot.add(new ItemStack(Material.IRON_HELMET));
|
||||||
|
for (int i = 0; i < 3; i++) _superChestLoot.add(new ItemStack(Material.IRON_CHESTPLATE));
|
||||||
|
for (int i = 0; i < 3; i++) _superChestLoot.add(new ItemStack(Material.IRON_LEGGINGS));
|
||||||
|
for (int i = 0; i < 3; i++) _superChestLoot.add(new ItemStack(Material.IRON_BOOTS));
|
||||||
|
|
||||||
|
for (int i = 0; i < 1; i++) _superChestLoot.add(new ItemStack(Material.DIAMOND_SWORD));
|
||||||
|
for (int i = 0; i < 2; i++) _baseChestLoot.add(new ItemStack(Material.DIAMOND_AXE));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ItemStack stack = _baseChestLoot.get(UtilMath.r(_baseChestLoot.size()));
|
||||||
|
if (superChest)
|
||||||
|
stack = _superChestLoot.get(UtilMath.r(_superChestLoot.size()));
|
||||||
|
|
||||||
int amount = 1;
|
int amount = 1;
|
||||||
|
|
||||||
@ -387,7 +493,7 @@ public class HungerGames extends SoloGame
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int max = Math.max(5, Math.min(100, _redLocations.size()/100));
|
int max = Math.max(5, Math.min(_maxSpreadRate, _redLocations.size()/100));
|
||||||
|
|
||||||
for (int i=0 ; i<max ; i++)
|
for (int i=0 ; i<max ; i++)
|
||||||
{
|
{
|
||||||
@ -449,6 +555,9 @@ public class HungerGames extends SoloGame
|
|||||||
if (!IsLive())
|
if (!IsLive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (true)
|
||||||
|
return;
|
||||||
|
|
||||||
System.out.println(" ");
|
System.out.println(" ");
|
||||||
System.out.println("Game Time: " + UtilTime.MakeStr(System.currentTimeMillis() - this.GetStateTime()));
|
System.out.println("Game Time: " + UtilTime.MakeStr(System.currentTimeMillis() - this.GetStateTime()));
|
||||||
System.out.println("Creep Size: " + _redLocations.size());
|
System.out.println("Creep Size: " + _redLocations.size());
|
||||||
@ -483,6 +592,10 @@ public class HungerGames extends SoloGame
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Ignore Signs
|
||||||
|
if (block.getType() == Material.SIGN || block.getType() == Material.SIGN_POST || block.getType() == Material.WALL_SIGN)
|
||||||
|
return false;
|
||||||
|
|
||||||
//Pre-Red
|
//Pre-Red
|
||||||
if (IsRed(block))
|
if (IsRed(block))
|
||||||
{
|
{
|
||||||
@ -538,6 +651,8 @@ public class HungerGames extends SoloGame
|
|||||||
{
|
{
|
||||||
MapUtil.ChunkBlockChange(loc, id, data);
|
MapUtil.ChunkBlockChange(loc, id, data);
|
||||||
|
|
||||||
|
//_redQueue.add(new BlockChange(loc, id, data));
|
||||||
|
|
||||||
for (Player player : UtilServer.getPlayers())
|
for (Player player : UtilServer.getPlayers())
|
||||||
{
|
{
|
||||||
if (player.getLocation().getChunk().getX() - loc.getChunk().getX() > UtilServer.getServer().getViewDistance())
|
if (player.getLocation().getChunk().getX() - loc.getChunk().getX() > UtilServer.getServer().getViewDistance())
|
||||||
@ -550,6 +665,59 @@ public class HungerGames extends SoloGame
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void RedChangeBlockClient(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (event.getType() != UpdateType.SEC)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/** TYPE A **/
|
||||||
|
|
||||||
|
for (BlockChange change : _redQueue)
|
||||||
|
{
|
||||||
|
for (Player player : UtilServer.getPlayers())
|
||||||
|
{
|
||||||
|
if (player.getLocation().getChunk().getX() - change.Location.getChunk().getX() > UtilServer.getServer().getViewDistance())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (player.getLocation().getChunk().getZ() - change.Location.getChunk().getZ() > UtilServer.getServer().getViewDistance())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
player.sendBlockChange(change.Location, change.Id, change.Data);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_redQueue.clear();
|
||||||
|
|
||||||
|
|
||||||
|
/** TYPE B **/
|
||||||
|
/*
|
||||||
|
HashSet<Chunk> chunks = new HashSet<Chunk>();
|
||||||
|
|
||||||
|
for (BlockChange change : _redQueue)
|
||||||
|
{
|
||||||
|
chunks.add(change.Location.getChunk());
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Chunk chunk : chunks)
|
||||||
|
{
|
||||||
|
for (Player player : UtilServer.getPlayers())
|
||||||
|
{
|
||||||
|
if (player.getLocation().getChunk().getX() - chunk.getX() > UtilServer.getServer().getViewDistance())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (player.getLocation().getChunk().getZ() - chunk.getZ() > UtilServer.getServer().getViewDistance())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
MapUtil.SendChunkForPlayer(chunk.getX(), chunk.getZ(), player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_redQueue.clear();
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
public boolean IsRed(Block block)
|
public boolean IsRed(Block block)
|
||||||
{
|
{
|
||||||
for (Entry<Integer,Integer> entry : _spreadTypeBlocks)
|
for (Entry<Integer,Integer> entry : _spreadTypeBlocks)
|
||||||
@ -580,6 +748,7 @@ public class HungerGames extends SoloGame
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (loc.getBlock().getType() == Material.LEAVES) RedChangeBlock(loc, 88, (byte)0);
|
if (loc.getBlock().getType() == Material.LEAVES) RedChangeBlock(loc, 88, (byte)0);
|
||||||
|
else if (loc.getBlock().getTypeId() == 8 || loc.getBlock().getTypeId() == 9) RedChangeBlock(loc, 49, (byte)0);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
double r = Math.random();
|
double r = Math.random();
|
||||||
@ -678,7 +847,7 @@ public class HungerGames extends SoloGame
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void SnowballDamage(CustomDamageEvent event)
|
public void RedDamage(CustomDamageEvent event)
|
||||||
{
|
{
|
||||||
if (event.GetProjectile() == null)
|
if (event.GetProjectile() == null)
|
||||||
return;
|
return;
|
||||||
@ -686,15 +855,222 @@ public class HungerGames extends SoloGame
|
|||||||
if (!(event.GetProjectile() instanceof Snowball))
|
if (!(event.GetProjectile() instanceof Snowball))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
event.AddMod("Snowball", _spreadName, 1, true);
|
event.AddMod("Snowball", _spreadName, 2, true);
|
||||||
|
|
||||||
event.AddKnockback("Snowball", 4);
|
event.AddKnockback("Snowball", 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void DebugCmd(PlayerCommandPreprocessEvent event)
|
public void DayNightCycle(UpdateEvent event)
|
||||||
{
|
{
|
||||||
|
if (!IsLive())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (event.getType() != UpdateType.TICK)
|
||||||
|
return;
|
||||||
|
|
||||||
|
long time = WorldData.World.getTime();
|
||||||
|
|
||||||
|
if (time > 22000 || time < 14000)
|
||||||
|
{
|
||||||
|
WorldTimeSet = (WorldTimeSet + 4)%24000;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WorldTimeSet = (WorldTimeSet + 16)%24000;
|
||||||
|
}
|
||||||
|
|
||||||
|
WorldData.World.setTime(WorldTimeSet);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void SupplyDrop(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (!IsLive())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (event.getType() != UpdateType.FASTEST)
|
||||||
|
return;
|
||||||
|
|
||||||
|
long time = WorldData.World.getTime();
|
||||||
|
|
||||||
|
if (time > 14000 && time < 23000)
|
||||||
|
{
|
||||||
|
if (_supplyCurrent == null)
|
||||||
|
{
|
||||||
|
_supplyCurrent = _supplyLocations.get(UtilMath.r(_supplyLocations.size()));
|
||||||
|
|
||||||
|
//Remove Prior
|
||||||
|
_supplyChests.remove(_supplyCurrent.getBlock().getRelative(BlockFace.UP));
|
||||||
|
_supplyCurrent.getBlock().getRelative(BlockFace.UP).setType(Material.AIR);
|
||||||
|
|
||||||
|
//Create New
|
||||||
|
_supplyCurrent.getBlock().setType(Material.BEACON);
|
||||||
|
for (int x=-1 ; x<=1 ; x++)
|
||||||
|
for (int z=-1 ; z<=1 ; z++)
|
||||||
|
_supplyCurrent.getBlock().getRelative(x, -1, z).setType(Material.IRON_BLOCK);
|
||||||
|
|
||||||
|
//Announce
|
||||||
|
this.Announce(C.cYellow + C.Bold + "Supply Drop Incoming (" + ChatColor.RESET + UtilWorld.locToStrClean(_supplyCurrent) + C.cYellow + C.Bold + ")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (_supplyCurrent != null)
|
||||||
|
{
|
||||||
|
if (_supplyEffect == null)
|
||||||
|
{
|
||||||
|
_supplyEffect = _supplyCurrent.clone();
|
||||||
|
_supplyEffect.setY(250);
|
||||||
|
}
|
||||||
|
|
||||||
|
FireworkEffect effect = FireworkEffect.builder().flicker(false).withColor(Color.YELLOW).with(Type.BURST).trail(false).build();
|
||||||
|
UtilFirework.playFirework(_supplyEffect, effect);
|
||||||
|
|
||||||
|
_supplyEffect.setY(_supplyEffect.getY()-1);
|
||||||
|
|
||||||
|
if (UtilMath.offset(_supplyEffect, _supplyCurrent) < 2)
|
||||||
|
{
|
||||||
|
effect = FireworkEffect.builder().flicker(false).withColor(Color.YELLOW).with(Type.BALL_LARGE).trail(true).build();
|
||||||
|
UtilFirework.playFirework(_supplyEffect, effect);
|
||||||
|
|
||||||
|
//Create Chest
|
||||||
|
_supplyCurrent.getBlock().setType(Material.GLASS);
|
||||||
|
_supplyCurrent.getBlock().getRelative(BlockFace.UP).setType(Material.CHEST);
|
||||||
|
_supplyChests.add(_supplyCurrent.getBlock().getRelative(BlockFace.UP));
|
||||||
|
|
||||||
|
//Reset
|
||||||
|
_supplyEffect = null;
|
||||||
|
_supplyCurrent = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void SupplyGlow(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (!IsLive())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (event.getType() != UpdateType.TICK)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (_supplyChests.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
Iterator<Block> chestIterator = _supplyChests.iterator();
|
||||||
|
|
||||||
|
while (chestIterator.hasNext())
|
||||||
|
{
|
||||||
|
Block block = chestIterator.next();
|
||||||
|
|
||||||
|
if (block.getType() != Material.CHEST)
|
||||||
|
{
|
||||||
|
chestIterator.remove();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
UtilParticle.PlayParticle(ParticleType.SPELL, block.getLocation().add(0.5, 0.5, 0.5), 0.3f, 0.3f, 0.3f, 0, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void TNTThrow(PlayerInteractEvent event)
|
||||||
|
{
|
||||||
|
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK &&
|
||||||
|
event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_AIR)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
if (!UtilInv.IsItem(player.getItemInHand(), Material.TNT, (byte)0))
|
||||||
|
return;
|
||||||
|
|
||||||
|
event.setCancelled(true);
|
||||||
|
|
||||||
|
if (!Manager.GetGame().CanThrowTNT(player.getLocation()))
|
||||||
|
{
|
||||||
|
//Inform
|
||||||
|
UtilPlayer.message(event.getPlayer(), F.main(GetName(), "You cannot use " + F.item("Throw TNT") + " here."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
UtilInv.remove(player, Material.TNT, (byte)0, 1);
|
||||||
|
UtilInv.Update(player);
|
||||||
|
|
||||||
|
TNTPrimed tnt = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), TNTPrimed.class);
|
||||||
|
|
||||||
|
UtilAction.velocity(tnt, player.getLocation().getDirection(), 0.5, false, 0, 0.1, 10, false);
|
||||||
|
|
||||||
|
_tntMap.put(tnt, player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void TNTExplosion(ExplosionPrimeEvent event)
|
||||||
|
{
|
||||||
|
if (!_tntMap.containsKey(event.getEntity()))
|
||||||
|
return;
|
||||||
|
|
||||||
|
Player player = _tntMap.remove(event.getEntity());
|
||||||
|
|
||||||
|
for (Player other : UtilPlayer.getNearby(event.getEntity().getLocation(), 14))
|
||||||
|
Manager.GetCondition().Factory().Explosion("Throwing TNT", other, player, 50, 0.1, false, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void BlockPlace(BlockPlaceEvent event)
|
||||||
|
{
|
||||||
|
if (event.getItemInHand().getType() == Material.PISTON_BASE)
|
||||||
|
{
|
||||||
|
_placedBlocks.add(event.getBlock().getLocation());
|
||||||
|
event.setCancelled(false);
|
||||||
|
|
||||||
|
final Block block = event.getBlock();
|
||||||
|
|
||||||
|
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable()
|
||||||
|
{
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
block.setType(Material.PISTON_BASE);
|
||||||
|
block.setData((byte) 6);
|
||||||
|
}
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void BlockBreak(BlockBreakEvent event)
|
||||||
|
{
|
||||||
|
if (_placedBlocks.remove(event.getBlock().getLocation()))
|
||||||
|
{
|
||||||
|
event.setCancelled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void BlockBurn(BlockBurnEvent event)
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void BlockSpread(BlockSpreadEvent event)
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void BlockFade(BlockFadeEvent event)
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void BlockDecay(LeavesDecayEvent event)
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//XXX REMOVE ME
|
//XXX REMOVE ME
|
||||||
|
@ -15,17 +15,16 @@ public class KitAssassin extends Kit
|
|||||||
{
|
{
|
||||||
public KitAssassin(ArcadeManager manager)
|
public KitAssassin(ArcadeManager manager)
|
||||||
{
|
{
|
||||||
super(manager, "Assassin", KitAvailability.Green,
|
super(manager, "Assassin", KitAvailability.Blue,
|
||||||
|
|
||||||
new String[]
|
new String[]
|
||||||
{
|
{
|
||||||
"Able to go invisible and surprise opponents."
|
"Sneak up on opponents while they're looting chests!"
|
||||||
},
|
},
|
||||||
|
|
||||||
new Perk[]
|
new Perk[]
|
||||||
{
|
{
|
||||||
new PerkBackstab(),
|
new PerkBackstab(),
|
||||||
new PerkSmokebomb()
|
|
||||||
},
|
},
|
||||||
EntityType.ZOMBIE,
|
EntityType.ZOMBIE,
|
||||||
new ItemStack(Material.IRON_SWORD));
|
new ItemStack(Material.IRON_SWORD));
|
||||||
|
@ -11,21 +11,22 @@ import nautilus.game.arcade.kit.KitAvailability;
|
|||||||
import nautilus.game.arcade.kit.Perk;
|
import nautilus.game.arcade.kit.Perk;
|
||||||
import nautilus.game.arcade.kit.perks.*;
|
import nautilus.game.arcade.kit.perks.*;
|
||||||
|
|
||||||
public class KitHunter extends Kit
|
public class KitAxeman extends Kit
|
||||||
{
|
{
|
||||||
public KitHunter(ArcadeManager manager)
|
public KitAxeman(ArcadeManager manager)
|
||||||
{
|
{
|
||||||
super(manager, "Hunter", KitAvailability.Free,
|
super(manager, "Axeman", KitAvailability.Free,
|
||||||
|
|
||||||
new String[]
|
new String[]
|
||||||
{
|
{
|
||||||
"Agile hunter, able to tackle opponents."
|
"Proficient in the art of axe combat!"
|
||||||
},
|
},
|
||||||
|
|
||||||
new Perk[]
|
new Perk[]
|
||||||
{
|
{
|
||||||
new PerkLeapTackleHG(6),
|
|
||||||
new PerkAxeman(),
|
new PerkAxeman(),
|
||||||
|
new PerkAxeThrower(manager)
|
||||||
},
|
},
|
||||||
EntityType.ZOMBIE,
|
EntityType.ZOMBIE,
|
||||||
new ItemStack(Material.IRON_AXE));
|
new ItemStack(Material.IRON_AXE));
|
@ -19,12 +19,13 @@ public class KitBomber extends Kit
|
|||||||
|
|
||||||
new String[]
|
new String[]
|
||||||
{
|
{
|
||||||
"Crazy bomb throwing guy."
|
"BOOM! BOOM! BOOM!"
|
||||||
},
|
},
|
||||||
|
|
||||||
new Perk[]
|
new Perk[]
|
||||||
{
|
{
|
||||||
new PerkBomber(30, 2, -1)
|
new PerkBomberHG(30, 2),
|
||||||
|
new PerkTNTArrow()
|
||||||
},
|
},
|
||||||
EntityType.ZOMBIE,
|
EntityType.ZOMBIE,
|
||||||
new ItemStack(Material.TNT));
|
new ItemStack(Material.TNT));
|
||||||
|
@ -24,7 +24,7 @@ public class KitKnight extends Kit
|
|||||||
|
|
||||||
new Perk[]
|
new Perk[]
|
||||||
{
|
{
|
||||||
new PerkIronSkin(1),
|
new PerkIronSkin(0.5),
|
||||||
new PerkHiltSmash()
|
new PerkHiltSmash()
|
||||||
},
|
},
|
||||||
EntityType.ZOMBIE,
|
EntityType.ZOMBIE,
|
||||||
|
@ -19,7 +19,7 @@ public class KitLooter extends Kit
|
|||||||
|
|
||||||
new String[]
|
new String[]
|
||||||
{
|
{
|
||||||
"+50% Loot from chests you are first to open!"
|
"Defeat your opponents with your swag loots!"
|
||||||
},
|
},
|
||||||
|
|
||||||
new Perk[]
|
new Perk[]
|
||||||
@ -27,7 +27,7 @@ public class KitLooter extends Kit
|
|||||||
new PerkLooter(),
|
new PerkLooter(),
|
||||||
},
|
},
|
||||||
EntityType.ZOMBIE,
|
EntityType.ZOMBIE,
|
||||||
new ItemStack(Material.IRON_SWORD));
|
new ItemStack(Material.CHEST));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,106 @@
|
|||||||
|
package nautilus.game.arcade.kit.perks;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.entity.Item;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.UtilAction;
|
||||||
|
import mineplex.core.common.util.UtilEnt;
|
||||||
|
import mineplex.core.common.util.UtilEvent;
|
||||||
|
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||||
|
import mineplex.core.common.util.UtilInv;
|
||||||
|
import mineplex.core.itemstack.ItemStackFactory;
|
||||||
|
import mineplex.core.projectile.IThrown;
|
||||||
|
import mineplex.core.projectile.ProjectileUser;
|
||||||
|
import nautilus.game.arcade.ArcadeManager;
|
||||||
|
import nautilus.game.arcade.kit.Perk;
|
||||||
|
|
||||||
|
public class PerkAxeThrower extends Perk implements IThrown
|
||||||
|
{
|
||||||
|
public PerkAxeThrower(ArcadeManager manager)
|
||||||
|
{
|
||||||
|
super("Axe Thrower", new String[]
|
||||||
|
{
|
||||||
|
C.cYellow + "RIGHT-Click" + C.cGray + " with Axes to " + C.cGreen + "Throw Axe",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void Throw(PlayerInteractEvent event)
|
||||||
|
{
|
||||||
|
if (!UtilEvent.isAction(event, ActionType.R))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (event.getPlayer().getItemInHand() == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE"))
|
||||||
|
return;
|
||||||
|
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
if (!Kit.HasKit(player))
|
||||||
|
return;
|
||||||
|
|
||||||
|
event.setCancelled(true);
|
||||||
|
|
||||||
|
org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(player.getItemInHand().getType()));
|
||||||
|
UtilAction.velocity(ent, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 10, false);
|
||||||
|
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 1d);
|
||||||
|
|
||||||
|
//Remove Axe
|
||||||
|
player.setItemInHand(null);
|
||||||
|
UtilInv.Update(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void Collide(LivingEntity target, Block block, ProjectileUser data)
|
||||||
|
{
|
||||||
|
if (target == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (target instanceof Player)
|
||||||
|
if (!Manager.GetGame().IsAlive((Player)target))
|
||||||
|
return;
|
||||||
|
|
||||||
|
Item item = (Item)data.GetThrown();
|
||||||
|
|
||||||
|
int damage = 4;
|
||||||
|
if (item.getItemStack().getType() == Material.STONE_AXE) damage = 5;
|
||||||
|
else if (item.getItemStack().getType() == Material.IRON_AXE) damage = 6;
|
||||||
|
else if (item.getItemStack().getType() == Material.DIAMOND_AXE) damage = 7;
|
||||||
|
|
||||||
|
//Damage Event
|
||||||
|
Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null,
|
||||||
|
DamageCause.CUSTOM, damage, true, true, false,
|
||||||
|
UtilEnt.getName(data.GetThrower()), GetName());
|
||||||
|
|
||||||
|
//Effect
|
||||||
|
data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.ZOMBIE_WOOD, 1f, 1.6f);
|
||||||
|
|
||||||
|
//Re-Drop
|
||||||
|
data.GetThrown().getWorld().dropItem(data.GetThrown().getLocation(), ItemStackFactory.Instance.CreateStack(item.getItemStack().getType())).setPickupDelay(60);
|
||||||
|
|
||||||
|
//Remove
|
||||||
|
data.GetThrown().remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void Idle(ProjectileUser data)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void Expire(ProjectileUser data)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -31,6 +31,9 @@ public class PerkBackstab extends Perk
|
|||||||
if (event.GetCause() != DamageCause.ENTITY_ATTACK)
|
if (event.GetCause() != DamageCause.ENTITY_ATTACK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (event.GetDamageInitial() <= 1)
|
||||||
|
return;
|
||||||
|
|
||||||
Player damager = event.GetDamagerPlayer(false);
|
Player damager = event.GetDamagerPlayer(false);
|
||||||
if (damager == null) return;
|
if (damager == null) return;
|
||||||
|
|
||||||
|
@ -0,0 +1,106 @@
|
|||||||
|
package nautilus.game.arcade.kit.perks;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||||
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
|
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.common.util.UtilInv;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
|
import mineplex.core.itemstack.ItemStackFactory;
|
||||||
|
import mineplex.core.recharge.Recharge;
|
||||||
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
import mineplex.core.updater.UpdateType;
|
||||||
|
import nautilus.game.arcade.kit.Perk;
|
||||||
|
|
||||||
|
public class PerkBomberHG extends Perk
|
||||||
|
{
|
||||||
|
private int _spawnRate;
|
||||||
|
private int _max;
|
||||||
|
|
||||||
|
public PerkBomberHG(int spawnRate, int max)
|
||||||
|
{
|
||||||
|
super("Explosives", new String[]
|
||||||
|
{
|
||||||
|
C.cGray + "Receive 1 TNT every " + spawnRate + " seconds. Maximum of " + max + ".",
|
||||||
|
});
|
||||||
|
|
||||||
|
_spawnRate = spawnRate;
|
||||||
|
_max = max;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Apply(Player player)
|
||||||
|
{
|
||||||
|
Recharge.Instance.use(player, GetName(), _spawnRate*1000, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void TNTSpawn(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (event.getType() != UpdateType.FAST)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (Player cur : UtilServer.getPlayers())
|
||||||
|
{
|
||||||
|
if (!Kit.HasKit(cur))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!Manager.GetGame().IsAlive(cur))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!Recharge.Instance.use(cur, GetName(), _spawnRate*1000, false))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (UtilInv.contains(cur, Material.TNT, (byte)0, _max))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
//Add
|
||||||
|
cur.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.TNT, (byte)0, 1, F.item("Throwing TNT")));
|
||||||
|
|
||||||
|
cur.playSound(cur.getLocation(), Sound.ITEM_PICKUP, 2f, 1f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void TNTDrop(PlayerDropItemEvent event)
|
||||||
|
{
|
||||||
|
if (event.isCancelled())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!UtilInv.IsItem(event.getItemDrop().getItemStack(), Material.TNT, (byte)0))
|
||||||
|
return;
|
||||||
|
|
||||||
|
//Cancel
|
||||||
|
event.setCancelled(true);
|
||||||
|
|
||||||
|
//Inform
|
||||||
|
UtilPlayer.message(event.getPlayer(), F.main(GetName(), "You cannot drop " + F.item("Throwing TNT") + "."));
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void TNTDeathRemove(PlayerDeathEvent event)
|
||||||
|
{
|
||||||
|
HashSet<org.bukkit.inventory.ItemStack> remove = new HashSet<org.bukkit.inventory.ItemStack>();
|
||||||
|
|
||||||
|
for (org.bukkit.inventory.ItemStack item : event.getDrops())
|
||||||
|
if (UtilInv.IsItem(item, Material.TNT, (byte)0))
|
||||||
|
remove.add(item);
|
||||||
|
|
||||||
|
for (org.bukkit.inventory.ItemStack item : remove)
|
||||||
|
event.getDrops().remove(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void TNTInvClick(InventoryClickEvent event)
|
||||||
|
{
|
||||||
|
UtilInv.DisallowMovementOf(event, "Throwing TNT", Material.TNT, (byte)0, true);
|
||||||
|
}
|
||||||
|
}
|
@ -11,16 +11,16 @@ import nautilus.game.arcade.kit.Perk;
|
|||||||
|
|
||||||
public class PerkIronSkin extends Perk
|
public class PerkIronSkin extends Perk
|
||||||
{
|
{
|
||||||
private int _reduction;
|
private double _reduction;
|
||||||
|
|
||||||
public PerkIronSkin(int reduction)
|
public PerkIronSkin(double d)
|
||||||
{
|
{
|
||||||
super("Iron Skin", new String[]
|
super("Iron Skin", new String[]
|
||||||
{
|
{
|
||||||
C.cGray + "You take " + reduction + " less damage from attacks",
|
C.cGray + "You take " + d + " less damage from attacks",
|
||||||
});
|
});
|
||||||
|
|
||||||
_reduction = reduction;
|
_reduction = d;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
@ -32,6 +32,9 @@ public class PerkIronSkin extends Perk
|
|||||||
if (event.GetCause() == DamageCause.FIRE_TICK)
|
if (event.GetCause() == DamageCause.FIRE_TICK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (event.GetDamage() <= 1)
|
||||||
|
return;
|
||||||
|
|
||||||
Player damagee = event.GetDamageePlayer();
|
Player damagee = event.GetDamageePlayer();
|
||||||
if (damagee == null) return;
|
if (damagee == null) return;
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package nautilus.game.arcade.kit.perks;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import org.bukkit.EntityEffect;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -27,16 +28,12 @@ public class PerkLeapTackleHG extends Perk
|
|||||||
{
|
{
|
||||||
private HashMap<LivingEntity, Long> _live = new HashMap<LivingEntity, Long>();
|
private HashMap<LivingEntity, Long> _live = new HashMap<LivingEntity, Long>();
|
||||||
|
|
||||||
private int _damage;
|
public PerkLeapTackleHG()
|
||||||
|
|
||||||
public PerkLeapTackleHG(int damage)
|
|
||||||
{
|
{
|
||||||
super("Leap Attack", new String[]
|
super("Leap Attack", new String[]
|
||||||
{
|
{
|
||||||
C.cYellow + "Right-Click" + C.cGray + " with Sword/Axe to " + C.cGreen + "Leap Attack"
|
C.cYellow + "Right-Click" + C.cGray + " with Sword/Axe to " + C.cGreen + "Leap Tackle"
|
||||||
});
|
});
|
||||||
|
|
||||||
_damage = damage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -111,10 +108,7 @@ public class PerkLeapTackleHG extends Perk
|
|||||||
|
|
||||||
public void Hit(Player damager, LivingEntity damagee)
|
public void Hit(Player damager, LivingEntity damagee)
|
||||||
{
|
{
|
||||||
//Damage Event
|
damagee.playEffect(EntityEffect.HURT);
|
||||||
Manager.GetDamage().NewDamageEvent(damagee, damager, null,
|
|
||||||
DamageCause.CUSTOM, _damage, false, true, false,
|
|
||||||
damager.getName(), GetName());
|
|
||||||
|
|
||||||
//Slow
|
//Slow
|
||||||
Manager.GetCondition().Factory().Slow(GetName(), damagee, damager, 1, 3, false, false, true, false);
|
Manager.GetCondition().Factory().Slow(GetName(), damagee, damager, 1, 3, false, false, true, false);
|
||||||
|
@ -14,7 +14,7 @@ public class PerkMammoth extends Perk
|
|||||||
{
|
{
|
||||||
super("Mammoth", new String[]
|
super("Mammoth", new String[]
|
||||||
{
|
{
|
||||||
C.cGray + "Take 75% knockback and deal 150% knockback",
|
C.cGray + "Take 50% knockback and deal 150% knockback",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package nautilus.game.arcade.kit.perks;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.bukkit.Effect;
|
import org.bukkit.Effect;
|
||||||
|
import org.bukkit.EntityEffect;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
@ -10,9 +11,7 @@ import org.bukkit.entity.LivingEntity;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.event.block.Action;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.util.Vector;
|
|
||||||
|
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
@ -21,21 +20,16 @@ import mineplex.core.common.util.UtilAlg;
|
|||||||
import mineplex.core.common.util.UtilBlock;
|
import mineplex.core.common.util.UtilBlock;
|
||||||
import mineplex.core.common.util.UtilEnt;
|
import mineplex.core.common.util.UtilEnt;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.common.util.UtilTime;
|
|
||||||
import mineplex.core.recharge.Recharge;
|
import mineplex.core.recharge.Recharge;
|
||||||
import mineplex.core.updater.UpdateType;
|
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
|
||||||
import nautilus.game.arcade.kit.Perk;
|
import nautilus.game.arcade.kit.Perk;
|
||||||
|
|
||||||
public class PerkSeismicSlamHG extends Perk
|
public class PerkSeismicSlamHG extends Perk
|
||||||
{
|
{
|
||||||
private HashMap<LivingEntity, Long> _live = new HashMap<LivingEntity, Long>();
|
|
||||||
|
|
||||||
public PerkSeismicSlamHG()
|
public PerkSeismicSlamHG()
|
||||||
{
|
{
|
||||||
super("Seismic Slam", new String[]
|
super("Ground Pound", new String[]
|
||||||
{
|
{
|
||||||
C.cYellow + "Right-Click" + C.cGray + " with Sword/Axe to " + C.cGreen + "Seismic Slam"
|
C.cYellow + "Right-Click" + C.cGray + " with Sword/Axe to " + C.cGreen + "Ground Pound"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,40 +60,6 @@ public class PerkSeismicSlamHG extends Perk
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
//Action
|
//Action
|
||||||
Vector vec = player.getLocation().getDirection();
|
|
||||||
if (vec.getY() < 0)
|
|
||||||
vec.setY(vec.getY() * -1);
|
|
||||||
|
|
||||||
UtilAction.velocity(player, vec, 1, true, 1, 0, 1, true);
|
|
||||||
|
|
||||||
//Record
|
|
||||||
_live.put(player, System.currentTimeMillis());
|
|
||||||
|
|
||||||
//Inform
|
|
||||||
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void Slam(UpdateEvent event)
|
|
||||||
{
|
|
||||||
if (event.getType() != UpdateType.TICK)
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (Player player : Manager.GetGame().GetPlayers(true))
|
|
||||||
{
|
|
||||||
if (!UtilEnt.isGrounded(player))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (!_live.containsKey(player))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (!UtilTime.elapsed(_live.get(player), 1000))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
_live.remove(player);
|
|
||||||
|
|
||||||
//Action
|
|
||||||
int damage = 8;
|
|
||||||
double range = 6;
|
double range = 6;
|
||||||
|
|
||||||
HashMap<LivingEntity, Double> targets = UtilEnt.getInRadius(player.getLocation(), range);
|
HashMap<LivingEntity, Double> targets = UtilEnt.getInRadius(player.getLocation(), range);
|
||||||
@ -111,10 +71,7 @@ public class PerkSeismicSlamHG extends Perk
|
|||||||
if (!UtilEnt.isGrounded(player))
|
if (!UtilEnt.isGrounded(player))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
//Damage Event
|
cur.playEffect(EntityEffect.HURT);
|
||||||
Manager.GetDamage().NewDamageEvent(cur, player, null,
|
|
||||||
DamageCause.CUSTOM, damage * targets.get(cur) + 0.5, false, true, false,
|
|
||||||
player.getName(), GetName());
|
|
||||||
|
|
||||||
//Velocity
|
//Velocity
|
||||||
UtilAction.velocity(cur,
|
UtilAction.velocity(cur,
|
||||||
@ -134,6 +91,9 @@ public class PerkSeismicSlamHG extends Perk
|
|||||||
for (Block cur : UtilBlock.getInRadius(player.getLocation(), 4d).keySet())
|
for (Block cur : UtilBlock.getInRadius(player.getLocation(), 4d).keySet())
|
||||||
if (UtilBlock.airFoliage(cur.getRelative(BlockFace.UP)) && !UtilBlock.airFoliage(cur))
|
if (UtilBlock.airFoliage(cur.getRelative(BlockFace.UP)) && !UtilBlock.airFoliage(cur))
|
||||||
cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, cur.getTypeId());
|
cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, cur.getTypeId());
|
||||||
}
|
|
||||||
|
|
||||||
|
//Inform
|
||||||
|
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,11 +5,15 @@ import java.util.HashMap;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature;
|
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature;
|
||||||
|
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftSkeleton;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Skeleton;
|
import org.bukkit.entity.Skeleton;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.entity.EntityCombustEvent;
|
||||||
import org.bukkit.event.entity.EntityTargetEvent;
|
import org.bukkit.event.entity.EntityTargetEvent;
|
||||||
|
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
@ -20,6 +24,7 @@ import mineplex.core.common.util.UtilPlayer;
|
|||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
||||||
|
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||||
import nautilus.game.arcade.kit.Perk;
|
import nautilus.game.arcade.kit.Perk;
|
||||||
import net.minecraft.server.v1_6_R3.EntityCreature;
|
import net.minecraft.server.v1_6_R3.EntityCreature;
|
||||||
import net.minecraft.server.v1_6_R3.Navigation;
|
import net.minecraft.server.v1_6_R3.Navigation;
|
||||||
@ -77,6 +82,11 @@ public class PerkSkeletons extends Perk
|
|||||||
event.GetEvent().getDrops().remove(killed.getInventory().getLeggings());
|
event.GetEvent().getDrops().remove(killed.getInventory().getLeggings());
|
||||||
event.GetEvent().getDrops().remove(killed.getInventory().getBoots());
|
event.GetEvent().getDrops().remove(killed.getInventory().getBoots());
|
||||||
|
|
||||||
|
skel.getEquipment().setItemInHandDropChance(1f);
|
||||||
|
skel.getEquipment().setHelmetDropChance(1f);
|
||||||
|
skel.getEquipment().setChestplateDropChance(1f);
|
||||||
|
skel.getEquipment().setLeggingsDropChance(1f);
|
||||||
|
skel.getEquipment().setBootsDropChance(1f);
|
||||||
|
|
||||||
if (_name)
|
if (_name)
|
||||||
{
|
{
|
||||||
@ -103,9 +113,9 @@ public class PerkSkeletons extends Perk
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void WolfUpdate(UpdateEvent event)
|
public void MinionUpdate(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (event.getType() != UpdateType.FAST)
|
if (event.getType() != UpdateType.SEC)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (Player player : _minions.keySet())
|
for (Player player : _minions.keySet())
|
||||||
@ -124,9 +134,19 @@ public class PerkSkeletons extends Perk
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Return to Owner
|
//Return to Owner
|
||||||
double range = 3;
|
double range = 4;
|
||||||
if (skel.getTarget() != null)
|
if (skel.getTarget() != null)
|
||||||
range = 12;
|
{
|
||||||
|
range = 8;
|
||||||
|
System.out.println("A: " + UtilEnt.getName(skel.getTarget()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (((CraftSkeleton)skel).getHandle().getGoalTarget() != null)
|
||||||
|
{
|
||||||
|
range = 8;
|
||||||
|
System.out.println("B: " + ((CraftSkeleton)skel).getHandle().getGoalTarget());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (UtilMath.offset(skel, player) > range)
|
if (UtilMath.offset(skel, player) > range)
|
||||||
{
|
{
|
||||||
@ -141,6 +161,9 @@ public class PerkSkeletons extends Perk
|
|||||||
nav.a(target.getX(), target.getY(), target.getZ(), speed);
|
nav.a(target.getX(), target.getY(), target.getZ(), speed);
|
||||||
|
|
||||||
skel.setTarget(null);
|
skel.setTarget(null);
|
||||||
|
((CraftSkeleton)skel).getHandle().setGoalTarget(null);
|
||||||
|
|
||||||
|
System.out.println("OUT OF RANGE! RETURN HOME MY FRIEND");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -162,4 +185,61 @@ public class PerkSkeletons extends Perk
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean IsMinion(Entity ent)
|
||||||
|
{
|
||||||
|
for (ArrayList<Skeleton> skels : _minions.values())
|
||||||
|
{
|
||||||
|
for (Skeleton skel : skels)
|
||||||
|
{
|
||||||
|
if (ent.equals(skel))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void Combust(EntityCombustEvent event)
|
||||||
|
{
|
||||||
|
if (IsMinion(event.getEntity()))
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void Damage(CustomDamageEvent event)
|
||||||
|
{
|
||||||
|
if (event.GetDamagerEntity(true) == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!IsMinion(event.GetDamagerEntity(true)))
|
||||||
|
return;
|
||||||
|
|
||||||
|
double damage = 4;
|
||||||
|
|
||||||
|
if (event.GetDamagerEntity(true) instanceof Skeleton)
|
||||||
|
{
|
||||||
|
Skeleton skel = (Skeleton)event.GetDamagerEntity(true);
|
||||||
|
|
||||||
|
if (skel.getEquipment().getItemInHand() != null)
|
||||||
|
{
|
||||||
|
if (skel.getEquipment().getItemInHand().getType() == Material.STONE_SWORD) damage = 5;
|
||||||
|
else if (skel.getEquipment().getItemInHand().getType() == Material.IRON_SWORD) damage = 6;
|
||||||
|
else if (skel.getEquipment().getItemInHand().getType() == Material.GOLD_SWORD) damage = 6;
|
||||||
|
else if (skel.getEquipment().getItemInHand().getType() == Material.DIAMOND_SWORD) damage = 7;
|
||||||
|
|
||||||
|
else if (skel.getEquipment().getItemInHand().getType() == Material.IRON_AXE) damage = 5;
|
||||||
|
else if (skel.getEquipment().getItemInHand().getType() == Material.GOLD_AXE) damage = 5;
|
||||||
|
else if (skel.getEquipment().getItemInHand().getType() == Material.DIAMOND_AXE) damage = 6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.GetProjectile() != null)
|
||||||
|
damage = 6;
|
||||||
|
|
||||||
|
event.AddMod("Skeleton Minion", "Negate", -event.GetDamageInitial(), false);
|
||||||
|
event.AddMod("Skeleton Minion", "Damage", damage, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,105 @@
|
|||||||
|
package nautilus.game.arcade.kit.perks;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftFallingSand;
|
||||||
|
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftTNTPrimed;
|
||||||
|
import org.bukkit.entity.Arrow;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.TNTPrimed;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.block.Action;
|
||||||
|
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.common.util.UtilInv;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import nautilus.game.arcade.kit.Perk;
|
||||||
|
|
||||||
|
public class PerkTNTArrow extends Perk
|
||||||
|
{
|
||||||
|
private HashSet<Player> _active = new HashSet<Player>();
|
||||||
|
private HashMap<Entity, Player> _tntMap = new HashMap<Entity, Player>();
|
||||||
|
|
||||||
|
public PerkTNTArrow()
|
||||||
|
{
|
||||||
|
super("Explosive Arrow", new String[]
|
||||||
|
{
|
||||||
|
C.cYellow + "Left-Click" + C.cGray + " with Bow to prepare " + C.cGreen + "Explosive Arrow"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void Fire(PlayerInteractEvent event)
|
||||||
|
{
|
||||||
|
if (event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.LEFT_CLICK_BLOCK)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (event.getPlayer().getItemInHand() == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (event.getPlayer().getItemInHand().getType() != Material.BOW)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
if (!Kit.HasKit(player))
|
||||||
|
return;
|
||||||
|
|
||||||
|
event.setCancelled(true);
|
||||||
|
|
||||||
|
if (!player.getInventory().contains(Material.TNT))
|
||||||
|
{
|
||||||
|
UtilPlayer.message(player, F.main("Game", "You have no " + F.item("TNT") + "."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_active.contains(player))
|
||||||
|
return;
|
||||||
|
|
||||||
|
//Use Stock
|
||||||
|
UtilInv.remove(player, Material.TNT, (byte)0, 1);
|
||||||
|
UtilInv.Update(player);
|
||||||
|
|
||||||
|
//Action
|
||||||
|
_active.add(player);
|
||||||
|
|
||||||
|
//Effect
|
||||||
|
player.getWorld().playSound(player.getLocation(), Sound.FIZZ, 2.5f, 2.0f);
|
||||||
|
|
||||||
|
//Inform
|
||||||
|
UtilPlayer.message(player, F.main("Game", "You prepared " + F.skill(GetName()) + "."));
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void ShootBow(EntityShootBowEvent event)
|
||||||
|
{
|
||||||
|
if (!(event.getEntity() instanceof Player))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!(event.getProjectile() instanceof Arrow))
|
||||||
|
return;
|
||||||
|
|
||||||
|
Player player = (Player)event.getEntity();
|
||||||
|
|
||||||
|
if (!_active.remove(player))
|
||||||
|
return;
|
||||||
|
|
||||||
|
//Inform
|
||||||
|
UtilPlayer.message(player, F.main("Game", "You fired " + F.skill(GetName()) + "."));
|
||||||
|
|
||||||
|
//TNT
|
||||||
|
TNTPrimed tnt = player.getWorld().spawn(player.getEyeLocation().add(0, 2, 0), TNTPrimed.class);
|
||||||
|
//XXX ((CraftTNTPrimed)tnt).getHandle().spectating = true;
|
||||||
|
|
||||||
|
event.getProjectile().setPassenger(tnt);
|
||||||
|
|
||||||
|
_tntMap.put(tnt, player);
|
||||||
|
}
|
||||||
|
}
|
@ -10,6 +10,7 @@ import org.bukkit.GameMode;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature;
|
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature;
|
||||||
|
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftLivingEntity;
|
||||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftWolf;
|
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftWolf;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -33,7 +34,6 @@ import mineplex.core.updater.event.UpdateEvent;
|
|||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import nautilus.game.arcade.kit.Perk;
|
import nautilus.game.arcade.kit.Perk;
|
||||||
import net.minecraft.server.v1_6_R3.EntityCreature;
|
import net.minecraft.server.v1_6_R3.EntityCreature;
|
||||||
import net.minecraft.server.v1_6_R3.EntityLiving;
|
|
||||||
import net.minecraft.server.v1_6_R3.Navigation;
|
import net.minecraft.server.v1_6_R3.Navigation;
|
||||||
|
|
||||||
public class PerkWolfPet extends Perk
|
public class PerkWolfPet extends Perk
|
||||||
@ -53,7 +53,6 @@ public class PerkWolfPet extends Perk
|
|||||||
{
|
{
|
||||||
C.cGray + "Spawn 1 Wolf every " + spawnRate + " seconds. Maximum of " + max + ".",
|
C.cGray + "Spawn 1 Wolf every " + spawnRate + " seconds. Maximum of " + max + ".",
|
||||||
C.cYellow + "Right-Click" + C.cGray + " with Sword/Axe to use " + C.cGreen + "Wolf Tackle",
|
C.cYellow + "Right-Click" + C.cGray + " with Sword/Axe to use " + C.cGreen + "Wolf Tackle",
|
||||||
//C.cYellow + "Hold Crouch" + C.cGray + " to " + C.cGreen + "Wolf Return"
|
|
||||||
});
|
});
|
||||||
|
|
||||||
_spawnRate = spawnRate;
|
_spawnRate = spawnRate;
|
||||||
@ -268,13 +267,13 @@ public class PerkWolfPet extends Perk
|
|||||||
public void CubStrikeHit(Player damager, LivingEntity damagee, Wolf wolf)
|
public void CubStrikeHit(Player damager, LivingEntity damagee, Wolf wolf)
|
||||||
{
|
{
|
||||||
//Damage Event
|
//Damage Event
|
||||||
((CraftWolf)wolf).getHandle().setGoalTarget((EntityLiving)damagee);
|
((CraftWolf)wolf).getHandle().setGoalTarget(((CraftLivingEntity)damagee).getHandle());
|
||||||
|
|
||||||
//Sound
|
//Sound
|
||||||
damagee.getWorld().playSound(damagee.getLocation(), Sound.WOLF_BARK, 1.5f, 1.5f);
|
damagee.getWorld().playSound(damagee.getLocation(), Sound.WOLF_BARK, 1.5f, 1.5f);
|
||||||
|
|
||||||
//Slow
|
//Slow
|
||||||
Manager.GetCondition().Factory().Slow(GetName(), damagee, damager, 6, 2, false, false, true, false);
|
Manager.GetCondition().Factory().Slow(GetName(), damagee, damager, 4, 1, false, false, true, false);
|
||||||
|
|
||||||
//Inform
|
//Inform
|
||||||
UtilPlayer.message(damager, F.main("Game", "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill("Wolf Tackle") + "."));
|
UtilPlayer.message(damager, F.main("Game", "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill("Wolf Tackle") + "."));
|
||||||
|
@ -145,6 +145,7 @@ public class GameCreationManager implements Listener
|
|||||||
Manager.GetDamage().SetEnabled(true);
|
Manager.GetDamage().SetEnabled(true);
|
||||||
Manager.GetExplosion().SetRegenerate(false);
|
Manager.GetExplosion().SetRegenerate(false);
|
||||||
Manager.GetExplosion().SetTNTSpread(true);
|
Manager.GetExplosion().SetTNTSpread(true);
|
||||||
|
Manager.GetAntiStack().SetEnabled(true);
|
||||||
|
|
||||||
HashMap<String, ChatColor> pastTeams = null;
|
HashMap<String, ChatColor> pastTeams = null;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user