Countdown modifications, refactoring, dogs vs cats challenge changes.

This commit is contained in:
Thanos paravantis 2016-01-30 21:52:18 +02:00
parent 69dc888657
commit 0e1a14a0c3
11 changed files with 238 additions and 171 deletions

View File

@ -55,6 +55,7 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeFormat;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GamePrepareCountdownCommence;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.GameTeam.PlayerState;
@ -72,13 +73,13 @@ import nautilus.game.arcade.game.games.mineware.challenges.ChallengeFallingBlock
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeFastFood;
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeFishingDay;
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeInfestation;
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeKOTL;
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeKingOfTheHill;
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeKangarooJump;
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeLavaRun;
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeMilkACow;
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeMineADiamond;
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeMinecartDance;
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeMiniOITQ;
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeMiniOneInTheQuiver;
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeNavigateMaze;
import nautilus.game.arcade.game.games.mineware.challenges.ChallengePickASide;
import nautilus.game.arcade.game.games.mineware.challenges.ChallengePunchThePig;
@ -110,7 +111,7 @@ import nautilus.game.arcade.kit.Kit;
public class MineWare extends TeamGame implements IThrown
{
private int _livesAmount = 1;
private int _livesAmount = 5;
private String _restrictCommand = "restrict";
private String _skipCommand = "skip";
@ -197,12 +198,12 @@ public class MineWare extends TeamGame implements IThrown
_challenges.add(ChallengeWaterHorror.class);
_challenges.add(ChallengeInfestation.class);
_challenges.add(ChallengeKangarooJump.class);
_challenges.add(ChallengeKOTL.class);
_challenges.add(ChallengeKingOfTheHill.class);
_challenges.add(ChallengeLavaRun.class);
_challenges.add(ChallengeMilkACow.class);
_challenges.add(ChallengeMineADiamond.class);
_challenges.add(ChallengeMinecartDance.class);
_challenges.add(ChallengeMiniOITQ.class);
_challenges.add(ChallengeMiniOneInTheQuiver.class);
_challenges.add(ChallengeNavigateMaze.class);
_challenges.add(ChallengePickASide.class);
_challenges.add(ChallengePunchThePig.class);
@ -217,14 +218,15 @@ public class MineWare extends TeamGame implements IThrown
_challenges.add(ChallengeVolleyPig.class);
_challenges.add(ChallengeWaveCrush.class);
// ============== trashed ==============
// _challenges.add(ChallengeSimonSays.class);
// _challenges.add(ChallengeHitTargets.class);
// _challenges.add(ChallengeTameTheWolf.class);
// These challenges are currently not used.
// _challenges.add(ChallengeBlockShot.class);
// _challenges.add(ChallengeNameThatSound.class);
// _challenges.add(ChallengeSkyFall.class);
// _challenges.add(ChallengeDiamondFall.class);
// _challenges.add(ChallengeHitTargets.class);
// _challenges.add(ChallengeNameThatSound.class);
// _challenges.add(ChallengeSimonSays.class);
// _challenges.add(ChallengeSkyFall.class);
// _challenges.add(ChallengeTameTheWolf.class);
}
@EventHandler
@ -722,6 +724,12 @@ public class MineWare extends TeamGame implements IThrown
@Override
public void run()
{
if (!IsLive())
{
cancel();
return;
}
for (Player player : UtilServer.getPlayers())
{
String message = messages.get(looped);
@ -745,6 +753,16 @@ public class MineWare extends TeamGame implements IThrown
}.runTaskTimer(Manager.getPlugin(), 0, 15);
}
@EventHandler
public void onGamePrepareCountdown(GamePrepareCountdownCommence event)
{
for (Player player : GetPlayers(true))
{
player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Integer.MAX_VALUE, 1));
player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, Integer.MAX_VALUE, 1));
}
}
@EventHandler
public void onPlayerMove(PlayerMoveEvent event)
{
@ -856,13 +874,12 @@ public class MineWare extends TeamGame implements IThrown
if (event.getType() != UpdateType.FASTEST)
return;
// If there is only 1 player and the game starts, do not teleport him to
// the map.
// If there is only 1 player and the game starts, do not teleport him to the map.
if (GetState() == GameState.Recruit && GetCountdown() >= 0 && GetPlayers(false).size() < 2)
{
UtilServer
.broadcast(F.main(GetType().GetName(), C.cRed + "This game requires at least 2 players to start."));
.broadcast(F.main(GetName(), C.cRed + "This game requires at least 2 players to start."));
SetCountdown(-1);
Manager.GetLobby().DisplayWaiting();
}
@ -889,7 +906,6 @@ public class MineWare extends TeamGame implements IThrown
SetPlayerState(player, PlayerState.OUT);
Manager.addSpectator(player, true);
event.setCancelled(true);
}
}
}
@ -917,25 +933,25 @@ public class MineWare extends TeamGame implements IThrown
Class<? extends Challenge> result = (Class<? extends Challenge>) Class
.forName("nautilus.game.arcade.game.games.mineware.challenges.Challenge" + rawClass);
Announce(C.cAqua + C.Bold + GetType().GetName() + " restricted to " + rawClass + " challenge.");
Announce(C.cAqua + C.Bold + GetName() + " restricted to " + rawClass + " challenge.");
_challenges.clear();
_challenges.add(result);
}
catch (ClassNotFoundException e)
{
UtilPlayer.message(player, F.main(GetType().GetName(),
UtilPlayer.message(player, F.main(GetName(),
"Could not match " + F.elem(rawClass) + " with any challenges."));
}
catch (ClassCastException e)
{
UtilPlayer.message(player,
F.main(GetType().GetName(), F.elem(rawClass) + "is not a challenge!"));
F.main(GetName(), F.elem(rawClass) + "is not a challenge!"));
}
}
else
{
Announce(C.cAqua + C.Bold + GetType().GetName() + " challenge restrictions were cleared.");
Announce(C.cAqua + C.Bold + GetName() + " challenge restrictions were cleared.");
_challenges.clear();
populateChallenges();
}
@ -954,7 +970,7 @@ public class MineWare extends TeamGame implements IThrown
else
{
UtilPlayer.message(player,
F.main(GetType().GetName(), "You cannot skip a challenge if the game is not started."));
F.main(GetName(), "You cannot skip a challenge if the game is not started."));
}
event.setCancelled(true);
@ -1030,6 +1046,27 @@ public class MineWare extends TeamGame implements IThrown
new Location(WorldData.World, 53, 0, 3));
}
@EventHandler
public void onGameEnd(GameStateChangeEvent event)
{
if (event.GetState() != GameState.End)
return;
if (_challengeStarted)
return;
for (Player player : GetPlayers(true))
{
if (player.hasPotionEffect(PotionEffectType.BLINDNESS) && player.hasPotionEffect(PotionEffectType.NIGHT_VISION))
{
player.removePotionEffect(PotionEffectType.BLINDNESS);
player.removePotionEffect(PotionEffectType.NIGHT_VISION);
}
UtilTextMiddle.display(null, null, player);
}
}
@EventHandler
public void onBlood(BloodEvent event)
{

View File

@ -101,7 +101,7 @@ public class ChallengeDogsVersusCats extends Challenge
Host.getArcadeManager().GetDisguise().disguise(Ddog);
player.getInventory().addItem(
ItemStackFactory.Instance.CreateStack(Material.BONE, (byte) 0, 1, ChatColor.GREEN + "Left-click to bark!"));
ItemStackFactory.Instance.CreateStack(Material.BONE, (byte) 0, 1, C.Reset + C.Bold + "Left-Click to bark!"));
UtilPlayer.message(player, C.cYellow + C.Bold + "You are a Dog, bark!");
}
else
@ -112,7 +112,7 @@ public class ChallengeDogsVersusCats extends Challenge
Host.getArcadeManager().GetDisguise().disguise(Dcat);
player.getInventory().addItem(
ItemStackFactory.Instance.CreateStack(Material.STRING, (byte) 0, 1, ChatColor.GREEN + "Left-click to meow!"));
ItemStackFactory.Instance.CreateStack(Material.STRING, (byte) 0, 1, C.Reset + C.Bold + "Left-Click to meow!"));
UtilPlayer.message(player, C.cYellow + C.Bold + "You are a Cat, meow!");
}
looped++;

