Chiss' checklist.

This commit is contained in:
Virizion 2016-01-25 03:01:54 -05:00
parent bfe9aa7a59
commit 219b86ae55
6 changed files with 178 additions and 50 deletions

View File

@ -1405,6 +1405,9 @@ public class UtilBlock
itemStack.setType(Material.DARK_OAK_DOOR_ITEM);
itemStack.setDurability((short) 0);
break;
case ANVIL:
itemStack.setDurability((short) (itemStack.getDurability() / 4));
break;
}
return itemStacks;

View File

@ -1164,6 +1164,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
if (event.GetState() == GameState.Recruit)
{
getCosmeticManager().setActive(true);
getCosmeticManager().setHideParticles(false);
}
else if (event.GetState() == GameState.Prepare || event.GetState() == GameState.Loading || event.GetState() == GameState.Dead)
{
@ -1175,6 +1176,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation
getCosmeticManager().disableItemsForGame();
}
}
if (!event.GetGame().AllowParticles)
getCosmeticManager().setHideParticles(true);
}
}

View File

@ -5,6 +5,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map.Entry;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.MapUtil;
@ -76,6 +77,7 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.ItemMergeEvent;
import org.bukkit.event.player.PlayerBucketEmptyEvent;
import org.bukkit.event.player.PlayerBucketFillEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
@ -96,6 +98,8 @@ public class SpeedBuilders extends SoloGame
public int BuildSizeMin1 = BuildSize - 1;
public int BuildSizePow3 = BuildSize * BuildSize * BuildSize;
public boolean InstaBreak = true;
private SpeedBuildersState _state = SpeedBuildersState.VIEWING;
private long _stateTime = System.currentTimeMillis();
@ -106,7 +110,7 @@ public class SpeedBuilders extends SoloGame
private int _buildTimeTracker = 40;
private int _buildTime = 40;
private int _viewTime = 8;
private int _viewTime = 10;
private Location _buildMiddle;
@ -140,6 +144,8 @@ public class SpeedBuilders extends SoloGame
private RecreationData _lastRecreationTarget;
private double _standMoveProgress;
private Location _standStart;
private BuildData _nextBuild;
public SpeedBuilders(ArcadeManager manager)
{
@ -374,8 +380,12 @@ public class SpeedBuilders extends SoloGame
if (_judgeLaserTarget != null)
judgeTargetLocation(null);
CreatureAllowOverride = true;
_judgeLaserTarget = _judgeEntity.getWorld().spawn(loc, ArmorStand.class);
CreatureAllowOverride = false;
_judgeLaserTarget.setVisible(false);
_judgeLaserTarget.setGravity(false);
_judgeLaserTarget.setSmall(true);
@ -446,8 +456,6 @@ public class SpeedBuilders extends SoloGame
GetTeamList().get(0).RemovePlayer(players.get(i));
}
}
Manager.getCosmeticManager().setHideParticles(true);
}
@EventHandler
@ -463,7 +471,12 @@ public class SpeedBuilders extends SoloGame
return;
}
_currentBuild = UtilAlg.Random(_buildData, _usedBuilds);
if (_nextBuild != null)
_currentBuild = _nextBuild;
else
_currentBuild = UtilAlg.Random(_buildData, _usedBuilds);
_nextBuild = null;
_usedBuilds.add(_currentBuild);
_buildTime = _currentBuild.getBuildTime(_buildTimeTracker);
@ -503,15 +516,6 @@ public class SpeedBuilders extends SoloGame
setSpeedBuilderState(SpeedBuildersState.VIEWING);
}
@EventHandler
public void onEnd(GameStateChangeEvent event)
{
if (event.GetState() != GameState.End && event.GetState() != GameState.Dead)
return;
Manager.getCosmeticManager().setHideParticles(false);
}
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event)
{
@ -522,7 +526,14 @@ public class SpeedBuilders extends SoloGame
if (recreation != null)
{
recreation.clearBuildArea(true);
HashSet<Block> blocks = UtilBlock.findConnectedBlocks(recreation.OriginalBuildLocation.getBlock(), recreation.OriginalBuildLocation.getBlock(), null, 2000, 8);
//Sets should remove duplicates
blocks.addAll(recreation.getBlocks());
Manager.GetExplosion().BlockExplosion(blocks, recreation.getMidpoint(), false, true);
recreation.clearBuildArea(false);
if (_toEliminate.contains(recreation))
_toEliminate.remove(recreation);
@ -777,7 +788,7 @@ public class SpeedBuilders extends SoloGame
if (_allPerfect)
{
UtilTextMiddle.display("", C.cAqua + GUARDIAN_NAME + " is Impressed!", 0, 30, 10);
UtilTextMiddle.display("", C.cAqua + GUARDIAN_NAME + " is Impressed!", 0, 100, 10);
_allPerfect = false;
}
else
@ -842,6 +853,26 @@ public class SpeedBuilders extends SoloGame
if (!allPerfectMatch && !allPlayersEqual && lowest != null && !_toEliminate.contains(lowest))
_toEliminate.add(lowest);
if (!_toEliminate.isEmpty())
{
Manager.runSyncLater(new Runnable()
{
@Override
public void run()
{
for (Player player : GetTeamList().get(0).GetPlayers(true))
{
if (!_buildRecreations.containsKey(player))
return;
double percent = ((double) _buildRecreations.get(player).calculateScoreFromBuild(_currentBuild) / _currentBuild.getPerfectScore()) * 100d;
UtilTextMiddle.display("", C.cGold + "You scored " + C.cYellow + UtilMath.trim(1, percent) + " Percent", 0, 30, 10, player);
}
}
}, 80L);
}
_lastElimination = System.currentTimeMillis();
_reviewStartTime = System.currentTimeMillis();
@ -866,7 +897,12 @@ public class SpeedBuilders extends SoloGame
clearCenterArea(true);
_currentBuild = UtilAlg.Random(_buildData, _usedBuilds);
if (_nextBuild != null)
_currentBuild = _nextBuild;
else
_currentBuild = UtilAlg.Random(_buildData, _usedBuilds);
_nextBuild = null;
_usedBuilds.add(_currentBuild);
_buildTime = _currentBuild.getBuildTime(_buildTimeTracker);
@ -964,8 +1000,12 @@ public class SpeedBuilders extends SoloGame
return;
WorldData.World.playEffect(eliminating.getMidpoint(), Effect.EXPLOSION_HUGE, 0);
WorldData.World.playSound(eliminating.getMidpoint(), Sound.EXPLODE, 10F, 1F);
for (Player player : UtilServer.getPlayers())
{
player.playSound(player.getEyeLocation(), Sound.ZOMBIE_REMEDY, 1F, 1F);
}
HashSet<Block> blocks = UtilBlock.findConnectedBlocks(eliminating.OriginalBuildLocation.getBlock(), eliminating.OriginalBuildLocation.getBlock(), null, 2000, 8);
//Sets should remove duplicates
@ -983,7 +1023,7 @@ public class SpeedBuilders extends SoloGame
moveToGuardians(eliminating.Player, true);
}
}, 40L);
}, 100L);
}
else if (!_eliminating)
{
@ -1228,6 +1268,9 @@ public class SpeedBuilders extends SoloGame
UtilEnt.CreatureLook(_judgeEntity, _lookStand);
_standMoveProgress += 0.2;
if (_standMoveProgress > 1)
_targetReached = System.currentTimeMillis();
}
private void moveEntity(Location loc, Entity entity)
@ -1496,6 +1539,48 @@ public class SpeedBuilders extends SoloGame
}, 1);
}
@EventHandler
public void setNextBuild(PlayerCommandPreprocessEvent event)
{
if (!event.getMessage().startsWith("/setnext "))
return;
event.setCancelled(true);
if (!Manager.GetClients().Get(event.getPlayer()).GetRank().has(event.getPlayer(), Rank.MAPDEV, true))
return;
if (!Manager.getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing"))
{
UtilPlayer.message(event.getPlayer(), F.main("Build", C.cYellow + "You can only use this on testing servers!"));
return;
}
String buildName = event.getMessage().substring(9);
BuildData build = null;
for (BuildData buildData : _buildData)
{
if (buildData.BuildText.toUpperCase().startsWith(buildName.toUpperCase()))
{
build = buildData;
break;
}
}
if (build == null)
UtilPlayer.message(event.getPlayer(), F.main("Build", "That build does not exist!"));
else
{
_nextBuild = build;
UtilPlayer.message(event.getPlayer(), F.main("Build", "Set next build to " + F.elem(build.BuildText)));
}
}
@Override
public void EndCheck()
{
@ -1537,6 +1622,9 @@ public class SpeedBuilders extends SoloGame
if (winners == null)
return null;
if (GetTeamList().size() < 2)
return new ArrayList<Player>();
List<Player> losers = GetTeamList().get(1).GetPlayers(false);
@ -1560,22 +1648,37 @@ public class SpeedBuilders extends SoloGame
Scoreboard.WriteBlank();
Scoreboard.Write(C.cGreenB + "Players Left:");
Scoreboard.Write("" + GetTeamList().get(0).GetPlayers(true).size());
Scoreboard.Write(C.cYellowB + "Build");
if (_currentBuild == null)
Scoreboard.Write("(None)");
else
Scoreboard.Write(C.cWhite + _currentBuild.BuildText);
Scoreboard.WriteBlank();
if (_state == SpeedBuildersState.BUILDING)
Scoreboard.Write(C.cYellowB + "Round");
Scoreboard.Write("" + _roundsPlayed);
Scoreboard.WriteBlank();
List<Player> playersAlive = GetTeamList().get(0).GetPlayers(true);
List<Player> playersDead = new ArrayList<Player>();
if (GetTeamList().size() > 1)
playersDead.addAll(GetTeamList().get(1).GetPlayers(false));
Scoreboard.Write(C.cYellowB + "Players");
for (Player player : playersAlive)
{
long timeLeft = 1000 * _buildTime - (System.currentTimeMillis() - _stateTime);
if (timeLeft < 0)
timeLeft = 0;
Scoreboard.Write(C.cRedB + "Round Time:");
Scoreboard.Write(UtilTime.MakeStr(timeLeft));
Scoreboard.WriteBlank();
Scoreboard.Write(player.getName());
}
for (Player player : playersDead)
{
Scoreboard.Write(C.cGray + player.getName());
}
Scoreboard.Draw();

View File

@ -178,7 +178,21 @@ public class BuildData
public int getPerfectScore()
{
return Game.BuildSizePow3 + Mobs.size();
int nonAirBlocks = 0;
for (int x = 0; x < Game.BuildSize; x++)
{
for (int y = 0; y < Game.BuildSize; y++)
{
for (int z = 0; z < Game.BuildSize; z++)
{
if (Build[x][y][z].getType() != Material.AIR)
nonAirBlocks++;
}
}
}
return nonAirBlocks + Mobs.size();
}
}

View File

@ -56,6 +56,9 @@ public class DemolitionData
public void spawnHologram()
{
if (Parent.Game.InstaBreak)
return;
Location loc = Parent.getMidpoint();
if (!Blocks.isEmpty())
@ -70,6 +73,9 @@ public class DemolitionData
public void despawnHologram()
{
if (_hologram == null)
return;
_hologram.stop();
_hologram = null;
@ -77,6 +83,16 @@ public class DemolitionData
public void update()
{
if (Parent.Game.InstaBreak)
{
breakBlocks();
return;
}
if (_hologram == null)
spawnHologram();
int secondsLeft = (int) Math.ceil((3000 - (System.currentTimeMillis() - Start)) / 1000.0D);
if (secondsLeft < 0)

View File

@ -8,7 +8,7 @@ import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilInv;
import nautilus.game.arcade.game.games.speedbuilders.SpeedBuilders;
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.BlockStairs;
@ -30,7 +30,6 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.material.Bed;
import org.bukkit.material.Door;
import org.bukkit.material.Stairs;
import org.bukkit.util.Vector;
public class RecreationData
{
@ -206,9 +205,7 @@ public class RecreationData
for (ItemStack itemStack : UtilBlock.blockToInventoryItemStacks(block))
{
Item item = block.getWorld().dropItem(getMidpoint(), itemStack);
DroppedItems.put(item, System.currentTimeMillis());
UtilInv.insert(Player, itemStack);
}
//Destroy the other part
@ -243,25 +240,13 @@ public class RecreationData
for (Entity entity : Mobs)
{
ItemStack spawnEgg = new ItemStack(Material.MONSTER_EGG, 1, entity.getType().getTypeId());
Item item = entity.getWorld().dropItem(getMidpoint(), spawnEgg);
DroppedItems.put(item, System.currentTimeMillis());
UtilInv.insert(Player, spawnEgg);
}
CornerA.getWorld().playEffect(getMidpoint(), Effect.STEP_SOUND, Material.LOG.getId());
clearBuildArea(false);
//Velocity to player
for (Item item : DroppedItems.keySet())
{
item.setPickupDelay(0);
double mult = 0.5 + (0.6 * (UtilMath.offset(Player.getLocation(), item.getLocation())/16d));
item.setVelocity(Player.getLocation().toVector().subtract(item.getLocation().toVector()).normalize().add(new Vector(0, 0.4, 0)).multiply(mult));
}
}
public boolean isEmptyBuild(BuildData buildData)
@ -291,6 +276,9 @@ public class RecreationData
Block currentBlock = CornerA.clone().add(x, y, z).getBlock();
BlockState expectedState = buildData.Build[x][y][z];
if (expectedState.getType() == Material.AIR)
continue;
if (expectedState.getType() == currentBlock.getType() && expectedState.getRawData() == currentBlock.getData())
{
score++;