bunch of changes and fixes and bugs and stuff and things

This commit is contained in:
NewGarbo 2015-11-26 23:59:47 +00:00
parent 055702b36e
commit e849484670
4 changed files with 70 additions and 47 deletions

View File

@ -706,11 +706,11 @@ public class ClansUtility
return false;
}
if (clan.getEnergy() == 0)
{
UtilPlayer.message(caller, F.main("Clans", "You must purchase energy at a shop before you can claim land."));
return false;
}
// if (clan.getEnergy() == 0)
// {
// UtilPlayer.message(caller, F.main("Clans", "You must purchase energy at a shop before you can claim land."));
// return false;
// }
String chunk = UtilWorld.chunkToStr(caller.getLocation().getChunk());
ClanInfo ownerClan = getOwner(caller.getLocation());
@ -816,7 +816,7 @@ public class ClansUtility
}
// Recharge
if (!Recharge.Instance.use(caller, "Territory Claim", 60000, true, false)) return false;
// if (!Recharge.Instance.use(caller, "Territory Claim", 60000, true, false)) return false;
// Event
PlayerClaimTerritoryEvent event = new PlayerClaimTerritoryEvent(caller, caller.getLocation().getChunk(), clan);
@ -841,20 +841,23 @@ public class ClansUtility
public boolean checkBox(Chunk chunk, int req)
{
int boxed = 0;
for (int x = -1; x <= 1; x++)
for (int z = -1; z <= 1; z++)
{
if (x == 0 && z == 0 || x != 0 && z != 0) continue;
String other = UtilWorld.chunkToStr(chunk.getWorld().getChunkAt(chunk.getX() + x, chunk.getZ() + z));
ClanInfo adjClan = getOwner(other);
if (adjClan == null) continue;
boxed++;
}
// This is bad. I know. But the other way doesn't seem to work.
String down = UtilWorld.chunkToStr(chunk.getWorld().getChunkAt(chunk.getX() + 1, chunk.getZ() + 1));
String up = UtilWorld.chunkToStr(chunk.getWorld().getChunkAt(chunk.getX(), chunk.getZ() -1 ));
String right = UtilWorld.chunkToStr(chunk.getWorld().getChunkAt(chunk.getX() + 1, chunk.getZ()));
String left = UtilWorld.chunkToStr(chunk.getWorld().getChunkAt(chunk.getX() - 1, chunk.getZ() + 0));
ClanInfo downClan = getOwner(down);
ClanInfo upClan = getOwner(up);
ClanInfo leftClan = getOwner(left);
ClanInfo rightClan = getOwner(right);
if (downClan != null) boxed++;
if (upClan != null) boxed++;
if (leftClan != null) boxed++;
if (rightClan != null) boxed++;
return (boxed >= req);
}

View File

@ -26,6 +26,7 @@ import mineplex.game.clans.items.CustomItem;
import mineplex.game.clans.items.GearManager;
import mineplex.game.clans.items.economy.GoldToken;
import mineplex.game.clans.shop.PvpItem;
import mineplex.game.clans.spawn.Spawn;
public class TravelButton implements IButton
{
@ -37,9 +38,11 @@ public class TravelButton implements IButton
private Material _iconMaterial;
private String _name;
private String[] _lore;
private byte _data;
public TravelButton(TravelPage page, Location location, Material material, String name, String[] lore)
public TravelButton(TravelPage page, Location location, Material material, String name, String[] lore, byte data)
{
_data =data;
_page = page;
_location = location;
_iconMaterial = material;
@ -50,7 +53,15 @@ public class TravelButton implements IButton
@Override
public void onClick(Player player, ClickType clickType)
{
if (clickType != ClickType.LEFT) return;
if (clickType != ClickType.LEFT)
{
return;
}
if (player.getLocation().distance(_location) <= 64)
{
return;
}
transportPlayer(player);
}
@ -80,7 +91,7 @@ public class TravelButton implements IButton
index++;
}
ShopItem item = new ShopItem(_iconMaterial, (byte)0, _name, strLore, 0, false, false);
ShopItem item = new ShopItem(_iconMaterial, (byte)_data, _name, strLore, 0, false, false);
return item;
}

View File

