Clickable f map
* New command /f claimat world x z * Permission: factions.claimat * Permission is not included in factions.halfplayer or anything for now. Will need to be granted manually. * If players don't have factions.claimat, they won't see the clickable f map
This commit is contained in:
parent
2262737a3f
commit
f29efa116d
@ -226,8 +226,12 @@ public interface FPlayer extends EconomyParticipator {
|
||||
|
||||
public boolean canClaimForFactionAtLocation(Faction forFaction, Location location, boolean notifyFailure);
|
||||
|
||||
public boolean canClaimForFactionAtLocation(Faction forFaction, FLocation location, boolean notifyFailure);
|
||||
|
||||
public boolean attemptClaim(Faction forFaction, Location location, boolean notifyFailure);
|
||||
|
||||
public boolean attemptClaim(Faction forFaction, FLocation location, boolean notifyFailure);
|
||||
|
||||
public void msg(String str, Object... args);
|
||||
|
||||
public String getId();
|
||||
|
38
src/main/java/com/massivecraft/factions/cmd/CmdClaimAt.java
Normal file
38
src/main/java/com/massivecraft/factions/cmd/CmdClaimAt.java
Normal file
@ -0,0 +1,38 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.FLocation;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
|
||||
public class CmdClaimAt extends FCommand {
|
||||
|
||||
public CmdClaimAt() {
|
||||
super();
|
||||
this.aliases.add("claimat");
|
||||
|
||||
this.requiredArgs.add("world");
|
||||
this.requiredArgs.add("x");
|
||||
this.requiredArgs.add("z");
|
||||
|
||||
this.permission = Permission.CLAIMAT.node;
|
||||
this.disableOnLock = true;
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = true;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
int x = argAsInt(1);
|
||||
int z = argAsInt(2);
|
||||
FLocation location = new FLocation(argAsString(0), x, z);
|
||||
fme.attemptClaim(myFaction, location, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
return null;
|
||||
}
|
||||
}
|
@ -59,7 +59,15 @@ public class CmdInvite extends FCommand {
|
||||
}
|
||||
|
||||
// Tooltips, colors, and commands only apply to the string immediately before it.
|
||||
FancyMessage message = new FancyMessage(fme.describeTo(you, true)).tooltip(TL.COMMAND_INVITE_CLICKTOJOIN.toString()).command("/" + Conf.baseCommandAliases.get(0) + " join " + myFaction.getTag()).then(TL.COMMAND_INVITE_INVITEDYOU.toString()).color(ChatColor.YELLOW).tooltip(TL.COMMAND_INVITE_CLICKTOJOIN.toString()).command("/" + Conf.baseCommandAliases.get(0) + " join " + myFaction.getTag()).then(myFaction.describeTo(you)).tooltip(TL.COMMAND_INVITE_CLICKTOJOIN.toString()).command("/" + Conf.baseCommandAliases.get(0) + " join " + myFaction.getTag());
|
||||
FancyMessage message = new FancyMessage(fme.describeTo(you, true))
|
||||
.tooltip(TL.COMMAND_INVITE_CLICKTOJOIN.toString())
|
||||
.command("/" + Conf.baseCommandAliases.get(0) + " join " + myFaction.getTag())
|
||||
.then(TL.COMMAND_INVITE_INVITEDYOU.toString())
|
||||
.color(ChatColor.YELLOW)
|
||||
.tooltip(TL.COMMAND_INVITE_CLICKTOJOIN.toString())
|
||||
.command("/" + Conf.baseCommandAliases.get(0) + " join " + myFaction.getTag())
|
||||
.then(myFaction.describeTo(you)).tooltip(TL.COMMAND_INVITE_CLICKTOJOIN.toString())
|
||||
.command("/" + Conf.baseCommandAliases.get(0) + " join " + myFaction.getTag());
|
||||
|
||||
message.send(you.getPlayer());
|
||||
|
||||
|
@ -75,6 +75,7 @@ public class FCmdRoot extends FCommand {
|
||||
public CmdDemote cmdDemote = new CmdDemote();
|
||||
public CmdSetDefaultRole cmdSetDefaultRole = new CmdSetDefaultRole();
|
||||
public CmdMapHeight cmdMapHeight = new CmdMapHeight();
|
||||
public CmdClaimAt cmdClaimAt = new CmdClaimAt();
|
||||
|
||||
public FCmdRoot() {
|
||||
super();
|
||||
@ -164,6 +165,7 @@ public class FCmdRoot extends FCommand {
|
||||
this.addSubCommand(this.cmdDemote);
|
||||
this.addSubCommand(this.cmdSetDefaultRole);
|
||||
this.addSubCommand(this.cmdMapHeight);
|
||||
this.addSubCommand(this.cmdClaimAt);
|
||||
if (P.p.isHookedPlayervaults()) {
|
||||
P.p.log("Found playervaults hook, adding /f vault and /f setmaxvault commands.");
|
||||
this.addSubCommand(new CmdSetMaxVaults());
|
||||
|
@ -17,6 +17,7 @@ public enum Permission {
|
||||
CHAT("chat"),
|
||||
CHATSPY("chatspy"),
|
||||
CLAIM("claim"),
|
||||
CLAIMAT("claimat"),
|
||||
CLAIM_LINE("claim.line"),
|
||||
CLAIM_RADIUS("claim.radius"),
|
||||
CONFIG("config"),
|
||||
|
@ -3,6 +3,7 @@ package com.massivecraft.factions.zcore.persist;
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.massivecraft.factions.*;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Relation;
|
||||
import com.massivecraft.factions.util.AsciiCompass;
|
||||
import com.massivecraft.factions.util.LazyLocation;
|
||||
@ -277,13 +278,18 @@ public abstract class MemoryBoard extends Board {
|
||||
}
|
||||
for (int dx = (dz < 3 ? 6 : 3); dx < width; dx++) {
|
||||
if (dx == halfWidth && dz == halfHeight) {
|
||||
row.then("+").color(ChatColor.AQUA);
|
||||
row.then("+").color(ChatColor.AQUA).tooltip(TL.CLAIM_YOUAREHERE.toString());
|
||||
} else {
|
||||
FLocation flocationHere = topLeft.getRelative(dx, dz);
|
||||
Faction factionHere = getFactionAt(flocationHere);
|
||||
Relation relation = fplayer.getRelationTo(factionHere);
|
||||
if (factionHere.isWilderness()) {
|
||||
row.then("-").color(ChatColor.GRAY);
|
||||
row.then("-") .color(ChatColor.GRAY);
|
||||
// Check for claimat position and if so, let them claim at ;D
|
||||
if (fplayer.getPlayer().hasPermission(Permission.CLAIMAT.node)) {
|
||||
row.tooltip(TL.CLAIM_CLICK_TO_CLAIM.format(dx, dz))
|
||||
.command(String.format("/f claimat %s %d %d", flocation.getWorldName(), dx, dz));
|
||||
}
|
||||
} else if (factionHere.isSafeZone()) {
|
||||
row.then("+").color(Conf.colorPeaceful);
|
||||
} else if (factionHere.isWarZone()) {
|
||||
|
@ -691,9 +691,7 @@ public abstract class MemoryFPlayer implements FPlayer {
|
||||
}
|
||||
|
||||
public boolean canClaimForFactionAtLocation(Faction forFaction, Location location, boolean notifyFailure) {
|
||||
FLocation flocation = new FLocation(location);
|
||||
|
||||
return canClaimForFactionAtLocation(forFaction, flocation, notifyFailure);
|
||||
return canClaimForFactionAtLocation(forFaction, new FLocation(location), notifyFailure);
|
||||
}
|
||||
|
||||
public boolean canClaimForFactionAtLocation(Faction forFaction, FLocation flocation, boolean notifyFailure) {
|
||||
@ -771,15 +769,18 @@ public abstract class MemoryFPlayer implements FPlayer {
|
||||
}
|
||||
|
||||
public boolean attemptClaim(Faction forFaction, Location location, boolean notifyFailure) {
|
||||
return attemptClaim(forFaction, new FLocation(location), notifyFailure);
|
||||
}
|
||||
|
||||
public boolean attemptClaim(Faction forFaction, FLocation flocation, boolean notifyFailure) {
|
||||
// notifyFailure is false if called by auto-claim; no need to notify on every failure for it
|
||||
// return value is false on failure, true on success
|
||||
|
||||
FLocation flocation = new FLocation(location);
|
||||
Faction currentFaction = Board.getInstance().getFactionAt(flocation);
|
||||
|
||||
int ownedLand = forFaction.getLandRounded();
|
||||
|
||||
if (!this.canClaimForFactionAtLocation(forFaction, location, notifyFailure)) {
|
||||
if (!this.canClaimForFactionAtLocation(forFaction, flocation, notifyFailure)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -602,6 +602,9 @@ public enum TL {
|
||||
CLAIM_TOOCLOSETOOTHERFACTION("<i>Your claim is too close to another Faction. Buffer required is %d"),
|
||||
CLAIM_OUTSIDEWORLDBORDER("<i>Your claim is outside the border."),
|
||||
CLAIM_OUTSIDEBORDERBUFFER("<i>Your claim is outside the border. %d chunks away world edge required."),
|
||||
CLAIM_CLICK_TO_CLAIM("Click to try to claim &2(%1$d, %2$d)"),
|
||||
CLAIM_YOUAREHERE("You are here"),
|
||||
|
||||
/**
|
||||
* More generic, or less easily categorisable translations, which may apply to more than one class
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user