Compare commits

..

11 Commits

Author SHA1 Message Date
Driftay
7b07e3ed23 Version 2.1.0 Implemented 2019-11-29 12:13:46 -05:00
Driftay
c0719ec4f5 Reverted final persistence 2019-11-29 05:12:07 -05:00
Driftay
c9fd86ef9e Merge remote-tracking branch 'origin/1.6.x' into 1.6.x 2019-11-29 04:59:20 -05:00
Driftay
939a60c611 Bunch of Econ, Lang.yml Additions 2019-11-29 04:58:59 -05:00
DroppingAnvil
36f22262c6 Added the ability to toggle titles when entering claims of a different faction
Signed-off-by: DroppingAnvil <dr0pping.4nvi1@gmail.com>
2019-11-28 19:34:39 -06:00
Driftay
f5e9ce3d90 Fly Changes, And Message Persistence 2019-11-28 02:09:21 -05:00
DroppingAnvil
e244b469aa Update Permission.java 2019-11-25 01:20:07 -06:00
Driftay
5f80ecfa76 Fixed Permissions And Removed Shield Code From Main Branch to Avoid pointless runnables 2019-11-24 22:37:31 -05:00
Driftay
28517ef391 More to Shields & Mission Class Cleanup 2019-11-23 22:33:49 -05:00
Driftay
5744b7e28e Version Change 2019-11-22 04:56:18 -05:00
Driftay
f3b0dcdb7f Quick Fix With Fly Check Console Spam & Properly Defined Variables In TL for TNT command 2019-11-22 04:55:58 -05:00
23 changed files with 202 additions and 95 deletions

View File

@@ -4,7 +4,7 @@
<groupId>com.massivecraft</groupId>
<artifactId>Factions</artifactId>
<version>1.6.9.5-U0.2.1-2.0.7-BETA</version>
<version>1.6.9.5-U0.2.1-2.1.0-BETA</version>
<packaging>jar</packaging>
<name>SaberFactions</name>
@@ -387,11 +387,6 @@
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.codemc.worldguardwrapper</groupId>
<artifactId>worldguardwrapper</artifactId>
<version>1.1.6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.jagrosh</groupId>
<artifactId>jda-utilities-commons</artifactId>

View File

