Fix bug with Building shop materials not properly being purchased in bulk. Modify the notification message for combat tagged players in safezones to display on the middle of the screen instead of chat.

This commit is contained in:
Ty Sayers 2015-08-27 15:46:57 -07:00
parent ff13f51151
commit 6a330a66d9
3 changed files with 46 additions and 39 deletions

View File

@ -18,18 +18,11 @@ import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.UtilEnt;
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.disguise.DisguiseManager;
import mineplex.core.disguise.disguises.DisguisePlayer;
import mineplex.core.shop.ShopBase;
import mineplex.game.clans.clans.ClansManager;
import mineplex.minecraft.game.classcombat.event.ClassCombatCreatureAllowSpawnEvent;
public class CombatLogNPC
{

View File

@ -5,9 +5,12 @@ import org.bukkit.Material;
import mineplex.core.account.CoreClientManager;
import mineplex.core.donation.DonationManager;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.game.clans.Clans;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.shop.PvpItem;
import mineplex.game.clans.shop.PvpShopButton;
import mineplex.game.clans.shop.ShopItemButton;
import mineplex.game.clans.shop.mining.MiningPage;
public class BuildingPage extends ShopPageBase<ClansManager, BuildingShop>
{
@ -21,29 +24,35 @@ public class BuildingPage extends ShopPageBase<ClansManager, BuildingShop>
@Override
protected void buildPage()
{
addPvpItem(1, new PvpItem(Material.STONE, (byte)0, 1, "Stone", 100, 20, 64));
addPvpItem(2, new PvpItem(Material.SMOOTH_BRICK, (byte)0, 1, "Stone Bricks", 100, 20, 64));
addPvpItem(3, new PvpItem(Material.SMOOTH_BRICK, (byte)2, 1, "Cracked Stone Bricks", 25, 5, 64));
addPvpItem(4, new PvpItem(Material.COBBLESTONE, (byte)0, 1, "Cobblestone", 25, 5, 64));
addShopItem(1, Material.STONE, 100, 20);
addShopItem(2, Material.SMOOTH_BRICK, 100, 20);
addShopItem(3, Material.SMOOTH_BRICK, 25, 5, (byte)2);
addShopItem(4, Material.COBBLESTONE, 25, 5);
addPvpItem(10, new PvpItem(Material.LOG, (byte)0, 1, "Oak Wood", 50, 10, 64));
addPvpItem(11, new PvpItem(Material.LOG, (byte)1, 1, "Spruce Wood", 50, 10, 64));
addPvpItem(12, new PvpItem(Material.LOG, (byte)2, 1, "Birch Wood", 50, 10, 64));
addPvpItem(13, new PvpItem(Material.LOG, (byte)3, 1, "Jungle Wood", 50, 10, 64));
addPvpItem(14, new PvpItem(Material.LOG_2, (byte)0, 1, "Acacia Wood", 50, 10, 64));
addPvpItem(15, new PvpItem(Material.LOG_2, (byte)1, 1, "Dark Oak Wood", 50, 10, 64));
addShopItem(10, Material.LOG, 50, 10, (byte) 0);
addShopItem(11, Material.LOG, 50, 10, (byte) 1);
addShopItem(12, Material.LOG, 50, 10, (byte) 2);
addShopItem(13, Material.LOG, 50, 10, (byte) 3);
addShopItem(14, Material.LOG_2, 50, 10, (byte) 0);
addShopItem(15, Material.LOG_2, 50, 10, (byte) 1);
addPvpItem(19, new PvpItem(Material.SAND, (byte)0, 1, "Sand", 20, 4, 64));
addPvpItem(20, new PvpItem(Material.GLASS, (byte)0, 1, "Glass", 30, 6, 64));
addPvpItem(21, new PvpItem(Material.SANDSTONE, (byte)0, 1, "Sandstone", 80, 16, 64));
addPvpItem(22, new PvpItem(Material.DIRT, (byte)0, 1, "Dirt", 10, 2, 64));
addPvpItem(23, new PvpItem(Material.NETHER_BRICK, (byte)0, 1, "Netherbrick", 50, 10, 64));
addPvpItem(24, new PvpItem(Material.QUARTZ_BLOCK, (byte)0, 1, "Quartz Block", 75, 15, 64));
addPvpItem(25, new PvpItem(Material.CLAY, (byte)0, 1, "Clay Block", 30, 6, 64));
addShopItem(19, Material.SAND, 20, 4);
addShopItem(20, Material.GLASS, 30, 6);
addShopItem(21, Material.SANDSTONE, 80, 16);
addShopItem(22, Material.DIRT, 10, 2);
addShopItem(23, Material.NETHER_BRICK, 50, 10);
addShopItem(24, Material.QUARTZ_BLOCK, 75, 15);
addShopItem(25, Material.CLAY, 30, 6);
}
public void addPvpItem(int slot, PvpItem item)
public void addShopItem(int slot, Material material, int buyPrice, int sellPrice)
{
addButton(slot, item, new PvpShopButton<BuildingPage>(this, item));
addShopItem(slot, material, buyPrice, sellPrice, (byte) 0);
}
public void addShopItem(int slot, Material material, int buyPrice, int sellPrice, byte data)
{
PvpItem item = new PvpItem(material, (byte)0, 1, Clans.prettifyName(material), buyPrice, sellPrice, 64);
addButton(slot, item, new ShopItemButton<BuildingPage>(this, item, buyPrice, sellPrice));
}
}

View File

@ -3,6 +3,7 @@ package mineplex.game.clans.spawn;
import java.util.Set;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
@ -30,6 +31,7 @@ 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.UtilTextMiddle;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilTime.TimeUnit;
import mineplex.core.updater.UpdateType;
@ -45,6 +47,7 @@ public class Spawn extends MiniPlugin
public static final int SPAWN_RADIUS = 32;
public static final int SHOP_RADIUS = 48;
public static final String COMBAT_TAG_NAME = "Unsafe";
public static final long COMBAT_TAG_DURATION = 15000;
private static Spawn _instance;
public static Spawn getInstance() { return _instance; }
@ -103,14 +106,20 @@ public class Spawn extends MiniPlugin
if (_clansManager.getClanUtility().isSafe(cur.getLocation()))
{
long lastDamager = _clansManager.getCombatManager().Get(cur).GetLastCombat();
if (!UtilTime.elapsed(lastDamager, 15000))
long duration = System.currentTimeMillis() - lastDamager;
if (!UtilTime.elapsed(lastDamager, COMBAT_TAG_DURATION))
{
UtilPlayer.message(cur, F.main("Safe Zone", "You are not safe for " +
F.time(UtilTime.convertString(15000 - (System.currentTimeMillis() - lastDamager), 1, TimeUnit.FIT))));
String message = ChatColor.RED + "Unsafe for "
+ ChatColor.YELLOW + F.time(UtilTime.convertString(COMBAT_TAG_DURATION - duration, 1, TimeUnit.FIT));
UtilTextMiddle.display(null, message, 0, 20, 0, cur);
_clansManager.getCondition().Factory().Custom(COMBAT_TAG_NAME, cur, cur, ConditionType.CUSTOM, 1, 0, false, Material.FIRE, (byte)0, true);
}
else if (!UtilTime.elapsed(lastDamager, COMBAT_TAG_DURATION + 1000))
{
UtilTextMiddle.display(null, ChatColor.GREEN + "Safe!", 0, 60, 20, cur);
}
}
}
}
@ -191,8 +200,6 @@ public class Spawn extends MiniPlugin
{
int size = event.getDrops().size();
event.getDrops().clear();
System.out.println("Cleared " + size + " to " + event.getDrops().size());
}
}
}
@ -209,11 +216,9 @@ public class Spawn extends MiniPlugin
@EventHandler
public void onBlockBreak(BlockBreakEvent event)
{
if (isInSpawn(event.getBlock().getLocation()) && event.getPlayer().getGameMode() != GameMode.CREATIVE)
{
event.setCancelled(true);
}
else if (isInSpawn(event.getPlayer()) && event.getPlayer().getGameMode() != GameMode.CREATIVE)
if (event.getPlayer().getGameMode() == GameMode.CREATIVE) return;
if (isInSpawn(event.getBlock().getLocation()) || isInSpawn(event.getPlayer()))
{
event.setCancelled(true);
}