Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex

This commit is contained in:
Jonathan Williams 2014-07-31 23:39:08 -07:00
commit 46fb27afbb
12 changed files with 85 additions and 54 deletions

View File

@ -367,6 +367,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation
{
return _statsManager;
}
public ServerStatusManager GetServerStatusManager()
{
return _serverStatusManager;
}
public ChatColor GetColor(Player player)
{

View File

@ -17,7 +17,7 @@ public class KitRevealer extends SneakyAssassinKit
super(manager, "Revealer", KitAvailability.Blue,
new String[]
{
"Carries two extra Smokebombs!"
"Carries three Revealers which explode and reveal nearby assassins!"
},
new Perk[]
{

View File

@ -63,10 +63,8 @@ public class NpcManager implements Listener
if (event.getType() != UpdateType.TICK)
return;
if (getGame().GetState() != Game.GameState.Live)
return;
bustle();
if (getGame().GetState() == Game.GameState.Live || getGame().GetState() == Game.GameState.Prepare)
bustle();
}
@EventHandler

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

@ -129,7 +129,7 @@ public abstract class Kit implements Listener
LivingEntity entity = (LivingEntity) Manager.GetCreature().SpawnEntity(loc, type);
entity.setRemoveWhenFarAway(false);
entity.setCustomName(GetAvailability().GetColor() + GetName() + " Kit" + (GetAvailability() == KitAvailability.Blue ? ChatColor.GRAY + " (" + ChatColor.WHITE + "Ultra" + ChatColor.GRAY + ")" : ""));
entity.setCustomName(GetAvailability().GetColor() + GetName() + " Kit" + (GetAvailability() == KitAvailability.Blue ? ChatColor.GRAY + " (" + ChatColor.WHITE + "Premium" + ChatColor.GRAY + ")" : ""));
entity.setCustomNameVisible(true);
entity.getEquipment().setItemInHand(_itemInHand);

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);

View File

@ -977,7 +977,9 @@ public class GameLobbyManager implements IPacketRunnable, Listener
System.out.println("Manager.GetServerConfig() is null");
}
if (client.GetRank().Has(Rank.ULTRA) || donor.OwnsUnknownPackage(game.GetName() + " " + ent.GetKit().GetName()) || donor.OwnsUnknownPackage(Manager.GetServerConfig().ServerType + " ULTRA") || ent.GetKit().GetAvailability() == KitAvailability.Free)
if (ent.GetKit().GetAvailability() == KitAvailability.Free || //Free
donor.OwnsUnknownPackage(Manager.GetGame().GetName() + " " + ent.GetKit().GetName()) || //Green
Manager.GetServerStatusManager().getCurrentServerName().toLowerCase().contains("free")) //Blue
{
entityName = ent.GetKit().GetAvailability().GetColor() + entityName;
}
@ -986,9 +988,9 @@ public class GameLobbyManager implements IPacketRunnable, Listener
entityName = ChatColor.RED + C.Bold + entityName;
if (ent.GetKit().GetAvailability() != KitAvailability.Blue)
entityName += ChatColor.RESET + " " + ChatColor.WHITE + C.Line + ent.GetKit().GetCost() + " Gems";
entityName += ChatColor.RESET + " (" + C.cGreen + ent.GetKit().GetCost() + " Gems" + ChatColor.RESET + ")";
else
entityName += ChatColor.RESET + " " + ChatColor.WHITE + C.Line + "Ultra";
entityName += ChatColor.RESET + " (" + C.cAqua + "Premium" + ChatColor.RESET + ")";
}
return entityName;

View File

@ -314,11 +314,11 @@ public class GamePlayerManager implements Listener
if (!Manager.GetGame().HasKit(kit))
return;
CoreClient client = Manager.GetClients().Get(player);
Donor donor = Manager.GetDonation().Get(player.getName());
if (kit.GetAvailability() == KitAvailability.Free || client.GetRank().Has(Rank.ULTRA) || donor.OwnsUnknownPackage(Manager.GetServerConfig().ServerType + " ULTRA") || donor.OwnsUnknownPackage(Manager.GetGame().GetName() + " " + kit.GetName()))
if (kit.GetAvailability() == KitAvailability.Free || //Free
donor.OwnsUnknownPackage(Manager.GetGame().GetName() + " " + kit.GetName()) || //Green
Manager.GetServerStatusManager().getCurrentServerName().toLowerCase().contains("free")) //Blue
{
Manager.GetGame().SetKit(player, kit, true);
}
@ -343,13 +343,12 @@ public class GamePlayerManager implements Listener
if (kit.GetAvailability() == KitAvailability.Blue)
{
UtilPlayer.message(player, F.main("Kit", "This kit requires " + F.elem(C.cAqua + "Ultra") + "."));
UtilPlayer.message(player, F.main("Kit", "Purchase at " + F.elem(C.cYellow + "www.mineplex.com/shop")));
UtilPlayer.message(player, F.main("Kit", "This " + F.elem(C.cAqua + "Premium Kit") + " is only available on " + F.elem(C.cAqua + "Premium Servers") + "."));
UtilPlayer.message(player, F.main("Kit", "Buy " + F.elem(C.cAqua + "Ultra") + " at " + F.elem(C.cGreen + C.Line + "www.mineplex.com/shop") + " to use " + F.elem(C.cAqua + "Premium Kits") + "."));
}
else
{
UtilPlayer.message(player, F.main("Kit", "You do not have enough " + F.elem(C.cGreen + "Gems") + "."));
UtilPlayer.message(player, F.main("Kit", "Purchase more at " + F.elem(C.cYellow + "www.mineplex.com/shop")));
}
}
}