F map autoupdate during flying fixed.

This commit is contained in:
ProSavage
2018-07-12 11:11:07 -05:00
parent 2426142664
commit 143daad9e6
74 changed files with 3460 additions and 3659 deletions

View File

@@ -75,7 +75,6 @@ public class CmdBan extends FCommand {
}
// Ban the user.
myFaction.ban(target, fme);
myFaction.deinvite(target); // can't hurt

View File

@@ -4,7 +4,6 @@ import com.massivecraft.factions.Conf;
import com.massivecraft.factions.struct.ChatMode;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.Bukkit;
public class CmdChat extends FCommand {
@@ -38,7 +37,7 @@ public class CmdChat extends FCommand {
if (modeString != null) {
modeString = modeString.toLowerCase();
if (modeString.startsWith("m")){
if (modeString.startsWith("m")) {
modeTarget = ChatMode.MOD;
} else if (modeString.startsWith("p")) {
modeTarget = ChatMode.PUBLIC;
@@ -56,10 +55,9 @@ public class CmdChat extends FCommand {
fme.setChatMode(modeTarget);
if (fme.getChatMode() == ChatMode.MOD)
{
if (fme.getChatMode() == ChatMode.MOD) {
msg(TL.COMMAND_CHAT_MODE_MOD);
}else if (fme.getChatMode() == ChatMode.PUBLIC) {
} else if (fme.getChatMode() == ChatMode.PUBLIC) {
msg(TL.COMMAND_CHAT_MODE_PUBLIC);
} else if (fme.getChatMode() == ChatMode.ALLIANCE) {
msg(TL.COMMAND_CHAT_MODE_ALLIANCE);

View File

@@ -50,8 +50,8 @@ public class CmdClaim extends FCommand {
}
new SpiralTask(new FLocation(me), radius) {
private int failCount = 0;
private final int limit = Conf.radiusClaimFailureLimit - 1;
private int failCount = 0;
@Override
public boolean work() {

View File

@@ -4,11 +4,10 @@ import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.Location;
import org.bukkit.plugin.java.JavaPlugin;
public class CmdCoords extends FCommand {
public CmdCoords(){
public CmdCoords() {
super();
this.aliases.add("coords");
this.aliases.add("coord");
@@ -24,11 +23,11 @@ public class CmdCoords extends FCommand {
}
@Override
public void perform(){
public void perform() {
Location location = fme.getPlayer().getLocation();
String message = TL.COMMAND_COORDS_MESSAGE.toString().replace("{player}",fme.getPlayer().getDisplayName()).replace("{x}",(int) location.getX() + "")
.replace("{y}",(int) location.getY() + "").replace("{z}",(int) location.getZ() + "").replace("{world}",location.getWorld().getName());
for (FPlayer fPlayer : fme.getFaction().getFPlayers()){
String message = TL.COMMAND_COORDS_MESSAGE.toString().replace("{player}", fme.getPlayer().getDisplayName()).replace("{x}", (int) location.getX() + "")
.replace("{y}", (int) location.getY() + "").replace("{z}", (int) location.getZ() + "").replace("{world}", location.getWorld().getName());
for (FPlayer fPlayer : fme.getFaction().getFPlayers()) {
fPlayer.sendMessage(message);
}
}

View File

@@ -24,6 +24,7 @@ public class CmdFly extends FCommand {
public static ConcurrentHashMap<String, Boolean> flyMap = new ConcurrentHashMap<String, Boolean>();
public static int id = -1;
public static int flyid = -1;
public CmdFly() {
super();
this.aliases.add("fly");
@@ -48,15 +49,15 @@ public class CmdFly extends FCommand {
continue;
}
if (!P.p.mc17) {
if (player.getGameMode() == GameMode.SPECTATOR){
if (player.getGameMode() == GameMode.SPECTATOR) {
continue;
}
}
if (FPlayers.getInstance().getByPlayer(player).isVanished()){
if (FPlayers.getInstance().getByPlayer(player).isVanished()) {
continue;
}
ParticleEffect.CLOUD.display((float) 0, (float) 0, (float) 0, (float) 0, 3, player.getLocation().add(0, -0.35, 0), 16);
ParticleEffect.CLOUD.display((float) 0, (float) 0, (float) 0, (float) 0, 3, player.getLocation().add(0, -0.35, 0), 16);
}
if (flyMap.keySet().size() == 0) {
Bukkit.getScheduler().cancelTask(id);
@@ -72,44 +73,44 @@ public class CmdFly extends FCommand {
public void run() throws ConcurrentModificationException { //threw the exception for now, until I recode fly :( Cringe.
checkTaskState();
if (flyMap.keySet().size() != 0) {
for (String name : flyMap.keySet()) {
if (name == null) {
continue;
}
Player player = Bukkit.getPlayer(name);
if (player == null) {
continue;
}
if (!player.isFlying()) {
continue;
}
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
if (fPlayer == null) {
continue;
}
if (player.getGameMode() == GameMode.CREATIVE || player.getGameMode() == GameMode.SPECTATOR) {
continue;
}
Faction myFaction = fPlayer.getFaction();
if (myFaction.isWilderness()) {
for (String name : flyMap.keySet()) {
if (name == null) {
continue;
}
Player player = Bukkit.getPlayer(name);
if (player == null) {
continue;
}
if (!player.isFlying()) {
continue;
}
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
if (fPlayer == null) {
continue;
}
if (player.getGameMode() == GameMode.CREATIVE || player.getGameMode() == GameMode.SPECTATOR) {
continue;
}
Faction myFaction = fPlayer.getFaction();
if (myFaction.isWilderness()) {
fPlayer.setFlying(false);
flyMap.remove(name);
continue;
}
if (fPlayer.checkIfNearbyEnemies()) {
continue;
}
FLocation myFloc = new FLocation(player.getLocation());
Faction toFac = Board.getInstance().getFactionAt(myFloc);
if (Board.getInstance().getFactionAt(myFloc) != myFaction) {
if (!checkBypassPerms(fPlayer, player, toFac)) {
fPlayer.setFlying(false);
flyMap.remove(name);
continue;
}
if (fPlayer.checkIfNearbyEnemies()) {
continue;
}
FLocation myFloc = new FLocation(player.getLocation());
Faction toFac = Board.getInstance().getFactionAt(myFloc);
if (Board.getInstance().getFactionAt(myFloc) != myFaction) {
if (!checkBypassPerms(fPlayer, player, toFac)) {
fPlayer.setFlying(false);
flyMap.remove(name);
continue;
}
}
}
}
}
}
@@ -139,16 +140,23 @@ public class CmdFly extends FCommand {
return ((player.hasPermission("factions.fly.neutral") || access == Access.ALLOW) && toFac.getRelationTo(fplayer.getFaction()) == Relation.NEUTRAL && !isSystemFaction(toFac));
}
public boolean isInFlightChecker(Player player) {
return flyMap.containsKey(player.getName());
}
public static Boolean isSystemFaction(Faction faction) {
return faction.isSafeZone() ||
faction.isWarZone() ||
faction.isWilderness();
}
public static void checkTaskState() {
if (flyMap.keySet().size() == 0) {
Bukkit.getScheduler().cancelTask(flyid);
flyid = -1;
}
}
public boolean isInFlightChecker(Player player) {
return flyMap.containsKey(player.getName());
}
@Override
public void perform() {
// Disabled by default.
@@ -159,7 +167,7 @@ public class CmdFly extends FCommand {
FLocation myfloc = new FLocation(me.getLocation());
Faction toFac = Board.getInstance().getFactionAt(myfloc);
if (Board.getInstance().getFactionAt(myfloc) != fme.getFaction()){
if (Board.getInstance().getFactionAt(myfloc) != fme.getFaction()) {
if (!me.hasPermission("factions.fly.wilderness") && toFac.isWilderness()) {
fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme));
return;
@@ -193,17 +201,13 @@ public class CmdFly extends FCommand {
}
List<Entity> entities = me.getNearbyEntities(16,256,16);
for (int i = 0; i <= entities.size() -1;i++)
{
if (entities.get(i) instanceof Player)
{
List<Entity> entities = me.getNearbyEntities(16, 256, 16);
for (int i = 0; i <= entities.size() - 1; i++) {
if (entities.get(i) instanceof Player) {
Player eplayer = (Player) entities.get(i);
FPlayer efplayer = FPlayers.getInstance().getByPlayer(eplayer);
if (efplayer.getRelationTo(fme) == Relation.ENEMY)
{
fme.msg(TL.COMMAND_FLY_CHECK_ENEMY);
if (efplayer.getRelationTo(fme) == Relation.ENEMY) {
fme.msg(TL.COMMAND_FLY_CHECK_ENEMY);
return;
}
}
@@ -213,14 +217,7 @@ public class CmdFly extends FCommand {
if (args.size() == 0) {
toggleFlight(!fme.isFlying(), me);
} else if (args.size() == 1) {
toggleFlight(argAsBool(0),me);
}
}
public static void checkTaskState() {
if (flyMap.keySet().size() == 0) {
Bukkit.getScheduler().cancelTask(flyid);
flyid = -1;
toggleFlight(argAsBool(0), me);
}
}
@@ -237,13 +234,13 @@ public class CmdFly extends FCommand {
@Override
public void run() {
fme.setFlying(true);
flyMap.put(player.getName(),true);
if (id == -1){
if (P.p.getConfig().getBoolean("ffly.Particles.Enabled")){
flyMap.put(player.getName(), true);
if (id == -1) {
if (P.p.getConfig().getBoolean("ffly.Particles.Enabled")) {
startParticles();
}
}
if (flyid == -1){
if (flyid == -1) {
startFlyCheck();
}
}

View File

@@ -13,6 +13,8 @@ import java.util.List;
public class CmdHelp extends FCommand {
public ArrayList<ArrayList<String>> helpPages;
public CmdHelp() {
super();
this.aliases.add("help");
@@ -32,6 +34,10 @@ public class CmdHelp extends FCommand {
senderMustBeAdmin = false;
}
//----------------------------------------------//
// Build the help pages
//----------------------------------------------//
@Override
public void perform() {
if (P.p.getConfig().getBoolean("use-old-help", true)) {
@@ -70,12 +76,6 @@ public class CmdHelp extends FCommand {
}
}
//----------------------------------------------//
// Build the help pages
//----------------------------------------------//
public ArrayList<ArrayList<String>> helpPages;
public void updateHelp() {
helpPages = new ArrayList<>();
ArrayList<String> pageLines;

View File

@@ -3,9 +3,8 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
public class CmdInspect extends FCommand
{
public CmdInspect(){
public class CmdInspect extends FCommand {
public CmdInspect() {
super();
this.aliases.add("inspect");
this.aliases.add("ins");
@@ -22,8 +21,8 @@ public class CmdInspect extends FCommand
@Override
public void perform(){
if (fme.isInspectMode()){
public void perform() {
if (fme.isInspectMode()) {
fme.setInspectMode(false);
msg(TL.COMMAND_INSPECT_DISABLED_MSG);
} else {

View File

@@ -2,12 +2,11 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
public class CmdLowPower extends FCommand {
public CmdLowPower(){
public CmdLowPower() {
super();
this.aliases.add("lowpower");
@@ -23,13 +22,13 @@ public class CmdLowPower extends FCommand {
@Override
public void perform(){
public void perform() {
double maxPower = Conf.powerPlayerMax;
String format = TL.COMMAND_LOWPOWER_FORMAT.toString();
msg(TL.COMMAND_LOWPOWER_HEADER.toString().replace("{maxpower}",(int) maxPower + ""));
for (FPlayer fPlayer : fme.getFaction().getFPlayers()){
if (fPlayer.getPower() < maxPower){
sendMessage(format.replace("{player}",fPlayer.getName()).replace("{player_power}",(int) fPlayer.getPower() + "").replace("{maxpower}",(int) maxPower + ""));
msg(TL.COMMAND_LOWPOWER_HEADER.toString().replace("{maxpower}", (int) maxPower + ""));
for (FPlayer fPlayer : fme.getFaction().getFPlayers()) {
if (fPlayer.getPower() < maxPower) {
sendMessage(format.replace("{player}", fPlayer.getName()).replace("{player_power}", (int) fPlayer.getPower() + "").replace("{maxpower}", (int) maxPower + ""));
}
}
}

View File

@@ -1,6 +1,5 @@
package com.massivecraft.factions.cmd;
import com.earth2me.essentials.Console;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.struct.Permission;

View File

@@ -1,7 +1,6 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.P;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Relation;
import com.massivecraft.factions.struct.Role;
import com.massivecraft.factions.zcore.fperms.Access;

View File

@@ -20,17 +20,15 @@ import java.util.List;
public class CmdSeeChunk extends FCommand {
private boolean useParticles;
private int length;
private ParticleEffect effect;
//Used a hashmap cuz imma make a particle selection gui later, will store it where the boolean is rn.
public static HashMap<String, Boolean> seeChunkMap = new HashMap<>();
Long interval = 10L;
private boolean useParticles;
private int length;
private ParticleEffect effect;
private int taskID = -1;
//I remade it cause of people getting mad that I had the same seechunk as drtshock
@@ -48,7 +46,7 @@ public class CmdSeeChunk extends FCommand {
this.useParticles = p.getConfig().getBoolean("see-chunk.particles", true);
interval = P.p.getConfig().getLong("see-chunk.interval", 10L);
if (effect == null){
if (effect == null) {
effect = ParticleEffect.REDSTONE;
}

View File

@@ -3,19 +3,12 @@ package com.massivecraft.factions.cmd;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ListMultimap;
import com.massivecraft.factions.FLocation;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.World;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
public class CmdShowClaims extends FCommand {
public class CmdShowClaims extends FCommand{
public CmdShowClaims(){
public CmdShowClaims() {
this.aliases.add("showclaims");
this.aliases.add("showclaim");
@@ -31,20 +24,20 @@ public class CmdShowClaims extends FCommand{
}
@Override
public void perform(){
sendMessage(TL.COMMAND_SHOWCLAIMS_HEADER.toString().replace("{faction}",fme.getFaction().describeTo(fme)));
ListMultimap<String,String> chunkMap = ArrayListMultimap.create();
public void perform() {
sendMessage(TL.COMMAND_SHOWCLAIMS_HEADER.toString().replace("{faction}", fme.getFaction().describeTo(fme)));
ListMultimap<String, String> chunkMap = ArrayListMultimap.create();
String format = TL.COMMAND_SHOWCLAIMS_CHUNKSFORMAT.toString();
for (FLocation fLocation : fme.getFaction().getAllClaims()){
chunkMap.put(fLocation.getWorldName(),format.replace("{x}",fLocation.getX() + "").replace("{z}",fLocation.getZ() + ""));
for (FLocation fLocation : fme.getFaction().getAllClaims()) {
chunkMap.put(fLocation.getWorldName(), format.replace("{x}", fLocation.getX() + "").replace("{z}", fLocation.getZ() + ""));
}
for (String world : chunkMap.keySet()){
String message = TL.COMMAND_SHOWCLAIMS_FORMAT.toString().replace("{world}",world);
sendMessage(message.replace("{chunks}","")); // made {chunks} blank as I removed the placeholder and people wont update their config :shrug:
for (String world : chunkMap.keySet()) {
String message = TL.COMMAND_SHOWCLAIMS_FORMAT.toString().replace("{world}", world);
sendMessage(message.replace("{chunks}", "")); // made {chunks} blank as I removed the placeholder and people wont update their config :shrug:
StringBuilder chunks = new StringBuilder("");
for (String chunkString : chunkMap.get(world)){
for (String chunkString : chunkMap.get(world)) {
chunks.append(chunkString + ", ");
if (chunks.toString().length() >= 2000 ) {
if (chunks.toString().length() >= 2000) {
sendMessage(chunks.toString());
chunks.setLength(0);
}
@@ -54,10 +47,6 @@ public class CmdShowClaims extends FCommand{
}
}
@Override

View File

@@ -6,10 +6,8 @@ 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 org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Dispenser;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
@@ -18,7 +16,7 @@ import org.bukkit.inventory.PlayerInventory;
public class CmdTntFill extends FCommand {
public CmdTntFill(){
public CmdTntFill() {
super();
this.aliases.add("tntfill");
@@ -35,23 +33,22 @@ public class CmdTntFill extends FCommand {
}
@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);
int radius = argAsInt(0,16);
int amount = argAsInt(1,16);
if (radius > P.p.getConfig().getInt("Tntfill.max-radius")){
msg(TL.COMMAND_TNTFILL_RADIUSMAX.toString().replace("{max}",P.p.getConfig().getInt("Tntfill.max-radius") + ""));
int radius = argAsInt(0, 16);
int amount = argAsInt(1, 16);
if (radius > P.p.getConfig().getInt("Tntfill.max-radius")) {
msg(TL.COMMAND_TNTFILL_RADIUSMAX.toString().replace("{max}", P.p.getConfig().getInt("Tntfill.max-radius") + ""));
return;
}
if (amount > P.p.getConfig().getInt("Tntfill.max-amount")){
msg(TL.COMMAND_TNTFILL_AMOUNTMAX.toString().replace("{max}",P.p.getConfig().getInt("Tntfill.max-amount") + ""));
if (amount > P.p.getConfig().getInt("Tntfill.max-amount")) {
msg(TL.COMMAND_TNTFILL_AMOUNTMAX.toString().replace("{max}", P.p.getConfig().getInt("Tntfill.max-amount") + ""));
return;
}
int testNumber = -1;
@@ -72,61 +69,58 @@ public class CmdTntFill extends FCommand {
for (double y = start.getY() - radius; y <= start.getY() + radius; y++) {
for (double z = start.getZ() - radius; z <= start.getZ() + radius; z++) {
Location blockLoc = new Location(start.getWorld(), x, y, z);
if (blockLoc.getBlock().getState() instanceof Dispenser){
Dispenser disp = (Dispenser) blockLoc.getBlock().getState();
Inventory dispenser = disp.getInventory();
if (canHold(dispenser,amount)){
int fullStacks = amount / 64;
int remainderAmt = amount % 64;
if (!inventoryContains(me.getInventory(), new ItemStack(Material.TNT,amount))){
if (!fme.getRole().isAtLeast(Role.MODERATOR)){
if (blockLoc.getBlock().getState() instanceof Dispenser) {
Dispenser disp = (Dispenser) blockLoc.getBlock().getState();
Inventory dispenser = disp.getInventory();
if (canHold(dispenser, amount)) {
int fullStacks = amount / 64;
int remainderAmt = amount % 64;
if (!inventoryContains(me.getInventory(), new ItemStack(Material.TNT, amount))) {
if (!fme.getRole().isAtLeast(Role.MODERATOR)) {
msg(TL.COMMAND_TNTFILL_NOTENOUGH);
sendMessage(TL.COMMAND_TNTFILL_SUCCESS.toString().replace("{amount}", amount + "").replace("{dispensers}", counter + ""));
me.updateInventory();
return;
} else if (bankMode) {
//msg(TL.COMMAND_TNTFILL_MOD.toString().replace("{role}",fme.getRole().nicename));
bankMode = true;
removeFromBank(amount);
if (!inventoryContains(me.getInventory(), new ItemStack(Material.TNT, amount))) {
msg(TL.COMMAND_TNTFILL_NOTENOUGH);
sendMessage(TL.COMMAND_TNTFILL_SUCCESS.toString().replace("{amount}",amount + "").replace("{dispensers}",counter+ ""));
sendMessage(TL.COMMAND_TNTFILL_SUCCESS.toString().replace("{amount}", amount + "").replace("{dispensers}", counter + ""));
me.updateInventory();
return;
} else if (bankMode){
//msg(TL.COMMAND_TNTFILL_MOD.toString().replace("{role}",fme.getRole().nicename));
bankMode = true;
removeFromBank(amount);
if (!inventoryContains(me.getInventory(), new ItemStack(Material.TNT,amount))){
msg(TL.COMMAND_TNTFILL_NOTENOUGH);
sendMessage(TL.COMMAND_TNTFILL_SUCCESS.toString().replace("{amount}",amount + "").replace("{dispensers}",counter+ ""));
me.updateInventory();
return;
}
}
}
ItemStack tnt64 = new ItemStack(Material.TNT, 64);
for (int i = 0; i <= fullStacks - 1; i++) {
dispenser.addItem(tnt64);
takeTnt(64);
}
if (remainderAmt != 0) {
ItemStack tnt = new ItemStack(Material.TNT, remainderAmt);
dispenser.addItem(tnt);
takeTnt(remainderAmt);
}
//sendMessage(TL.COMMAND_TNTFILL_SUCCESS.toString().replace("{amount}",amount + "").replace("{x}",(int) x + "").replace("{y}",(int) y + "").replace("{z}",(int) z + ""));
counter++;
}
ItemStack tnt64 = new ItemStack(Material.TNT, 64);
for (int i = 0; i <= fullStacks - 1; i++) {
dispenser.addItem(tnt64);
takeTnt(64);
}
if (remainderAmt != 0) {
ItemStack tnt = new ItemStack(Material.TNT, remainderAmt);
dispenser.addItem(tnt);
takeTnt(remainderAmt);
}
//sendMessage(TL.COMMAND_TNTFILL_SUCCESS.toString().replace("{amount}",amount + "").replace("{x}",(int) x + "").replace("{y}",(int) y + "").replace("{z}",(int) z + ""));
counter++;
}
}
}
}
}
if (bankMode) {
msg(TL.COMMAND_TNTFILL_MOD.toString().replace("{role}",fme.getRole().nicename));
msg(TL.COMMAND_TNTFILL_MOD.toString().replace("{role}", fme.getRole().nicename));
}
sendMessage(TL.COMMAND_TNTFILL_SUCCESS.toString().replace("{amount}",amount + "").replace("{dispensers}",counter+ ""));
sendMessage(TL.COMMAND_TNTFILL_SUCCESS.toString().replace("{amount}", amount + "").replace("{dispensers}", counter + ""));
me.updateInventory();
}
private void removeFromBank(int amount){
private void removeFromBank(int amount) {
int testNumber = -1;
try {
testNumber = Integer.parseInt(args.get(1));
@@ -164,7 +158,7 @@ public class CmdTntFill extends FCommand {
me.updateInventory();
}
public void takeTnt(int amount){
public void takeTnt(int amount) {
Inventory inv = me.getInventory();
int invTnt = 0;
for (int i = 0; i <= inv.getSize(); i++) {
@@ -187,7 +181,7 @@ public class CmdTntFill extends FCommand {
removeFromInventory(me.getInventory(), tnt);
}
public boolean canHold(Inventory inventory, int amount){
public boolean canHold(Inventory inventory, int amount) {
int fullStacks = amount / 64;
int remainderAmt = amount % 64;
if ((remainderAmt == 0 && getEmptySlots(me) <= fullStacks)) {

View File

@@ -49,8 +49,8 @@ public class CmdUnclaim extends FCommand {
}
new SpiralTask(new FLocation(me), radius) {
private int failCount = 0;
private final int limit = Conf.radiusClaimFailureLimit - 1;
private int failCount = 0;
@Override
public boolean work() {

View File

@@ -1,25 +1,15 @@
package com.massivecraft.factions.cmd;
import com.drtshock.playervaults.PlayerVaults;
import com.drtshock.playervaults.translations.Lang;
import com.drtshock.playervaults.vaultmanagement.UUIDVaultManager;
import com.drtshock.playervaults.vaultmanagement.VaultOperations;
import com.drtshock.playervaults.vaultmanagement.VaultViewInfo;
import com.massivecraft.factions.Board;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.FLocation;
import com.massivecraft.factions.P;
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 org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Chest;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.inventory.Inventory;
public class CmdVault extends FCommand {
@@ -39,45 +29,44 @@ public class CmdVault extends FCommand {
senderMustBeAdmin = false;
}
@Override
@Override
public void perform() {
if (!P.p.getConfig().getBoolean("fvault.Enabled")){
if (!P.p.getConfig().getBoolean("fvault.Enabled")) {
fme.sendMessage("This command is disabled!");
return;
}
Access access = fme.getFaction().getAccess(fme, PermissableAction.VAULT);
Access access = fme.getFaction().getAccess(fme, PermissableAction.VAULT);
if (access.equals(Access.DENY)) {
fme.msg(TL.GENERIC_NOPERMISSION, "vault");
return;
}
if (fme.isInVault()){
if (fme.isInVault()) {
me.closeInventory();
return;
}
fme.setInVault(true);
Location vaultLocation = fme.getFaction().getVault();
if (vaultLocation == null){
if (vaultLocation == null) {
fme.msg(TL.COMMAND_VAULT_INVALID);
return;
}
FLocation vaultFLocation = new FLocation(vaultLocation);
if (Board.getInstance().getFactionAt(vaultFLocation) != fme.getFaction()){
FLocation vaultFLocation = new FLocation(vaultLocation);
if (Board.getInstance().getFactionAt(vaultFLocation) != fme.getFaction()) {
fme.getFaction().setVault(null);
fme.msg(TL.COMMAND_VAULT_INVALID);
return;
}
if (vaultLocation.getBlock().getType() != Material.CHEST){
if (vaultLocation.getBlock().getType() != Material.CHEST) {
fme.getFaction().setVault(null);
fme.msg(TL.COMMAND_VAULT_INVALID);
return;
}
Chest chest = (Chest) vaultLocation.getBlock().getState();
Inventory chestInv = chest.getBlockInventory();
fme.msg(TL.COMMAND_VAULT_OPENING);
me.openInventory(chestInv);
Chest chest = (Chest) vaultLocation.getBlock().getState();
Inventory chestInv = chest.getBlockInventory();
fme.msg(TL.COMMAND_VAULT_OPENING);
me.openInventory(chestInv);
}

View File

@@ -213,7 +213,7 @@ public class FCmdRoot extends FCommand {
this.addSubCommand(this.cmdSetBanner);
if (Bukkit.getServer().getPluginManager().getPlugin("CoreProtect") != null){
if (Bukkit.getServer().getPluginManager().getPlugin("CoreProtect") != null) {
P.p.log("Found CoreProtect, enabling Inspect");
this.addSubCommand(this.cmdInspect);
} else {
@@ -231,10 +231,10 @@ public class FCmdRoot extends FCommand {
}
if (P.p.isHookedPlayervaults()) {
P.p.log("Found playervaults hook, adding /f vault and /f setmaxvault commands.");
// this.addSubCommand(new CmdSetMaxVaults());
// this.addSubCommand(new CmdVault());
}else{
// this.addSubCommand(new CmdVault());
// this.addSubCommand(new CmdSetMaxVaults());
// this.addSubCommand(new CmdVault());
} else {
// this.addSubCommand(new CmdVault());
}
}

View File

@@ -100,7 +100,7 @@ public abstract class FCommand extends MCommand<P> {
return false;
}
if (this.senderMustBeColeader && !fme.getRole().isAtLeast(Role.COLEADER)){
if (this.senderMustBeColeader && !fme.getRole().isAtLeast(Role.COLEADER)) {
sender.sendMessage(p.txt.parse("<b>Only faction coleaders can %s.", this.getHelpShort()));
return false;
}
@@ -111,7 +111,6 @@ public abstract class FCommand extends MCommand<P> {
}
return true;
}
@@ -266,14 +265,11 @@ public abstract class FCommand extends MCommand<P> {
return true;
}
if (you.getRole().equals(Role.ADMIN))
{
if (you.getRole().equals(Role.ADMIN)) {
i.sendMessage(p.txt.parse("<b>Only the faction admin can do that."));
}
else if ((you.getRole().equals(Role.COLEADER)))
{
if (i == you){
} else if ((you.getRole().equals(Role.COLEADER))) {
if (i == you) {
return true;
} else {
i.sendMessage(p.txt.parse("<b>Coleaders can't control each other..."));