@@ -115,6 +115,7 @@ public class Conf {
public static boolean logMoneyTransactions = true;
public static boolean logPlayerCommands = true;
// prevent some potential exploits
public static boolean denyFlightIfInNoClaimingWorld = false;
public static boolean preventCreeperGlitch = true;
public static boolean handleExploitObsidianGenerators = true;
public static boolean handleExploitEnderPearlClipping = true;
@@ -540,6 +541,10 @@ public class Conf {
defaultFactionPermissions.put("MODERATOR", new DefaultPermissions(true));
defaultFactionPermissions.put("NORMAL MEMBER", new DefaultPermissions(false));
defaultFactionPermissions.put("RECRUIT", new DefaultPermissions(false));
defaultFactionPermissions.put("ALLY", new DefaultPermissions(false));
defaultFactionPermissions.put("ENEMY", new DefaultPermissions(false));
defaultFactionPermissions.put("TRUCE", new DefaultPermissions(false));
defaultFactionPermissions.put("NEUTRAL", new DefaultPermissions(false));
}
public static void load() {

View File

@@ -30,6 +30,18 @@ public interface FPlayer extends EconomyParticipator {
boolean hasNotificationsEnabled();
/**
* Used to check if this player should be served titles
* @return if this FPlayer has titles enabled as a boolean
*/
boolean hasTitlesEnabled();
/**
* Used to set if player should be served titles
* @param b Boolean to titlesEnabled to
*/
void setTitlesEnabled(Boolean b);
/**
* Used to determine if a player is in their faction's chest
* @return if player is in their faction's as a boolean

View File

@@ -440,4 +440,5 @@ public interface Faction extends EconomyParticipator {
String getPaypal();
void paypalSet(String paypal);
}

View File

@@ -195,7 +195,7 @@ public class FactionsPlugin extends MPlugin {
return;
}
//Update their config if needed
Updater.updateIfNeeded(getConfig());
// Updater.updateIfNeeded(getConfig());
RegisteredServiceProvider<Economy> rsp = FactionsPlugin.this.getServer().getServicesManager().getRegistration(Economy.class);
FactionsPlugin.econ = rsp.getProvider();
com.massivecraft.factions.integration.Essentials.setup();
@@ -737,4 +737,8 @@ public class FactionsPlugin extends MPlugin {
public void debug(String s) {
debug(Level.INFO, s);
}
public Worldguard getWg() {
return wg;
}
}

View File

@@ -97,6 +97,9 @@ public class CmdFly extends FCommand {
}
public static boolean checkBypassPerms(FPlayer fme, Player me, Faction toFac) {
if (Conf.denyFlightIfInNoClaimingWorld && !Conf.worldsNoClaiming.isEmpty() && Conf.worldsNoClaiming.stream().anyMatch(me.getWorld().getName()::equalsIgnoreCase))
return false;
if (toFac != fme.getFaction()) {
if (!me.hasPermission(Permission.FLY_WILD.node) && toFac.isWilderness() || !me.hasPermission(Permission.FLY_SAFEZONE.node) && toFac.isSafeZone() || !me.hasPermission(Permission.FLY_WARZONE.node) && toFac.isWarZone()) {
fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme));
@@ -122,7 +125,7 @@ public class CmdFly extends FCommand {
}
return me.hasPermission(Permission.FLY.node) && (access != Access.DENY || toFac.isSystemFaction());
}
return fme.canFlyAtLocation();
return true;
}
@@ -182,7 +185,7 @@ public class CmdFly extends FCommand {
}
if (fme.canFlyAtLocation())
if (fme.canFlyAtLocation()) {
context.doWarmUp(WarmUpUtil.Warmup.FLIGHT, TL.WARMUPS_NOTIFY_FLIGHT, "Fly", () -> {
fme.setFlying(true);
flyMap.put(fme.getPlayer().getName(), true);
@@ -194,6 +197,9 @@ public class CmdFly extends FCommand {
startFlyCheck();
}
}, FactionsPlugin.getInstance().getConfig().getLong("warmups.f-fly", 0));
} else {
fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(fme.getLastStoodAt()).getTag());
}
}
@Override

View File

@@ -0,0 +1,21 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.FactionsPlugin;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
public class CmdPlayerTitleToggle extends FCommand {
public CmdPlayerTitleToggle() {
super();
this.aliases.add("titles");
this.requirements = new CommandRequirements.Builder(Permission.TOGGLE_TITLES)
.build();
}
@Override
public void perform(CommandContext context) {
context.fPlayer.setTitlesEnabled(!context.fPlayer.hasTitlesEnabled());
context.msg(TL.COMMAND_TITLETOGGLE_TOGGLED, context.fPlayer.hasTitlesEnabled() ? FactionsPlugin.getInstance().color("&dEnabled") : FactionsPlugin.getInstance().color("&dDisabled"));
}
@Override
public TL getUsageTranslation() {return TL.COMMAND_TITLETOGGLE_DESCRIPTION;}
}

View File

@@ -21,7 +21,7 @@ public class CmdUpgrades extends FCommand {
@Override
public void perform(CommandContext context) {
if (!FactionsPlugin.getInstance().getConfig().getBoolean("fupgrades.Enabled")) {
context.fPlayer.sendMessage("This command is disabled!");
context.fPlayer.msg(TL.COMMAND_UPGRADES_DISABLED);
return;
}
new FUpgradesGUI().openMainMenu(context.fPlayer);

View File

@@ -87,6 +87,7 @@ public class FCmdRoot extends FCommand implements CommandExecutor {
public CmdStuck cmdStuck = new CmdStuck();
public CmdTag cmdTag = new CmdTag();
public CmdTitle cmdTitle = new CmdTitle();
public CmdPlayerTitleToggle cmdPlayerTitleToggle = new CmdPlayerTitleToggle();
public CmdToggleAllianceChat cmdToggleAllianceChat = new CmdToggleAllianceChat();
public CmdUnclaim cmdUnclaim = new CmdUnclaim();
public CmdUnclaimall cmdUnclaimall = new CmdUnclaimall();
@@ -215,6 +216,7 @@ public class FCmdRoot extends FCommand implements CommandExecutor {
this.addSubCommand(this.cmdLogout);
this.addSubCommand(this.cmdTag);
this.addSubCommand(this.cmdTitle);
this.addSubCommand(this.cmdPlayerTitleToggle);
this.addSubCommand(this.cmdUnclaim);
this.addSubCommand(this.cmdUnclaimall);
this.addSubCommand(this.cmdVersion);

View File

@@ -17,7 +17,7 @@ public class CmdTnt extends FCommand {
public CmdTnt() {
super();
this.aliases.add("tnt");
this.optionalArgs.put("add/take", "");
this.optionalArgs.put("add/take/addall", "");
this.optionalArgs.put("amount", "number");
this.requirements = new CommandRequirements.Builder(Permission.TNT)
@@ -62,7 +62,7 @@ public class CmdTnt extends FCommand {
return;
}
ItemStack tnt = new ItemStack(Material.TNT, amount);
if (context.faction.getTnt() + amount > FactionsPlugin.instance.getConfig().getInt("ftnt.Bank-Limit")) {
if (context.faction.getTnt() + amount > context.faction.getTntBankLimit()) {
context.msg(TL.COMMAND_TNT_EXCEEDLIMIT);
return;
}
@@ -71,7 +71,7 @@ public class CmdTnt extends FCommand {
context.faction.addTnt(amount);
context.msg(TL.COMMAND_TNT_DEPOSIT_SUCCESS);
context.fPlayer.sendMessage(FactionsPlugin.instance.color(TL.COMMAND_TNT_AMOUNT.toString().replace("{amount}", context.fPlayer.getFaction().getTnt() + "")));
context.fPlayer.sendMessage(FactionsPlugin.instance.color(TL.COMMAND_TNT_AMOUNT.toString().replace("{amount}", context.faction.getTnt() + "").replace("{maxAmount}", context.faction.getTntBankLimit() + "")));
return;
}
@@ -91,7 +91,7 @@ public class CmdTnt extends FCommand {
context.msg(TL.COMMAND_TNT_WIDTHDRAW_NOTENOUGH_TNT.toString());
return;
}
int fullStacks = Math.round(amount / 64);
int fullStacks = amount / 64;
int remainderAmt = amount - (fullStacks * 64);
if ((remainderAmt == 0 && !hasAvaliableSlot(context.player, fullStacks))) {
context.msg(TL.COMMAND_TNT_WIDTHDRAW_NOTENOUGH_SPACE);
@@ -110,10 +110,35 @@ public class CmdTnt extends FCommand {
context.msg(TL.COMMAND_TNT_WIDTHDRAW_SUCCESS);
}
} else if (context.args.size() == 1) {
if (context.args.get(0).equalsIgnoreCase("addall")) {
Inventory inv = context.player.getInventory();
int invTnt = 0;
for (int i = 0; i <= inv.getSize(); i++) {
if (inv.getItem(i) == null) { continue; }
if (inv.getItem(i).getType() == Material.TNT) {
invTnt += inv.getItem(i).getAmount();
}
}
if (invTnt <= 0) {
context.msg(TL.COMMAND_TNT_DEPOSIT_NOTENOUGH);
return;
}
if (context.faction.getTnt() + invTnt > context.faction.getTntBankLimit()) {
context.msg(TL.COMMAND_TNT_EXCEEDLIMIT);
return;
}
removeItems(context.player.getInventory(), new ItemStack(Material.TNT), invTnt);
context.player.updateInventory();
context.faction.addTnt(invTnt);
context.msg(TL.COMMAND_TNT_DEPOSIT_SUCCESS);
context.fPlayer.sendMessage(FactionsPlugin.instance.color(TL.COMMAND_TNT_AMOUNT.toString().replace("{amount}", context.faction.getTnt() + "").replace("{maxAmount}", context.faction.getTntBankLimit() + "")));
return;
}
context.msg(TL.GENERIC_ARGS_TOOFEW);
context.msg(context.args.get(0).equalsIgnoreCase("take") || context.args.get(0).equalsIgnoreCase("t") ? TL.COMMAND_TNT_TAKE_DESCRIPTION : TL.COMMAND_TNT_ADD_DESCRIPTION);
}
context.sendMessage(TL.COMMAND_TNT_AMOUNT.toString().replace("{amount}", context.faction.getTnt() + ""));
context.sendMessage(TL.COMMAND_TNT_AMOUNT.toString().replace("{amount}", context.faction.getTnt() + "").replace("{maxAmount}", context.faction.getTntBankLimit() + ""));
}
@@ -141,6 +166,24 @@ public class CmdTnt extends FCommand {
return check >= howmany;
}
public static void removeItems(Inventory inventory, ItemStack item, int toRemove) {
if (toRemove <= 0 || inventory == null || item == null)
return;
for (int i = 0; i < inventory.getSize(); i++) {
ItemStack loopItem = inventory.getItem(i);
if (loopItem == null || !item.isSimilar(loopItem))
continue;
if (toRemove <= 0)
return;
if (toRemove < loopItem.getAmount()) {
loopItem.setAmount(loopItem.getAmount() - toRemove);
return;
}
inventory.clear(i);
toRemove -= loopItem.getAmount();
}
}
public void removeFromInventory(Inventory inventory, ItemStack item) {
int amt = item.getAmount();
ItemStack[] items = inventory.getContents();

View File

@@ -86,7 +86,7 @@ public class Econ {
FactionsPlugin.getInstance().log(Level.WARNING, "Vault does not appear to be hooked into an economy plugin.");
return;
}
to.sendMessage(String.format("%s's balance is %s.", about.getTag(), Econ.moneyString(econ.getBalance(about.getAccountId()))));
to.sendMessage(String.format(TL.ECON_PLAYERBALANCE.toString(), about.getTag(), Econ.moneyString(econ.getBalance(about.getAccountId()))));
}
public static boolean canIControllYou(EconomyParticipator i, EconomyParticipator you) {
@@ -126,7 +126,7 @@ public class Econ {
}
// Otherwise you may not!;,,;
i.msg("<h>%s<i> lacks permission to control <h>%s's<i> money.", i.describeTo(i, true), you.describeTo(i));
i.msg(TL.ECON_CANTCONTROLMONEY, i.describeTo(i, true), you.describeTo(i));
return false;
}
@@ -179,7 +179,7 @@ public class Econ {
if (!econ.has(fromAcc, amount)) {
// There was not enough money to pay
if (invoker != null && notify) {
invoker.msg("<h>%s<b> can't afford to transfer <h>%s<b> to %s<b>.", from.describeTo(invoker, true), moneyString(amount), to.describeTo(invoker));
invoker.msg(TL.COMMAND_MONEYTRANSFERFF_TRANSFERCANTAFFORD, from.describeTo(invoker, true), moneyString(amount), to.describeTo(invoker));
}
return false;
@@ -209,7 +209,7 @@ public class Econ {
// if we get here something with the transaction failed
if (notify) {
invoker.msg("Unable to transfer %s<b> to <h>%s<b> from <h>%s<b>.", moneyString(amount), to.describeTo(invoker), from.describeTo(invoker, true));
invoker.msg(TL.ECON_UNABLETOTRANSFER, moneyString(amount), to.describeTo(invoker), from.describeTo(invoker, true));
}
return false;
@@ -237,19 +237,19 @@ public class Econ {
if (invoker == null) {
for (FPlayer recipient : recipients) {
recipient.msg("<h>%s<i> was transferred from <h>%s<i> to <h>%s<i>.", moneyString(amount), from.describeTo(recipient), to.describeTo(recipient));
recipient.msg(TL.ECON_MONEYTRASFERREDFROM, moneyString(amount), from.describeTo(recipient), to.describeTo(recipient));
}
} else if (invoker == from) {
for (FPlayer recipient : recipients) {
recipient.msg("<h>%s<i> <h>gave %s<i> to <h>%s<i>.", from.describeTo(recipient, true), moneyString(amount), to.describeTo(recipient));
recipient.msg(TL.ECON_PERSONGAVEMONEYTO, from.describeTo(recipient, true), moneyString(amount), to.describeTo(recipient));
}
} else if (invoker == to) {
for (FPlayer recipient : recipients) {
recipient.msg("<h>%s<i> <h>took %s<i> from <h>%s<i>.", to.describeTo(recipient, true), moneyString(amount), from.describeTo(recipient));
recipient.msg(TL.ECON_PERSONTOOKMONEYFROM, to.describeTo(recipient, true), moneyString(amount), from.describeTo(recipient));
}
} else {
for (FPlayer recipient : recipients) {
recipient.msg("<h>%s<i> transferred <h>%s<i> from <h>%s<i> to <h>%s<i>.", invoker.describeTo(recipient, true), moneyString(amount), from.describeTo(recipient), to.describeTo(recipient));
recipient.msg(TL.ECON_MONEYTRASFERREDFROMPERSONTOPERSON, invoker.describeTo(recipient, true), moneyString(amount), from.describeTo(recipient), to.describeTo(recipient));
}
}
}
@@ -280,7 +280,7 @@ public class Econ {
if (!affordable) {
if (toDoThis != null && !toDoThis.isEmpty()) {
ep.msg("<h>%s<i> can't afford <h>%s<i> %s.", ep.describeTo(ep, true), moneyString(delta), toDoThis);
ep.msg(TL.COMMAND_MONEY_CANTAFFORD, ep.describeTo(ep, true), moneyString(delta), toDoThis);
}
return false;
}
@@ -318,13 +318,13 @@ public class Econ {
if (er.transactionSuccess()) {
modifyUniverseMoney(-delta);
if (forDoingThis != null && !forDoingThis.isEmpty()) {
ep.msg("<h>%s<i> gained <h>%s<i> %s.", You, moneyString(delta), forDoingThis);
ep.msg(TL.COMMAND_MONEY_GAINED, You, moneyString(delta), forDoingThis);
}
return true;
} else {
// transfer to account failed
if (forDoingThis != null && !forDoingThis.isEmpty()) {
ep.msg("<h>%s<i> would have gained <h>%s<i> %s, but the deposit failed.", You, moneyString(delta), forDoingThis);
ep.msg(TL.ECON_DEPOSITFAILED, You, moneyString(delta), forDoingThis);
}
return false;
}
@@ -336,13 +336,13 @@ public class Econ {
// There is enough money to pay
modifyUniverseMoney(-delta);
if (forDoingThis != null && !forDoingThis.isEmpty()) {
ep.msg("<h>%s<i> lost <h>%s<i> %s.", You, moneyString(-delta), forDoingThis);
ep.msg(TL.ECON_MONEYLOST, You, moneyString(-delta), forDoingThis);
}
return true;
} else {
// There was not enough money to pay
if (toDoThis != null && !toDoThis.isEmpty()) {
ep.msg("<h>%s<i> can't afford <h>%s<i> %s.", You, moneyString(-delta), toDoThis);
ep.msg(TL.ECON_CANTAFFORD, You, moneyString(-delta), toDoThis);
}
return false;
}

View File

@@ -80,7 +80,6 @@ public class FactionsBlockListener implements Listener {
boolean pain = !justCheck && myFaction.getAccess(me, PermissableAction.PAIN_BUILD) == Access.ALLOW;
return CheckActionState(myFaction, loc, me, PermissableAction.fromString(action), pain);
}
// Something failed prevent build
return false;
}
@@ -137,7 +136,6 @@ public class FactionsBlockListener implements Listener {
event.setCancelled(true);
return;
}
if (isSpawner) {
if (Conf.spawnerLock) {
event.setCancelled(true);

View File

@@ -553,9 +553,14 @@ public class FactionsPlayerListener implements Listener {
return string;
}
public void enableFly(FPlayer me) {
if (!FactionsPlugin.instance.getConfig().getBoolean("ffly.AutoEnable")) return; // Looks prettier sorry
if (!me.canFlyAtLocation()) return;
public void checkCanFly(FPlayer me) {
if (me.isFlying() && (!me.canFlyAtLocation() || me.checkIfNearbyEnemies())) {
me.setFFlying(false, false);
me.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(me.getLastStoodAt()).getTag());
return;
}
if (me.isFlying() || !FactionsPlugin.instance.getConfig().getBoolean("ffly.AutoEnable"))
return;
me.setFFlying(true, false);
CmdFly.flyMap.put(me.getName(), true);
if (CmdFly.particleTask == null)
@@ -709,7 +714,7 @@ public class FactionsPlayerListener implements Listener {
if (changedFaction) {
Bukkit.getScheduler().runTask(FactionsPlugin.instance, () -> Bukkit.getServer().getPluginManager().callEvent(new FPlayerEnteredFactionEvent(factionTo, factionFrom, me)));
if (FactionsPlugin.instance.getConfig().getBoolean("Title.Show-Title")) {
if (FactionsPlugin.instance.getConfig().getBoolean("Title.Show-Title") && me.hasTitlesEnabled()) {
String title = FactionsPlugin.instance.getConfig().getString("Title.Format.Title");
title = title.replace("{Faction}", factionTo.getColorTo(me) + factionTo.getTag());
title = parseAllPlaceholders(title, factionTo, player);
@@ -729,9 +734,7 @@ public class FactionsPlayerListener implements Listener {
}, 5);
}
}
if (!me.isFlying()) {
enableFly(me);
}
this.checkCanFly(me);
if (me.getAutoClaimFor() != null) {
me.attemptClaim(me.getAutoClaimFor(), newLocation, true);

View File

@@ -24,9 +24,6 @@ public class CmdMissions extends FCommand {
@Override
public void perform(CommandContext context) {
if (context.faction == null) {
return;
}
final MissionGUI missionsGUI = new MissionGUI(FactionsPlugin.getInstance(), context.fPlayer);
missionsGUI.build();
context.player.openInventory(missionsGUI.getInventory());

View File

@@ -31,9 +31,7 @@ public class MissionGUI implements FactionGUI {
@Override
public void onClick(int slot, ClickType action) {
String missionName = slots.get(slot);
if (missionName == null) {
return;
}
if (missionName == null) return;
ConfigurationSection configurationSection = plugin.getConfig().getConfigurationSection("Missions");
if (missionName.equals(plugin.color(FactionsPlugin.getInstance().getConfig().getString("Randomization.Start-Item.Allowed.Name")))) {
Mission pickedMission = null;
@@ -54,25 +52,22 @@ public class MissionGUI implements FactionGUI {
}
}
} else if (plugin.getConfig().getBoolean("Randomization.Enabled")) {return;}
if (configurationSection == null) {
return;
}
if (configurationSection == null) return;
int max = plugin.getConfig().getInt("MaximumMissionsAllowedAtOnce");
if (fPlayer.getFaction().getMissions().size() >= max) {
fPlayer.msg(TL.MISSION_MISSION_MAX_ALLOWED, max);
return;
}
if (missionName.equals(plugin.color(FactionsPlugin.getInstance().getConfig().getString("Randomization.Start-Item.Disallowed.Name")))) {
return;
}
if (missionName.equals(plugin.color(FactionsPlugin.getInstance().getConfig().getString("Randomization.Start-Item.Disallowed.Name")))) return;
if (fPlayer.getFaction().getMissions().containsKey(missionName)) {
fPlayer.msg(TL.MISSION_MISSION_ACTIVE);
return;
}
ConfigurationSection section = configurationSection.getConfigurationSection(missionName);
if (section == null) {
return;
}
if (section == null) return;
if(FactionsPlugin.getInstance().getConfig().getBoolean("DenyMissionsMoreThenOnce")) {
if (fPlayer.getFaction().getCompletedMissions().contains(missionName)) {
fPlayer.msg(TL.MISSION_ALREAD_COMPLETED);
@@ -81,9 +76,7 @@ public class MissionGUI implements FactionGUI {
}
ConfigurationSection missionSection = section.getConfigurationSection("Mission");
if (missionSection == null) {
return;
}
if (missionSection == null) return;
Mission mission = new Mission(missionName, missionSection.getString("Type"));
fPlayer.getFaction().getMissions().put(missionName, mission);

View File

@@ -36,13 +36,13 @@ public enum Permission {
DISBAND_ANY("disband.any"),
DISCORD("discord"),
FLY("fly"),
FLY_WILD("factions.fly.wilderness"),
FLY_SAFEZONE("factions.fly.safezone"),
FLY_WARZONE("factions.fly.warzone"),
FLY_ENEMY("factions.fly.enemy"),
FLY_ALLY("factions.fly.ally"),
FLY_TRUCE("factions.fly.truce"),
FLY_NEUTRAL("factions.fly.neutral"),
FLY_WILD("fly.wilderness"),
FLY_SAFEZONE("fly.safezone"),
FLY_WARZONE("fly.warzone"),
FLY_ENEMY("fly.enemy"),
FLY_ALLY("fly.ally"),
FLY_TRUCE("fly.truce"),
FLY_NEUTRAL("fly.neutral"),
FOCUS("focus"),
GLOBALCHAT("globalchat"),
GRACE("grace"),
@@ -108,6 +108,7 @@ public enum Permission {
STEALTH("stealth"),
STUCK("stuck"),
TAG("tag"),
TOGGLE_TITLES("toggletitles"),
TNT("tnt"),
TITLE("title"),
TITLE_COLOR("title.color"),

View File

@@ -132,7 +132,7 @@ public class ClipPlaceholderAPIManager extends PlaceholderExpansion implements R
return (powerBoost == 0.0) ? "" : (powerBoost > 0.0 ? TL.COMMAND_SHOW_BONUS.toString() : TL.COMMAND_SHOW_PENALTY.toString()) + powerBoost + ")";
case "faction_leader":
FPlayer fAdmin = faction.getFPlayerAdmin();
return fAdmin == null ? "Server" : fAdmin.getName().substring(0, fAdmin.getName().length() > 14 ? 13 : fAdmin.getName().length());
return fAdmin == null ? TL.GENERIC_SERVER.toString() : fAdmin.getName().substring(0, fAdmin.getName().length() > 14 ? 13 : fAdmin.getName().length());
case "faction_warps":
return String.valueOf(faction.getWarps().size());
case "faction_raidable":

View File

@@ -35,8 +35,7 @@ public class Updater {
conf.set("Randomization.Start-Item.Disallowed.Lore", lore);
conf.set("Randomization.Start-Item.Slot", 28);
conf.set("Config-Version", 1.1);
version = 1.1;
currentVersion = 1.1;
}
//End with save + reload
try {

View File

@@ -78,6 +78,7 @@ public abstract class MemoryFPlayer implements FPlayer {
protected transient boolean shouldTakeFallDamage = true;
protected boolean isStealthEnabled = false;
protected boolean notificationsEnabled = true;
protected boolean titlesEnabled = true;
protected boolean isAlt = false;
boolean inspectMode = false;
@@ -217,7 +218,12 @@ public abstract class MemoryFPlayer implements FPlayer {
public boolean hasNotificationsEnabled() {
return this.notificationsEnabled;
}
public boolean hasTitlesEnabled() {
return this.titlesEnabled;
}
public void setTitlesEnabled(Boolean b) {
this.titlesEnabled = b;
}
public String getFactionId() {
return this.factionId;
}
@@ -989,7 +995,7 @@ public abstract class MemoryFPlayer implements FPlayer {
}
if (faction.isSystemFaction()) {
return CmdFly.checkBypassPerms(this, this.getPlayer(), faction);
return CmdFly.checkBypassPerms(this, getPlayer(), faction);
}
Access access = faction.getAccess(this, PermissableAction.FLY);
@@ -1225,7 +1231,7 @@ public abstract class MemoryFPlayer implements FPlayer {
}
// if economy is enabled and they're not on the bypass list, make sure they can pay
boolean mustPay = Econ.shouldBeUsed() && !this.isAdminBypassing() && !forFaction.isSafeZone() && !forFaction.isWarZone();
boolean mustPay = Econ.shouldBeUsed() && !this.isAdminBypassing() && !forFaction.isSafeZone() && !forFaction.isWarZone() && (Conf.econCostClaimWilderness != 0);
double cost = 0.0;
EconomyParticipator payee = null;
if (mustPay) {

View File

@@ -160,7 +160,6 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
this.checks = new ConcurrentHashMap<>();
this.playerWallCheckCount = new ConcurrentHashMap<>();
this.playerBufferCheckCount = new ConcurrentHashMap<>();
resetPerms(); // Reset on new Faction so it has default values.
}
@@ -564,7 +563,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
}
@Override
public void setGuildId(final String guildId) {
public void setGuildId(String guildId) {
this.guildId = guildId;
}
@@ -584,7 +583,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
}
@Override
public void setWallNotifyChannelId(final String wallNotifyChannelId) {
public void setWallNotifyChannelId(String wallNotifyChannelId) {
this.wallNotifyChannelId = wallNotifyChannelId;
}
@@ -594,7 +593,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
}
@Override
public void setBufferNotifyChannelId(final String bufferNotifyChannelId) {
public void setBufferNotifyChannelId(String bufferNotifyChannelId) {
this.bufferNotifyChannelId = bufferNotifyChannelId;
}
@@ -604,7 +603,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
}
@Override
public void setWeeWooChannelId(final String weeWooChannelId) {
public void setWeeWooChannelId(String weeWooChannelId) {
this.weeWooChannelId = weeWooChannelId;
}
@@ -614,7 +613,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
}
@Override
public void setNotifyFormat(final String notifyFormat) {
public void setNotifyFormat(String notifyFormat) {
this.notifyFormat = notifyFormat;
}
@@ -624,17 +623,17 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
}
@Override
public void setWeeWooFormat(final String weeWooFormat) {
public void setWeeWooFormat(String weeWooFormat) {
this.weeWooFormat = weeWooFormat;
}
@Override
public void setFactionChatChannelId(final String factionChatChannelId) {
public void setFactionChatChannelId(String factionChatChannelId) {
this.factionChatChannelId = factionChatChannelId;
}
@Override
public void setMemberRoleId(final String memberRoleId) {
public void setMemberRoleId(String memberRoleId) {
this.memberRoleId = memberRoleId;
}
@@ -774,7 +773,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
return;
}
msg("<b>Your faction home has been un-set since it is no longer in your territory.");
msg(TL.COMMAND_HOME_UNSET);
this.home = null;
}
@@ -866,16 +865,13 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
* @return
*/
public Access getAccess(FPlayer player, PermissableAction permissableAction) {
if (player == null || permissableAction == null) {
return Access.UNDEFINED;
}
if (player == null || permissableAction == null) return Access.UNDEFINED;
Permissable perm = player.getFaction() == null ? player.getRole() : player.getFaction().getRelationTo(this);
Permissable perm = player.getFaction() == this ? player.getRole() : player.getFaction().getRelationTo(this);
Map<PermissableAction, Access> accessMap = permissions.get(perm);
if (accessMap != null && accessMap.containsKey(permissableAction)) {
return accessMap.get(permissableAction);
}
if (accessMap != null && accessMap.containsKey(permissableAction)) return accessMap.get(permissableAction);
return Access.UNDEFINED;
}
@@ -890,7 +886,6 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
public void resetPerms() {
FactionsPlugin.getInstance().log(Level.WARNING, "Resetting permissions for Faction: " + tag);
permissions.clear();
// First populate a map with undefined as the permission for each action.
@@ -1306,7 +1301,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
}
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
fplayer.msg("The faction %s<i> was disbanded.", this.getTag(fplayer));
fplayer.msg(TL.COMMAND_DISBAND_BROADCAST_GENERIC, this.getTag(fplayer));
}
FactionDisbandEvent disbandEvent = new FactionDisbandEvent(null, getId(), autoLeave ? PlayerDisbandReason.INACTIVITY : PlayerDisbandReason.LEAVE);
@@ -1318,8 +1313,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
oldLeader.setRole(Role.NORMAL);
}
replacements.get(0).setRole(Role.LEADER);
//TODO:TL
this.msg("<i>Faction admin <h>%s<i> has been removed. %s<i> has been promoted as the new faction admin.", oldLeader == null ? "" : oldLeader.getName(), replacements.get(0).getName());
this.msg(TL.COMMAND_ADMIN_PROMOTED_AUTOLEAVE, oldLeader == null ? "" : oldLeader.getName(), replacements.get(0).getName());
FactionsPlugin.getInstance().log("Faction " + this.getTag() + " (" + this.getId() + ") admin was removed. Replacement admin: " + replacements.get(0).getName());
}
}
@@ -1453,8 +1447,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
ownerList.append(", ");
}
OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(UUID.fromString(anOwnerData));
//TODO:TL
ownerList.append(offlinePlayer != null ? offlinePlayer.getName() : "null player");
ownerList.append(offlinePlayer != null ? offlinePlayer.getName() : TL.GENERIC_NULLPLAYER.toString());
}
return ownerList.toString();
}

