Fixes for winroom command, and illuminated chest

This commit is contained in:
LCastr0 2016-05-15 22:49:10 -03:00
parent 42eef838b3
commit fb63b3a1a4
4 changed files with 16 additions and 41 deletions

View File

@ -2,6 +2,7 @@ package mineplex.core.treasure;
import java.util.List;
import mineplex.core.reward.RewardPool;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@ -149,18 +150,10 @@ public class TreasureLocation implements Listener
{
if(!_treasureManager.hasItemsToGivePlayer(treasureType.getRewardPool(), player))
{
player.sendMessage(F.main("Treasure", "You seem to have all treasures for this chest"));
player.sendMessage(F.main("Treasure", "unlocked alredy"));
if(testServer)
{
player.sendMessage("Ignoring that too^^");
}
else
{
_inventoryManager.addItemToInventory(player, treasureType.getItemName(), 1);
return;
}
}
player.sendMessage(F.main("Treasure", "You seem to have all treasures for this chest unlocked already!"));
_inventoryManager.addItemToInventory(player, treasureType.getItemName(), 1);
return;
}
}
Reward[] rewards = _treasureManager.getRewards(player, treasureType.getRewardPool(), treasureType.getRewardType());

View File

@ -1,5 +1,6 @@
package mineplex.core.treasure.gui;
import mineplex.core.treasure.TreasureType;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
@ -24,7 +25,7 @@ public class BuyChestButton implements IButton
private Material _chestMat;
private int _chestCost;
public BuyChestButton(Player player, InventoryManager inventoryManager, TreasurePage page,
public BuyChestButton(InventoryManager inventoryManager, TreasurePage page,
String chestName, Material chestMat, int chestCost)
{
_inventoryManager = inventoryManager;
@ -39,6 +40,11 @@ public class BuyChestButton implements IButton
@Override
public void onClick(final Player player, ClickType clickType)
{
if (!_page.getPlugin().hasItemsToGivePlayer(TreasureType.ILLUMINATED.getRewardPool(), player))
{
player.sendMessage(F.main("Treasure", "You seem to have all treasures for this chest unlocked already!"));
return;
}
if(_inventoryManager.getClientManager().Get(player).isDisguised())
{
UtilPlayer.message(player, F.main("Disguise", "You cant buy things while you are disguised!"));

View File

@ -179,10 +179,9 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
{
addButton(slot, item, new OpenTreasureButton(getPlayer(), _treasureLocation, treasureType));
}
else if (treasureType.isPurchasable())
{
addButton(slot, item, new BuyChestButton(getPlayer(), _inventoryManager, this, treasureType.getItemName(), Material.CHEST, treasureType.getPurchasePrice()));
}
else if (treasureType.isPurchasable()) {
addButton(slot, item, new BuyChestButton(_inventoryManager, this, treasureType.getItemName(), Material.CHEST, treasureType.getPurchasePrice()));
}
else
{
setItem(slot, item);

View File

@ -1849,28 +1849,5 @@ public abstract class Game implements Listener
public void addTutorials(){}
public void disable(){}
@EventHandler
public void onCommand(PlayerCommandPreprocessEvent event)
{
boolean testServer = getArcadeManager().getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing");
if(!testServer) return;
event.setCancelled(true);
if(GetState() == GameState.Loading)
{
event.getPlayer().sendMessage(F.main("Game", C.cRed + "Game is loading, please wait"));
return;
}
if(event.getMessage().equalsIgnoreCase("/winroom"))
{
List<Player> list = new ArrayList<>(UtilServer.getPlayersCollection());
AnnounceEnd(list);
Bukkit.getScheduler().runTaskLater(getArcadeManager().getPlugin(), () -> { WinEffectManager.end(); }, 20 * 12);
}
}
}