1.2-STABLE
/f tntfill wont spam chat anymore, I changed the tntfill_success option, so you're gonna wanna delete that to rengerate it. If you havent edited the lang.yml just delete it and restart /f stuck wont tp players outside the border anymore. Nametags & Tab has placeholderapi support added use {relationcolor} and {faction} for relational color and faction ( These were already built in ) They can be edited in the lang.yml the option is default_prefix. /f perms now has tntfill, tntbank, and vault permission options
This commit is contained in:
parent
ba9b3587e0
commit
6bf4598d57
@ -51,7 +51,7 @@ public class P extends MPlugin {
|
|||||||
public static Permission perms = null;
|
public static Permission perms = null;
|
||||||
|
|
||||||
|
|
||||||
|
ItemStack item = new ItemStack(Material.CAKE);
|
||||||
// Persistence related
|
// Persistence related
|
||||||
private boolean locked = false;
|
private boolean locked = false;
|
||||||
|
|
||||||
|
@ -73,7 +73,8 @@ public class CmdStuck extends FCommand {
|
|||||||
public boolean work() {
|
public boolean work() {
|
||||||
FLocation chunk = currentFLocation();
|
FLocation chunk = currentFLocation();
|
||||||
Faction faction = board.getFactionAt(chunk);
|
Faction faction = board.getFactionAt(chunk);
|
||||||
if (faction.isWilderness()) {
|
int buffer = P.p.getConfig().getInt("world-border.buffer", 0);
|
||||||
|
if (faction.isWilderness() && !chunk.isOutsideWorldBorder(buffer)) {
|
||||||
int cx = FLocation.chunkToBlock((int) chunk.getX());
|
int cx = FLocation.chunkToBlock((int) chunk.getX());
|
||||||
int cz = FLocation.chunkToBlock((int) chunk.getZ());
|
int cz = FLocation.chunkToBlock((int) chunk.getZ());
|
||||||
int y = world.getHighestBlockYAt(cx, cz);
|
int y = world.getHighestBlockYAt(cx, cz);
|
||||||
|
@ -2,6 +2,8 @@ package com.massivecraft.factions.cmd;
|
|||||||
|
|
||||||
import com.massivecraft.factions.P;
|
import com.massivecraft.factions.P;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
|
import com.massivecraft.factions.zcore.fperms.Access;
|
||||||
|
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -17,6 +19,7 @@ public class CmdTnt extends FCommand {
|
|||||||
this.optionalArgs.put("add/take", "");
|
this.optionalArgs.put("add/take", "");
|
||||||
this.optionalArgs.put("amount", "number");
|
this.optionalArgs.put("amount", "number");
|
||||||
|
|
||||||
|
|
||||||
this.permission = Permission.TNT.node;
|
this.permission = Permission.TNT.node;
|
||||||
this.disableOnLock = true;
|
this.disableOnLock = true;
|
||||||
|
|
||||||
@ -32,6 +35,13 @@ public class CmdTnt extends FCommand {
|
|||||||
fme.msg(TL.COMMAND_TNT_DISABLED_MSG);
|
fme.msg(TL.COMMAND_TNT_DISABLED_MSG);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Access access = fme.getFaction().getAccess(fme, PermissableAction.TNTBANK);
|
||||||
|
if (access.equals(Access.DENY)) {
|
||||||
|
fme.msg(TL.GENERIC_NOPERMISSION, "tntbank");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (args.size() == 2) {
|
if (args.size() == 2) {
|
||||||
if (args.get(0).equalsIgnoreCase("add")) {
|
if (args.get(0).equalsIgnoreCase("add")) {
|
||||||
int testNumber = -1;
|
int testNumber = -1;
|
||||||
|
@ -3,6 +3,8 @@ package com.massivecraft.factions.cmd;
|
|||||||
import com.massivecraft.factions.P;
|
import com.massivecraft.factions.P;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
import com.massivecraft.factions.struct.Role;
|
import com.massivecraft.factions.struct.Role;
|
||||||
|
import com.massivecraft.factions.zcore.fperms.Access;
|
||||||
|
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -34,6 +36,13 @@ public class CmdTntFill extends FCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void perform(){
|
public void perform(){
|
||||||
|
Access access = fme.getFaction().getAccess(fme, PermissableAction.TNTFILL);
|
||||||
|
if (access.equals(Access.DENY)) {
|
||||||
|
fme.msg(TL.GENERIC_NOPERMISSION, "tntfill");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
msg(TL.COMMAND_TNTFILL_HEADER);
|
msg(TL.COMMAND_TNTFILL_HEADER);
|
||||||
int radius = argAsInt(0,16);
|
int radius = argAsInt(0,16);
|
||||||
int amount = argAsInt(1,16);
|
int amount = argAsInt(1,16);
|
||||||
@ -58,6 +67,7 @@ public class CmdTntFill extends FCommand {
|
|||||||
}
|
}
|
||||||
boolean bankMode = fme.getRole().isAtLeast(Role.MODERATOR);
|
boolean bankMode = fme.getRole().isAtLeast(Role.MODERATOR);
|
||||||
Location start = me.getLocation();
|
Location start = me.getLocation();
|
||||||
|
int counter = 0;
|
||||||
for (double x = start.getX() - radius; x <= start.getX() + radius; x++) {
|
for (double x = start.getX() - radius; x <= start.getX() + radius; x++) {
|
||||||
for (double y = start.getY() - radius; y <= start.getY() + radius; y++) {
|
for (double y = start.getY() - radius; y <= start.getY() + radius; y++) {
|
||||||
for (double z = start.getZ() - radius; z <= start.getZ() + radius; z++) {
|
for (double z = start.getZ() - radius; z <= start.getZ() + radius; z++) {
|
||||||
@ -71,13 +81,17 @@ public class CmdTntFill extends FCommand {
|
|||||||
if (!inventoryContains(me.getInventory(), new ItemStack(Material.TNT,amount))){
|
if (!inventoryContains(me.getInventory(), new ItemStack(Material.TNT,amount))){
|
||||||
if (!fme.getRole().isAtLeast(Role.MODERATOR)){
|
if (!fme.getRole().isAtLeast(Role.MODERATOR)){
|
||||||
msg(TL.COMMAND_TNTFILL_NOTENOUGH);
|
msg(TL.COMMAND_TNTFILL_NOTENOUGH);
|
||||||
|
sendMessage(TL.COMMAND_TNTFILL_SUCCESS.toString().replace("{amount}",amount + "").replace("{dispensers}",counter+ ""));
|
||||||
|
me.updateInventory();
|
||||||
return;
|
return;
|
||||||
} else if (bankMode){
|
} else if (bankMode){
|
||||||
msg(TL.COMMAND_TNTFILL_MOD.toString().replace("{role}",fme.getRole().nicename));
|
//msg(TL.COMMAND_TNTFILL_MOD.toString().replace("{role}",fme.getRole().nicename));
|
||||||
bankMode = true;
|
bankMode = true;
|
||||||
me.performCommand("f tnt take " + amount);
|
removeFromBank(amount);
|
||||||
if (!inventoryContains(me.getInventory(), new ItemStack(Material.TNT,amount))){
|
if (!inventoryContains(me.getInventory(), new ItemStack(Material.TNT,amount))){
|
||||||
msg(TL.COMMAND_TNTFILL_NOTENOUGH);
|
msg(TL.COMMAND_TNTFILL_NOTENOUGH);
|
||||||
|
sendMessage(TL.COMMAND_TNTFILL_SUCCESS.toString().replace("{amount}",amount + "").replace("{dispensers}",counter+ ""));
|
||||||
|
me.updateInventory();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -92,18 +106,64 @@ public class CmdTntFill extends FCommand {
|
|||||||
dispenser.addItem(tnt);
|
dispenser.addItem(tnt);
|
||||||
takeTnt(remainderAmt);
|
takeTnt(remainderAmt);
|
||||||
}
|
}
|
||||||
sendMessage(TL.COMMAND_TNTFILL_SUCCESS.toString().replace("{amount}",amount + "").replace("{x}",(int) x + "")
|
//sendMessage(TL.COMMAND_TNTFILL_SUCCESS.toString().replace("{amount}",amount + "").replace("{x}",(int) x + "").replace("{y}",(int) y + "").replace("{z}",(int) z + ""));
|
||||||
.replace("{y}",(int) y + "").replace("{z}",(int) z + ""));
|
counter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (bankMode) {
|
||||||
|
msg(TL.COMMAND_TNTFILL_MOD.toString().replace("{role}",fme.getRole().nicename));
|
||||||
|
}
|
||||||
|
sendMessage(TL.COMMAND_TNTFILL_SUCCESS.toString().replace("{amount}",amount + "").replace("{dispensers}",counter+ ""));
|
||||||
|
me.updateInventory();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void removeFromBank(int amount){
|
||||||
|
int testNumber = -1;
|
||||||
|
try {
|
||||||
|
testNumber = Integer.parseInt(args.get(1));
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
fme.msg(TL.COMMAND_TNT_INVALID_NUM);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (amount < 0) {
|
||||||
|
fme.msg(TL.COMMAND_TNT_POSITIVE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (fme.getFaction().getTnt() < amount) {
|
||||||
|
fme.msg(TL.COMMAND_TNT_WIDTHDRAW_NOTENOUGH);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int fullStacks = amount / 64;
|
||||||
|
int remainderAmt = amount % 64;
|
||||||
|
if ((remainderAmt == 0 && getEmptySlots(me) <= fullStacks)) {
|
||||||
|
fme.msg(TL.COMMAND_TNT_WIDTHDRAW_NOTENOUGH);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (getEmptySlots(me) + 1 <= fullStacks) {
|
||||||
|
fme.msg(TL.COMMAND_TNT_WIDTHDRAW_NOTENOUGH);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ItemStack tnt64 = new ItemStack(Material.TNT, 64);
|
||||||
|
for (int i = 0; i <= fullStacks - 1; i++) {
|
||||||
|
me.getInventory().addItem(tnt64);
|
||||||
|
}
|
||||||
|
if (remainderAmt != 0) {
|
||||||
|
ItemStack tnt = new ItemStack(Material.TNT, remainderAmt);
|
||||||
|
me.getInventory().addItem(tnt);
|
||||||
|
}
|
||||||
|
fme.getFaction().takeTnt(amount);
|
||||||
|
me.updateInventory();
|
||||||
|
}
|
||||||
|
|
||||||
public void takeTnt(int amount){
|
public void takeTnt(int amount){
|
||||||
Inventory inv = me.getInventory();
|
Inventory inv = me.getInventory();
|
||||||
int invTnt = 0;
|
int invTnt = 0;
|
||||||
|
@ -10,6 +10,8 @@ import com.massivecraft.factions.Conf;
|
|||||||
import com.massivecraft.factions.FLocation;
|
import com.massivecraft.factions.FLocation;
|
||||||
import com.massivecraft.factions.P;
|
import com.massivecraft.factions.P;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
|
import com.massivecraft.factions.zcore.fperms.Access;
|
||||||
|
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -39,10 +41,15 @@ public class CmdVault extends FCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void perform() {
|
public void perform() {
|
||||||
|
|
||||||
if (!P.p.getConfig().getBoolean("fvault.Enabled")){
|
if (!P.p.getConfig().getBoolean("fvault.Enabled")){
|
||||||
fme.sendMessage("This command is disabled!");
|
fme.sendMessage("This command is disabled!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Access access = fme.getFaction().getAccess(fme, PermissableAction.VAULT);
|
||||||
|
if (access.equals(Access.DENY)) {
|
||||||
|
fme.msg(TL.GENERIC_NOPERMISSION, "vault");
|
||||||
|
}
|
||||||
|
|
||||||
if (fme.isInVault()){
|
if (fme.isInVault()){
|
||||||
me.closeInventory();
|
me.closeInventory();
|
||||||
|
@ -2,6 +2,7 @@ package com.massivecraft.factions.scoreboards;
|
|||||||
|
|
||||||
import com.massivecraft.factions.*;
|
import com.massivecraft.factions.*;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
|
import me.clip.placeholderapi.PlaceholderAPI;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.scoreboard.Scoreboard;
|
import org.bukkit.scoreboard.Scoreboard;
|
||||||
@ -169,6 +170,8 @@ public class FTeamWrapper {
|
|||||||
Team team = teams.get(fboard);
|
Team team = teams.get(fboard);
|
||||||
|
|
||||||
String prefix = TL.DEFAULT_PREFIX.toString();
|
String prefix = TL.DEFAULT_PREFIX.toString();
|
||||||
|
prefix = PlaceholderAPI.setPlaceholders(fplayer.getPlayer(),prefix);
|
||||||
|
prefix = PlaceholderAPI.setBracketPlaceholders(fplayer.getPlayer(),prefix);
|
||||||
prefix = prefix.replace("{relationcolor}", faction.getRelationTo(fplayer).getColor().toString());
|
prefix = prefix.replace("{relationcolor}", faction.getRelationTo(fplayer).getColor().toString());
|
||||||
prefix = prefix.replace("{faction}", faction.getTag().substring(0, Math.min("{faction}".length() + 16 - prefix.length(), faction.getTag().length())));
|
prefix = prefix.replace("{faction}", faction.getTag().substring(0, Math.min("{faction}".length() + 16 - prefix.length(), faction.getTag().length())));
|
||||||
if (team.getPrefix() == null || !team.getPrefix().equals(prefix)) {
|
if (team.getPrefix() == null || !team.getPrefix().equals(prefix)) {
|
||||||
|
@ -34,7 +34,10 @@ public enum PermissableAction {
|
|||||||
PROMOTE("promote"),
|
PROMOTE("promote"),
|
||||||
SETWARP("setwarp"),
|
SETWARP("setwarp"),
|
||||||
WARP("warp"),
|
WARP("warp"),
|
||||||
FLY("fly"),;
|
FLY("fly"),
|
||||||
|
VAULT("vault"),
|
||||||
|
TNTBANK("tntbank"),
|
||||||
|
TNTFILL("tntfill");
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
@ -674,7 +674,7 @@ public enum TL {
|
|||||||
COMMAND_TNT_DESCRIPTION("add/widthraw from faction's tnt bank"),
|
COMMAND_TNT_DESCRIPTION("add/widthraw from faction's tnt bank"),
|
||||||
|
|
||||||
COMMAND_TNTFILL_HEADER("&c&l[!] &7Filling tnt in dispensers..."),
|
COMMAND_TNTFILL_HEADER("&c&l[!] &7Filling tnt in dispensers..."),
|
||||||
COMMAND_TNTFILL_SUCCESS("&c&l[!] &7Filled &c{amount}&7 Tnt in dispenser at {x} {y} {z}"),
|
COMMAND_TNTFILL_SUCCESS("&c&l[!] &7Filled &c{amount}&7 Tnt in &c{dispensers} &7dispensers"),
|
||||||
COMMAND_TNTFILL_NOTENOUGH("&c&l[!] &7Not enough tnt in inventory."),
|
COMMAND_TNTFILL_NOTENOUGH("&c&l[!] &7Not enough tnt in inventory."),
|
||||||
COMMAND_TNTFILL_RADIUSMAX("&c&l[!] &7The max radius is {max}"),
|
COMMAND_TNTFILL_RADIUSMAX("&c&l[!] &7The max radius is {max}"),
|
||||||
COMMAND_TNTFILL_AMOUNTMAX("&c&l[!] &7The max amount is {max}"),
|
COMMAND_TNTFILL_AMOUNTMAX("&c&l[!] &7The max amount is {max}"),
|
||||||
|
@ -501,6 +501,9 @@ fperm-gui:
|
|||||||
ban: 27
|
ban: 27
|
||||||
disband: 28
|
disband: 28
|
||||||
fly: 29
|
fly: 29
|
||||||
|
vault: 30
|
||||||
|
tntbank: 31
|
||||||
|
tntfill: 32
|
||||||
# Material to show, if the material is colorable eg: Wool, Stained Clay it will update with it's access color
|
# Material to show, if the material is colorable eg: Wool, Stained Clay it will update with it's access color
|
||||||
materials:
|
materials:
|
||||||
build: STAINED_CLAY
|
build: STAINED_CLAY
|
||||||
@ -524,6 +527,9 @@ fperm-gui:
|
|||||||
ban: STAINED_CLAY
|
ban: STAINED_CLAY
|
||||||
disband: STAINED_CLAY
|
disband: STAINED_CLAY
|
||||||
fly: STAINED_CLAY
|
fly: STAINED_CLAY
|
||||||
|
vault: STAINED_CLAY
|
||||||
|
tntbank: STAINED_CLAY
|
||||||
|
tntfill: STAINED_CLAY
|
||||||
# Same dummy items format as above
|
# Same dummy items format as above
|
||||||
dummy-items:
|
dummy-items:
|
||||||
'0':
|
'0':
|
||||||
@ -536,9 +542,6 @@ fperm-gui:
|
|||||||
- 8
|
- 8
|
||||||
- 29
|
- 29
|
||||||
- 30
|
- 30
|
||||||
- 31
|
|
||||||
- 32
|
|
||||||
- 33
|
|
||||||
- 34
|
- 34
|
||||||
- 35
|
- 35
|
||||||
# {action} Action name eg: Setwarp, Kick
|
# {action} Action name eg: Setwarp, Kick
|
||||||
|
Loading…
Reference in New Issue
Block a user