Added alot

This commit is contained in:
Driftay 2019-05-14 22:07:59 -04:00
parent a25ba5e71c
commit 26a9e4eba8
12 changed files with 735 additions and 474 deletions

View File

@ -81,6 +81,7 @@ public class Conf {
public static String truceChatFormat = ChatColor.DARK_PURPLE + "%s:" + ChatColor.WHITE + " %s"; public static String truceChatFormat = ChatColor.DARK_PURPLE + "%s:" + ChatColor.WHITE + " %s";
public static String modChatFormat = ChatColor.RED + "%s:" + ChatColor.WHITE + " %s"; public static String modChatFormat = ChatColor.RED + "%s:" + ChatColor.WHITE + " %s";
public static int stealthFlyCheckRadius = 32; public static int stealthFlyCheckRadius = 32;
public static boolean gracePeriod = false;
public static boolean noEnderpearlsInFly = false; public static boolean noEnderpearlsInFly = false;
public static boolean broadcastDescriptionChanges = false; public static boolean broadcastDescriptionChanges = false;
public static boolean broadcastTagChanges = false; public static boolean broadcastTagChanges = false;

View File

@ -73,6 +73,10 @@ public interface Faction extends EconomyParticipator {
void ban(FPlayer target, FPlayer banner); void ban(FPlayer target, FPlayer banner);
int getStrikes();
void setStrikes(int strikes);
void unban(FPlayer player); void unban(FPlayer player);
boolean isBanned(FPlayer player); boolean isBanned(FPlayer player);

View File

@ -0,0 +1,83 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.FPlayers;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
public class CmdSetStrikes extends FCommand {
public CmdSetStrikes() {
super();
this.aliases.add("setstrikes");
this.aliases.add("setstrike");
this.requiredArgs.add("set,give,remove");
this.requiredArgs.add("faction");
this.requiredArgs.add("# of strikes");
this.requiredArgs.add("reason");
this.errorOnToManyArgs = false;
//this.optionalArgs
this.permission = Permission.SETSTRIKES.node;
this.disableOnLock = true;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
Faction faction = Factions.getInstance().getByTag(args.get(1));
boolean success = false;
if (faction == null) {
fme.msg(TL.COMMAND_SETSTRIKES_FAILURE.toString().replace("{faction}", args.get(1)));
}
if (args.get(0).equalsIgnoreCase("set")) {
faction.setStrikes(argAsInt(2));
success = true;
} else if (args.get(0).equalsIgnoreCase("give")) {
faction.setStrikes(faction.getStrikes() + argAsInt(2));
success = true;
} else if (args.get(0).equalsIgnoreCase("take")) {
faction.setStrikes(faction.getStrikes() - argAsInt(2));
success = true;
}
if (success) {
for (FPlayer fPlayer : FPlayers.getInstance().getOnlinePlayers()) {
fPlayer.msg(TL.COMMAND_SETSTRIKES_BROADCAST.toString()
.replace("{faction}", faction.getTag())
.replace("{reason}", getReason()));
}
fme.msg(TL.COMMAND_SETSTRIKES_SUCCESS.toString()
.replace("{faction}", faction.getTag())
.replace("{strikes}", faction.getStrikes() + ""));
}
}
private String getReason() {
String reason = "";
for (int i = 3; i < args.size(); i++) {
reason += args.get(i) + " ";
}
return reason;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_SETSTRIKES_DESCRIPTION;
}
}

View File

@ -25,6 +25,7 @@ public class CmdShow extends FCommand {
defaults.add("<a>Description: <i>{description}"); defaults.add("<a>Description: <i>{description}");
defaults.add("<a>Joining: <i>{joining} {peaceful}"); defaults.add("<a>Joining: <i>{joining} {peaceful}");
defaults.add("<a>Land / Power / Maxpower: <i> {chunks} / {power} / {maxPower}"); defaults.add("<a>Land / Power / Maxpower: <i> {chunks} / {power} / {maxPower}");
defaults.add("<a>Faction Strikes: {strikes}");
defaults.add("<a>Founded: <i>{create-date}"); defaults.add("<a>Founded: <i>{create-date}");
defaults.add("<a>This faction is permanent, remaining even with no members."); defaults.add("<a>This faction is permanent, remaining even with no members.");
defaults.add("<a>Land value: <i>{land-value} {land-refund}"); defaults.add("<a>Land value: <i>{land-value} {land-refund}");

View File

@ -0,0 +1,52 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.zcore.util.TL;
public class CmdStrike extends FCommand {
public CmdStrike() {
super();
this.aliases.add("strike");
this.aliases.add("strikes");
this.optionalArgs.put("faction", "tag");
this.disableOnLock = true;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeAdmin = false;
}
@Override
public void perform() {
if (args.size() == 0) {
if (myFaction.isWilderness()) {
fme.msg(TL.COMMAND_STRIKE_NEEDFACTION);
return;
}
fme.msg(TL.COMMAND_STRIKE_MESSAGE.toString().replace("{faction}", fme.getFaction().getTag()).replace("{strikes}", fme.getFaction().getStrikes() + ""));
return;
}
Faction faction = Factions.getInstance().getByTag(args.get(0));
if (faction != null) {
fme.msg(TL.COMMAND_STRIKE_MESSAGE.toString().replace("{faction}", faction.getTag()).replace("{strikes}", faction.getStrikes() + ""));
} else {
fme.msg(TL.COMMAND_STRIKE_NOTFOUND.toString().replace("{faction}", args.get(0)));
}
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_STUCK_DESCRIPTION;
}
}

View File

@ -23,6 +23,7 @@ public class FCmdRoot extends FCommand {
public CmdDescription cmdDescription = new CmdDescription(); public CmdDescription cmdDescription = new CmdDescription();
public CmdDisband cmdDisband = new CmdDisband(); public CmdDisband cmdDisband = new CmdDisband();
public CmdFocus cmdFocus = new CmdFocus(); public CmdFocus cmdFocus = new CmdFocus();
public CmdGrace cmdGrace = new CmdGrace();
public CmdHelp cmdHelp = new CmdHelp(); public CmdHelp cmdHelp = new CmdHelp();
public CmdHome cmdHome = new CmdHome(); public CmdHome cmdHome = new CmdHome();
public CmdInvite cmdInvite = new CmdInvite(); public CmdInvite cmdInvite = new CmdInvite();
@ -104,6 +105,8 @@ public class FCmdRoot extends FCommand {
public CmdTntFill cmdTntFill = new CmdTntFill(); public CmdTntFill cmdTntFill = new CmdTntFill();
public CmdChest cmdChest = new CmdChest(); public CmdChest cmdChest = new CmdChest();
public CmdSetBanner cmdSetBanner = new CmdSetBanner(); public CmdSetBanner cmdSetBanner = new CmdSetBanner();
public CmdStrike cmdStrike = new CmdStrike();
public CmdSetStrikes cmdSetStrikes = new CmdSetStrikes();
public FCmdRoot() { public FCmdRoot() {
@ -140,7 +143,8 @@ public class FCmdRoot extends FCommand {
this.addSubCommand(this.cmdDeinvite); this.addSubCommand(this.cmdDeinvite);
this.addSubCommand(this.cmdDescription); this.addSubCommand(this.cmdDescription);
this.addSubCommand(this.cmdDisband); this.addSubCommand(this.cmdDisband);
this.addSubCommand(this.cmdStrike);
this.addSubCommand(this.cmdSetStrikes);
this.addSubCommand(this.cmdHelp); this.addSubCommand(this.cmdHelp);
this.addSubCommand(this.cmdHome); this.addSubCommand(this.cmdHome);
this.addSubCommand(this.cmdInvite); this.addSubCommand(this.cmdInvite);
@ -217,6 +221,10 @@ public class FCmdRoot extends FCommand {
this.addSubCommand(this.cmdChest); this.addSubCommand(this.cmdChest);
this.addSubCommand(this.cmdSetBanner); this.addSubCommand(this.cmdSetBanner);
if (SavageFactions.plugin.getConfig().getBoolean("f-grace.Enabled")) {
this.addSubCommand(this.cmdGrace);
}
if (Bukkit.getServer().getPluginManager().getPlugin("CoreProtect") != null) { if (Bukkit.getServer().getPluginManager().getPlugin("CoreProtect") != null) {
SavageFactions.plugin.log("Found CoreProtect, enabling Inspect"); SavageFactions.plugin.log("Found CoreProtect, enabling Inspect");

View File

@ -31,6 +31,7 @@ public enum Permission {
DISBAND_ANY("disband.any"), DISBAND_ANY("disband.any"),
FLY("fly"), FLY("fly"),
FOCUS("focus"), FOCUS("focus"),
GRACE("grace"),
HELP("help"), HELP("help"),
HOME("home"), HOME("home"),
INVITE("invite"), INVITE("invite"),
@ -77,6 +78,7 @@ public enum Permission {
SAVE("save"), SAVE("save"),
SETHOME("sethome"), SETHOME("sethome"),
SETHOME_ANY("sethome.any"), SETHOME_ANY("sethome.any"),
SETSTRIKES("setstrikes"),
SHOW("show"), SHOW("show"),
STATUS("status"), STATUS("status"),
STEALTH("stealth"), STEALTH("stealth"),

View File

@ -68,6 +68,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
Inventory chest; Inventory chest;
Map<String, Object> bannerSerialized; Map<String, Object> bannerSerialized;
private long lastDeath; private long lastDeath;
private int strikes = 0;
// -------------------------------------------- // // -------------------------------------------- //
// Construct // Construct
@ -117,6 +118,14 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
resetPerms(); // Reset on new Faction so it has default values. resetPerms(); // Reset on new Faction so it has default values.
} }
public int getStrikes() {
return strikes;
}
public void setStrikes(int strikes) {
this.strikes = strikes;
}
public HashMap<String, List<String>> getAnnouncements() { public HashMap<String, List<String>> getAnnouncements() {
return this.announcements; return this.announcements;
} }

View File

@ -317,6 +317,10 @@ public enum TL {
COMMAND_FWARP_PASSWORD_REQUIRED("&c&l[!]&c Warp Password:"), COMMAND_FWARP_PASSWORD_REQUIRED("&c&l[!]&c Warp Password:"),
COMMAND_FWARP_PASSWORD_TIMEOUT("&c&l[!]&7 Warp password &ccanceled"), COMMAND_FWARP_PASSWORD_TIMEOUT("&c&l[!]&7 Warp password &ccanceled"),
COMMAND_GRACE_DESCRIPTION("Toggles Grace Period on/off"),
COMMAND_GRACE_ENABLED("&cYou cannot place &e%s &cwhile grace period is active!"),
COMMAND_GRACE_TOGGLE("&8» &7Grace period is now &c%1$s"),
COMMAND_HINT_PERMISSION("&aYou can manage your factions permissions using &7/f perms"), COMMAND_HINT_PERMISSION("&aYou can manage your factions permissions using &7/f perms"),
COMMAND_HOME_DISABLED("&c&l[!]&7 Sorry, Faction homes are &cdisabled on this server."), COMMAND_HOME_DISABLED("&c&l[!]&7 Sorry, Faction homes are &cdisabled on this server."),
@ -605,6 +609,16 @@ public enum TL {
COMMAND_SETMAXVAULTS_DESCRIPTION("Set max vaults for a Faction."), COMMAND_SETMAXVAULTS_DESCRIPTION("Set max vaults for a Faction."),
COMMAND_SETMAXVAULTS_SUCCESS("&aSet max vaults for &e%s &ato &b%d"), COMMAND_SETMAXVAULTS_SUCCESS("&aSet max vaults for &e%s &ato &b%d"),
COMMAND_SETSTRIKES_FAILURE("&c&l[!]&7 &c{faction} does not exist."),
COMMAND_SETSTRIKES_BROADCAST("&c&l[!]&7 &c{faction} has received a strike for {reason}"),
COMMAND_SETSTRIKES_SUCCESS("&c&l[!]&7 &c{faction}'s&7 new strikes are &c{strikes}"),
COMMAND_SETSTRIKES_DESCRIPTION("Set a faction's points"),
COMMAND_STRIKE_MESSAGE("&c&l[!] &7{faction} has {strikes} strikes."),
COMMAND_STRIKE_NOTFOUND("&c&l[!] &7{faction} does not exist."),
COMMAND_STRIKE_NEEDFACTION("&c&l[!] &7&cYou need to join a faction to view your own!"),
COMMAND_STRIKE_DESCRIPTION("Give a faction strikes."),
COMMAND_VAULT_DESCRIPTION("Open your placed faction vault!"), COMMAND_VAULT_DESCRIPTION("Open your placed faction vault!"),
COMMAND_VAULT_INVALID("&c&l[!]&7 Your vault was either&c claimed&7, &cbroken&7, or has&c not been&7 placed yet."), COMMAND_VAULT_INVALID("&c&l[!]&7 Your vault was either&c claimed&7, &cbroken&7, or has&c not been&7 placed yet."),
COMMAND_VAULT_OPENING("&c&l[!]&7 Opening faction vault."), COMMAND_VAULT_OPENING("&c&l[!]&7 Opening faction vault."),

View File

@ -6,6 +6,7 @@ import com.massivecraft.factions.struct.Relation;
import org.apache.commons.lang.time.DurationFormatUtils; import org.apache.commons.lang.time.DurationFormatUtils;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.dynmap.snakeyaml.nodes.Tag;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -72,6 +73,7 @@ public enum TagReplacer {
FACTION_KILLS(TagType.FACTION, "{faction-kills}"), FACTION_KILLS(TagType.FACTION, "{faction-kills}"),
FACTION_DEATHS(TagType.FACTION, "{faction-deaths}"), FACTION_DEATHS(TagType.FACTION, "{faction-deaths}"),
FACTION_BANCOUNT(TagType.FACTION, "{faction-bancount}"), FACTION_BANCOUNT(TagType.FACTION, "{faction-bancount}"),
FACTION_STRIKES(TagType.FACTION, "{strikes}"),
/** /**
* General variables, require no faction or player * General variables, require no faction or player
@ -255,6 +257,9 @@ public enum TagReplacer {
return String.valueOf(fac.getDeaths()); return String.valueOf(fac.getDeaths());
case FACTION_BANCOUNT: case FACTION_BANCOUNT:
return String.valueOf(fac.getBannedPlayers().size()); return String.valueOf(fac.getBannedPlayers().size());
case FACTION_STRIKES:
return String.valueOf(fac.getStrikes());
default: default:
} }
return null; return null;

View File

@ -280,6 +280,7 @@ show:
- '&6 * &eOwner &7{leader}' - '&6 * &eOwner &7{leader}'
- '&6 * &eDescription &7{description}' - '&6 * &eDescription &7{description}'
- '&6 * &eLand / Power / Max Power: &7{chunks} &8/ &7{power} &8/ &7{maxPower}' - '&6 * &eLand / Power / Max Power: &7{chunks} &8/ &7{power} &8/ &7{maxPower}'
- '&6 * &eFaction Strikes: &7{strikes}'
- '&6 * &eFounded &7{create-date}' - '&6 * &eFounded &7{create-date}'
- '&6 * &eBalance &f{faction-balance}' - '&6 * &eBalance &f{faction-balance}'
- '&6 * &eAllies &c{allies-list}' - '&6 * &eAllies &c{allies-list}'
@ -753,6 +754,26 @@ fnear:
Enabled: true Enabled: true
Radius: 50 Radius: 50
############################################################
# +------------------------------------------------------+ #
# | Falling Block Fix | #
# +------------------------------------------------------+ #
############################################################
#Enabling this will disallow falling blocks to be in spawn.
#Meaning people cannot shoot cannons into spawn and stack sand
#Recommended: true
Falling-Block-Fix:
enabled: true
############################################################
# +------------------------------------------------------+ #
# | Faction GracePeriod | #
# +------------------------------------------------------+ #
############################################################
f-grace:
Enabled: true
############################################################ ############################################################
# +------------------------------------------------------+ # # +------------------------------------------------------+ #
# | Faction Focus | # # | Faction Focus | #