@ -35,35 +35,38 @@ public class TravelPage extends ShopPageBase<ClansManager, TravelShop>
@Override
protected void buildPage()
{
Material m = Material.WATCH;
addTravelLocation(Spawn.getEastSpawn(), Material.IRON_SWORD, "East Spawn", new String[] {
"Spawns are locations where",
"you respawn after dying.",
addTravelLocation(Spawn.getEastSpawn(), getPlayer().getLocation().distance(Spawn.getEastSpawn()) <= 64 ? Material.SKULL_ITEM : Material.IRON_SWORD, getPlayer().getLocation().distance(Spawn.getEastSpawn()) <= 64 ? C.cRed : C.cWhite + "East Spawn", new String[] {
getPlayer().getLocation().distance(Spawn.getEastSpawn()) <= 64 ? C.cRed + "You are already here.": "",
C.cWhite + "Spawns are locations where",
C.cWhite + "you respawn after dying.",
" ",
"You cannot be attacked here,",
"as they are Safe Zones.",
}, 14 + 10);
addTravelLocation(Spawn.getWestSpawn(), Material.IRON_SWORD, "West Spawn", new String[] {
"Spawns are locations where",
"you respawn after dying.",
C.cWhite + "You cannot be attacked here,",
C.cWhite + "as they are Safe Zones.",
}, 14 + 10, getPlayer().getLocation().distance(Spawn.getEastSpawn()) <= 64 ? (byte) 3 : (byte) 0);
addTravelLocation(Spawn.getWestSpawn(), getPlayer().getLocation().distance(Spawn.getWestSpawn()) <= 64 ? Material.SKULL_ITEM : Material.IRON_SWORD, getPlayer().getLocation().distance(Spawn.getWestSpawn()) <= 64 ? C.cRed : C.cWhite + "West Spawn", new String[] {
getPlayer().getLocation().distance(Spawn.getWestSpawn()) <= 64 ? C.cRed + "You are already here.": "",
C.cWhite + "Spawns are locations where",
C.cWhite + "you respawn after dying.",
" ",
"You cannot be attacked here,",
"as they are Safe Zones.",
}, 12 + 8);
C.cWhite + "You cannot be attacked here,",
C.cWhite + "as they are Safe Zones.",
}, 12 + 8, getPlayer().getLocation().distance(Spawn.getWestSpawn()) <= 64 ? (byte) 3 : (byte) 0);
addTravelLocation(Spawn.getNorthTown(), Material.EMERALD, "North Shop", new String[] {
"Shops are locations where you",
"can buy and sell all sorts of goods.",
C.cWhite + "Shops are locations where you",
C.cWhite + "can buy and sell all sorts of goods.",
" ",
"You cannot be attacked here,",
"as they are Safe Zones.",
C.cWhite + "You cannot be attacked here,",
C.cWhite + "as they are Safe Zones.",
}, 4);
addTravelLocation(Spawn.getSouthTown(), Material.EMERALD, "South Shop", new String[] {
"Shops are locations where you",
"can buy and sell all sorts of goods.",
C.cWhite + "Shops are locations where you",
C.cWhite + "can buy and sell all sorts of goods.",
" ",
"You cannot be attacked here,",
"as they are Safe Zones.",
C.cWhite + "You cannot be attacked here,",
C.cWhite + "as they are Safe Zones.",
}, 22 + 9 + 9);
@ -127,7 +130,13 @@ public class TravelPage extends ShopPageBase<ClansManager, TravelShop>
public void addTravelLocation(Location location, Material material, String name, String[] lore, int slot)
{
TravelButton button = new TravelButton(this, location, material, name, lore);
TravelButton button = new TravelButton(this, location, material, name, lore, (byte) 0);
addButton(slot, button.generateButtonItem(), button);
}
public void addTravelLocation(Location location, Material material, String name, String[] lore, int slot, byte data)
{
TravelButton button = new TravelButton(this, location, material, name, lore, data);
addButton(slot, button.generateButtonItem(), button);
}
}

View File

@ -67,7 +67,7 @@ public class ClanTips extends MiniPlugin
@EventHandler
public void onClaimTerritory(final PlayerClaimTerritoryEvent event)
{
if (event.getClan().getClaimCount() == 1)
if (event.getClan().getClaimCount() == 0)
{
displayTip(TipType.FIRST_CLAIM_SETHOME, event.getClaimer());