Added stained glass around power-up beacon base in sneaky assassins to identify power-up more easily.

Added workaround to make revealer fireworks explode consistently
Power-ups use UtilPlayer.message and have a sound effect is player when a power-up is aqcuired
Power-up bug fixes
This commit is contained in:
CoderTim 2014-07-31 23:35:50 -04:00
parent 6ac00cde99
commit c36242cc47
6 changed files with 66 additions and 39 deletions

View File

@ -1,5 +1,6 @@
package nautilus.game.arcade.game.games.sneakyassassins.powerups;
import mineplex.core.common.util.*;
import org.bukkit.*;
import org.bukkit.entity.*;
import org.bukkit.inventory.*;
@ -39,15 +40,18 @@ public class ArmorPowerUp extends PowerUp
@Override
public boolean powerUpPlayer(Player player)
{
if (powerUpArmor(player) || powerUpArmor(player))
{
player.sendMessage("Your armor was upgraded!");
boolean powerUp1 = powerUpArmor(player);
boolean powerUp2 = powerUpArmor(player);
return true;
if (powerUp1 || powerUp2)
{
UtilPlayer.message(player, F.main("Power-Up", "Your " + F.item("Armor") + " was upgraded."));
return super.powerUpPlayer(player);
}
else
{
player.sendMessage("Your armor is already fully upgraded!");
UtilPlayer.message(player, F.main("Power-Up", "Your " + F.item("Armor") + " is already fully upgraded!"));
return false;
}

View File

@ -7,6 +7,7 @@ import org.bukkit.*;
import org.bukkit.block.*;
import org.bukkit.entity.*;
import org.bukkit.inventory.*;
import org.bukkit.material.*;
import org.bukkit.util.*;
public abstract class PowerUp
@ -16,8 +17,7 @@ public abstract class PowerUp
private final Location _location;
private Location _effectLocation;
private Block _beaconBlock;
private BlockState _originalBeaconBlock;
private BlockState[][] _originalBeaconBase = new BlockState[3][3];
private BlockState[][][] _originalBeaconBlocks = new BlockState[3][2][3];
private Item _item;
public PowerUp(PowerUpManager powerUpManager, PowerUpType powerUpType, Location location)
@ -39,21 +39,28 @@ public abstract class PowerUp
return _location;
}
@SuppressWarnings("deprecation")
public void activate()
{
_beaconBlock = getLocation().getBlock().getRelative(BlockFace.DOWN);
_originalBeaconBlock = _beaconBlock.getState();
_beaconBlock.setType(Material.BEACON);
for (int x = 0; x < 3; x++)
{
for (int z = 0; z < 3; z++)
for (int y = 0; y < 2; y++)
{
Block beaconBaseBlock = _beaconBlock.getRelative(x-1, -1, z-1);
for (int z = 0; z < 3; z++)
{
Block beaconBaseBlock = _beaconBlock.getRelative(x - 1, y - 1, z - 1);
_originalBeaconBase[x][z] = beaconBaseBlock.getState();
beaconBaseBlock.setType(Material.IRON_BLOCK);
_originalBeaconBlocks[x][y][z] = beaconBaseBlock.getState();
if (y == 0)
beaconBaseBlock.setType(Material.IRON_BLOCK);
else if (x == 1 && z == 1)
beaconBaseBlock.setType(Material.BEACON);
else
beaconBaseBlock.setTypeIdAndData(Material.STAINED_GLASS.getId(), getPowerUpType().getDyeColor().getWoolData(), false);
}
}
}
}
@ -114,14 +121,18 @@ public abstract class PowerUp
_item = null;
}
_originalBeaconBlock.update(true, false);
for (int x = 0; x < _originalBeaconBase.length; x++)
for (int z = 0; z < _originalBeaconBase[0].length; z++)
_originalBeaconBase[x][z].update(true, false);
for (int x = 0; x < _originalBeaconBlocks.length; x++)
for (int y = 0; y < _originalBeaconBlocks[x].length; y++)
for (int z = 0; z < _originalBeaconBlocks[x][y].length; z++)
_originalBeaconBlocks[x][y][z].update(true, false);
getPowerUpManager().removePowerUp(this);
}
public abstract boolean powerUpPlayer(Player player);
public boolean powerUpPlayer(Player player)
{
player.playSound(player.getEyeLocation(), Sound.LEVEL_UP, 2f, 0.8f);
return true;
}
}

