Change death effect skull and item spawn height, add /restrict <challenge> command.

This commit is contained in:
Thanos paravantis 2016-01-02 15:27:44 +02:00
parent c0a397b9fb
commit b3e2d67152
4 changed files with 64 additions and 12 deletions

View File

@ -1 +1 @@
[[{"location":"C:\\@Thanos\\Documents\\Minecraft\\Mineplex\\projects\\Mineplex\\Plugins\\Libraries\\craftbukkit.jar","type":"JAR","hints":{}},"ABSENT"],[{"location":"C:\\@Thanos\\Documents\\Minecraft\\Mineplex\\projects\\Mineplex\\Plugins\\Mineplex.Core.Common","type":"PROJECT","hints":{"PROJECT_NAME":"Mineplex.Core.Common"}},"ABSENT"]]
[[{"location":"C:\\@Thanos\\Documents\\Minecraft\\Mineplex\\projects\\Mineplex\\Plugins\\Mineplex.Core.Common","type":"PROJECT","hints":{"PROJECT_NAME":"Mineplex.Core.Common"}},"ABSENT"],[{"location":"C:\\@Thanos\\Documents\\Minecraft\\Mineplex\\projects\\Mineplex\\Plugins\\Nautilus.Game.Arcade","type":"PROJECT","hints":{"PROJECT_NAME":"Nautilus.Game.Arcade"}},"ABSENT"],[{"location":"C:\\Program Files\\Java\\jre1.8.0_51","type":"JRE","hints":{}},"jre:jre:1.8.0"]]

View File

@ -31,15 +31,19 @@ import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.scheduler.BukkitRunnable;
import com.google.common.base.Joiner;
import mineplex.core.account.CoreClient;
import mineplex.core.blood.BloodEvent;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlockText;
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.UtilText;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTextTop;
import mineplex.core.common.util.UtilTime;
@ -162,6 +166,57 @@ public class MineWare extends SoloGame implements IThrown
);
}
// Debug Only
@SuppressWarnings("unchecked")
@EventHandler
public void restrictChallengeCommand(PlayerCommandPreprocessEvent event)
{
Player player = event.getPlayer();
String command = "restrict";
String message = event.getMessage();
if (player.isOp())
{
if (message.startsWith("/" + command))
{
String[] pieces = message.split(" ");
if (pieces.length > 1)
{
String rawClass = pieces[1].replace("Challenge", "");
try
{
Class<? extends Challenge> result = (Class<? extends Challenge>) Class.forName("nautilus.game.arcade.game.games.mineware.challenges.Challenge" + rawClass);
String name = rawClass.replaceAll("(?!^)([A-Z])", " $1");
Announce(C.cAqua + C.Bold + GetType().GetName() + " restricted to " + name + " challenge.");
_challenges.clear();
_challenges.add(result);
}
catch (ClassNotFoundException e)
{
UtilPlayer.message(player, F.main("Debug", "Could not match " + F.elem(rawClass) + " with any challenges."));
}
catch (ClassCastException e)
{
UtilPlayer.message(player, F.main("Debug", "Could not match " + F.elem(rawClass) + " with any challenges."));
}
}
else
{
Announce(C.cAqua + C.Bold + GetType().GetName() + " challenge restrictions were cleared.");
_challenges.clear();
PopulateOrders();
}
event.setCancelled(true);
}
}
}
public void PopulateOrders()
{
_challenges.add(ChallengeAnvilDance.class);
@ -494,9 +549,11 @@ public class MineWare extends SoloGame implements IThrown
return;
Player player = event.getEntity();
Location death = player.getLocation().clone();
_challenge.getLost().add(player);
LoseLife(event.getEntity(), true);
_deathEffect.playDeath(player, death);
}
@EventHandler
@ -885,11 +942,9 @@ public class MineWare extends SoloGame implements IThrown
public void LoseLife(Player player, boolean isDeath)
{
Location death = player.getLocation().clone();
if (!isDeath)
{
Manager.addSpectator(player, false);
Manager.addSpectator(player, true);
}
if (_challenge == null || _challenge.IsCompleted(player))
@ -897,7 +952,7 @@ public class MineWare extends SoloGame implements IThrown
int lives = GetLives(player);
int playersAlive = 0;
for(Player players: _lives.keySet())
{
if(_lives.get(players) > 0)
@ -926,11 +981,9 @@ public class MineWare extends SoloGame implements IThrown
if (isDeath)
{
Manager.addSpectator(player, false);
Manager.addSpectator(player, true);
}
}
_deathEffect.playDeath(player, death);
}
public void endCurrentChallenge() // TODO

View File

@ -368,7 +368,7 @@ public class ChallengeMinecartDance extends Challenge
}
}
}.runTaskLater(Host.Manager.getPlugin(), ticks);
}.runTaskLater(Host.Manager.getPlugin(), ticks * 20);
}
public void spawnFireworkAtCorners(Color color)

View File

@ -110,8 +110,7 @@ public class DeathEffect
@SuppressWarnings("deprecation")
private void spawnChickenHead(DeathEffectData data)
{
Location loc = data.getLocation();
Location dropsite = loc.clone().subtract(0, 0.7, 0);
Location dropsite = data.getLocation();
ArmorStand chickenHead = _host.WorldData.World.spawn(dropsite, ArmorStand.class);
chickenHead.setVisible(false);
@ -128,7 +127,7 @@ public class DeathEffect
data.setChickenHead(chickenHead);
playHeadRotation(data);
Hologram hologram = getRandomHologram(loc);
Hologram hologram = getRandomHologram(dropsite);
hologram.start();
data.setHologram(hologram);
}