Bigger /f map

Add /f mapheight <height> command to allow players to set their mapheight.
Increase default map height and width to be in line with larger values servers want
This commit is contained in:
Trent Hensler 2018-02-10 16:20:13 -08:00
parent 3c4168a1dd
commit 50930d7583
9 changed files with 67 additions and 4 deletions

View File

@ -364,8 +364,9 @@ public class Conf {
public static Backend backEnd = Backend.JSON;
public static transient int mapHeight = 8;
public static transient int mapWidth = 39;
// Taller and wider for "bigger f map"
public static transient int mapHeight = 17;
public static transient int mapWidth = 49;
public static transient char[] mapKeyChrs = "\\/#$%=&^ABCDEFGHJKLMNOPQRSTUVWXYZ1234567890abcdeghjmnopqrsuvwxyz?".toCharArray();
static {

View File

@ -244,6 +244,9 @@ public interface FPlayer extends EconomyParticipator {
public void sendFancyMessage(List<FancyMessage> message);
public int getMapHeight();
public void setMapHeight(int height);
public boolean isOnlineAndVisibleTo(Player me);

View File

@ -0,0 +1,39 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
public class CmdMapHeight extends FCommand {
public CmdMapHeight() {
super();
this.aliases.add("mapheight");
this.aliases.add("mh");
this.requiredArgs.add("height");
this.permission = Permission.MAPHEIGHT.node;
this.senderMustBePlayer = true;
}
@Override
public void perform() {
int height = argAsInt(0, -1);
if (height == -1) {
fme.sendMessage(TL.COMMAND_MAPHEIGHT_DESCRIPTION.toString());
return;
}
fme.setMapHeight(height);
fme.sendMessage(TL.COMMAND_MAPHEIGHT_SET.format(height));
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_MAPHEIGHT_DESCRIPTION;
}
}

View File

@ -74,6 +74,7 @@ public class FCmdRoot extends FCommand {
public CmdPromote cmdPromote = new CmdPromote();
public CmdDemote cmdDemote = new CmdDemote();
public CmdSetDefaultRole cmdSetDefaultRole = new CmdSetDefaultRole();
public CmdMapHeight cmdMapHeight = new CmdMapHeight();
public FCmdRoot() {
super();
@ -162,6 +163,7 @@ public class FCmdRoot extends FCommand {
this.addSubCommand(this.cmdPromote);
this.addSubCommand(this.cmdDemote);
this.addSubCommand(this.cmdSetDefaultRole);
this.addSubCommand(this.cmdMapHeight);
if (P.p.isHookedPlayervaults()) {
P.p.log("Found playervaults hook, adding /f vault and /f setmaxvault commands.");
this.addSubCommand(new CmdSetMaxVaults());

View File

@ -38,6 +38,7 @@ public enum Permission {
LIST("list"),
LOCK("lock"),
MAP("map"),
MAPHEIGHT("mapheight"),
MOD("mod"),
MOD_ANY("mod.any"),
MODIFY_POWER("modifypower"),

View File

@ -259,7 +259,8 @@ public abstract class MemoryBoard extends Board {
ret.add(new FancyMessage(asciiCompass.get(2)));
int halfWidth = Conf.mapWidth / 2;
int halfHeight = Conf.mapHeight / 2;
// Use player's value for height
int halfHeight = fplayer.getMapHeight() / 2;
FLocation topLeft = flocation.getRelative(-halfWidth, -halfHeight);
int width = halfWidth * 2 + 1;
int height = halfHeight * 2 + 1;

View File

@ -59,6 +59,7 @@ public abstract class MemoryFPlayer implements FPlayer {
protected boolean isAdminBypassing = false;
protected int kills, deaths;
protected boolean willAutoLeave = true;
protected int mapHeight;
protected transient FLocation lastStoodAt = new FLocation(); // Where did this player stand the last time we checked?
protected transient boolean mapAutoUpdating;
@ -243,6 +244,7 @@ public abstract class MemoryFPlayer implements FPlayer {
this.showScoreboard = P.p.getConfig().getBoolean("scoreboard.default-enabled", false);
this.kills = 0;
this.deaths = 0;
this.mapHeight = Conf.mapHeight;
if (!Conf.newPlayerStartingFactionID.equals("0") && Factions.getInstance().isValidFactionId(Conf.newPlayerStartingFactionID)) {
this.factionId = Conf.newPlayerStartingFactionID;
@ -269,6 +271,7 @@ public abstract class MemoryFPlayer implements FPlayer {
this.showScoreboard = P.p.getConfig().getBoolean("scoreboard.default-enabled", true);
this.kills = other.kills;
this.deaths = other.deaths;
this.mapHeight = Conf.mapHeight;
}
public void resetFactionData(boolean doSpoutUpdate) {
@ -913,6 +916,13 @@ public abstract class MemoryFPlayer implements FPlayer {
}
}
public int getMapHeight() {
return this.mapHeight;
}
public void setMapHeight(int height) {
this.mapHeight = height;
}
public String getNameAndTitle(FPlayer fplayer) {
return this.getColorTo(fplayer) + this.getNameAndTitle();

View File

@ -295,6 +295,9 @@ public enum TL {
COMMAND_MAP_UPDATE_DISABLED("<i>Map auto update <red>DISABLED."),
COMMAND_MAP_DESCRIPTION("Show the territory map, and set optional auto update"),
COMMAND_MAPHEIGHT_DESCRIPTION("Update the lines that /f map sends"),
COMMAND_MAPHEIGHT_SET("Set /f map lines to %1$d"),
COMMAND_MOD_CANDIDATES("Players you can promote: "),
COMMAND_MOD_CLICKTOPROMOTE("Click to promote "),
COMMAND_MOD_NOTMEMBER("%1$s<b> is not a member in your faction."),

View File

@ -99,6 +99,7 @@ permissions:
factions.top: true
factions.togglealliancechat: true
factions.vault: true
factions.mapheight: true
factions.admin:
description: hand over your admin rights
factions.admin.any:
@ -273,4 +274,6 @@ permissions:
factions.vault:
description: Access faction vault.
factions.setmaxvault:
description: Set a faction's max vaults.
description: Set a faction's max vaults.
factions.mapheight:
description: Set your /f map height.