Dragon Escape changes
This commit is contained in:
parent
1912d2c23e
commit
60869d114e
@ -135,18 +135,19 @@ public class MapUtil
|
|||||||
return totalHeight / count;
|
return totalHeight / count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ChunkBlockChange(Location location, int id, byte data)
|
public static void ChunkBlockChange(Location location, int id, byte data, boolean notifyPlayers)
|
||||||
{
|
{
|
||||||
ChunkBlockChange(location.getWorld(), location.getBlockX(), location.getBlockY(), location.getBlockZ(), id,
|
ChunkBlockChange(location.getWorld(), location.getBlockX(), location.getBlockY(), location.getBlockZ(), id,
|
||||||
data);
|
data, notifyPlayers);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ChunkBlockChange(World world, int x, int y, int z, int id, byte data)
|
public static void ChunkBlockChange(World world, int x, int y, int z, int id, byte data, boolean notifyPlayers)
|
||||||
{
|
{
|
||||||
if (changeChunkBlock(x & 15, y, z & 15, ((CraftWorld) world).getHandle().getChunkAt(x >> 4, z >> 4),
|
if (changeChunkBlock(x & 15, y, z & 15, ((CraftWorld) world).getHandle().getChunkAt(x >> 4, z >> 4),
|
||||||
Block.getById(id), data))
|
Block.getById(id), data))
|
||||||
{
|
{
|
||||||
//((CraftWorld) world).getHandle().notify(x, y, z);
|
if (notifyPlayers)
|
||||||
|
((CraftWorld) world).getHandle().notify(x, y, z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,10 +256,10 @@ public class UtilBlock
|
|||||||
|
|
||||||
public static HashMap<Block, Double> getInRadius(Location loc, double dR)
|
public static HashMap<Block, Double> getInRadius(Location loc, double dR)
|
||||||
{
|
{
|
||||||
return getInRadius(loc, dR, 999);
|
return getInRadius(loc, dR, 9999);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HashMap<Block, Double> getInRadius(Location loc, double dR, double heightLimit)
|
public static HashMap<Block, Double> getInRadius(Location loc, double dR, double maxHeight)
|
||||||
{
|
{
|
||||||
HashMap<Block, Double> blockList = new HashMap<Block, Double>();
|
HashMap<Block, Double> blockList = new HashMap<Block, Double>();
|
||||||
int iR = (int)dR + 1;
|
int iR = (int)dR + 1;
|
||||||
@ -268,7 +268,7 @@ public class UtilBlock
|
|||||||
for (int z=-iR ; z <= iR ; z++)
|
for (int z=-iR ; z <= iR ; z++)
|
||||||
for (int y=-iR ; y <= iR ; y++)
|
for (int y=-iR ; y <= iR ; y++)
|
||||||
{
|
{
|
||||||
if (Math.abs(y) > heightLimit)
|
if (Math.abs(y) > maxHeight)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Block curBlock = loc.getWorld().getBlockAt((int)(loc.getX()+x), (int)(loc.getY()+y), (int)(loc.getZ()+z));
|
Block curBlock = loc.getWorld().getBlockAt((int)(loc.getX()+x), (int)(loc.getY()+y), (int)(loc.getZ()+z));
|
||||||
|
@ -139,21 +139,21 @@ public class UtilText
|
|||||||
if (align == TextAlign.CENTER)
|
if (align == TextAlign.CENTER)
|
||||||
for (int i=-64 ; i<=64 ; i++)
|
for (int i=-64 ; i<=64 ; i++)
|
||||||
{
|
{
|
||||||
MapUtil.ChunkBlockChange(world, bX + i * face.getModX(), bY + i * face.getModY(), bZ + i * face.getModZ(), 0, (byte)0);
|
MapUtil.ChunkBlockChange(world, bX + i * face.getModX(), bY + i * face.getModY(), bZ + i * face.getModZ(), 0, (byte)0, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (align == TextAlign.LEFT)
|
if (align == TextAlign.LEFT)
|
||||||
for (int i=0 ; i<=128 ; i++)
|
for (int i=0 ; i<=128 ; i++)
|
||||||
{
|
{
|
||||||
MapUtil.ChunkBlockChange(world, bX + i * face.getModX(), bY + i * face.getModY(), bZ + i * face.getModZ(), 0, (byte)0);
|
MapUtil.ChunkBlockChange(world, bX + i * face.getModX(), bY + i * face.getModY(), bZ + i * face.getModZ(), 0, (byte)0, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (align == TextAlign.RIGHT)
|
if (align == TextAlign.RIGHT)
|
||||||
for (int i=-128 ; i<=0 ; i++)
|
for (int i=-128 ; i<=0 ; i++)
|
||||||
{
|
{
|
||||||
MapUtil.ChunkBlockChange(world, bX + i * face.getModX(), bY + i * face.getModY(), bZ + i * face.getModZ(), 0, (byte)0);
|
MapUtil.ChunkBlockChange(world, bX + i * face.getModX(), bY + i * face.getModY(), bZ + i * face.getModZ(), 0, (byte)0, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -181,7 +181,7 @@ public class UtilText
|
|||||||
if (letter[x][y] == 1)
|
if (letter[x][y] == 1)
|
||||||
{
|
{
|
||||||
changes.add(world.getBlockAt(bX, bY, bZ));
|
changes.add(world.getBlockAt(bX, bY, bZ));
|
||||||
MapUtil.ChunkBlockChange(world, bX, bY, bZ, id, data);
|
MapUtil.ChunkBlockChange(world, bX, bY, bZ, id, data, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Forward
|
//Forward
|
||||||
|
@ -314,7 +314,7 @@ public class Explosion extends MiniPlugin
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
double chance = 0.2 + (double)_explosionBlocks.size()/(double)120;
|
double chance = 0.2 + (double)_explosionBlocks.size()/(double)120;
|
||||||
if (Math.random() > Math.min(0.85, chance))
|
if (Math.random() > Math.min(0.95, chance))
|
||||||
{
|
{
|
||||||
FallingBlock fall = cur.getWorld().spawnFallingBlock(cur.getLocation().add(0.5, 0.5, 0.5), blocks.get(cur).getKey(), blocks.get(cur).getValue());
|
FallingBlock fall = cur.getWorld().spawnFallingBlock(cur.getLocation().add(0.5, 0.5, 0.5), blocks.get(cur).getKey(), blocks.get(cur).getValue());
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ public class SnakePart
|
|||||||
|
|
||||||
public void sendBlock(Location loc, int id, byte data)
|
public void sendBlock(Location loc, int id, byte data)
|
||||||
{
|
{
|
||||||
MapUtil.ChunkBlockChange(loc, id, data);
|
MapUtil.ChunkBlockChange(loc, id, data, false);
|
||||||
|
|
||||||
|
|
||||||
for (Player player : UtilServer.getPlayers())
|
for (Player player : UtilServer.getPlayers())
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package nautilus.game.arcade.game.games.dragonescape;
|
package nautilus.game.arcade.game.games.dragonescape;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -10,6 +12,8 @@ import org.bukkit.Location;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.FireworkEffect.Type;
|
import org.bukkit.FireworkEffect.Type;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.entity.EnderDragon;
|
import org.bukkit.entity.EnderDragon;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -119,6 +123,9 @@ public class DragonEscape extends SoloGame
|
|||||||
|
|
||||||
if (WorldData.MapName.contains("Hell"))
|
if (WorldData.MapName.contains("Hell"))
|
||||||
this.WorldTimeSet = 16000;
|
this.WorldTimeSet = 16000;
|
||||||
|
|
||||||
|
if (WorldData.MapName.contains("Pirate"))
|
||||||
|
this.WorldWaterDamage = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -133,7 +140,7 @@ public class DragonEscape extends SoloGame
|
|||||||
|
|
||||||
dragon.setCustomName(ChatColor.YELLOW + C.Bold + "Douglas the Dragon");
|
dragon.setCustomName(ChatColor.YELLOW + C.Bold + "Douglas the Dragon");
|
||||||
|
|
||||||
_dragonData = new DragonEscapeData(this, dragon, _waypoints.get(0));
|
_dragonData = new DragonEscapeData(this, dragon, _waypoints.get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -148,8 +155,25 @@ public class DragonEscape extends SoloGame
|
|||||||
_dragonData.Target = _waypoints.get(Math.min(_waypoints.size()-1, (GetWaypointIndex(_dragonData.Location) + 1)));
|
_dragonData.Target = _waypoints.get(Math.min(_waypoints.size()-1, (GetWaypointIndex(_dragonData.Location) + 1)));
|
||||||
|
|
||||||
_dragonData.Move();
|
_dragonData.Move();
|
||||||
|
|
||||||
|
Set<Block> blocks = UtilBlock.getInRadius(_dragonData.Location, 10d).keySet();
|
||||||
|
|
||||||
|
Iterator<Block> blockIterator = blocks.iterator();
|
||||||
|
while (blockIterator.hasNext())
|
||||||
|
{
|
||||||
|
Block block = blockIterator.next();
|
||||||
|
|
||||||
|
if (block.isLiquid())
|
||||||
|
blockIterator.remove();
|
||||||
|
|
||||||
Manager.GetExplosion().BlockExplosion(UtilBlock.getInRadius(_dragonData.Location, 10d).keySet(), _dragonData.Location, false);
|
else if (WorldData.MapName.contains("Hell") && block.getY() < 30)
|
||||||
|
blockIterator.remove();
|
||||||
|
|
||||||
|
else if (WorldData.MapName.contains("Pirate") && block.getY() < 4)
|
||||||
|
blockIterator.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
Manager.GetExplosion().BlockExplosion(blocks, _dragonData.Location, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -161,7 +185,7 @@ public class DragonEscape extends SoloGame
|
|||||||
if (!IsLive())
|
if (!IsLive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_dragonData == null)
|
if (_dragonData == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
double dragonScore = GetScore(_dragonData.Dragon);
|
double dragonScore = GetScore(_dragonData.Dragon);
|
||||||
|
@ -177,20 +177,6 @@ public class Spleef extends SoloGame
|
|||||||
event.getPlayer().getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.SNOW_BALL));
|
event.getPlayer().getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.SNOW_BALL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Ignore
|
|
||||||
//@EventHandler
|
|
||||||
public void LeapDamage(PerkLeapEvent event)
|
|
||||||
{
|
|
||||||
if (!UtilEnt.isGrounded(event.GetPlayer()))
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (Block block : UtilBlock.getInRadius(event.GetPlayer().getLocation().subtract(0, 1, 0), 3d, 0).keySet())
|
|
||||||
{
|
|
||||||
BlockFade(block, event.GetPlayer(), false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void BlockFade(Block block, Player player, boolean slowDamage)
|
public void BlockFade(Block block, Player player, boolean slowDamage)
|
||||||
{
|
{
|
||||||
AddStat(player, "BlocksBroken", 1, false, false);
|
AddStat(player, "BlocksBroken", 1, false, false);
|
||||||
|
@ -121,18 +121,6 @@ public class SpleefTeams extends TeamGame
|
|||||||
BlockFade(event.getBlock(), event.getPlayer());
|
BlockFade(event.getBlock(), event.getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void LeapDamage(PerkLeapEvent event)
|
|
||||||
{
|
|
||||||
if (!UtilEnt.isGrounded(event.GetPlayer()))
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (Block block : UtilBlock.getInRadius(event.GetPlayer().getLocation().subtract(0, 1, 0), 3d, 0).keySet())
|
|
||||||
{
|
|
||||||
BlockFade(block, event.GetPlayer());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void BlockFade(Block block, Player player)
|
public void BlockFade(Block block, Player player)
|
||||||
{
|
{
|
||||||
UtilPlayer.hunger(player, 1);
|
UtilPlayer.hunger(player, 1);
|
||||||
|
@ -768,7 +768,7 @@ public class SurvivalGames extends SoloGame
|
|||||||
if (!IsLive())
|
if (!IsLive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
MapUtil.ChunkBlockChange(loc, id, data);
|
MapUtil.ChunkBlockChange(loc, id, data, false);
|
||||||
|
|
||||||
//Old Style
|
//Old Style
|
||||||
/*
|
/*
|
||||||
|
@ -774,7 +774,7 @@ public class SurvivalGamesTeams extends TeamGame
|
|||||||
if (!IsLive())
|
if (!IsLive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
MapUtil.ChunkBlockChange(loc, id, data);
|
MapUtil.ChunkBlockChange(loc, id, data, false);
|
||||||
|
|
||||||
//Old Style
|
//Old Style
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user