Merge branch 'MortensRawBugFixes' into thanos-mineware
Conflicts: Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/MineWare.java
This commit is contained in:
commit
b64f561659
@ -656,6 +656,52 @@ public enum Achievement
|
||||
new int[]{1},
|
||||
AchievementCategory.MINE_STRIKE),
|
||||
|
||||
//MineWare
|
||||
MINEWARE_VETERAN("Mineware Veteran", 1500,
|
||||
new String[]{"MineWare.Veteran"},
|
||||
new String[]{"Win 50 games of Mineware"},
|
||||
new int[] {50},
|
||||
AchievementCategory.MINEWARE),
|
||||
|
||||
MINEWARE_LAURA_CRAFT("Laura Craft", 800,
|
||||
new String[]{"MineWare.LauraCraft"},
|
||||
new String[]{"Complete the maze challenge in under 8 seconds 3 times"},
|
||||
new int[] {3},
|
||||
AchievementCategory.MINEWARE),
|
||||
|
||||
MINEWARE_PINATA_MASTER("Pinata Master", 800,
|
||||
new String[]{"MineWare.PinataMaster"},
|
||||
new String[]{"In chicken shooter, hit 6 chickens without missing one"},
|
||||
new int[] {1},
|
||||
AchievementCategory.MINEWARE),
|
||||
|
||||
MINEWARE_MILK_MAN("Professional Milk Man", 700,
|
||||
new String[]{"MineWare.MilkMan"},
|
||||
new String[]{"In Milk the Cows, Collect 100 buckets of milk to the Farmer"},
|
||||
new int[] {100},
|
||||
AchievementCategory.MINEWARE),
|
||||
|
||||
MINEWARE_TAG_MASTER("Tag Master", 700,
|
||||
new String[]{"MineWare.TagMaster"},
|
||||
new String[]{"In reverse tag, Win an entire round without losing the tag"},
|
||||
new int[] {1},
|
||||
AchievementCategory.MINEWARE),
|
||||
|
||||
MINEWARE_SURF_UP("Surf Up", 850,
|
||||
new String[]{"MineWare.SurfUp"},
|
||||
new String[]{"Avoid 250 waves in Wave Crush"},
|
||||
new int[] {250},
|
||||
AchievementCategory.MINEWARE),
|
||||
|
||||
MINEWARE_KANGAROO_AT_HEART("Kangaroo at Heart", 900,
|
||||
new String[]{"MineWare.Kangaroo"},
|
||||
new String[]{"Complete Kangaroo Jump without falling once, 15 times"},
|
||||
new int[] {15},
|
||||
AchievementCategory.MINEWARE),
|
||||
|
||||
|
||||
|
||||
|
||||
//Bomb Lobbers
|
||||
BOMB_LOBBERS_WINS("Master Bomber", 1200,
|
||||
new String[]{"Bomb Lobbers.Wins"},
|
||||
|
@ -58,6 +58,10 @@ public enum AchievementCategory
|
||||
new StatDisplay("Kills as Undead"), new StatDisplay("Deaths as Undead"), StatDisplay.GEMS_EARNED },
|
||||
Material.DIAMOND_CHESTPLATE, 0, GameCategory.CLASSICS, null),
|
||||
|
||||
MINEWARE("Mineware", null,
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED },
|
||||
Material.SPONGE, 0, GameCategory.CLASSICS, null),
|
||||
|
||||
BLOCK_HUNT("Block Hunt", null,
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
||||
Material.GRASS, 0, GameCategory.CLASSICS, "Infestor Kit"),
|
||||
|
@ -49,7 +49,7 @@ public class AchievementMainPage extends ShopPageBase<AchievementManager, Achiev
|
||||
"XXXXOXXXO",
|
||||
"OXOXOXOXO",
|
||||
"OXOXOXOXO",
|
||||
"XXOXOXOXX").getItemSlots();
|
||||
"XOXOXOXOX").getItemSlots();
|
||||
int listSlot = 0;
|
||||
|
||||
for (AchievementCategory category : AchievementCategory.values())
|
||||
|
@ -16,7 +16,7 @@ import mineplex.core.projectile.ProjectileUser;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
|
||||
import nautilus.game.arcade.game.games.mineware.events.challengeEndEvent;
|
||||
import nautilus.game.arcade.game.games.mineware.events.ChallengeEndEvent;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
@ -310,6 +310,11 @@ public abstract class Challenge implements Listener
|
||||
{
|
||||
return Lost;
|
||||
}
|
||||
|
||||
public HashSet<Player> getWinners()
|
||||
{
|
||||
return Completed;
|
||||
}
|
||||
|
||||
public void setLost(Player player, boolean invis)
|
||||
{
|
||||
|
@ -1,19 +1,17 @@
|
||||
package nautilus.game.arcade.game.games.mineware;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.sql.Time;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import mineplex.core.account.CoreClient;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UUIDFetcher;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
@ -22,7 +20,6 @@ import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.common.util.UtilTextTop;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.projectile.IThrown;
|
||||
import mineplex.core.projectile.ProjectileUser;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
@ -38,8 +35,8 @@ import nautilus.game.arcade.game.games.holeinwall.KitNormal;
|
||||
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeAnvilDance;
|
||||
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeArrowRampage;
|
||||
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeBlockLobbers;
|
||||
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeBlockRunner;
|
||||
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeBouncingBlock;
|
||||
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeBuildRace;
|
||||
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeChestLoot;
|
||||
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeCloudFall;
|
||||
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeDogvsCat;
|
||||
@ -65,17 +62,23 @@ import nautilus.game.arcade.game.games.mineware.challenges.ChallengeShootChicken
|
||||
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeSmashOff;
|
||||
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeStandOnColor;
|
||||
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeTntLauncher;
|
||||
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeTreasureDigger;
|
||||
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeVolleyPig;
|
||||
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeWaveCrush;
|
||||
import nautilus.game.arcade.game.games.mineware.events.challengeEndEvent;
|
||||
import nautilus.game.arcade.game.games.mineware.events.ChallengeEndEvent;
|
||||
import nautilus.game.arcade.game.games.mineware.events.ChallengeStartEvent;
|
||||
import nautilus.game.arcade.game.games.mineware.stats.MinewareKangarooAtHeart;
|
||||
import nautilus.game.arcade.game.games.mineware.stats.MinewareLauraCraftTracker;
|
||||
import nautilus.game.arcade.game.games.mineware.stats.MinewareMilkManTracker;
|
||||
import nautilus.game.arcade.game.games.mineware.stats.MinewarePinataMasterTracker;
|
||||
import nautilus.game.arcade.game.games.mineware.stats.MinewareSurfUpTracker;
|
||||
import nautilus.game.arcade.game.games.mineware.stats.MinewareTagMasterTracker;
|
||||
import nautilus.game.arcade.game.games.mineware.stats.MinewareVeteranTracker;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Banner;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -84,6 +87,7 @@ import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
@ -93,8 +97,6 @@ import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.sun.xml.internal.ws.resources.UtilMessages;
|
||||
|
||||
public class MineWare extends SoloGame implements IThrown
|
||||
{
|
||||
private HashMap<Player, Integer> _lives = new HashMap<Player, Integer>();
|
||||
@ -137,6 +139,15 @@ public class MineWare extends SoloGame implements IThrown
|
||||
Manager.GetCreature().SetDisableCustomDrops(true);
|
||||
|
||||
PopulateOrders();
|
||||
|
||||
registerStatTrackers(
|
||||
new MinewareVeteranTracker(this),
|
||||
new MinewareSurfUpTracker(this),
|
||||
new MinewareLauraCraftTracker(this),
|
||||
new MinewareMilkManTracker(this),
|
||||
new MinewarePinataMasterTracker(this),
|
||||
new MinewareTagMasterTracker(this),
|
||||
new MinewareKangarooAtHeart(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -186,46 +197,39 @@ public class MineWare extends SoloGame implements IThrown
|
||||
|
||||
public void PopulateOrders()
|
||||
{
|
||||
// _challenges.add(ChallengeFallingBlocks.class);
|
||||
// _challenges.add(ChallengeAnvilDance.class);
|
||||
// _challenges.add(ChallengeBuildRace.class);
|
||||
// _challenges.add(ChallengeFastFood.class);
|
||||
// _challenges.add(ChallengeTreasureDigger.class);
|
||||
_challenges.add(ChallengeAnvilDance.class);
|
||||
_challenges.add(ChallengeFallingBlocks.class);
|
||||
_challenges.add(ChallengeWaveCrush.class);
|
||||
_challenges.add(ChallengePickASide.class);//
|
||||
_challenges.add(ChallengeKOTL.class);
|
||||
_challenges.add(ChallengePunchThePig.class);
|
||||
_challenges.add(ChallengeDogvsCat.class);
|
||||
_challenges.add(ChallengeShootChickens.class);
|
||||
_challenges.add(ChallengeReverseTag.class);
|
||||
_challenges.add(ChallengeKangarooJump.class);
|
||||
_challenges.add(ChallengeMiniOITQ.class);
|
||||
_challenges.add(ChallengeMineADiamond.class);
|
||||
_challenges.add(ChallengeRushPush.class);
|
||||
_challenges.add(ChallengeBlockLobbers.class);
|
||||
_challenges.add(ChallengeStandOnColor.class);
|
||||
_challenges.add(ChallengeMilkACow.class);
|
||||
_challenges.add(ChallengeDragonEgg.class);
|
||||
_challenges.add(ChallengeChestLoot.class);
|
||||
_challenges.add(ChallengeLavaRun.class);
|
||||
_challenges.add(ChallengeNavigateMaze.class);
|
||||
_challenges.add(ChallengeVolleyPig.class);
|
||||
_challenges.add(ChallengeSmashOff.class);
|
||||
_challenges.add(ChallengeTntLauncher.class);
|
||||
_challenges.add(ChallengeArrowRampage.class);
|
||||
_challenges.add(ChallengeCloudFall.class);
|
||||
_challenges.add(ChallengeInfestation.class);
|
||||
_challenges.add(ChallengeBouncingBlock.class);
|
||||
_challenges.add(ChallengeBlockRunner.class);
|
||||
_challenges.add(ChallengeFastFood.class);
|
||||
_challenges.add(ChallengeMinecartDance.class);
|
||||
_challenges.add(ChallengeRedLightGreenLight.class);
|
||||
_challenges.add(ChallengeFishingDay.class);
|
||||
|
||||
// _challenges.add(ChallengeAnvilDance.class);
|
||||
// _challenges.add(ChallengeFallingBlocks.class);
|
||||
// _challenges.add(ChallengeWaveCrush.class);
|
||||
// _challenges.add(ChallengePickASide.class);//
|
||||
// _challenges.add(ChallengeKOTL.class);
|
||||
// _challenges.add(ChallengePunchThePig.class);
|
||||
// _challenges.add(ChallengeDogvsCat.class);
|
||||
// _challenges.add(ChallengeShootChickens.class);
|
||||
// _challenges.add(ChallengeReverseTag.class);
|
||||
// _challenges.add(ChallengeKangarooJump.class);
|
||||
// _challenges.add(ChallengeMiniOITQ.class);
|
||||
// _challenges.add(ChallengeMineADiamond.class);
|
||||
// _challenges.add(ChallengeRushPush.class);
|
||||
// _challenges.add(ChallengeBlockLobbers.class);
|
||||
// _challenges.add(ChallengeStandOnColor.class);
|
||||
// _challenges.add(ChallengeMilkACow.class);
|
||||
// _challenges.add(ChallengeDragonEgg.class);
|
||||
// _challenges.add(ChallengeChestLoot.class);
|
||||
// _challenges.add(ChallengeLavaRun.class);
|
||||
// _challenges.add(ChallengeNavigateMaze.class);
|
||||
// _challenges.add(ChallengeVolleyPig.class);
|
||||
// _challenges.add(ChallengeSmashOff.class);
|
||||
// _challenges.add(ChallengeTntLauncher.class);
|
||||
// _challenges.add(ChallengeArrowRampage.class);
|
||||
// _challenges.add(ChallengeCloudFall.class);
|
||||
// _challenges.add(ChallengeInfestation.class);
|
||||
// _challenges.add(ChallengeBouncingBlock.class);
|
||||
// _challenges.add(ChallengeEvolutionOfCombat.class);
|
||||
// _challenges.add(ChallengeBlockRunner.class);
|
||||
// _challenges.add(ChallengeFastFood.class);
|
||||
// _challenges.add(ChallengeMinecartDance.class);
|
||||
// _challenges.add(ChallengeRedLightGreenLight.class);
|
||||
|
||||
// ============== trashed ==============
|
||||
// _challenges.add(ChallengeSimonSays.class);
|
||||
// _challenges.add(ChallengeHitTargets.class);
|
||||
@ -301,7 +305,7 @@ public class MineWare extends SoloGame implements IThrown
|
||||
|
||||
for(String currentMessage : messages)
|
||||
{
|
||||
if(messages.get(messages.size()-1) != currentMessage)
|
||||
if(messages.get(messages.size() - 1) != currentMessage)
|
||||
{
|
||||
UtilPlayer.message(player, C.cGreen + "ChallengeRule - " + C.cYellow + C.Bold + currentMessage);
|
||||
}
|
||||
@ -401,7 +405,7 @@ public class MineWare extends SoloGame implements IThrown
|
||||
return;
|
||||
|
||||
// Deregister
|
||||
Bukkit.getServer().getPluginManager().callEvent(new challengeEndEvent(_challenge));
|
||||
Bukkit.getServer().getPluginManager().callEvent(new ChallengeEndEvent(_challenge));
|
||||
HandlerList.unregisterAll(_challenge);
|
||||
|
||||
_challenge.EndOrder();
|
||||
@ -657,6 +661,7 @@ public class MineWare extends SoloGame implements IThrown
|
||||
_isChallengeStarted = true;
|
||||
|
||||
_challenge.StartOrder();
|
||||
Bukkit.getServer().getPluginManager().callEvent(new ChallengeStartEvent(_challenge));
|
||||
|
||||
// Register events
|
||||
UtilServer.getServer().getPluginManager().registerEvents(_challenge, Manager.getPlugin());
|
||||
@ -732,6 +737,31 @@ public class MineWare extends SoloGame implements IThrown
|
||||
return _lives.get(player);
|
||||
}
|
||||
|
||||
public void onModeratorTeleport(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
if(!IsLive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(event.getMessage().equalsIgnoreCase("/tp") || event.getMessage().equalsIgnoreCase("/teleport"))
|
||||
{
|
||||
CoreClient staff = getArcadeManager().GetClients().Get(event.getPlayer());
|
||||
|
||||
if(staff.GetRank().has(Rank.MODERATOR))
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
UtilPlayer.message(player, C.cRed + C.Bold + "You are out of the game!");
|
||||
player.playSound(player.getLocation(), Sound.EXPLODE, 2f, 1f);
|
||||
|
||||
Scoreboard.ResetScore(player.getName());
|
||||
SetPlayerState(player, PlayerState.OUT);
|
||||
|
||||
Manager.addSpectator(player, true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void LoseLife(Player player, boolean isDeath)
|
||||
{
|
||||
if(!isDeath)
|
||||
@ -786,7 +816,7 @@ public class MineWare extends SoloGame implements IThrown
|
||||
}
|
||||
|
||||
// Deregister
|
||||
Bukkit.getServer().getPluginManager().callEvent(new challengeEndEvent(_challenge));
|
||||
Bukkit.getServer().getPluginManager().callEvent(new ChallengeEndEvent(_challenge));
|
||||
HandlerList.unregisterAll(_challenge);
|
||||
|
||||
_challenge.EndOrder();
|
||||
@ -809,7 +839,7 @@ public class MineWare extends SoloGame implements IThrown
|
||||
|
||||
EndCheck();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@EventHandler
|
||||
public void ScoreboardUpdate(UpdateEvent event)
|
||||
@ -819,11 +849,11 @@ public class MineWare extends SoloGame implements IThrown
|
||||
return;
|
||||
}
|
||||
Scoreboard.Reset();
|
||||
|
||||
|
||||
if(GetPlayers(false).size() > 14)
|
||||
{
|
||||
int alive = 0;
|
||||
for(Player cAlive: _lives.keySet())
|
||||
for(Player cAlive : _lives.keySet())
|
||||
{
|
||||
if(GetLives(cAlive) != 0)
|
||||
{
|
||||
@ -840,13 +870,13 @@ public class MineWare extends SoloGame implements IThrown
|
||||
else
|
||||
{
|
||||
Scoreboard.WriteBlank();
|
||||
for(Player player: GetPlayers(false))
|
||||
for(Player player : GetPlayers(false))
|
||||
{
|
||||
|
||||
|
||||
int currentLives = GetLives(player);
|
||||
String status;
|
||||
String currentlyOut = "";
|
||||
|
||||
|
||||
if(_challenge != null)
|
||||
{
|
||||
if(_challenge.isLost(player))
|
||||
@ -858,7 +888,7 @@ public class MineWare extends SoloGame implements IThrown
|
||||
currentlyOut = C.cGreen + "✔ ";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
switch(currentLives)
|
||||
{
|
||||
case 5:
|
||||
|
@ -16,7 +16,7 @@ import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.game.games.mineware.Challenge;
|
||||
import nautilus.game.arcade.game.games.mineware.MineWare;
|
||||
import nautilus.game.arcade.game.games.mineware.events.challengeEndEvent;
|
||||
import nautilus.game.arcade.game.games.mineware.events.ChallengeEndEvent;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -131,7 +131,7 @@ public class ChallengeArrowRampage extends Challenge
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onChallengeEnd(challengeEndEvent event)
|
||||
public void onChallengeEnd(ChallengeEndEvent event)
|
||||
{
|
||||
for(Entity fBlocks: Host.WorldData.World.getEntities())
|
||||
{
|
||||
|
@ -38,7 +38,7 @@ public class ChallengeBlockLobbers extends Challenge
|
||||
|
||||
public ChallengeBlockLobbers(MineWare host)
|
||||
{
|
||||
super(host, ChallengeType.LastStanding, "Block Lobbers", "Hit players off the platform", "by punching with the block");
|
||||
super(host, ChallengeType.LastStanding, "Block Lobbers", "Hit players off the platform", "by throwing with the blocks");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -44,7 +44,7 @@ public class ChallengeBouncingBlock extends Challenge
|
||||
|
||||
public ChallengeBouncingBlock(MineWare host)
|
||||
{
|
||||
super(host, ChallengeType.FirstComplete, "Bouncing Block", "Jump and punch the wool!", "Avoid standing on red wool!", "First to 10 wins!");
|
||||
super(host, ChallengeType.FirstComplete, "Bouncing Block", "Jump and punch the wool!", "Avoid landing on red wool!", "First to 10 wins!");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -157,8 +157,6 @@ public class ChallengeCloudFall extends Challenge
|
||||
{
|
||||
return;
|
||||
}
|
||||
Bukkit.broadcastMessage("Player " + event.GetDamageePlayer().getName() + " feel and had a Y on " + event.GetDamageePlayer().getLocation().getY());
|
||||
Bukkit.broadcastMessage("and when that's rounded it ends at: " + Math.round(event.GetDamageePlayer().getLocation().getY()));
|
||||
if(Math.round(event.GetDamageePlayer().getLocation().getY()) == 3)
|
||||
{
|
||||
event.SetCancelled("fell on wool");
|
||||
|
@ -32,7 +32,7 @@ public class ChallengeKOTL extends Challenge
|
||||
|
||||
public ChallengeKOTL(MineWare host)
|
||||
{
|
||||
super(host, ChallengeType.FirstComplete, "King of the ladder", "Reach the top of the ladder");
|
||||
super(host, ChallengeType.FirstComplete, "King Of The Ladder", "Reach the top of the ladder");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -177,8 +177,7 @@ public class ChallengeKOTL extends Challenge
|
||||
}
|
||||
if(UtilAlg.inBoundingBox(player.getLocation(), _winCornerA, _winCornerB))
|
||||
{
|
||||
SetCompleted(player);
|
||||
|
||||
SetCompleted(player, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,8 +4,6 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
@ -22,17 +20,16 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.RETURN;
|
||||
|
||||
public class ChallengeKangarooJump extends Challenge
|
||||
{
|
||||
private long _gameTime = System.currentTimeMillis() + ((UtilMath.r(5) + 20) * 1000);
|
||||
|
||||
private HashMap<String, Boolean> _players = new HashMap<String, Boolean>();
|
||||
private HashMap<Player, Integer> _playerJumpHeight = new HashMap<Player, Integer>();
|
||||
|
||||
public ChallengeKangarooJump(MineWare host)
|
||||
{
|
||||
super(host, ChallengeType.FirstComplete, "Kangaroo Jump", "Block from block to block", "Highest player win!");
|
||||
super(host, ChallengeType.FirstComplete, "Kangaroo Jump", "Jump from block to block", "Highest players win!");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -65,6 +62,7 @@ public class ChallengeKangarooJump extends Challenge
|
||||
for(Player player : Host.GetPlayers(true))
|
||||
{
|
||||
_players.put(player.getName(), true);
|
||||
_playerJumpHeight.put(player, 0);
|
||||
}
|
||||
Host.StrictAntiHack = false;
|
||||
}
|
||||
@ -126,7 +124,7 @@ public class ChallengeKangarooJump extends Challenge
|
||||
}
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if(_players.get(player.getName()) == false)
|
||||
if(_players.get(player.getName()) == false) // TODO fix
|
||||
{
|
||||
if(player.isOnGround())
|
||||
{
|
||||
@ -137,6 +135,41 @@ public class ChallengeKangarooJump extends Challenge
|
||||
UtilAction.velocity(player, 2, 0.4, 4, true);
|
||||
_players.put(player.getName(), false);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void playerJumpTracker(PlayerMoveEvent event)
|
||||
{
|
||||
if(!Host.IsLive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
Player player = event.getPlayer();
|
||||
if(player.getLocation().getBlockY() < 4)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(!player.isOnGround())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(!_playerJumpHeight.containsKey(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(isLost(player))
|
||||
{
|
||||
_playerJumpHeight.remove(player);
|
||||
}
|
||||
if((player.getLocation().getBlockY() < _playerJumpHeight.get(player)))
|
||||
{
|
||||
_playerJumpHeight.remove(player);
|
||||
return;
|
||||
}
|
||||
if(player.getLocation().getBlockY() > _playerJumpHeight.get(player))
|
||||
{
|
||||
_playerJumpHeight.put(player, player.getLocation().getBlockY());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void gameEndChecker(UpdateEvent event)
|
||||
@ -161,12 +194,12 @@ public class ChallengeKangarooJump extends Challenge
|
||||
}
|
||||
ArrayList<String> sortedList = sortHash(playerHeights);
|
||||
|
||||
for(int i = 0; i < (Host.GetPlayers(true).size()); i++)
|
||||
for(int i = 0; i < (sortedList.size()); i++)
|
||||
{
|
||||
System.out.println(sortedList.get(i));
|
||||
if(!isDone(Bukkit.getPlayer(sortedList.get(i))))
|
||||
{
|
||||
if(i <= (Host.GetPlayers(true).size() / 2))
|
||||
if(i < (sortedList.size() / 2))
|
||||
{
|
||||
SetCompleted(Bukkit.getPlayer(sortedList.get(i)));
|
||||
}
|
||||
@ -194,4 +227,9 @@ public class ChallengeKangarooJump extends Challenge
|
||||
});
|
||||
return players;
|
||||
}
|
||||
|
||||
public HashMap<Player, Integer> getPlayerHeight()
|
||||
{
|
||||
return _playerJumpHeight;
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.disguise.disguises.DisguiseVillager;
|
||||
@ -31,11 +32,11 @@ public class ChallengeMilkACow extends Challenge
|
||||
{
|
||||
private Villager _villager;
|
||||
private HashMap<Entity, ArrayList<String>> _milked = new HashMap<Entity, ArrayList<String>>();
|
||||
private HashMap<String, Integer> _score = new HashMap<String, Integer>();
|
||||
private HashMap<Player, Integer> _score = new HashMap<Player, Integer>();
|
||||
|
||||
public ChallengeMilkACow(MineWare host)
|
||||
{
|
||||
super(host, ChallengeType.FirstComplete, "Milk the cows", "Milk 5 different cows and deliver to the villager!");
|
||||
super(host, ChallengeType.FirstComplete, "Milk the cows", "Milk 5 different cows", "Deliver the milk to the vilager");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -79,7 +80,7 @@ public class ChallengeMilkACow extends Challenge
|
||||
disguise.setBaby();
|
||||
Host.getArcadeManager().GetDisguise().disguise(disguise);
|
||||
player.getInventory().setItem(0, new ItemStack(Material.BUCKET));
|
||||
_score.put(player.getName(), 0);
|
||||
_score.put(player, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -204,8 +205,8 @@ public class ChallengeMilkACow extends Challenge
|
||||
{
|
||||
p.setItemInHand(new ItemStack(Material.BUCKET));
|
||||
p.playSound(p.getLocation(), Sound.ORB_PICKUP, 2, 0);
|
||||
int score = _score.get(p.getName()) + 1;
|
||||
_score.put(p.getName(), score);
|
||||
int score = _score.get(p) + 1;
|
||||
_score.put(p, score);
|
||||
|
||||
displayCount(p, ((Villager) ent).getEyeLocation().add(0, 0.3, 0), (score >= 5 ? C.cDGreen : score >= 3 ? C.cGreen
|
||||
: score >= 2 ? C.cRed : C.cDRed) + score);
|
||||
@ -225,6 +226,7 @@ public class ChallengeMilkACow extends Challenge
|
||||
{
|
||||
event.setCancelled(true);
|
||||
event.getPlayer().updateInventory();
|
||||
event.getPlayer().sendMessage(F.main("Mike the Cows", "Deliver the milk to the farmer!"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -245,4 +247,9 @@ public class ChallengeMilkACow extends Challenge
|
||||
|
||||
return spawns;
|
||||
}
|
||||
|
||||
public HashMap<Player, Integer> getScore()
|
||||
{
|
||||
return _score;
|
||||
}
|
||||
}
|
||||
|
@ -19,125 +19,139 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class ChallengeMineADiamond extends Challenge
|
||||
{
|
||||
private ArrayList<Material> ores = new ArrayList<Material>(Arrays.asList(Material.IRON_ORE, Material.GOLD_ORE, Material.REDSTONE_ORE,
|
||||
Material.EMERALD_ORE, Material.COAL_ORE, Material.LAPIS_ORE));
|
||||
private ArrayList<Material> ores = new ArrayList<Material>(Arrays.asList(Material.IRON_ORE, Material.GOLD_ORE, Material.REDSTONE_ORE,
|
||||
Material.EMERALD_ORE, Material.COAL_ORE, Material.LAPIS_ORE));
|
||||
|
||||
public ChallengeMineADiamond(MineWare host)
|
||||
{
|
||||
super(host, ChallengeType.FirstComplete, "Mine a Diamond", "Find the diamonds", "And mine them!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Location> getSpawns()
|
||||
{
|
||||
ArrayList<Location> spawns = new ArrayList<Location>();
|
||||
|
||||
for(int x = -getArenaSize()+1; x <= getArenaSize()-1; x++)
|
||||
public ChallengeMineADiamond(MineWare host)
|
||||
{
|
||||
for(int z = -getArenaSize()+1; z <= getArenaSize()-1; z++)
|
||||
{
|
||||
if(x % 2 == 0 && z % 2 == 0)
|
||||
{
|
||||
spawns.add(getCenter().clone().add(x + 0.5, 2.1, z + 0.5));
|
||||
}
|
||||
}
|
||||
super(host, ChallengeType.FirstComplete, "Mine a Diamond", "Find the diamonds", "And mine them!");
|
||||
}
|
||||
return spawns;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanupRoom()
|
||||
{
|
||||
Host.BlockBreak = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupPlayers()
|
||||
{
|
||||
for(Player player : Host.GetPlayers(true))
|
||||
@Override
|
||||
public ArrayList<Location> getSpawns()
|
||||
{
|
||||
player.getInventory().addItem(new ItemStack(Material.DIAMOND_PICKAXE));
|
||||
}
|
||||
Host.BlockBreak = true;
|
||||
}
|
||||
ArrayList<Location> spawns = new ArrayList<Location>();
|
||||
|
||||
@Override
|
||||
public void generateRoom()
|
||||
{
|
||||
int amountOfDiamonds = 0;
|
||||
for(int x = -getArenaSize(); x <= getArenaSize(); x++)
|
||||
{
|
||||
for(int z = -getArenaSize(); z <= getArenaSize(); z++)
|
||||
{
|
||||
for(int y = 0; y <= 1; y++)
|
||||
for(int x = -getArenaSize() + 1; x <= getArenaSize() - 1; x++)
|
||||
{
|
||||
Block b = getCenter().getBlock().getRelative(x, y, z);
|
||||
|
||||
if(y == 0)
|
||||
{
|
||||
b.setType(Material.DIRT);
|
||||
b.setData((byte) 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(amountOfDiamonds == 0)
|
||||
for(int z = -getArenaSize() + 1; z <= getArenaSize() - 1; z++)
|
||||
{
|
||||
for(int i = 0; i < Math.ceil((Host.GetPlayers(true).size()+1) / 2); i++)
|
||||
{
|
||||
Block copy = getCenter().getBlock().getRelative(UtilMath.r(getArenaSize()*2) - (getArenaSize()), 1, UtilMath.r(getArenaSize()*2) - (getArenaSize()));
|
||||
if(copy.getType() == Material.DIAMOND_ORE)
|
||||
if(x % 2 == 0 && z % 2 == 0)
|
||||
{
|
||||
i--;
|
||||
continue;
|
||||
spawns.add(getCenter().clone().add(x + 0.5, 2.1, z + 0.5));
|
||||
}
|
||||
copy.setType(Material.DIAMOND_ORE);
|
||||
addBlock(copy);
|
||||
|
||||
amountOfDiamonds++;
|
||||
}
|
||||
}
|
||||
if(b.getType() != Material.DIAMOND_ORE)
|
||||
{
|
||||
b.setType(ores.get(UtilMath.r(ores.size())));
|
||||
}
|
||||
|
||||
if(Math.abs(x) == getArenaSize() || Math.abs(z) == getArenaSize())
|
||||
{
|
||||
b.setType(Material.FENCE);
|
||||
}
|
||||
}
|
||||
if(b.getType() != Material.AIR)
|
||||
{
|
||||
addBlock(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
return spawns;
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDiamondMine(PlayerInteractEvent event)
|
||||
{
|
||||
if(!Host.IsLive())
|
||||
|
||||
@Override
|
||||
public void cleanupRoom()
|
||||
{
|
||||
return;
|
||||
Host.BlockBreak = false;
|
||||
}
|
||||
if(!Host.IsAlive(event.getPlayer()))
|
||||
|
||||
@Override
|
||||
public void setupPlayers()
|
||||
{
|
||||
return;
|
||||
for(Player player : Host.GetPlayers(true))
|
||||
{
|
||||
player.getInventory().addItem(new ItemStack(Material.DIAMOND_PICKAXE));
|
||||
}
|
||||
Host.BlockBreak = true;
|
||||
}
|
||||
if(IsCompleted(event.getPlayer()))
|
||||
|
||||
@Override
|
||||
public void generateRoom()
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
int amountOfDiamonds = 0;
|
||||
for(int x = -getArenaSize(); x <= getArenaSize(); x++)
|
||||
{
|
||||
for(int z = -getArenaSize(); z <= getArenaSize(); z++)
|
||||
{
|
||||
for(int y = 0; y <= 1; y++)
|
||||
{
|
||||
Block b = getCenter().getBlock().getRelative(x, y, z);
|
||||
|
||||
if(y == 0)
|
||||
{
|
||||
b.setType(Material.DIRT);
|
||||
b.setData((byte) 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(amountOfDiamonds == 0)
|
||||
{
|
||||
for(int i = 0; i < Math.ceil((Host.GetPlayers(true).size() + 1) / 2); i++)
|
||||
{
|
||||
Block copy = getCenter().getBlock().getRelative(UtilMath.r(getArenaSize() * 2) - (getArenaSize()), 1,
|
||||
UtilMath.r(getArenaSize() * 2) - (getArenaSize()));
|
||||
if(copy.getType() == Material.DIAMOND_ORE)
|
||||
{
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
copy.setType(Material.DIAMOND_ORE);
|
||||
addBlock(copy);
|
||||
|
||||
amountOfDiamonds++;
|
||||
}
|
||||
}
|
||||
if(b.getType() != Material.DIAMOND_ORE)
|
||||
{
|
||||
b.setType(ores.get(UtilMath.r(ores.size())));
|
||||
}
|
||||
|
||||
if(Math.abs(x) == getArenaSize() || Math.abs(z) == getArenaSize())
|
||||
{
|
||||
b.setType(Material.FENCE);
|
||||
}
|
||||
}
|
||||
if(b.getType() != Material.AIR)
|
||||
{
|
||||
addBlock(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(event.getAction() == Action.LEFT_CLICK_BLOCK)
|
||||
|
||||
@EventHandler
|
||||
public void onDiamondMine(PlayerInteractEvent event)
|
||||
{
|
||||
if(event.getClickedBlock().getType() == Material.DIAMOND_ORE)
|
||||
{
|
||||
SetCompleted(event.getPlayer(), true);
|
||||
event.getClickedBlock().setType(Material.AIR);
|
||||
}
|
||||
if(!Host.IsLive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(!Host.IsAlive(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(IsCompleted(event.getPlayer()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
if(event.getAction() == Action.LEFT_CLICK_BLOCK)
|
||||
{
|
||||
if(event.getClickedBlock().getType() == Material.DIAMOND_ORE)
|
||||
{
|
||||
SetCompleted(event.getPlayer(), true);
|
||||
event.getClickedBlock().setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerMineblock(BlockBreakEvent event)
|
||||
{
|
||||
if(!Host.IsLive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(event.getBlock().getType() != Material.DIAMOND_ORE)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package nautilus.game.arcade.game.games.mineware.challenges;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import nautilus.game.arcade.game.games.mineware.Challenge;
|
||||
@ -10,12 +11,14 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
public class ChallengeNavigateMaze extends Challenge
|
||||
{
|
||||
|
||||
private HashMap<Player, Long> _playerCompletionTime = new HashMap<Player, Long>();
|
||||
public ChallengeNavigateMaze(MineWare host)
|
||||
{
|
||||
super(host, ChallengeType.FirstComplete, "Nagivation maze", "Go to the other side of the maze");
|
||||
@ -39,11 +42,18 @@ public class ChallengeNavigateMaze extends Challenge
|
||||
public void onMove(PlayerMoveEvent event)
|
||||
{
|
||||
if (UtilPlayer.isSpectator(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
|
||||
}
|
||||
if(isDone(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getTo().getY() >= 1 && event.getTo().getX() > 16)
|
||||
{
|
||||
SetCompleted(event.getPlayer());
|
||||
_playerCompletionTime.put(event.getPlayer(), System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
|
||||
@ -243,4 +253,9 @@ public class ChallengeNavigateMaze extends Challenge
|
||||
|
||||
return blocks;
|
||||
}
|
||||
|
||||
public HashMap<Player, Long> getPlayerTimes()
|
||||
{
|
||||
return _playerCompletionTime;
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ public class ChallengePickASide extends Challenge
|
||||
|
||||
public ChallengePickASide(MineWare host)
|
||||
{
|
||||
super(host, ChallengeType.FirstComplete, "Pick a Side", "Stand on the side with the least players!");
|
||||
super(host, ChallengeType.FirstComplete, "Pick a Side", "The side with the least players win!");
|
||||
}
|
||||
|
||||
public int getMinPlayers()
|
||||
|
@ -156,6 +156,10 @@ public class ChallengeRedLightGreenLight extends Challenge
|
||||
}
|
||||
if(!_canMove && !_cooldownedPlayers.contains(event.getPlayer().getName()) && _timeBeforeAction < System.currentTimeMillis())
|
||||
{
|
||||
if(event.getFrom().getBlockX() == event.getTo().getBlockX())
|
||||
{
|
||||
return;
|
||||
}
|
||||
UtilAction.velocity(event.getPlayer(), UtilAlg.getTrajectory2d(event.getPlayer().getLocation(), new Location(getCenter().getWorld(), -32, 5, 0)), 1.5, true, 0.4, 0, 10, true);
|
||||
_cooldownedPlayers.add(event.getPlayer().getName());
|
||||
|
||||
@ -167,7 +171,7 @@ public class ChallengeRedLightGreenLight extends Challenge
|
||||
{
|
||||
_cooldownedPlayers.remove(event.getPlayer().getName());
|
||||
}
|
||||
}.runTaskLater(Host.Manager.getPlugin(), 40);
|
||||
}.runTaskLater(Host.Manager.getPlugin(), 35);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,12 +30,16 @@ import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class ChallengeReverseTag extends Challenge
|
||||
{
|
||||
private int _cooldown = 2; // in seconds
|
||||
private double _endTime;
|
||||
private double _startTime;
|
||||
private HashSet<String> _tagged = new HashSet<String>();
|
||||
private HashSet<String> _cooldowned = new HashSet<String>();
|
||||
private HashSet<Player> _nonTaggedPlayers = new HashSet<Player>();
|
||||
|
||||
public ChallengeReverseTag(MineWare Host)
|
||||
{
|
||||
@ -78,6 +82,7 @@ public class ChallengeReverseTag extends Challenge
|
||||
|
||||
for(Player player : players)
|
||||
{
|
||||
_nonTaggedPlayers.add(player);
|
||||
if(looped % 2 == 0)
|
||||
{
|
||||
addTagged(player);
|
||||
@ -166,6 +171,11 @@ public class ChallengeReverseTag extends Challenge
|
||||
event.SetCancelled("Damaged a nontagged person");
|
||||
return;
|
||||
}
|
||||
if(_cooldowned.contains(event.GetDamageePlayer().getName()))
|
||||
{
|
||||
event.SetCancelled("Damaged is on cooldown");
|
||||
return;
|
||||
}
|
||||
removeTagged(event.GetDamageePlayer());
|
||||
addTagged(event.GetDamagerPlayer(false));
|
||||
}
|
||||
@ -197,13 +207,29 @@ public class ChallengeReverseTag extends Challenge
|
||||
}
|
||||
}
|
||||
|
||||
private void removeTagged(Player player)
|
||||
private void removeTagged(final Player player)
|
||||
{
|
||||
if(_tagged.contains(player.getName()))
|
||||
{
|
||||
UtilPlayer.message(player, C.cYellow + C.Bold + "You are " + C.cRed + "NO LONGER" + C.cYellow + " tagged!");
|
||||
player.getInventory().setHelmet(new ItemStack(Material.AIR));
|
||||
_tagged.remove(player.getName());
|
||||
_cooldowned.add(player.getName());
|
||||
|
||||
new BukkitRunnable()
|
||||
{
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
_cooldowned.remove(player.getName());
|
||||
}
|
||||
}.runTaskLater(Host.Manager.getPlugin(), 20*_cooldown);
|
||||
|
||||
if(_nonTaggedPlayers.contains(player))
|
||||
{
|
||||
_nonTaggedPlayers.remove(player);
|
||||
}
|
||||
|
||||
for(int i = 0; i <= 8; i++)
|
||||
{
|
||||
@ -244,5 +270,9 @@ public class ChallengeReverseTag extends Challenge
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public HashSet<Player> getNonTaggedPlayers()
|
||||
{
|
||||
return _nonTaggedPlayers;
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Chicken;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
@ -33,6 +34,8 @@ public class ChallengeShootChickens extends Challenge
|
||||
private ArrayList<Chicken> _chickens = new ArrayList<Chicken>();
|
||||
private HashMap<String, Integer> _killedChickens = new HashMap<String, Integer>();
|
||||
private ArrayList<Projectile> _arrows = new ArrayList<Projectile>();
|
||||
|
||||
private HashMap<Player, Integer> _arrowsShot = new HashMap<Player, Integer>();
|
||||
|
||||
public ChallengeShootChickens(MineWare host)
|
||||
{
|
||||
@ -58,7 +61,18 @@ public class ChallengeShootChickens extends Challenge
|
||||
@EventHandler
|
||||
public void onShoot(ProjectileLaunchEvent event)
|
||||
{
|
||||
_arrows.add(event.getEntity());
|
||||
|
||||
if(event.getEntity() instanceof Arrow)
|
||||
{
|
||||
_arrows.add(event.getEntity());
|
||||
|
||||
Arrow arrow = (Arrow) event.getEntity();
|
||||
Player player = (Player) arrow.getShooter();
|
||||
if(!isDone(player))
|
||||
{
|
||||
_arrowsShot.put(player, _arrowsShot.get(player)+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -157,11 +171,11 @@ public class ChallengeShootChickens extends Challenge
|
||||
|
||||
for (Player player : Host.GetPlayers(true))
|
||||
{
|
||||
player.getInventory().setItem(0,
|
||||
new ItemBuilder(Material.BOW).addEnchantment(Enchantment.ARROW_INFINITE, 1).setUnbreakable(true).build());
|
||||
player.getInventory().setItem(0,new ItemBuilder(Material.BOW).addEnchantment(Enchantment.ARROW_INFINITE, 1).setUnbreakable(true).build());
|
||||
player.getInventory().setItem(9, new ItemStack(Material.ARROW));
|
||||
|
||||
_killedChickens.put(player.getName(), 0);
|
||||
_arrowsShot.put(player, 0);
|
||||
}
|
||||
|
||||
Host.DamagePvE = true;
|
||||
@ -229,4 +243,9 @@ public class ChallengeShootChickens extends Challenge
|
||||
|
||||
return spawns;
|
||||
}
|
||||
|
||||
public HashMap<Player, Integer> getArrowsShot()
|
||||
{
|
||||
return _arrowsShot;
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ import mineplex.core.common.util.UtilTextBottom;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.game.games.mineware.Challenge;
|
||||
import nautilus.game.arcade.game.games.mineware.MineWare;
|
||||
import nautilus.game.arcade.game.games.mineware.events.challengeEndEvent;
|
||||
import nautilus.game.arcade.game.games.mineware.events.ChallengeEndEvent;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Color;
|
||||
@ -306,7 +306,7 @@ public class ChallengeSimonSays extends Challenge
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onChallengeEnd(challengeEndEvent event)
|
||||
public void onChallengeEnd(ChallengeEndEvent event)
|
||||
{
|
||||
if(!(event.getEndedChallenge() instanceof ChallengeSimonSays))
|
||||
{
|
||||
|
@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.mineware.challenges;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.ListIterator;
|
||||
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
@ -11,7 +12,7 @@ import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.game.games.mineware.Challenge;
|
||||
import nautilus.game.arcade.game.games.mineware.MineWare;
|
||||
import nautilus.game.arcade.game.games.mineware.events.challengeEndEvent;
|
||||
import nautilus.game.arcade.game.games.mineware.events.ChallengeEndEvent;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
@ -32,6 +33,8 @@ public class ChallengeWaveCrush extends Challenge
|
||||
private int _waveAmount = 0;
|
||||
private int _waveSpeed = 30; // in ticks
|
||||
private ArrayList<Integer> _colorList = new ArrayList<Integer>(Arrays.asList(14, 11, 9, 3, 1, 4, 13, 5));
|
||||
|
||||
private HashMap<Player, Integer> _survivedWaves = new HashMap<Player, Integer>();
|
||||
|
||||
public ChallengeWaveCrush(MineWare host)
|
||||
{
|
||||
@ -85,6 +88,11 @@ public class ChallengeWaveCrush extends Challenge
|
||||
@Override
|
||||
public void setupPlayers()
|
||||
{
|
||||
for(Player player: Host.GetPlayers(true))
|
||||
{
|
||||
_survivedWaves.put(player, 0);
|
||||
}
|
||||
|
||||
_inProgress = true;
|
||||
|
||||
new BukkitRunnable()
|
||||
@ -112,6 +120,14 @@ public class ChallengeWaveCrush extends Challenge
|
||||
{
|
||||
_waveSpeed--;
|
||||
}
|
||||
|
||||
for(Player player: _survivedWaves.keySet())
|
||||
{
|
||||
if(!isDone(player))
|
||||
{
|
||||
_survivedWaves.put(player, _survivedWaves.get(player)+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(Host.Manager.getPlugin(), 20 * 3, _waveSpeed);
|
||||
}
|
||||
@ -194,7 +210,7 @@ public class ChallengeWaveCrush extends Challenge
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void OnChallengeEnd(challengeEndEvent event)
|
||||
public void OnChallengeEnd(ChallengeEndEvent event)
|
||||
{
|
||||
for(Player player : Host.GetPlayers(true))
|
||||
{
|
||||
@ -248,4 +264,9 @@ public class ChallengeWaveCrush extends Challenge
|
||||
}
|
||||
}.runTaskTimer(Host.Manager.getPlugin(), 0, 2);
|
||||
}
|
||||
|
||||
public HashMap<Player, Integer> getsurvivedwaves()
|
||||
{
|
||||
return _survivedWaves;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,36 @@
|
||||
package nautilus.game.arcade.game.games.mineware.events;
|
||||
|
||||
import nautilus.game.arcade.game.games.mineware.Challenge;
|
||||
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class ChallengeStartEvent extends Event
|
||||
{
|
||||
private Challenge _startedChallenge;
|
||||
private static final HandlerList _handlers = new HandlerList();
|
||||
|
||||
public ChallengeStartEvent(Challenge startedChallenge)
|
||||
{
|
||||
this._startedChallenge = startedChallenge;
|
||||
}
|
||||
|
||||
public Challenge getStartedChallenge()
|
||||
{
|
||||
return _startedChallenge;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return _handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -6,30 +6,30 @@ import nautilus.game.arcade.game.games.mineware.Challenge;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class challengeEndEvent extends Event
|
||||
public class ChallengeEndEvent extends Event
|
||||
{
|
||||
private Challenge _endedChallenge;
|
||||
private static final HandlerList _handlers = new HandlerList();
|
||||
|
||||
public challengeEndEvent(Challenge challenge)
|
||||
public ChallengeEndEvent(Challenge challenge)
|
||||
{
|
||||
this._endedChallenge = challenge;
|
||||
this._endedChallenge = challenge;
|
||||
}
|
||||
|
||||
public Challenge getEndedChallenge()
|
||||
{
|
||||
return _endedChallenge;
|
||||
return _endedChallenge;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return _handlers;
|
||||
}
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return _handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return getHandlerList();
|
||||
}
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,46 @@
|
||||
package nautilus.game.arcade.game.games.mineware.stats;
|
||||
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.game.games.mineware.Challenge;
|
||||
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeKangarooJump;
|
||||
import nautilus.game.arcade.game.games.mineware.events.ChallengeEndEvent;
|
||||
import nautilus.game.arcade.stats.StatTracker;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
public class MinewareKangarooAtHeart extends StatTracker<Game>
|
||||
{
|
||||
|
||||
public MinewareKangarooAtHeart(Game game)
|
||||
{
|
||||
super(game);
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onChallengeEnd(ChallengeEndEvent event)
|
||||
{
|
||||
if(getGame().GetState() != GameState.Live)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Challenge challenge = event.getEndedChallenge();
|
||||
|
||||
if(!(challenge instanceof ChallengeKangarooJump))
|
||||
{
|
||||
return;
|
||||
}
|
||||
ChallengeKangarooJump kJump = (ChallengeKangarooJump) challenge;
|
||||
|
||||
for(Player player: kJump.getPlayerHeight().keySet())
|
||||
{
|
||||
if(!kJump.isLost(player))
|
||||
{
|
||||
addStat(player, "Kangaroo", 1, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
package nautilus.game.arcade.game.games.mineware.stats;
|
||||
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.game.games.mineware.Challenge;
|
||||
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeNavigateMaze;
|
||||
import nautilus.game.arcade.game.games.mineware.events.ChallengeEndEvent;
|
||||
import nautilus.game.arcade.game.games.mineware.events.ChallengeStartEvent;
|
||||
import nautilus.game.arcade.stats.StatTracker;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
public class MinewareLauraCraftTracker extends StatTracker<Game>
|
||||
{
|
||||
|
||||
private long _challengeStartTime;
|
||||
private int _timeForCompletion = 8; // in seconds
|
||||
|
||||
public MinewareLauraCraftTracker(Game game)
|
||||
{
|
||||
super(game);
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onMazeChallengeStart(ChallengeStartEvent event)
|
||||
{
|
||||
if(getGame().GetState() != GameState.Live)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Challenge challenge = event.getStartedChallenge();
|
||||
|
||||
if(!(challenge instanceof ChallengeNavigateMaze))
|
||||
{
|
||||
return;
|
||||
}
|
||||
_challengeStartTime = System.currentTimeMillis();
|
||||
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onMazeChallengeEnd(ChallengeEndEvent event)
|
||||
{
|
||||
if(getGame().GetState() != GameState.Live)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Challenge challenge = event.getEndedChallenge();
|
||||
|
||||
if(!(challenge instanceof ChallengeNavigateMaze))
|
||||
{
|
||||
return;
|
||||
}
|
||||
ChallengeNavigateMaze challengeMaze = (ChallengeNavigateMaze) challenge;
|
||||
for(Player player: challengeMaze.getPlayerTimes().keySet())
|
||||
{
|
||||
if(challengeMaze.getPlayerTimes().get(player) <= (_challengeStartTime+(_timeForCompletion*1000)))
|
||||
{
|
||||
addStat(player, "LauraCraft", 1, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package nautilus.game.arcade.game.games.mineware.stats;
|
||||
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.game.games.mineware.Challenge;
|
||||
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeMilkACow;
|
||||
import nautilus.game.arcade.game.games.mineware.events.ChallengeEndEvent;
|
||||
import nautilus.game.arcade.stats.StatTracker;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
public class MinewareMilkManTracker extends StatTracker<Game>
|
||||
{
|
||||
|
||||
public MinewareMilkManTracker(Game game)
|
||||
{
|
||||
super(game);
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onChallengeEnd(ChallengeEndEvent event)
|
||||
{
|
||||
if(getGame().GetState() != GameState.Live)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Challenge challenge = event.getEndedChallenge();
|
||||
if(!(challenge instanceof ChallengeMilkACow))
|
||||
{
|
||||
return;
|
||||
}
|
||||
ChallengeMilkACow milk = (ChallengeMilkACow) challenge;
|
||||
|
||||
for(Player player : milk.getScore().keySet())
|
||||
{
|
||||
int score = milk.getScore().get(player);
|
||||
if(!player.isOnline())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
addStat(player, "MilkMan", score, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package nautilus.game.arcade.game.games.mineware.stats;
|
||||
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.game.games.mineware.Challenge;
|
||||
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeShootChickens;
|
||||
import nautilus.game.arcade.game.games.mineware.events.ChallengeEndEvent;
|
||||
import nautilus.game.arcade.stats.StatTracker;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
public class MinewarePinataMasterTracker extends StatTracker<Game>
|
||||
{
|
||||
|
||||
public MinewarePinataMasterTracker(Game game)
|
||||
{
|
||||
super(game);
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onChallengeEnd(ChallengeEndEvent event)
|
||||
{
|
||||
if(getGame().GetState() != GameState.Live)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Challenge challenge = event.getEndedChallenge();
|
||||
|
||||
if(!(challenge instanceof ChallengeShootChickens))
|
||||
{
|
||||
return;
|
||||
}
|
||||
ChallengeShootChickens chickChallenge = (ChallengeShootChickens) challenge;
|
||||
|
||||
for(Player player: chickChallenge.getArrowsShot().keySet())
|
||||
{
|
||||
if(chickChallenge.getArrowsShot().get(player) == 6 && challenge.IsCompleted(player))
|
||||
{
|
||||
addStat(player, "PinataMaster", 1, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package nautilus.game.arcade.game.games.mineware.stats;
|
||||
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.game.games.mineware.Challenge;
|
||||
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeWaveCrush;
|
||||
import nautilus.game.arcade.game.games.mineware.events.ChallengeEndEvent;
|
||||
import nautilus.game.arcade.stats.StatTracker;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
public class MinewareSurfUpTracker extends StatTracker<Game>
|
||||
{
|
||||
|
||||
public MinewareSurfUpTracker(Game game)
|
||||
{
|
||||
super(game);
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onChallengeEnd(ChallengeEndEvent event)
|
||||
{
|
||||
if(getGame().GetState() != GameState.Live)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Challenge challenge = event.getEndedChallenge();
|
||||
|
||||
if(!(challenge instanceof ChallengeWaveCrush))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ChallengeWaveCrush wave = (ChallengeWaveCrush) challenge;
|
||||
|
||||
for(Player player: wave.getsurvivedwaves().keySet())
|
||||
{
|
||||
int survivedWavesAmount = wave.getsurvivedwaves().get(player);
|
||||
|
||||
if(survivedWavesAmount < 1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
addStat(player, "SurfUp", survivedWavesAmount, false, false);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package nautilus.game.arcade.game.games.mineware.stats;
|
||||
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.game.games.mineware.Challenge;
|
||||
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeReverseTag;
|
||||
import nautilus.game.arcade.game.games.mineware.events.ChallengeEndEvent;
|
||||
import nautilus.game.arcade.stats.StatTracker;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
public class MinewareTagMasterTracker extends StatTracker<Game>
|
||||
{
|
||||
|
||||
public MinewareTagMasterTracker(Game game)
|
||||
{
|
||||
super(game);
|
||||
System.out.println("3");
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onGameEnd(ChallengeEndEvent event)
|
||||
{
|
||||
if(getGame().GetState() != GameState.Live)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Challenge challenge = event.getEndedChallenge();
|
||||
|
||||
if(!(challenge instanceof ChallengeReverseTag))
|
||||
{
|
||||
return;
|
||||
}
|
||||
ChallengeReverseTag tag = (ChallengeReverseTag) challenge;
|
||||
|
||||
for(Player player: tag.getNonTaggedPlayers())
|
||||
{
|
||||
if(tag.isLost(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
addStat(player, "TagMaster", 1, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package nautilus.game.arcade.game.games.mineware.stats;
|
||||
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.stats.StatTracker;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
public class MinewareVeteranTracker extends StatTracker<Game>
|
||||
{
|
||||
public MinewareVeteranTracker(Game game)
|
||||
{
|
||||
super(game);
|
||||
System.out.println("1");
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void tracePlayerWin(GameStateChangeEvent event)
|
||||
{
|
||||
if(event.GetState() == GameState.End)
|
||||
{
|
||||
for(Player player: getGame().getWinners())
|
||||
{
|
||||
addStat(player, "Veteran", 1, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user