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

This commit is contained in:
libraryaddict 2015-02-07 03:53:17 +13:00
commit 8851cccff4
33 changed files with 696 additions and 258 deletions

View File

@ -0,0 +1,157 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package net.minecraft.server.v1_7_R4;
import java.io.IOException;
import java.util.Iterator;
import org.bukkit.craftbukkit.v1_7_R4.scoreboard.CraftScoreboard;
import org.bukkit.craftbukkit.v1_7_R4.util.CraftChatMessage;
import org.bukkit.scoreboard.Team;
import net.minecraft.util.com.mojang.authlib.GameProfile;
import net.minecraft.util.com.mojang.authlib.properties.Property;
import net.minecraft.util.com.mojang.authlib.properties.PropertyMap;
public class PacketPlayOutPlayerInfo extends Packet {
public static final int ADD_PLAYER = 0;
public static final int UPDATE_GAMEMODE = 1;
public static final int UPDATE_LATENCY = 2;
public static final int UPDATE_DISPLAY_NAME = 3;
public static final int REMOVE_PLAYER = 4;
public int action;
public GameProfile player;
public int gamemode;
public int ping;
public String username;
public String _tabName;
public PacketPlayOutPlayerInfo() {
}
public static PacketPlayOutPlayerInfo addPlayer(EntityPlayer player) {
PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo();
packet.action = 0;
packet.username = player.listName;
packet.player = player.getProfile();
packet.ping = player.ping;
packet.gamemode = player.playerInteractManager.getGameMode().getId();
packet._tabName = getFormattedName(player);
return packet;
}
public static PacketPlayOutPlayerInfo updatePing(EntityPlayer player) {
PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo();
packet.action = 2;
packet.username = player.listName;
packet.player = player.getProfile();
packet.ping = player.ping;
return packet;
}
public static PacketPlayOutPlayerInfo updateGamemode(EntityPlayer player) {
PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo();
packet.action = 1;
packet.username = player.listName;
packet.player = player.getProfile();
packet.gamemode = player.playerInteractManager.getGameMode().getId();
return packet;
}
public static PacketPlayOutPlayerInfo updateDisplayName(EntityPlayer player) {
PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo();
packet.action = 3;
packet.username = player.listName;
packet.player = player.getProfile();
packet._tabName = getFormattedName(player);
return packet;
}
public static PacketPlayOutPlayerInfo removePlayer(EntityPlayer player) {
PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo();
packet.action = 4;
packet.username = player.listName;
packet.player = player.getProfile();
return packet;
}
public void a(PacketDataSerializer packetdataserializer) throws IOException {
}
public void b(PacketDataSerializer packetdataserializer) throws IOException {
if(packetdataserializer.version >= 20) {
packetdataserializer.b(this.action);
packetdataserializer.b(1);
packetdataserializer.writeUUID(this.player.getId());
switch(this.action) {
case 0:
packetdataserializer.a(this.player.getName());
PropertyMap properties = this.player.getProperties();
packetdataserializer.b(properties.size());
Iterator var3 = properties.values().iterator();
while(var3.hasNext()) {
Property property = (Property)var3.next();
packetdataserializer.a(property.getName());
packetdataserializer.a(property.getValue());
packetdataserializer.writeBoolean(property.hasSignature());
if(property.hasSignature()) {
packetdataserializer.a(property.getSignature());
}
}
packetdataserializer.b(this.gamemode);
packetdataserializer.b(this.ping);
packetdataserializer.writeBoolean(this.username != null);
if(this.username != null) {
// packetdataserializer.a(ChatSerializer.a(CraftChatMessage.fromString(this.username)[0]));
packetdataserializer.a(ChatSerializer.a(CraftChatMessage.fromString(this._tabName)[0]));
}
break;
case 1:
packetdataserializer.b(this.gamemode);
break;
case 2:
packetdataserializer.b(this.ping);
break;
case 3:
packetdataserializer.writeBoolean(this.username != null);
if(this.username != null) {
// packetdataserializer.a(ChatSerializer.a(CraftChatMessage.fromString(this.username)[0]));
packetdataserializer.a(ChatSerializer.a(CraftChatMessage.fromString(this._tabName)[0]));
}
case 4:
}
} else {
packetdataserializer.a(this.username);
packetdataserializer.writeBoolean(this.action != 4);
packetdataserializer.writeShort(this.ping);
}
}
public void a(PacketPlayOutListener packetplayoutlistener) {
packetplayoutlistener.a(this);
}
public void handle(PacketListener packetlistener) {
this.a((PacketPlayOutListener)((PacketPlayOutListener)packetlistener));
}
private static String getFormattedName(EntityPlayer player)
{
String name = player.getName();
CraftScoreboard scoreboard = player.getBukkitEntity().getScoreboard();
if (scoreboard != null)
{
Team team = scoreboard.getPlayerTeam(player.getBukkitEntity());
if (team != null)
name = team.getPrefix() + name + team.getSuffix();
}
return name;
}
}

View File