View File

@ -24,12 +24,12 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.games.mineware.Challenge;
import nautilus.game.arcade.game.games.mineware.MineWare;
public class ChallengeKOTL extends Challenge
public class ChallengeKingOfTheHill extends Challenge
{
private Location _winCornerA = new Location(Host.WorldData.World, -2, 20, -2);
private Location _winCornerB = new Location(Host.WorldData.World, 2, 23, 2);
public ChallengeKOTL(MineWare host)
public ChallengeKingOfTheHill(MineWare host)
{
super(host, ChallengeType.FirstComplete, "King Of The Ladder", "Reach the top of the ladder.");
}

View File

@ -23,9 +23,9 @@ import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.games.mineware.Challenge;
import nautilus.game.arcade.game.games.mineware.MineWare;
public class ChallengeMiniOITQ extends Challenge
public class ChallengeMiniOneInTheQuiver extends Challenge
{
public ChallengeMiniOITQ(MineWare host)
public ChallengeMiniOneInTheQuiver(MineWare host)
{
super(host, ChallengeType.LastStanding, "Mini OITQ", false, true, "Do not get hit!", "You receive a new arrow every 4 seconds.", "Last man standing wins!");
}

View File

@ -1,4 +1,4 @@
package nautilus.game.arcade.game.games.mineware.challenges;
package nautilus.game.arcade.game.games.mineware.challenges.removed;
import java.util.ArrayList;
import java.util.HashMap;
@ -40,7 +40,7 @@ public class ChallengeBlockShot extends Challenge
public ChallengeBlockShot(MineWare host)
{
super(host, ChallengeType.FirstComplete,"Block Shot", "Shoot down 5 blocks");
super(host, ChallengeType.FirstComplete, "Block Shot", "Shoot down 5 blocks");
}
@Override
@ -97,7 +97,8 @@ public class ChallengeBlockShot extends Challenge
sloc.add(UtilAlg.getTrajectory(sloc, block.getLocation().add(0.5, 0.5, 0.5)).multiply(
Math.min(7, block.getLocation().distance(sloc))));
displayCount(player, sloc, (score >= 5 ? C.cDGreen : score >= 3 ? C.cGreen: score >= 1 ? C.cRed : C.cDRed) + score);
displayCount(player, sloc,
(score >= 5 ? C.cDGreen : score >= 3 ? C.cGreen : score >= 1 ? C.cRed : C.cDRed) + score);
if (score == 5)
{

View File

@ -1,4 +1,4 @@
package nautilus.game.arcade.game.games.mineware.challenges;
package nautilus.game.arcade.game.games.mineware.challenges.removed;
import java.util.ArrayList;
import java.util.Collections;
@ -23,7 +23,7 @@ public class ChallengeDiamondFall extends Challenge
{
public ChallengeDiamondFall(MineWare host)
{
super(host, ChallengeType.LastStanding,"Diamond Fall", "Loot the most diamonds from chests!");
super(host, ChallengeType.LastStanding, "Diamond Fall", "Loot the most diamonds from chests!");
}
@Override
@ -121,10 +121,12 @@ public class ChallengeDiamondFall extends Challenge
Block b = getCenter().getBlock().getRelative(UtilMath.r(16) - 8, y, UtilMath.r(16) - 8);
boolean chestFound = false;
for (BlockFace face : new BlockFace[]
{
BlockFace.EAST, BlockFace.WEST, BlockFace.NORTH, BlockFace.SOUTH
})
for (BlockFace face : new BlockFace[] {
BlockFace.EAST,
BlockFace.WEST,
BlockFace.NORTH,
BlockFace.SOUTH
})
{
Block block = b.getRelative(face);

View File

@ -1,4 +1,4 @@
package nautilus.game.arcade.game.games.mineware.challenges;
package nautilus.game.arcade.game.games.mineware.challenges.removed;
import java.util.ArrayList;
import java.util.HashMap;
@ -24,7 +24,7 @@ public class ChallengeHitTargets extends Challenge
public ChallengeHitTargets(MineWare host)
{
super(host, ChallengeType.FirstComplete,"Hit target", "Hit the chosen players");
super(host, ChallengeType.FirstComplete, "Hit target", "Hit the chosen players");
}
@EventHandler
@ -64,12 +64,12 @@ public class ChallengeHitTargets extends Challenge
}
}
// @Override
// public String getMessage(Player player)
// {
// return C.cYellow + "Hit the players " + C.cWhite
// + StringUtils.join(_targets.get(player.getName()), C.cYellow + ", " + C.cWhite);
// }
// @Override
// public String getMessage(Player player)
// {
// return C.cYellow + "Hit the players " + C.cWhite
// + StringUtils.join(_targets.get(player.getName()), C.cYellow + ", " + C.cWhite);
// }
@Override
public int getMinPlayers()

View File

@ -1,4 +1,4 @@
package nautilus.game.arcade.game.games.mineware.challenges;
package nautilus.game.arcade.game.games.mineware.challenges.removed;
import java.util.ArrayList;
import java.util.Collections;
@ -40,85 +40,109 @@ public class ChallengeNameThatSound extends ChallengeSeperateRooms
{
super(host, ChallengeType.FirstComplete, "Hit the creature that makes the noises");
_sounds.put(EntityType.ZOMBIE, new Sound[]
{
Sound.ZOMBIE_DEATH, Sound.ZOMBIE_HURT, Sound.ZOMBIE_IDLE, Sound.ZOMBIE_INFECT, Sound.ZOMBIE_METAL,
Sound.ZOMBIE_REMEDY, Sound.ZOMBIE_UNFECT
});
_sounds.put(EntityType.ZOMBIE, new Sound[] {
Sound.ZOMBIE_DEATH,
Sound.ZOMBIE_HURT,
Sound.ZOMBIE_IDLE,
Sound.ZOMBIE_INFECT,
Sound.ZOMBIE_METAL,
Sound.ZOMBIE_REMEDY,
Sound.ZOMBIE_UNFECT
});
_sounds.put(EntityType.PIG, new Sound[]
{
Sound.PIG_DEATH, Sound.PIG_IDLE
});
_sounds.put(EntityType.PIG, new Sound[] {
Sound.PIG_DEATH,
Sound.PIG_IDLE
});
_sounds.put(EntityType.CHICKEN, new Sound[]
{
Sound.CHICKEN_EGG_POP, Sound.CHICKEN_HURT, Sound.CHICKEN_IDLE
});
_sounds.put(EntityType.CHICKEN, new Sound[] {
Sound.CHICKEN_EGG_POP,
Sound.CHICKEN_HURT,
Sound.CHICKEN_IDLE
});
/*_sounds.put(EntityType.SPIDER, new Sound[]
{
Sound.SPIDER_DEATH, Sound.SPIDER_IDLE
});*/
/*
* _sounds.put(EntityType.SPIDER, new Sound[] { Sound.SPIDER_DEATH, Sound.SPIDER_IDLE });
*/
_sounds.put(EntityType.IRON_GOLEM, new Sound[]
{
Sound.IRONGOLEM_DEATH, Sound.IRONGOLEM_HIT, Sound.IRONGOLEM_THROW
});
_sounds.put(EntityType.IRON_GOLEM, new Sound[] {
Sound.IRONGOLEM_DEATH,
Sound.IRONGOLEM_HIT,
Sound.IRONGOLEM_THROW
});
_sounds.put(EntityType.ENDERMAN, new Sound[]
{
Sound.ENDERMAN_DEATH, Sound.ENDERMAN_HIT, Sound.ENDERMAN_IDLE, Sound.ENDERMAN_SCREAM, Sound.ENDERMAN_TELEPORT
});
_sounds.put(EntityType.ENDERMAN, new Sound[] {
Sound.ENDERMAN_DEATH,
Sound.ENDERMAN_HIT,
Sound.ENDERMAN_IDLE,
Sound.ENDERMAN_SCREAM,
Sound.ENDERMAN_TELEPORT
});
_sounds.put(EntityType.COW, new Sound[]
{
Sound.COW_HURT, Sound.COW_IDLE, Sound.COW_WALK
});
_sounds.put(EntityType.COW, new Sound[] {
Sound.COW_HURT,
Sound.COW_IDLE,
Sound.COW_WALK
});
_sounds.put(EntityType.HORSE, new Sound[]
{
Sound.HORSE_ANGRY, Sound.HORSE_BREATHE, Sound.HORSE_DEATH, Sound.HORSE_GALLOP, Sound.HORSE_ARMOR,
Sound.HORSE_HIT, Sound.HORSE_IDLE
});
_sounds.put(EntityType.HORSE, new Sound[] {
Sound.HORSE_ANGRY,
Sound.HORSE_BREATHE,
Sound.HORSE_DEATH,
Sound.HORSE_GALLOP,
Sound.HORSE_ARMOR,
Sound.HORSE_HIT,
Sound.HORSE_IDLE
});
_sounds.put(EntityType.OCELOT, new Sound[]
{
Sound.CAT_HISS, Sound.CAT_HIT, Sound.CAT_MEOW, Sound.CAT_PURR, Sound.CAT_PURREOW
});
_sounds.put(EntityType.OCELOT, new Sound[] {
Sound.CAT_HISS,
Sound.CAT_HIT,
Sound.CAT_MEOW,
Sound.CAT_PURR,
Sound.CAT_PURREOW
});
_sounds.put(EntityType.VILLAGER, new Sound[]
{
Sound.VILLAGER_DEATH, Sound.VILLAGER_HAGGLE, Sound.VILLAGER_HIT, Sound.VILLAGER_IDLE, Sound.VILLAGER_NO,
Sound.VILLAGER_YES
});
_sounds.put(EntityType.VILLAGER, new Sound[] {
Sound.VILLAGER_DEATH,
Sound.VILLAGER_HAGGLE,
Sound.VILLAGER_HIT,
Sound.VILLAGER_IDLE,
Sound.VILLAGER_NO,
Sound.VILLAGER_YES
});
_sounds.put(EntityType.WOLF, new Sound[]
{
Sound.WOLF_BARK, Sound.WOLF_DEATH, Sound.WOLF_GROWL, Sound.WOLF_HURT, Sound.WOLF_PANT, Sound.WOLF_SHAKE,
Sound.WOLF_WHINE
});
_sounds.put(EntityType.WOLF, new Sound[] {
Sound.WOLF_BARK,
Sound.WOLF_DEATH,
Sound.WOLF_GROWL,
Sound.WOLF_HURT,
Sound.WOLF_PANT,
Sound.WOLF_SHAKE,
Sound.WOLF_WHINE
});
_sounds.put(EntityType.PIG_ZOMBIE, new Sound[]
{
Sound.ZOMBIE_PIG_ANGRY, Sound.ZOMBIE_PIG_DEATH, Sound.ZOMBIE_PIG_HURT, Sound.ZOMBIE_PIG_IDLE
});
_sounds.put(EntityType.PIG_ZOMBIE, new Sound[] {
Sound.ZOMBIE_PIG_ANGRY,
Sound.ZOMBIE_PIG_DEATH,
Sound.ZOMBIE_PIG_HURT,
Sound.ZOMBIE_PIG_IDLE
});
_sounds.put(EntityType.SHEEP, new Sound[]
{
Sound.SHEEP_IDLE
});
_sounds.put(EntityType.SHEEP, new Sound[] {
Sound.SHEEP_IDLE
});
_sounds.put(EntityType.SKELETON, new Sound[]
{
Sound.SKELETON_DEATH, Sound.SKELETON_HURT, Sound.SKELETON_IDLE
});
_sounds.put(EntityType.SKELETON, new Sound[] {
Sound.SKELETON_DEATH,
Sound.SKELETON_HURT,
Sound.SKELETON_IDLE
});
/*_sounds.put(EntityType.SLIME, new Sound[]
{
Sound.SLIME_ATTACK, Sound.SLIME_WALK, Sound.SLIME_WALK2, Sound.MAGMACUBE_JUMP, Sound.MAGMACUBE_WALK,
Sound.MAGMACUBE_WALK2
});*/
/*
* _sounds.put(EntityType.SLIME, new Sound[] { Sound.SLIME_ATTACK, Sound.SLIME_WALK, Sound.SLIME_WALK2, Sound.MAGMACUBE_JUMP,
* Sound.MAGMACUBE_WALK, Sound.MAGMACUBE_WALK2 });
*/
while (_toPlay.size() < 3)
{
@ -224,7 +248,8 @@ public class ChallengeNameThatSound extends ChallengeSeperateRooms
"Guess",
"Wait "
+ UtilTime.convertString((_lastGuess.get(player.getName()) + 3000) - System.currentTimeMillis(), 1,
TimeUnit.SECONDS) + " before next guess"));
TimeUnit.SECONDS)
+ " before next guess"));
return;
}

