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:
parent
6ac00cde99
commit
c36242cc47
@ -1,5 +1,6 @@
|
|||||||
package nautilus.game.arcade.game.games.sneakyassassins.powerups;
|
package nautilus.game.arcade.game.games.sneakyassassins.powerups;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.*;
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.*;
|
||||||
import org.bukkit.inventory.*;
|
import org.bukkit.inventory.*;
|
||||||
@ -39,15 +40,18 @@ public class ArmorPowerUp extends PowerUp
|
|||||||
@Override
|
@Override
|
||||||
public boolean powerUpPlayer(Player player)
|
public boolean powerUpPlayer(Player player)
|
||||||
{
|
{
|
||||||
if (powerUpArmor(player) || powerUpArmor(player))
|
boolean powerUp1 = powerUpArmor(player);
|
||||||
{
|
boolean powerUp2 = powerUpArmor(player);
|
||||||
player.sendMessage("Your armor was upgraded!");
|
|
||||||
|
|
||||||
return true;
|
if (powerUp1 || powerUp2)
|
||||||
|
{
|
||||||
|
UtilPlayer.message(player, F.main("Power-Up", "Your " + F.item("Armor") + " was upgraded."));
|
||||||
|
|
||||||
|
return super.powerUpPlayer(player);
|
||||||
}
|
}
|
||||||
else
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import org.bukkit.*;
|
|||||||
import org.bukkit.block.*;
|
import org.bukkit.block.*;
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.*;
|
||||||
import org.bukkit.inventory.*;
|
import org.bukkit.inventory.*;
|
||||||
|
import org.bukkit.material.*;
|
||||||
import org.bukkit.util.*;
|
import org.bukkit.util.*;
|
||||||
|
|
||||||
public abstract class PowerUp
|
public abstract class PowerUp
|
||||||
@ -16,8 +17,7 @@ public abstract class PowerUp
|
|||||||
private final Location _location;
|
private final Location _location;
|
||||||
private Location _effectLocation;
|
private Location _effectLocation;
|
||||||
private Block _beaconBlock;
|
private Block _beaconBlock;
|
||||||
private BlockState _originalBeaconBlock;
|
private BlockState[][][] _originalBeaconBlocks = new BlockState[3][2][3];
|
||||||
private BlockState[][] _originalBeaconBase = new BlockState[3][3];
|
|
||||||
private Item _item;
|
private Item _item;
|
||||||
|
|
||||||
public PowerUp(PowerUpManager powerUpManager, PowerUpType powerUpType, Location location)
|
public PowerUp(PowerUpManager powerUpManager, PowerUpType powerUpType, Location location)
|
||||||
@ -39,21 +39,28 @@ public abstract class PowerUp
|
|||||||
return _location;
|
return _location;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void activate()
|
public void activate()
|
||||||
{
|
{
|
||||||
_beaconBlock = getLocation().getBlock().getRelative(BlockFace.DOWN);
|
_beaconBlock = getLocation().getBlock().getRelative(BlockFace.DOWN);
|
||||||
|
|
||||||
_originalBeaconBlock = _beaconBlock.getState();
|
|
||||||
_beaconBlock.setType(Material.BEACON);
|
|
||||||
|
|
||||||
for (int x = 0; x < 3; x++)
|
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();
|
_originalBeaconBlocks[x][y][z] = beaconBaseBlock.getState();
|
||||||
beaconBaseBlock.setType(Material.IRON_BLOCK);
|
|
||||||
|
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;
|
_item = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
_originalBeaconBlock.update(true, false);
|
for (int x = 0; x < _originalBeaconBlocks.length; x++)
|
||||||
|
for (int y = 0; y < _originalBeaconBlocks[x].length; y++)
|
||||||
for (int x = 0; x < _originalBeaconBase.length; x++)
|
for (int z = 0; z < _originalBeaconBlocks[x][y].length; z++)
|
||||||
for (int z = 0; z < _originalBeaconBase[0].length; z++)
|
_originalBeaconBlocks[x][y][z].update(true, false);
|
||||||
_originalBeaconBase[x][z].update(true, false);
|
|
||||||
|
|
||||||
getPowerUpManager().removePowerUp(this);
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -177,7 +177,7 @@ public class PowerUpManager implements Listener
|
|||||||
if (_powerUpPickUpCooldown.get(event.getPlayer().getUniqueId()) == powerUp)
|
if (_powerUpPickUpCooldown.get(event.getPlayer().getUniqueId()) == powerUp)
|
||||||
_powerUpPickUpCooldown.remove(event.getPlayer().getUniqueId());
|
_powerUpPickUpCooldown.remove(event.getPlayer().getUniqueId());
|
||||||
}
|
}
|
||||||
}, 2000);
|
}, 40);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,13 +4,13 @@ import org.bukkit.*;
|
|||||||
|
|
||||||
public enum PowerUpType
|
public enum PowerUpType
|
||||||
{
|
{
|
||||||
WEAPON(Material.DIAMOND_SWORD, Color.RED),
|
WEAPON(Material.DIAMOND_SWORD, DyeColor.RED),
|
||||||
ARMOR(Material.IRON_CHESTPLATE, Color.BLUE);
|
ARMOR(Material.IRON_CHESTPLATE, DyeColor.BLUE);
|
||||||
|
|
||||||
private final Material _itemType;
|
private final Material _itemType;
|
||||||
private final Color _color;
|
private final DyeColor _color;
|
||||||
|
|
||||||
PowerUpType(Material type, Color color)
|
PowerUpType(Material type, DyeColor color)
|
||||||
{
|
{
|
||||||
_itemType = type;
|
_itemType = type;
|
||||||
_color = color;
|
_color = color;
|
||||||
@ -22,6 +22,11 @@ public enum PowerUpType
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Color getColor()
|
public Color getColor()
|
||||||
|
{
|
||||||
|
return getDyeColor().getColor();
|
||||||
|
}
|
||||||
|
|
||||||
|
public DyeColor getDyeColor()
|
||||||
{
|
{
|
||||||
return _color;
|
return _color;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package nautilus.game.arcade.game.games.sneakyassassins.powerups;
|
package nautilus.game.arcade.game.games.sneakyassassins.powerups;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.*;
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.*;
|
||||||
import org.bukkit.inventory.*;
|
import org.bukkit.inventory.*;
|
||||||
@ -30,16 +31,20 @@ public class WeaponPowerUp extends PowerUp
|
|||||||
|
|
||||||
if (swordSlot != -1)
|
if (swordSlot != -1)
|
||||||
{
|
{
|
||||||
int newSwordType = Math.min(SWORD_PROGRESSION.size() - 1, swordType + 1);
|
int newSwordType = swordType + 1;
|
||||||
player.getInventory().setItem(swordSlot, new ItemStack(SWORD_PROGRESSION.get(newSwordType)));
|
|
||||||
|
|
||||||
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,14 @@ import java.util.*;
|
|||||||
|
|
||||||
public class PerkRevealer extends Perk implements IThrown
|
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
|
private static class RevealedPlayerInfo
|
||||||
{
|
{
|
||||||
public int _expirationSeconds = 5;
|
public int _expirationSeconds = 5;
|
||||||
@ -106,15 +114,9 @@ public class PerkRevealer extends Perk implements IThrown
|
|||||||
|
|
||||||
private void explode(ProjectileUser data)
|
private void explode(ProjectileUser data)
|
||||||
{
|
{
|
||||||
FireworkEffect effect = FireworkEffect
|
// Workaround to make firework effect always visible
|
||||||
.builder()
|
for (int i = 0; i < 3; i++)
|
||||||
.flicker(false)
|
UtilFirework.playFirework(data.GetThrown().getLocation(), REVEALER_FIREWORK_EFFECT);
|
||||||
.withColor(Color.GREEN)
|
|
||||||
.with(FireworkEffect.Type.BALL_LARGE)
|
|
||||||
.trail(false)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
UtilFirework.playFirework(data.GetThrown().getLocation(), effect);
|
|
||||||
|
|
||||||
data.GetThrown().getLocation().getWorld().playSound(data.GetThrown().getLocation(), Sound.ZOMBIE_UNFECT, 2f, 0.5f);
|
data.GetThrown().getLocation().getWorld().playSound(data.GetThrown().getLocation(), Sound.ZOMBIE_UNFECT, 2f, 0.5f);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user