- Finalized game to chiss and sigils' requirements minus flag status in scoreboard, will add next commit
- Fixed items ever being lost from treasurechests
This commit is contained in:
parent
d654f1f4b1
commit
a8b27e66d1
@ -0,0 +1,22 @@
|
||||
package mineplex.core.reward;
|
||||
|
||||
import mineplex.core.common.Rank;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class RankRewardData extends RewardData
|
||||
{
|
||||
private Rank _rank;
|
||||
|
||||
public RankRewardData(String friendlyName, ItemStack displayItem, RewardRarity rarity, Rank rank)
|
||||
{
|
||||
super(friendlyName, displayItem, rarity);
|
||||
_rank = rank;
|
||||
}
|
||||
|
||||
public Rank getWonRank()
|
||||
{
|
||||
return _rank;
|
||||
}
|
||||
|
||||
}
|
@ -407,7 +407,7 @@ public class RewardManager
|
||||
}
|
||||
if (canGiveMythical && type == RewardType.MythicalChest && !_clientManager.Get(player).GetRank().has(Rank.TITAN))
|
||||
{
|
||||
return new RankReward(_clientManager, _statusManager, 0, rarity);
|
||||
return new RankReward(_clientManager, 0, rarity);
|
||||
}
|
||||
else if (!canGiveMythical || _clientManager.Get(player).GetRank().has(Rank.LEGEND))
|
||||
{
|
||||
@ -415,7 +415,7 @@ public class RewardManager
|
||||
}
|
||||
else
|
||||
{
|
||||
return new RankReward(_clientManager, _statusManager, 0, rarity);
|
||||
return new RankReward(_clientManager, 0, rarity);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ public class GiveawayReward extends Reward
|
||||
// Dang, I guess we failed!
|
||||
if (!_clientManager.hasRank(player, Rank.TITAN))
|
||||
{
|
||||
Reward reward = new RankReward(_clientManager, _serverStatusManager, 0, getRarity());
|
||||
Reward reward = new RankReward(_clientManager, 0, getRarity());
|
||||
reward.giveReward(rewardType, player, rewardDataCallback);
|
||||
}
|
||||
else
|
||||
|
@ -2,31 +2,28 @@ package mineplex.core.reward.rewards;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.reward.RankRewardData;
|
||||
import mineplex.core.reward.Reward;
|
||||
import mineplex.core.reward.RewardData;
|
||||
import mineplex.core.reward.RewardRarity;
|
||||
import mineplex.core.reward.RewardType;
|
||||
|
||||
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;
|
||||
import mineplex.core.reward.RewardType;
|
||||
import mineplex.core.status.ServerStatusManager;
|
||||
import mineplex.core.titangiveaway.redis.TitanChestGiveawayMessage;
|
||||
|
||||
public class RankReward extends Reward
|
||||
{
|
||||
private Random _random;
|
||||
private CoreClientManager _clientManager;
|
||||
private ServerStatusManager _statusManager;
|
||||
|
||||
public RankReward(CoreClientManager clientManager, ServerStatusManager statusManager, int weight, RewardRarity rarity)
|
||||
public RankReward(CoreClientManager clientManager, int weight, RewardRarity rarity)
|
||||
{
|
||||
super(rarity, weight);
|
||||
|
||||
_clientManager = clientManager;
|
||||
_statusManager = statusManager;
|
||||
_random = new Random();
|
||||
}
|
||||
|
||||
@ -47,14 +44,8 @@ public class RankReward extends Reward
|
||||
|
||||
_clientManager.Get(player).SetRank(rank, false);
|
||||
_clientManager.getRepository().saveRank(null, player.getName(), player.getUniqueId(), rank, true);
|
||||
|
||||
if (rank == Rank.TITAN)
|
||||
{
|
||||
TitanChestGiveawayMessage message = new TitanChestGiveawayMessage(player.getName(), _statusManager.getCurrentServerName());
|
||||
message.publish();
|
||||
}
|
||||
|
||||
return new RewardData(getRarity().getColor() + rank.Name + " Rank", new ItemStack(Material.NETHER_STAR), getRarity());
|
||||
return new RankRewardData(getRarity().getColor() + rank.Name + " Rank", new ItemStack(Material.NETHER_STAR), getRarity(), rank);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -68,7 +59,7 @@ public class RankReward extends Reward
|
||||
if (rank == null)
|
||||
return new RewardData(getRarity().getColor() + "Rank Upgrade Error", new ItemStack(Material.PAPER), getRarity());
|
||||
|
||||
return new RewardData(getRarity().getColor() + rank.Name + " Rank", new ItemStack(Material.NETHER_STAR), getRarity());
|
||||
return new RankRewardData(getRarity().getColor() + rank.Name + " Rank", new ItemStack(Material.NETHER_STAR), getRarity(), rank);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -6,30 +6,25 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.minecraft.server.v1_8_R3.BlockPosition;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutBlockAction;
|
||||
import mineplex.core.blockrestore.BlockRestore;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.hologram.HologramManager;
|
||||
import mineplex.core.reward.RankRewardData;
|
||||
import mineplex.core.reward.Reward;
|
||||
import mineplex.core.reward.RewardData;
|
||||
import mineplex.core.reward.RewardRarity;
|
||||
import mineplex.core.reward.RewardType;
|
||||
import mineplex.core.status.ServerStatusManager;
|
||||
import mineplex.core.titangiveaway.redis.TitanChestGiveawayMessage;
|
||||
import mineplex.core.treasure.animation.Animation;
|
||||
import mineplex.core.treasure.animation.BlockChangeAnimation;
|
||||
import mineplex.core.treasure.animation.ChestOpenAnimation;
|
||||
@ -37,8 +32,17 @@ import mineplex.core.treasure.animation.ChestSpawnAnimation;
|
||||
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.LootUncommonAnimation;
|
||||
import mineplex.core.treasure.animation.TreasureRemoveAnimation;
|
||||
import net.minecraft.server.v1_8_R3.BlockPosition;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutBlockAction;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* Created by Shaun on 8/27/2014.
|
||||
@ -62,6 +66,7 @@ public class Treasure
|
||||
|
||||
private Reward[] _rewards;
|
||||
private RewardType _rewardType;
|
||||
private ConcurrentHashMap<Integer, RewardData> _rewardData = new ConcurrentHashMap<Integer, RewardData>();
|
||||
private int _currentReward;
|
||||
|
||||
private boolean _finished;
|
||||
@ -70,15 +75,16 @@ public class Treasure
|
||||
private LinkedList<Animation> _animations;
|
||||
|
||||
private HologramManager _hologramManager;
|
||||
private ServerStatusManager _statusManager;
|
||||
|
||||
public Treasure(Player player, Reward[] rewards, RewardType rewardType, Block centerBlock, Block[] chestBlocks, TreasureType treasureType, BlockRestore blockRestore, HologramManager hologramManager)
|
||||
public Treasure(Player player, Reward[] rewards, RewardType rewardType, Block centerBlock, Block[] chestBlocks, TreasureType treasureType, BlockRestore blockRestore, HologramManager hologramManager, ServerStatusManager statusManager)
|
||||
{
|
||||
this(player, new Random(), rewards, rewardType, centerBlock, chestBlocks, treasureType, hologramManager);
|
||||
this(player, new Random(), rewards, rewardType, centerBlock, chestBlocks, treasureType, hologramManager, statusManager);
|
||||
|
||||
_blockRestore = blockRestore;
|
||||
}
|
||||
|
||||
public Treasure(Player player, Random seed, Reward[] rewards, RewardType rewardType, Block centerBlock, Block[] chestBlocks, TreasureType treasureType, HologramManager hologramManager)
|
||||
public Treasure(Player player, Random seed, Reward[] rewards, RewardType rewardType, Block centerBlock, Block[] chestBlocks, TreasureType treasureType, HologramManager hologramManager, ServerStatusManager statusManager)
|
||||
{
|
||||
_player = player;
|
||||
_random = seed;
|
||||
@ -88,6 +94,7 @@ public class Treasure
|
||||
_centerBlock = centerBlock;
|
||||
_animations = new LinkedList<Animation>();
|
||||
_hologramManager = hologramManager;
|
||||
_statusManager = statusManager;
|
||||
|
||||
_currentChest = 0;
|
||||
_currentReward = 0;
|
||||
@ -101,6 +108,19 @@ public class Treasure
|
||||
}
|
||||
|
||||
_animations.add(new BlockChangeAnimation(this, _otherBlockInfo));
|
||||
|
||||
for (int i = 0; i < _rewards.length; i++)
|
||||
{
|
||||
Reward reward = _rewards[i];
|
||||
final int count = i;
|
||||
reward.giveReward(_rewardType, player, new Callback<RewardData>()
|
||||
{
|
||||
@Override
|
||||
public void run(RewardData data) {
|
||||
_rewardData.put(count, data);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public int getFinishedTickCount()
|
||||
@ -203,14 +223,15 @@ public class Treasure
|
||||
final ChestData data = getChestData(block);
|
||||
if (data != null && !data.isOpened() && _currentReward < _rewards.length)
|
||||
{
|
||||
final Reward reward = _rewards[_currentReward];
|
||||
//final Reward reward = _rewards[_currentReward];
|
||||
final RewardData rewardData = _rewardData.get(_currentReward);
|
||||
data.setOpened(true);
|
||||
_currentReward++;
|
||||
reward.giveReward(_rewardType, _player, new Callback<RewardData>()
|
||||
{
|
||||
@Override
|
||||
public void run(RewardData rewardData)
|
||||
{
|
||||
//reward.giveReward(_rewardType, _player, new Callback<RewardData>()
|
||||
//{
|
||||
//@Override
|
||||
//public void run(RewardData rewardData)
|
||||
//{
|
||||
if (swapList)
|
||||
{
|
||||
BlockInfo info = getBlockInfo(block);
|
||||
@ -222,22 +243,30 @@ public class Treasure
|
||||
_animations.add(chestOpenTask);
|
||||
|
||||
// Extra effects based off the rarity of the treasure
|
||||
if (reward.getRarity() == RewardRarity.UNCOMMON)
|
||||
if (rewardData.getRarity() == RewardRarity.UNCOMMON)
|
||||
{
|
||||
_animations.add(new LootUncommonAnimation(Treasure.this, data.getBlock()));
|
||||
}
|
||||
else if (reward.getRarity() == RewardRarity.RARE)
|
||||
else if (rewardData.getRarity() == RewardRarity.RARE)
|
||||
{
|
||||
_animations.add(new LootRareAnimation(Treasure.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)
|
||||
else if (rewardData.getRarity() == RewardRarity.LEGENDARY)
|
||||
{
|
||||
_animations.add(new LootLegendaryAnimation(Treasure.this, data.getBlock()));
|
||||
Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " found " + C.cGreen + "Legendary " + rewardData.getFriendlyName()));
|
||||
}
|
||||
else if (reward.getRarity() == RewardRarity.MYTHICAL)
|
||||
else if (rewardData.getRarity() == RewardRarity.MYTHICAL)
|
||||
{
|
||||
if (rewardData instanceof RankRewardData)
|
||||
{
|
||||
if (((RankRewardData)rewardData).getWonRank() == Rank.TITAN)
|
||||
{
|
||||
TitanChestGiveawayMessage message = new TitanChestGiveawayMessage(_player.getName(), _statusManager.getCurrentServerName());
|
||||
message.publish();
|
||||
}
|
||||
}
|
||||
_animations.add(new LootMythicalAnimation(Treasure.this, data.getBlock()));
|
||||
Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " found " + C.cRed + "Mythical " + rewardData.getFriendlyName()));
|
||||
}
|
||||
@ -248,8 +277,8 @@ public class Treasure
|
||||
_animations.add(animation);
|
||||
_finished = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
//}
|
||||
//});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,26 @@ package mineplex.core.treasure;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.gadget.event.GadgetBlockEvent;
|
||||
import mineplex.core.hologram.Hologram;
|
||||
import mineplex.core.hologram.HologramManager;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.core.reward.Reward;
|
||||
import mineplex.core.status.ServerStatusManager;
|
||||
import mineplex.core.treasure.event.TreasureFinishEvent;
|
||||
import mineplex.core.treasure.event.TreasureStartEvent;
|
||||
import mineplex.core.treasure.gui.TreasureShop;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -18,31 +38,13 @@ import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerVelocityEvent;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.gadget.event.GadgetBlockEvent;
|
||||
import mineplex.core.hologram.Hologram;
|
||||
import mineplex.core.hologram.HologramManager;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.core.reward.Reward;
|
||||
import mineplex.core.treasure.event.TreasureFinishEvent;
|
||||
import mineplex.core.treasure.event.TreasureStartEvent;
|
||||
import mineplex.core.treasure.gui.TreasureShop;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
public class TreasureLocation implements Listener
|
||||
{
|
||||
private TreasureManager _treasureManager;
|
||||
private InventoryManager _inventoryManager;
|
||||
private Hologram _hologram;
|
||||
private HologramManager _hologramManager;
|
||||
private ServerStatusManager _statusManager;
|
||||
private Treasure _currentTreasure;
|
||||
private Block _chestBlock;
|
||||
private byte _chestBlockData;
|
||||
@ -50,7 +52,7 @@ public class TreasureLocation implements Listener
|
||||
private TreasureShop _shop;
|
||||
private Location _resetLocation;
|
||||
|
||||
public TreasureLocation(TreasureManager treasureManager, InventoryManager inventoryManager, CoreClientManager clientManager, DonationManager donationManager, Block chestBlock, Block[] chestSpawns, Location resetLocation, HologramManager hologramManager)
|
||||
public TreasureLocation(TreasureManager treasureManager, InventoryManager inventoryManager, CoreClientManager clientManager, DonationManager donationManager, Block chestBlock, Block[] chestSpawns, Location resetLocation, HologramManager hologramManager, ServerStatusManager statusManager)
|
||||
{
|
||||
_treasureManager = treasureManager;
|
||||
_resetLocation = resetLocation;
|
||||
@ -59,6 +61,7 @@ public class TreasureLocation implements Listener
|
||||
_chestBlockData = _chestBlock.getData();
|
||||
_chestSpawns = chestSpawns;
|
||||
_hologramManager = hologramManager;
|
||||
_statusManager = statusManager;
|
||||
_currentTreasure = null;
|
||||
_hologram = new Hologram(_hologramManager, chestBlock.getLocation().add(0.5, 2.5, 0.5), C.cGreen + C.Bold + "Open Treasure");
|
||||
setHoloChestVisible(true);
|
||||
@ -107,7 +110,7 @@ public class TreasureLocation implements Listener
|
||||
Bukkit.broadcastMessage(F.main("Treasure", F.name(player.getName()) + " is opening a " + treasureType.getName()));
|
||||
|
||||
Reward[] rewards = _treasureManager.getRewards(player, treasureType.getRewardType());
|
||||
Treasure treasure = new Treasure(player, rewards, treasureType.getRewardType(), _chestBlock, _chestSpawns, treasureType, _treasureManager.getBlockRestore(), _hologramManager);
|
||||
Treasure treasure = new Treasure(player, rewards, treasureType.getRewardType(), _chestBlock, _chestSpawns, treasureType, _treasureManager.getBlockRestore(), _hologramManager, _statusManager);
|
||||
_currentTreasure = treasure;
|
||||
|
||||
UtilTextMiddle.display(treasureType.getName(), "Choose 4 Chests To Open", 20, 180, 20, player);
|
||||
|
@ -65,7 +65,7 @@ public class TreasureManager extends MiniPlugin
|
||||
Block chestLoc7 = world.getBlockAt(-18, 72, -16);
|
||||
Block chestLoc8 = world.getBlockAt(-16, 72, -18);
|
||||
Location resetLocation = new Location(world, -23.5, 72, -23.5);
|
||||
_treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager));
|
||||
_treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager, statusManager));
|
||||
}
|
||||
|
||||
{
|
||||
@ -79,7 +79,7 @@ public class TreasureManager extends MiniPlugin
|
||||
Block chestLoc7 = world.getBlockAt(18, 72, 16);
|
||||
Block chestLoc8 = world.getBlockAt(16, 72, 18);
|
||||
Location resetLocation = new Location(world, 23.5, 72, 23.5);
|
||||
_treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager));
|
||||
_treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager, statusManager));
|
||||
}
|
||||
|
||||
{
|
||||
@ -93,7 +93,7 @@ public class TreasureManager extends MiniPlugin
|
||||
Block chestLoc7 = world.getBlockAt(18, 72, -16);
|
||||
Block chestLoc8 = world.getBlockAt(16, 72, -18);
|
||||
Location resetLocation = new Location(world, 23.5, 72, -23.5);
|
||||
_treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager));
|
||||
_treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager, statusManager));
|
||||
}
|
||||
|
||||
{
|
||||
@ -107,7 +107,7 @@ public class TreasureManager extends MiniPlugin
|
||||
Block chestLoc7 = world.getBlockAt(-18, 72, 16);
|
||||
Block chestLoc8 = world.getBlockAt(-16, 72, 18);
|
||||
Location resetLocation = new Location(world, -23.5, 72, 23.5);
|
||||
_treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager));
|
||||
_treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager, statusManager));
|
||||
}
|
||||
|
||||
for (TreasureLocation treasureLocation : _treasureLocations)
|
||||
|
@ -104,15 +104,15 @@ public class BlockToss extends SkillCharge implements IThrown
|
||||
if (!Recharge.Instance.use(player, GetName(), 1000, false, false))
|
||||
return;
|
||||
|
||||
//Door
|
||||
if (grab.getRelative(BlockFace.UP).getTypeId() == 64 || grab.getRelative(BlockFace.UP).getTypeId() == 71)
|
||||
//Door and Banner
|
||||
if (grab.getRelative(BlockFace.UP).getTypeId() == 64 || grab.getRelative(BlockFace.UP).getTypeId() == 71 || grab.getRelative(BlockFace.UP).getType() == Material.STANDING_BANNER)
|
||||
{
|
||||
UtilPlayer.message(player, F.main(GetName(), "You cannot grab this block."));
|
||||
return;
|
||||
}
|
||||
|
||||
// Ladder and beacon grabs
|
||||
if (grab.getType() == Material.LADDER || grab.getType() == Material.BEACON)
|
||||
// Ladder, banner and beacon grabs
|
||||
if (grab.getType() == Material.LADDER || grab.getType() == Material.BEACON || grab.getType() == Material.STANDING_BANNER || grab.getType() == Material.WALL_BANNER)
|
||||
{
|
||||
UtilPlayer.message(player, F.main(GetName(), "You cannot grab this block."));
|
||||
return;
|
||||
|
@ -154,6 +154,8 @@ public class ArcticArmor extends Skill
|
||||
HashMap<Block, Double> blocks = UtilBlock.getInRadius(cur.getLocation().getBlock().getLocation(), 3d + level);
|
||||
for (Block block : blocks.keySet())
|
||||
{
|
||||
if (block.getType().toString().contains("BANNER") || block.getRelative(BlockFace.UP).getType().toString().contains("BANNER"))
|
||||
continue;
|
||||
//Freeze
|
||||
if (!block.getRelative(BlockFace.UP).isLiquid())
|
||||
if (block.getLocation().getY() <= cur.getLocation().getY())
|
||||
|
@ -114,6 +114,10 @@ public class FissureData
|
||||
//Cannot raise
|
||||
if (block.getTypeId() == 46)
|
||||
return false;
|
||||
if (block.getType().toString().contains("BANNER"))
|
||||
return false;
|
||||
if (block.getRelative(BlockFace.UP).getType().toString().contains("BANNER"))
|
||||
return false;
|
||||
|
||||
Block up = block.getRelative(0, _height + 1, 0);
|
||||
|
||||
|
@ -201,12 +201,15 @@ public class CaptureTheFlag extends TeamGame
|
||||
for (Flag flag : _flags)
|
||||
if (flag.getCarrier() == null)
|
||||
for (Player player : GetPlayers(true))
|
||||
if (UtilMath.offset(player.getLocation(), flag.getPlacedLocation()) < 3)
|
||||
if (UtilMath.offset(player.getLocation(), flag.getPlacedLocation()) < .9)
|
||||
flag.pickup(player);
|
||||
}
|
||||
else if (event.getType() == UpdateType.FAST)
|
||||
for (Resupply resupply : _resupply)
|
||||
resupply.Update();
|
||||
else if (event.getType() == UpdateType.SEC)
|
||||
for (Flag flag : _flags)
|
||||
flag.handleRespawn();
|
||||
else
|
||||
progressTime();
|
||||
}
|
||||
@ -227,7 +230,7 @@ public class CaptureTheFlag extends TeamGame
|
||||
{
|
||||
_suddenDeath = true;
|
||||
this.DeathOut = true;
|
||||
UtilTextMiddle.display(C.cDPurple + "Sudden Death", "Next Capture Wins! No Respawns!");
|
||||
UtilTextMiddle.display(C.cYellow + "Sudden Death", "Next Capture Wins! No Respawns!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -383,27 +386,31 @@ public class CaptureTheFlag extends TeamGame
|
||||
//Wipe Last
|
||||
Scoreboard.Reset();
|
||||
|
||||
//Scores
|
||||
//Scores
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write("First to " + _victoryCaps);
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write(C.cRed + "Red Team");
|
||||
Scoreboard.Write(C.cRedB + "Red Team");
|
||||
Scoreboard.Write(_redScore + C.cRed);
|
||||
//Flag in play stuff
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write(C.cAqua + "Blue Team");
|
||||
Scoreboard.Write(C.cAquaB + "Blue Team");
|
||||
Scoreboard.Write(_blueScore + C.cAqua);
|
||||
//Flag in play stuff
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write(C.cYellowB + "Score to Win");
|
||||
Scoreboard.Write(_victoryCaps + C.cGold);
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
|
||||
if (_suddenDeath)
|
||||
{
|
||||
Scoreboard.Write(C.cDPurple + C.Bold + "Sudden Death");
|
||||
Scoreboard.Write(C.cYellowB + "Sudden Death");
|
||||
Scoreboard.Write("Next Capture Wins");
|
||||
Scoreboard.Write("No Respawns");
|
||||
}
|
||||
else
|
||||
{
|
||||
Scoreboard.Write("Time Remaining:");
|
||||
Scoreboard.Write(C.cYellowB + "Time Left");
|
||||
Scoreboard.Write(UtilTime.MakeStr(Math.max(_gameTime - (System.currentTimeMillis() - GetStateTime()), 0)) + C.cWhite);
|
||||
}
|
||||
|
||||
@ -672,7 +679,7 @@ public class CaptureTheFlag extends TeamGame
|
||||
|
||||
_gameTime = (System.currentTimeMillis() - GetStateTime()) + 11;
|
||||
for (Player pl : UtilServer.getPlayers())
|
||||
UtilPlayer.message(pl, C.cDPurpleB + event.getPlayer().getName() + " has equalized both teams and enabled Sudden Death!");
|
||||
UtilPlayer.message(pl, C.cYellowB + event.getPlayer().getName() + " has equalized both teams and enabled Sudden Death!");
|
||||
}
|
||||
else
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Game", "You do not have permission to use this game modifier!"));
|
||||
|
@ -2,9 +2,9 @@ package nautilus.game.arcade.game.games.common.ctf_data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
@ -43,6 +43,8 @@ public class Flag
|
||||
private CaptureTheFlag _host;
|
||||
|
||||
private Location _spawn;
|
||||
private Location _particleLoc;
|
||||
private Location _beacon;
|
||||
|
||||
private Block _flagBlock;
|
||||
|
||||
@ -61,17 +63,17 @@ public class Flag
|
||||
private boolean _moved = false;
|
||||
private boolean _dropped = false;
|
||||
private long _dropTime = 0;
|
||||
private int _respawnTimer;
|
||||
|
||||
private Hologram _name, _time;
|
||||
|
||||
private String _displayName;
|
||||
|
||||
private ConcurrentHashMap<Player, Long> _grabbing = new ConcurrentHashMap<Player, Long>();
|
||||
|
||||
public Flag(CaptureTheFlag host, Location spawn, GameTeam team)
|
||||
{
|
||||
_host = host;
|
||||
_spawn = spawn;
|
||||
_beacon = _spawn.clone().add(0, -2, 0);
|
||||
_team = team;
|
||||
_displayName = team.GetColor() + team.GetName() + "'s Flag".replace("s's", "s'");
|
||||
_patterns = new ArrayList<Pattern>();
|
||||
@ -80,34 +82,16 @@ public class Flag
|
||||
if (team.GetColor() == ChatColor.RED)
|
||||
{
|
||||
i = new ItemStack(Material.BANNER);
|
||||
_dyeData = DyeColor.BLACK;
|
||||
_dyeData = DyeColor.RED;
|
||||
_enemy = ChatColor.BLUE;
|
||||
_patterns.add(new Pattern(DyeColor.RED, PatternType.STRIPE_SMALL));
|
||||
_patterns.add(new Pattern(DyeColor.RED, PatternType.FLOWER));
|
||||
_patterns.add(new Pattern(DyeColor.BLACK, PatternType.BORDER));
|
||||
_patterns.add(new Pattern(DyeColor.BLACK, PatternType.TRIANGLE_TOP));
|
||||
_patterns.add(new Pattern(DyeColor.BLACK, PatternType.RHOMBUS_MIDDLE));
|
||||
_patterns.add(new Pattern(DyeColor.RED, PatternType.FLOWER));
|
||||
_patterns.add(new Pattern(DyeColor.BLACK, PatternType.GRADIENT));
|
||||
_patterns.add(new Pattern(DyeColor.BLACK, PatternType.CIRCLE_MIDDLE));
|
||||
_patterns.add(new Pattern(DyeColor.BLACK, PatternType.TRIANGLE_TOP));
|
||||
_patterns.add(new Pattern(DyeColor.WHITE, PatternType.CROSS));
|
||||
}
|
||||
else
|
||||
{
|
||||
i = new ItemStack(Material.BANNER);
|
||||
_dyeData = DyeColor.GRAY;
|
||||
_dyeData = DyeColor.BLUE;
|
||||
_enemy = ChatColor.RED;
|
||||
_patterns.add(new Pattern(DyeColor.BLACK, PatternType.GRADIENT));
|
||||
_patterns.add(new Pattern(DyeColor.BLACK, PatternType.GRADIENT_UP));
|
||||
_patterns.add(new Pattern(DyeColor.CYAN, PatternType.TRIANGLE_BOTTOM));
|
||||
_patterns.add(new Pattern(DyeColor.CYAN, PatternType.TRIANGLE_TOP));
|
||||
_patterns.add(new Pattern(DyeColor.BLACK, PatternType.RHOMBUS_MIDDLE));
|
||||
_patterns.add(new Pattern(DyeColor.BLACK, PatternType.TRIANGLES_TOP));
|
||||
_patterns.add(new Pattern(DyeColor.BLACK, PatternType.TRIANGLES_BOTTOM));
|
||||
_patterns.add(new Pattern(DyeColor.BLUE, PatternType.STRIPE_DOWNRIGHT));
|
||||
_patterns.add(new Pattern(DyeColor.BLUE, PatternType.STRIPE_DOWNLEFT));
|
||||
_patterns.add(new Pattern(DyeColor.BLACK, PatternType.CROSS));
|
||||
_patterns.add(new Pattern(DyeColor.BLUE, PatternType.FLOWER));
|
||||
_patterns.add(new Pattern(DyeColor.WHITE, PatternType.CIRCLE_MIDDLE));
|
||||
}
|
||||
|
||||
BannerMeta im = (BannerMeta) i.getItemMeta();
|
||||
@ -193,21 +177,10 @@ public class Flag
|
||||
{
|
||||
if (_dropped)
|
||||
{
|
||||
for (Player pl : _grabbing.keySet())
|
||||
{
|
||||
if (UtilMath.offset(pl.getLocation(), getPlacedLocation()) > 3)
|
||||
_grabbing.remove(pl);
|
||||
|
||||
}
|
||||
Integer r = Math.max(0, _respawnTimer);
|
||||
_time.setText(remainColor(r) + r.toString());
|
||||
|
||||
Integer r = (int)(System.currentTimeMillis() - _dropTime) / 1000;
|
||||
Integer re = Math.max(0, Math.min(15 - r, 15));
|
||||
_time.setText(remainColor(re) + re.toString());
|
||||
|
||||
if (!UtilTime.elapsed(_dropTime, 15000))
|
||||
return;
|
||||
|
||||
if (!_grabbing.isEmpty())
|
||||
if (_respawnTimer > -1)
|
||||
return;
|
||||
|
||||
deleteFlag();
|
||||
@ -227,17 +200,22 @@ public class Flag
|
||||
|
||||
UtilTextBottom.display("Return the Flag to your Capture Zone!", _holding);
|
||||
|
||||
if (_team.GetColor() == ChatColor.RED)
|
||||
while (UtilMath.offset(_particleLoc, _holding.getEyeLocation().clone().add(0.0, 0.5, 0.0)) > .2)
|
||||
{
|
||||
for (int i = 0 ; i < 2 ; i++)
|
||||
UtilParticle.PlayParticle(ParticleType.RED_DUST, _holding.getEyeLocation().clone().add(0.0, 0.5, 0.0), 0, 0, 0, 0, 1,
|
||||
ViewDist.MAX, UtilServer.getPlayers());
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0 ; i < 2 ; i++)
|
||||
UtilParticle.PlayParticle(ParticleType.RED_DUST, _holding.getEyeLocation().clone().add(0.0, 0.5, 0.0), -1, 1, 1, 1, 0,
|
||||
ViewDist.MAX, UtilServer.getPlayers());
|
||||
if (_team.GetColor() == ChatColor.RED)
|
||||
{
|
||||
for (int i = 0 ; i < 2 ; i++)
|
||||
UtilParticle.PlayParticle(ParticleType.RED_DUST, _particleLoc, 0, 0, 0, 0, 1,
|
||||
ViewDist.MAX, UtilServer.getPlayers());
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0 ; i < 2 ; i++)
|
||||
UtilParticle.PlayParticle(ParticleType.RED_DUST, _particleLoc, -1, 1, 1, 1, 0,
|
||||
ViewDist.MAX, UtilServer.getPlayers());
|
||||
}
|
||||
|
||||
_particleLoc.add(UtilAlg.getTrajectory(_particleLoc, _holding.getEyeLocation().clone().add(0.0, 0.5, 0.0)).multiply(.2));
|
||||
}
|
||||
|
||||
if (_host.GetTeam(_holding).GetColor() == ChatColor.RED)
|
||||
@ -245,7 +223,7 @@ public class Flag
|
||||
else
|
||||
_holding.setCompassTarget(_host.getBlueFlag());
|
||||
|
||||
if (_holding.hasPotionEffect(PotionEffectType.SLOW))
|
||||
if (!_holding.hasPotionEffect(PotionEffectType.SLOW))
|
||||
_holding.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 1000000, 1));
|
||||
|
||||
//_holding.getWorld().playSound(_holding.getLocation(), Sound.NOTE_STICKS, 2f, 1f);
|
||||
@ -253,6 +231,22 @@ public class Flag
|
||||
}
|
||||
}
|
||||
|
||||
public void handleRespawn()
|
||||
{
|
||||
if (_moved)
|
||||
{
|
||||
if (_dropped)
|
||||
{
|
||||
_respawnTimer = _respawnTimer - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_respawnTimer < 15)
|
||||
_respawnTimer = _respawnTimer + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ChatColor remainColor(int remain)
|
||||
{
|
||||
if (remain >= 9) return ChatColor.GREEN;
|
||||
@ -280,13 +274,14 @@ public class Flag
|
||||
{
|
||||
_name.setLocation(loc.getBlock().getLocation().clone().add(0.5, 3, 0.5));
|
||||
_name.start();
|
||||
_beacon.getBlock().setType(Material.BEACON);
|
||||
_respawnTimer = 15;
|
||||
}
|
||||
else
|
||||
{
|
||||
_name.setLocation(loc.getBlock().getLocation().clone().add(0.5, 3, 0.5));
|
||||
_name.start();
|
||||
Integer r = (int)(System.currentTimeMillis() - _dropTime) / 1000;
|
||||
Integer re = Math.max(0, Math.min(15 - r, 15));
|
||||
Integer re = Math.max(0, _respawnTimer);
|
||||
_time.setText(remainColor(re) + re.toString());
|
||||
_time.setLocation(loc.getBlock().getLocation().clone().add(0.5, 2.5, 0.5));
|
||||
_time.start();
|
||||
@ -298,6 +293,8 @@ public class Flag
|
||||
{
|
||||
_flagBlock.setType(_priorBlock);
|
||||
_flagBlock.setData(_priorData);
|
||||
_beacon.getBlock().setType(Material.WOOL);
|
||||
_beacon.getBlock().setData(_dyeData.getWoolData());
|
||||
|
||||
_name.stop();
|
||||
_time.stop();
|
||||
@ -308,25 +305,15 @@ public class Flag
|
||||
if (_holding == null)
|
||||
{
|
||||
if (!UtilPlayer.isSpectator(player))
|
||||
{
|
||||
if (!Recharge.Instance.usable(player, "Flag Pickup", false))
|
||||
return false;
|
||||
|
||||
{
|
||||
if (_host.IsAlive(player))
|
||||
{
|
||||
if (_host.GetTeam(player) != _team)
|
||||
{
|
||||
if (_dropped)
|
||||
{
|
||||
if (!_grabbing.containsKey(player))
|
||||
_grabbing.put(player, System.currentTimeMillis());
|
||||
|
||||
if (!UtilTime.elapsed(_grabbing.get(player), 5000))
|
||||
{
|
||||
Integer r = 5 - ((int)(System.currentTimeMillis() - _grabbing.get(player)) / 1000);
|
||||
UtilTextBottom.display(r.toString() + " seconds until pickup!", player);
|
||||
if (!UtilTime.elapsed(_dropTime, 3000))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
deleteFlag();
|
||||
@ -357,13 +344,12 @@ public class Flag
|
||||
else
|
||||
announceSteal(player, true);
|
||||
|
||||
_particleLoc = player.getEyeLocation().clone().add(0.0, 0.5, 0.0);
|
||||
_holding = player;
|
||||
_dropped = false;
|
||||
_dropTime = 0;
|
||||
_moved = true;
|
||||
|
||||
_grabbing.clear();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -381,8 +367,6 @@ public class Flag
|
||||
{
|
||||
if (_holding.getUniqueId() == player.getUniqueId())
|
||||
{
|
||||
Recharge.Instance.recharge(player, "Flag Pickup");
|
||||
Recharge.Instance.use(player, "Flag Pickup", 5000, false, false);
|
||||
spawnFlag(player.getLocation());
|
||||
announceDrop(player);
|
||||
_holding = null;
|
||||
|
Loading…
Reference in New Issue
Block a user