Edits to treasure chests
This commit is contained in:
parent
f8d5bd3c11
commit
8ad7646128
@ -137,13 +137,25 @@ public class TreasureLocation implements Listener
|
||||
{
|
||||
if(!_treasureManager.hasItemsToGivePlayer(treasureType.getRewardPool(), player))
|
||||
{
|
||||
player.sendMessage(F.main("Treasure", "You seem to have all treasures for"));
|
||||
player.sendMessage(F.main("Treasure", "this chest unlocked alredy"));
|
||||
player.sendMessage(F.main("Treasure", "You seem to have all treasures for this chest"));
|
||||
player.sendMessage(F.main("Treasure", "unlocked alredy"));
|
||||
player.sendMessage("Ignoring that too^^");
|
||||
// _inventoryManager.addItemToInventory(player, treasureType.getItemName(), 1);
|
||||
// return;
|
||||
}
|
||||
}
|
||||
|
||||
Reward[] rewards = _treasureManager.getRewards(player, treasureType.getRewardPool(), treasureType.getRewardType());
|
||||
for(Reward r : rewards)
|
||||
{
|
||||
if(r == null)
|
||||
{
|
||||
reset();
|
||||
player.sendMessage(F.main("Treasure", "There are no available items in this chest for you"));
|
||||
player.sendMessage(F.main("Treasure", "to open"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Treasure is now being opened
|
||||
setHoloChestVisible(false);
|
||||
@ -153,17 +165,6 @@ public class TreasureLocation implements Listener
|
||||
Bukkit.broadcastMessage(F.main("Treasure", F.name(player.getName()) + " is opening " + UtilText.prefixPronoun(treasureType.getName())));
|
||||
}
|
||||
|
||||
Reward[] rewards = _treasureManager.getRewards(player, treasureType.getRewardPool(), treasureType.getRewardType());
|
||||
for(Reward r : rewards)
|
||||
{
|
||||
if(r == null)
|
||||
{
|
||||
reset();
|
||||
player.sendMessage(F.main("Treasure", "There are no available items in this"));
|
||||
player.sendMessage(F.main("Treasure", "chest for you to open"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
Treasure treasure = new Treasure(player, rewards, treasureType.getRewardType(), _chestBlock, _chestSpawns, treasureType, _treasureManager.getBlockRestore(), _hologramManager, _statusManager);
|
||||
_currentTreasure = treasure;
|
||||
|
||||
|
@ -1,22 +1,19 @@
|
||||
package mineplex.core.treasure.animation;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
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_8_R3.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.minecraft.server.v1_8_R3.BlockPosition;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutBlockAction;
|
||||
import net.minecraft.server.v1_8_R3.TileEntity;
|
||||
import net.minecraft.server.v1_8_R3.TileEntityEnderChest;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.hologram.Hologram;
|
||||
@ -24,6 +21,11 @@ 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_8_R3.BlockPosition;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutBlockAction;
|
||||
import net.minecraft.server.v1_8_R3.TileEntity;
|
||||
import net.minecraft.server.v1_8_R3.TileEntityChest;
|
||||
import net.minecraft.server.v1_8_R3.TileEntityEnderChest;
|
||||
|
||||
/**
|
||||
* Created by Shaun on 8/29/2014.
|
||||
@ -43,15 +45,16 @@ public class ChestOpenAnimation extends Animation
|
||||
_hologramManager = hologramManager;
|
||||
_chestData = chestData;
|
||||
_rewardData = rewardData;
|
||||
|
||||
|
||||
|
||||
// Send chest open packet
|
||||
Block block = chestData.getBlock();
|
||||
PacketPlayOutBlockAction packet = new PacketPlayOutBlockAction(new BlockPosition(block.getX(), block.getY(), block.getZ()),
|
||||
CraftMagicNumbers.getBlock(block), 1, 1);
|
||||
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
{
|
||||
UtilPlayer.sendPacket(other, packet);
|
||||
|
||||
if (block.getType() == Material.ENDER_CHEST)
|
||||
{
|
||||
// Fix for Ender Chests closing as soon as they are opened
|
||||
@ -68,8 +71,9 @@ public class ChestOpenAnimation extends Animation
|
||||
protected void tick()
|
||||
{
|
||||
if (getTicks() == 5)
|
||||
{
|
||||
Location location = _chestData.getBlock().getLocation().add(0.5, 0.8, 0.5);
|
||||
{
|
||||
double y = UtilBlock.getSize(_chestData.getBlock(), BlockFace.UP);
|
||||
Location location = _chestData.getBlock().getLocation().add(0.5, y, 0.5);
|
||||
_itemEntity = location.getWorld().dropItem(location, _rewardData.getDisplayItem());
|
||||
_itemEntity.setVelocity(new Vector(0, 0, 0));
|
||||
_itemEntity.setPickupDelay(Integer.MAX_VALUE);
|
||||
|
Loading…
Reference in New Issue
Block a user