+ Added shop signs. Closes #1.
This commit is contained in:
parent
ff7522ad22
commit
59066f3660
@ -73,6 +73,8 @@ public enum ConfigC {
|
|||||||
|
|
||||||
sign_LEAVE (new String[] { "%H[" + BlockHunt.pdfFile.getName() + "%H]",
|
sign_LEAVE (new String[] { "%H[" + BlockHunt.pdfFile.getName() + "%H]",
|
||||||
"&4LEAVE", "&8Right-Click", "&8To leave." }, W.config),
|
"&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]",
|
sign_WAITING (new String[] { "%H[" + BlockHunt.pdfFile.getName() + "%H]",
|
||||||
"%A%arenaname%", "%A%players%%N/%A%maxplayers%", "&8Waiting..." },
|
"%A%arenaname%", "%A%players%%N/%A%maxplayers%", "&8Waiting..." },
|
||||||
W.config),
|
W.config),
|
||||||
|
@ -4,6 +4,7 @@ import nl.Steffion.BlockHunt.Arena;
|
|||||||
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
import nl.Steffion.BlockHunt.Arena.ArenaState;
|
||||||
import nl.Steffion.BlockHunt.ArenaHandler;
|
import nl.Steffion.BlockHunt.ArenaHandler;
|
||||||
import nl.Steffion.BlockHunt.ConfigC;
|
import nl.Steffion.BlockHunt.ConfigC;
|
||||||
|
import nl.Steffion.BlockHunt.InventoryHandler;
|
||||||
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
|
import nl.Steffion.BlockHunt.PermissionsC.Permissions;
|
||||||
import nl.Steffion.BlockHunt.SignsHandler;
|
import nl.Steffion.BlockHunt.SignsHandler;
|
||||||
import nl.Steffion.BlockHunt.SolidBlockHandler;
|
import nl.Steffion.BlockHunt.SolidBlockHandler;
|
||||||
@ -112,6 +113,16 @@ public class OnPlayerInteractEvent implements Listener {
|
|||||||
ArenaHandler.playerLeaveArena(player, true,
|
ArenaHandler.playerLeaveArena(player, true,
|
||||||
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 {
|
} else {
|
||||||
for (Arena arena : W.arenaList) {
|
for (Arena arena : W.arenaList) {
|
||||||
if (sign.getLines()[1]
|
if (sign.getLines()[1]
|
||||||
|
@ -25,6 +25,22 @@ public class SignsHandler {
|
|||||||
location);
|
location);
|
||||||
W.signs.save();
|
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;
|
saved = true;
|
||||||
} else {
|
} else {
|
||||||
number = number + 1;
|
number = number + 1;
|
||||||
@ -111,6 +127,19 @@ public class SignsHandler {
|
|||||||
linecount = linecount + 1;
|
linecount = linecount + 1;
|
||||||
}
|
}
|
||||||
signblock.update();
|
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 {
|
} else {
|
||||||
for (Arena arena : W.arenaList) {
|
for (Arena arena : W.arenaList) {
|
||||||
if (lines[1].endsWith(arena.arenaName)) {
|
if (lines[1].endsWith(arena.arenaName)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user