Add first work in progress version of Fishing Day challenge.
This commit is contained in:
parent
80c95f1995
commit
473f0ebcc7
@ -14,10 +14,10 @@ import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.giveaway.GiveawayManager;
|
||||
import mineplex.core.globalpacket.command.GlobalPacketCommand;
|
||||
import mineplex.core.globalpacket.listeners.GlobalGiveCoins;
|
||||
import mineplex.core.globalpacket.listeners.GlobalGiveGems;
|
||||
import mineplex.core.globalpacket.listeners.GlobalGiveItem;
|
||||
import mineplex.core.globalpacket.listeners.GlobalRawr;
|
||||
// import mineplex.core.globalpacket.listeners.GlobalGiveCoins;
|
||||
// import mineplex.core.globalpacket.listeners.GlobalGiveGems;
|
||||
// import mineplex.core.globalpacket.listeners.GlobalGiveItem;
|
||||
// import mineplex.core.globalpacket.listeners.GlobalRawr;
|
||||
import mineplex.core.globalpacket.redis.GlobalPacketHandler;
|
||||
import mineplex.core.globalpacket.redis.GlobalPacketMessage;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
@ -53,10 +53,10 @@ public class GlobalPacketManager extends MiniPlugin
|
||||
|
||||
ServerCommandManager.getInstance().registerCommandType("GlobalPacketMessage", GlobalPacketMessage.class, new GlobalPacketHandler(statusManager));
|
||||
|
||||
getPluginManager().registerEvents(new GlobalGiveItem(inventoryManager, _rewardManager), getPlugin());
|
||||
getPluginManager().registerEvents(new GlobalGiveGems(donationManager), getPlugin());
|
||||
getPluginManager().registerEvents(new GlobalGiveCoins(donationManager, clientManager), getPlugin());
|
||||
getPluginManager().registerEvents(new GlobalRawr(), getPlugin());
|
||||
// getPluginManager().registerEvents(new GlobalGiveItem(inventoryManager, _rewardManager), getPlugin());
|
||||
// getPluginManager().registerEvents(new GlobalGiveGems(donationManager), getPlugin());
|
||||
// getPluginManager().registerEvents(new GlobalGiveCoins(donationManager, clientManager), getPlugin());
|
||||
// getPluginManager().registerEvents(new GlobalRawr(), getPlugin());
|
||||
}
|
||||
|
||||
public void callGlobalCommand(Player caller, String[] args)
|
||||
|
@ -32,6 +32,7 @@ import nautilus.game.arcade.game.games.mineware.challenges.ChallengeAnvilDance;
|
||||
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeBuildRace;
|
||||
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.ChallengeFishingDay;
|
||||
import nautilus.game.arcade.game.games.mineware.challenges.ChallengeTreasureDigger;
|
||||
import nautilus.game.arcade.game.games.mineware.events.challengeEndEvent;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
@ -145,11 +146,12 @@ public class MineWare extends SoloGame implements IThrown
|
||||
|
||||
public void PopulateOrders()
|
||||
{
|
||||
_challenges.add(ChallengeTreasureDigger.class);
|
||||
_challenges.add(ChallengeFastFood.class);
|
||||
_challenges.add(ChallengeBuildRace.class);
|
||||
_challenges.add(ChallengeAnvilDance.class);
|
||||
_challenges.add(ChallengeFallingBlocks.class);
|
||||
_challenges.add(ChallengeFishingDay.class);
|
||||
// _challenges.add(ChallengeTreasureDigger.class);
|
||||
// _challenges.add(ChallengeFastFood.class);
|
||||
// _challenges.add(ChallengeBuildRace.class);
|
||||
// _challenges.add(ChallengeAnvilDance.class);
|
||||
// _challenges.add(ChallengeFallingBlocks.class);
|
||||
|
||||
// _challenges.add(ChallengeWaveCrush.class);
|
||||
// _challenges.add(ChallengePickASide.class);
|
||||
|
@ -0,0 +1,148 @@
|
||||
package nautilus.game.arcade.game.games.mineware.challenges;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilShapes;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
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.block.Block;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.FishHook;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.BlockPhysicsEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
|
||||
public class ChallengeFishingDay extends Challenge
|
||||
{
|
||||
private final int _spacing = 4;
|
||||
private ArrayList<Location> _spawns = new ArrayList<Location>();
|
||||
|
||||
public ChallengeFishingDay(MineWare host)
|
||||
{
|
||||
super(host, ChallengeType.FirstComplete, "Fishing Day", "Be the first to catch 5 fish.", "If you fail on any try, TNT will explode!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Location> getSpawns()
|
||||
{
|
||||
return _spawns;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateRoom()
|
||||
{
|
||||
for(int x = -getArenaSize(); x <= getArenaSize(); x++)
|
||||
{
|
||||
for(int z = -getArenaSize(); z <= getArenaSize(); z++)
|
||||
{
|
||||
for(int y = 0; y < 8; y++)
|
||||
{
|
||||
Block b = getCenter().getBlock().getRelative(x, y, z);
|
||||
if(y == 0)
|
||||
{
|
||||
b.setType(Material.BEDROCK);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(Math.abs(x) == getArenaSize() || Math.abs(z) == getArenaSize())
|
||||
{
|
||||
if(y == 7)
|
||||
{
|
||||
_spawns.add(getCenter().clone().add(x + 0.5, 7.1, z + 0.5));
|
||||
}
|
||||
b.setType(Material.STONE);
|
||||
}
|
||||
else if(y <= 6)
|
||||
{
|
||||
b.setType(Material.WATER);
|
||||
}
|
||||
}
|
||||
|
||||
if(y == 1)
|
||||
{
|
||||
int random = UtilMath.r(100);
|
||||
|
||||
if(random > 30)
|
||||
{
|
||||
b.setType(Material.SAND);
|
||||
}
|
||||
else if(random < 30 && random > 10)
|
||||
{
|
||||
b.setType(Material.GRAVEL);
|
||||
}
|
||||
else
|
||||
{
|
||||
b.setType(Material.CLAY);
|
||||
}
|
||||
}
|
||||
//
|
||||
// if(y == 5)
|
||||
// {
|
||||
// if(_spawns.size() < Host.GetPlayers(true).size())
|
||||
// {
|
||||
// if(x % _spacing == 0 && z % _spacing == 0)
|
||||
// {
|
||||
// for(Location platform : UtilShapes.getCircle(new Location(getCenter().getWorld(), x, 6.1, z), false, _spacing))
|
||||
// {
|
||||
// platform.getBlock().setType(Material.SANDSTONE);
|
||||
// addBlock(platform.getBlock());
|
||||
// }
|
||||
//
|
||||
// _spawns.add(getCenter().clone().add(x + 0.5, 6.1, z + 0.5));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
addBlock(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupPlayers()
|
||||
{
|
||||
ItemBuilder item = new ItemBuilder(Material.FISHING_ROD);
|
||||
item.addEnchantment(Enchantment.LURE, 1);
|
||||
|
||||
for(Player player : Host.GetPlayers(true))
|
||||
{
|
||||
player.getInventory().setItem(4, item.build());
|
||||
player.getInventory().setHeldItemSlot(4);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanupRoom()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPhysics(BlockPhysicsEvent event)
|
||||
{
|
||||
if(!Host.IsLive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(event.getBlock().getType() == Material.SAND)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEntityDamageByEntity(EntityDamageByEntityEvent event)
|
||||
{
|
||||
if(event.getEntity() instanceof Player && event.getDamager() instanceof FishHook)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user