Working on the new MineWare theme.
This commit is contained in:
parent
d5dd342af3
commit
a15f6f8473
@ -1 +1 @@
|
||||
{}
|
||||
[[{"location":"C:\\Program Files\\Java\\jre1.8.0_51","type":"JRE","hints":{}},"jre:jre:1.8.0"],[{"location":"C:\\@Thanos\\Documents\\Minecraft\\Mineplex\\projects\\Mineplex\\Plugins\\Mineplex.Core","type":"PROJECT","hints":{"PROJECT_NAME":"Mineplex.Core"}},"ABSENT"],[{"location":"C:\\@Thanos\\Documents\\Minecraft\\Mineplex\\projects\\Mineplex\\Plugins\\Nautilus.Game.Arcade","type":"PROJECT","hints":{"PROJECT_NAME":"Nautilus.Game.Arcade"}},"ABSENT"],[{"location":"C:\\@Thanos\\Documents\\Minecraft\\Mineplex\\projects\\Mineplex\\Plugins\\Libraries\\craftbukkit.jar","type":"JAR","hints":{}},"ABSENT"]]
|
@ -35,6 +35,7 @@ public abstract class Challenge implements Listener
|
||||
{
|
||||
LastStanding, FirstComplete
|
||||
}
|
||||
|
||||
public MineWare Host;
|
||||
|
||||
protected int Places;
|
||||
@ -512,5 +513,4 @@ public abstract class Challenge implements Listener
|
||||
{
|
||||
return !Completed.isEmpty();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,102 @@
|
||||
package nautilus.game.arcade.game.games.mineware;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
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.Item;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
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.itemstack.ItemBuilder;
|
||||
|
||||
public class DeathEffect
|
||||
{
|
||||
private MineWare _host;
|
||||
private JavaPlugin _plugin;
|
||||
private ArrayList<Item> _eggs = new ArrayList<Item>();
|
||||
|
||||
public DeathEffect(MineWare host)
|
||||
{
|
||||
_host = host;
|
||||
_plugin = host.getArcadeManager().getPlugin();
|
||||
}
|
||||
|
||||
public void playDeath(Player player)
|
||||
{
|
||||
Location loc = player.getLocation();
|
||||
Block belowFirst = loc.getBlock().getRelative(BlockFace.DOWN);
|
||||
Block belowSecond = belowFirst.getRelative(BlockFace.DOWN);
|
||||
|
||||
if (!belowFirst.isEmpty() || !belowSecond.isEmpty())
|
||||
{
|
||||
System.out.println("Death effect triggered for " + player.getName() + ".");
|
||||
startEggSpawnTask(loc);
|
||||
}
|
||||
}
|
||||
|
||||
private void startEggSpawnTask(Location loc)
|
||||
{
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
loc.add(0, 1, 0);
|
||||
|
||||
ItemBuilder builder = new ItemBuilder(Material.EGG);
|
||||
builder.setTitle(UtilMath.r(999999) + "Egg");
|
||||
|
||||
Item egg = loc.getWorld().dropItem(loc, builder.build());
|
||||
|
||||
Vector velocity = new Vector((Math.random() - 0.5) * 0.5, 0.1 + Math.random() * 0.3,
|
||||
(Math.random() - 0.5) * 0.5);
|
||||
egg.setVelocity(velocity);
|
||||
|
||||
_eggs.add(egg);
|
||||
removeSpawnedEggTask(egg);
|
||||
}
|
||||
|
||||
loc.getWorld().playSound(loc, Sound.CHICKEN_EGG_POP, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
private void removeSpawnedEggTask(Item egg)
|
||||
{
|
||||
new BukkitRunnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (egg.isValid() && _eggs.contains(egg))
|
||||
{
|
||||
UtilParticle.PlayParticleToAll(ParticleType.HAPPY_VILLAGER, egg.getLocation(), 0.0F, 0.0F, 0.0F,
|
||||
0.0F, 1, ViewDist.MAX);
|
||||
_eggs.remove(egg);
|
||||
egg.remove();
|
||||
}
|
||||
}
|
||||
}.runTaskLater(_plugin, 60L);
|
||||
}
|
||||
|
||||
public void removeSpawnedEggs()
|
||||
{
|
||||
for (Item item : _eggs)
|
||||
{
|
||||
if (item.isValid())
|
||||
{
|
||||
item.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean shouldCancel()
|
||||
{
|
||||
return !_host.IsLive() || !_host.isChallengeStarted();
|
||||
}
|
||||
}
|
@ -32,6 +32,7 @@ import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
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;
|
||||
@ -116,6 +117,8 @@ public class MineWare extends SoloGame implements IThrown
|
||||
private ArrayList<Class<? extends Challenge>> _challenges = new ArrayList<Class<? extends Challenge>>();
|
||||
private ArrayList<Class<? extends Challenge>> _challengesCopy = new ArrayList<Class<? extends Challenge>>();
|
||||
|
||||
private DeathEffect _deathEffect = new DeathEffect(this);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public MineWare(ArcadeManager manager)
|
||||
{
|
||||
@ -219,6 +222,12 @@ public class MineWare extends SoloGame implements IThrown
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlood(BloodEvent event)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void EndCheck()
|
||||
{
|
||||
@ -482,7 +491,10 @@ public class MineWare extends SoloGame implements IThrown
|
||||
if (_challenge == null)
|
||||
return;
|
||||
|
||||
_challenge.getLost().add(event.getEntity());
|
||||
Player player = event.getEntity();
|
||||
|
||||
_challenge.getLost().add(player);
|
||||
_deathEffect.playDeath(player);
|
||||
LoseLife(event.getEntity(), true);
|
||||
}
|
||||
|
||||
@ -911,8 +923,6 @@ public class MineWare extends SoloGame implements IThrown
|
||||
{
|
||||
Manager.addSpectator(player, true);
|
||||
}
|
||||
|
||||
player.playSound(player.getLocation(), Sound.CHICKEN_HURT, 1.5F, 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
@ -939,6 +949,7 @@ public class MineWare extends SoloGame implements IThrown
|
||||
Bukkit.getServer().getPluginManager().callEvent(new ChallengeEndEvent(_challenge));
|
||||
HandlerList.unregisterAll(_challenge);
|
||||
|
||||
_deathEffect.removeSpawnedEggs();
|
||||
_challenge.EndOrder();
|
||||
_isChallengeStarted = false;
|
||||
|
||||
|
@ -214,7 +214,7 @@ public class ChallengeReverseTag extends Challenge
|
||||
{
|
||||
//UtilPlayer.message(player, C.cYellow + C.Bold + "You are " + C.cRed + "NO LONGER" + C.cYellow + " tagged!");
|
||||
|
||||
UtilTextMiddle.display(null, C.cRed + "You are no longer tagged.", 5, 40, 5);
|
||||
UtilTextMiddle.display(null, C.cRed + "You are no longer tagged.", 5, 40, 5, player);
|
||||
player.getInventory().setHelmet(new ItemStack(Material.AIR));
|
||||
_tagged.remove(player.getName());
|
||||
|
||||
@ -236,7 +236,7 @@ public class ChallengeReverseTag extends Challenge
|
||||
{
|
||||
// UtilPlayer.message(player, C.cYellow + C.Bold + "You are " + C.cGreen + "NOW" + C.cYellow + " tagged! Keep it up!");
|
||||
|
||||
UtilTextMiddle.display(null, C.cGreen + "You are now tagged, keep it up.", 5, 40, 5);
|
||||
UtilTextMiddle.display(null, C.cGreen + "You are now tagged, keep it up.", 5, 40, 5, player);
|
||||
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(35, (byte) 5));
|
||||
_tagged.add(player.getName());
|
||||
_cooldowned.add(player.getName());
|
||||
|
@ -19,7 +19,7 @@ public class KitBawksFood extends Kit
|
||||
public KitBawksFood(ArcadeManager manager)
|
||||
{
|
||||
super(manager,
|
||||
"Bawks Food",
|
||||
"Bawk's Food",
|
||||
KitAvailability.Free,
|
||||
new String[] { "You must listen to Bawk Bawk." },
|
||||
new Perk[] { },
|
||||
@ -42,21 +42,25 @@ public class KitBawksFood extends Kit
|
||||
ItemStack helmet = new ItemStack(Material.LEATHER_HELMET);
|
||||
LeatherArmorMeta helmetMeta = (LeatherArmorMeta) helmet.getItemMeta();
|
||||
helmetMeta.setColor(Color.WHITE);
|
||||
helmetMeta.spigot().setUnbreakable(true);
|
||||
helmet.setItemMeta(helmetMeta);
|
||||
|
||||
ItemStack chestplate = new ItemStack(Material.LEATHER_CHESTPLATE);
|
||||
LeatherArmorMeta chestplateMeta = (LeatherArmorMeta) chestplate.getItemMeta();
|
||||
chestplateMeta.setColor(Color.WHITE);
|
||||
chestplateMeta.spigot().setUnbreakable(true);
|
||||
chestplate.setItemMeta(chestplateMeta);
|
||||
|
||||
ItemStack leggings = new ItemStack(Material.LEATHER_LEGGINGS);
|
||||
LeatherArmorMeta leggingsMeta = (LeatherArmorMeta) leggings.getItemMeta();
|
||||
leggingsMeta.setColor(Color.WHITE);
|
||||
leggingsMeta.spigot().setUnbreakable(true);
|
||||
leggings.setItemMeta(leggingsMeta);
|
||||
|
||||
ItemStack boots = new ItemStack(Material.LEATHER_BOOTS);
|
||||
LeatherArmorMeta bootsMeta = (LeatherArmorMeta) boots.getItemMeta();
|
||||
bootsMeta.setColor(Color.WHITE);
|
||||
bootsMeta.spigot().setUnbreakable(true);
|
||||
boots.setItemMeta(bootsMeta);
|
||||
|
||||
equipment.setHelmet(helmet);
|
||||
|
Loading…
Reference in New Issue
Block a user