View File

@ -177,7 +177,7 @@ public class PowerUpManager implements Listener
if (_powerUpPickUpCooldown.get(event.getPlayer().getUniqueId()) == powerUp)
_powerUpPickUpCooldown.remove(event.getPlayer().getUniqueId());
}
}, 2000);
}, 40);
}
}
}

View File

@ -4,13 +4,13 @@ import org.bukkit.*;
public enum PowerUpType
{
WEAPON(Material.DIAMOND_SWORD, Color.RED),
ARMOR(Material.IRON_CHESTPLATE, Color.BLUE);
WEAPON(Material.DIAMOND_SWORD, DyeColor.RED),
ARMOR(Material.IRON_CHESTPLATE, DyeColor.BLUE);
private final Material _itemType;
private final Color _color;
private final DyeColor _color;
PowerUpType(Material type, Color color)
PowerUpType(Material type, DyeColor color)
{
_itemType = type;
_color = color;
@ -22,6 +22,11 @@ public enum PowerUpType
}
public Color getColor()
{
return getDyeColor().getColor();
}
public DyeColor getDyeColor()
{
return _color;
}

View File

@ -1,5 +1,6 @@
package nautilus.game.arcade.game.games.sneakyassassins.powerups;
import mineplex.core.common.util.*;
import org.bukkit.*;
import org.bukkit.entity.*;
import org.bukkit.inventory.*;
@ -30,16 +31,20 @@ public class WeaponPowerUp extends PowerUp
if (swordSlot != -1)
{
int newSwordType = Math.min(SWORD_PROGRESSION.size() - 1, swordType + 1);
player.getInventory().setItem(swordSlot, new ItemStack(SWORD_PROGRESSION.get(newSwordType)));
int newSwordType = swordType + 1;
player.sendMessage("You sword was upgraded!");
if (newSwordType < SWORD_PROGRESSION.size())
{
player.getInventory().setItem(swordSlot, new ItemStack(SWORD_PROGRESSION.get(newSwordType)));
return true;
UtilPlayer.message(player, F.main("Power-Up", "Your " + F.item("Sword") + " was upgraded."));
return super.powerUpPlayer(player);
}
}
}
player.sendMessage("Your sword is already fully upgraded!");
UtilPlayer.message(player, F.main("Power-Up", "Your " + F.item("Sword") + " is already fully upgraded!"));
return false;
}

View File

@ -18,6 +18,14 @@ import java.util.*;
public class PerkRevealer extends Perk implements IThrown
{
private static final FireworkEffect REVEALER_FIREWORK_EFFECT = FireworkEffect
.builder()
.flicker(false)
.withColor(Color.GREEN)
.with(FireworkEffect.Type.BALL_LARGE)
.trail(false)
.build();
private static class RevealedPlayerInfo
{
public int _expirationSeconds = 5;
@ -106,15 +114,9 @@ public class PerkRevealer extends Perk implements IThrown
private void explode(ProjectileUser data)
{
FireworkEffect effect = FireworkEffect
.builder()
.flicker(false)
.withColor(Color.GREEN)
.with(FireworkEffect.Type.BALL_LARGE)
.trail(false)
.build();
UtilFirework.playFirework(data.GetThrown().getLocation(), effect);
// Workaround to make firework effect always visible
for (int i = 0; i < 3; i++)
UtilFirework.playFirework(data.GetThrown().getLocation(), REVEALER_FIREWORK_EFFECT);
data.GetThrown().getLocation().getWorld().playSound(data.GetThrown().getLocation(), Sound.ZOMBIE_UNFECT, 2f, 0.5f);