@ -637,9 +637,12 @@ public enum Achievement
public static String getExperienceString(int level)
{
if (level < 0)
return C.cPurple + level;
if (level < 20)
return C.cGray + level;
if (level < 40)
return C.cBlue + level;

View File

@ -202,8 +202,10 @@ public class AchievementManager extends MiniPlugin
public String getMineplexLevel(Player sender, Rank rank)
{
int level = get(sender, Achievement.GLOBAL_MINEPLEX_LEVEL).getLevel();
if (rank.Has(Rank.OWNER))
if (sender.getName().equalsIgnoreCase("Phinary"))
level = -level;
else if (rank.Has(Rank.OWNER))
level = Math.max(level, 50 + get(sender, Achievement.GLOBAL_GEM_HUNTER).getLevel());
else if (rank.Has(Rank.ADMIN))
level = Math.max(level, 30 + get(sender, Achievement.GLOBAL_GEM_HUNTER).getLevel());

View File

@ -5,20 +5,6 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import mineplex.core.command.CommandCenter;
import mineplex.core.common.util.C;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilTime;
import mineplex.core.friend.FriendManager;
import mineplex.core.friend.FriendStatusType;
import mineplex.core.friend.data.FriendData;
import mineplex.core.friend.data.FriendStatus;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.itemstack.ItemLayout;
import mineplex.core.shop.item.IButton;
import net.minecraft.server.v1_7_R4.EntityPlayer;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.Sound;
@ -34,6 +20,20 @@ import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import net.minecraft.server.v1_7_R4.EntityPlayer;
import mineplex.core.command.CommandCenter;
import mineplex.core.common.util.C;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilTime;
import mineplex.core.friend.FriendManager;
import mineplex.core.friend.FriendStatusType;
import mineplex.core.friend.data.FriendData;
import mineplex.core.friend.data.FriendStatus;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.itemstack.ItemLayout;
import mineplex.core.shop.item.IButton;
public class FriendsGUI implements Listener
{
@ -257,7 +257,7 @@ public class FriendsGUI implements Listener
if (friend.Online)
{
builder.addLore(C.cDGray + C.Bold + "Server: " + C.cGray + friend.ServerName);
builder.addLore(C.cGray + C.Bold + "Server: " + C.cYellow + friend.ServerName);
}
else
{

View File

@ -6,7 +6,10 @@ import java.io.IOException;
import java.util.HashSet;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin;
@ -16,7 +19,9 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.portal.Commands.*;
import mineplex.core.common.util.UtilTabTitle;
import mineplex.core.portal.Commands.SendCommand;
import mineplex.core.portal.Commands.ServerCommand;
import mineplex.serverdata.MinecraftServer;
import mineplex.serverdata.Region;
import mineplex.serverdata.ServerCommandManager;
@ -52,6 +57,15 @@ public class Portal extends MiniPlugin
// Register the server command type for future use
ServerCommandManager.getInstance().registerCommandType("TransferCommand", TransferCommand.class, new TransferHandler());
}
@EventHandler
public void join(PlayerJoinEvent event)
{
Player player = event.getPlayer();
//Player List
String serverName = _plugin.getConfig().getString("serverstatus.name");
UtilTabTitle.setHeaderAndFooter(player, C.Bold + "Mineplex Network " + C.cGreen + serverName, "Visit " + C.cGreen + "www.mineplex.com" + ChatColor.RESET + " for News, Forums and Shop");
}
public void sendAllPlayers(String serverName)
{

View File

@ -12,12 +12,15 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Rank;
import mineplex.core.donation.DonationManager;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.pet.PetManager;
import mineplex.core.reward.rewards.CoinReward;
import mineplex.core.reward.rewards.InventoryReward;
import mineplex.core.reward.rewards.PetReward;
import mineplex.core.reward.rewards.RankReward;
import mineplex.core.reward.rewards.UnknownPackageReward;
public class RewardManager
@ -26,9 +29,11 @@ public class RewardManager
private HashMap<RewardRarity, List<Reward>> _treasureMap;
private Random _random;
private CoreClientManager _clientManager;
private boolean _doubleGadgetValue;
public RewardManager(DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager,
public RewardManager(CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager,
int commonValueMin, int commonValueMax,
int uncommonValueMin, int uncommonValueMax,
int rareValueMin, int rareValueMax,
@ -44,6 +49,8 @@ public class RewardManager
_treasureMap.put(rarity, new ArrayList<Reward>());
}
_clientManager = clientManager;
_doubleGadgetValue = doubleGadgetValue;
addCommon(donationManager, inventoryManager, petManager, commonValueMin, commonValueMax);
@ -325,6 +332,19 @@ public class RewardManager
{
RewardRarity rarity = type.generateRarity(requiresUncommon);
//Dont give Rank Upgrade if already has Legend
if (rarity == RewardRarity.MYTHICAL)
{
if (_clientManager.Get(player).GetRank().Has(Rank.LEGEND))
{
rarity = RewardRarity.LEGENDARY;
}
else
{
return new RankReward(_clientManager, 0, rarity);
}
}
List<Reward> treasureList = _treasureMap.get(rarity);
int totalWeight = 0;

View File

@ -15,11 +15,11 @@ public enum RewardRarity
*/
OTHER("Other", cWhite),
COMMON("Common", cAqua),
UNCOMMON("Uncommon", cGreen),
RARE("Rare", cGold),
LEGENDARY("Legendary", cRed),
MYTHICAL("Mythical", C.cBlack);
COMMON("Common", cWhite),
UNCOMMON("Uncommon", cAqua),
RARE("Rare", cPurple),
LEGENDARY("Legendary", cGreen),
MYTHICAL("Mythical", cRed);
private String _name;
private String _color;

View File

@ -6,7 +6,7 @@ public enum RewardType
GameLoot( 0.000001, 0.001, 0.004, 3),
BasicChest( 0, 0.01, 0.04, 5),
HeroicChest( 0, 1, 4, 25),
LegendaryChest( 1, 2, 8, 40);
LegendaryChest( 1, 2.5, 10, 40);
private double _mythicalChance;
private double _legendaryChance;

View File

@ -0,0 +1,56 @@
package mineplex.core.reward.rewards;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Rank;
import mineplex.core.reward.Reward;
import mineplex.core.reward.RewardData;
import mineplex.core.reward.RewardRarity;
public class RankReward extends Reward
{
private CoreClientManager _clientManager;
public RankReward(CoreClientManager clientManager, int weight, RewardRarity rarity)
{
super(rarity, weight);
_clientManager = clientManager;
}
@Override
public RewardData giveRewardCustom(Player player)
{
Rank rank = null;
if (_clientManager.Get(player).GetRank() == Rank.ALL) rank = Rank.ULTRA;
else if (_clientManager.Get(player).GetRank() == Rank.ULTRA) rank = Rank.HERO;
else if (_clientManager.Get(player).GetRank() == Rank.HERO) rank = Rank.LEGEND;
if (rank == null)
return new RewardData(getRarity().getColor() + "Rank Upgrade Error", new ItemStack(Material.PAPER));
_clientManager.Get(player).SetRank(rank);
_clientManager.getRepository().saveRank(null, player.getName(), rank, true);
return new RewardData(getRarity().getColor() + rank.Name + " Rank", new ItemStack(Material.NETHER_STAR));
}
@Override
public boolean canGiveReward(Player player)
{
return !_clientManager.Get(player).GetRank().Has(Rank.LEGEND);
}
@Override
public boolean equals(Object obj)
{
if (obj instanceof RankReward)
return true;
return false;
}
}

View File

@ -27,10 +27,11 @@ import mineplex.core.treasure.animation.Animation;
import mineplex.core.treasure.animation.BlockChangeAnimation;
import mineplex.core.treasure.animation.ChestOpenAnimation;
import mineplex.core.treasure.animation.ChestSpawnAnimation;
import mineplex.core.treasure.animation.LegendaryAnimation;
import mineplex.core.treasure.animation.RareAnimation;
import mineplex.core.treasure.animation.LootLegendaryAnimation;
import mineplex.core.treasure.animation.LootMythicalAnimation;
import mineplex.core.treasure.animation.LootRareAnimation;
import mineplex.core.treasure.animation.TreasureRemoveAnimation;
import mineplex.core.treasure.animation.UncommonAnimation;
import mineplex.core.treasure.animation.LootUncommonAnimation;
/**
* Created by Shaun on 8/27/2014.
@ -108,13 +109,12 @@ public class Treasure
if (_tickCount % 10 == 0 && _currentChest < _chestData.length)
{
Block block = _chestData[_currentChest].getBlock();
ChestSpawnAnimation chestSpawn = new ChestSpawnAnimation(this, block, _chestBlockInfo);
ChestSpawnAnimation chestSpawn = new ChestSpawnAnimation(this,_chestData[_currentChest].getBlock(), _chestBlockInfo, _centerBlock, _currentChest);
_animations.add(chestSpawn);
_currentChest++;
}
//Auto-open after 1 minute
if (_tickCount == 60 * 20)
{
for (BlockInfo blockInfo : _chestBlockInfo)
@ -192,17 +192,22 @@ public class Treasure
// Extra effects based off the rarity of the treasure
if (reward.getRarity() == RewardRarity.UNCOMMON)
{
_animations.add(new UncommonAnimation(this, data.getBlock()));
_animations.add(new LootUncommonAnimation(this, data.getBlock()));
}
else if (reward.getRarity() == RewardRarity.RARE)
{
_animations.add(new RareAnimation(this, data.getBlock().getLocation().add(0.5, 1.5, 0.5)));
Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " found " + C.cGold + "Rare " + rewardData.getFriendlyName()));
_animations.add(new LootRareAnimation(this, data.getBlock().getLocation().add(0.5, 1.5, 0.5)));
Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " found " + C.cPurple + "Rare " + rewardData.getFriendlyName()));
}
else if (reward.getRarity() == RewardRarity.LEGENDARY)
{
_animations.add(new LegendaryAnimation(this, data.getBlock()));
Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " found " + C.cRed + "Legendary " + rewardData.getFriendlyName()));
_animations.add(new LootLegendaryAnimation(this, data.getBlock()));
Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " found " + C.cGreen + "Legendary " + rewardData.getFriendlyName()));
}
else if (reward.getRarity() == RewardRarity.MYTHICAL)
{
_animations.add(new LootMythicalAnimation(this, data.getBlock()));
Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " found " + C.cRed + "Mythical " + rewardData.getFriendlyName()));
}
if (isFinished())

View File

@ -39,7 +39,7 @@ public class TreasureManager extends MiniPlugin
_inventoryManager = inventoryManager;
_blockRestore = blockRestore;
_hologramManager = hologramManager;
_rewardManager = new RewardManager(donationManager, inventoryManager, petManager,
_rewardManager = new RewardManager(clientManager, donationManager, inventoryManager, petManager,
100, 250,
500, 1000,
1500, 2500,

View File

@ -1,6 +1,7 @@
package mineplex.core.treasure;
import org.bukkit.Material;
import org.bukkit.Sound;
import mineplex.core.common.util.UtilParticle.ParticleType;
@ -12,103 +13,37 @@ public enum TreasureStyle
/**
* These are examples, not final!
*/
NETHER(Material.NETHERRACK, (byte) 0,
Material.NETHER_BRICK, (byte) 0,
Material.NETHER_FENCE, (byte) 0,
null,
BASIC(
ParticleType.EXPLODE,
ParticleType.EXPLODE,
Sound.FIZZ,
Sound.HORSE_ARMOR),
HEROIC(
ParticleType.FLAME,
ParticleType.LAVA),
NATURE(Material.GRASS, (byte) 0,
Material.LOG, (byte) 0,
Material.LEAVES, (byte) 0,
null,
ParticleType.LAVA,
Sound.LAVA_POP,
Sound.EXPLODE),
LEGENDARY(
ParticleType.HAPPY_VILLAGER,
ParticleType.SLIME),
ParticleType.LARGE_EXPLODE,
Sound.PORTAL_TRAVEL,
Sound.ANVIL_BREAK);
WATER(Material.ICE,(byte) 9,
Material.PACKED_ICE, (byte) 5,
Material.STAINED_GLASS_PANE, (byte) 8,
null,
ParticleType.SNOW_SHOVEL,
ParticleType.SNOWBALL_POOF);
// FANCY(Material.DIAMOND_BLOCK,(byte) 0,
// Material.GOLD_BLOCK, (byte) 0,
// Material.AIR, (byte) 0,
// ParticleType.FLAME,
// ParticleType.CLOUD,
// ParticleType.LAVA),
//
// FANCY_2(Material.IRON_BLOCK,(byte) 0,
// Material.EMERALD_BLOCK, (byte) 0,
// Material.AIR, (byte) 0,
// ParticleType.FLAME,
// ParticleType.HAPPY_VILLAGER,
// null);
private Material _primaryMaterial;
private byte _primaryData;
private Material _secondaryMaterial;
private byte _secondaryData;
private Material _wallMaterial;
private byte _wallData;
private ParticleType _primaryParticle;
private ParticleType _secondaryParticle;
private ParticleType _chestSpawnParticle;
TreasureStyle(Material primaryMaterial, byte primaryData, Material secondaryMaterial, byte secondaryData, Material wallMaterial, byte wallData, ParticleType primaryParticle, ParticleType secondaryParticle, ParticleType chestSpawnParticle)
private Sound _sound;
private Sound _chestSpawnSound;
TreasureStyle(ParticleType secondaryParticle, ParticleType chestSpawnParticle, Sound sound, Sound chestSpawnSound)
{
_primaryMaterial = primaryMaterial;
_primaryData = primaryData;
_secondaryMaterial = secondaryMaterial;
_secondaryData = secondaryData;
_wallMaterial = wallMaterial;
_wallData = wallData;
_primaryParticle = primaryParticle;
_secondaryParticle = secondaryParticle;
_chestSpawnParticle = chestSpawnParticle;
}
public Material getPrimaryMaterial()
{
return _primaryMaterial;
}
public byte getPrimaryData()
{
return _primaryData;
}
public Material getSecondaryMaterial()
{
return _secondaryMaterial;
}
public byte getSecondaryData()
{
return _secondaryData;
}
public Material getWallMaterial()
{
return _wallMaterial;
}
public byte getWallData()
{
return _wallData;
}
public ParticleType getPrimaryParticle()
{
return _primaryParticle;
_sound = sound;
_chestSpawnSound = chestSpawnSound;
}
public ParticleType getSecondaryParticle()
@ -120,4 +55,14 @@ public enum TreasureStyle
{
return _chestSpawnParticle;
}
public Sound getSound()
{
return _sound;
}
public Sound getChestSpawnSound()
{
return _chestSpawnSound;
}
}

View File

@ -7,9 +7,11 @@ import mineplex.core.reward.RewardType;
public enum TreasureType
{
BASIC(C.cYellow + "Basic Chest", "Basic Chest", RewardType.BasicChest, Material.CHEST, TreasureStyle.NATURE),
HEROIC(C.cGold + "Heroic Chest", "Heroic Chest", RewardType.HeroicChest, Material.TRAPPED_CHEST, TreasureStyle.WATER),
LEGENDARY(C.cRed + "Legendary Chest", "Legendary Chest", RewardType.LegendaryChest, Material.ENDER_CHEST, TreasureStyle.NETHER);
BASIC(C.cYellow + "Basic Chest", "Basic Chest", RewardType.BasicChest, Material.CHEST, TreasureStyle.BASIC),
HEROIC(C.cGold + "Heroic Chest", "Heroic Chest", RewardType.HeroicChest, Material.TRAPPED_CHEST, TreasureStyle.HEROIC),
LEGENDARY(C.cRed + "Legendary Chest", "Legendary Chest", RewardType.LegendaryChest, Material.ENDER_CHEST, TreasureStyle.LEGENDARY);
private final String _name;
private final RewardType _rewardType;

View File

@ -44,7 +44,7 @@ public class BlockChangeAnimation extends Animation
for (int z = -_currentRadius; z <= _currentRadius; z++)
{
Block b = centerBlock.getRelative(x, y, z);
if (y > 0 && b.getType() == Material.SMOOTH_BRICK || b.getType() == Material.STEP || b.getType() == Material.SMOOTH_STAIRS)
if (y > 0 && (b.getType() == Material.SMOOTH_BRICK || b.getType() == Material.STEP || b.getType() == Material.SMOOTH_STAIRS))
{
_blockInfoList.add(new BlockInfo(b));
b.setType(Material.AIR);

View File

@ -1,21 +1,25 @@
package mineplex.core.treasure.animation;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_7_R4.util.CraftMagicNumbers;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import net.minecraft.server.v1_7_R4.PacketPlayOutBlockAction;
import net.minecraft.server.v1_7_R4.TileEntity;
import net.minecraft.server.v1_7_R4.TileEntityEnderChest;
import mineplex.core.common.util.UtilServer;
import mineplex.core.hologram.Hologram;
import mineplex.core.hologram.HologramManager;
import mineplex.core.reward.RewardData;
import mineplex.core.treasure.ChestData;
import mineplex.core.treasure.Treasure;
import net.minecraft.server.v1_7_R4.PacketPlayOutBlockAction;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_7_R4.util.CraftMagicNumbers;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
/**
* Created by Shaun on 8/29/2014.
@ -43,6 +47,15 @@ public class ChestOpenAnimation extends Animation
for (Player other : UtilServer.getPlayers())
{
((CraftPlayer) other).getHandle().playerConnection.sendPacket(packet);
if (block.getType() == Material.ENDER_CHEST)
{
// Fix for Ender Chests closing as soon as they are opened
TileEntity tileEntity = ((CraftWorld) block.getWorld()).getTileEntityAt(block.getX(), block.getY(), block.getZ());
if (tileEntity instanceof TileEntityEnderChest)
((TileEntityEnderChest)tileEntity).j = 1;
}
other.playSound(block.getLocation(), Sound.CHEST_OPEN, 1, 1);
}
}

View File

@ -2,30 +2,43 @@ package mineplex.core.treasure.animation;
import java.util.List;
import org.bukkit.Effect;
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.craftbukkit.v1_7_R4.CraftWorld;
import org.bukkit.util.Vector;
import net.minecraft.server.v1_7_R4.MathHelper;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.treasure.BlockInfo;
import mineplex.core.treasure.Treasure;
import mineplex.core.treasure.TreasureType;
/**
* Created by Shaun on 8/29/2014.
*/
public class ChestSpawnAnimation extends Animation
{
private static final int ANIMATION_DURATION = 10;
private static final int ANIMATION_DURATION = 80;
private Block _block;
private byte _direction;
private Location _centerLocation;
private Location _particleLocation;
private Vector _particleDirection;
private List<BlockInfo> _chestBlockInfo;
private double _radialOffset;
public ChestSpawnAnimation(Treasure tresure, Block block, List<BlockInfo> chestBlockInfo)
public ChestSpawnAnimation(Treasure tresure, Block block, List<BlockInfo> chestBlockInfo, Block openingCenter, double radialOffset)
{
super(tresure);
_block = block;
@ -36,7 +49,7 @@ public class ChestSpawnAnimation extends Animation
if (relX > 0)
_direction = (byte) 5;
else
_direction = (byte) 4;
_direction = (byte) 4;
}
else
{
@ -45,11 +58,17 @@ public class ChestSpawnAnimation extends Animation
else
_direction = (byte) 2;
}
_centerLocation = block.getLocation().clone().add(0.5, 0.5, 0.5);
_centerLocation.getWorld().playSound(_centerLocation, Sound.LAVA, 1, 1);
_chestBlockInfo = chestBlockInfo;
_particleLocation = openingCenter.getLocation().add(0.5, 4, 0.5);
_particleDirection = UtilAlg.getTrajectory(_particleLocation, _centerLocation);
_particleDirection.multiply(UtilMath.offset(_particleLocation, _centerLocation) / (double)ANIMATION_DURATION);
_radialOffset = radialOffset;
}
@Override
@ -57,22 +76,47 @@ public class ChestSpawnAnimation extends Animation
{
float scale = (float)((double)(ANIMATION_DURATION - getTicks()) / (double)ANIMATION_DURATION);
float y = 5 * scale;
double width = 1.4 * ((double) getTicks() / (double) ANIMATION_DURATION);
for (int i=0 ; i < 2 ; i++)
//Move Paticle Forwards
_particleLocation.add(_particleDirection);
//Play Particels
if (getTreasure().getTreasureType() == TreasureType.BASIC)
{
double lead = i * ((2d * Math.PI)/2);
float x = (float) (Math.sin(getTicks()/4D + lead));
float z = (float) (Math.cos(getTicks()/4D + lead));
UtilParticle.PlayParticle(getTreasure().getTreasureType().getStyle().getSecondaryParticle(), _centerLocation.clone().add(x * width, y, z * width), 0f, 0f, 0f, 0, 1);
UtilParticle.PlayParticle(getTreasure().getTreasureType().getStyle().getSecondaryParticle(), _centerLocation, 0.1f, 0.1f, 0.1f, 0, 1);
}
else if (getTreasure().getTreasureType() == TreasureType.HEROIC)
{
float x = (float) (Math.sin(getTicks()/4D));
float z = (float) (Math.cos(getTicks()/4D));
Location newLoc = _particleLocation.clone();
newLoc.add(UtilAlg.getLeft(_particleDirection).multiply(x * scale));
newLoc.add(UtilAlg.getUp(_particleDirection).multiply(z * scale));
UtilParticle.PlayParticle(getTreasure().getTreasureType().getStyle().getSecondaryParticle(), newLoc, 0f, 0f, 0f, 0, 1);
}
else if (getTreasure().getTreasureType() == TreasureType.LEGENDARY)
{
float y = 5 * scale;
double width = 0.7 * ((double) getTicks() / (double) ANIMATION_DURATION);
for (int i=0 ; i < 2 ; i++)
{
double lead = i * ((2d * Math.PI)/2);
float x = (float) (Math.sin(getTicks()/4D + lead));
float z = (float) (Math.cos(getTicks()/4D + lead));
UtilParticle.PlayParticle(getTreasure().getTreasureType().getStyle().getSecondaryParticle(), _centerLocation.clone().add(x * width, y, z * width), 0f, 0f, 0f, 0, 1);
}
}
//Spawn Chest
if (getTicks() >= ANIMATION_DURATION)
{
_chestBlockInfo.add(new BlockInfo(_block));
getTreasure().setBlock(_block, getTreasure().getTreasureType().getMaterial(), _direction);
_block.getLocation().getWorld().playSound(_centerLocation, Sound.ANVIL_LAND, 0.5f, 1f);
_block.getLocation().getWorld().playSound(_centerLocation, getTreasure().getTreasureType().getStyle().getChestSpawnSound(), 0.5f, 1f);
UtilParticle.ParticleType particleType = getTreasure().getTreasureType().getStyle().getChestSpawnParticle();

View File

@ -6,6 +6,7 @@ import org.bukkit.Color;
import org.bukkit.FireworkEffect;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.block.Block;
import mineplex.core.common.util.UtilFirework;
@ -15,7 +16,7 @@ import mineplex.core.treasure.Treasure;
/**
* Created by shaun on 14-09-12.
*/
public class LegendaryAnimation extends Animation
public class LootLegendaryAnimation extends Animation
{
/**
* Played when a "Very Rare" chest is opened
@ -24,7 +25,7 @@ public class LegendaryAnimation extends Animation
private Random _random = new Random();
private Block _chestBlock;
public LegendaryAnimation(Treasure treasure, Block chestBlock)
public LootLegendaryAnimation(Treasure treasure, Block chestBlock)
{
super(treasure);
@ -34,18 +35,16 @@ public class LegendaryAnimation extends Animation
@Override
protected void tick()
{
if (getTicks() < 12 && getTicks() % 3 == 0)
{
UtilFirework.playFirework(_chestBlock.getLocation().add(0.5, 0.5, 0.5), Type.BALL_LARGE, Color.LIME, true, true);
}
if (getTicks() == 1)
{
// _chestBlock.getLocation().getWorld().playSound(_chestBlock.getLocation().add(0.5, 0.5, 0.5), Sound.WITHER_SPAWN, 10F, 1.2F);
_chestBlock.getLocation().getWorld().playSound(_chestBlock.getLocation().add(0.5, 0.5, 0.5), Sound.ENDERDRAGON_DEATH, 10F, 2.0F);
}
if (getTicks() == 20)
{
FireworkEffect effect = FireworkEffect.builder().with(FireworkEffect.Type.BALL_LARGE).withColor(Color.RED).withFade(Color.BLACK).build();
UtilFirework.playFirework(_chestBlock.getLocation().add(0.5, 0.5, 0.5), effect);
// ((CraftWorld) _chestBlock.getWorld()).getHandle().triggerEffect(1005, _chestBlock.getX(), _chestBlock.getY(), _chestBlock.getZ(), 2257);
}
else if (getTicks() < 15)
else if (getTicks() < 35)
{
double radius = 2 - (getTicks() / 10D * 2);
int particleAmount = 20 - (getTicks() * 2);
@ -56,10 +55,10 @@ public class LegendaryAnimation extends Animation
double zDiff = Math.cos(i/(double)particleAmount * 2 * Math.PI) * radius;
Location location = _centerLocation.clone().add(xDiff, 0, zDiff);
UtilParticle.PlayParticle(UtilParticle.ParticleType.CLOUD, location, 0, 0, 0, 0, 1);
UtilParticle.PlayParticle(UtilParticle.ParticleType.HAPPY_VILLAGER, location, 0, 0, 0, 0, 1);
}
}
else if (getTicks() < 20)
else if (getTicks() < 40)
{
double xDif = _random.nextGaussian() * 0.5;
double zDif = _random.nextGaussian() * 0.5;

View File

@ -0,0 +1,65 @@
package mineplex.core.treasure.animation;
import java.util.Random;
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.block.Block;
import org.bukkit.util.Vector;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.treasure.Treasure;
/**
* Created by shaun on 14-09-12.
*/
public class LootMythicalAnimation extends Animation
{
/**
* Played when a "Very Rare" chest is opened
*/
private Random _random = new Random();
private Block _chestBlock;
public LootMythicalAnimation(Treasure treasure, Block chestBlock)
{
super(treasure);
_chestBlock = chestBlock;
}
@Override
protected void tick()
{
if (getTicks() < 30 && getTicks() % 3 == 0)
{
UtilFirework.playFirework(_chestBlock.getLocation().add(0.5, 0.5, 0.5), Type.BALL_LARGE, Color.RED, true, true);
}
if (getTicks() == 1)
{
_chestBlock.getLocation().getWorld().playSound(_chestBlock.getLocation().add(0.5, 0.5, 0.5), Sound.PORTAL_TRAVEL, 10F, 2.0F);
_chestBlock.getLocation().getWorld().playSound(_chestBlock.getLocation().add(0.5, 0.5, 0.5), Sound.ZOMBIE_UNFECT, 10F, 0.1F);
}
else if (getTicks() < 60)
{
UtilFirework.launchFirework(_chestBlock.getLocation().add(0.5, 0.5, 0.5), Type.BALL_LARGE, Color.RED, true, true,
new Vector((Math.random()-0.5)*0.05, 0.1, (Math.random()-0.5)*0.05), 1);
}
else
{
finish();
}
}
@Override
protected void onFinish()
{
}
}

View File

@ -4,6 +4,7 @@ import org.bukkit.Color;
import org.bukkit.FireworkEffect;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.FireworkEffect.Type;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilParticle;
@ -12,7 +13,7 @@ import mineplex.core.treasure.Treasure;
/**
* Created by shaun on 2014-09-09.
*/
public class RareAnimation extends Animation
public class LootRareAnimation extends Animation
{
/**
* Played when a "Rare" chest is opened
@ -20,7 +21,7 @@ public class RareAnimation extends Animation
private Location _centerLocation;
public RareAnimation(Treasure treasure, Location centerLocation)
public LootRareAnimation(Treasure treasure, Location centerLocation)
{
super(treasure);
@ -32,7 +33,8 @@ public class RareAnimation extends Animation
{
if (getTicks() == 2)
{
UtilFirework.playFirework(_centerLocation, FireworkEffect.builder().withColor(Color.ORANGE).with(FireworkEffect.Type.BURST).build());
UtilFirework.playFirework(_centerLocation, Type.BALL, Color.FUCHSIA, false, false);
_centerLocation.getWorld().playSound(_centerLocation, Sound.WITHER_SPAWN, 10F, 1.2F);
}
else if (getTicks() >= 60)
@ -40,6 +42,7 @@ public class RareAnimation extends Animation
finish();
}
//Particle Ground
{
double currentRotation = getTicks() / 20D;
double radius = currentRotation;
@ -49,9 +52,10 @@ public class RareAnimation extends Animation
Location location = _centerLocation.clone().add(xDiff, yDiff, zDiff);
UtilParticle.PlayParticle(UtilParticle.ParticleType.FLAME, location, 0, 0, 0, 0, 1);
UtilParticle.PlayParticle(UtilParticle.ParticleType.WITCH_MAGIC, location, 0, 0, 0, 0, 1);
}
//Particle Spiral Up
double radius = getTicks() / 20D;
int particleAmount = getTicks() / 2;
for (int i = 0; i < particleAmount; i++)
@ -60,7 +64,7 @@ public class RareAnimation extends Animation
double zDiff = Math.cos(i/(double)particleAmount * 2 * Math.PI) * radius;
Location location = _centerLocation.clone().add(xDiff, -1.3, zDiff);
UtilParticle.PlayParticle(UtilParticle.ParticleType.FLAME, location, 0, 0, 0, 0, 1);
UtilParticle.PlayParticle(UtilParticle.ParticleType.WITCH_MAGIC, location, 0, 0, 0, 0, 1);
}
}

View File

@ -4,6 +4,7 @@ import java.util.Random;
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.block.Block;
import mineplex.core.common.util.UtilFirework;
@ -13,7 +14,7 @@ import mineplex.core.treasure.Treasure;
/**
* Created by shaun on 2014-09-09.
*/
public class UncommonAnimation extends Animation
public class LootUncommonAnimation extends Animation
{
/**
* Played when an "Uncommon" chest is opened
@ -22,7 +23,7 @@ public class UncommonAnimation extends Animation
private Random _random = new Random();
private Block _block;
public UncommonAnimation(Treasure treasure, Block block)
public LootUncommonAnimation(Treasure treasure, Block block)
{
super(treasure);
@ -37,22 +38,12 @@ public class UncommonAnimation extends Animation
if (getTicks() == 10)
{
double xDif = 0;//_random.nextGaussian() * 1;
double zDif = 0;//_random.nextGaussian() * 1;
double yDif = 2;//(_random.nextInt(3) * _random.nextDouble()) + 2;
FireworkEffect effect = FireworkEffect.builder().withColor(Color.RED)
.withFade(Color.fromRGB(_random.nextInt(255), _random.nextInt(255), _random.nextInt(255)))
.with(FireworkEffect.Type.STAR)
.build();
UtilFirework.playFirework(_block.getLocation().add(0.5, 0.5, 0.5).add(xDif, yDif, zDif), effect);
UtilFirework.playFirework(_block.getLocation().add(0.5, 0.5, 0.5), Type.BURST, Color.AQUA, false, false);
}
else if (getTicks() % 2 == 0)
{
UtilParticle.PlayParticle(UtilParticle.ParticleType.HEART, _block.getLocation().add(0.5, 1.2, 0.5), 0.5F, 0.2F, 0.5F, 0, 1);
}
}
@Override

View File

@ -54,7 +54,7 @@ public class ParticleAnimation extends Animation
{
Vector position = PATH.get(pathPosition);
UtilParticle.PlayParticle(getTreasure().getTreasureType().getStyle().getPrimaryParticle(), getTreasure().getCenterBlock().getLocation().add(0.5, 0, 0.5).add(position), 0, 0, 0, 0, 1);
UtilParticle.PlayParticle(getTreasure().getTreasureType().getStyle().getSecondaryParticle(), getTreasure().getCenterBlock().getLocation().add(0.5, 0, 0.5).add(position), 0, 0, 0, 0, 1);
pathPosition = (pathPosition + 1) % PATH.size();
}

View File

@ -1,6 +1,7 @@
package mineplex.game.clans.clans;
import java.util.HashSet;
import java.util.TimeZone;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -58,6 +59,8 @@ import mineplex.minecraft.game.core.mechanics.Weapon;
public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelation
{
private static final TimeZone TIME_ZONE = TimeZone.getDefault();
private String _serverName;
private CoreClientManager _clientManager;
@ -504,4 +507,15 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
{
return (energy / 4) + (energy % 4 == 0 ? 0 : 1);
}
/**
* Get the timezone for this server.
* This may be used in the future if we have
* clans servers with varying timezones.
* @return {@link java.util.TimeZone} that this server should run at
*/
public TimeZone getServerTimeZone()
{
return TIME_ZONE;
}
}

View File

@ -36,23 +36,12 @@ public class EnemyData
return _kills;
}
public void addDeath()
public void addScore(int add)
{
addScore(-1);
_score = Math.max(0, Math.min(_score + add, 40));
}
public void addKill()
{
addScore(1);
addKills(1);
}
private void addScore(int add)
{
_score = Math.max(0, Math.min(_score + 1, 40));
}
private void addKills(int add)
{
_kills++;
}

View File

@ -5,6 +5,7 @@ import java.util.Calendar;
import java.util.Date;
import java.util.LinkedList;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.PlayerDeathEvent;
@ -13,7 +14,10 @@ import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.game.clans.clans.ClanInfo;
import mineplex.game.clans.clans.ClansManager;
@ -24,10 +28,44 @@ public class WarManager extends MiniPlugin
private final ClansManager _clansManager;
private WarState _warState;
public WarManager(JavaPlugin plugin, ClansManager clansManager)
{
super("War Manager", plugin);
_clansManager = clansManager;
_warState = calculateWarState();
}
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.SLOWEST)
return;
WarState currentState = calculateWarState();
if (currentState != _warState)
{
WarStateChangeEvent warEvent = new WarStateChangeEvent(_warState, currentState);
UtilServer.getServer().getPluginManager().callEvent(warEvent);
_warState = currentState;
}
}
private WarState calculateWarState()
{
// Get a calendar snapshot of the current time using server timezone
Calendar calendar = Calendar.getInstance(_clansManager.getServerTimeZone());
WarState warState = WarState.WAR;
if (isEnemyTime(calendar))
warState = WarState.FORM_ENEMIES;
else if (isInvadeTime(calendar))
warState = WarState.INVADE;
return warState;
}
public void attemptEnemy(Player player, ClanInfo initiatingClan, ClanInfo otherClan)
@ -39,7 +77,7 @@ public class WarManager extends MiniPlugin
{
String notifyMessage = null;
if (!isEnemyTime())
if (_warState != WarState.FORM_ENEMIES)
{
notifyMessage = "Enemies cannot be formed at this time. Please see mineplex.com/clans for info";
}
@ -75,25 +113,30 @@ public class WarManager extends MiniPlugin
{
if (playerClan.getEnemyData() != null && playerClan.getEnemyData().getEnemyName().equalsIgnoreCase(killerClan.getName()))
{
if (isWarInProgress())
// Only adjust score if we are in WAR or FORM ENEMIES state. Once invasion begins score should never change
// Adjust kill stats no matter what war state we are in (so we track kills during invasion)
if (_warState == WarState.WAR || _warState == WarState.FORM_ENEMIES)
{
playerClan.getEnemyData().addDeath();
killerClan.getEnemyData().addKill();
playerClan.getEnemyData().addScore(-1);
killerClan.getEnemyData().addScore(1);
}
killerClan.getEnemyData().addKill();
}
}
}
/**
* Can enemies be formed at the current time
*
* Enemy forming will happen once a week during a set period
*/
private boolean isEnemyTime()
{
Calendar c = Calendar.getInstance();
/**
* Check if a specific Calendar is currently in enemy time
* If this returns true, isInvadeTime should always return false for the same Calendar
*
* @param c {@link java.util.Calendar} instance that should be checked
*/
private boolean isEnemyTime(Calendar c)
{
int dayOfWeek = c.get(Calendar.DAY_OF_WEEK);
if (dayOfWeek == CREATE_ENEMY_DATE)
@ -104,9 +147,14 @@ public class WarManager extends MiniPlugin
return false;
}
private boolean isInvadeTime()
/**
* Check if a specific Calendar is currently in invade time
* If this returns true, isEnemyTime should always return false for the same Calendar
*
* @param c {@link java.util.Calendar} instance that should be checked
*/
private boolean isInvadeTime(Calendar c)
{
Calendar c = Calendar.getInstance();
int dayOfWeek = c.get(Calendar.DAY_OF_WEEK);
if (dayOfWeek == INVADE_ENEMY_DATE)
@ -116,24 +164,22 @@ public class WarManager extends MiniPlugin
return false;
}
private boolean isWarInProgress()
{
return !isInvadeTime();
}
/**
* Get the starting time of when enemies can be formed next
* @return The enemy start time in the form of {@link java.util.Date}
*/
private Date getNextEnemyTime()
{
Calendar c = Calendar.getInstance();
Calendar c = Calendar.getInstance(_clansManager.getServerTimeZone());
int currDayOfWeek = c.get(Calendar.DAY_OF_WEEK);
c.set(Calendar.DAY_OF_WEEK, CREATE_ENEMY_DATE);
c.set(Calendar.HOUR_OF_DAY, 0);
c.set(Calendar.MINUTE, 0);
c.set(Calendar.SECOND, 0);
c.add(Calendar.DATE, 7);
if (currDayOfWeek >= CREATE_ENEMY_DATE)
c.add(Calendar.DATE, 7);
return c.getTime();
}
@ -144,17 +190,37 @@ public class WarManager extends MiniPlugin
*/
private Date getNextInvadeTime()
{
Calendar c = Calendar.getInstance();
Calendar c = Calendar.getInstance(_clansManager.getServerTimeZone());
int currDayOfWeek = c.get(Calendar.DAY_OF_WEEK);
c.set(Calendar.DAY_OF_WEEK, INVADE_ENEMY_DATE);
c.set(Calendar.HOUR_OF_DAY, 0);
c.set(Calendar.MINUTE, 0);
c.set(Calendar.SECOND, 0);
c.add(Calendar.DATE, 7);
if (currDayOfWeek >= INVADE_ENEMY_DATE)
c.add(Calendar.DATE, 7);
return c.getTime();
}
/**
* Get the current War State of the server
* War state determines what events are going on
* with respect to the current war.
*/
public WarState getWarState()
{
return _warState;
}
@EventHandler
public void stateChange(WarStateChangeEvent event)
{
WarState state = event.getNewState();
Bukkit.broadcastMessage(F.main("Clans", "War state changed: " + F.elem(state.getDescription())));
}
/**
* Send the current server time information to the player
*/
@ -162,34 +228,29 @@ public class WarManager extends MiniPlugin
{
LinkedList<String> messageList = new LinkedList<String>();
messageList.add(F.main("Clans", "Server Time;"));
messageList.add(F.main("Clans", "Server Time"));
Date currDate = new Date();
SimpleDateFormat dateFormat = new SimpleDateFormat("EEE MMM d HH:mm:ss yyyy");
dateFormat.setTimeZone(_clansManager.getServerTimeZone());
messageList.add(F.value("Server Time", dateFormat.format(currDate)));
if (isInvadeTime())
{
messageList.add(F.elem("Winning clans can invade enemies right now"));
}
else
messageList.add(F.value("Status", _warState.getDescription()));
if (_warState != WarState.INVADE)
{
long next = getNextInvadeTime().getTime();
long currTime = System.currentTimeMillis();
messageList.add(F.value("Enemy Invasion", UtilTime.convertString(next - currTime, 1, UtilTime.TimeUnit.FIT)));
messageList.add(F.value("Invasion", UtilTime.convertString(next - currTime, 1, UtilTime.TimeUnit.FIT)));
}
if (isEnemyTime())
{
messageList.add(F.elem("Enemies can be formed at this time"));
}
else
if (_warState != WarState.FORM_ENEMIES)
{
long next = getNextEnemyTime().getTime();
long currTime = System.currentTimeMillis();
messageList.add(F.value("Can Form Enemies In", UtilTime.convertString(next - currTime, 1, UtilTime.TimeUnit.FIT)));
messageList.add(F.value("Enemy Reset", UtilTime.convertString(next - currTime, 1, UtilTime.TimeUnit.FIT)));
}
return messageList;

View File

@ -0,0 +1,20 @@
package mineplex.game.clans.clans.war;
public enum WarState
{
FORM_ENEMIES("Enemies can now be formed"),
WAR("War is in progress"),
INVADE("Winning teams can invade enemies");
private String _description;
WarState(String description)
{
_description = description;
}
public String getDescription()
{
return _description;
}
}

View File

@ -0,0 +1,39 @@
package mineplex.game.clans.clans.war;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class WarStateChangeEvent extends Event
{
private static final HandlerList handlers = new HandlerList();
private WarState _oldState;
private WarState _newState;
public WarStateChangeEvent(WarState oldState, WarState newState)
{
_oldState = oldState;
_newState = newState;
}
public HandlerList getHandlers()
{
return handlers;
}
public static HandlerList getHandlerList()
{
return handlers;
}
public WarState getOldState()
{
return _oldState;
}
public WarState getNewState()
{
return _newState;
}
}

View File

@ -56,7 +56,6 @@ 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.UtilTabTitle;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilWorld;
import mineplex.core.cosmetic.CosmeticManager;
@ -75,6 +74,7 @@ import mineplex.core.pet.PetManager;
import mineplex.core.portal.Portal;
import mineplex.core.preferences.PreferencesManager;
import mineplex.core.projectile.ProjectileManager;
import mineplex.core.recharge.Recharge;
import mineplex.core.stats.StatsManager;
import mineplex.core.task.TaskManager;
import mineplex.core.treasure.TreasureManager;
@ -511,10 +511,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
public void PlayerJoin(PlayerJoinEvent event)
{
Player player = event.getPlayer();
//Player List
UtilTabTitle.setHeaderAndFooter(player, " ", "Visit " + C.cGreen + "www.mineplex.com" + ChatColor.RESET + " for News, Forums and Shop");
//Public Message
if (_clientManager.Get(player).GetRank() != Rank.LEGEND)
event.setJoinMessage(null);

View File

@ -10,7 +10,7 @@ public class GameCommand extends MultiCommandBase<ArcadeManager>
{
public GameCommand(ArcadeManager plugin)
{
super(plugin, Rank.ADMIN, new Rank[] {Rank.YOUTUBE, Rank.MAPDEV}, "game");
super(plugin, Rank.ADMIN, new Rank[] {Rank.YOUTUBE, Rank.MAPLEAD}, "game");
AddCommand(new StartCommand(Plugin));
AddCommand(new StopCommand(Plugin));

View File

@ -17,7 +17,7 @@ public class SetCommand extends CommandBase<ArcadeManager>
{
public SetCommand(ArcadeManager plugin)
{
super(plugin, Rank.ADMIN, new Rank[] {Rank.YOUTUBE, Rank.MAPDEV}, "set");
super(plugin, Rank.ADMIN, new Rank[] {Rank.YOUTUBE, Rank.MAPLEAD}, "set");
}
@Override

View File

@ -12,7 +12,7 @@ public class StartCommand extends CommandBase<ArcadeManager>
{
public StartCommand(ArcadeManager plugin)
{
super(plugin, Rank.ADMIN, new Rank[] {Rank.YOUTUBE, Rank.MAPDEV}, "start");
super(plugin, Rank.ADMIN, new Rank[] {Rank.YOUTUBE, Rank.MAPLEAD}, "start");
}
@Override

View File

@ -142,7 +142,7 @@ public class SuperSmash extends SoloGame
for (Player player : GetPlayers(true))
_lives.put(player, 4);
_nextPowerup = (long) (System.currentTimeMillis() + 120000 + 180000 * Math.random());
_nextPowerup = (long) (System.currentTimeMillis() + 240000 + 360000 * Math.random());
}
@EventHandler
@ -333,7 +333,7 @@ public class SuperSmash extends SoloGame
best.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, ((SmashKit)GetKit(best)).getSuperCharges(),
C.cYellow + C.Bold + "Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + ((SmashKit)GetKit(best)).getSuperName()));
_nextPowerup = (long) (System.currentTimeMillis() + 120000 + 180000 * Math.random());
_nextPowerup = (long) (System.currentTimeMillis() + 240000 + 360000 * Math.random());
Manager.GetGame().Announce(C.Bold + best.getName() + " collected " + C.cGreen + C.Bold + "Smash Crystal" + ChatColor.RESET + C.Bold + "!");
}

View File

@ -98,7 +98,7 @@ public class PerkDoubleJump extends Perk
Recharge.Instance.setDisplayForce(player, GetName(), true);
}
}
}
}
@EventHandler
public void FlightUpdate(UpdateEvent event)

View File

@ -21,7 +21,6 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.pet.PetManager;
@ -51,7 +50,7 @@ public class GameLootManager implements Listener
Manager.GetPluginManager().registerEvents(this, Manager.GetPlugin());
_rewardManager = new RewardManager(Manager.GetDonation(), Manager.getInventoryManager(), petManager,
_rewardManager = new RewardManager(Manager.GetClients(), Manager.GetDonation(), Manager.getInventoryManager(), petManager,
100, 250,
500, 1000,
1500, 2500,
@ -59,15 +58,14 @@ public class GameLootManager implements Listener
false);
//Chest
_rewardManager.addReward(new InventoryReward(Manager.getInventoryManager(), "Treasure Chest", "Treasure Chest", 1, 1,
new ItemStack(Material.CHEST), RewardRarity.COMMON, 4));
_rewardManager.addReward(new InventoryReward(Manager.getInventoryManager(), "Treasure Chest", "Treasure Chest", 1, 2,
new ItemStack(Material.CHEST), RewardRarity.COMMON, 1));
_rewardManager.addReward(new InventoryReward(Manager.getInventoryManager(), "Basic Chest", "Basic Chest", 1, 1,
new ItemStack(Material.CHEST), RewardRarity.UNCOMMON, 1000));
//Key
_rewardManager.addReward(new InventoryReward(Manager.getInventoryManager(), "Treasure Key", "Treasure Key", 1, 1,
new ItemStack(Material.DIAMOND), RewardRarity.UNCOMMON, 1000));
_rewardManager.addReward(new InventoryReward(Manager.getInventoryManager(), "Heroic Chest", "Heroic Chest", 1, 1,
new ItemStack(Material.CHEST), RewardRarity.UNCOMMON, 40));
_rewardManager.addReward(new InventoryReward(Manager.getInventoryManager(), "Legendary Chest", "Legendary Chest", 1, 1,
new ItemStack(Material.CHEST), RewardRarity.UNCOMMON, 1));
}
@EventHandler