+ Added shop signs. Closes #1.

This commit is contained in:
Steffion 2013-10-05 23:20:35 +02:00
parent ff7522ad22
commit 59066f3660
3 changed files with 42 additions and 0 deletions

View File

@ -73,6 +73,8 @@ public enum ConfigC {
sign_LEAVE (new String[] { "%H[" + BlockHunt.pdfFile.getName() + "%H]",
"&4LEAVE", "&8Right-Click", "&8To leave." }, W.config),
sign_SHOP (new String[] { "%H[" + BlockHunt.pdfFile.getName() + "%H]",
"&4SHOP", "&8Right-Click", "&8To shop." }, W.config),
sign_WAITING (new String[] { "%H[" + BlockHunt.pdfFile.getName() + "%H]",
"%A%arenaname%", "%A%players%%N/%A%maxplayers%", "&8Waiting..." },
W.config),

View File

@ -4,6 +4,7 @@ import nl.Steffion.BlockHunt.Arena;
import nl.Steffion.BlockHunt.Arena.ArenaState;
import nl.Steffion.BlockHunt.ArenaHandler;
import nl.Steffion.BlockHunt.ConfigC;
import nl.Steffion.BlockHunt.InventoryHandler;
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
import nl.Steffion.BlockHunt.SignsHandler;
import nl.Steffion.BlockHunt.SolidBlockHandler;
@ -112,6 +113,16 @@ public class OnPlayerInteractEvent implements Listener {
ArenaHandler.playerLeaveArena(player, true,
true);
}
} else if (sign.getLine(1).equals(
MessageM.replaceAll(W.config
.getFile()
.getStringList(
ConfigC.sign_SHOP.location)
.get(1)))) {
if (PermissionsM.hasPerm(player,
Permissions.shop, true)) {
InventoryHandler.openShop(player);
}
} else {
for (Arena arena : W.arenaList) {
if (sign.getLines()[1]

View File

@ -25,6 +25,22 @@ public class SignsHandler {
location);
W.signs.save();
saved = true;
} else {
number = number + 1;
}
}
} else if (lines[1].equalsIgnoreCase("shop")) {
boolean saved = false;
int number = 1;
while (!saved) {
if (W.signs.getFile().get("shop_" + number) == null) {
W.signs.getFile().set("shop_" + number + ".arenaName",
"shop");
W.signs.getFile().set("shop_" + number + ".location",
location);
W.signs.save();
saved = true;
} else {
number = number + 1;
@ -111,6 +127,19 @@ public class SignsHandler {
linecount = linecount + 1;
}
signblock.update();
} else if (sign.contains("shop")) {
ArrayList<String> signLines = (ArrayList<String>) W.config
.getFile().getList(ConfigC.sign_SHOP.location);
int linecount = 0;
for (String line : signLines) {
if (linecount <= 3) {
signblock.setLine(linecount,
MessageM.replaceAll(line));
}
linecount = linecount + 1;
}
signblock.update();
} else {
for (Arena arena : W.arenaList) {
if (lines[1].endsWith(arena.arenaName)) {