Small polish on Mavericks Master Builders

This commit is contained in:
xGamingDudex 2016-06-28 01:13:34 +02:00
parent d6672c44f4
commit 65e05b9d8c
4 changed files with 60 additions and 23 deletions

View File

@ -150,10 +150,15 @@ public class Build extends SoloGame
private ChatColor _firstHintColor = ChatColor.YELLOW;
protected UUID _winnerUUID = null;
public Build(ArcadeManager manager)
{
super(manager, GameType.Build,
this(manager, GameType.Build);
}
public Build(ArcadeManager manager, GameType gameType)
{
super(manager, gameType,
new Kit[]
{

View File

@ -184,25 +184,32 @@ public class BuildData
{
Blocks.add(block);
}
public boolean inBuildArea(Block block)
public boolean inBuildArea(Block block)
{
if (block.getX() < Math.min(CornerA.getBlockX(), CornerB.getBlockX()))
if(!block.getWorld().getName().equals(Spawn.getWorld().getName())) return false;
return inBuildArea(block.getLocation().add(0.5, 0, 0.5).toVector());
}
public boolean inBuildArea(Vector vec)
{
if (vec.getX() < Math.min(CornerA.getBlockX(), CornerB.getBlockX()))
return false;
if (block.getY() < Math.min(CornerA.getBlockY(), CornerB.getBlockY()))
if (vec.getY() < Math.min(CornerA.getBlockY(), CornerB.getBlockY()))
return false;
if (block.getZ() < Math.min(CornerA.getBlockZ(), CornerB.getBlockZ()))
if (vec.getZ() < Math.min(CornerA.getBlockZ(), CornerB.getBlockZ()))
return false;
if (block.getX() > Math.max(CornerA.getBlockX(), CornerB.getBlockX()))
if (vec.getX() > Math.max(CornerA.getBlockX(), CornerB.getBlockX()))
return false;
if (block.getY() > Math.max(CornerA.getBlockY(), CornerB.getBlockY()))
if (vec.getY() > Math.max(CornerA.getBlockY(), CornerB.getBlockY()))
return false;
if (block.getZ() > Math.max(CornerA.getBlockZ(), CornerB.getBlockZ()))
if (vec.getZ() > Math.max(CornerA.getBlockZ(), CornerB.getBlockZ()))
return false;
return true;

View File

@ -7,7 +7,9 @@ import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import mineplex.core.common.block.schematic.Schematic;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilItem;
import mineplex.core.recharge.Recharge;
@ -17,29 +19,25 @@ import nautilus.game.arcade.game.games.build.GroundData;
public class BuildDataCylinder extends BuildData
{
private final double RADIUS = 11;
private final double RADIUS = 11.5;
private final double HEIGHT = 25;
private final Location _blockSpawn;
public BuildDataCylinder(Player player, Location spawn, Location center)
{
super(player, spawn);
_blockSpawn = center.getBlock().getLocation();
_blockSpawn = center.getBlock().getLocation().add(0.5, 0, 0.5);
}
@Override
public boolean inBuildArea(Block block)
public boolean inBuildArea(Vector vec)
{
if(!block.getWorld().equals(_blockSpawn.getWorld())) return false;
Location loc = block.getLocation().add(0.5, 0, 0.5);
loc.setY(_blockSpawn.getY());
double yDiff = block.getY()-_blockSpawn.getY();
double yDiff = vec.getY()-_blockSpawn.getY();
if(yDiff < 0 || yDiff > HEIGHT) return false;
return loc.distanceSquared(_blockSpawn) < RADIUS*RADIUS;
vec.setY(_blockSpawn.getY());
return vec.distanceSquared(_blockSpawn.toVector()) < RADIUS*RADIUS;
}
@Override
@ -72,6 +70,32 @@ public class BuildDataCylinder extends BuildData
}
UtilBlock.stopQuickRecording();
getMin().getBlock().setType(mat);
getMax().subtract(0, HEIGHT, 0).getBlock().setType(mat);
getMax().getBlock().setType(mat);
}
@Override
public Schematic convertToSchematic()
{
//Clear out other floor blocks before creating the schematic block
// only keeping the build blocks and the floor set by the user
Location min = getMin();
Location max = getMax();
int y = min.getBlockY();
for(int x = min.getBlockX(); x < max.getBlockX(); x++)
{
for(int z = min.getBlockZ(); z < max.getBlockZ(); z++)
{
if(!inBuildArea(new Vector(x, min.getY()+1, z)))
{
UtilBlock.setQuick(min.getWorld(), x, y, z, 0, (byte) 0);
}
}
}
return super.convertToSchematic();
}
@Override
@ -83,7 +107,7 @@ public class BuildDataCylinder extends BuildData
@Override
protected Location getMax()
{
return _blockSpawn.clone().add(RADIUS, HEIGHT, RADIUS);
return _blockSpawn.clone().add(RADIUS, HEIGHT, RADIUS).subtract(0.5, 0, 0.5);
}
@Override

View File

@ -31,6 +31,7 @@ import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.mavericks.MavericksBuildRepository;
import mineplex.core.mavericks.MavericksBuildWrapper;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.games.build.Build;
import nautilus.game.arcade.game.games.build.BuildData;
@ -48,7 +49,7 @@ public class BuildMavericks extends Build
public BuildMavericks(ArcadeManager manager)
{
super(manager);
super(manager, GameType.BuildMavericks);
_words = new String[]
{