->Added hasPermissionToBreakSign(Sign, Player)

->Fixed return conditions for hasPermissionToBreakWorldShopSign()
This commit is contained in:
sigonasr2 2016-07-29 20:33:21 -05:00
parent 94d4a88948
commit d22b1c305f
5 changed files with 39 additions and 6 deletions

Binary file not shown.

View File

@ -1,6 +1,6 @@
name: TwosideKeeper name: TwosideKeeper
main: sig.plugin.TwosideKeeper.TwosideKeeper main: sig.plugin.TwosideKeeper.TwosideKeeper
version: 3.7.3-alpha1 version: 3.7.3-alpha2
commands: commands:
money: money:
description: Tells the player the amount of money they are holding. description: Tells the player the amount of money they are holding.

View File

@ -1613,6 +1613,9 @@ public class GenericFunctions {
case TRAP_DOOR:{ case TRAP_DOOR:{
return "Wooden Trapdoor"; return "Wooden Trapdoor";
} }
case IRON_FENCE:{
return "Iron Bars";
}
default:{ default:{
return GenericFunctions.CapitalizeFirstLetters(type.getType().toString().replace("_", " ")); return GenericFunctions.CapitalizeFirstLetters(type.getType().toString().replace("_", " "));
} }
@ -2810,4 +2813,25 @@ public class GenericFunctions {
return false; return false;
} }
} }
public static boolean isBankSign(Sign s) {
return s.getLine(0).equalsIgnoreCase(ChatColor.AQUA+"-- BANK --");
}
public static boolean hasPermissionToBreakSign(Sign s, Player p) {
String[] lines = s.getLines();
if (WorldShop.isWorldShopSign(s)) {
WorldShop shop = TwosideKeeper.TwosideShops.LoadWorldShopData(s);
if (shop.GetOwner().equalsIgnoreCase(p.getName()) || p.isOp()) {
return true;
} else {
return false;
}
} else
if (GenericFunctions.isBankSign(s)) {
return false;
} else {
return true;
}
}
} }

View File

@ -799,11 +799,15 @@ public class WorldShop {
public static boolean hasPermissionToBreakWorldShopSign(Sign s, Player p) { public static boolean hasPermissionToBreakWorldShopSign(Sign s, Player p) {
String[] lines = s.getLines(); String[] lines = s.getLines();
WorldShop shop = TwosideKeeper.TwosideShops.LoadWorldShopData(s); if (WorldShop.isWorldShopSign(s)) {
if (shop.GetOwner().equalsIgnoreCase(p.getName()) || p.isOp()) { WorldShop shop = TwosideKeeper.TwosideShops.LoadWorldShopData(s);
return true; if (shop.GetOwner().equalsIgnoreCase(p.getName()) || p.isOp()) {
return true;
} else {
return false;
}
} else { } else {
return false; return true;
} }
} }
} }

View File

@ -170,6 +170,11 @@ public final class TwosideKeeperAPI {
return SpleefManager.playerIsPlayingSpleef(p); return SpleefManager.playerIsPlayingSpleef(p);
} }
//Breaking COMMANDS.
public static boolean hasPermissionToBreakSign(Sign s, Player p) {
return GenericFunctions.hasPermissionToBreakSign(s,p);
}
//World Shop COMMANDS. //World Shop COMMANDS.
public static boolean isWorldShop(Location l) { public static boolean isWorldShop(Location l) {
return WorldShop.shopSignExists(l); return WorldShop.shopSignExists(l);