Added Achievements and fixed bugs.
This commit is contained in:
parent
ccaa86662c
commit
e8f7b140df
@ -638,6 +638,52 @@ public enum Achievement
|
|||||||
new int[]{1},
|
new int[]{1},
|
||||||
AchievementCategory.MINE_STRIKE),
|
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
|
||||||
BOMB_LOBBERS_WINS("Master Bomber", 1200,
|
BOMB_LOBBERS_WINS("Master Bomber", 1200,
|
||||||
new String[]{"Bomb Lobbers.Wins"},
|
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 },
|
new StatDisplay("Kills as Undead"), new StatDisplay("Deaths as Undead"), StatDisplay.GEMS_EARNED },
|
||||||
Material.DIAMOND_CHESTPLATE, 0, GameCategory.CLASSICS, null),
|
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,
|
BLOCK_HUNT("Block Hunt", null,
|
||||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
||||||
Material.GRASS, 0, GameCategory.CLASSICS, "Infestor Kit"),
|
Material.GRASS, 0, GameCategory.CLASSICS, "Infestor Kit"),
|
||||||
|
@ -49,7 +49,7 @@ public class AchievementMainPage extends ShopPageBase<AchievementManager, Achiev
|
|||||||
"XXXXOXXXO",
|
"XXXXOXXXO",
|
||||||
"OXOXOXOXO",
|
"OXOXOXOXO",
|
||||||
"OXOXOXOXO",
|
"OXOXOXOXO",
|
||||||
"XXOXOXOXX").getItemSlots();
|
"XOXOXOXOX").getItemSlots();
|
||||||
int listSlot = 0;
|
int listSlot = 0;
|
||||||
|
|
||||||
for (AchievementCategory category : AchievementCategory.values())
|
for (AchievementCategory category : AchievementCategory.values())
|
||||||
|
@ -16,7 +16,7 @@ import mineplex.core.projectile.ProjectileUser;
|
|||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
|
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.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -311,6 +311,11 @@ public abstract class Challenge implements Listener
|
|||||||
return Lost;
|
return Lost;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public HashSet<Player> getWinners()
|
||||||
|
{
|
||||||
|
return Completed;
|
||||||
|
}
|
||||||
|
|
||||||
public void setLost(Player player, boolean invis)
|
public void setLost(Player player, boolean invis)
|
||||||
{
|
{
|
||||||
if(isDone(player))
|
if(isDone(player))
|
||||||
|
@ -1,19 +1,17 @@
|
|||||||
package nautilus.game.arcade.game.games.mineware;
|
package nautilus.game.arcade.game.games.mineware;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.sql.Time;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
|
import mineplex.core.account.CoreClient;
|
||||||
import mineplex.core.common.Rank;
|
import mineplex.core.common.Rank;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.UUIDFetcher;
|
|
||||||
import mineplex.core.common.util.UtilInv;
|
import mineplex.core.common.util.UtilInv;
|
||||||
import mineplex.core.common.util.UtilMath;
|
import mineplex.core.common.util.UtilMath;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
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.UtilTextTop;
|
||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
import mineplex.core.common.util.UtilWorld;
|
import mineplex.core.common.util.UtilWorld;
|
||||||
import mineplex.core.itemstack.ItemBuilder;
|
|
||||||
import mineplex.core.projectile.IThrown;
|
import mineplex.core.projectile.IThrown;
|
||||||
import mineplex.core.projectile.ProjectileUser;
|
import mineplex.core.projectile.ProjectileUser;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
@ -46,6 +43,7 @@ import nautilus.game.arcade.game.games.mineware.challenges.ChallengeDogvsCat;
|
|||||||
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeDragonEgg;
|
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeDragonEgg;
|
||||||
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeFallingBlocks;
|
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeFallingBlocks;
|
||||||
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeFastFood;
|
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.ChallengeInfestation;
|
||||||
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeKOTL;
|
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeKOTL;
|
||||||
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeKangarooJump;
|
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeKangarooJump;
|
||||||
@ -66,14 +64,21 @@ 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.ChallengeTntLauncher;
|
||||||
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeVolleyPig;
|
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.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 nautilus.game.arcade.kit.Kit;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.block.Banner;
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -82,6 +87,7 @@ import org.bukkit.event.EventPriority;
|
|||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||||
|
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
@ -91,8 +97,6 @@ import org.bukkit.potion.PotionEffect;
|
|||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
import com.sun.xml.internal.ws.resources.UtilMessages;
|
|
||||||
|
|
||||||
public class MineWare extends SoloGame implements IThrown
|
public class MineWare extends SoloGame implements IThrown
|
||||||
{
|
{
|
||||||
private HashMap<Player, Integer> _lives = new HashMap<Player, Integer>();
|
private HashMap<Player, Integer> _lives = new HashMap<Player, Integer>();
|
||||||
@ -135,6 +139,15 @@ public class MineWare extends SoloGame implements IThrown
|
|||||||
Manager.GetCreature().SetDisableCustomDrops(true);
|
Manager.GetCreature().SetDisableCustomDrops(true);
|
||||||
|
|
||||||
PopulateOrders();
|
PopulateOrders();
|
||||||
|
|
||||||
|
registerStatTrackers(
|
||||||
|
new MinewareVeteranTracker(this),
|
||||||
|
new MinewareSurfUpTracker(this),
|
||||||
|
new MinewareLauraCraftTracker(this),
|
||||||
|
new MinewareMilkManTracker(this),
|
||||||
|
new MinewarePinataMasterTracker(this),
|
||||||
|
new MinewareTagMasterTracker(this),
|
||||||
|
new MinewareKangarooAtHeart(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -184,38 +197,38 @@ public class MineWare extends SoloGame implements IThrown
|
|||||||
|
|
||||||
public void PopulateOrders()
|
public void PopulateOrders()
|
||||||
{
|
{
|
||||||
// _challenges.add(ChallengeAnvilDance.class);
|
_challenges.add(ChallengeAnvilDance.class);
|
||||||
// _challenges.add(ChallengeFallingBlocks.class);
|
_challenges.add(ChallengeFallingBlocks.class);
|
||||||
// _challenges.add(ChallengeWaveCrush.class);
|
_challenges.add(ChallengeWaveCrush.class);
|
||||||
// _challenges.add(ChallengePickASide.class);//
|
_challenges.add(ChallengePickASide.class);//
|
||||||
// _challenges.add(ChallengeKOTL.class);
|
_challenges.add(ChallengeKOTL.class);
|
||||||
// _challenges.add(ChallengePunchThePig.class);
|
_challenges.add(ChallengePunchThePig.class);
|
||||||
// _challenges.add(ChallengeDogvsCat.class);
|
_challenges.add(ChallengeDogvsCat.class);
|
||||||
// _challenges.add(ChallengeShootChickens.class);
|
_challenges.add(ChallengeShootChickens.class);
|
||||||
// _challenges.add(ChallengeReverseTag.class);
|
_challenges.add(ChallengeReverseTag.class);
|
||||||
// _challenges.add(ChallengeKangarooJump.class);
|
_challenges.add(ChallengeKangarooJump.class);
|
||||||
// _challenges.add(ChallengeMiniOITQ.class);
|
_challenges.add(ChallengeMiniOITQ.class);
|
||||||
// _challenges.add(ChallengeMineADiamond.class);
|
_challenges.add(ChallengeMineADiamond.class);
|
||||||
// _challenges.add(ChallengeRushPush.class);
|
_challenges.add(ChallengeRushPush.class);
|
||||||
// _challenges.add(ChallengeBlockLobbers.class);
|
_challenges.add(ChallengeBlockLobbers.class);
|
||||||
// _challenges.add(ChallengeStandOnColor.class);
|
_challenges.add(ChallengeStandOnColor.class);
|
||||||
// _challenges.add(ChallengeMilkACow.class);
|
_challenges.add(ChallengeMilkACow.class);
|
||||||
// _challenges.add(ChallengeDragonEgg.class);
|
_challenges.add(ChallengeDragonEgg.class);
|
||||||
// _challenges.add(ChallengeChestLoot.class);
|
_challenges.add(ChallengeChestLoot.class);
|
||||||
// _challenges.add(ChallengeLavaRun.class);
|
_challenges.add(ChallengeLavaRun.class);
|
||||||
// _challenges.add(ChallengeNavigateMaze.class);
|
_challenges.add(ChallengeNavigateMaze.class);
|
||||||
// _challenges.add(ChallengeVolleyPig.class);
|
_challenges.add(ChallengeVolleyPig.class);
|
||||||
// _challenges.add(ChallengeSmashOff.class);
|
_challenges.add(ChallengeSmashOff.class);
|
||||||
// _challenges.add(ChallengeTntLauncher.class);
|
_challenges.add(ChallengeTntLauncher.class);
|
||||||
// _challenges.add(ChallengeArrowRampage.class);
|
_challenges.add(ChallengeArrowRampage.class);
|
||||||
// _challenges.add(ChallengeCloudFall.class);
|
_challenges.add(ChallengeCloudFall.class);
|
||||||
// _challenges.add(ChallengeInfestation.class);
|
_challenges.add(ChallengeInfestation.class);
|
||||||
// _challenges.add(ChallengeBouncingBlock.class);
|
_challenges.add(ChallengeBouncingBlock.class);
|
||||||
// _challenges.add(ChallengeEvolutionOfCombat.class);
|
_challenges.add(ChallengeBlockRunner.class);
|
||||||
// _challenges.add(ChallengeBlockRunner.class);
|
_challenges.add(ChallengeFastFood.class);
|
||||||
// _challenges.add(ChallengeFastFood.class);
|
_challenges.add(ChallengeMinecartDance.class);
|
||||||
// _challenges.add(ChallengeMinecartDance.class);
|
|
||||||
_challenges.add(ChallengeRedLightGreenLight.class);
|
_challenges.add(ChallengeRedLightGreenLight.class);
|
||||||
|
_challenges.add(ChallengeFishingDay.class);
|
||||||
|
|
||||||
// ============== trashed ==============
|
// ============== trashed ==============
|
||||||
// _challenges.add(ChallengeSimonSays.class);
|
// _challenges.add(ChallengeSimonSays.class);
|
||||||
@ -392,7 +405,7 @@ public class MineWare extends SoloGame implements IThrown
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Deregister
|
// Deregister
|
||||||
Bukkit.getServer().getPluginManager().callEvent(new challengeEndEvent(_challenge));
|
Bukkit.getServer().getPluginManager().callEvent(new ChallengeEndEvent(_challenge));
|
||||||
HandlerList.unregisterAll(_challenge);
|
HandlerList.unregisterAll(_challenge);
|
||||||
|
|
||||||
_challenge.EndOrder();
|
_challenge.EndOrder();
|
||||||
@ -648,6 +661,7 @@ public class MineWare extends SoloGame implements IThrown
|
|||||||
_isChallengeStarted = true;
|
_isChallengeStarted = true;
|
||||||
|
|
||||||
_challenge.StartOrder();
|
_challenge.StartOrder();
|
||||||
|
Bukkit.getServer().getPluginManager().callEvent(new ChallengeStartEvent(_challenge));
|
||||||
|
|
||||||
// Register events
|
// Register events
|
||||||
UtilServer.getServer().getPluginManager().registerEvents(_challenge, Manager.getPlugin());
|
UtilServer.getServer().getPluginManager().registerEvents(_challenge, Manager.getPlugin());
|
||||||
@ -723,6 +737,31 @@ public class MineWare extends SoloGame implements IThrown
|
|||||||
return _lives.get(player);
|
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)
|
public void LoseLife(Player player, boolean isDeath)
|
||||||
{
|
{
|
||||||
if(!isDeath)
|
if(!isDeath)
|
||||||
@ -777,7 +816,7 @@ public class MineWare extends SoloGame implements IThrown
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Deregister
|
// Deregister
|
||||||
Bukkit.getServer().getPluginManager().callEvent(new challengeEndEvent(_challenge));
|
Bukkit.getServer().getPluginManager().callEvent(new ChallengeEndEvent(_challenge));
|
||||||
HandlerList.unregisterAll(_challenge);
|
HandlerList.unregisterAll(_challenge);
|
||||||
|
|
||||||
_challenge.EndOrder();
|
_challenge.EndOrder();
|
||||||
|
@ -31,16 +31,16 @@ import org.bukkit.util.Vector;
|
|||||||
public class ChallengeAnvilDance extends Challenge
|
public class ChallengeAnvilDance extends Challenge
|
||||||
{
|
{
|
||||||
// The amount of seconds until the anvils start to dance.
|
// The amount of seconds until the anvils start to dance.
|
||||||
private static final int DanceDelay = 10;
|
private int _danceDelay = 10;
|
||||||
|
|
||||||
// The map height where all anvils will spawn.
|
// The map height where all anvils will spawn.
|
||||||
private static final int WaveHeight = 13;
|
private int _waveHeight = 13;
|
||||||
|
|
||||||
// The map height where the first firework of a dance wave will be spawned.
|
// The map height where the first firework of a dance wave will be spawned.
|
||||||
private static final int FireworkHeight = 8;
|
private int _fireworkHeight = 8;
|
||||||
|
|
||||||
// The amount of times the height is being increased on every firework.
|
// The amount of times the height is being increased on every firework.
|
||||||
private static final int FireWorkHeightIncrement = 4;
|
private int _fireworkHeightIncrement = 4;
|
||||||
|
|
||||||
// True when anvils are simply falling, false when they dance in air.
|
// True when anvils are simply falling, false when they dance in air.
|
||||||
private boolean _paused;
|
private boolean _paused;
|
||||||
@ -238,13 +238,13 @@ public class ChallengeAnvilDance extends Challenge
|
|||||||
|
|
||||||
startUnpauseTask();
|
startUnpauseTask();
|
||||||
}
|
}
|
||||||
}.runTaskTimer(Host.getArcadeManager().getPlugin(), 100L, DanceDelay * 20);
|
}.runTaskTimer(Host.getArcadeManager().getPlugin(), 100L, _danceDelay * 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
private void createAnvil()
|
private void createAnvil()
|
||||||
{
|
{
|
||||||
Location center = new Location(Host.WorldData.World, 0, UtilMath.r(3) + WaveHeight, 0);
|
Location center = new Location(Host.WorldData.World, 0, UtilMath.r(3) + _waveHeight, 0);
|
||||||
ArrayList<Location> locations = UtilShapes.getCircle(center, false, getArenaSize());
|
ArrayList<Location> locations = UtilShapes.getCircle(center, false, getArenaSize());
|
||||||
|
|
||||||
Location random = locations.get(UtilMath.r(locations.size()));
|
Location random = locations.get(UtilMath.r(locations.size()));
|
||||||
@ -284,14 +284,14 @@ public class ChallengeAnvilDance extends Challenge
|
|||||||
{
|
{
|
||||||
_paused = false;
|
_paused = false;
|
||||||
}
|
}
|
||||||
}.runTaskLater(Host.getArcadeManager().getPlugin(), (DanceDelay / 2) * 20);
|
}.runTaskLater(Host.getArcadeManager().getPlugin(), (_danceDelay / 2) * 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void playFireworksTask()
|
private void playFireworksTask()
|
||||||
{
|
{
|
||||||
new BukkitRunnable()
|
new BukkitRunnable()
|
||||||
{
|
{
|
||||||
int height = FireworkHeight;
|
int height = _fireworkHeight;
|
||||||
int times = 0;
|
int times = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -311,7 +311,7 @@ public class ChallengeAnvilDance extends Challenge
|
|||||||
Color.fromBGR(UtilMath.r(255), UtilMath.r(255), UtilMath.r(255)), false, true);
|
Color.fromBGR(UtilMath.r(255), UtilMath.r(255), UtilMath.r(255)), false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
height += FireWorkHeightIncrement;
|
height += _fireworkHeightIncrement;
|
||||||
}
|
}
|
||||||
}.runTaskTimer(Host.getArcadeManager().getPlugin(), 0L, 5L);
|
}.runTaskTimer(Host.getArcadeManager().getPlugin(), 0L, 5L);
|
||||||
}
|
}
|
||||||
@ -340,7 +340,7 @@ public class ChallengeAnvilDance extends Challenge
|
|||||||
{
|
{
|
||||||
Player player = (Player) entity;
|
Player player = (Player) entity;
|
||||||
|
|
||||||
if(!Host.IsAlive(player))
|
if(isDone(player))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
player.damage(player.getHealth());
|
player.damage(player.getHealth());
|
||||||
|
@ -16,7 +16,7 @@ import mineplex.core.updater.UpdateType;
|
|||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import nautilus.game.arcade.game.games.mineware.Challenge;
|
import nautilus.game.arcade.game.games.mineware.Challenge;
|
||||||
import nautilus.game.arcade.game.games.mineware.MineWare;
|
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.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -131,7 +131,7 @@ public class ChallengeArrowRampage extends Challenge
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onChallengeEnd(challengeEndEvent event)
|
public void onChallengeEnd(ChallengeEndEvent event)
|
||||||
{
|
{
|
||||||
for(Entity fBlocks: Host.WorldData.World.getEntities())
|
for(Entity fBlocks: Host.WorldData.World.getEntities())
|
||||||
{
|
{
|
||||||
|
@ -38,7 +38,7 @@ public class ChallengeBlockLobbers extends Challenge
|
|||||||
|
|
||||||
public ChallengeBlockLobbers(MineWare host)
|
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
|
@Override
|
||||||
|
@ -44,7 +44,7 @@ public class ChallengeBouncingBlock extends Challenge
|
|||||||
|
|
||||||
public ChallengeBouncingBlock(MineWare host)
|
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
|
@Override
|
||||||
|
@ -28,9 +28,9 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
public class ChallengeBuildRace extends Challenge
|
public class ChallengeBuildRace extends Challenge
|
||||||
{
|
{
|
||||||
// The amount of blocks for every hotbar slot.
|
// The amount of blocks for every hotbar slot.
|
||||||
private static final int InventoryBlockAmount = 5;
|
private int _inventoryBlockAmount = 5;
|
||||||
|
|
||||||
private static Material[] _materials =
|
private Material[] _materials =
|
||||||
{ Material.DIRT, Material.STONE, Material.COBBLESTONE, Material.LOG, Material.WOOD, Material.WOOL, Material.BRICK, Material.SMOOTH_BRICK,
|
{ Material.DIRT, Material.STONE, Material.COBBLESTONE, Material.LOG, Material.WOOD, Material.WOOL, Material.BRICK, Material.SMOOTH_BRICK,
|
||||||
Material.GLASS };
|
Material.GLASS };
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ public class ChallengeBuildRace extends Challenge
|
|||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (!Host.IsAlive(player))
|
if(isDone(player))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(IsCompleted(player))
|
if(IsCompleted(player))
|
||||||
@ -181,7 +181,7 @@ public class ChallengeBuildRace extends Challenge
|
|||||||
|
|
||||||
for(Material material : shuffledMaterials)
|
for(Material material : shuffledMaterials)
|
||||||
{
|
{
|
||||||
ItemStack itemStack = new ItemStack(material, InventoryBlockAmount);
|
ItemStack itemStack = new ItemStack(material, _inventoryBlockAmount);
|
||||||
player.getInventory().addItem(itemStack);
|
player.getInventory().addItem(itemStack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -157,8 +157,6 @@ public class ChallengeCloudFall extends Challenge
|
|||||||
{
|
{
|
||||||
return;
|
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)
|
if(Math.round(event.GetDamageePlayer().getLocation().getY()) == 3)
|
||||||
{
|
{
|
||||||
event.SetCancelled("fell on wool");
|
event.SetCancelled("fell on wool");
|
||||||
|
@ -31,16 +31,16 @@ import org.bukkit.scheduler.BukkitRunnable;
|
|||||||
public class ChallengeFallingBlocks extends Challenge
|
public class ChallengeFallingBlocks extends Challenge
|
||||||
{
|
{
|
||||||
// The chance of an anvil to spawn in a single block.
|
// The chance of an anvil to spawn in a single block.
|
||||||
private static final double SpawnChance = 20.0;
|
private double _spawnChance = 20.0;
|
||||||
|
|
||||||
// The amount of times the spawn chance will increment after each wave.
|
// The amount of times the spawn chance will increment after each wave.
|
||||||
private static final double IncrementRate = 5.0;
|
private double _incrementRate = 5.0;
|
||||||
|
|
||||||
// The map height where all anvil waves will spawn.
|
// The map height where all anvil waves will spawn.
|
||||||
private static final double WaveHeight = 10.0;
|
private double _waveHeight = 10.0;
|
||||||
|
|
||||||
// The amount of seconds until the next anvil wave appears.
|
// The amount of seconds until the next anvil wave appears.
|
||||||
private static final long NextWave = 5;
|
private long _nextWave = 5;
|
||||||
|
|
||||||
// The remaining time until the next anvil wave appears.
|
// The remaining time until the next anvil wave appears.
|
||||||
private int _time;
|
private int _time;
|
||||||
@ -60,19 +60,19 @@ public class ChallengeFallingBlocks extends Challenge
|
|||||||
Material.IRON_ORE, Material.HAY_BLOCK, Material.JUKEBOX, Material.SMOOTH_BRICK, Material.EMERALD_ORE, Material.FURNACE };
|
Material.IRON_ORE, Material.HAY_BLOCK, Material.JUKEBOX, Material.SMOOTH_BRICK, Material.EMERALD_ORE, Material.FURNACE };
|
||||||
|
|
||||||
// The array of materials used to generate random floor.
|
// The array of materials used to generate random floor.
|
||||||
private static Material[] _floor =
|
private Material[] _floor =
|
||||||
{ Material.GRASS, Material.DIRT, Material.STONE, Material.COBBLESTONE };
|
{ Material.GRASS, Material.DIRT, Material.STONE, Material.COBBLESTONE };
|
||||||
|
|
||||||
// The array of sounds used to play when a new wave is being deployed.
|
// The array of sounds used to play when a new wave is being deployed.
|
||||||
private static Sound[] _sounds =
|
private Sound[] _sounds =
|
||||||
{ Sound.DIG_GRASS, Sound.DIG_GRAVEL, Sound.DIG_SAND, Sound.DIG_SNOW, Sound.DIG_STONE, Sound.DIG_WOOD, Sound.DIG_WOOL };
|
{ Sound.DIG_GRASS, Sound.DIG_GRAVEL, Sound.DIG_SAND, Sound.DIG_SNOW, Sound.DIG_STONE, Sound.DIG_WOOD, Sound.DIG_WOOL };
|
||||||
|
|
||||||
public ChallengeFallingBlocks(MineWare host)
|
public ChallengeFallingBlocks(MineWare host)
|
||||||
{
|
{
|
||||||
super(host, ChallengeType.LastStanding, "Falling Blocks", "Blocks are falling from the sky!", "Try to avoid getting hit.");
|
super(host, ChallengeType.LastStanding, "Falling Blocks", "Blocks are falling from the sky!", "Try to avoid getting hit.");
|
||||||
|
|
||||||
_time = (int) NextWave;
|
_time = (int) _nextWave;
|
||||||
_modifiedSpawnChance = SpawnChance;
|
_modifiedSpawnChance = _spawnChance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -210,7 +210,7 @@ public class ChallengeFallingBlocks extends Challenge
|
|||||||
|
|
||||||
createWave();
|
createWave();
|
||||||
}
|
}
|
||||||
}.runTaskTimer(Host.getArcadeManager().getPlugin(), 20 * NextWave, 20 * NextWave);
|
}.runTaskTimer(Host.getArcadeManager().getPlugin(), 20 * _nextWave, 20 * _nextWave);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startWaveTimerTask()
|
private void startWaveTimerTask()
|
||||||
@ -228,7 +228,7 @@ public class ChallengeFallingBlocks extends Challenge
|
|||||||
|
|
||||||
if(_time <= 0)
|
if(_time <= 0)
|
||||||
{
|
{
|
||||||
_time = (int) NextWave;
|
_time = (int) _nextWave;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wave = _wavesCompleted + 1;
|
int wave = _wavesCompleted + 1;
|
||||||
@ -251,7 +251,7 @@ public class ChallengeFallingBlocks extends Challenge
|
|||||||
private void createWave()
|
private void createWave()
|
||||||
{
|
{
|
||||||
if(_modifiedSpawnChance < 100.0)
|
if(_modifiedSpawnChance < 100.0)
|
||||||
_modifiedSpawnChance += IncrementRate;
|
_modifiedSpawnChance += _incrementRate;
|
||||||
|
|
||||||
_wavesCompleted++;
|
_wavesCompleted++;
|
||||||
|
|
||||||
@ -262,7 +262,7 @@ public class ChallengeFallingBlocks extends Challenge
|
|||||||
player.playSound(player.getLocation(), nextSound, 1.0F, 1.5F);
|
player.playSound(player.getLocation(), nextSound, 1.0F, 1.5F);
|
||||||
}
|
}
|
||||||
|
|
||||||
Location center = new Location(Host.WorldData.World, 0, WaveHeight, 0);
|
Location center = new Location(Host.WorldData.World, 0, _waveHeight, 0);
|
||||||
|
|
||||||
for(Location location : UtilShapes.getCircle(center, false, getArenaSize()))
|
for(Location location : UtilShapes.getCircle(center, false, getArenaSize()))
|
||||||
{
|
{
|
||||||
@ -279,7 +279,7 @@ public class ChallengeFallingBlocks extends Challenge
|
|||||||
|
|
||||||
if(camp.getY() >= 1 && camp.getY() <= 3)
|
if(camp.getY() >= 1 && camp.getY() <= 3)
|
||||||
{
|
{
|
||||||
createFallingBlock(new Location(Host.WorldData.World, camp.getX(), WaveHeight, camp.getZ()));
|
createFallingBlock(new Location(Host.WorldData.World, camp.getX(), _waveHeight, camp.getZ()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -319,7 +319,7 @@ public class ChallengeFallingBlocks extends Challenge
|
|||||||
{
|
{
|
||||||
Player player = (Player) entity;
|
Player player = (Player) entity;
|
||||||
|
|
||||||
if(!Host.IsAlive(player))
|
if(isDone(player))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
player.damage(player.getHealth());
|
player.damage(player.getHealth());
|
||||||
|
@ -32,14 +32,14 @@ import org.bukkit.scheduler.BukkitRunnable;
|
|||||||
|
|
||||||
public class ChallengeFastFood extends Challenge
|
public class ChallengeFastFood extends Challenge
|
||||||
{
|
{
|
||||||
private static final Material[] _food =
|
private Material[] _food =
|
||||||
{ Material.APPLE, Material.BREAD, Material.GRILLED_PORK, Material.COOKED_BEEF, Material.RAW_FISH, Material.COOKED_FISH, Material.CAKE,
|
{ Material.APPLE, Material.BREAD, Material.GRILLED_PORK, Material.COOKED_BEEF, Material.RAW_FISH, Material.COOKED_FISH, Material.CAKE,
|
||||||
Material.COOKIE, Material.MELON, Material.COOKED_CHICKEN, Material.CARROT_ITEM, Material.BAKED_POTATO, Material.PUMPKIN_PIE };
|
Material.COOKIE, Material.MELON, Material.COOKED_CHICKEN, Material.CARROT_ITEM, Material.BAKED_POTATO, Material.PUMPKIN_PIE };
|
||||||
|
|
||||||
private static final Material[] _flowers =
|
private Material[] _flowers =
|
||||||
{ Material.LONG_GRASS, Material.YELLOW_FLOWER, Material.RED_ROSE };
|
{ Material.LONG_GRASS, Material.YELLOW_FLOWER, Material.RED_ROSE };
|
||||||
|
|
||||||
private int itemSeperator = 0;
|
private int _itemSeperator = 0;
|
||||||
|
|
||||||
public ChallengeFastFood(MineWare host)
|
public ChallengeFastFood(MineWare host)
|
||||||
{
|
{
|
||||||
@ -96,7 +96,7 @@ public class ChallengeFastFood extends Challenge
|
|||||||
@Override
|
@Override
|
||||||
public void cleanupRoom()
|
public void cleanupRoom()
|
||||||
{
|
{
|
||||||
itemSeperator = 0;
|
_itemSeperator = 0;
|
||||||
|
|
||||||
for(Entity entity : Host.WorldData.World.getEntities())
|
for(Entity entity : Host.WorldData.World.getEntities())
|
||||||
{
|
{
|
||||||
@ -115,7 +115,7 @@ public class ChallengeFastFood extends Challenge
|
|||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if(UtilEvent.isAction(event, ActionType.L) && Host.IsAlive(player))
|
if(UtilEvent.isAction(event, ActionType.L) && !isDone(player))
|
||||||
{
|
{
|
||||||
if(event.getItem() != null)
|
if(event.getItem() != null)
|
||||||
{
|
{
|
||||||
@ -203,8 +203,8 @@ public class ChallengeFastFood extends Challenge
|
|||||||
player.getWorld().playSound(player.getLocation(), Sound.EAT, 0.5F, 1.1F);
|
player.getWorld().playSound(player.getLocation(), Sound.EAT, 0.5F, 1.1F);
|
||||||
UtilInv.remove(player, item.getType(), item.getData().getData(), 1);
|
UtilInv.remove(player, item.getType(), item.getData().getData(), 1);
|
||||||
|
|
||||||
itemSeperator++;
|
_itemSeperator++;
|
||||||
ItemStack toThrow = ItemStackFactory.Instance.CreateStack(item.getType(), item.getData().getData(), 1, Integer.toString(itemSeperator));
|
ItemStack toThrow = ItemStackFactory.Instance.CreateStack(item.getType(), item.getData().getData(), 1, Integer.toString(_itemSeperator));
|
||||||
|
|
||||||
double randomMultiply = 0.5 + (1 - 0.5) * UtilMath.random.nextDouble();
|
double randomMultiply = 0.5 + (1 - 0.5) * UtilMath.random.nextDouble();
|
||||||
|
|
||||||
|
@ -0,0 +1,415 @@
|
|||||||
|
package nautilus.game.arcade.game.games.mineware.challenges;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.UtilAction;
|
||||||
|
import mineplex.core.common.util.UtilAlg;
|
||||||
|
import mineplex.core.common.util.UtilInv;
|
||||||
|
import mineplex.core.common.util.UtilMath;
|
||||||
|
import mineplex.core.common.util.UtilParticle;
|
||||||
|
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||||
|
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
|
import mineplex.core.common.util.UtilTextBottom;
|
||||||
|
import mineplex.core.itemstack.ItemBuilder;
|
||||||
|
import mineplex.core.recharge.Recharge;
|
||||||
|
import nautilus.game.arcade.game.games.mineware.Challenge;
|
||||||
|
import nautilus.game.arcade.game.games.mineware.MineWare;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.Fish;
|
||||||
|
import org.bukkit.entity.FishHook;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.TNTPrimed;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
|
import org.bukkit.event.player.PlayerFishEvent;
|
||||||
|
import org.bukkit.event.player.PlayerItemHeldEvent;
|
||||||
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
|
import org.bukkit.inventory.ItemFlag;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public class ChallengeFishingDay extends Challenge
|
||||||
|
{
|
||||||
|
private int _fishingRodSlot = 0;
|
||||||
|
|
||||||
|
private int _startingLureLevel = 8;
|
||||||
|
|
||||||
|
private HashMap<Player, Boolean> _fishing = new HashMap<Player, Boolean>();
|
||||||
|
|
||||||
|
private HashMap<TNTPrimed, Player> _explosives = new HashMap<TNTPrimed, Player>();
|
||||||
|
|
||||||
|
public ChallengeFishingDay(MineWare host)
|
||||||
|
{
|
||||||
|
super(host, ChallengeType.FirstComplete, "Fishing Day", "Be the first to catch 5 fish.", "Watch out for TNT if you miss the fish!");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ArrayList<Location> getSpawns()
|
||||||
|
{
|
||||||
|
int size = getArenaSize();
|
||||||
|
ArrayList<Location> spawns = new ArrayList<Location>();
|
||||||
|
|
||||||
|
for(int x = -(size); x <= size; x++)
|
||||||
|
{
|
||||||
|
for(int z = -(size); z <= size; z++)
|
||||||
|
{
|
||||||
|
double absX = Math.abs(x);
|
||||||
|
double absZ = Math.abs(z);
|
||||||
|
int platform = size - 2;
|
||||||
|
|
||||||
|
if((absX == platform || absZ == platform) && !(absX > platform || absZ > platform))
|
||||||
|
{
|
||||||
|
spawns.add(getCenter().clone().add(x + 0.5, 6.1, z + 0.5));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return spawns;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void generateRoom()
|
||||||
|
{
|
||||||
|
int size = getArenaSize();
|
||||||
|
|
||||||
|
for(int x = -size; x <= size; x++)
|
||||||
|
{
|
||||||
|
for(int z = -size; z <= size; z++)
|
||||||
|
{
|
||||||
|
for(int y = 0; y < 8; y++)
|
||||||
|
{
|
||||||
|
Block block = getCenter().getBlock().getRelative(x, y, z);
|
||||||
|
|
||||||
|
double absX = Math.abs(x);
|
||||||
|
double absZ = Math.abs(z);
|
||||||
|
|
||||||
|
// Bottom Layer
|
||||||
|
|
||||||
|
if(y == 0)
|
||||||
|
{
|
||||||
|
block.setType(Material.BEDROCK);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ground Layer
|
||||||
|
|
||||||
|
else if(y == 1)
|
||||||
|
{
|
||||||
|
block.setType(Material.SAND);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(y < 6)
|
||||||
|
{
|
||||||
|
// Fishing Platform
|
||||||
|
|
||||||
|
if((absX >= size - 3 && absX <= size) || (absZ >= size - 3 && absZ <= size))
|
||||||
|
{
|
||||||
|
double chance = Math.random() * 100;
|
||||||
|
|
||||||
|
if(chance < 25)
|
||||||
|
{
|
||||||
|
block.setType(Material.GRAVEL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(y == 5)
|
||||||
|
{
|
||||||
|
block.setType(Material.GRASS);
|
||||||
|
|
||||||
|
if(chance > 25 && chance < 30)
|
||||||
|
{
|
||||||
|
Block above = block.getRelative(BlockFace.UP);
|
||||||
|
above.setType(Material.LONG_GRASS);
|
||||||
|
above.setData((byte) 1);
|
||||||
|
addBlock(block);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
block.setType(Material.DIRT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Water Container
|
||||||
|
|
||||||
|
else if(absX <= size - 4 || absZ <= size - 4)
|
||||||
|
{
|
||||||
|
block.setType(Material.WATER);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Border Walls
|
||||||
|
|
||||||
|
else if(y > 4 && (absX == size || absZ == size))
|
||||||
|
{
|
||||||
|
block.setType(Material.FENCE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
addBlock(block);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setupPlayers()
|
||||||
|
{
|
||||||
|
Host.DamageEvP = false;
|
||||||
|
Host.ItemPickup = true;
|
||||||
|
|
||||||
|
ItemBuilder item = new ItemBuilder(Material.FISHING_ROD);
|
||||||
|
item.addEnchantment(Enchantment.LURE, _startingLureLevel);
|
||||||
|
item.setUnbreakable(true);
|
||||||
|
|
||||||
|
ItemStack itemStack = item.build();
|
||||||
|
ItemMeta meta = itemStack.getItemMeta();
|
||||||
|
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
||||||
|
itemStack.setItemMeta(meta);
|
||||||
|
|
||||||
|
for(Player player : Host.GetPlayers(true))
|
||||||
|
{
|
||||||
|
if(isDone(player))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
player.getInventory().setItem(_fishingRodSlot, itemStack);
|
||||||
|
player.getInventory().setHeldItemSlot(_fishingRodSlot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cleanupRoom()
|
||||||
|
{
|
||||||
|
Host.DamageEvP = false;
|
||||||
|
Host.ItemPickup = false;
|
||||||
|
Host.InventoryClick = false;
|
||||||
|
|
||||||
|
for(Entity entity : Host.WorldData.World.getEntities())
|
||||||
|
{
|
||||||
|
if(entity instanceof TNTPrimed)
|
||||||
|
{
|
||||||
|
entity.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_fishing.clear();
|
||||||
|
_explosives.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerFish(PlayerFishEvent event)
|
||||||
|
{
|
||||||
|
Player fisher = event.getPlayer();
|
||||||
|
|
||||||
|
if(isDone(fisher) || !Host.IsLive() || !Host.isChallengeStarted())
|
||||||
|
return;
|
||||||
|
|
||||||
|
Fish hook = event.getHook();
|
||||||
|
|
||||||
|
if(!_fishing.containsKey(fisher))
|
||||||
|
{
|
||||||
|
_fishing.put(fisher, false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(!_fishing.get(fisher))
|
||||||
|
{
|
||||||
|
_fishing.put(fisher, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(event.getCaught() != null)
|
||||||
|
{
|
||||||
|
Entity entity = event.getCaught();
|
||||||
|
|
||||||
|
ItemStack item = new ItemStack(Material.RAW_FISH, 1, (byte) UtilMath.r(3));
|
||||||
|
fisher.getInventory().addItem(item);
|
||||||
|
|
||||||
|
UtilTextBottom.display("You caught a " + C.cGreen + getFishType(item.getData().getData()) + C.cWhite + "!", fisher);
|
||||||
|
fisher.playSound(fisher.getLocation(), Sound.ORB_PICKUP, 1.0F, 1.0F);
|
||||||
|
|
||||||
|
waterSplashEffect(fisher.getLocation().add(0, 0.5, 0), true, true);
|
||||||
|
|
||||||
|
event.setExpToDrop(0);
|
||||||
|
entity.remove();
|
||||||
|
|
||||||
|
_fishing.put(fisher, false);
|
||||||
|
|
||||||
|
checkForWinner(fisher);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(isFishingHookEmpty(fisher, hook))
|
||||||
|
{
|
||||||
|
createExplosion(fisher, hook.getLocation());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onEntityDamageByEntity(EntityDamageByEntityEvent event)
|
||||||
|
{
|
||||||
|
if(!Host.IsLive() || !Host.isChallengeStarted())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(event.getEntity() instanceof Player && event.getDamager() instanceof FishHook)
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onItemHeld(PlayerItemHeldEvent event)
|
||||||
|
{
|
||||||
|
if(!Host.IsLive() || !Host.isChallengeStarted())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(!isDone(event.getPlayer()))
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerMove(PlayerMoveEvent event)
|
||||||
|
{
|
||||||
|
if(!Host.IsLive() || !Host.isChallengeStarted())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(!isDone(event.getPlayer()))
|
||||||
|
{
|
||||||
|
if(Math.random() * 100 < 20)
|
||||||
|
{
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
Location from = event.getFrom();
|
||||||
|
Location to = event.getTo();
|
||||||
|
|
||||||
|
double fromX = from.getX();
|
||||||
|
double fromZ = from.getZ();
|
||||||
|
double toX = to.getX();
|
||||||
|
double toZ = to.getZ();
|
||||||
|
|
||||||
|
if(fromX != toX || fromZ != toZ)
|
||||||
|
{
|
||||||
|
waterSplashEffect(player.getLocation().add(0, 0.1, 0), false, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onEntityExplode(EntityExplodeEvent event)
|
||||||
|
{
|
||||||
|
if(!Host.IsLive() || !Host.isChallengeStarted())
|
||||||
|
return;
|
||||||
|
|
||||||
|
Location dropsite = event.getLocation();
|
||||||
|
World world = dropsite.getWorld();
|
||||||
|
|
||||||
|
world.playSound(dropsite, Sound.ZOMBIE_WOODBREAK, 0.5F, 1.0F);
|
||||||
|
world.playSound(dropsite, Sound.EXPLODE, 1.0F, 1.0F);
|
||||||
|
UtilParticle.PlayParticle(ParticleType.CLOUD, dropsite, 0.6F, 0.6F, 0.6F, 0.0F, 50, ViewDist.NORMAL, UtilServer.getPlayers());
|
||||||
|
UtilParticle.PlayParticle(ParticleType.SMOKE, dropsite, 0.3F, 0.3F, 0.3F, 0.5F, 50, ViewDist.NORMAL, UtilServer.getPlayers());
|
||||||
|
|
||||||
|
Player target = _explosives.get(event.getEntity());
|
||||||
|
|
||||||
|
if(UtilMath.offset(dropsite, target.getLocation()) <= 6.0)
|
||||||
|
{
|
||||||
|
setLost(target);
|
||||||
|
}
|
||||||
|
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getFishType(byte data)
|
||||||
|
{
|
||||||
|
if(data == 1)
|
||||||
|
{
|
||||||
|
return "Salmon";
|
||||||
|
}
|
||||||
|
else if(data == 2)
|
||||||
|
{
|
||||||
|
return "Clownfish";
|
||||||
|
}
|
||||||
|
else if(data == 3)
|
||||||
|
{
|
||||||
|
return "Pufferfish";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return "Fish";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkForWinner(Player fisher)
|
||||||
|
{
|
||||||
|
ArrayList<ItemStack> contents = UtilInv.getItems(fisher);
|
||||||
|
int caughtFish = 0;
|
||||||
|
|
||||||
|
for(ItemStack item : contents)
|
||||||
|
{
|
||||||
|
if(item.getType() == Material.RAW_FISH)
|
||||||
|
{
|
||||||
|
caughtFish = caughtFish + item.getAmount();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(caughtFish == 5)
|
||||||
|
{
|
||||||
|
SetCompleted(fisher);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isFishingHookEmpty(Player fisher, Fish hook)
|
||||||
|
{
|
||||||
|
// Check if the player is retracting the hook.
|
||||||
|
// Once hook is retracted, the entity is valid but not on ground.
|
||||||
|
|
||||||
|
return _fishing.get(fisher) && hook.isValid() && !hook.isOnGround();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createExplosion(Player target, Location dropsite)
|
||||||
|
{
|
||||||
|
if (Recharge.Instance.use(target, "TNT Spawn", 700, false, false))
|
||||||
|
{
|
||||||
|
World world = dropsite.getWorld();
|
||||||
|
|
||||||
|
target.playSound(dropsite, Sound.ZOMBIE_WOODBREAK, 0.3F, 1.3F);
|
||||||
|
|
||||||
|
TNTPrimed explosive = world.spawn(dropsite, TNTPrimed.class);
|
||||||
|
explosive.setFuseTicks(40);
|
||||||
|
explosive.setYield(0.0F);
|
||||||
|
|
||||||
|
UtilAction.velocity(explosive, UtilAlg.getTrajectory(dropsite, target.getLocation()), 1.2D, false, 0.0D, 0.3D, 0.6D, false);
|
||||||
|
|
||||||
|
_explosives.put(explosive, target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void waterSplashEffect(Location location, boolean randomAmount, boolean sound)
|
||||||
|
{
|
||||||
|
int amount = 5;
|
||||||
|
|
||||||
|
if(randomAmount)
|
||||||
|
amount += UtilMath.r(10);
|
||||||
|
|
||||||
|
UtilParticle.PlayParticle(ParticleType.WATER_WAKE, location, 0.2F, 0.1F, 0.2F, 0.0F, amount, ViewDist.NORMAL, UtilServer.getPlayers());
|
||||||
|
|
||||||
|
if(sound)
|
||||||
|
location.getWorld().playSound(location, Sound.WATER, 0.3F, 1.0F);
|
||||||
|
}
|
||||||
|
}
|
@ -32,7 +32,7 @@ public class ChallengeKOTL extends Challenge
|
|||||||
|
|
||||||
public ChallengeKOTL(MineWare host)
|
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
|
@Override
|
||||||
@ -177,8 +177,7 @@ public class ChallengeKOTL extends Challenge
|
|||||||
}
|
}
|
||||||
if(UtilAlg.inBoundingBox(player.getLocation(), _winCornerA, _winCornerB))
|
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.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import mineplex.core.common.util.UtilAction;
|
import mineplex.core.common.util.UtilAction;
|
||||||
import mineplex.core.common.util.UtilMath;
|
import mineplex.core.common.util.UtilMath;
|
||||||
@ -22,17 +20,16 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
|
|
||||||
import com.sun.org.apache.bcel.internal.generic.RETURN;
|
|
||||||
|
|
||||||
public class ChallengeKangarooJump extends Challenge
|
public class ChallengeKangarooJump extends Challenge
|
||||||
{
|
{
|
||||||
private long _gameTime = System.currentTimeMillis() + ((UtilMath.r(5) + 20) * 1000);
|
private long _gameTime = System.currentTimeMillis() + ((UtilMath.r(5) + 20) * 1000);
|
||||||
|
|
||||||
private HashMap<String, Boolean> _players = new HashMap<String, Boolean>();
|
private HashMap<String, Boolean> _players = new HashMap<String, Boolean>();
|
||||||
|
private HashMap<Player, Integer> _playerJumpHeight = new HashMap<Player, Integer>();
|
||||||
|
|
||||||
public ChallengeKangarooJump(MineWare host)
|
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
|
@Override
|
||||||
@ -65,6 +62,7 @@ public class ChallengeKangarooJump extends Challenge
|
|||||||
for(Player player : Host.GetPlayers(true))
|
for(Player player : Host.GetPlayers(true))
|
||||||
{
|
{
|
||||||
_players.put(player.getName(), true);
|
_players.put(player.getName(), true);
|
||||||
|
_playerJumpHeight.put(player, 0);
|
||||||
}
|
}
|
||||||
Host.StrictAntiHack = false;
|
Host.StrictAntiHack = false;
|
||||||
}
|
}
|
||||||
@ -126,7 +124,7 @@ public class ChallengeKangarooJump extends Challenge
|
|||||||
}
|
}
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if(_players.get(player.getName()) == false)
|
if(_players.get(player.getName()) == false) // TODO fix
|
||||||
{
|
{
|
||||||
if(player.isOnGround())
|
if(player.isOnGround())
|
||||||
{
|
{
|
||||||
@ -138,6 +136,41 @@ public class ChallengeKangarooJump extends Challenge
|
|||||||
_players.put(player.getName(), false);
|
_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
|
@EventHandler
|
||||||
public void gameEndChecker(UpdateEvent event)
|
public void gameEndChecker(UpdateEvent event)
|
||||||
{
|
{
|
||||||
@ -161,12 +194,12 @@ public class ChallengeKangarooJump extends Challenge
|
|||||||
}
|
}
|
||||||
ArrayList<String> sortedList = sortHash(playerHeights);
|
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));
|
System.out.println(sortedList.get(i));
|
||||||
if(!isDone(Bukkit.getPlayer(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)));
|
SetCompleted(Bukkit.getPlayer(sortedList.get(i)));
|
||||||
}
|
}
|
||||||
@ -194,4 +227,9 @@ public class ChallengeKangarooJump extends Challenge
|
|||||||
});
|
});
|
||||||
return players;
|
return players;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public HashMap<Player, Integer> getPlayerHeight()
|
||||||
|
{
|
||||||
|
return _playerJumpHeight;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.UtilMath;
|
import mineplex.core.common.util.UtilMath;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.disguise.disguises.DisguiseVillager;
|
import mineplex.core.disguise.disguises.DisguiseVillager;
|
||||||
@ -31,11 +32,11 @@ public class ChallengeMilkACow extends Challenge
|
|||||||
{
|
{
|
||||||
private Villager _villager;
|
private Villager _villager;
|
||||||
private HashMap<Entity, ArrayList<String>> _milked = new HashMap<Entity, ArrayList<String>>();
|
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)
|
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
|
@Override
|
||||||
@ -79,7 +80,7 @@ public class ChallengeMilkACow extends Challenge
|
|||||||
disguise.setBaby();
|
disguise.setBaby();
|
||||||
Host.getArcadeManager().GetDisguise().disguise(disguise);
|
Host.getArcadeManager().GetDisguise().disguise(disguise);
|
||||||
player.getInventory().setItem(0, new ItemStack(Material.BUCKET));
|
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.setItemInHand(new ItemStack(Material.BUCKET));
|
||||||
p.playSound(p.getLocation(), Sound.ORB_PICKUP, 2, 0);
|
p.playSound(p.getLocation(), Sound.ORB_PICKUP, 2, 0);
|
||||||
int score = _score.get(p.getName()) + 1;
|
int score = _score.get(p) + 1;
|
||||||
_score.put(p.getName(), score);
|
_score.put(p, score);
|
||||||
|
|
||||||
displayCount(p, ((Villager) ent).getEyeLocation().add(0, 0.3, 0), (score >= 5 ? C.cDGreen : score >= 3 ? C.cGreen
|
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);
|
: score >= 2 ? C.cRed : C.cDRed) + score);
|
||||||
@ -225,6 +226,7 @@ public class ChallengeMilkACow extends Challenge
|
|||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
event.getPlayer().updateInventory();
|
event.getPlayer().updateInventory();
|
||||||
|
event.getPlayer().sendMessage(F.main("Mike the Cows", "Deliver the milk to the farmer!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -245,4 +247,9 @@ public class ChallengeMilkACow extends Challenge
|
|||||||
|
|
||||||
return spawns;
|
return spawns;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public HashMap<Player, Integer> getScore()
|
||||||
|
{
|
||||||
|
return _score;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,8 @@ public class ChallengeMineADiamond extends Challenge
|
|||||||
{
|
{
|
||||||
for(int i = 0; i < Math.ceil((Host.GetPlayers(true).size() + 1) / 2); i++)
|
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()));
|
Block copy = getCenter().getBlock().getRelative(UtilMath.r(getArenaSize() * 2) - (getArenaSize()), 1,
|
||||||
|
UtilMath.r(getArenaSize() * 2) - (getArenaSize()));
|
||||||
if(copy.getType() == Material.DIAMOND_ORE)
|
if(copy.getType() == Material.DIAMOND_ORE)
|
||||||
{
|
{
|
||||||
i--;
|
i--;
|
||||||
@ -140,4 +141,17 @@ public class ChallengeMineADiamond extends Challenge
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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;
|
package nautilus.game.arcade.game.games.mineware.challenges;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import nautilus.game.arcade.game.games.mineware.Challenge;
|
import nautilus.game.arcade.game.games.mineware.Challenge;
|
||||||
@ -10,12 +11,14 @@ import org.bukkit.Location;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
|
|
||||||
public class ChallengeNavigateMaze extends Challenge
|
public class ChallengeNavigateMaze extends Challenge
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private HashMap<Player, Long> _playerCompletionTime = new HashMap<Player, Long>();
|
||||||
public ChallengeNavigateMaze(MineWare host)
|
public ChallengeNavigateMaze(MineWare host)
|
||||||
{
|
{
|
||||||
super(host, ChallengeType.FirstComplete, "Nagivation maze", "Go to the other side of the maze");
|
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)
|
public void onMove(PlayerMoveEvent event)
|
||||||
{
|
{
|
||||||
if (UtilPlayer.isSpectator(event.getPlayer()))
|
if (UtilPlayer.isSpectator(event.getPlayer()))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
if(isDone(event.getPlayer()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (event.getTo().getY() >= 1 && event.getTo().getX() > 16)
|
if (event.getTo().getY() >= 1 && event.getTo().getX() > 16)
|
||||||
{
|
{
|
||||||
SetCompleted(event.getPlayer());
|
SetCompleted(event.getPlayer());
|
||||||
|
_playerCompletionTime.put(event.getPlayer(), System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,4 +253,9 @@ public class ChallengeNavigateMaze extends Challenge
|
|||||||
|
|
||||||
return blocks;
|
return blocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public HashMap<Player, Long> getPlayerTimes()
|
||||||
|
{
|
||||||
|
return _playerCompletionTime;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ public class ChallengePickASide extends Challenge
|
|||||||
|
|
||||||
public ChallengePickASide(MineWare host)
|
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()
|
public int getMinPlayers()
|
||||||
|
@ -156,6 +156,10 @@ public class ChallengeRedLightGreenLight extends Challenge
|
|||||||
}
|
}
|
||||||
if(!_canMove && !_cooldownedPlayers.contains(event.getPlayer().getName()) && _timeBeforeAction < System.currentTimeMillis())
|
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);
|
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());
|
_cooldownedPlayers.add(event.getPlayer().getName());
|
||||||
|
|
||||||
@ -167,7 +171,7 @@ public class ChallengeRedLightGreenLight extends Challenge
|
|||||||
{
|
{
|
||||||
_cooldownedPlayers.remove(event.getPlayer().getName());
|
_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.PlayerInteractEntityEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
public class ChallengeReverseTag extends Challenge
|
public class ChallengeReverseTag extends Challenge
|
||||||
{
|
{
|
||||||
|
private int _cooldown = 2; // in seconds
|
||||||
private double _endTime;
|
private double _endTime;
|
||||||
private double _startTime;
|
private double _startTime;
|
||||||
private HashSet<String> _tagged = new HashSet<String>();
|
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)
|
public ChallengeReverseTag(MineWare Host)
|
||||||
{
|
{
|
||||||
@ -78,6 +82,7 @@ public class ChallengeReverseTag extends Challenge
|
|||||||
|
|
||||||
for(Player player : players)
|
for(Player player : players)
|
||||||
{
|
{
|
||||||
|
_nonTaggedPlayers.add(player);
|
||||||
if(looped % 2 == 0)
|
if(looped % 2 == 0)
|
||||||
{
|
{
|
||||||
addTagged(player);
|
addTagged(player);
|
||||||
@ -166,6 +171,11 @@ public class ChallengeReverseTag extends Challenge
|
|||||||
event.SetCancelled("Damaged a nontagged person");
|
event.SetCancelled("Damaged a nontagged person");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(_cooldowned.contains(event.GetDamageePlayer().getName()))
|
||||||
|
{
|
||||||
|
event.SetCancelled("Damaged is on cooldown");
|
||||||
|
return;
|
||||||
|
}
|
||||||
removeTagged(event.GetDamageePlayer());
|
removeTagged(event.GetDamageePlayer());
|
||||||
addTagged(event.GetDamagerPlayer(false));
|
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()))
|
if(_tagged.contains(player.getName()))
|
||||||
{
|
{
|
||||||
UtilPlayer.message(player, C.cYellow + C.Bold + "You are " + C.cRed + "NO LONGER" + C.cYellow + " tagged!");
|
UtilPlayer.message(player, C.cYellow + C.Bold + "You are " + C.cRed + "NO LONGER" + C.cYellow + " tagged!");
|
||||||
player.getInventory().setHelmet(new ItemStack(Material.AIR));
|
player.getInventory().setHelmet(new ItemStack(Material.AIR));
|
||||||
_tagged.remove(player.getName());
|
_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++)
|
for(int i = 0; i <= 8; i++)
|
||||||
{
|
{
|
||||||
@ -245,4 +271,8 @@ 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.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.entity.Arrow;
|
||||||
import org.bukkit.entity.Chicken;
|
import org.bukkit.entity.Chicken;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
@ -34,6 +35,8 @@ public class ChallengeShootChickens extends Challenge
|
|||||||
private HashMap<String, Integer> _killedChickens = new HashMap<String, Integer>();
|
private HashMap<String, Integer> _killedChickens = new HashMap<String, Integer>();
|
||||||
private ArrayList<Projectile> _arrows = new ArrayList<Projectile>();
|
private ArrayList<Projectile> _arrows = new ArrayList<Projectile>();
|
||||||
|
|
||||||
|
private HashMap<Player, Integer> _arrowsShot = new HashMap<Player, Integer>();
|
||||||
|
|
||||||
public ChallengeShootChickens(MineWare host)
|
public ChallengeShootChickens(MineWare host)
|
||||||
{
|
{
|
||||||
super(host, ChallengeType.FirstComplete, "Chicken Shooting", "Shoot 6 chickens");
|
super(host, ChallengeType.FirstComplete, "Chicken Shooting", "Shoot 6 chickens");
|
||||||
@ -57,8 +60,19 @@ public class ChallengeShootChickens extends Challenge
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onShoot(ProjectileLaunchEvent event)
|
public void onShoot(ProjectileLaunchEvent event)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(event.getEntity() instanceof Arrow)
|
||||||
{
|
{
|
||||||
_arrows.add(event.getEntity());
|
_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
|
@EventHandler
|
||||||
@ -157,11 +171,11 @@ public class ChallengeShootChickens extends Challenge
|
|||||||
|
|
||||||
for (Player player : Host.GetPlayers(true))
|
for (Player player : Host.GetPlayers(true))
|
||||||
{
|
{
|
||||||
player.getInventory().setItem(0,
|
player.getInventory().setItem(0,new ItemBuilder(Material.BOW).addEnchantment(Enchantment.ARROW_INFINITE, 1).setUnbreakable(true).build());
|
||||||
new ItemBuilder(Material.BOW).addEnchantment(Enchantment.ARROW_INFINITE, 1).setUnbreakable(true).build());
|
|
||||||
player.getInventory().setItem(9, new ItemStack(Material.ARROW));
|
player.getInventory().setItem(9, new ItemStack(Material.ARROW));
|
||||||
|
|
||||||
_killedChickens.put(player.getName(), 0);
|
_killedChickens.put(player.getName(), 0);
|
||||||
|
_arrowsShot.put(player, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Host.DamagePvE = true;
|
Host.DamagePvE = true;
|
||||||
@ -229,4 +243,9 @@ public class ChallengeShootChickens extends Challenge
|
|||||||
|
|
||||||
return spawns;
|
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 mineplex.core.updater.event.UpdateEvent;
|
||||||
import nautilus.game.arcade.game.games.mineware.Challenge;
|
import nautilus.game.arcade.game.games.mineware.Challenge;
|
||||||
import nautilus.game.arcade.game.games.mineware.MineWare;
|
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.Bukkit;
|
||||||
import org.bukkit.Color;
|
import org.bukkit.Color;
|
||||||
@ -306,7 +306,7 @@ public class ChallengeSimonSays extends Challenge
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onChallengeEnd(challengeEndEvent event)
|
public void onChallengeEnd(ChallengeEndEvent event)
|
||||||
{
|
{
|
||||||
if(!(event.getEndedChallenge() instanceof ChallengeSimonSays))
|
if(!(event.getEndedChallenge() instanceof ChallengeSimonSays))
|
||||||
{
|
{
|
||||||
|
@ -243,7 +243,7 @@ public class ChallengeTreasureDigger extends Challenge
|
|||||||
Player damager = (Player) event.getDamager();
|
Player damager = (Player) event.getDamager();
|
||||||
ItemStack item = damager.getItemInHand();
|
ItemStack item = damager.getItemInHand();
|
||||||
|
|
||||||
if(!Host.IsAlive(damager))
|
if(isDone(damager))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(item != null)
|
if(item != null)
|
||||||
|
@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.mineware.challenges;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.ListIterator;
|
import java.util.ListIterator;
|
||||||
|
|
||||||
import mineplex.core.common.util.UtilMath;
|
import mineplex.core.common.util.UtilMath;
|
||||||
@ -11,7 +12,7 @@ import mineplex.core.updater.UpdateType;
|
|||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import nautilus.game.arcade.game.games.mineware.Challenge;
|
import nautilus.game.arcade.game.games.mineware.Challenge;
|
||||||
import nautilus.game.arcade.game.games.mineware.MineWare;
|
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.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -33,6 +34,8 @@ public class ChallengeWaveCrush extends Challenge
|
|||||||
private int _waveSpeed = 30; // in ticks
|
private int _waveSpeed = 30; // in ticks
|
||||||
private ArrayList<Integer> _colorList = new ArrayList<Integer>(Arrays.asList(14, 11, 9, 3, 1, 4, 13, 5));
|
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)
|
public ChallengeWaveCrush(MineWare host)
|
||||||
{
|
{
|
||||||
super(host, ChallengeType.LastStanding, "Wave Crush", "Avoid the crushing waves!");
|
super(host, ChallengeType.LastStanding, "Wave Crush", "Avoid the crushing waves!");
|
||||||
@ -85,6 +88,11 @@ public class ChallengeWaveCrush extends Challenge
|
|||||||
@Override
|
@Override
|
||||||
public void setupPlayers()
|
public void setupPlayers()
|
||||||
{
|
{
|
||||||
|
for(Player player: Host.GetPlayers(true))
|
||||||
|
{
|
||||||
|
_survivedWaves.put(player, 0);
|
||||||
|
}
|
||||||
|
|
||||||
_inProgress = true;
|
_inProgress = true;
|
||||||
|
|
||||||
new BukkitRunnable()
|
new BukkitRunnable()
|
||||||
@ -112,6 +120,14 @@ public class ChallengeWaveCrush extends Challenge
|
|||||||
{
|
{
|
||||||
_waveSpeed--;
|
_waveSpeed--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(Player player: _survivedWaves.keySet())
|
||||||
|
{
|
||||||
|
if(!isDone(player))
|
||||||
|
{
|
||||||
|
_survivedWaves.put(player, _survivedWaves.get(player)+1);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}.runTaskTimer(Host.Manager.getPlugin(), 20 * 3, _waveSpeed);
|
}.runTaskTimer(Host.Manager.getPlugin(), 20 * 3, _waveSpeed);
|
||||||
}
|
}
|
||||||
@ -194,7 +210,7 @@ public class ChallengeWaveCrush extends Challenge
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void OnChallengeEnd(challengeEndEvent event)
|
public void OnChallengeEnd(ChallengeEndEvent event)
|
||||||
{
|
{
|
||||||
for(Player player : Host.GetPlayers(true))
|
for(Player player : Host.GetPlayers(true))
|
||||||
{
|
{
|
||||||
@ -248,4 +264,9 @@ public class ChallengeWaveCrush extends Challenge
|
|||||||
}
|
}
|
||||||
}.runTaskTimer(Host.Manager.getPlugin(), 0, 2);
|
}.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,12 +6,12 @@ import nautilus.game.arcade.game.games.mineware.Challenge;
|
|||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
public class challengeEndEvent extends Event
|
public class ChallengeEndEvent extends Event
|
||||||
{
|
{
|
||||||
private Challenge _endedChallenge;
|
private Challenge _endedChallenge;
|
||||||
private static final HandlerList _handlers = new HandlerList();
|
private static final HandlerList _handlers = new HandlerList();
|
||||||
|
|
||||||
public challengeEndEvent(Challenge challenge)
|
public ChallengeEndEvent(Challenge challenge)
|
||||||
{
|
{
|
||||||
this._endedChallenge = challenge;
|
this._endedChallenge = challenge;
|
||||||
}
|
}
|
||||||
|
@ -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