View File

@@ -126,6 +126,8 @@ public enum TL {
COMMAND_CONTEXT_ADMINISTER_MOD_REQUIRED("&c[!] You must be a faction moderator to do that."),
COMMAND_UPGRADES_DESCRIPTION("&cOpen the Upgrades Menu"),
COMMAND_UPGRADES_DISABLED("&c[!] &7Faction Upgrades are &cdisabled&7."),
COMMAND_CORNER_CANT_CLAIM("&c&l[!] &cYou may not claim this corner!"),
COMMAND_CORNER_CLAIMED("\n&2&l[!] &aYou have claimed the corner successfully, totalling in &b%1$d &achunks!\n"),
COMMAND_CORNER_ATTEMPTING_CLAIM("&c&l[!] &7Attempting to claim corner..."),
@@ -141,6 +143,7 @@ public enum TL {
COMMAND_ADMIN_DEMOTED("&c&l[!] &cYou have been demoted from the position of faction admin by &7%1$s&c"),
COMMAND_ADMIN_PROMOTES("&e&l[!] &eYou have promoted &6%1$s &eto the position of faction admin."),
COMMAND_ADMIN_PROMOTED("&e&l[!] &6%1$s &egave &6%2$s &ethe leadership of &6%3$s&e."),
COMMAND_ADMIN_PROMOTED_AUTOLEAVE("&e&l[!] &7Faction admin &c%s&7 has been removed. &c%s&7 has been promoted as the new faction admin."),
COMMAND_ADMIN_DESCRIPTION("Hand over your admin rights"),
COMMAND_ADMIN_NOMEMBERS("&e&l[!] &cNo one else to promote, please disband faction."),
@@ -368,6 +371,7 @@ public enum TL {
COMMAND_DISBAND_IMMUTABLE("&c&l[!]&7 &7You &ccannot&7 disband &2Wilderness&7,&e SafeZone&7, or &4WarZone."),
COMMAND_DISBAND_MARKEDPERMANENT("&c&l[!]&7 This faction is designated as&c permanent&7, so you cannot disband it."),
COMMAND_DISBAND_BROADCAST_YOURS("&c&l[!]&7 &c%1$s&7 disbanded your &cfaction."),
COMMAND_DISBAND_BROADCAST_GENERIC("&c&l[!]&7 The Faction &c%1$s&7 was disbanded."),
COMMAND_DISBAND_BROADCAST_NOTYOURS("&c&l[!]&7 &c%1$s &7disbanded the faction &c%2$s."),
COMMAND_DISBAND_HOLDINGS("&c&l[!]&7 &7You have been given the disbanded &cfaction's bank&7, totaling &c%1$s."),
COMMAND_DISBAND_PLAYER("&c&l[!] &7You have disbanded your &cfaction"),
@@ -411,6 +415,7 @@ public enum TL {
COMMAND_HOME_DISABLED("&c&l[!]&7 Sorry, Faction homes are &cdisabled on this server."),
COMMAND_HOME_TELEPORTDISABLED("&c&l[!]&7 Sorry, the ability to &cteleport &7to Faction homes is &cdisabled &7on this server."),
COMMAND_HOME_NOHOME("&c&l[!]&7 Your faction does &cnot &7have a home. "),
COMMAND_HOME_UNSET("&c&l[!]&7 Sorry, your faction home has been &cun-set &7since it is no longer in your territory."),
COMMAND_HOME_INENEMY("&c&l[!]&7 You &ccannot teleport &7to your &cfaction home&7 while in the territory of an &cenemy faction&7."),
COMMAND_HOME_WRONGWORLD("&c&l[!]&7 You &ccannot &7teleport to your &cfaction home&7 while in a different world."),
COMMAND_HOME_ENEMYNEAR("&c&l[!]&7 You &ccannot teleport&7 to your faction home while an enemy is within &c%s&7 blocks of you."),
@@ -547,6 +552,9 @@ public enum TL {
COMMAND_MONEY_LONG("&c&l[!]&7 The faction money commands."),
COMMAND_MONEY_DESCRIPTION("Faction money commands"),
COMMAND_MONEY_CANTAFFORD("&c&l[!]&7 &c%1$s&7 can't afford &c%2$s&7 %3$s"),
COMMAND_MONEY_GAINED("&c&l[!]&7 &c%1$s&7 gained &c%2$s %2%6"),
COMMAND_MONEYBALANCE_SHORT("show faction balance"),
COMMAND_MONEYBALANCE_DESCRIPTION("Show your factions current money balance"),
@@ -555,6 +563,8 @@ public enum TL {
COMMAND_MONEYTRANSFERFF_DESCRIPTION("Transfer f -> f"),
COMMAND_MONEYTRANSFERFF_TRANSFER("&c&l[!]&7 &c%1$s&7 transferred&c %2$s &7from the faction &c\"%3$s\"&7 to the faction&c \"%4$s\"&7"),
COMMAND_MONEYTRANSFERFF_TRANSFERCANTAFFORD("&c&l[!]&7 &c%1$s&7 can't afford to transfer &c%2$s &7to %3$s"),
COMMAND_MONEYTRANSFERFP_DESCRIPTION("Transfer f -> plugin"),
COMMAND_MONEYTRANSFERFP_TRANSFER("&c&l[!]&7 &c%1$s &7transferred&c %2$s &7from the faction&c \"%3$s\" &7to the player &c\"%4$s\""),
@@ -867,6 +877,10 @@ public enum TL {
COMMAND_TITLE_CHANGED("%1$s changed a title: %2$s"),
COMMAND_TITLE_DESCRIPTION("Set or remove a players title"),
COMMAND_TITLETOGGLE_TOGGLED("You have changed your title setting to &c%1$s"),
COMMAND_TITLETOGGLE_DESCRIPTION("Toggle titles to be served to you"),
COMMAND_TOGGLEALLIANCECHAT_DESCRIPTION("Toggles whether or not you will see alliance chat"),
COMMAND_TOGGLEALLIANCECHAT_IGNORE("Alliance chat is now ignored"),
COMMAND_TOGGLEALLIANCECHAT_UNIGNORE("Alliance chat is no longer ignored"),
@@ -888,7 +902,7 @@ public enum TL {
COMMAND_TNT_WIDTHDRAW_SUCCESS("&cSuccessfully withdrew tnt."),
COMMAND_TNT_WIDTHDRAW_NOTENOUGH("&cNot enough tnt in bank."),
COMMAND_TNT_DEPOSIT_NOTENOUGH("&cNot enough tnt in tnt inventory."),
COMMAND_TNT_AMOUNT("&cYour faction has %1$s tnt in the tnt bank."),
COMMAND_TNT_AMOUNT("&cYour faction has {amount}/{maxAmount} tnt in the tnt bank."),
COMMAND_TNT_POSITIVE("&cPlease use positive numbers!"),
COMMAND_TNT_DESCRIPTION("add/widthraw from faction's tnt bank"),
COMMAND_TNT_WIDTHDRAW_NOTENOUGH_SPACE("&cNot enough space in your inventory."),
@@ -1004,6 +1018,7 @@ public enum TL {
GENERIC_YOU("you"),
GENERIC_YOURFACTION("your faction"),
GENERIC_NOPERMISSION("You don't have permission to %1$s."),
GENERIC_ACTION_NOPERMISSION("You don't have permission to use %1$s"),
GENERIC_FPERM_NOPERMISSION("&7The faction leader does not allow you to &c%1$s."),
GENERIC_DOTHAT("do that"), //Ugh nuke this from high orbit
GENERIC_NOPLAYERMATCH("No player match found for \"<plugin>%1$s\"."),
@@ -1015,9 +1030,11 @@ public enum TL {
GENERIC_PUBLICLAND("Public faction land."),
GENERIC_FACTIONLESS("factionless"),
GENERIC_SERVERADMIN("A server admin"),
GENERIC_SERVER("Server"),
GENERIC_DISABLED("disabled"),
GENERIC_ENABLED("enabled"),
GENERIC_INFINITY("∞"),
GENERIC_NULLPLAYER("null player"),
GENERIC_CONSOLEONLY("This command cannot be run as a player."),
GENERIC_PLAYERONLY("This command can only be used by ingame players."),
GENERIC_ASKYOURLEADER(" Ask your leader to:"),
@@ -1038,7 +1055,7 @@ public enum TL {
GENERIC_YOUMUSTBE("&cYour must be atleast %1$s to do this!"),
GENERIC_MEMBERONLY("&cYou must be in a faction to do this!"),
// MISSION_CREATED_COOLDOWN("&c&l[!] &7Due to your immediate faction creation, you may not start missions for &b%1$s minutes&7!"),
MISSION_MISSION_STARTED("&f%1$s &dstarted the %2$s &fmission"),
MISSION_ALREAD_COMPLETED("&c&l[!] &7You may not restart a mission you have already completed"),
MISSION_MISSION_ACTIVE("&c&l[!] &7This mission is currently active!"),
@@ -1081,8 +1098,19 @@ public enum TL {
ECON_OFF("no %s"), // no balance, no value, no refund, etc
ECON_FORMAT("###,###.###"),
ECON_MONEYTRASFERREDFROM("%1$s was transferred from %2$s to %3$s."),
ECON_PERSONGAVEMONEYTO("%1$s gave %2$s to %3$s."),
ECON_PERSONTOOKMONEYFROM("%1$s took %2$s from %3$s."),
ECON_DISABLED("Factions econ is disabled."),
ECON_OVER_BAL_CAP("&4The amount &e%s &4is over Essentials' balance cap."),
ECON_MONEYLOST("&c%s &7lost &c%s &7%s."),
ECON_CANTAFFORD("&c%s &7can't afford &c%s&7 %s."),
ECON_UNABLETOTRANSFER("&7Unable to transfer &c%s&7 to &c%s&7 from &c%s&7."),
ECON_PLAYERBALANCE("&c%s&7's balance is &c%s&7."),
ECON_DEPOSITFAILED("&c%s&7 would have gained &c%s&7 %s, but the deposit failed."),
ECON_CANTCONTROLMONEY("&c%s&7 lacks permission to control &c%s&7's money."),
ECON_MONEYTRASFERREDFROMPERSONTOPERSON("%1$s transferred %2$s from %3$s to %4$s."),
/**
* Relations

View File

@@ -535,7 +535,7 @@ fperm-gui:
- ''
- '&4&l* &cStatus: &f{action-access-color}{action-access}'
- ''
- '&2&l* &aLeft click to &alAllow&a.'
- '&2&l* &aLeft click to &a&lAllow&a.'
- '&4&l* &cRight click to &c&lDeny&c.'
- '&8&l* &7Middle click to &7&lUndefine&7.'
# Back item will be take you to the previous GUI
@@ -1331,7 +1331,6 @@ Tntfill:
max-radius: 32
max-amount: 64
############################################################
# +------------------------------------------------------+ #
# | Big List of variables | #

View File

@@ -104,6 +104,7 @@ permissions:
factions.show: true
factions.stuck: true
factions.tag: true
factions.toggletitles: true
factions.title: true
factions.version: true
factions.unclaim: true