Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
a20f41be09
@ -9,25 +9,15 @@ import org.bukkit.util.Vector;
|
||||
|
||||
public class UtilShapes
|
||||
{
|
||||
private final static BlockFace[] diagonalFaces =
|
||||
{
|
||||
BlockFace.SOUTH_WEST, BlockFace.NORTH_WEST, BlockFace.NORTH_EAST, BlockFace.SOUTH_EAST
|
||||
};
|
||||
|
||||
private final static BlockFace[] radial =
|
||||
{
|
||||
BlockFace.SOUTH, BlockFace.SOUTH_WEST, BlockFace.WEST, BlockFace.NORTH_WEST, BlockFace.NORTH,
|
||||
BlockFace.NORTH_EAST, BlockFace.EAST, BlockFace.SOUTH_EAST
|
||||
};
|
||||
|
||||
private final static BlockFace[] squareFaces =
|
||||
public static ArrayList<Location> getCircle(Location loc, double radius)
|
||||
{
|
||||
BlockFace.SOUTH, BlockFace.WEST, BlockFace.NORTH, BlockFace.EAST
|
||||
};
|
||||
|
||||
public static ArrayList<Location> getCircle(Location loc, double radius, boolean hollow)
|
||||
{
|
||||
return getCircleBlocks(loc, radius, 0, hollow, false);
|
||||
return getCircleBlocks(loc, radius, 0, true, false);
|
||||
}
|
||||
|
||||
public static ArrayList<Location> getSphereBlocks(Location loc, double radius, double height, boolean hollow)
|
||||
|
@ -98,7 +98,7 @@ public class UtilTime
|
||||
if (type == TimeUnit.DAYS) text = (num = UtilMath.trim(trim, time / 86400000d)) + " Day";
|
||||
else if (type == TimeUnit.HOURS) text = (num = UtilMath.trim(trim, time / 3600000d)) + " Hour";
|
||||
else if (type == TimeUnit.MINUTES) text = (num = UtilMath.trim(trim, time / 60000d)) + " Minute";
|
||||
else if (type == TimeUnit.SECONDS) text = (int) (num = (int) UtilMath.trim(0, time / 1000d)) + " Second";
|
||||
else if (type == TimeUnit.SECONDS) text = (num = UtilMath.trim(trim, time / 1000d)) + " Second";
|
||||
else text = (int) (num = (int) UtilMath.trim(0, time)) + " Millisecond";
|
||||
}
|
||||
|
||||
|
@ -60,6 +60,8 @@ public class CommandCenter implements Listener
|
||||
|
||||
if (command != null)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
|
||||
if (ClientManager.Get(event.getPlayer()).GetRank().Has(event.getPlayer(), command.GetRequiredRank(), command.GetSpecificRanks(), true))
|
||||
{
|
||||
if (!Recharge.Instance.use(event.getPlayer(), "Command", 500, false, false))
|
||||
@ -71,7 +73,6 @@ public class CommandCenter implements Listener
|
||||
command.SetAliasUsed(commandName.toLowerCase());
|
||||
command.Execute(event.getPlayer(), args);
|
||||
}
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,6 @@ package mineplex.core.message;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
@ -23,7 +22,6 @@ import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||
import mineplex.core.event.StackerEvent;
|
||||
import mineplex.core.friend.FriendManager;
|
||||
import mineplex.core.friend.data.FriendData;
|
||||
import mineplex.core.friend.data.FriendStatus;
|
||||
@ -193,7 +191,8 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
|
||||
|
||||
// My attempt at trying to mitigate some of the spam bots - Phinary
|
||||
// Triggers if they are whispering a new player
|
||||
if (!GetClientManager().Get(from).GetRank().Has(Rank.HELPER) && Get(from).LastTo != null && !Get(from).LastTo.equalsIgnoreCase(to.getName()))
|
||||
if (!GetClientManager().Get(from).GetRank().Has(Rank.HELPER) && Get(from).LastTo != null
|
||||
&& !Get(from).LastTo.equalsIgnoreCase(to.getName()))
|
||||
{
|
||||
long delta = System.currentTimeMillis() - Get(from).LastToTime;
|
||||
|
||||
@ -355,12 +354,10 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
|
||||
|
||||
String toRank = F.rank(_clientManager.Get(to).GetRank());
|
||||
|
||||
|
||||
// Message the sender
|
||||
RedisMessageCallback message = new RedisMessageCallback(globalMessage, true, to.getName(),
|
||||
|
||||
C.cPurple + "-> " + toRank + " " + to.getName() + " " + C.cPurple
|
||||
+ globalMessage.getMessage());
|
||||
C.cPurple + "-> " + toRank + " " + to.getName() + " " + C.cPurple + globalMessage.getMessage());
|
||||
|
||||
// Inform Admins
|
||||
for (Player staff : UtilServer.getPlayers())
|
||||
@ -392,7 +389,8 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
|
||||
return;
|
||||
}
|
||||
|
||||
String message = C.cGold + "§l" + globalMessage.getSender() + " > " + to.getName() + C.cYellow + " §l" + globalMessage.getMessage();
|
||||
String message = C.cGold + "§l" + globalMessage.getSender() + " > " + to.getName() + C.cYellow + " §l"
|
||||
+ globalMessage.getMessage();
|
||||
|
||||
// Message the receiver
|
||||
UtilPlayer.message(to, message);
|
||||
@ -456,7 +454,8 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
|
||||
}
|
||||
}
|
||||
|
||||
public void sendMessage(final Player sender, String target, String message, boolean isReply, final boolean adminMessage)
|
||||
public void sendMessage(final Player sender, final String target, final String message, final boolean isReply,
|
||||
final boolean adminMessage)
|
||||
{
|
||||
FriendData friends = _friendsManager.Get(sender);
|
||||
FriendStatus friend = null;
|
||||
@ -484,6 +483,33 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
|
||||
}
|
||||
}
|
||||
|
||||
final FriendStatus friendInfo = friend;
|
||||
|
||||
new BukkitRunnable()
|
||||
{
|
||||
final String newMessage = _chat.getFilteredMessage(sender, message);
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
new BukkitRunnable()
|
||||
{
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
sendMessage(sender, target, newMessage, adminMessage, isReply, friendInfo);
|
||||
}
|
||||
|
||||
}.runTask(getPlugin());
|
||||
}
|
||||
|
||||
}.runTaskAsynchronously(getPlugin());
|
||||
}
|
||||
|
||||
private void sendMessage(final Player sender, String target, String message, final boolean adminMessage, boolean isReply,
|
||||
FriendStatus friend)
|
||||
{
|
||||
// We now have the friend object, if its not null. We are sending the message to that player.
|
||||
|
||||
// Only notify player if friend is null and its not a reply
|
||||
|
@ -282,7 +282,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
+ "§r §2§lFAQ§r§0\n"
|
||||
+ "§m-------------------\n"
|
||||
+ "§r\n"
|
||||
+ "§lHow do I get §b§lUltra§0 §lor §5§lHero§0§l?\n"
|
||||
+ "§lHow do I get §bUltra§l, §5Hero§l, or §aLegend§l?\n"
|
||||
+ "\n"
|
||||
+ "§r§0You are able to purchase these ranks through our shop on our website at:\n"
|
||||
+ "\n"
|
||||
@ -312,9 +312,9 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
+ "§r §2§lFAQ§r§0\n"
|
||||
+ "§m-------------------\n"
|
||||
+ "§r\n"
|
||||
+ "§lHow do I apply for Helper?\n"
|
||||
+ "§lHow do I apply for Trainee?\n"
|
||||
+ "\n"
|
||||
+ "§rYou may only apply for Helper if you have §bUltra §0or §5Hero§0.\n"
|
||||
+ "§rYou may only apply for Helper if you have §bUltra§0, §5Hero§0, or §aLegend§0.\n"
|
||||
+ "Apply at:\n"
|
||||
+ "§omineplex.com/application\n");
|
||||
|
||||
|
@ -417,7 +417,7 @@ public class CombatManager extends MiniPlugin
|
||||
CombatDeathEvent deathEvent = new CombatDeathEvent(event, Get(event.getEntity().getName()), log);
|
||||
UtilServer.getServer().getPluginManager().callEvent(deathEvent);
|
||||
|
||||
|
||||
//XXX Death MSG
|
||||
if (deathEvent.GetBroadcastType() == DeathMessageType.Detailed || deathEvent.GetBroadcastType() == DeathMessageType.Absolute)
|
||||
{
|
||||
//Display Simple
|
||||
|
@ -1,5 +1,6 @@
|
||||
package mineplex.minecraft.game.core.condition;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
@ -128,9 +129,9 @@ public class Condition
|
||||
|
||||
//Add
|
||||
if (_ticks == -1)
|
||||
(new PotionEffect(type, 72000, _mult, _ambient)).apply(_ent);
|
||||
_ent.addPotionEffect(new PotionEffect(type, 72000, _mult, _ambient), true);
|
||||
else
|
||||
(new PotionEffect(type, _ticks, _mult, _ambient)).apply(_ent);
|
||||
_ent.addPotionEffect(new PotionEffect(type, _ticks, _mult, _ambient), true);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -141,10 +142,39 @@ public class Condition
|
||||
public void Remove()
|
||||
{
|
||||
try
|
||||
{
|
||||
// TODO Remove once we update to 1.8, this fix fixes crashes for potioneffect's when acting on a potioneffect damage
|
||||
// event.
|
||||
boolean potionEffectCrash = false;
|
||||
StackTraceElement[] stackTraces = Thread.currentThread().getStackTrace();
|
||||
|
||||
for (StackTraceElement trace : stackTraces)
|
||||
{
|
||||
if (trace.getClassName().equals("net.minecraft.server.v1_7_R4.EntityLiving")
|
||||
&& trace.getMethodName().equals("aO"))
|
||||
{
|
||||
potionEffectCrash = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (potionEffectCrash)
|
||||
{
|
||||
Bukkit.getScheduler().runTaskLater(Manager.getPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
PotionEffectType type = PotionEffectType.getByName(_type.toString());
|
||||
_ent.removePotionEffect(type);
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
PotionEffectType type = PotionEffectType.getByName(_type.toString());
|
||||
_ent.removePotionEffect(type);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
|
@ -42,7 +42,6 @@ import mineplex.core.blockrestore.BlockRestore;
|
||||
import mineplex.core.blood.Blood;
|
||||
import mineplex.core.chat.Chat;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.jsonchat.ChildJsonMessage;
|
||||
import mineplex.core.common.jsonchat.ClickEvent;
|
||||
import mineplex.core.common.jsonchat.JsonMessage;
|
||||
import mineplex.core.common.util.C;
|
||||
@ -84,7 +83,6 @@ import mineplex.core.status.ServerStatusManager;
|
||||
import mineplex.core.task.TaskManager;
|
||||
import mineplex.core.teleport.Teleport;
|
||||
import mineplex.core.timing.TimingManager;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.classcombat.Class.ClassManager;
|
||||
import mineplex.minecraft.game.classcombat.Condition.SkillConditionManager;
|
||||
@ -161,7 +159,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
private EloManager _eloManager;
|
||||
|
||||
// Managers
|
||||
private GameFactory _gameFactory;
|
||||
private GameCreationManager _gameCreationManager;
|
||||
private GameGemManager _gameGemManager;
|
||||
private GameManager _gameManager;
|
||||
@ -222,8 +219,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
_explosionManager.SetDebris(false);
|
||||
|
||||
if (serverConfig.GameList.contains(GameType.ChampionsDominate)
|
||||
|| serverConfig.GameList.contains(GameType.ChampionsTDM)
|
||||
|| serverConfig.GameList.contains(GameType.ChampionsMOBA))
|
||||
|| serverConfig.GameList.contains(GameType.ChampionsTDM))
|
||||
{
|
||||
_conditionManager = new SkillConditionManager(plugin);
|
||||
}
|
||||
@ -263,9 +259,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
// Shop
|
||||
_arcadeShop = new ArcadeShop(this, clientManager, donationManager);
|
||||
|
||||
// Game Factory
|
||||
_gameFactory = new GameFactory(this);
|
||||
|
||||
// Managers
|
||||
new GameChatManager(this);
|
||||
_gameCreationManager = new GameCreationManager(this);
|
||||
@ -540,11 +533,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
return _gameHostManager;
|
||||
}
|
||||
|
||||
public GameFactory GetGameFactory()
|
||||
{
|
||||
return _gameFactory;
|
||||
}
|
||||
|
||||
public GameManager GetGameManager()
|
||||
{
|
||||
return _gameManager;
|
||||
@ -1256,7 +1244,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
|
||||
public void toggleChampionsModules(GameType gameType)
|
||||
{
|
||||
boolean isChamps = gameType == GameType.ChampionsDominate || gameType == GameType.ChampionsTDM || gameType == GameType.ChampionsMOBA;
|
||||
boolean isChamps = gameType == GameType.ChampionsDominate || gameType == GameType.ChampionsTDM;
|
||||
|
||||
if (_enabled == isChamps)
|
||||
{
|
||||
|
@ -1,123 +0,0 @@
|
||||
package nautilus.game.arcade;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import nautilus.game.arcade.game.games.sneakyassassins.*;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.games.baconbrawl.BaconBrawl;
|
||||
import nautilus.game.arcade.game.games.barbarians.Barbarians;
|
||||
import nautilus.game.arcade.game.games.bridge.Bridge;
|
||||
import nautilus.game.arcade.game.games.build.Build;
|
||||
import nautilus.game.arcade.game.games.cards.Cards;
|
||||
import nautilus.game.arcade.game.games.castlesiege.CastleSiege;
|
||||
import nautilus.game.arcade.game.games.champions.ChampionsDominate;
|
||||
import nautilus.game.arcade.game.games.champions.ChampionsTDM;
|
||||
import nautilus.game.arcade.game.games.christmas.Christmas;
|
||||
import nautilus.game.arcade.game.games.deathtag.DeathTag;
|
||||
import nautilus.game.arcade.game.games.dragonescape.DragonEscape;
|
||||
import nautilus.game.arcade.game.games.dragonescape.DragonEscapeTeams;
|
||||
import nautilus.game.arcade.game.games.dragonriders.DragonRiders;
|
||||
import nautilus.game.arcade.game.games.dragons.Dragons;
|
||||
import nautilus.game.arcade.game.games.dragons.DragonsTeams;
|
||||
import nautilus.game.arcade.game.games.draw.Draw;
|
||||
import nautilus.game.arcade.game.games.event.EventGame;
|
||||
import nautilus.game.arcade.game.games.evolution.Evolution;
|
||||
import nautilus.game.arcade.game.games.gravity.Gravity;
|
||||
import nautilus.game.arcade.game.games.halloween.Halloween;
|
||||
import nautilus.game.arcade.game.games.hideseek.HideSeek;
|
||||
import nautilus.game.arcade.game.games.holeinwall.HoleInTheWall;
|
||||
import nautilus.game.arcade.game.games.micro.Micro;
|
||||
import nautilus.game.arcade.game.games.milkcow.MilkCow;
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
import nautilus.game.arcade.game.games.mineware.MineWare;
|
||||
import nautilus.game.arcade.game.games.quiver.Quiver;
|
||||
import nautilus.game.arcade.game.games.quiver.QuiverTeams;
|
||||
import nautilus.game.arcade.game.games.runner.Runner;
|
||||
import nautilus.game.arcade.game.games.searchanddestroy.SearchAndDestroy;
|
||||
import nautilus.game.arcade.game.games.sheep.SheepGame;
|
||||
import nautilus.game.arcade.game.games.smash.SuperSmash;
|
||||
import nautilus.game.arcade.game.games.smash.SuperSmashDominate;
|
||||
import nautilus.game.arcade.game.games.smash.SuperSmashTeam;
|
||||
import nautilus.game.arcade.game.games.snake.Snake;
|
||||
import nautilus.game.arcade.game.games.snowfight.SnowFight;
|
||||
import nautilus.game.arcade.game.games.spleef.Spleef;
|
||||
import nautilus.game.arcade.game.games.spleef.SpleefTeams;
|
||||
import nautilus.game.arcade.game.games.squidshooter.SquidShooter;
|
||||
import nautilus.game.arcade.game.games.stacker.Stacker;
|
||||
import nautilus.game.arcade.game.games.survivalgames.SurvivalGames;
|
||||
import nautilus.game.arcade.game.games.survivalgames.SurvivalGamesTeams;
|
||||
import nautilus.game.arcade.game.games.paintball.Paintball;
|
||||
import nautilus.game.arcade.game.games.tug.Tug;
|
||||
import nautilus.game.arcade.game.games.turfforts.TurfForts;
|
||||
import nautilus.game.arcade.game.games.uhc.UHC;
|
||||
import nautilus.game.arcade.game.games.wither.WitherGame;
|
||||
import nautilus.game.arcade.game.games.wizards.Wizards;
|
||||
import nautilus.game.arcade.game.games.zombiesurvival.ZombieSurvival;
|
||||
|
||||
public class GameFactory
|
||||
{
|
||||
private ArcadeManager _manager;
|
||||
|
||||
public GameFactory(ArcadeManager gameManager)
|
||||
{
|
||||
_manager = gameManager;
|
||||
}
|
||||
|
||||
public Game CreateGame(GameType gameType, HashMap<String, ChatColor> pastTeams)
|
||||
{
|
||||
if (gameType == GameType.Barbarians) return new Barbarians(_manager);
|
||||
else if (gameType == GameType.BaconBrawl) return new BaconBrawl(_manager);
|
||||
else if (gameType == GameType.Bridge) return new Bridge(_manager);
|
||||
else if (gameType == GameType.Build) return new Build(_manager);
|
||||
else if (gameType == GameType.Cards) return new Cards(_manager);
|
||||
else if (gameType == GameType.CastleSiege) return new CastleSiege(_manager);
|
||||
else if (gameType == GameType.Christmas) return new Christmas(_manager);
|
||||
else if (gameType == GameType.DeathTag) return new DeathTag(_manager);
|
||||
else if (gameType == GameType.ChampionsDominate) return new ChampionsDominate(_manager);
|
||||
else if (gameType == GameType.ChampionsTDM) return new ChampionsTDM(_manager);
|
||||
else if (gameType == GameType.Dragons) return new Dragons(_manager);
|
||||
else if (gameType == GameType.DragonsTeams) return new DragonsTeams(_manager);
|
||||
else if (gameType == GameType.DragonEscape) return new DragonEscape(_manager);
|
||||
else if (gameType == GameType.DragonEscapeTeams) return new DragonEscapeTeams(_manager);
|
||||
else if (gameType == GameType.DragonRiders) return new DragonRiders(_manager);
|
||||
else if (gameType == GameType.Draw) return new Draw(_manager);
|
||||
else if (gameType == GameType.Event) return new EventGame(_manager);
|
||||
else if (gameType == GameType.Evolution) return new Evolution(_manager);
|
||||
else if (gameType == GameType.Gravity) return new Gravity(_manager);
|
||||
else if (gameType == GameType.Halloween) return new Halloween(_manager);
|
||||
else if (gameType == GameType.HideSeek) return new HideSeek(_manager);
|
||||
else if (gameType == GameType.HoleInTheWall) return new HoleInTheWall(_manager);
|
||||
else if (gameType == GameType.Micro) return new Micro(_manager);
|
||||
else if (gameType == GameType.MineStrike) return new MineStrike(_manager);
|
||||
else if (gameType == GameType.MineWare) return new MineWare(_manager);
|
||||
else if (gameType == GameType.MilkCow) return new MilkCow(_manager);
|
||||
else if (gameType == GameType.Paintball) return new Paintball(_manager);
|
||||
else if (gameType == GameType.Quiver) return new Quiver(_manager);
|
||||
else if (gameType == GameType.QuiverTeams) return new QuiverTeams(_manager);
|
||||
else if (gameType == GameType.Runner) return new Runner(_manager);
|
||||
else if (gameType == GameType.SearchAndDestroy) return new SearchAndDestroy(_manager);
|
||||
else if (gameType == GameType.SnowFight) return new SnowFight(_manager);
|
||||
else if (gameType == GameType.Sheep) return new SheepGame(_manager);
|
||||
else if (gameType == GameType.Smash) return new SuperSmash(_manager);
|
||||
else if (gameType == GameType.SmashTeams) return new SuperSmashTeam(_manager);
|
||||
else if (gameType == GameType.SmashDomination) return new SuperSmashDominate(_manager);
|
||||
else if (gameType == GameType.Snake) return new Snake(_manager);
|
||||
else if (gameType == GameType.SneakyAssassins) return new SneakyAssassins(_manager);
|
||||
else if (gameType == GameType.Spleef) return new Spleef(_manager);
|
||||
else if (gameType == GameType.SpleefTeams) return new SpleefTeams(_manager);
|
||||
else if (gameType == GameType.SquidShooter) return new SquidShooter(_manager);
|
||||
else if (gameType == GameType.Stacker) return new Stacker(_manager);
|
||||
else if (gameType == GameType.SurvivalGames) return new SurvivalGames(_manager);
|
||||
else if (gameType == GameType.SurvivalGamesTeams) return new SurvivalGamesTeams(_manager);
|
||||
else if (gameType == GameType.Tug) return new Tug(_manager);
|
||||
else if (gameType == GameType.TurfWars) return new TurfForts(_manager);
|
||||
else if (gameType == GameType.UHC) return new UHC(_manager);
|
||||
else if (gameType == GameType.WitherAssault) return new WitherGame(_manager);
|
||||
else if (gameType == GameType.Wizards) return new Wizards(_manager);
|
||||
else if (gameType == GameType.ZombieSurvival) return new ZombieSurvival(_manager);
|
||||
else return null;
|
||||
}
|
||||
}
|
@ -1,65 +1,120 @@
|
||||
package nautilus.game.arcade;
|
||||
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.games.baconbrawl.BaconBrawl;
|
||||
import nautilus.game.arcade.game.games.barbarians.Barbarians;
|
||||
import nautilus.game.arcade.game.games.bridge.Bridge;
|
||||
import nautilus.game.arcade.game.games.build.Build;
|
||||
import nautilus.game.arcade.game.games.cards.Cards;
|
||||
import nautilus.game.arcade.game.games.castlesiege.CastleSiege;
|
||||
import nautilus.game.arcade.game.games.champions.ChampionsDominate;
|
||||
import nautilus.game.arcade.game.games.champions.ChampionsTDM;
|
||||
import nautilus.game.arcade.game.games.christmas.Christmas;
|
||||
import nautilus.game.arcade.game.games.deathtag.DeathTag;
|
||||
import nautilus.game.arcade.game.games.dragonescape.DragonEscape;
|
||||
import nautilus.game.arcade.game.games.dragonescape.DragonEscapeTeams;
|
||||
import nautilus.game.arcade.game.games.dragonriders.DragonRiders;
|
||||
import nautilus.game.arcade.game.games.dragons.Dragons;
|
||||
import nautilus.game.arcade.game.games.dragons.DragonsTeams;
|
||||
import nautilus.game.arcade.game.games.draw.Draw;
|
||||
import nautilus.game.arcade.game.games.event.EventGame;
|
||||
import nautilus.game.arcade.game.games.evolution.Evolution;
|
||||
import nautilus.game.arcade.game.games.gravity.Gravity;
|
||||
import nautilus.game.arcade.game.games.halloween.Halloween;
|
||||
import nautilus.game.arcade.game.games.hideseek.HideSeek;
|
||||
import nautilus.game.arcade.game.games.holeinwall.HoleInTheWall;
|
||||
import nautilus.game.arcade.game.games.horsecharge.Horse;
|
||||
import nautilus.game.arcade.game.games.micro.Micro;
|
||||
import nautilus.game.arcade.game.games.milkcow.MilkCow;
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
import nautilus.game.arcade.game.games.mineware.MineWare;
|
||||
import nautilus.game.arcade.game.games.oldmineware.OldMineWare;
|
||||
import nautilus.game.arcade.game.games.paintball.Paintball;
|
||||
import nautilus.game.arcade.game.games.quiver.Quiver;
|
||||
import nautilus.game.arcade.game.games.quiver.QuiverTeams;
|
||||
import nautilus.game.arcade.game.games.runner.Runner;
|
||||
import nautilus.game.arcade.game.games.searchanddestroy.SearchAndDestroy;
|
||||
import nautilus.game.arcade.game.games.sheep.SheepGame;
|
||||
import nautilus.game.arcade.game.games.smash.SuperSmash;
|
||||
import nautilus.game.arcade.game.games.smash.SuperSmashDominate;
|
||||
import nautilus.game.arcade.game.games.smash.SuperSmashTeam;
|
||||
import nautilus.game.arcade.game.games.snake.Snake;
|
||||
import nautilus.game.arcade.game.games.sneakyassassins.SneakyAssassins;
|
||||
import nautilus.game.arcade.game.games.snowfight.SnowFight;
|
||||
import nautilus.game.arcade.game.games.spleef.Spleef;
|
||||
import nautilus.game.arcade.game.games.spleef.SpleefTeams;
|
||||
import nautilus.game.arcade.game.games.squidshooter.SquidShooter;
|
||||
import nautilus.game.arcade.game.games.stacker.Stacker;
|
||||
import nautilus.game.arcade.game.games.survivalgames.SurvivalGames;
|
||||
import nautilus.game.arcade.game.games.survivalgames.SurvivalGamesTeams;
|
||||
import nautilus.game.arcade.game.games.tug.Tug;
|
||||
import nautilus.game.arcade.game.games.turfforts.TurfForts;
|
||||
import nautilus.game.arcade.game.games.uhc.UHC;
|
||||
import nautilus.game.arcade.game.games.wither.WitherGame;
|
||||
import nautilus.game.arcade.game.games.wizards.Wizards;
|
||||
import nautilus.game.arcade.game.games.zombiesurvival.ZombieSurvival;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
public enum GameType
|
||||
{
|
||||
//Mini
|
||||
BaconBrawl("Bacon Brawl", Material.PORK, (byte)0, GameCategory.ARCADE, 1),
|
||||
Barbarians("A Barbarians Life", Material.WOOD_AXE, (byte)0, GameCategory.EXTRA, 2),
|
||||
Bridge("The Bridges", Material.IRON_PICKAXE, (byte)0, GameCategory.SURVIVAL, 3),
|
||||
CastleSiege("Castle Siege", Material.DIAMOND_CHESTPLATE, (byte)0, GameCategory.CLASSICS, 4),
|
||||
ChampionsDominate("Champions Domination", "Champions", Material.BEACON, (byte)0, GameCategory.CHAMPIONS, 6),
|
||||
ChampionsMOBA("Champions MOBA", "Champions", Material.SKULL_ITEM, (byte)0, GameCategory.CHAMPIONS, 7),
|
||||
ChampionsTDM("Champions TDM", "Champions", Material.GOLD_SWORD, (byte)0, GameCategory.CHAMPIONS, 5),
|
||||
Christmas("Christmas Chaos", Material.SNOW_BALL, (byte)0, GameCategory.CLASSICS, 8),
|
||||
DeathTag("Death Tag", Material.SKULL_ITEM, (byte)0, GameCategory.ARCADE, 9),
|
||||
DragonEscape("Dragon Escape", Material.DRAGON_EGG, (byte)0, GameCategory.ARCADE, 10),
|
||||
DragonEscapeTeams("Dragon Escape Teams", Material.DRAGON_EGG, (byte)0, GameCategory.TEAM_VARIANT, 11),
|
||||
DragonRiders("Dragon Riders", Material.DRAGON_EGG, (byte)0, GameCategory.ARCADE, 12),
|
||||
Dragons("Dragons", Material.ENDER_STONE, (byte)0, GameCategory.ARCADE, 13),
|
||||
DragonsTeams("Dragons Teams", Material.ENDER_STONE, (byte)0, GameCategory.TEAM_VARIANT, 14),
|
||||
Draw("Draw My Thing", Material.BOOK_AND_QUILL, (byte)0, GameCategory.CLASSICS, 15),
|
||||
Evolution("Evolution", Material.EMERALD, (byte)0, GameCategory.ARCADE, 16),
|
||||
FlappyBird("Flappy Bird", Material.FEATHER, (byte)0, GameCategory.ARCADE, 17),
|
||||
Gravity("Gravity", Material.ENDER_PORTAL, (byte)0, GameCategory.EXTRA, 18),
|
||||
Halloween("Halloween Horror", Material.PUMPKIN, (byte)0, GameCategory.CLASSICS, 19),
|
||||
HideSeek("Block Hunt", Material.GRASS, (byte)0, GameCategory.CLASSICS, 20),
|
||||
HoleInTheWall("Hole in the Wall", Material.STAINED_GLASS, (byte) 2, GameCategory.ARCADE, 52),
|
||||
Horse("Horseback", Material.IRON_BARDING, (byte)0, GameCategory.ARCADE, 21),
|
||||
Micro("Micro Battle", Material.LAVA_BUCKET, (byte)0, GameCategory.ARCADE, 24),
|
||||
MilkCow("Milk the Cow", Material.MILK_BUCKET, (byte)0, GameCategory.ARCADE, 27),
|
||||
MineStrike("MineStrike", Material.TNT, (byte)0, GameCategory.CLASSICS, 25, "http://chivebox.com/file/c/assets.zip", false),
|
||||
MineWare("MineWare", Material.PAPER, (byte)0, GameCategory.EXTRA, 26),
|
||||
Paintball("Super Paintball", Material.ENDER_PEARL, (byte)0, GameCategory.ARCADE, 28),
|
||||
Quiver("One in the Quiver", Material.ARROW, (byte)0, GameCategory.ARCADE, 29),
|
||||
QuiverTeams("One in the Quiver Teams", Material.ARROW, (byte)0, GameCategory.TEAM_VARIANT, 30),
|
||||
Runner("Runner", Material.LEATHER_BOOTS, (byte)0, GameCategory.ARCADE, 31),
|
||||
SearchAndDestroy("Search and Destroy", Material.TNT, (byte)0, GameCategory.SURVIVAL, 32),
|
||||
Sheep("Sheep Quest", Material.WOOL, (byte)4, GameCategory.ARCADE, 33),
|
||||
Smash("Super Smash Mobs", Material.SKULL_ITEM, (byte)4, GameCategory.CLASSICS, 34),
|
||||
SmashDomination("Super Smash Mobs Domination", "Super Smash Mobs", Material.SKULL_ITEM, (byte)4, GameCategory.EXTRA, 36),
|
||||
SmashTeams("Super Smash Mobs Teams", "Super Smash Mobs", Material.SKULL_ITEM, (byte)4, GameCategory.TEAM_VARIANT, 35),
|
||||
Snake("Snake", Material.WOOL, (byte)0, GameCategory.ARCADE, 37),
|
||||
SneakyAssassins("Sneaky Assassins", Material.INK_SACK, (byte)0, GameCategory.ARCADE, 38),
|
||||
SnowFight("Snow Fight", Material.SNOW_BALL, (byte)0, GameCategory.EXTRA, 39),
|
||||
Spleef("Super Spleef", Material.IRON_SPADE, (byte)0, GameCategory.ARCADE, 40),
|
||||
SpleefTeams("Super Spleef Teams", Material.IRON_SPADE, (byte)0, GameCategory.TEAM_VARIANT, 41),
|
||||
SquidShooter("Squid Shooter", Material.FIREWORK_CHARGE, (byte)0, GameCategory.ARCADE, 43),
|
||||
Stacker("Super Stacker", Material.BOWL, (byte)0, GameCategory.ARCADE, 42),
|
||||
SurvivalGames("Survival Games", Material.IRON_SWORD, (byte)0, GameCategory.SURVIVAL, 22),
|
||||
SurvivalGamesTeams("Survival Games Teams", Material.IRON_SWORD, (byte)0, GameCategory.TEAM_VARIANT, 23),
|
||||
Tug("Tug of Wool", Material.WHEAT, (byte)0, GameCategory.ARCADE, 44),
|
||||
TurfWars("Turf Wars", Material.STAINED_CLAY, (byte)14, GameCategory.ARCADE, 45),
|
||||
UHC("Ultra Hardcore", Material.GOLDEN_APPLE, (byte)0, GameCategory.SURVIVAL, 46),
|
||||
WitherAssault("Wither Assault", Material.SKULL_ITEM, (byte)1, GameCategory.ARCADE, 47),
|
||||
Wizards("Wizards", Material.BLAZE_ROD, (byte)0, GameCategory.SURVIVAL, 48, "http://chivebox.com/file/c/ResWizards.zip", true),
|
||||
ZombieSurvival("Zombie Survival", Material.SKULL_ITEM, (byte)2, GameCategory.SURVIVAL, 49),
|
||||
BaconBrawl(BaconBrawl.class, "Bacon Brawl", Material.PORK, (byte)0, GameCategory.ARCADE, 1),
|
||||
Barbarians(Barbarians.class, "A Barbarians Life", Material.WOOD_AXE, (byte)0, GameCategory.EXTRA, 2),
|
||||
Bridge(Bridge.class, "The Bridges", Material.IRON_PICKAXE, (byte)0, GameCategory.SURVIVAL, 3),
|
||||
CastleSiege(CastleSiege.class, "Castle Siege", Material.DIAMOND_CHESTPLATE, (byte)0, GameCategory.CLASSICS, 4),
|
||||
ChampionsDominate(ChampionsDominate.class, "Champions Domination", "Champions", Material.BEACON, (byte)0, GameCategory.CHAMPIONS, 6),
|
||||
//ChampionsMOBA(ChampionsMOBA.class, "Champions MOBA", "Champions", Material.SKULL_ITEM, (byte)0, GameCategory.CHAMPIONS, 7),
|
||||
ChampionsTDM(ChampionsTDM.class, "Champions TDM", "Champions", Material.GOLD_SWORD, (byte)0, GameCategory.CHAMPIONS, 5),
|
||||
Christmas(Christmas.class, "Christmas Chaos", Material.SNOW_BALL, (byte)0, GameCategory.CLASSICS, 8),
|
||||
DeathTag(DeathTag.class, "Death Tag", Material.SKULL_ITEM, (byte)0, GameCategory.ARCADE, 9),
|
||||
DragonEscape(DragonEscape.class, "Dragon Escape", Material.DRAGON_EGG, (byte)0, GameCategory.ARCADE, 10),
|
||||
DragonEscapeTeams(DragonEscapeTeams.class, "Dragon Escape Teams", Material.DRAGON_EGG, (byte)0, GameCategory.TEAM_VARIANT, 11),
|
||||
DragonRiders(DragonRiders.class, "Dragon Riders", Material.DRAGON_EGG, (byte)0, GameCategory.ARCADE, 12),
|
||||
Dragons(Dragons.class, "Dragons", Material.ENDER_STONE, (byte)0, GameCategory.ARCADE, 13),
|
||||
DragonsTeams(DragonsTeams.class, "Dragons Teams", Material.ENDER_STONE, (byte)0, GameCategory.TEAM_VARIANT, 14),
|
||||
Draw(Draw.class, "Draw My Thing", Material.BOOK_AND_QUILL, (byte)0, GameCategory.CLASSICS, 15),
|
||||
Evolution(Evolution.class, "Evolution", Material.EMERALD, (byte)0, GameCategory.ARCADE, 16),
|
||||
//FlappyBird(FlappyBird.class, "Flappy Bird", Material.FEATHER, (byte)0, GameCategory.ARCADE, 17),
|
||||
Gravity(Gravity.class, "Gravity", Material.ENDER_PORTAL, (byte)0, GameCategory.EXTRA, 18),
|
||||
Halloween(Halloween.class, "Halloween Horror", Material.PUMPKIN, (byte)0, GameCategory.CLASSICS, 19),
|
||||
HideSeek(HideSeek.class, "Block Hunt", Material.GRASS, (byte)0, GameCategory.CLASSICS, 20),
|
||||
HoleInTheWall(HoleInTheWall.class, "Hole in the Wall", Material.STAINED_GLASS, (byte) 2, GameCategory.ARCADE, 52),
|
||||
Horse(Horse.class, "Horseback", Material.IRON_BARDING, (byte)0, GameCategory.ARCADE, 21),
|
||||
Micro(Micro.class, "Micro Battle", Material.LAVA_BUCKET, (byte)0, GameCategory.ARCADE, 24),
|
||||
MilkCow(MilkCow.class, "Milk the Cow", Material.MILK_BUCKET, (byte)0, GameCategory.ARCADE, 27),
|
||||
MineStrike(MineStrike.class, "MineStrike", Material.TNT, (byte)0, GameCategory.CLASSICS, 25, "http://chivebox.com/file/c/assets.zip", true),
|
||||
MineWare(MineWare.class, "MineWare", Material.PAPER, (byte)0, GameCategory.EXTRA, 26),
|
||||
OldMineWare(OldMineWare.class, "Old MineWare", Material.PAPER, (byte)0, GameCategory.EXTRA, 26),
|
||||
Paintball(Paintball.class, "Super Paintball", Material.ENDER_PEARL, (byte)0, GameCategory.ARCADE, 28),
|
||||
Quiver(Quiver.class, "One in the Quiver", Material.ARROW, (byte)0, GameCategory.ARCADE, 29),
|
||||
QuiverTeams(QuiverTeams.class, "One in the Quiver Teams", Material.ARROW, (byte)0, GameCategory.TEAM_VARIANT, 30),
|
||||
Runner(Runner.class, "Runner", Material.LEATHER_BOOTS, (byte)0, GameCategory.ARCADE, 31),
|
||||
SearchAndDestroy(SearchAndDestroy.class, "Search and Destroy", Material.TNT, (byte)0, GameCategory.SURVIVAL, 32),
|
||||
Sheep(SheepGame.class, "Sheep Quest", Material.WOOL, (byte)4, GameCategory.ARCADE, 33),
|
||||
Smash(SuperSmash.class, "Super Smash Mobs", Material.SKULL_ITEM, (byte)4, GameCategory.CLASSICS, 34),
|
||||
SmashDomination(SuperSmashDominate.class, "Super Smash Mobs Domination", "Super Smash Mobs", Material.SKULL_ITEM, (byte)4, GameCategory.EXTRA, 36),
|
||||
SmashTeams(SuperSmashTeam.class, "Super Smash Mobs Teams", "Super Smash Mobs", Material.SKULL_ITEM, (byte)4, GameCategory.TEAM_VARIANT, 35),
|
||||
Snake(Snake.class, "Snake", Material.WOOL, (byte)0, GameCategory.ARCADE, 37),
|
||||
SneakyAssassins(SneakyAssassins.class, "Sneaky Assassins", Material.INK_SACK, (byte)0, GameCategory.ARCADE, 38),
|
||||
SnowFight(SnowFight.class, "Snow Fight", Material.SNOW_BALL, (byte)0, GameCategory.EXTRA, 39),
|
||||
Spleef(Spleef.class, "Super Spleef", Material.IRON_SPADE, (byte)0, GameCategory.ARCADE, 40),
|
||||
SpleefTeams(SpleefTeams.class, "Super Spleef Teams", Material.IRON_SPADE, (byte)0, GameCategory.TEAM_VARIANT, 41),
|
||||
SquidShooter(SquidShooter.class, "Squid Shooter", Material.FIREWORK_CHARGE, (byte)0, GameCategory.ARCADE, 43),
|
||||
Stacker(Stacker.class, "Super Stacker", Material.BOWL, (byte)0, GameCategory.ARCADE, 42),
|
||||
SurvivalGames(SurvivalGames.class, "Survival Games", Material.IRON_SWORD, (byte)0, GameCategory.SURVIVAL, 22),
|
||||
SurvivalGamesTeams(SurvivalGamesTeams.class, "Survival Games Teams", Material.IRON_SWORD, (byte)0, GameCategory.TEAM_VARIANT, 23),
|
||||
Tug(Tug.class, "Tug of Wool", Material.WHEAT, (byte)0, GameCategory.ARCADE, 44),
|
||||
TurfWars(TurfForts.class, "Turf Wars", Material.STAINED_CLAY, (byte)14, GameCategory.ARCADE, 45),
|
||||
UHC(UHC.class, "Ultra Hardcore", Material.GOLDEN_APPLE, (byte)0, GameCategory.SURVIVAL, 46),
|
||||
WitherAssault(WitherGame.class, "Wither Assault", Material.SKULL_ITEM, (byte)1, GameCategory.ARCADE, 47),
|
||||
Wizards(Wizards.class, "Wizards", Material.BLAZE_ROD, (byte)0, GameCategory.SURVIVAL, 48, "http://chivebox.com/file/c/ResWizards.zip", true),
|
||||
ZombieSurvival(ZombieSurvival.class, "Zombie Survival", Material.SKULL_ITEM, (byte)2, GameCategory.SURVIVAL, 49),
|
||||
|
||||
Build("Master Builders", Material.BRICK, (byte)0, GameCategory.CLASSICS, 50),
|
||||
Cards("Craft Against Humanity", Material.MAP, (byte)0, GameCategory.CLASSICS, 51),
|
||||
Build(Build.class, "Master Builders", Material.BRICK, (byte)0, GameCategory.CLASSICS, 50),
|
||||
Cards(Cards.class, "Craft Against Humanity", Material.MAP, (byte)0, GameCategory.CLASSICS, 51),
|
||||
|
||||
Event("Mineplex Event", Material.CAKE, (byte)0, GameCategory.EVENT, 999);
|
||||
Event(EventGame.class, "Mineplex Event", Material.CAKE, (byte)0, GameCategory.EVENT, 999);
|
||||
|
||||
String _name;
|
||||
String _lobbyName;
|
||||
@ -68,27 +123,29 @@ public enum GameType
|
||||
GameCategory _gameCategory;
|
||||
boolean _enforceResourcePack;
|
||||
String _resourcePack;
|
||||
Class<? extends Game> _gameClass;
|
||||
|
||||
private int _gameId; // Unique identifying id for this gamemode (used for statistics)
|
||||
public int getGameId() { return _gameId; }
|
||||
|
||||
GameType(String name, Material mat, byte data, GameCategory gameCategory, int gameId)
|
||||
GameType(Class<? extends Game> gameClass, String name, Material mat, byte data, GameCategory gameCategory, int gameId)
|
||||
{
|
||||
this(name, name, mat, data, gameCategory, gameId);
|
||||
this(gameClass, name, name, mat, data, gameCategory, gameId);
|
||||
}
|
||||
|
||||
GameType(String name, Material mat, byte data, GameCategory gameCategory, int gameId, String resourcePackUrl, boolean enforceResourcePack)
|
||||
GameType(Class<? extends Game> gameClass, String name, Material mat, byte data, GameCategory gameCategory, int gameId, String resourcePackUrl, boolean enforceResourcePack)
|
||||
{
|
||||
this(name, name, mat, data, gameCategory, gameId, resourcePackUrl, enforceResourcePack);
|
||||
this(gameClass, name, name, mat, data, gameCategory, gameId, resourcePackUrl, enforceResourcePack);
|
||||
}
|
||||
|
||||
GameType(String name, String lobbyName, Material mat, byte data, GameCategory gameCategory, int gameId)
|
||||
GameType(Class<? extends Game> gameClass, String name, String lobbyName, Material mat, byte data, GameCategory gameCategory, int gameId)
|
||||
{
|
||||
this(name, lobbyName, mat, data, gameCategory, gameId, null, false);
|
||||
this(gameClass, name, lobbyName, mat, data, gameCategory, gameId, null, false);
|
||||
}
|
||||
|
||||
GameType(String name, String lobbyName, Material mat, byte data, GameCategory gameCategory, int gameId, String resourcePackUrl, boolean enforceResourcePack)
|
||||
GameType(Class<? extends Game> gameClass, String name, String lobbyName, Material mat, byte data, GameCategory gameCategory, int gameId, String resourcePackUrl, boolean enforceResourcePack)
|
||||
{
|
||||
_gameClass = gameClass;
|
||||
_name = name;
|
||||
_lobbyName = lobbyName;
|
||||
_mat = mat;
|
||||
@ -99,6 +156,11 @@ public enum GameType
|
||||
_enforceResourcePack = enforceResourcePack;
|
||||
}
|
||||
|
||||
public Class<? extends Game> getGameClass()
|
||||
{
|
||||
return _gameClass;
|
||||
}
|
||||
|
||||
public boolean isEnforceResourcePack()
|
||||
{
|
||||
return _enforceResourcePack;
|
||||
|
@ -22,8 +22,6 @@ public class StopCommand extends CommandBase<ArcadeManager>
|
||||
if (Plugin.GetGame() == null)
|
||||
return;
|
||||
|
||||
HandlerList.unregisterAll(Plugin.GetGame());
|
||||
|
||||
if (Plugin.GetGame().GetState() == GameState.End || Plugin.GetGame().GetState() == GameState.End)
|
||||
{
|
||||
caller.sendMessage("Game is already ending...");
|
||||
@ -38,6 +36,7 @@ public class StopCommand extends CommandBase<ArcadeManager>
|
||||
Plugin.GetGame().SetState(GameState.End);
|
||||
}
|
||||
|
||||
HandlerList.unregisterAll(Plugin.GetGame());
|
||||
|
||||
Plugin.GetGame().Announce(C.cAqua + C.Bold + caller.getName() + " has stopped the game.");
|
||||
}
|
||||
|
@ -9,12 +9,10 @@ import java.util.Set;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Hanging;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -1276,15 +1274,20 @@ public abstract class Game implements Listener
|
||||
CreatureAllowOverride = event.getAllowed();
|
||||
}
|
||||
|
||||
public boolean isInsideMap(Player player)
|
||||
{
|
||||
return isInsideMap(player.getLocation());
|
||||
}
|
||||
|
||||
public boolean isInsideMap(Location loc)
|
||||
{
|
||||
return !(
|
||||
loc.getX() >= WorldData.MaxX ||
|
||||
loc.getX() >= WorldData.MaxX + 1 ||
|
||||
loc.getX() <= WorldData.MinX ||
|
||||
loc.getZ() >= WorldData.MaxZ + 1 ||
|
||||
loc.getZ() <= WorldData.MinZ + 1 ||
|
||||
loc.getY() >= WorldData.MaxY ||
|
||||
loc.getY() <= WorldData.MinY + 1);
|
||||
loc.getZ() <= WorldData.MinZ ||
|
||||
loc.getY() >= WorldData.MaxY + 1 ||
|
||||
loc.getY() <= WorldData.MinY);
|
||||
}
|
||||
|
||||
public void setItemMerge(boolean itemMerge)
|
||||
|
@ -31,6 +31,7 @@ import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.entity.ItemSpawnEvent;
|
||||
import org.bukkit.event.inventory.PrepareItemCraftEvent;
|
||||
import org.bukkit.event.player.PlayerBucketEmptyEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
import org.bukkit.inventory.CraftingInventory;
|
||||
@ -1626,4 +1627,20 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double GetKillsGems(Player killer, Player killed, boolean assist)
|
||||
{
|
||||
if (assist)
|
||||
return 3;
|
||||
else
|
||||
return 12;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void toggleOre(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
if (event.getPlayer().isOp() && event.getMessage().contains("/oretoggle"))
|
||||
_ore.ToggleVisibility();
|
||||
}
|
||||
}
|
||||
|
@ -63,6 +63,7 @@ import org.bukkit.event.vehicle.VehicleCreateEvent;
|
||||
import org.bukkit.event.vehicle.VehicleDamageEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
@ -91,6 +92,7 @@ import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.events.PlayerPrepareTeleportEvent;
|
||||
import nautilus.game.arcade.game.SoloGame;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.game.games.build.gui.MobShop;
|
||||
import nautilus.game.arcade.game.games.build.gui.OptionsShop;
|
||||
import nautilus.game.arcade.game.games.build.kits.KitBuilder;
|
||||
@ -107,8 +109,8 @@ public class Build extends SoloGame
|
||||
private int _buildGameState = 0;
|
||||
private long _buildStateTime = 0;
|
||||
private long _buildTime = 300000;
|
||||
private long _voteTime = 12000;
|
||||
private long _viewTime = 16000;
|
||||
private long _voteTime = 14000;
|
||||
private long _viewTime = 18000;
|
||||
private BuildData _viewData = null;
|
||||
|
||||
private int _countdownTimerState = 0;
|
||||
@ -372,7 +374,27 @@ public class Build extends SoloGame
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasDecentVote)
|
||||
String result = null;
|
||||
|
||||
//More than half think its abusive
|
||||
if (GetPlayers(true).size() >= 4 && _viewData.AbuseVotes.size() >= (double)(GetPlayers(true).size() - 1) / 2d)
|
||||
{
|
||||
result = C.cWhite + "Inappropriate Build";
|
||||
_viewData.setAbusive();
|
||||
|
||||
//Record Abuse
|
||||
AddStat(_viewData.Player, "Build Draw Abuse", 1, false, true);
|
||||
|
||||
//Announce
|
||||
Announce(C.cWhite + C.Bold + _viewData.Player.getName() + " has been reported for an inappropriate build.", false);
|
||||
_viewData.Spawn.getWorld().playSound(_viewData.Spawn, Sound.ENDERDRAGON_GROWL, 10f, 1f);
|
||||
|
||||
UtilPlayer.message(_viewData.Player, C.cWhite + C.Bold + "Inappropriate Builds can result in a Master Buildres ban.");
|
||||
|
||||
//Return to Hub
|
||||
getArcadeManager().GetPortal().sendPlayerToServer(_viewData.Player, "Lobby");
|
||||
}
|
||||
else if (!hasDecentVote)
|
||||
{
|
||||
Manager.GetExplosion().BlockExplosion(_viewData.Blocks, _viewData.Spawn, false);
|
||||
|
||||
@ -380,10 +402,12 @@ public class Build extends SoloGame
|
||||
_viewData.Spawn.getWorld().playSound(_viewData.Spawn, Sound.EXPLODE, 3f, 1f);
|
||||
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, _viewData.Spawn, 4f, 4f, 4f, 0, 10,
|
||||
ViewDist.MAX, UtilServer.getPlayers());
|
||||
|
||||
result = C.cRed + "Failure";
|
||||
}
|
||||
|
||||
//Announce Builder
|
||||
UtilTextMiddle.display(hasDecentVote ? null : C.cRed + "Failure", "Built by: " + C.Bold + _viewData.Player.getName(), 0, 80, 5);
|
||||
UtilTextMiddle.display(result, "Built by: " + C.Bold + _viewData.Player.getName(), 0, 80, 5);
|
||||
}
|
||||
|
||||
_viewData.Judged = true;
|
||||
@ -431,6 +455,8 @@ public class Build extends SoloGame
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(160, (byte)3, 1, C.cAqua + C.Bold + "Amazing"));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(160, (byte)10, 1, C.cPurple + C.Bold + "WOW! EVERYTHING IS AWESOME!"));
|
||||
|
||||
player.getInventory().setItem(8, ItemStackFactory.Instance.CreateStack(Material.BOOK, (byte)0, 1, C.cWhite + C.Bold + "Report Inappropriate Build"));
|
||||
|
||||
UtilTextMiddle.display(null, C.cYellow + "Click to Vote", 0, 60, 5, player);
|
||||
}
|
||||
|
||||
@ -711,9 +737,6 @@ public class Build extends SoloGame
|
||||
if (!IsAlive(event.getPlayer()))
|
||||
return;
|
||||
|
||||
if (!UtilGear.isMat(event.getPlayer().getItemInHand(), Material.STAINED_GLASS_PANE))
|
||||
return;
|
||||
|
||||
if (!UtilEvent.isAction(event, ActionType.R) && !UtilEvent.isAction(event, ActionType.L))
|
||||
return;
|
||||
|
||||
@ -726,6 +749,19 @@ public class Build extends SoloGame
|
||||
if (!UtilTime.elapsed(_buildStateTime, 1500))
|
||||
return;
|
||||
|
||||
//Vote Abuse
|
||||
if (UtilGear.isMat(event.getPlayer().getItemInHand(), Material.BOOK))
|
||||
{
|
||||
_viewData.addAbuseVote(event.getPlayer());
|
||||
UtilTextMiddle.display(null, C.cWhite + C.Bold + "Inappropriate Build", 0, 40, 5, event.getPlayer());
|
||||
UtilPlayer.message(event.getPlayer(), C.cWhite + C.Bold + "You reported " + _viewData.Player.getName() + " for inappropriate build!");
|
||||
UtilPlayer.message(event.getPlayer(), C.cWhite + C.Bold + "Thanks for helping us keep Master Builders clean!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!UtilGear.isMat(event.getPlayer().getItemInHand(), Material.STAINED_GLASS_PANE))
|
||||
return;
|
||||
|
||||
if (!_votes.containsKey(event.getPlayer()))
|
||||
_votes.put(event.getPlayer(), new NautHashMap<Player, Integer>());
|
||||
|
||||
@ -1179,12 +1215,12 @@ public class Build extends SoloGame
|
||||
if (_buildGameState == 0)
|
||||
{
|
||||
Scoreboard.Write(C.cYellow + C.Bold + "Build Time");
|
||||
Scoreboard.Write(UtilTime.MakeStr(Math.max(0, _buildTime - (System.currentTimeMillis() - this.GetStateTime())), 1));
|
||||
Scoreboard.Write(UtilTime.MakeStr(Math.max(0, _buildTime - (System.currentTimeMillis() - this.GetStateTime())), 0));
|
||||
}
|
||||
else if (_buildGameState == 2)
|
||||
{
|
||||
Scoreboard.Write(C.cYellow + C.Bold + "Vote Time");
|
||||
Scoreboard.Write(UtilTime.MakeStr(Math.max(0, _voteTime - (System.currentTimeMillis() - _buildStateTime)), 1));
|
||||
Scoreboard.Write(UtilTime.MakeStr(Math.max(0, _voteTime - (System.currentTimeMillis() - _buildStateTime)), 0));
|
||||
|
||||
// if (_viewData != null)
|
||||
// {
|
||||
@ -1441,4 +1477,22 @@ public class Build extends SoloGame
|
||||
|
||||
return GetTeamList().get(0).GetSpawn();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void kickAbusers(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SLOW)
|
||||
return;
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
if (Manager.GetStatsManager().Get(player).getStat("Global.Build Draw Abuse") >= 3)
|
||||
{
|
||||
UtilPlayer.message(player, C.cRed + C.Bold + "You have been flagged as an Inappropriate Builder!");
|
||||
UtilPlayer.message(player, C.cRed + C.Bold + "As a result, you are banned from this game.");
|
||||
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 10f, 1f);
|
||||
getArcadeManager().GetPortal().sendPlayerToServer(player, "Lobby");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -52,6 +52,9 @@ public class BuildData
|
||||
|
||||
public int Time = 6000;
|
||||
|
||||
public HashSet<String> AbuseVotes = new HashSet<String>();
|
||||
public boolean IsAbusive = false;
|
||||
|
||||
// This is used to show the player to use their inventory to grab items
|
||||
public boolean ClickedInventory = false;
|
||||
|
||||
@ -307,6 +310,9 @@ public class BuildData
|
||||
|
||||
public void addPoints(double d)
|
||||
{
|
||||
if (IsAbusive)
|
||||
return;
|
||||
|
||||
_totalPoints += d;
|
||||
}
|
||||
|
||||
@ -319,4 +325,14 @@ public class BuildData
|
||||
{
|
||||
_totalPoints = 0;
|
||||
}
|
||||
|
||||
public void addAbuseVote(Player voter)
|
||||
{
|
||||
AbuseVotes.add(voter.getName());
|
||||
}
|
||||
|
||||
public void setAbusive()
|
||||
{
|
||||
IsAbusive = true;
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
|
||||
import mineplex.core.common.util.MapUtil;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
@ -178,7 +179,7 @@ public class Micro extends TeamGame
|
||||
return;
|
||||
|
||||
for (Block block : _glass)
|
||||
block.setType(Material.AIR);
|
||||
MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR);
|
||||
|
||||
_glass.clear();
|
||||
}
|
||||
|
@ -245,8 +245,8 @@ public class MineStrike extends TeamGame
|
||||
C.cAqua + "SWAT" + C.cWhite + " Defend the Bomb Sites",
|
||||
C.cAqua + "SWAT" + C.cWhite + " Kill the Terrorists",
|
||||
" ",
|
||||
C.cRed + "Al'Jaha" + C.cWhite + " Plant the Bomb at Bomb Site",
|
||||
C.cRed + "Al'Jaha" + C.cWhite + " Kill the Counter-Terrorists",
|
||||
C.cRed + "Bombers" + C.cWhite + " Plant the Bomb at Bomb Site",
|
||||
C.cRed + "Bombers" + C.cWhite + " Kill the Counter-Terrorists",
|
||||
});
|
||||
|
||||
_shopManager = new ShopManager(this);
|
||||
@ -313,7 +313,7 @@ public class MineStrike extends TeamGame
|
||||
this.GetTeamList().get(0).SetName("SWAT");
|
||||
|
||||
this.GetTeamList().get(1).SetColor(ChatColor.RED);
|
||||
this.GetTeamList().get(1).SetName("Al'Jaha");
|
||||
this.GetTeamList().get(1).SetName("Bombers");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -0,0 +1,245 @@
|
||||
package nautilus.game.arcade.game.games.mineware;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.hologram.Hologram;
|
||||
import mineplex.core.hologram.Hologram.HologramTarget;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public abstract class Challenge implements Listener
|
||||
{
|
||||
public enum ChallengeType
|
||||
{
|
||||
LastStanding, FirstComplete
|
||||
}
|
||||
|
||||
public MineWare Host;
|
||||
|
||||
private String _order;
|
||||
|
||||
protected long StartTime;
|
||||
protected long Duration;
|
||||
|
||||
private Location _center;
|
||||
|
||||
protected HashSet<Player> Completed = new HashSet<Player>();
|
||||
private HashSet<Block> _modifiedBlocks = new HashSet<Block>();
|
||||
protected int Places;
|
||||
private ChallengeType _challengeType;
|
||||
|
||||
public Challenge(MineWare host, ChallengeType challengeType, String challengeName)
|
||||
{
|
||||
Host = host;
|
||||
_order = challengeName;
|
||||
_center = new Location(host.WorldData.World, 0, 0, 0);
|
||||
_challengeType = challengeType;
|
||||
}
|
||||
|
||||
public HashSet<Block> getModifiedBlocks()
|
||||
{
|
||||
return _modifiedBlocks;
|
||||
}
|
||||
|
||||
public String getMessage(Player player)
|
||||
{
|
||||
return _order;
|
||||
}
|
||||
|
||||
public void setBorder(int minX, int maxX, int minY, int maxY, int minZ, int maxZ)
|
||||
{
|
||||
Host.WorldData.MinX = minX;
|
||||
Host.WorldData.MaxX = maxX;
|
||||
Host.WorldData.MinY = minY;
|
||||
Host.WorldData.MaxY = maxY;
|
||||
Host.WorldData.MinZ = minZ;
|
||||
Host.WorldData.MaxZ = maxZ;
|
||||
}
|
||||
|
||||
protected void addBlock(Block block)
|
||||
{
|
||||
if (block.getType() == Material.AIR)
|
||||
{
|
||||
_modifiedBlocks.remove(block);
|
||||
}
|
||||
else
|
||||
{
|
||||
_modifiedBlocks.add(block);
|
||||
}
|
||||
}
|
||||
|
||||
public void StartOrder()
|
||||
{
|
||||
setupPlayers();
|
||||
|
||||
Completed.clear();
|
||||
|
||||
StartTime = System.currentTimeMillis();
|
||||
|
||||
Duration = 60000;
|
||||
|
||||
Places = (int) Math.ceil(getChallengers().size() / 2D);
|
||||
}
|
||||
|
||||
public void EndOrder()
|
||||
{
|
||||
cleanupRoom();
|
||||
}
|
||||
|
||||
protected void displayCount(Player player, Location loc, String string)
|
||||
{
|
||||
final Hologram hologram = new Hologram(Host.Manager.getHologramManager(), loc, string);
|
||||
hologram.setHologramTarget(HologramTarget.WHITELIST);
|
||||
hologram.addPlayer(player);
|
||||
hologram.start();
|
||||
final long expires = System.currentTimeMillis() + 500;
|
||||
|
||||
new BukkitRunnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
if (!Host.IsLive() || expires < System.currentTimeMillis())
|
||||
{
|
||||
hologram.stop();
|
||||
cancel();
|
||||
}
|
||||
else
|
||||
{
|
||||
hologram.setLocation(hologram.getLocation().add(0, 0.1, 0));
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(Host.Manager.getPlugin(), 0, 0);
|
||||
}
|
||||
|
||||
public abstract ArrayList<Location> getSpawns();
|
||||
|
||||
public abstract void cleanupRoom();
|
||||
|
||||
/**
|
||||
* Register border
|
||||
*/
|
||||
public abstract void setupPlayers();
|
||||
|
||||
public abstract void generateRoom();
|
||||
|
||||
public String GetOrder()
|
||||
{
|
||||
return _order.toUpperCase();
|
||||
}
|
||||
|
||||
public boolean isInsideMap(Player player)
|
||||
{
|
||||
return Host.isInsideMap(player.getLocation());
|
||||
}
|
||||
|
||||
public final boolean Finish()
|
||||
{
|
||||
ArrayList<Player> players = getChallengers();
|
||||
|
||||
if (players.isEmpty())
|
||||
return true;
|
||||
|
||||
if (_challengeType == ChallengeType.LastStanding)
|
||||
{
|
||||
if (players.size() <= Places)
|
||||
{
|
||||
for (Player player : players)
|
||||
{
|
||||
SetCompleted(player);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (_challengeType == ChallengeType.FirstComplete)
|
||||
{
|
||||
if (Completed.size() >= Places)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return UtilTime.elapsed(StartTime, Duration);
|
||||
}
|
||||
|
||||
public int GetTimeLeft()
|
||||
{
|
||||
return (int) ((Duration - (System.currentTimeMillis() - StartTime)) / 1000);
|
||||
}
|
||||
|
||||
public void SetCompleted(Player player)
|
||||
{
|
||||
if (Completed.contains(player))
|
||||
return;
|
||||
|
||||
Completed.add(player);
|
||||
UtilPlayer.message(player, C.cGreen + C.Bold + "You completed the task!");
|
||||
player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1f);
|
||||
UtilInv.Clear(player);
|
||||
}
|
||||
|
||||
public void setLost(Player player)
|
||||
{
|
||||
Host.LoseLife(player, false);
|
||||
Host.Manager.addSpectator(player, true);
|
||||
UtilInv.Clear(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all players that are alive, regardless of having won or not.
|
||||
*/
|
||||
public ArrayList<Player> getChallengers()
|
||||
{
|
||||
return Host.getChallengers();
|
||||
}
|
||||
|
||||
public boolean IsCompleted(Player player)
|
||||
{
|
||||
return Completed.contains(player);
|
||||
}
|
||||
|
||||
public float GetTimeLeftPercent()
|
||||
{
|
||||
float a = (float) (Duration - (System.currentTimeMillis() - StartTime));
|
||||
float b = (float) (Duration);
|
||||
return a / b;
|
||||
}
|
||||
|
||||
public final int GetRemainingPlaces()
|
||||
{
|
||||
if (_challengeType == ChallengeType.FirstComplete)
|
||||
{
|
||||
return Places - Completed.size();
|
||||
}
|
||||
else if (_challengeType == ChallengeType.LastStanding)
|
||||
{
|
||||
return getChallengers().size() - Places;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getMinPlayers()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
public Location getCenter()
|
||||
{
|
||||
return _center.clone();
|
||||
}
|
||||
|
||||
public boolean hasWinner()
|
||||
{
|
||||
return !Completed.isEmpty();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,140 @@
|
||||
package nautilus.game.arcade.game.games.mineware;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public abstract class ChallengeSeperateRooms extends Challenge
|
||||
{
|
||||
private HashMap<String, Integer[]> _borders = new HashMap<String, Integer[]>();
|
||||
private HashMap<Location, Integer[]> _spawns = new HashMap<Location, Integer[]>();
|
||||
private double _borderX, _borderZ;
|
||||
|
||||
public ChallengeSeperateRooms(MineWare host, ChallengeType challengeType, String challengeName)
|
||||
{
|
||||
super(host, challengeType, challengeName);
|
||||
}
|
||||
|
||||
public void assignRooms()
|
||||
{
|
||||
for (Player player : getChallengers())
|
||||
{
|
||||
for (Entry<Location, Integer[]> entry : _spawns.entrySet())
|
||||
{
|
||||
if (entry.getKey().distance(player.getLocation()) < 1)
|
||||
{
|
||||
_borders.put(player.getName(), entry.getValue());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public final void generateRoom()
|
||||
{
|
||||
int size = getChallengers().size();
|
||||
|
||||
int x = 1;
|
||||
int z = 1;
|
||||
|
||||
while (size > x * z)
|
||||
{
|
||||
if (x > z)
|
||||
{
|
||||
z++;
|
||||
}
|
||||
else
|
||||
{
|
||||
x++;
|
||||
}
|
||||
}
|
||||
|
||||
_borderX = (x * getBorderX()) + (x * getDividersX());
|
||||
_borderZ = (z * getBorderZ()) + (z * getDividersZ());
|
||||
_borderX /= 2;
|
||||
_borderZ /= 2;
|
||||
_borderX = Math.ceil(_borderX);
|
||||
_borderZ = Math.ceil(_borderZ);
|
||||
|
||||
int players = 0;
|
||||
|
||||
for (int x1 = 0; x1 < x; x1++)
|
||||
{
|
||||
for (int z1 = 0; z1 < z; z1++)
|
||||
{
|
||||
if (++players > size)
|
||||
continue;
|
||||
|
||||
double lX = (x1 * getBorderX()) + (x1 * getDividersX());
|
||||
double lZ = (z1 * getBorderZ()) + (z1 * getDividersZ());
|
||||
lX -= _borderX;
|
||||
lZ -= _borderZ;
|
||||
|
||||
Location loc = getCenter().clone().add(lX, 0, lZ);
|
||||
|
||||
generateRoom(loc.clone());
|
||||
|
||||
_spawns.put(getSpawn(loc.clone()), new Integer[]
|
||||
{
|
||||
loc.getBlockX(), loc.getBlockX() + getBorderX(),
|
||||
|
||||
loc.getBlockY(), loc.getBlockY() + getBorderY(),
|
||||
|
||||
loc.getBlockZ(), loc.getBlockZ() + getBorderZ()
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void StartOrder()
|
||||
{
|
||||
super.StartOrder();
|
||||
|
||||
setBorder((int) -Math.ceil(_borderX), (int) Math.ceil(_borderX), 0, 256, (int) -Math.ceil(_borderZ),
|
||||
(int) Math.ceil(_borderZ));
|
||||
}
|
||||
|
||||
public abstract void generateRoom(Location loc);
|
||||
|
||||
public abstract int getBorderX();
|
||||
|
||||
public abstract int getBorderY();
|
||||
|
||||
public abstract int getBorderZ();
|
||||
|
||||
public abstract int getDividersX();
|
||||
|
||||
public abstract int getDividersZ();
|
||||
|
||||
public Location getSpawn(Location roomLocation)
|
||||
{
|
||||
return roomLocation.clone().add(getBorderX() / 2D, 1, getBorderZ() / 2D);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Location> getSpawns()
|
||||
{
|
||||
return new ArrayList<Location>(_spawns.keySet());
|
||||
}
|
||||
|
||||
public boolean isInsideMap(Player player)
|
||||
{
|
||||
Location loc = player.getLocation();
|
||||
|
||||
if (!_borders.containsKey(player.getName()) || UtilPlayer.isSpectator(player))
|
||||
{
|
||||
return super.isInsideMap(player);
|
||||
}
|
||||
|
||||
Integer[] borders = _borders.get(player.getName());
|
||||
|
||||
return !(loc.getX() >= borders[1] + 1 || loc.getX() <= borders[0] || loc.getZ() >= borders[5] + 1
|
||||
|| loc.getZ() <= borders[4] || loc.getY() >= borders[3] + 1 || loc.getY() <= borders[2]);
|
||||
}
|
||||
|
||||
}
|
@ -1,155 +1,193 @@
|
||||
package nautilus.game.arcade.game.games.mineware;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Chicken;
|
||||
import org.bukkit.entity.Cow;
|
||||
import org.bukkit.entity.Creature;
|
||||
import org.bukkit.entity.Ghast;
|
||||
import org.bukkit.entity.Pig;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Sheep;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.SoloGame;
|
||||
import nautilus.game.arcade.game.games.mineware.order.Order;
|
||||
import nautilus.game.arcade.game.games.mineware.random.*;
|
||||
import nautilus.game.arcade.game.games.runner.kits.KitLeaper;
|
||||
import nautilus.game.arcade.game.GameTeam.PlayerState;
|
||||
import nautilus.game.arcade.game.games.holeinwall.KitNormal;
|
||||
import nautilus.game.arcade.game.games.mineware.challenges.*;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
|
||||
public class MineWare extends SoloGame
|
||||
{
|
||||
private HashMap<Player, Integer> _lives = new HashMap<Player, Integer>();
|
||||
private HashSet<Player> _killed = new HashSet<Player>();
|
||||
|
||||
private Order _order = null;
|
||||
private Challenge _order;
|
||||
private ArrayList<Block> _lastOrderBlocks;
|
||||
private long _orderTime = 0;
|
||||
private int _orderCount = 0;
|
||||
private boolean _orderWaiting;
|
||||
|
||||
private ArrayList<Order> _orders = new ArrayList<Order>();
|
||||
private ArrayList<Order> _ordersCopy = new ArrayList<Order>();
|
||||
private ArrayList<Class<? extends Challenge>> _orders = new ArrayList<Class<? extends Challenge>>();
|
||||
private ArrayList<Class<? extends Challenge>> _ordersCopy = new ArrayList<Class<? extends Challenge>>();
|
||||
|
||||
private Location _ghastLoc = null;
|
||||
private Location _ghastTarget = null;
|
||||
private Ghast _ghast = null;
|
||||
private ArrayList<Location> _mobLocs = new ArrayList<Location>();
|
||||
private ArrayList<Creature> _mobs = new ArrayList<Creature>();
|
||||
|
||||
public MineWare(ArcadeManager manager)
|
||||
public MineWare(ArcadeManager manager, String justSoError)
|
||||
{
|
||||
super(manager, GameType.MineWare,
|
||||
|
||||
new Kit[]
|
||||
{
|
||||
new KitLeaper(manager),
|
||||
new KitNormal(manager),
|
||||
},
|
||||
|
||||
new String[]
|
||||
{
|
||||
"Follow the orders given in chat!",
|
||||
"First half to follow it win the round.",
|
||||
"Other players lose one life.",
|
||||
"Follow the orders given in chat!", "First half to follow it win the round.", "Other players lose one life.",
|
||||
"Last player with lives wins!"
|
||||
});
|
||||
|
||||
this.PrepareFreeze = false;
|
||||
|
||||
this.DamagePvP = false;
|
||||
|
||||
this.BlockPlace = true;
|
||||
this.BlockBreak = true;
|
||||
|
||||
this.ItemDrop = true;
|
||||
this.ItemPickup = true;
|
||||
|
||||
InventoryOpenBlock = true;
|
||||
InventoryOpenChest = true;
|
||||
DamagePvE = false;
|
||||
DamageEvP = false;
|
||||
DamageFall = false;
|
||||
InventoryClick = true;
|
||||
DamageSelf = false;
|
||||
DeathOut = false;
|
||||
|
||||
Manager.GetCreature().SetDisableCustomDrops(true);
|
||||
|
||||
PopulateOrders();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ParseData()
|
||||
public void EndCheck()
|
||||
{
|
||||
_ghastLoc = WorldData.GetDataLocs("WHITE").get(0);
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
while (_mobLocs.size() < 100)
|
||||
int living = 0;
|
||||
|
||||
for (Player player : GetPlayers(false))
|
||||
{
|
||||
Location loc = WorldData.GetRandomXZ();
|
||||
|
||||
while (UtilBlock.airFoliage(loc.getBlock()))
|
||||
loc.add(0, -1, 0);
|
||||
|
||||
Material mat = loc.getBlock().getType();
|
||||
|
||||
if (mat == Material.STONE ||
|
||||
mat == Material.GRASS ||
|
||||
mat == Material.SAND)
|
||||
_mobLocs.add(loc);
|
||||
if (_lives.containsKey(player) && _lives.get(player) > 0)
|
||||
{
|
||||
System.out.print(player.getName() + " is living");
|
||||
living++;
|
||||
}
|
||||
}
|
||||
|
||||
if (living <= 1)
|
||||
{
|
||||
SetState(GameState.End);
|
||||
System.out.print("End game");
|
||||
AnnounceEnd(getWinners());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInsideMap(Player player)
|
||||
{
|
||||
if (_order != null)
|
||||
{
|
||||
return _order.isInsideMap(player);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onLive(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Live)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UtilServer.getServer().getPluginManager().registerEvents(_order, Manager.getPlugin());
|
||||
|
||||
if (_order instanceof ChallengeSeperateRooms)
|
||||
{
|
||||
((ChallengeSeperateRooms) _order).assignRooms();
|
||||
}
|
||||
|
||||
_order.StartOrder();
|
||||
|
||||
sayChallenge(_order);
|
||||
}
|
||||
|
||||
public void PopulateOrders()
|
||||
{
|
||||
_orders.add(new ActionMilkCow(this));
|
||||
_orders.add(new ActionShearSheep(this));
|
||||
|
||||
_orders.add(new CraftLadder(this));
|
||||
_orders.add(new CraftStoneShovel(this));
|
||||
|
||||
_orders.add(new DamageChicken(this));
|
||||
_orders.add(new DamageFall(this));
|
||||
_orders.add(new DamageGhast(this));
|
||||
|
||||
_orders.add(new GatherCobble(this));
|
||||
_orders.add(new GatherRedFlower(this));
|
||||
_orders.add(new GatherYellowFlower(this));
|
||||
_orders.add(new GatherSand(this));
|
||||
|
||||
_orders.add(new PlaceDoor(this));
|
||||
|
||||
_orders.add(new RideBoat(this));
|
||||
_orders.add(new RidePig(this));
|
||||
|
||||
_orders.add(new StandAlone(this));
|
||||
_orders.add(new StandShelter(this));
|
||||
_orders.add(new StandStone(this));
|
||||
_orders.add(new StandWater(this));
|
||||
//_orders.add(ChallengeShootChickens.class);
|
||||
//_orders.add(ChallengeStandOnColor.class);
|
||||
_orders.add(ChallengePickASide.class);
|
||||
//_orders.add(ChallengeMilkACow.class);
|
||||
_orders.add(ChallengeHitTargets.class);
|
||||
_orders.add(ChallengeNavigateMaze.class);
|
||||
//_orders.add(ChallengeDragonEgg.class);
|
||||
_orders.add(ChallengeBlockShot.class);
|
||||
//_orders.add(ChallengeChestLoot.class);
|
||||
_orders.add(ChallengeLavaRun.class);
|
||||
}
|
||||
|
||||
public Order GetOrder()
|
||||
public Challenge GetOrder()
|
||||
{
|
||||
for (int i = 0; i < _orders.size() * 4; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_ordersCopy.isEmpty())
|
||||
{
|
||||
for (Order order : _orders)
|
||||
_ordersCopy.addAll(_orders);
|
||||
}
|
||||
|
||||
Challenge challenge = _ordersCopy.remove(UtilMath.r(_ordersCopy.size())).getConstructor(MineWare.class)
|
||||
.newInstance(this);
|
||||
|
||||
if (getChallengers().size() >= challenge.getMinPlayers())
|
||||
{
|
||||
_ordersCopy.add(order);
|
||||
System.out.print("Using challenge " + challenge.getClass().getSimpleName());
|
||||
return challenge;
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.print("Cannot use challenge " + challenge.getClass().getSimpleName() + ", not enough players");
|
||||
|
||||
}
|
||||
}
|
||||
catch (InvocationTargetException ex)
|
||||
{
|
||||
ex.getCause().printStackTrace();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return _ordersCopy.remove(UtilMath.r(_ordersCopy.size()));
|
||||
return null;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
@ -159,7 +197,104 @@ public class MineWare extends SoloGame
|
||||
return;
|
||||
|
||||
for (Player player : GetPlayers(true))
|
||||
_lives.put(player, 10);
|
||||
_lives.put(player, 5); // TODO
|
||||
|
||||
_order = GetOrder();
|
||||
_order.generateRoom();
|
||||
|
||||
GetTeamList().get(0).SetSpawns(_order.getSpawns());
|
||||
SpectatorSpawn = UtilWorld.averageLocation(_order.getSpawns()).add(0, 7, 0);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDamage(CustomDamageEvent event)
|
||||
{
|
||||
event.SetDamageToLevel(false);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDeath(PlayerDeathEvent event)
|
||||
{
|
||||
_killed.add(event.getEntity());
|
||||
|
||||
if (_order == null)
|
||||
return;
|
||||
|
||||
LoseLife(event.getEntity(), true);
|
||||
}
|
||||
|
||||
public boolean IsAlive(Entity entity)
|
||||
{
|
||||
if (_killed.contains(entity))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return super.IsAlive(entity);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onQuit(PlayerQuitEvent event)
|
||||
{
|
||||
_lives.remove(event.getPlayer());
|
||||
}
|
||||
|
||||
public ArrayList<Player> getChallengers()
|
||||
{
|
||||
ArrayList<Player> challengers = new ArrayList<Player>();
|
||||
|
||||
for (Player player : GetPlayers(false))
|
||||
{
|
||||
if (!UtilPlayer.isSpectator(player))
|
||||
{
|
||||
challengers.add(player);
|
||||
}
|
||||
}
|
||||
|
||||
return challengers;
|
||||
}
|
||||
|
||||
public void sayChallenge(Challenge challenge)
|
||||
{
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
player.playSound(player.getLocation(), Sound.NOTE_PLING, 1f, 1f);
|
||||
|
||||
UtilPlayer.message(player,
|
||||
C.cYellow + C.Bold + (IsAlive(player) ? challenge.getMessage(player) : challenge.GetOrder()));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInteract(PlayerInteractEvent event)
|
||||
{
|
||||
if (!_orderWaiting)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void PlayerMoveCancel(PlayerMoveEvent event)
|
||||
{
|
||||
if (!PrepareFreeze)
|
||||
return;
|
||||
|
||||
if (!_orderWaiting)
|
||||
return;
|
||||
|
||||
if (!IsAlive(event.getPlayer()))
|
||||
return;
|
||||
|
||||
if (UtilMath.offset2d(event.getFrom(), event.getTo()) <= 0)
|
||||
return;
|
||||
|
||||
event.getFrom().setPitch(event.getTo().getPitch());
|
||||
event.getFrom().setYaw(event.getTo().getYaw());
|
||||
|
||||
event.setTo(event.getFrom());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -174,29 +309,75 @@ public class MineWare extends SoloGame
|
||||
// New Order
|
||||
if (_order == null)
|
||||
{
|
||||
if (!UtilTime.elapsed(_orderTime, 1000))
|
||||
if (!UtilTime.elapsed(_orderTime, 1500))
|
||||
return;
|
||||
|
||||
for (Player player : GetPlayers(false))
|
||||
{
|
||||
if (_killed.contains(player) && _lives.get(player) > 0)
|
||||
{
|
||||
Manager.Clear(player);
|
||||
}
|
||||
}
|
||||
|
||||
_killed.clear();
|
||||
|
||||
_order = GetOrder();
|
||||
|
||||
if (_order == null)
|
||||
{
|
||||
System.out.println("No challenge suitable");
|
||||
SetState(GameState.Dead);
|
||||
return;
|
||||
}
|
||||
|
||||
//Register
|
||||
UtilServer.getServer().getPluginManager().registerEvents(_order, Manager.getPlugin());
|
||||
_order.StartOrder(_orderCount++);
|
||||
for (Block block : _lastOrderBlocks)
|
||||
{
|
||||
if (block.getState() instanceof InventoryHolder)
|
||||
{
|
||||
((InventoryHolder) block.getState()).getInventory().clear();
|
||||
}
|
||||
|
||||
Announce(C.cYellow + C.Bold + _order.GetOrder().toUpperCase());
|
||||
block.setTypeIdAndData(Material.AIR.getId(), (byte) 0, false);
|
||||
}
|
||||
|
||||
_order.generateRoom();
|
||||
|
||||
GetTeamList().get(0).SetSpawns(_order.getSpawns());
|
||||
SpectatorSpawn = UtilWorld.averageLocation(_order.getSpawns()).add(0, 7, 0);
|
||||
|
||||
for (Player player : getChallengers())
|
||||
{
|
||||
player.teleport(GetTeamList().get(0).GetSpawn());
|
||||
}
|
||||
|
||||
if (_order instanceof ChallengeSeperateRooms)
|
||||
{
|
||||
((ChallengeSeperateRooms) _order).assignRooms();
|
||||
}
|
||||
|
||||
_orderTime = System.currentTimeMillis();
|
||||
_orderWaiting = true;
|
||||
/* XXX
|
||||
GetObjectiveSide().setDisplayName(
|
||||
ChatColor.WHITE + "§lMineWare " + C.cGreen + "§l"
|
||||
+ "Round " + _orderCount);
|
||||
*/
|
||||
}
|
||||
else if (_orderWaiting)
|
||||
{
|
||||
if (!UtilTime.elapsed(_orderTime, 1000))
|
||||
return;
|
||||
|
||||
_orderWaiting = false;
|
||||
|
||||
_order.StartOrder();
|
||||
|
||||
// Register
|
||||
UtilServer.getServer().getPluginManager().registerEvents(_order, Manager.getPlugin());
|
||||
|
||||
sayChallenge(_order);
|
||||
}
|
||||
// Update Order
|
||||
else
|
||||
{
|
||||
@ -204,25 +385,36 @@ public class MineWare extends SoloGame
|
||||
{
|
||||
_orderTime = System.currentTimeMillis();
|
||||
|
||||
if (_order.PlayerHasCompleted())
|
||||
for (Player player : getChallengers())
|
||||
{
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
if (!_order.IsCompleted(player))
|
||||
{
|
||||
LoseLife(player);
|
||||
UtilInv.Clear(player);
|
||||
|
||||
if (IsAlive(player))
|
||||
_order.FailItems(player);
|
||||
if (_order.hasWinner() && !_order.IsCompleted(player))
|
||||
{
|
||||
LoseLife(player, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Deregister
|
||||
HandlerList.unregisterAll(_order);
|
||||
|
||||
_order.EndOrder();
|
||||
|
||||
_lastOrderBlocks = new ArrayList<Block>(_order.getModifiedBlocks());
|
||||
// Remove blocks from top to bottom, prevents blocks popping off.
|
||||
Collections.sort(_lastOrderBlocks, new Comparator<Block>()
|
||||
{
|
||||
|
||||
@Override
|
||||
public int compare(Block o1, Block o2)
|
||||
{
|
||||
return new Integer(o2.getY()).compareTo(o1.getY());
|
||||
}
|
||||
});
|
||||
|
||||
_order = null;
|
||||
|
||||
EndCheck();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -241,13 +433,10 @@ public class MineWare extends SoloGame
|
||||
if (!_lives.containsKey(player))
|
||||
return 0;
|
||||
|
||||
if (!IsAlive(player))
|
||||
return 0;
|
||||
|
||||
return _lives.get(player);
|
||||
}
|
||||
|
||||
private void LoseLife(Player player)
|
||||
public void LoseLife(Player player, boolean isDeath)
|
||||
{
|
||||
int lives = GetLives(player) - 1;
|
||||
|
||||
@ -260,82 +449,19 @@ public class MineWare extends SoloGame
|
||||
_lives.put(player, lives);
|
||||
}
|
||||
else
|
||||
{
|
||||
{System.out.print(player.getName() + " list");
|
||||
UtilPlayer.message(player, C.cRed + C.Bold + "You are out of the game!");
|
||||
player.playSound(player.getLocation(), Sound.EXPLODE, 2f, 1f);
|
||||
|
||||
player.damage(5000);
|
||||
|
||||
Scoreboard.ResetScore(player.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void UpdateMobs(UpdateEvent event)
|
||||
SetPlayerState(player, PlayerState.OUT);
|
||||
|
||||
if (!isDeath)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
if (!InProgress())
|
||||
return;
|
||||
|
||||
Iterator<Creature> mobIterator = _mobs.iterator();
|
||||
|
||||
while (mobIterator.hasNext())
|
||||
{
|
||||
Creature mob = mobIterator.next();
|
||||
|
||||
if (!mob.isValid())
|
||||
{
|
||||
mob.remove();
|
||||
mobIterator.remove();
|
||||
Manager.addSpectator(player, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (_mobs.size() < 200)
|
||||
{
|
||||
Location loc = _mobLocs.get(UtilMath.r(_mobLocs.size())).clone().add(new Vector(0.5,1,0.5));
|
||||
double r = Math.random();
|
||||
|
||||
this.CreatureAllowOverride = true;
|
||||
|
||||
if (r > 0.75) _mobs.add(loc.getWorld().spawn(loc, Pig.class));
|
||||
else if (r > 0.5) _mobs.add(loc.getWorld().spawn(loc, Cow.class));
|
||||
else if (r > 0.25) _mobs.add(loc.getWorld().spawn(loc, Chicken.class));
|
||||
else _mobs.add(loc.getWorld().spawn(loc, Sheep.class));
|
||||
|
||||
this.CreatureAllowOverride = false;
|
||||
}
|
||||
|
||||
if (_ghast == null || !_ghast.isValid())
|
||||
{
|
||||
if (_ghast != null)
|
||||
_ghast.remove();
|
||||
|
||||
this.CreatureAllowOverride = true;
|
||||
_ghast = _ghastLoc.getWorld().spawn(_ghastLoc, Ghast.class);
|
||||
this.CreatureAllowOverride = false;
|
||||
|
||||
_ghast.setMaxHealth(10000);
|
||||
_ghast.setHealth(_ghast.getMaxHealth());
|
||||
}
|
||||
else
|
||||
{
|
||||
//New Target
|
||||
if (_ghastTarget == null || UtilMath.offset(_ghast.getLocation(), _ghastTarget) < 5)
|
||||
{
|
||||
_ghastTarget = _ghastLoc.clone().add(40 - 80*Math.random(), -20*Math.random(), 40 - 80*Math.random());
|
||||
}
|
||||
|
||||
_ghast.teleport(_ghast.getLocation().add(UtilAlg.getTrajectory(_ghast.getLocation(), _ghastTarget).multiply(0.1)));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void GhastTarget(EntityTargetEvent event)
|
||||
{
|
||||
if (event.getEntity().equals(_ghast))
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -0,0 +1,185 @@
|
||||
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.UtilAlg;
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
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.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.FireworkEffect.Type;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.material.Wool;
|
||||
import org.bukkit.projectiles.ProjectileSource;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class ChallengeBlockShot extends Challenge
|
||||
{
|
||||
private HashMap<String, Integer> _shotBlocks = new HashMap<String, Integer>();
|
||||
private ArrayList<Location> _spawns = new ArrayList<Location>();
|
||||
private ArrayList<Entity> _arrows = new ArrayList<Entity>();
|
||||
|
||||
public ChallengeBlockShot(MineWare host)
|
||||
{
|
||||
super(host, ChallengeType.FirstComplete, "Shoot down 5 blocks");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Location> getSpawns()
|
||||
{
|
||||
return _spawns;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onShoot(ProjectileLaunchEvent event)
|
||||
{
|
||||
_arrows.add(event.getEntity());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanupRoom()
|
||||
{
|
||||
for (Entity arrow : _arrows)
|
||||
{
|
||||
arrow.remove();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onProjectileHit(final ProjectileHitEvent event)
|
||||
{
|
||||
event.getEntity().remove();
|
||||
|
||||
new BukkitRunnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
ProjectileSource shooter = event.getEntity().getShooter();
|
||||
|
||||
if (shooter != null && shooter instanceof Player)
|
||||
{
|
||||
Player player = (Player) shooter;
|
||||
|
||||
for (double x = -0.5; x <= 0.5; x++)
|
||||
{
|
||||
for (double y = -0.5; y <= 0.5; y++)
|
||||
{
|
||||
for (double z = -0.5; z <= 0.5; z++)
|
||||
{
|
||||
Block block = event.getEntity().getLocation().add(x, y, z).getBlock();
|
||||
|
||||
if (block.getType() == Material.WOOL)
|
||||
{
|
||||
int score = _shotBlocks.get(player.getName()) + 1;
|
||||
|
||||
_shotBlocks.put(player.getName(), score);
|
||||
|
||||
Location sloc = player.getEyeLocation();
|
||||
sloc.add(UtilAlg.getTrajectory(sloc, block.getLocation().add(0.5, 0.5, 0.5)).multiply(
|
||||
Math.min(7, block.getLocation().distance(sloc))));
|
||||
|
||||
displayCount(player, sloc, (score >= 5 ? C.cDGreen : score >= 3 ? C.cGreen
|
||||
: score >= 1 ? C.cRed : C.cDRed)
|
||||
+ score);
|
||||
|
||||
if (score == 5)
|
||||
{
|
||||
SetCompleted(player);
|
||||
}
|
||||
|
||||
Location loc = block.getLocation().add(0.5, 0.5, 0.5);
|
||||
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, loc, 0, 0, 0, 0, 1, ViewDist.MAX,
|
||||
UtilServer.getPlayers());
|
||||
|
||||
spawnBlock();
|
||||
|
||||
Wool wool = new Wool(block.getType(), block.getData());
|
||||
|
||||
UtilFirework.playFirework(loc, Type.BALL, wool.getColor().getColor(), true, true);
|
||||
|
||||
block.setTypeIdAndData(Material.AIR.getId(), (byte) 0, false);
|
||||
|
||||
addBlock(block);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}.runTaskLater(Host.Manager.getPlugin(), 0);
|
||||
}
|
||||
|
||||
private void spawnBlock()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
Block block = getCenter().add(UtilMath.r(40) - 20, 10 + UtilMath.r(10), UtilMath.r(40) - 20).getBlock();
|
||||
|
||||
if (block.getType() == Material.AIR)
|
||||
{
|
||||
block.setType(Material.WOOL);
|
||||
block.setData((byte) UtilMath.r(16));
|
||||
addBlock(block);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupPlayers()
|
||||
{
|
||||
setBorder(-16, 16, 0, 20, -16, 16);
|
||||
|
||||
for (Player player : Host.GetPlayers(true))
|
||||
{
|
||||
player.getInventory().setItem(0,
|
||||
new ItemBuilder(Material.BOW).addEnchantment(Enchantment.ARROW_INFINITE, 1).setUnbreakable(true).build());
|
||||
player.getInventory().setItem(9, new ItemStack(Material.ARROW));
|
||||
|
||||
_shotBlocks.put(player.getName(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateRoom()
|
||||
{
|
||||
for (Location loc : UtilShapes.getPointsInCircle(getCenter(), getChallengers().size(), 10))
|
||||
{
|
||||
loc = loc.getBlock().getLocation().add(0.5, 7.1, 0.5);
|
||||
_spawns.add(loc);
|
||||
|
||||
Block block = loc.getBlock().getRelative(BlockFace.DOWN);
|
||||
block.setType(Material.DOUBLE_STEP);
|
||||
block.setData((byte) 8);
|
||||
addBlock(block);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 18; i++)
|
||||
{
|
||||
spawnBlock();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package nautilus.game.arcade.game.games.mineware.challenges;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import nautilus.game.arcade.game.games.mineware.ChallengeSeperateRooms;
|
||||
import nautilus.game.arcade.game.games.mineware.MineWare;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class ChallengeBuildBuilding extends ChallengeSeperateRooms
|
||||
{
|
||||
private ArrayList<Material> _materials = new ArrayList<Material>();
|
||||
private HashMap<Location, Material> _build = new HashMap<Location, Material>();
|
||||
|
||||
public ChallengeBuildBuilding(MineWare host, String challengeName)
|
||||
{
|
||||
super(host, ChallengeType.FirstComplete, "Replicate the building!");
|
||||
|
||||
for (int x = 0; x < 3; x++)
|
||||
{
|
||||
for (int y = 0; y < 5; y++)
|
||||
{
|
||||
for (int z = 0; z < 3; z++)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateRoom(Location loc)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBorderX()
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBorderY()
|
||||
{
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBorderZ()
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDividersX()
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDividersZ()
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanupRoom()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupPlayers()
|
||||
{
|
||||
for (Player player : getChallengers())
|
||||
{
|
||||
player.setGameMode(GameMode.CREATIVE);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,127 @@
|
||||
package nautilus.game.arcade.game.games.mineware.challenges;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
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.block.BlockFace;
|
||||
import org.bukkit.block.Chest;
|
||||
import org.bukkit.block.DoubleChest;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class ChallengeChestLoot extends Challenge
|
||||
{
|
||||
public ChallengeChestLoot(MineWare host)
|
||||
{
|
||||
super(host, ChallengeType.FirstComplete, "Find a diamond in the chests");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Location> getSpawns()
|
||||
{
|
||||
ArrayList<Location> spawns = new ArrayList<Location>();
|
||||
|
||||
for (int x = -7; x <= 7; x++)
|
||||
{
|
||||
for (int z = -7; z <= 7; z++)
|
||||
{
|
||||
if (x % 2 == 0 && z % 2 == 0)
|
||||
{
|
||||
spawns.add(getCenter().clone().add(x, 2.1, z));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return spawns;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanupRoom()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupPlayers()
|
||||
{
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryClick(InventoryClickEvent event)
|
||||
{
|
||||
if (!(event.getInventory().getHolder() instanceof Player))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
|
||||
if (event.getInventory().getHolder() instanceof DoubleChest || event.getInventory().getHolder() instanceof Chest)
|
||||
{
|
||||
if (event.getCurrentItem() != null && event.getCurrentItem().getType() == Material.DIAMOND)
|
||||
{
|
||||
event.setCurrentItem(new ItemStack(Material.AIR));
|
||||
SetCompleted((Player) event.getWhoClicked());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateRoom()
|
||||
{
|
||||
ArrayList<Inventory> invs = new ArrayList<Inventory>();
|
||||
|
||||
for (int x = -7; x <= 7; x++)
|
||||
{
|
||||
for (int z = -7; z <= 7; z++)
|
||||
{
|
||||
Block b = getCenter().getBlock().getRelative(x, 1, z);
|
||||
|
||||
if (Math.abs(x) % 2 == 0 && Math.abs(z) % 2 == 0)
|
||||
{
|
||||
b.setType(Material.CHEST);
|
||||
|
||||
Inventory inventory = ((Chest) b.getState()).getInventory();
|
||||
invs.add(inventory);
|
||||
|
||||
for (int i = 0; i < inventory.getSize(); i++)
|
||||
{
|
||||
ItemStack item = new ItemStack(Material.values()[UtilMath.r(Material.values().length)]);
|
||||
|
||||
if (item.getType() == Material.DIAMOND || item.getType() == Material.AIR)
|
||||
{
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
|
||||
inventory.setItem(i, item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
b.setType(Material.STAINED_CLAY);
|
||||
b.setData((byte) UtilMath.r(16));
|
||||
|
||||
Block block = b.getRelative(BlockFace.UP);
|
||||
block.setType(Material.STAINED_CLAY);
|
||||
block.setData((byte) UtilMath.r(16));
|
||||
addBlock(block);
|
||||
}
|
||||
|
||||
addBlock(b);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 10 + getChallengers().size(); i++)
|
||||
{
|
||||
Inventory inv = invs.get(UtilMath.r(invs.size()));
|
||||
inv.setItem(UtilMath.r(inv.getSize()), new ItemStack(Material.DIAMOND));
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,171 @@
|
||||
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.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.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
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.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
public class ChallengeDragonEgg extends Challenge
|
||||
{
|
||||
private HashMap<String, Integer> _smashedEggs = new HashMap<String, Integer>();
|
||||
private ArrayList<Entity> _dragonEggs = new ArrayList<Entity>();
|
||||
|
||||
public ChallengeDragonEgg(MineWare host)
|
||||
{
|
||||
super(host, ChallengeType.FirstComplete, "Whack a dragon egg 10 times");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Location> getSpawns()
|
||||
{
|
||||
ArrayList<Location> spawns = new ArrayList<Location>();
|
||||
|
||||
for (int x = -14; x < 15; x++)
|
||||
{
|
||||
for (int z = -14; z < 15; z++)
|
||||
{
|
||||
if (x % 2 == 0 && z % 2 == 0)
|
||||
{
|
||||
spawns.add(getCenter().clone().add(x, 1.1, z));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return spawns;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockHit(PlayerInteractEvent event)
|
||||
{
|
||||
if (event.getAction() != Action.LEFT_CLICK_BLOCK && event.getAction() != Action.RIGHT_CLICK_BLOCK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (UtilPlayer.isSpectator(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Block block = event.getClickedBlock();
|
||||
|
||||
if (block.getType() != Material.DRAGON_EGG)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
block.setType(Material.AIR);
|
||||
addBlock(block);
|
||||
|
||||
UtilParticle.PlayParticle(ParticleType.PORTAL, block.getLocation().add(0.5, 0.5, 0.5), 0.5F, 0.5F, 0.5F, 0, 11,
|
||||
ViewDist.MAX, UtilServer.getPlayers());
|
||||
|
||||
Host.CreatureAllowOverride = true;
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
Block b = getCenter().clone().add(UtilMath.r(30) - 15, 1, UtilMath.r(30) - 15).getBlock();
|
||||
|
||||
if (b.getType() == Material.AIR)
|
||||
{
|
||||
Entity entity = getCenter().getWorld().spawnFallingBlock(b.getLocation().add(0.5, 2, 0.5), Material.DRAGON_EGG,
|
||||
(byte) 0);
|
||||
_dragonEggs.add(entity);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Host.CreatureAllowOverride = false;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
int score = _smashedEggs.get(player.getName()) + 1;
|
||||
|
||||
displayCount(player, block.getLocation().add(0.5, 1, 0.5), (score >= 10 ? C.cDGreen : score >= 7 ? C.cGreen
|
||||
: score >= 4 ? C.cRed : C.cDRed)
|
||||
+ score);
|
||||
|
||||
_smashedEggs.put(player.getName(), score);
|
||||
|
||||
if (score == 10)
|
||||
{
|
||||
SetCompleted(player);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanupRoom()
|
||||
{
|
||||
for (int x = -15; x <= 15; x++)
|
||||
{
|
||||
for (int z = -15; z <= 15; z++)
|
||||
{
|
||||
Block b = getCenter().getBlock().getRelative(x, 1, z);
|
||||
|
||||
addBlock(b);
|
||||
}
|
||||
}
|
||||
|
||||
for (Entity ent : _dragonEggs)
|
||||
{
|
||||
ent.remove();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupPlayers()
|
||||
{
|
||||
setBorder(-18, 18, 0, 20, -18, 18);
|
||||
|
||||
for (Player player : getChallengers())
|
||||
{
|
||||
_smashedEggs.put(player.getName(), 0);
|
||||
player.getInventory().setItem(0, new ItemBuilder(Material.IRON_AXE).setTitle(C.cWhite + "Egg Smasher").build());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateRoom()
|
||||
{
|
||||
for (int x = -15; x <= 15; x++)
|
||||
{
|
||||
for (int z = -15; z <= 15; z++)
|
||||
{
|
||||
Block b = getCenter().getBlock().getRelative(x, 0, z);
|
||||
b.setType(Material.WOOL);
|
||||
b.setData((byte) UtilMath.r(16));
|
||||
|
||||
addBlock(b);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 9; i++)
|
||||
{
|
||||
Block b = getCenter().getBlock().getRelative(UtilMath.r(30) - 15, 1, UtilMath.r(30) - 15);
|
||||
b.setType(Material.DRAGON_EGG);
|
||||
addBlock(b);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,156 @@
|
||||
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.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.game.games.mineware.Challenge;
|
||||
import nautilus.game.arcade.game.games.mineware.MineWare;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
public class ChallengeHitTargets extends Challenge
|
||||
{
|
||||
private HashMap<String, ArrayList<String>> _targets = new HashMap<String, ArrayList<String>>();
|
||||
private int _targetsEach;
|
||||
|
||||
public ChallengeHitTargets(MineWare host)
|
||||
{
|
||||
super(host, ChallengeType.FirstComplete, "Hit the chosen players");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDamage(CustomDamageEvent event)
|
||||
{
|
||||
if (UtilPlayer.isSpectator(event.GetDamageePlayer()))
|
||||
return;
|
||||
|
||||
if (!(event.GetDamageeEntity() instanceof Player))
|
||||
return;
|
||||
|
||||
Player p = event.GetDamageePlayer();
|
||||
|
||||
if (!_targets.containsKey(p.getName()))
|
||||
return;
|
||||
|
||||
String name = ((Player) event.GetDamageeEntity()).getName();
|
||||
|
||||
ArrayList<String> targets = _targets.get(p.getName());
|
||||
|
||||
if (!targets.remove(name))
|
||||
{
|
||||
p.playSound(p.getLocation(), Sound.NOTE_PLING, 1f, 1f);
|
||||
|
||||
UtilPlayer.message(p, "Hit the players " + StringUtils.join(targets, C.cWhite + C.Bold + ", " + C.cYellow + C.Bold));
|
||||
return;
|
||||
}
|
||||
|
||||
displayCount(p, event.GetDamageeEntity().getEyeLocation().add(0, 0.3, 0), (targets.isEmpty() ? C.cDGreen
|
||||
: targets.size() == 1 ? C.cRed : C.cDRed) + (_targetsEach - targets.size()));
|
||||
|
||||
if (targets.isEmpty())
|
||||
{
|
||||
SetCompleted(p);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage(Player player)
|
||||
{
|
||||
return "Hit the players "
|
||||
+ StringUtils.join(_targets.get(player.getName()), C.cWhite + C.Bold + ", " + C.cYellow + C.Bold);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinPlayers()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Location> getSpawns()
|
||||
{
|
||||
ArrayList<Location> spawns = new ArrayList<Location>();
|
||||
|
||||
for (int x = -8; x <= 8; x++)
|
||||
{
|
||||
for (int z = -8; z <= 8; z++)
|
||||
{
|
||||
if (x % 2 == 0 && z % 2 == 0)
|
||||
{
|
||||
spawns.add(getCenter().clone().add(x + 0.5, 1.1, z + 0.5));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return spawns;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanupRoom()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupPlayers()
|
||||
{
|
||||
ArrayList<Player> players = new ArrayList<Player>();
|
||||
|
||||
for (Player player : players)
|
||||
{
|
||||
ArrayList<String> names = new ArrayList<String>();
|
||||
|
||||
for (Player p : players)
|
||||
{
|
||||
if (p != player)
|
||||
{
|
||||
names.add(p.getName());
|
||||
}
|
||||
}
|
||||
|
||||
while (names.size() > 3)
|
||||
{
|
||||
names.remove(UtilMath.r(names.size()));
|
||||
}
|
||||
|
||||
_targetsEach = names.size();
|
||||
|
||||
_targets.put(player.getName(), names);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateRoom()
|
||||
{
|
||||
for (int x = -10; x <= 10; x++)
|
||||
{
|
||||
for (int z = -10; z <= 10; z++)
|
||||
{
|
||||
Block b = getCenter().clone().add(x, 0, z).getBlock();
|
||||
b.setType(Material.SMOOTH_BRICK);
|
||||
addBlock(b);
|
||||
|
||||
if (Math.abs(x) > 1 && Math.abs(x) < 9 && Math.abs(z) > 1 && Math.abs(z) < 9)
|
||||
{
|
||||
for (int y = 1; y < 3; y++)
|
||||
{
|
||||
Block block = b.getRelative(0, y, 0);
|
||||
block.setType(Material.SMOOTH_BRICK);
|
||||
block.setData((byte) (UtilMath.r(8) < 7 ? 0 : UtilMath.r(2) + 1));
|
||||
addBlock(block);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,179 @@
|
||||
package nautilus.game.arcade.game.games.mineware.challenges;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
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.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
public class ChallengeLavaRun extends Challenge
|
||||
{
|
||||
private long _delay;
|
||||
private Location _obsidian;
|
||||
|
||||
public ChallengeLavaRun(MineWare host)
|
||||
{
|
||||
super(host, ChallengeType.LastStanding, "The lava is coming! Stand on the obsidian!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Location> getSpawns()
|
||||
{
|
||||
ArrayList<Location> spawns = new ArrayList<Location>();
|
||||
|
||||
for (int x = -7; x <= 7; x++)
|
||||
{
|
||||
for (int z = -7; z <= 7; z++)
|
||||
{
|
||||
spawns.add(getCenter().clone().add(x + 0.5, 2, z + 0.5));
|
||||
}
|
||||
}
|
||||
|
||||
return spawns;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDamage(CustomDamageEvent event)
|
||||
{
|
||||
if (event.GetDamagerEntity(true) != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
event.AddMod("Ensure Death", null, 9999, false);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onTick(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!UtilTime.elapsed(_delay, 2000))
|
||||
return;
|
||||
|
||||
if (_obsidian == null)
|
||||
{
|
||||
_obsidian = getCenter().add(UtilMath.r(21) - 9.5, 1, UtilMath.r(21) - 9.5);
|
||||
|
||||
for (int x = -10; x <= 10; x++)
|
||||
{
|
||||
for (int z = -10; z <= 10; z++)
|
||||
{
|
||||
Block b = getCenter().getBlock().getRelative(x, 1, z);
|
||||
|
||||
b.setType(Material.GLASS);
|
||||
addBlock(b);
|
||||
}
|
||||
}
|
||||
|
||||
_obsidian.getBlock().setType(Material.OBSIDIAN);
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
player.playSound(player.getLocation(), Sound.NOTE_PIANO, 2f, 0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
ArrayList<Block> glassBlocks = new ArrayList<Block>();
|
||||
|
||||
for (int x = -10; x <= 10; x++)
|
||||
{
|
||||
for (int z = -10; z <= 10; z++)
|
||||
{
|
||||
Block b = getCenter().getBlock().getRelative(x, 1, z);
|
||||
|
||||
if (b.getType() == Material.GLASS)
|
||||
{
|
||||
glassBlocks.add(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (glassBlocks.isEmpty())
|
||||
{
|
||||
_delay = System.currentTimeMillis();
|
||||
_obsidian = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
final HashMap<Block, Double> distance = new HashMap<Block, Double>();
|
||||
|
||||
for (Block b : glassBlocks)
|
||||
{
|
||||
distance.put(b, b.getLocation().add(0.5, 0, 0.5).distance(_obsidian));
|
||||
}
|
||||
|
||||
Collections.sort(glassBlocks, new Comparator<Block>()
|
||||
{
|
||||
|
||||
@Override
|
||||
public int compare(Block o1, Block o2)
|
||||
{
|
||||
return distance.get(o2).compareTo(distance.get(o1));
|
||||
}
|
||||
});
|
||||
|
||||
for (int i = 0; i < Math.min(8, glassBlocks.size()); i++)
|
||||
{
|
||||
Block b = glassBlocks.remove(0);
|
||||
b.setTypeIdAndData(Material.AIR.getId(), (byte) 0, false);
|
||||
addBlock(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanupRoom()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupPlayers()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateRoom()
|
||||
{
|
||||
for (int x = -15; x <= 15; x++)
|
||||
{
|
||||
for (int z = -15; z <= 15; z++)
|
||||
{
|
||||
Block block = getCenter().getBlock().getRelative(x, 0, z);
|
||||
block.setType(Material.LAVA);
|
||||
addBlock(block);
|
||||
|
||||
if (Math.abs(x) <= 10 && Math.abs(z) <= 10)
|
||||
{
|
||||
Block b = block.getRelative(BlockFace.UP);
|
||||
b.setType(Material.GLASS);
|
||||
addBlock(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_obsidian = getCenter().add(UtilMath.r(21) - 9.5, 1, UtilMath.r(21) - 9.5);
|
||||
|
||||
_obsidian.getBlock().setType(Material.OBSIDIAN);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,241 @@
|
||||
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.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
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.block.Block;
|
||||
import org.bukkit.entity.Cow;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Villager;
|
||||
import org.bukkit.entity.Villager.Profession;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerItemConsumeEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class ChallengeMilkACow extends Challenge
|
||||
{
|
||||
private Villager _villager;
|
||||
private HashMap<Entity, ArrayList<String>> _milked = new HashMap<Entity, ArrayList<String>>();
|
||||
private HashMap<String, Integer> _score = new HashMap<String, Integer>();
|
||||
|
||||
public ChallengeMilkACow(MineWare host)
|
||||
{
|
||||
super(host, ChallengeType.FirstComplete, "Deliver 5 buckets of milk to the villager");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanupRoom()
|
||||
{
|
||||
for (Entity cow : _milked.keySet())
|
||||
{
|
||||
cow.remove();
|
||||
}
|
||||
|
||||
_villager.remove();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Damage(CustomDamageEvent event)
|
||||
{
|
||||
if (event.GetProjectile() == null)
|
||||
return;
|
||||
|
||||
Player player = event.GetDamagerPlayer(true);
|
||||
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
LivingEntity ent = event.GetDamageeEntity();
|
||||
|
||||
if (!(ent instanceof Player))
|
||||
{
|
||||
event.SetCancelled("Non-Combat Entity");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupPlayers()
|
||||
{
|
||||
setBorder(-16, 16, 0, 10, -16, 16);
|
||||
|
||||
for (Player player : Host.GetPlayers(true))
|
||||
{
|
||||
player.getInventory().setItem(0, new ItemStack(Material.BUCKET));
|
||||
_score.put(player.getName(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateRoom()
|
||||
{
|
||||
for (int x = -16; x <= 16; x++)
|
||||
{
|
||||
for (int z = -16; z <= 16; z++)
|
||||
{
|
||||
for (int y = 0; y <= 1; y++)
|
||||
{
|
||||
Block b = getCenter().getBlock().getRelative(x, y, z);
|
||||
|
||||
if (y == 0)
|
||||
{
|
||||
b.setType(Material.GRASS);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Math.abs(x) == 16 || Math.abs(z) == 16)
|
||||
{
|
||||
b.setType(Material.FENCE);
|
||||
}
|
||||
else if (UtilMath.r(4) == 0)
|
||||
{
|
||||
if (UtilMath.r(8) == 0)
|
||||
{
|
||||
b.setType(UtilMath.random.nextBoolean() ? Material.YELLOW_FLOWER : Material.RED_ROSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
b.setType(Material.LONG_GRASS);
|
||||
b.setData((byte) 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (b.getType() != Material.AIR)
|
||||
{
|
||||
addBlock(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Host.CreatureAllowOverride = true;
|
||||
_villager = (Villager) getCenter().getWorld().spawnEntity(getCenter().clone().add(0, 1, 0), EntityType.VILLAGER);
|
||||
_villager.setProfession(Profession.FARMER);
|
||||
String[] names = new String[]
|
||||
{
|
||||
"Tom", "Steve", "John", "Harry", "Andrew", "Daniel", "Jorge", "Jim"
|
||||
};
|
||||
|
||||
if (UtilMath.r(5) == 0)
|
||||
{
|
||||
names = new String[]
|
||||
{
|
||||
"Moosworth", "Mooington", "Mooley", "Moose", "Mooskee", "Chicken", "Mooffy", "Moozzle"
|
||||
};
|
||||
}
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
Location loc = getCenter().clone().add(UtilMath.r(26) - 13, 1, UtilMath.r(26) - 13);
|
||||
Cow cow = (Cow) loc.getWorld().spawnEntity(loc, EntityType.COW);
|
||||
|
||||
cow.setCustomName(C.cWhite + names[i]);
|
||||
cow.setCustomNameVisible(true);
|
||||
|
||||
_milked.put(cow, new ArrayList<String>());
|
||||
}
|
||||
|
||||
Host.CreatureAllowOverride = false;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEntityInteract(PlayerInteractEntityEvent event)
|
||||
{
|
||||
Player p = event.getPlayer();
|
||||
|
||||
if (UtilPlayer.isSpectator(p))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Host.IsLive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack item = p.getItemInHand();
|
||||
|
||||
if (item == null)
|
||||
return;
|
||||
|
||||
Entity ent = event.getRightClicked();
|
||||
|
||||
if (_milked.containsKey(ent))
|
||||
{
|
||||
if (item.getType() == Material.BUCKET)
|
||||
{
|
||||
if (!_milked.get(ent).contains(p.getName()))
|
||||
{
|
||||
p.setItemInHand(new ItemStack(Material.MILK_BUCKET));
|
||||
_milked.get(ent).add(p.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
p.updateInventory();
|
||||
}
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
else if (ent == _villager)
|
||||
{
|
||||
if (item.getType() == Material.MILK_BUCKET)
|
||||
{
|
||||
p.setItemInHand(new ItemStack(Material.BUCKET));
|
||||
p.playSound(p.getLocation(), Sound.ORB_PICKUP, 2, 0);
|
||||
int score = _score.get(p.getName()) + 1;
|
||||
_score.put(p.getName(), score);
|
||||
|
||||
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);
|
||||
|
||||
if (score == 5)
|
||||
{
|
||||
SetCompleted(p);
|
||||
}
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onConsume(PlayerItemConsumeEvent event)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
event.getPlayer().updateInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Location> getSpawns()
|
||||
{
|
||||
ArrayList<Location> spawns = new ArrayList<Location>();
|
||||
|
||||
for (int x = -13; x <= 13; x++)
|
||||
{
|
||||
for (int z = -13; z <= 13; z++)
|
||||
{
|
||||
if (x % 2 == 0 && z % 2 == 0)
|
||||
{
|
||||
spawns.add(getCenter().clone().add(x + 0.5, 1.1, z + 0.5));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return spawns;
|
||||
}
|
||||
}
|
@ -0,0 +1,246 @@
|
||||
package nautilus.game.arcade.game.games.mineware.challenges;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
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.block.BlockFace;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
public class ChallengeNavigateMaze extends Challenge
|
||||
{
|
||||
|
||||
public ChallengeNavigateMaze(MineWare host)
|
||||
{
|
||||
super(host, ChallengeType.FirstComplete, "Make it to the other side of the maze");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Location> getSpawns()
|
||||
{
|
||||
ArrayList<Location> spawns = new ArrayList<Location>();
|
||||
|
||||
for (int z = -9; z <= 12; z++)
|
||||
{
|
||||
Location loc = getCenter().clone().add(-16, 1.1, z);
|
||||
spawns.add(loc);
|
||||
}
|
||||
|
||||
return spawns;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onMove(PlayerMoveEvent event)
|
||||
{
|
||||
if (UtilPlayer.isSpectator(event.getPlayer()))
|
||||
return;
|
||||
|
||||
if (event.getTo().getY() >= 1 && event.getTo().getX() > 15)
|
||||
{
|
||||
SetCompleted(event.getPlayer());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanupRoom()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupPlayers()
|
||||
{
|
||||
setBorder(-20, 18, 0, 10, -20, 18);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateRoom()
|
||||
{
|
||||
for (int x = -18; x <= 20; x++)
|
||||
{
|
||||
for (int z = -12; z <= 15; z++)
|
||||
{
|
||||
Block b = getCenter().getBlock().getRelative(x, 0, z);
|
||||
|
||||
if (z == -12 || z == 15)
|
||||
{
|
||||
for (int y = 1; y <= 3; y++)
|
||||
{
|
||||
Block block = b.getRelative(0, y, 0);
|
||||
block.setType(Material.STONE);
|
||||
block.setData((byte) 0);
|
||||
addBlock(block);
|
||||
}
|
||||
}
|
||||
|
||||
if (x > 14 || x < -12)
|
||||
{
|
||||
b.setType(Material.WOOL);
|
||||
b.setData((byte) (x < 0 ? 14 : 13));
|
||||
}
|
||||
else
|
||||
{
|
||||
b.setType(Material.STONE);
|
||||
b.setData((byte) 0);
|
||||
|
||||
Block block = b.getRelative(0, 4, 0);
|
||||
|
||||
if (block.getX() == -12)
|
||||
{
|
||||
block.setType(Material.STONE);
|
||||
block.setData((byte) 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
block.setType(Material.STAINED_GLASS);
|
||||
block.setData((byte) 8);
|
||||
}
|
||||
|
||||
addBlock(block);
|
||||
}
|
||||
|
||||
addBlock(b);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 30; i++)
|
||||
{
|
||||
ArrayList<Block> mazeBlocks = generateMaze();
|
||||
|
||||
if (mazeValid())
|
||||
{
|
||||
for (Block b : mazeBlocks)
|
||||
{
|
||||
addBlock(b);
|
||||
}
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.print("Generated bad maze, trying again..");
|
||||
for (Block b : mazeBlocks)
|
||||
{
|
||||
b.setTypeIdAndData(Material.AIR.getId(), (byte) 0, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean mazeValid()
|
||||
{
|
||||
ArrayList<Block> blocks = new ArrayList<Block>();
|
||||
ArrayList<Block> nextLoop = new ArrayList<Block>();
|
||||
|
||||
nextLoop.add(getCenter().getBlock().getRelative(-15, 1, 0));
|
||||
|
||||
blocks.addAll(nextLoop);
|
||||
|
||||
while (!nextLoop.isEmpty())
|
||||
{
|
||||
Block block = nextLoop.remove(0);
|
||||
|
||||
for (BlockFace face : new BlockFace[]
|
||||
{
|
||||
BlockFace.EAST, BlockFace.WEST, BlockFace.SOUTH, BlockFace.NORTH
|
||||
})
|
||||
{
|
||||
Block b = block.getRelative(face);
|
||||
|
||||
if (blocks.contains(b))
|
||||
continue;
|
||||
|
||||
blocks.add(b);
|
||||
|
||||
if (b.getType() == Material.STONE || b.getX() < -14 || b.getZ() < -12 || b.getZ() > 15)
|
||||
continue;
|
||||
|
||||
if (b.getX() >= 15)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
nextLoop.add(b);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private ArrayList<Block> generateMaze()
|
||||
{
|
||||
ArrayList<Block> blocks = new ArrayList<Block>();
|
||||
int[][] maze = new MazeGenerator(10, 10).getMaze();
|
||||
|
||||
// Divisable by 2's are up and down walls
|
||||
// Other's are left and right. All walls have a corner block.
|
||||
|
||||
// This means I need to loop over all of the blocks, figure out if its a corner if yes then set block
|
||||
// Else if its a wall, then figure out if I'm making the wall or not
|
||||
for (int x = 1; x < 10; x++)
|
||||
{
|
||||
for (int z = 1; z < 10; z++)
|
||||
{
|
||||
Block b = getCenter().getBlock().getRelative((x - 5) * 3, 1, (z - 5) * 3);
|
||||
|
||||
for (int y = 0; y < 3; y++)
|
||||
{
|
||||
Block block = b.getRelative(0, y, 0);
|
||||
|
||||
if (block.getType() == Material.STONE)
|
||||
continue;
|
||||
|
||||
block.setType(Material.STONE);
|
||||
block.setData((byte) 0);
|
||||
blocks.add(block);
|
||||
}
|
||||
|
||||
// Set blocks for x
|
||||
if ((maze[x][z] & 8) == 0)
|
||||
{
|
||||
for (int i = 1; i <= 2; i++)
|
||||
{
|
||||
for (int y = 0; y < 3; y++)
|
||||
{
|
||||
Block block = b.getRelative(i, y, 0);
|
||||
|
||||
if (block.getType() == Material.STONE)
|
||||
continue;
|
||||
|
||||
block.setType(Material.STONE);
|
||||
block.setData((byte) 0);
|
||||
blocks.add(block);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Set blocks for z
|
||||
if ((maze[x][z] & 1) == 0)
|
||||
{
|
||||
for (int i = 1; i <= 2; i++)
|
||||
{
|
||||
for (int y = 0; y < 3; y++)
|
||||
{
|
||||
Block block = b.getRelative(0, y, i);
|
||||
|
||||
if (block.getType() == Material.STONE)
|
||||
continue;
|
||||
|
||||
block.setType(Material.STONE);
|
||||
block.setData((byte) 0);
|
||||
blocks.add(block);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return blocks;
|
||||
}
|
||||
}
|
@ -0,0 +1,193 @@
|
||||
package nautilus.game.arcade.game.games.mineware.challenges;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextBottom;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.game.games.mineware.Challenge;
|
||||
import nautilus.game.arcade.game.games.mineware.MineWare;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
public class ChallengePickASide extends Challenge
|
||||
{
|
||||
private long _stageExpires;
|
||||
private long _lastSound;
|
||||
private boolean _isFalling;
|
||||
|
||||
public ChallengePickASide(MineWare host)
|
||||
{
|
||||
super(host, ChallengeType.LastStanding, "Stand on the side with the least players! Don't be caught on the white blocks!");
|
||||
}
|
||||
|
||||
public int getMinPlayers()
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Location> getSpawns()
|
||||
{
|
||||
ArrayList<Location> spawns = new ArrayList<Location>();
|
||||
|
||||
for (int x = -8; x <= 8; x++)
|
||||
{
|
||||
for (int z = -8; z <= 8; z++)
|
||||
{
|
||||
if (x % 2 == 0 && z % 2 == 0)
|
||||
{
|
||||
spawns.add(getCenter().clone().add(x + 0.5, 1.1, z + 0.5));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return spawns;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanupRoom()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupPlayers()
|
||||
{
|
||||
setBorder(-10, 10, 0, 10, -10, 10);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void OnTick(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Host.IsLive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player[] players = getChallengers().toArray(new Player[0]);
|
||||
|
||||
if (_stageExpires < System.currentTimeMillis())
|
||||
{
|
||||
UtilTextBottom.displayProgress(0, players);
|
||||
|
||||
if (_isFalling)
|
||||
{
|
||||
_isFalling = false;
|
||||
_stageExpires = System.currentTimeMillis() + 1500;
|
||||
}
|
||||
else
|
||||
{
|
||||
_isFalling = true;
|
||||
_stageExpires = System.currentTimeMillis() + 4000;
|
||||
|
||||
ArrayList<Player> red = new ArrayList<Player>();
|
||||
ArrayList<Player> blue = new ArrayList<Player>();
|
||||
ArrayList<Player> misc = new ArrayList<Player>();
|
||||
|
||||
for (Player player : getChallengers())
|
||||
{
|
||||
Location loc = player.getLocation();
|
||||
|
||||
while (loc.getBlockY() > 0 && loc.getBlock().getType() != Material.STAINED_CLAY)
|
||||
{
|
||||
loc.add(0, -1, 0);
|
||||
}
|
||||
|
||||
byte data = loc.getBlock().getType() == Material.STAINED_CLAY ? loc.getBlock().getData() : 0;
|
||||
|
||||
if (data == 11)
|
||||
{
|
||||
red.add(player);
|
||||
}
|
||||
else if (data == 14)
|
||||
{
|
||||
blue.add(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
misc.add(player);
|
||||
}
|
||||
}
|
||||
|
||||
Host.Announce(C.cRed + "RED: " + red.size(), true);
|
||||
Host.Announce(C.cRed + "BLUE: " + blue.size(), false);
|
||||
|
||||
if (misc.size() > 0)
|
||||
{
|
||||
Host.Announce(C.cRed + "MISC: " + misc.size(), false);
|
||||
}
|
||||
|
||||
if (!red.isEmpty() && !blue.isEmpty())
|
||||
{
|
||||
if (red.size() < blue.size())
|
||||
{
|
||||
misc.addAll(blue);
|
||||
}
|
||||
else if (blue.size() < red.size())
|
||||
{
|
||||
misc.addAll(red);
|
||||
}
|
||||
|
||||
for (Player player : misc)
|
||||
{
|
||||
setLost(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!_isFalling)
|
||||
{
|
||||
UtilTextBottom.displayProgress((_stageExpires - System.currentTimeMillis()) / 8D, players);
|
||||
|
||||
if (_lastSound < System.currentTimeMillis())
|
||||
{
|
||||
_lastSound = System.currentTimeMillis() + 1000;
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
player.playSound(player.getLocation(), Sound.NOTE_STICKS, 1f, 1f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilTextBottom.displayProgress(0, players);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateRoom()
|
||||
{
|
||||
for (int x = -10; x <= 10; x++)
|
||||
{
|
||||
for (int z = -10; z <= 10; z++)
|
||||
{
|
||||
for (int y = 0; y <= 2; y++)
|
||||
{
|
||||
Block b = getCenter().getBlock().getRelative(x, y, z);
|
||||
|
||||
if (y == 0 || Math.abs(x) == 10 || Math.abs(z) == 10)
|
||||
{
|
||||
if (y > 0 && Math.abs(z) != 10)
|
||||
continue;
|
||||
|
||||
b.setType(Material.STAINED_CLAY);
|
||||
b.setData((byte) (z < 0 ? 11 : z > 0 ? 14 : 0));
|
||||
addBlock(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,232 @@
|
||||
package nautilus.game.arcade.game.games.mineware.challenges;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
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.Chicken;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class ChallengeShootChickens extends Challenge
|
||||
{
|
||||
private ArrayList<Chicken> _chickens = new ArrayList<Chicken>();
|
||||
private HashMap<String, Integer> _killedChickens = new HashMap<String, Integer>();
|
||||
private ArrayList<Projectile> _arrows = new ArrayList<Projectile>();
|
||||
|
||||
public ChallengeShootChickens(MineWare host)
|
||||
{
|
||||
super(host, ChallengeType.FirstComplete, "Shoot 6 chickens");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanupRoom()
|
||||
{
|
||||
for (Chicken chicken : _chickens)
|
||||
{
|
||||
chicken.remove();
|
||||
}
|
||||
|
||||
for (Projectile arrow : _arrows)
|
||||
{
|
||||
arrow.remove();
|
||||
}
|
||||
|
||||
Host.DamagePvE = false;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onShoot(ProjectileLaunchEvent event)
|
||||
{
|
||||
_arrows.add(event.getEntity());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDeath(EntityDeathEvent event)
|
||||
{
|
||||
event.getDrops().clear();
|
||||
event.setDroppedExp(0);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Damage(CustomDamageEvent event)
|
||||
{
|
||||
if (event.GetProjectile() == null)
|
||||
{
|
||||
event.SetCancelled("Not projectile damage");
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.GetDamagerPlayer(true);
|
||||
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
LivingEntity ent = event.GetDamageeEntity();
|
||||
|
||||
if (!_chickens.remove(ent))
|
||||
{
|
||||
event.SetCancelled("Not a chicken");
|
||||
return;
|
||||
}
|
||||
|
||||
event.AddMod("Ensure Death", null, 10, false);
|
||||
|
||||
int score = _killedChickens.get(player.getName()) + 1;
|
||||
|
||||
Location sloc = player.getEyeLocation();
|
||||
sloc.add(UtilAlg.getTrajectory(sloc, ent.getEyeLocation()).multiply(Math.min(7, ent.getLocation().distance(sloc))));
|
||||
|
||||
displayCount(player, sloc, (score >= 6 ? C.cDGreen : score >= 4 ? C.cGreen : score >= 2 ? C.cRed : C.cDRed) + score);
|
||||
|
||||
_killedChickens.put(player.getName(), score);
|
||||
|
||||
if (score == 6)
|
||||
{
|
||||
SetCompleted(player);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onHalfSecond(UpdateEvent event)
|
||||
{
|
||||
if (!Host.IsLive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Iterator<Chicken> itel = _chickens.iterator();
|
||||
|
||||
while (itel.hasNext())
|
||||
{
|
||||
Chicken chicken = itel.next();
|
||||
|
||||
if (chicken.isOnGround() || !chicken.isValid())
|
||||
{
|
||||
chicken.remove();
|
||||
itel.remove();
|
||||
}
|
||||
}
|
||||
|
||||
if (_chickens.size() < 13)
|
||||
{
|
||||
Location loc = getCenter().clone().add(UtilMath.r(20) - 10, 15, UtilMath.r(20) - 10);
|
||||
|
||||
Host.CreatureAllowOverride = true;
|
||||
Chicken chicken = (Chicken) loc.getWorld().spawnEntity(loc, EntityType.CHICKEN);
|
||||
Host.CreatureAllowOverride = false;
|
||||
chicken.setMaxHealth(0.1);
|
||||
chicken.setHealth(0.1);
|
||||
|
||||
_chickens.add(chicken);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupPlayers()
|
||||
{
|
||||
setBorder(-10, 10, 0, 10, -10, 10);
|
||||
|
||||
for (Player player : Host.GetPlayers(true))
|
||||
{
|
||||
player.getInventory().setItem(0,
|
||||
new ItemBuilder(Material.BOW).addEnchantment(Enchantment.ARROW_INFINITE, 1).setUnbreakable(true).build());
|
||||
player.getInventory().setItem(9, new ItemStack(Material.ARROW));
|
||||
|
||||
_killedChickens.put(player.getName(), 0);
|
||||
}
|
||||
|
||||
Host.DamagePvE = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateRoom()
|
||||
{
|
||||
for (int x = -10; x <= 10; x++)
|
||||
{
|
||||
for (int z = -10; z <= 10; z++)
|
||||
{
|
||||
for (int y = 0; y <= 1; y++)
|
||||
{
|
||||
Block b = getCenter().getBlock().getRelative(x, y, z);
|
||||
|
||||
if (y == 0)
|
||||
{
|
||||
b.setType(Material.GRASS);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Math.abs(x) == 10 || Math.abs(z) == 10)
|
||||
{
|
||||
b.setType(Material.FENCE);
|
||||
}
|
||||
else if (UtilMath.r(4) == 0)
|
||||
{
|
||||
if (UtilMath.r(8) == 0)
|
||||
{
|
||||
b.setType(UtilMath.random.nextBoolean() ? Material.YELLOW_FLOWER : Material.RED_ROSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
b.setType(Material.LONG_GRASS);
|
||||
b.setData((byte) 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (b.getType() != Material.AIR)
|
||||
{
|
||||
addBlock(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Location> getSpawns()
|
||||
{
|
||||
ArrayList<Location> spawns = new ArrayList<Location>();
|
||||
|
||||
for (int x = -8; x <= 8; x++)
|
||||
{
|
||||
for (int z = -8; z <= 8; z++)
|
||||
{
|
||||
if (x % 2 == 0 && z % 2 == 0)
|
||||
{
|
||||
spawns.add(getCenter().clone().add(x + 0.5, 1.1, z + 0.5));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return spawns;
|
||||
}
|
||||
}
|
@ -0,0 +1,213 @@
|
||||
package nautilus.game.arcade.game.games.mineware.challenges;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextBottom;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.game.games.mineware.Challenge;
|
||||
import nautilus.game.arcade.game.games.mineware.MineWare;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class ChallengeStandOnColor extends Challenge
|
||||
{
|
||||
private ArrayList<Integer> _colors = new ArrayList<Integer>();
|
||||
private int _currentColor;
|
||||
private boolean _isFalling;
|
||||
private long _lastSound;
|
||||
private long _stageExpires;
|
||||
private long _timeDelay = 5000;
|
||||
|
||||
public ChallengeStandOnColor(MineWare host)
|
||||
{
|
||||
super(host, ChallengeType.LastStanding, "Stand on the correct color");
|
||||
|
||||
for (int i = 0; i <= 15; i++)
|
||||
{
|
||||
_colors.add(i);
|
||||
}
|
||||
|
||||
_colors.remove(new Integer(2));
|
||||
_colors.remove(new Integer(6));
|
||||
_colors.remove(new Integer(7));
|
||||
_colors.remove(new Integer(9));
|
||||
_colors.remove(new Integer(12));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanupRoom()
|
||||
{
|
||||
for (Player player : Host.GetPlayers(true))
|
||||
{
|
||||
UtilInv.Clear(player);
|
||||
}
|
||||
}
|
||||
|
||||
private void generateFloor()
|
||||
{
|
||||
ArrayList<Entry<Integer, Integer>> cords = new ArrayList<Entry<Integer, Integer>>();
|
||||
|
||||
int i = UtilMath.r(_colors.size());
|
||||
|
||||
for (int x = -4; x <= 4; x++)
|
||||
{
|
||||
for (int z = -4; z <= 4; z++)
|
||||
{
|
||||
cords.add(new HashMap.SimpleEntry(x * 2, z * 2));
|
||||
}
|
||||
}
|
||||
|
||||
Collections.shuffle(cords);
|
||||
|
||||
for (Entry<Integer, Integer> entry : cords)
|
||||
{
|
||||
byte color = (byte) (int) _colors.get(i++);
|
||||
|
||||
if (i >= _colors.size())
|
||||
{
|
||||
i = 0;
|
||||
}
|
||||
for (int x = 0; x <= 1; x++)
|
||||
{
|
||||
for (int z = 0; z <= 1; z++)
|
||||
{
|
||||
Block b = getCenter().getBlock().getRelative(entry.getKey() + x, 0, entry.getValue() + z);
|
||||
|
||||
b.setTypeIdAndData(Material.STAINED_CLAY.getId(), color, false);
|
||||
addBlock(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateRoom()
|
||||
{
|
||||
setBorder(-20, 20, 0, 10, -20, 20);
|
||||
generateFloor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Location> getSpawns()
|
||||
{
|
||||
ArrayList<Location> spawns = new ArrayList<Location>();
|
||||
|
||||
for (int x = -7; x <= 7; x++)
|
||||
{
|
||||
for (int z = -7; z <= 7; z++)
|
||||
{
|
||||
if (x % 2 == 0 && z % 2 == 0)
|
||||
{
|
||||
spawns.add(getCenter().clone().add(x + 0.5, 1.1, z + 0.5));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return spawns;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void OnTick(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Host.IsLive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player[] players = getChallengers().toArray(new Player[0]);
|
||||
|
||||
if (_stageExpires < System.currentTimeMillis())
|
||||
{
|
||||
UtilTextBottom.displayProgress(0, players);
|
||||
|
||||
if (_isFalling)
|
||||
{
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
player.playSound(player.getLocation(), Sound.NOTE_PIANO, 2f, 0f);
|
||||
|
||||
_timeDelay -= 800;
|
||||
_isFalling = false;
|
||||
_stageExpires = System.currentTimeMillis() + _timeDelay;
|
||||
_currentColor = _colors.get(UtilMath.r(_colors.size()));
|
||||
generateFloor();
|
||||
|
||||
for (Player player : getChallengers())
|
||||
{
|
||||
for (int i = 0; i < 9; i++)
|
||||
{
|
||||
player.getInventory().setItem(i, new ItemStack(Material.STAINED_CLAY, 1, (short) _currentColor));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_isFalling = true;
|
||||
_stageExpires = System.currentTimeMillis() + 4000;
|
||||
|
||||
for (int x = -8; x <= 9; x++)
|
||||
{
|
||||
for (int z = -8; z <= 9; z++)
|
||||
{
|
||||
Block b = getCenter().getBlock().getRelative(x, 0, z);
|
||||
|
||||
if (b.getData() != _currentColor)
|
||||
{
|
||||
b.setTypeIdAndData(Material.AIR.getId(), (byte) 0, false);
|
||||
addBlock(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!_isFalling)
|
||||
{
|
||||
UtilTextBottom.displayProgress((_stageExpires - System.currentTimeMillis()) / (double) _timeDelay, players);
|
||||
|
||||
if (_lastSound < System.currentTimeMillis())
|
||||
{
|
||||
_lastSound = System.currentTimeMillis() + 1000;
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
player.playSound(player.getLocation(), Sound.NOTE_STICKS, 1f, 1f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilTextBottom.displayProgress(0, players);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupPlayers()
|
||||
{
|
||||
_stageExpires = System.currentTimeMillis() + _timeDelay;
|
||||
_currentColor = _colors.get(UtilMath.r(_colors.size()));
|
||||
|
||||
for (Player player : Host.GetPlayers(true))
|
||||
{
|
||||
for (int i = 0; i < 9; i++)
|
||||
{
|
||||
player.getInventory().setItem(i, new ItemStack(Material.STAINED_CLAY, 1, (short) _currentColor));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,104 @@
|
||||
package nautilus.game.arcade.game.games.mineware.challenges;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
/*
|
||||
* recursive backtracking algorithm
|
||||
* shamelessly borrowed from the ruby at
|
||||
* http://weblog.jamisbuck.org/2010/12/27/maze-generation-recursive-backtracking
|
||||
*
|
||||
* This code taken from http://rosettacode.org/wiki/Maze_generation#Java
|
||||
*/
|
||||
public class MazeGenerator
|
||||
{
|
||||
private final int x;
|
||||
private final int y;
|
||||
private final int[][] maze;
|
||||
|
||||
public MazeGenerator(int x, int y)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
maze = new int[this.x][this.y];
|
||||
generateMaze(0, 0);
|
||||
}
|
||||
|
||||
public int[][] getMaze()
|
||||
{
|
||||
return maze;
|
||||
}
|
||||
|
||||
public void display()
|
||||
{
|
||||
for (int i = 0; i < y; i++)
|
||||
{
|
||||
// draw the north edge
|
||||
for (int j = 0; j < x; j++)
|
||||
{
|
||||
System.out.print((maze[j][i] & 1) == 0 ? "+---" : "+ ");
|
||||
}
|
||||
System.out.println("+");
|
||||
// draw the west edge
|
||||
for (int j = 0; j < x; j++)
|
||||
{
|
||||
System.out.print((maze[j][i] & 8) == 0 ? "| " : " ");
|
||||
}
|
||||
System.out.println("|");
|
||||
}
|
||||
// draw the bottom line
|
||||
for (int j = 0; j < x; j++)
|
||||
{
|
||||
System.out.print("+---");
|
||||
}
|
||||
System.out.println("+");
|
||||
}
|
||||
|
||||
private void generateMaze(int cx, int cy)
|
||||
{
|
||||
DIR[] dirs = DIR.values();
|
||||
Collections.shuffle(Arrays.asList(dirs));
|
||||
for (DIR dir : dirs)
|
||||
{
|
||||
int nx = cx + dir.dx;
|
||||
int ny = cy + dir.dy;
|
||||
if (between(nx, x) && between(ny, y) && (maze[nx][ny] == 0))
|
||||
{
|
||||
maze[cx][cy] |= dir.bit;
|
||||
maze[nx][ny] |= dir.opposite.bit;
|
||||
generateMaze(nx, ny);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean between(int v, int upper)
|
||||
{
|
||||
return (v >= 0) && (v < upper);
|
||||
}
|
||||
|
||||
private enum DIR
|
||||
{
|
||||
N(1, 0, -1), S(2, 0, 1), E(4, 1, 0), W(8, -1, 0);
|
||||
private final int bit;
|
||||
private final int dx;
|
||||
private final int dy;
|
||||
private DIR opposite;
|
||||
|
||||
// use the static initializer to resolve forward references
|
||||
static
|
||||
{
|
||||
N.opposite = S;
|
||||
S.opposite = N;
|
||||
E.opposite = W;
|
||||
W.opposite = E;
|
||||
}
|
||||
|
||||
private DIR(int bit, int dx, int dy)
|
||||
{
|
||||
this.bit = bit;
|
||||
this.dx = dx;
|
||||
this.dy = dy;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.mineware.random;
|
||||
|
||||
import nautilus.game.arcade.game.games.mineware.MineWare;
|
||||
import nautilus.game.arcade.game.games.mineware.order.OrderCraft;
|
||||
|
||||
public class CraftLadder extends OrderCraft
|
||||
{
|
||||
public CraftLadder(MineWare host)
|
||||
{
|
||||
super(host, "Craft some ladders", 65, -1, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Initialize()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Uninitialize()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.mineware.random;
|
||||
|
||||
import nautilus.game.arcade.game.games.mineware.MineWare;
|
||||
import nautilus.game.arcade.game.games.mineware.order.OrderCraft;
|
||||
|
||||
public class CraftStoneShovel extends OrderCraft
|
||||
{
|
||||
public CraftStoneShovel(MineWare host)
|
||||
{
|
||||
super(host, "Craft a stone shovel", 273, -1, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Initialize()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Uninitialize()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.mineware.random;
|
||||
|
||||
import nautilus.game.arcade.game.games.mineware.MineWare;
|
||||
import nautilus.game.arcade.game.games.mineware.order.OrderGather;
|
||||
|
||||
public class GatherCobble extends OrderGather
|
||||
{
|
||||
public GatherCobble(MineWare host)
|
||||
{
|
||||
super(host, "Pick up 10 Cobblestone", 4, -1, 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Initialize()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Uninitialize()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.mineware.random;
|
||||
|
||||
import nautilus.game.arcade.game.games.mineware.MineWare;
|
||||
import nautilus.game.arcade.game.games.mineware.order.OrderGather;
|
||||
|
||||
public class GatherRedFlower extends OrderGather
|
||||
{
|
||||
public GatherRedFlower(MineWare host)
|
||||
{
|
||||
super(host, "Pick 3 Red Roses", 38, -1, 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Initialize()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Uninitialize()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.mineware.random;
|
||||
|
||||
import nautilus.game.arcade.game.games.mineware.MineWare;
|
||||
import nautilus.game.arcade.game.games.mineware.order.OrderGather;
|
||||
|
||||
public class GatherSand extends OrderGather
|
||||
{
|
||||
public GatherSand(MineWare host)
|
||||
{
|
||||
super(host, "Pick up 16 Sand", 12, -1, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Initialize()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Uninitialize()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.mineware.random;
|
||||
|
||||
import nautilus.game.arcade.game.games.mineware.MineWare;
|
||||
import nautilus.game.arcade.game.games.mineware.order.OrderGather;
|
||||
|
||||
public class GatherYellowFlower extends OrderGather
|
||||
{
|
||||
public GatherYellowFlower(MineWare host)
|
||||
{
|
||||
super(host, "Pick 4 Yellow Flowers", 37, -1, 4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Initialize()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Uninitialize()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.mineware.random;
|
||||
|
||||
import nautilus.game.arcade.game.games.mineware.MineWare;
|
||||
import nautilus.game.arcade.game.games.mineware.order.OrderPlace;
|
||||
|
||||
public class PlaceDoor extends OrderPlace
|
||||
{
|
||||
public PlaceDoor(MineWare host)
|
||||
{
|
||||
super(host, "Place a wooden door", 64, -1, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Initialize()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Uninitialize()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,352 @@
|
||||
package nautilus.game.arcade.game.games.oldmineware;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Chicken;
|
||||
import org.bukkit.entity.Cow;
|
||||
import org.bukkit.entity.Creature;
|
||||
import org.bukkit.entity.Ghast;
|
||||
import org.bukkit.entity.Pig;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Sheep;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.SoloGame;
|
||||
import nautilus.game.arcade.game.games.oldmineware.order.Order;
|
||||
import nautilus.game.arcade.game.games.oldmineware.random.*;
|
||||
import nautilus.game.arcade.game.games.runner.kits.KitLeaper;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
|
||||
public class OldMineWare extends SoloGame
|
||||
{
|
||||
private HashMap<Player, Integer> _lives = new HashMap<Player, Integer>();
|
||||
|
||||
private Order _order = null;
|
||||
private long _orderTime = 0;
|
||||
private int _orderCount = 0;
|
||||
|
||||
private ArrayList<Order> _orders = new ArrayList<Order>();
|
||||
private ArrayList<Order> _ordersCopy = new ArrayList<Order>();
|
||||
|
||||
private Location _ghastLoc = null;
|
||||
private Location _ghastTarget = null;
|
||||
private Ghast _ghast = null;
|
||||
private ArrayList<Location> _mobLocs = new ArrayList<Location>();
|
||||
private ArrayList<Creature> _mobs = new ArrayList<Creature>();
|
||||
|
||||
public OldMineWare(ArcadeManager manager)
|
||||
{
|
||||
super(manager, GameType.OldMineWare,
|
||||
|
||||
new Kit[]
|
||||
{
|
||||
new KitLeaper(manager),
|
||||
},
|
||||
|
||||
new String[]
|
||||
{
|
||||
"Follow the orders given in chat!",
|
||||
"First half to follow it win the round.",
|
||||
"Other players lose one life.",
|
||||
"Last player with lives wins!"
|
||||
});
|
||||
|
||||
this.PrepareFreeze = false;
|
||||
|
||||
this.DamagePvP = false;
|
||||
|
||||
this.BlockPlace = true;
|
||||
this.BlockBreak = true;
|
||||
|
||||
this.ItemDrop = true;
|
||||
this.ItemPickup = true;
|
||||
|
||||
InventoryOpenBlock = true;
|
||||
InventoryOpenChest = true;
|
||||
InventoryClick = true;
|
||||
|
||||
PopulateOrders();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ParseData()
|
||||
{
|
||||
_ghastLoc = WorldData.GetDataLocs("WHITE").get(0);
|
||||
|
||||
while (_mobLocs.size() < 100)
|
||||
{
|
||||
Location loc = WorldData.GetRandomXZ();
|
||||
|
||||
while (UtilBlock.airFoliage(loc.getBlock()))
|
||||
loc.add(0, -1, 0);
|
||||
|
||||
Material mat = loc.getBlock().getType();
|
||||
|
||||
if (mat == Material.STONE ||
|
||||
mat == Material.GRASS ||
|
||||
mat == Material.SAND)
|
||||
_mobLocs.add(loc);
|
||||
}
|
||||
}
|
||||
|
||||
public void PopulateOrders()
|
||||
{
|
||||
_orders.add(new ActionMilkCow(this));
|
||||
_orders.add(new ActionShearSheep(this));
|
||||
|
||||
_orders.add(new CraftLadder(this));
|
||||
_orders.add(new CraftStoneShovel(this));
|
||||
|
||||
_orders.add(new DamageChicken(this));
|
||||
_orders.add(new DamageFall(this));
|
||||
_orders.add(new DamageGhast(this));
|
||||
|
||||
_orders.add(new GatherCobble(this));
|
||||
_orders.add(new GatherRedFlower(this));
|
||||
_orders.add(new GatherYellowFlower(this));
|
||||
_orders.add(new GatherSand(this));
|
||||
|
||||
_orders.add(new PlaceDoor(this));
|
||||
|
||||
_orders.add(new RideBoat(this));
|
||||
_orders.add(new RidePig(this));
|
||||
|
||||
_orders.add(new StandAlone(this));
|
||||
_orders.add(new StandShelter(this));
|
||||
_orders.add(new StandStone(this));
|
||||
_orders.add(new StandWater(this));
|
||||
}
|
||||
|
||||
public Order GetOrder()
|
||||
{
|
||||
if (_ordersCopy.isEmpty())
|
||||
{
|
||||
for (Order order : _orders)
|
||||
{
|
||||
_ordersCopy.add(order);
|
||||
}
|
||||
}
|
||||
|
||||
return _ordersCopy.remove(UtilMath.r(_ordersCopy.size()));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void GameStateChange(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Prepare)
|
||||
return;
|
||||
|
||||
for (Player player : GetPlayers(true))
|
||||
_lives.put(player, 10);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void UpdateOrder(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
//New Order
|
||||
if (_order == null)
|
||||
{
|
||||
if (!UtilTime.elapsed(_orderTime, 1000))
|
||||
return;
|
||||
|
||||
_order = GetOrder();
|
||||
|
||||
if (_order == null)
|
||||
{
|
||||
SetState(GameState.Dead);
|
||||
return;
|
||||
}
|
||||
|
||||
//Register
|
||||
UtilServer.getServer().getPluginManager().registerEvents(_order, Manager.getPlugin());
|
||||
_order.StartOrder(_orderCount++);
|
||||
|
||||
Announce(C.cYellow + C.Bold + _order.GetOrder().toUpperCase());
|
||||
|
||||
/* XXX
|
||||
GetObjectiveSide().setDisplayName(
|
||||
ChatColor.WHITE + "§lMineWare " + C.cGreen + "§l"
|
||||
+ "Round " + _orderCount);
|
||||
*/
|
||||
}
|
||||
//Update Order
|
||||
else
|
||||
{
|
||||
if (_order.Finish())
|
||||
{
|
||||
_orderTime = System.currentTimeMillis();
|
||||
|
||||
if (_order.PlayerHasCompleted())
|
||||
{
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
if (!_order.IsCompleted(player))
|
||||
{
|
||||
LoseLife(player);
|
||||
|
||||
if (IsAlive(player))
|
||||
_order.FailItems(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Deregister
|
||||
HandlerList.unregisterAll(_order);
|
||||
_order.EndOrder();
|
||||
_order = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Set Level
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
player.setLevel(_order.GetRemainingPlaces());
|
||||
player.setExp(_order.GetTimeLeftPercent());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int GetLives(Player player)
|
||||
{
|
||||
if (!_lives.containsKey(player))
|
||||
return 0;
|
||||
|
||||
if (!IsAlive(player))
|
||||
return 0;
|
||||
|
||||
return _lives.get(player);
|
||||
}
|
||||
|
||||
private void LoseLife(Player player)
|
||||
{
|
||||
int lives = GetLives(player) - 1;
|
||||
|
||||
if (lives > 0)
|
||||
{
|
||||
UtilPlayer.message(player, C.cRed + C.Bold + "You failed the task!");
|
||||
UtilPlayer.message(player, C.cRed + C.Bold + "You have " + lives + " lives left!");
|
||||
player.playSound(player.getLocation(), Sound.NOTE_BASS_GUITAR, 2f, 0.5f);
|
||||
|
||||
_lives.put(player, lives);
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(player, C.cRed + C.Bold + "You are out of the game!");
|
||||
player.playSound(player.getLocation(), Sound.EXPLODE, 2f, 1f);
|
||||
|
||||
player.damage(5000);
|
||||
|
||||
Scoreboard.ResetScore(player.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void UpdateMobs(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
if (!InProgress())
|
||||
return;
|
||||
|
||||
Iterator<Creature> mobIterator = _mobs.iterator();
|
||||
|
||||
while (mobIterator.hasNext())
|
||||
{
|
||||
Creature mob = mobIterator.next();
|
||||
|
||||
if (!mob.isValid())
|
||||
{
|
||||
mob.remove();
|
||||
mobIterator.remove();
|
||||
}
|
||||
}
|
||||
|
||||
if (_mobs.size() < 200)
|
||||
{
|
||||
Location loc = _mobLocs.get(UtilMath.r(_mobLocs.size())).clone().add(new Vector(0.5,1,0.5));
|
||||
double r = Math.random();
|
||||
|
||||
this.CreatureAllowOverride = true;
|
||||
|
||||
if (r > 0.75) _mobs.add(loc.getWorld().spawn(loc, Pig.class));
|
||||
else if (r > 0.5) _mobs.add(loc.getWorld().spawn(loc, Cow.class));
|
||||
else if (r > 0.25) _mobs.add(loc.getWorld().spawn(loc, Chicken.class));
|
||||
else _mobs.add(loc.getWorld().spawn(loc, Sheep.class));
|
||||
|
||||
this.CreatureAllowOverride = false;
|
||||
}
|
||||
|
||||
if (_ghast == null || !_ghast.isValid())
|
||||
{
|
||||
if (_ghast != null)
|
||||
_ghast.remove();
|
||||
|
||||
this.CreatureAllowOverride = true;
|
||||
_ghast = _ghastLoc.getWorld().spawn(_ghastLoc, Ghast.class);
|
||||
this.CreatureAllowOverride = false;
|
||||
|
||||
_ghast.setMaxHealth(10000);
|
||||
_ghast.setHealth(_ghast.getMaxHealth());
|
||||
}
|
||||
else
|
||||
{
|
||||
//New Target
|
||||
if (_ghastTarget == null || UtilMath.offset(_ghast.getLocation(), _ghastTarget) < 5)
|
||||
{
|
||||
_ghastTarget = _ghastLoc.clone().add(40 - 80*Math.random(), -20*Math.random(), 40 - 80*Math.random());
|
||||
}
|
||||
|
||||
_ghast.teleport(_ghast.getLocation().add(UtilAlg.getTrajectory(_ghast.getLocation(), _ghastTarget).multiply(0.1)));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void GhastTarget(EntityTargetEvent event)
|
||||
{
|
||||
if (event.getEntity().equals(_ghast))
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int GetScoreboardScore(Player player)
|
||||
{
|
||||
return GetLives(player);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void ItemDrop(PlayerDropItemEvent event)
|
||||
{
|
||||
event.getItemDrop().remove();
|
||||
}
|
||||
}
|
@ -1,11 +1,11 @@
|
||||
package nautilus.game.arcade.game.games.mineware.order;
|
||||
package nautilus.game.arcade.game.games.oldmineware.order;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import nautilus.game.arcade.game.games.mineware.MineWare;
|
||||
import nautilus.game.arcade.game.games.oldmineware.OldMineWare;
|
||||
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -13,7 +13,7 @@ import org.bukkit.event.Listener;
|
||||
|
||||
public abstract class Order implements Listener
|
||||
{
|
||||
public MineWare Host;
|
||||
public OldMineWare Host;
|
||||
|
||||
private String _order;
|
||||
|
||||
@ -22,7 +22,7 @@ public abstract class Order implements Listener
|
||||
|
||||
private HashSet<Player> _completed = new HashSet<Player>();
|
||||
|
||||
public Order(MineWare host, String order)
|
||||
public Order(OldMineWare host, String order)
|
||||
{
|
||||
Host = host;
|
||||
|
@ -1,10 +1,10 @@
|
||||
package nautilus.game.arcade.game.games.mineware.order;
|
||||
package nautilus.game.arcade.game.games.oldmineware.order;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import nautilus.game.arcade.game.games.mineware.MineWare;
|
||||
import nautilus.game.arcade.game.games.oldmineware.OldMineWare;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
@ -23,7 +23,7 @@ public abstract class OrderCraft extends Order
|
||||
private byte _data;
|
||||
private int _req;
|
||||
|
||||
public OrderCraft(MineWare host, String order, int id, int data, int required)
|
||||
public OrderCraft(OldMineWare host, String order, int id, int data, int required)
|
||||
{
|
||||
super(host, order);
|
||||
|
@ -1,10 +1,10 @@
|
||||
package nautilus.game.arcade.game.games.mineware.order;
|
||||
package nautilus.game.arcade.game.games.oldmineware.order;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import nautilus.game.arcade.game.games.mineware.MineWare;
|
||||
import nautilus.game.arcade.game.games.oldmineware.OldMineWare;
|
||||
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -19,7 +19,7 @@ public abstract class OrderGather extends Order
|
||||
private byte _data;
|
||||
private int _req;
|
||||
|
||||
public OrderGather(MineWare host, String order, int id, int data, int required)
|
||||
public OrderGather(OldMineWare host, String order, int id, int data, int required)
|
||||
{
|
||||
super(host, order);
|
||||
|
@ -1,8 +1,8 @@
|
||||
package nautilus.game.arcade.game.games.mineware.order;
|
||||
package nautilus.game.arcade.game.games.oldmineware.order;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import nautilus.game.arcade.game.games.mineware.MineWare;
|
||||
import nautilus.game.arcade.game.games.oldmineware.OldMineWare;
|
||||
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -17,7 +17,7 @@ public abstract class OrderPlace extends Order
|
||||
private byte _data;
|
||||
private int _req;
|
||||
|
||||
public OrderPlace(MineWare host, String order, int id, int data, int required)
|
||||
public OrderPlace(OldMineWare host, String order, int id, int data, int required)
|
||||
{
|
||||
super(host, order);
|
||||
|
@ -1,4 +1,4 @@
|
||||
package nautilus.game.arcade.game.games.mineware.random;
|
||||
package nautilus.game.arcade.game.games.oldmineware.random;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Cow;
|
||||
@ -8,12 +8,12 @@ import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import nautilus.game.arcade.game.games.mineware.MineWare;
|
||||
import nautilus.game.arcade.game.games.mineware.order.Order;
|
||||
import nautilus.game.arcade.game.games.oldmineware.OldMineWare;
|
||||
import nautilus.game.arcade.game.games.oldmineware.order.Order;
|
||||
|
||||
public class ActionMilkCow extends Order
|
||||
{
|
||||
public ActionMilkCow(MineWare host)
|
||||
public ActionMilkCow(OldMineWare host)
|
||||
{
|
||||
super(host, "milk a cow");
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package nautilus.game.arcade.game.games.mineware.random;
|
||||
package nautilus.game.arcade.game.games.oldmineware.random;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -6,12 +6,12 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerShearEntityEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import nautilus.game.arcade.game.games.mineware.MineWare;
|
||||
import nautilus.game.arcade.game.games.mineware.order.Order;
|
||||
import nautilus.game.arcade.game.games.oldmineware.OldMineWare;
|
||||
import nautilus.game.arcade.game.games.oldmineware.order.Order;
|
||||
|
||||
public class ActionShearSheep extends Order
|
||||
{
|
||||
public ActionShearSheep(MineWare host)
|
||||
public ActionShearSheep(OldMineWare host)
|
||||
{
|
||||
super(host, "shear a sheep");
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package nautilus.game.arcade.game.games.oldmineware.random;
|
||||
|
||||
import nautilus.game.arcade.game.games.oldmineware.OldMineWare;
|
||||
import nautilus.game.arcade.game.games.oldmineware.order.OrderCraft;
|
||||
|
||||
public class CraftLadder extends OrderCraft
|
||||
{
|
||||
public CraftLadder(OldMineWare host)
|
||||
{
|
||||
super(host, "Craft some ladders", 65, -1, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Initialize()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Uninitialize()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package nautilus.game.arcade.game.games.oldmineware.random;
|
||||
|
||||
import nautilus.game.arcade.game.games.oldmineware.OldMineWare;
|
||||
import nautilus.game.arcade.game.games.oldmineware.order.OrderCraft;
|
||||
|
||||
public class CraftStoneShovel extends OrderCraft
|
||||
{
|
||||
public CraftStoneShovel(OldMineWare host)
|
||||
{
|
||||
super(host, "Craft a stone shovel", 273, -1, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Initialize()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Uninitialize()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package nautilus.game.arcade.game.games.mineware.random;
|
||||
package nautilus.game.arcade.game.games.oldmineware.random;
|
||||
|
||||
import org.bukkit.entity.Chicken;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
@ -7,12 +7,12 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.game.games.mineware.MineWare;
|
||||
import nautilus.game.arcade.game.games.mineware.order.Order;
|
||||
import nautilus.game.arcade.game.games.oldmineware.OldMineWare;
|
||||
import nautilus.game.arcade.game.games.oldmineware.order.Order;
|
||||
|
||||
public class DamageChicken extends Order
|
||||
{
|
||||
public DamageChicken(MineWare host)
|
||||
public DamageChicken(OldMineWare host)
|
||||
{
|
||||
super(host, "punch a chicken");
|
||||
}
|
@ -1,16 +1,16 @@
|
||||
package nautilus.game.arcade.game.games.mineware.random;
|
||||
package nautilus.game.arcade.game.games.oldmineware.random;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.game.games.mineware.MineWare;
|
||||
import nautilus.game.arcade.game.games.mineware.order.Order;
|
||||
import nautilus.game.arcade.game.games.oldmineware.OldMineWare;
|
||||
import nautilus.game.arcade.game.games.oldmineware.order.Order;
|
||||
|
||||
public class DamageFall extends Order
|
||||
{
|
||||
public DamageFall(MineWare host)
|
||||
public DamageFall(OldMineWare host)
|
||||
{
|
||||
super(host, "Take fall damage");
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package nautilus.game.arcade.game.games.mineware.random;
|
||||
package nautilus.game.arcade.game.games.oldmineware.random;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Ghast;
|
||||
@ -11,12 +11,12 @@ import org.bukkit.inventory.ItemStack;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.game.games.mineware.MineWare;
|
||||
import nautilus.game.arcade.game.games.mineware.order.Order;
|
||||
import nautilus.game.arcade.game.games.oldmineware.OldMineWare;
|
||||
import nautilus.game.arcade.game.games.oldmineware.order.Order;
|
||||
|
||||
public class DamageGhast extends Order
|
||||
{
|
||||
public DamageGhast(MineWare host)
|
||||
public DamageGhast(OldMineWare host)
|
||||
{
|
||||
super(host, "shoot the ghast");
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package nautilus.game.arcade.game.games.oldmineware.random;
|
||||
|
||||
import nautilus.game.arcade.game.games.oldmineware.OldMineWare;
|
||||
import nautilus.game.arcade.game.games.oldmineware.order.OrderGather;
|
||||
|
||||
public class GatherCobble extends OrderGather
|
||||
{
|
||||
public GatherCobble(OldMineWare host)
|
||||
{
|
||||
super(host, "Pick up 10 Cobblestone", 4, -1, 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Initialize()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Uninitialize()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package nautilus.game.arcade.game.games.oldmineware.random;
|
||||
|
||||
import nautilus.game.arcade.game.games.oldmineware.OldMineWare;
|
||||
import nautilus.game.arcade.game.games.oldmineware.order.OrderGather;
|
||||
|
||||
public class GatherRedFlower extends OrderGather
|
||||
{
|
||||
public GatherRedFlower(OldMineWare host)
|
||||
{
|
||||
super(host, "Pick 3 Red Roses", 38, -1, 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Initialize()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Uninitialize()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package nautilus.game.arcade.game.games.oldmineware.random;
|
||||
|
||||
import nautilus.game.arcade.game.games.oldmineware.OldMineWare;
|
||||
import nautilus.game.arcade.game.games.oldmineware.order.OrderGather;
|
||||
|
||||
public class GatherSand extends OrderGather
|
||||
{
|
||||
public GatherSand(OldMineWare host)
|
||||
{
|
||||
super(host, "Pick up 16 Sand", 12, -1, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Initialize()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Uninitialize()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package nautilus.game.arcade.game.games.oldmineware.random;
|
||||
|
||||
import nautilus.game.arcade.game.games.oldmineware.OldMineWare;
|
||||
import nautilus.game.arcade.game.games.oldmineware.order.OrderGather;
|
||||
|
||||
public class GatherYellowFlower extends OrderGather
|
||||
{
|
||||
public GatherYellowFlower(OldMineWare host)
|
||||
{
|
||||
super(host, "Pick 4 Yellow Flowers", 37, -1, 4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Initialize()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Uninitialize()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package nautilus.game.arcade.game.games.oldmineware.random;
|
||||
|
||||
import nautilus.game.arcade.game.games.oldmineware.OldMineWare;
|
||||
import nautilus.game.arcade.game.games.oldmineware.order.OrderPlace;
|
||||
|
||||
public class PlaceDoor extends OrderPlace
|
||||
{
|
||||
public PlaceDoor(OldMineWare host)
|
||||
{
|
||||
super(host, "Place a wooden door", 64, -1, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Initialize()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Uninitialize()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package nautilus.game.arcade.game.games.mineware.random;
|
||||
package nautilus.game.arcade.game.games.oldmineware.random;
|
||||
|
||||
import org.bukkit.entity.Boat;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -6,12 +6,12 @@ import org.bukkit.event.EventHandler;
|
||||
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.game.games.mineware.MineWare;
|
||||
import nautilus.game.arcade.game.games.mineware.order.Order;
|
||||
import nautilus.game.arcade.game.games.oldmineware.OldMineWare;
|
||||
import nautilus.game.arcade.game.games.oldmineware.order.Order;
|
||||
|
||||
public class RideBoat extends Order
|
||||
{
|
||||
public RideBoat(MineWare host)
|
||||
public RideBoat(OldMineWare host)
|
||||
{
|
||||
super(host, "Sit in a Boat");
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package nautilus.game.arcade.game.games.mineware.random;
|
||||
package nautilus.game.arcade.game.games.oldmineware.random;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Pig;
|
||||
@ -8,12 +8,12 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.game.games.mineware.MineWare;
|
||||
import nautilus.game.arcade.game.games.mineware.order.Order;
|
||||
import nautilus.game.arcade.game.games.oldmineware.OldMineWare;
|
||||
import nautilus.game.arcade.game.games.oldmineware.order.Order;
|
||||
|
||||
public class RidePig extends Order
|
||||
{
|
||||
public RidePig(MineWare host)
|
||||
public RidePig(OldMineWare host)
|
||||
{
|
||||
super(host, "ride a pig");
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package nautilus.game.arcade.game.games.mineware.random;
|
||||
package nautilus.game.arcade.game.games.oldmineware.random;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -6,12 +6,12 @@ import org.bukkit.event.EventHandler;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.game.games.mineware.MineWare;
|
||||
import nautilus.game.arcade.game.games.mineware.order.Order;
|
||||
import nautilus.game.arcade.game.games.oldmineware.OldMineWare;
|
||||
import nautilus.game.arcade.game.games.oldmineware.order.Order;
|
||||
|
||||
public class StandAlone extends Order
|
||||
{
|
||||
public StandAlone(MineWare host)
|
||||
public StandAlone(OldMineWare host)
|
||||
{
|
||||
super(host, "Run away from everyone");
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package nautilus.game.arcade.game.games.mineware.random;
|
||||
package nautilus.game.arcade.game.games.oldmineware.random;
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
@ -7,12 +7,12 @@ import org.bukkit.event.EventHandler;
|
||||
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.game.games.mineware.MineWare;
|
||||
import nautilus.game.arcade.game.games.mineware.order.Order;
|
||||
import nautilus.game.arcade.game.games.oldmineware.OldMineWare;
|
||||
import nautilus.game.arcade.game.games.oldmineware.order.Order;
|
||||
|
||||
public class StandShelter extends Order
|
||||
{
|
||||
public StandShelter(MineWare host)
|
||||
public StandShelter(OldMineWare host)
|
||||
{
|
||||
super(host, "take shelter from rain");
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package nautilus.game.arcade.game.games.mineware.random;
|
||||
package nautilus.game.arcade.game.games.oldmineware.random;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
@ -7,12 +7,12 @@ import org.bukkit.event.EventHandler;
|
||||
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.game.games.mineware.MineWare;
|
||||
import nautilus.game.arcade.game.games.mineware.order.Order;
|
||||
import nautilus.game.arcade.game.games.oldmineware.OldMineWare;
|
||||
import nautilus.game.arcade.game.games.oldmineware.order.Order;
|
||||
|
||||
public class StandStone extends Order
|
||||
{
|
||||
public StandStone(MineWare host)
|
||||
public StandStone(OldMineWare host)
|
||||
{
|
||||
super(host, "Stand on stone");
|
||||
}
|
@ -1,16 +1,16 @@
|
||||
package nautilus.game.arcade.game.games.mineware.random;
|
||||
package nautilus.game.arcade.game.games.oldmineware.random;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.game.games.mineware.MineWare;
|
||||
import nautilus.game.arcade.game.games.mineware.order.Order;
|
||||
import nautilus.game.arcade.game.games.oldmineware.OldMineWare;
|
||||
import nautilus.game.arcade.game.games.oldmineware.order.Order;
|
||||
|
||||
public class StandWater extends Order
|
||||
{
|
||||
public StandWater(MineWare host)
|
||||
public StandWater(OldMineWare host)
|
||||
{
|
||||
super(host, "Go for a swim");
|
||||
}
|
@ -43,7 +43,6 @@ import org.bukkit.event.hanging.HangingBreakEvent;
|
||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
import org.bukkit.event.inventory.PrepareItemCraftEvent;
|
||||
import org.bukkit.event.player.PlayerChangedWorldEvent;
|
||||
import org.bukkit.event.player.PlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
@ -913,16 +912,6 @@ public class SurvivalGames extends SoloGame
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onChat(PlayerChatEvent event)
|
||||
{
|
||||
if (event.getMessage().equalsIgnoreCase("start game") && GetState() == GameState.Recruit)
|
||||
{
|
||||
// TODO Remove
|
||||
getArcadeManager().GetGameManager().StateCountdown(this, 1, true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void DisableDamageLevel(CustomDamageEvent event)
|
||||
{
|
||||
@ -1037,7 +1026,10 @@ public class SurvivalGames extends SoloGame
|
||||
@Override
|
||||
public double GetKillsGems(Player killer, Player killed, boolean assist)
|
||||
{
|
||||
return 4;
|
||||
if (assist)
|
||||
return 3;
|
||||
else
|
||||
return 12;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -2272,5 +2264,4 @@ public class SurvivalGames extends SoloGame
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.wizards;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
@ -10,8 +11,10 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
@ -57,6 +60,19 @@ public class WizardSpellMenu extends MiniPlugin
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void Observer(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
if (event.getMessage().equalsIgnoreCase("/spec"))
|
||||
{
|
||||
if (!_wizards.IsAlive(event.getPlayer())
|
||||
&& !UtilInv.contains(event.getPlayer(), _wizardSpells.getType(), (byte) 0, 1))
|
||||
{
|
||||
event.getPlayer().getInventory().setItem(0, _wizardSpells);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onJoin(GameStateChangeEvent event)
|
||||
{
|
||||
|
@ -1111,6 +1111,9 @@ public class Wizards extends SoloGame
|
||||
@EventHandler
|
||||
public void onClick(InventoryClickEvent event)
|
||||
{
|
||||
if (event.getClickedInventory() == null || !(event.getClickedInventory().getHolder() instanceof BlockState))
|
||||
return;
|
||||
|
||||
ItemStack item = event.getCurrentItem();
|
||||
|
||||
if (item != null)
|
||||
|
@ -98,7 +98,7 @@ public class PerkIronHook extends Perk implements IThrown
|
||||
|
||||
//Damage Event
|
||||
Manager.GetDamage().NewDamageEvent(target, player, null,
|
||||
DamageCause.CUSTOM, velocity * 8, false, true, false,
|
||||
DamageCause.CUSTOM, velocity * 4, false, true, false,
|
||||
player.getName(), GetName());
|
||||
|
||||
//Inform
|
||||
|
@ -1,5 +1,6 @@
|
||||
package nautilus.game.arcade.managers;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
@ -188,8 +189,28 @@ public class GameCreationManager implements Listener
|
||||
|
||||
_lastGames.add(0, gameType);
|
||||
|
||||
//Make Game
|
||||
Manager.SetGame(Manager.GetGameFactory().CreateGame(gameType, pastTeams));
|
||||
try
|
||||
{
|
||||
Game game = gameType.getGameClass().getConstructor(ArcadeManager.class).newInstance(Manager);
|
||||
|
||||
Manager.SetGame(game);
|
||||
}
|
||||
catch (NoSuchMethodException ex)
|
||||
{
|
||||
System.err.println("Is the constructor for " + gameType.GetName() + " using only one argument?");
|
||||
ex.printStackTrace();
|
||||
return;
|
||||
}
|
||||
catch (InvocationTargetException ex)
|
||||
{
|
||||
ex.getCause().printStackTrace();
|
||||
return;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
if (Manager.GetGame() == null)
|
||||
{
|
||||
|
@ -840,7 +840,7 @@ public class GameFlagManager implements Listener
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
if (!game.isInsideMap(player.getLocation()) && game.IsAlive(player))
|
||||
if (!game.isInsideMap(player) && game.IsAlive(player))
|
||||
{
|
||||
if (!Manager.IsAlive(player) || ((CraftPlayer)player).getHandle().spectating)
|
||||
{
|
||||
@ -917,6 +917,9 @@ public class GameFlagManager implements Listener
|
||||
if (!game.TeleportsDisqualify)
|
||||
return;
|
||||
|
||||
if (!game.IsAlive(event.getPlayer()))
|
||||
return;
|
||||
|
||||
//Remove Kit
|
||||
game.RemoveTeamPreference(event.getPlayer());
|
||||
game.GetPlayerKits().remove(event.getPlayer());
|
||||
|
@ -103,7 +103,7 @@ public class GameHostManager implements Listener
|
||||
legendGames.add(GameType.SnowFight);
|
||||
legendGames.add(GameType.Gravity);
|
||||
legendGames.add(GameType.Barbarians);
|
||||
legendGames.add(GameType.MineWare);
|
||||
legendGames.add(GameType.OldMineWare);
|
||||
legendGames.add(GameType.SmashDomination);
|
||||
// Team variants
|
||||
legendGames.add(GameType.DragonEscapeTeams);
|
||||
|
@ -73,7 +73,7 @@ public class IdleManager implements Listener
|
||||
|
||||
if (_yaw.get(player) == player.getLocation().getYaw())
|
||||
{
|
||||
if (UtilTime.elapsed(_idle.get(player), 120000))
|
||||
if (UtilTime.elapsed(_idle.get(player), getArcadeManager().GetGame().IsLive() ? 240000 : 120000))
|
||||
{
|
||||
if (getArcadeManager().GetGame().GetState() != GameState.Recruit && !getArcadeManager().GetGame().IsAlive(player))
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user