Protection, Placeholder and fix

Add :
- PlaceHolder %faction_name_at_location%
- Add protection with farm land
- Add protection to shulkers, to beacon, cauldron and brewing stand
- Add protection with bone meal
- Convert permission for the command

Fix :
- Console /f list
- Console /f show
- Claim with Wilderness is unclaim the land
- Dynmap players.admins and players.admins.count is for co-leader. The leader already have players.leader and a faction have one leader only

Optimization
This commit is contained in:
GenialJerome
2019-01-27 03:41:25 +01:00
parent 7b55a80744
commit 69207ac898
25 changed files with 213 additions and 167 deletions

View File

@@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.FLocation;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.SavageFactions;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Role;
import com.massivecraft.factions.util.SpiralTask;
@@ -24,8 +25,7 @@ public class CmdClaim extends FCommand {
this.permission = Permission.CLAIM.node;
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
@@ -46,6 +46,12 @@ public class CmdClaim extends FCommand {
}
}
if (forFaction.isWilderness())
{
CmdUnclaim cmdUnclaim = SavageFactions.plugin.cmdBase.cmdUnclaim;
cmdUnclaim.execute(sender, args.size() > 1 ? args.subList(0, 1):args);
return;
}
if (radius < 1) {
msg(TL.COMMAND_CLAIM_INVALIDRADIUS);

View File

@@ -2,6 +2,7 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.Conf.Backend;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.persist.json.FactionsJSON;
import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.command.ConsoleCommandSender;
@@ -11,6 +12,8 @@ public class CmdConvert extends FCommand {
public CmdConvert() {
this.aliases.add("convert");
this.permission = Permission.CONVERT.node;
this.requiredArgs.add("[MYSQL|JSON]");
}

View File

@@ -31,8 +31,7 @@ public class CmdList extends FCommand {
this.permission = Permission.LIST.node;
this.disableOnLock = false;
senderMustBePlayer = false;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
@@ -42,9 +41,8 @@ public class CmdList extends FCommand {
@Override
public void perform() {
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostList, "to list the factions", "for listing the factions")) {
if (!payForCommand(Conf.econCostList, "to list the factions", "for listing the factions"))
return;
}
ArrayList<Faction> factionList = Factions.getInstance().getAllFactions();
factionList.remove(Factions.getInstance().getWilderness());
@@ -52,14 +50,14 @@ public class CmdList extends FCommand {
factionList.remove(Factions.getInstance().getWarZone());
// remove exempt factions
if (!fme.getPlayer().hasPermission("factions.show.bypassexempt")) {
if (fme != null && fme.getPlayer() != null && !fme.getPlayer().hasPermission("factions.show.bypassexempt")) {
List<String> exemptFactions = SavageFactions.plugin.getConfig().getStringList("show-exempt");
Iterator<Faction> factionIterator = factionList.iterator();
while (factionIterator.hasNext()) {
Faction next = factionIterator.next();
if (exemptFactions.contains(next.getTag())) {
if (exemptFactions.contains(next.getTag()))
factionIterator.remove();
}
}
}

View File

@@ -19,7 +19,7 @@ public class CmdOwner extends FCommand {
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
@@ -63,7 +63,6 @@ public class CmdOwner extends FCommand {
fme.msg(TL.COMMAND_OWNER_WRONGFACTION);
return;
}
}
FPlayer target = this.argAsBestFPlayerMatch(0, fme);

View File

@@ -10,10 +10,8 @@ import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.*;
import org.bukkit.entity.Player;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
public class CmdSeeChunk extends FCommand {
@@ -117,7 +115,6 @@ public class CmdSeeChunk extends FCommand {
}
private void showPillar(Player player, World world, int blockX, int blockZ) {
List<Player> onePlayer = Arrays.asList(player);
for (int blockY = 0; blockY < player.getLocation().getBlockY() + 30; blockY++) {
Location loc = new Location(world, blockX, blockY, blockZ).add(0.5, 0, 0.5);
if (loc.getBlock().getType() != Material.AIR) {

View File

@@ -47,12 +47,11 @@ public class CmdShow extends FCommand {
@Override
public void perform() {
Faction faction = myFaction;
if (this.argIsSet(0)) {
if (this.argIsSet(0))
faction = this.argAsFaction(0);
}
if (faction == null) {
if (faction == null)
return;
}
if (fme != null && !fme.getPlayer().hasPermission("factions.show.bypassexempt")
&& SavageFactions.plugin.getConfig().getStringList("show-exempt").contains(faction.getTag())) {
@@ -66,9 +65,8 @@ public class CmdShow extends FCommand {
}
List<String> show = SavageFactions.plugin.getConfig().getStringList("show");
if (show == null || show.isEmpty()) {
if (show == null || show.isEmpty())
show = defaults;
}
if (!faction.isNormal()) {
String tag = faction.getTag(fme);
@@ -92,11 +90,11 @@ public class CmdShow extends FCommand {
parsed = TagUtil.parsePlaceholders(fme.getPlayer(), parsed);
}
if (fme != null && TagUtil.hasFancy(parsed)) {
if (TagUtil.hasFancy(parsed)) {
List<FancyMessage> fancy = TagUtil.parseFancy(faction, fme, parsed);
if (fancy != null) {
if (fancy != null)
sendFancyMessage(fancy);
}
continue;
}
if (!parsed.contains("{notFrozen}") && !parsed.contains("{notPermanent}")) {

View File

@@ -30,7 +30,7 @@ public class CmdTpBanner extends FCommand {
return;
}
final FactionsPlayerListener fpl = new FactionsPlayerListener(SavageFactions.plugin);
final FactionsPlayerListener fpl = new FactionsPlayerListener();
if (FactionsBlockListener.bannerLocations.containsKey(fme.getTag())) {
fme.msg(TL.COMMAND_TPBANNER_SUCCESS);

View File

@@ -18,7 +18,6 @@ public class CmdUnclaim extends FCommand {
this.aliases.add("declaim");
this.optionalArgs.put("radius", "1");
this.optionalArgs.put("faction", "your");
this.permission = Permission.UNCLAIM.node;
this.disableOnLock = true;
@@ -27,14 +26,12 @@ public class CmdUnclaim extends FCommand {
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
// Read and validate input
int radius = this.argAsInt(0, 1); // Default to 1
final Faction forFaction = this.argAsFaction(1, myFaction); // Default to own
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.TERRITORY);