View File

@ -1,4 +1,4 @@
package nautilus.game.arcade.game.games.mineware.challenges;
package nautilus.game.arcade.game.games.mineware.challenges.removed;
import java.util.ArrayList;
import java.util.HashMap;
@ -56,7 +56,8 @@ public class ChallengeSimonSays extends Challenge
public ChallengeSimonSays(MineWare host)
{
super(host, ChallengeType.FirstComplete, "Simon Says", "Do everything Simon says", "Don't listen to anyone else!", "first with 3 correct wins!");
super(host, ChallengeType.FirstComplete, "Simon Says", "Do everything Simon says", "Don't listen to anyone else!",
"first with 3 correct wins!");
}
private enum simonTypes
@ -86,11 +87,11 @@ public class ChallengeSimonSays extends Challenge
{
ArrayList<Location> spawns = new ArrayList<Location>();
for(int x = -(getArenaSize() - 1); x <= getArenaSize(); x++)
for (int x = -(getArenaSize() - 1); x <= getArenaSize(); x++)
{
for(int z = -(getArenaSize() - 1); z <= getArenaSize(); z++)
for (int z = -(getArenaSize() - 1); z <= getArenaSize(); z++)
{
if(x % 2 == 0 && z % 2 == 0)
if (x % 2 == 0 && z % 2 == 0)
{
spawns.add(getCenter().clone().add(x + 0.5, 1.1, z + 0.5));
}
@ -108,7 +109,7 @@ public class ChallengeSimonSays extends Challenge
@Override
public void setupPlayers()
{
for(Player players : Host.GetPlayers(true))
for (Player players : Host.GetPlayers(true))
{
_playerScore.put(players.getName(), 0);
}
@ -118,21 +119,21 @@ public class ChallengeSimonSays extends Challenge
@Override
public void generateRoom()
{
for(int x = -getArenaSize(); x <= getArenaSize(); x++)
for (int x = -getArenaSize(); x <= getArenaSize(); x++)
{
for(int z = -getArenaSize(); z <= getArenaSize(); z++)
for (int z = -getArenaSize(); z <= getArenaSize(); z++)
{
for(int y = 0; y <= 1; y++)
for (int y = 0; y <= 1; y++)
{
Block b = getCenter().getBlock().getRelative(x, y, z);
if(y == 0)
if (y == 0)
{
b.setType(Material.GRASS);
}
if(x == 0 && z == 0)
if (x == 0 && z == 0)
{
for(int i = 0; i <= 2; i++)
for (int i = 0; i <= 2; i++)
{
b = getCenter().getBlock().getRelative(x, i, z);
b.setType(Material.WOOL);
@ -142,13 +143,13 @@ public class ChallengeSimonSays extends Challenge
}
else
{
if(Math.abs(x) == getArenaSize() || Math.abs(z) == getArenaSize())
if (Math.abs(x) == getArenaSize() || Math.abs(z) == getArenaSize())
{
b.setType(Material.FENCE);
}
}
if(b.getType() != Material.AIR)
if (b.getType() != Material.AIR)
{
addBlock(b);
}
@ -170,17 +171,17 @@ public class ChallengeSimonSays extends Challenge
@EventHandler
public void onPlayerJump(PlayerMoveEvent event)
{
if(!Host.IsLive())
if (!Host.IsLive())
{
return;
}
if(_currentType != simonTypes.Jump)
if (_currentType != simonTypes.Jump)
{
return;
}
if(event.getFrom().getY() < event.getTo().getY())
if (event.getFrom().getY() < event.getTo().getY())
{
if(_truthful == true)
if (_truthful == true)
{
playerScoreIncrease(event.getPlayer());
}
@ -194,20 +195,20 @@ public class ChallengeSimonSays extends Challenge
@EventHandler
public void onPlayerPunch(PlayerInteractEvent event)
{
if(!Host.IsLive())
if (!Host.IsLive())
{
return;
}
if(_currentType != simonTypes.Punch && _currentType != simonTypes.Punch_Block)
if (_currentType != simonTypes.Punch && _currentType != simonTypes.Punch_Block)
{
return;
}
if(event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK)
if (event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK)
{
if(_currentType == simonTypes.Punch)
if (_currentType == simonTypes.Punch)
{
if(_truthful)
if (_truthful)
{
playerScoreIncrease(event.getPlayer());
}
@ -218,11 +219,11 @@ public class ChallengeSimonSays extends Challenge
}
else
{
if(event.getClickedBlock() != null)
if (event.getClickedBlock() != null)
{
if(event.getClickedBlock().getType() != Material.AIR)
if (event.getClickedBlock().getType() != Material.AIR)
{
if(_truthful)
if (_truthful)
{
playerScoreIncrease(event.getPlayer());
}
@ -239,21 +240,21 @@ public class ChallengeSimonSays extends Challenge
@EventHandler
public void onPlayerShootBow(EntityShootBowEvent event)
{
if(!Host.IsLive())
if (!Host.IsLive())
{
return;
}
if(_currentType != simonTypes.Shoot_Arrow)
if (_currentType != simonTypes.Shoot_Arrow)
{
return;
}
if(!(event.getEntity() instanceof Player))
if (!(event.getEntity() instanceof Player))
{
return;
}
Player player = (Player) event.getEntity();
if(_truthful)
if (_truthful)
{
playerScoreIncrease(player);
}
@ -262,30 +263,30 @@ public class ChallengeSimonSays extends Challenge
playerScoreOnFail(player);
}
}
@EventHandler
public void onOrderLookUp(UpdateEvent event)
{
if(!Host.IsLive())
if (!Host.IsLive())
{
return;
}
if(_currentType != simonTypes.LookUp)
if (_currentType != simonTypes.LookUp)
{
return;
}
if(_eventKey)
if (_eventKey)
{
new BukkitRunnable()
{
@Override
public void run()
{
for(Player player: Host.GetPlayers(true))
for (Player player : Host.GetPlayers(true))
{
if(player.getEyeLocation().getPitch() <= -45)
if (player.getEyeLocation().getPitch() <= -45)
{
if(_truthful)
if (_truthful)
{
playerScoreIncrease(player);
}
@ -300,15 +301,15 @@ public class ChallengeSimonSays extends Challenge
}
}
}
}.runTaskLater(Host.Manager.getPlugin(), 20*4);
}.runTaskLater(Host.Manager.getPlugin(), 20 * 4);
_eventKey = false;
}
}
@EventHandler
public void onChallengeEnd(ChallengeEndEvent event)
{
if(!(event.getEndedChallenge() instanceof ChallengeSimonSays))
if (!(event.getEndedChallenge() instanceof ChallengeSimonSays))
{
return;
}
@ -317,7 +318,7 @@ public class ChallengeSimonSays extends Challenge
private void activeOrder()
{
if(_timesRan == 0)
if (_timesRan == 0)
{
_truthful = true;
}
@ -333,17 +334,18 @@ public class ChallengeSimonSays extends Challenge
_playerRoundFinish.clear();
_eventKey = true;
Bukkit.broadcastMessage(C.cGreen + C.Bold + "Villager> " + C.cYellow + (_truthful == true ? "Simon says: " : "") + _currentType.getOrderName());
Bukkit.broadcastMessage(
C.cGreen + C.Bold + "Villager> " + C.cYellow + (_truthful == true ? "Simon says: " : "") + _currentType.getOrderName());
startOrderTimer();
}
private void stopCurrentOrder()
{
for(Player player : Host.GetPlayers(true))
for (Player player : Host.GetPlayers(true))
{
if(!_playerRoundFinish.contains(player.getName()))
if (!_playerRoundFinish.contains(player.getName()))
{
if(!_truthful)
if (!_truthful)
{
playerScoreIncrease(player);
}
@ -363,25 +365,25 @@ public class ChallengeSimonSays extends Challenge
}
}.runTaskLater(Host.Manager.getPlugin(), 20 * 3);
}
private void startOrderTimer()
{
final double endTime = _roundPause*1000 + System.currentTimeMillis();
final double endTime = _roundPause * 1000 + System.currentTimeMillis();
final double timerAddtion = endTime / 100;
_time = 0;
new BukkitRunnable()
{
@Override
public void run()
{
if(!Host.IsLive() || !Host.isChallengeStarted())
if (!Host.IsLive() || !Host.isChallengeStarted())
{
this.cancel();
}
UtilTextBottom.displayProgress(_time / System.currentTimeMillis(), Host.GetPlayers(true).toArray(new Player[0]));
_time = _time+timerAddtion;
if(System.currentTimeMillis() > endTime)
_time = _time + timerAddtion;
if (System.currentTimeMillis() > endTime)
{
stopCurrentOrder();
this.cancel();
@ -393,22 +395,22 @@ public class ChallengeSimonSays extends Challenge
private simonTypes getSimonTypeRandomly()
{
simonTypes pickedType = simonTypes.getRandomType();
while(pickedType == _currentType)
while (pickedType == _currentType)
{
pickedType = simonTypes.getRandomType();
}
if(_currentType == simonTypes.Shoot_Arrow)
if (_currentType == simonTypes.Shoot_Arrow)
{
for(Player player : Host.GetPlayers(true))
for (Player player : Host.GetPlayers(true))
{
player.getInventory().clear();
}
}
if(pickedType == simonTypes.Shoot_Arrow)
if (pickedType == simonTypes.Shoot_Arrow)
{
for(Player player : Host.GetPlayers(true))
for (Player player : Host.GetPlayers(true))
{
player.getInventory().addItem(new ItemStack(Material.BOW));
player.getInventory().addItem(new ItemStack(Material.ARROW));
@ -420,7 +422,7 @@ public class ChallengeSimonSays extends Challenge
private void playerScoreIncrease(Player player)
{
String playerName = player.getName();
if(_playerRoundFinish.contains(playerName) || isDone(player))
if (_playerRoundFinish.contains(playerName) || isDone(player))
{
return;
}
@ -429,7 +431,7 @@ public class ChallengeSimonSays extends Challenge
_playerScore.put(playerName, _playerScore.get(playerName) + 1);
player.sendMessage(F.desc("Simon says", "You did the order right"));
if(_playerScore.get(playerName) >= _neededOrderCompleted)
if (_playerScore.get(playerName) >= _neededOrderCompleted)
{
SetCompleted(player);
}
@ -440,7 +442,7 @@ public class ChallengeSimonSays extends Challenge
private void playerScoreOnFail(Player player)
{
String playerName = player.getName();
if(_playerRoundFinish.contains(playerName) || isDone(player))
if (_playerRoundFinish.contains(playerName) || isDone(player))
{
return;
}

View File

@ -1,4 +1,4 @@
package nautilus.game.arcade.game.games.mineware.challenges;
package nautilus.game.arcade.game.games.mineware.challenges.removed;
import java.util.ArrayList;

View File

@ -1,4 +1,4 @@
package nautilus.game.arcade.game.games.mineware.challenges;
package nautilus.game.arcade.game.games.mineware.challenges.removed;
import java.util.ArrayList;
import java.util.Arrays;