Code Cleanup/Added Configurable option to deny and remove homes in ANY factions land.

More Soon..
This commit is contained in:
Driftay 2019-02-10 23:57:45 -05:00
parent 3559a9f090
commit 5a37320397
125 changed files with 3676 additions and 3410 deletions

View File

@ -1,5 +1,5 @@
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" <assembly xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>bin</id> <id>bin</id>
<includeBaseDirectory>false</includeBaseDirectory> <includeBaseDirectory>false</includeBaseDirectory>

View File

@ -2,12 +2,12 @@ package com.massivecraft.factions;
import ch.njol.skript.Skript; import ch.njol.skript.Skript;
import ch.njol.skript.SkriptAddon; import ch.njol.skript.SkriptAddon;
import com.earth2me.essentials.Essentials;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import com.massivecraft.factions.cmd.CmdAutoHelp; import com.massivecraft.factions.cmd.CmdAutoHelp;
import com.massivecraft.factions.cmd.FCmdRoot; import com.massivecraft.factions.cmd.FCmdRoot;
import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.integration.Essentials;
import com.massivecraft.factions.integration.Worldguard; import com.massivecraft.factions.integration.Worldguard;
import com.massivecraft.factions.integration.dynmap.EngineDynmap; import com.massivecraft.factions.integration.dynmap.EngineDynmap;
import com.massivecraft.factions.listeners.*; import com.massivecraft.factions.listeners.*;
@ -56,7 +56,9 @@ public class SavageFactions extends MPlugin {
// Single 4 life. // Single 4 life.
public static SavageFactions plugin; public static SavageFactions plugin;
public static Permission perms = null; public static Permission perms = null;
// Persistence related
public static ArrayList<FPlayer> playersFlying = new ArrayList();
public Essentials ess;
public boolean PlaceholderApi; public boolean PlaceholderApi;
// Commands // Commands
public FCmdRoot cmdBase; public FCmdRoot cmdBase;
@ -72,15 +74,12 @@ public class SavageFactions extends MPlugin {
SOIL, MOB_SPANWER, THIN_GLASS, IRON_FENCE, NETHER_FENCE, FENCE, SOIL, MOB_SPANWER, THIN_GLASS, IRON_FENCE, NETHER_FENCE, FENCE,
WOODEN_DOOR, TRAP_DOOR, FENCE_GATE, BURNING_FURNACE, DIODE_BLOCK_OFF, WOODEN_DOOR, TRAP_DOOR, FENCE_GATE, BURNING_FURNACE, DIODE_BLOCK_OFF,
DIODE_BLOCK_ON, ENCHANTMENT_TABLE, FIREBALL; DIODE_BLOCK_ON, ENCHANTMENT_TABLE, FIREBALL;
// Persistence related SkriptAddon skriptAddon;
private boolean locked = false; private boolean locked = false;
private Integer AutoLeaveTask = null; private Integer AutoLeaveTask = null;
private boolean hookedPlayervaults; private boolean hookedPlayervaults;
private ClipPlaceholderAPIManager clipPlaceholderAPIManager; private ClipPlaceholderAPIManager clipPlaceholderAPIManager;
private boolean mvdwPlaceholderAPIManager = false; private boolean mvdwPlaceholderAPIManager = false;
SkriptAddon skriptAddon;
private Listener[] eventsListener; private Listener[] eventsListener;
public SavageFactions() { public SavageFactions() {
@ -157,7 +156,7 @@ public class SavageFactions extends MPlugin {
// Load Conf from disk // Load Conf from disk
Conf.load(); Conf.load();
Essentials.setup(); com.massivecraft.factions.integration.Essentials.setup();
hookedPlayervaults = setupPlayervaults(); hookedPlayervaults = setupPlayervaults();
FPlayers.getInstance().load(); FPlayers.getInstance().load();
Factions.getInstance().load(); Factions.getInstance().load();
@ -171,6 +170,11 @@ public class SavageFactions extends MPlugin {
} }
faction.addFPlayer(fPlayer); faction.addFPlayer(fPlayer);
} }
playersFlying.clear();
for (FPlayer fPlayer : FPlayers.getInstance().getAllFPlayers()) {
playersFlying.add(fPlayer);
}
UtilFly.run();
Board.getInstance().load(); Board.getInstance().load();
Board.getInstance().clean(); Board.getInstance().clean();
@ -238,6 +242,8 @@ public class SavageFactions extends MPlugin {
getCommand(this.refCommand).setExecutor(this); getCommand(this.refCommand).setExecutor(this);
getCommand(this.refCommand).setTabCompleter(this); getCommand(this.refCommand).setTabCompleter(this);
setupEssentials();
if (getDescription().getFullName().contains("BETA")) { if (getDescription().getFullName().contains("BETA")) {
divider(); divider();
System.out.println("You are using a BETA version of the plugin!"); System.out.println("You are using a BETA version of the plugin!");
@ -505,6 +511,11 @@ public class SavageFactions extends MPlugin {
return econ; return econ;
} }
private boolean setupEssentials() {
SavageFactions.plugin.ess = (Essentials) this.getServer().getPluginManager().getPlugin("Essentials");
return SavageFactions.plugin.ess == null;
}
@Override @Override
public boolean logPlayerCommands() { public boolean logPlayerCommands() {
return Conf.logPlayerCommands; return Conf.logPlayerCommands;
@ -542,25 +553,20 @@ public class SavageFactions extends MPlugin {
return new ArrayList<>(); return new ArrayList<>();
} }
for (; !commandsList.isEmpty() && !argsList.isEmpty(); argsList.remove(0)) for (; !commandsList.isEmpty() && !argsList.isEmpty(); argsList.remove(0)) {
{
String cmdName = argsList.get(0).toLowerCase(); String cmdName = argsList.get(0).toLowerCase();
MCommand<?> commandFounded = commandsList.stream() MCommand<?> commandFounded = commandsList.stream()
.filter(c -> c.aliases.contains(cmdName)) .filter(c -> c.aliases.contains(cmdName))
.findFirst().orElse(null); .findFirst().orElse(null);
if (commandFounded != null) if (commandFounded != null) {
{
commandEx = commandFounded; commandEx = commandFounded;
commandsList = commandFounded.subCommands; commandsList = commandFounded.subCommands;
} } else break;
else break;
} }
if (argsList.isEmpty()) if (argsList.isEmpty()) {
{ for (MCommand<?> subCommand : commandEx.subCommands) {
for (MCommand<?> subCommand: commandEx.subCommands)
{
subCommand.setCommandSender(sender); subCommand.setCommandSender(sender);
if (handleCommand(sender, cmdValid + " " + subCommand.aliases.get(0), true) if (handleCommand(sender, cmdValid + " " + subCommand.aliases.get(0), true)
&& subCommand.visibility != CommandVisibility.INVISIBLE && subCommand.visibility != CommandVisibility.INVISIBLE

View File

@ -41,12 +41,10 @@ public class CmdChat extends FCommand {
modeString = modeString.toLowerCase(); modeString = modeString.toLowerCase();
// Only allow Mods and higher rank to switch to this channel. // Only allow Mods and higher rank to switch to this channel.
if (modeString.startsWith("m")) { if (modeString.startsWith("m")) {
if (!fme.getRole().isAtLeast(Role.MODERATOR)) if (!fme.getRole().isAtLeast(Role.MODERATOR)) {
{
msg(TL.COMMAND_CHAT_MOD_ONLY); msg(TL.COMMAND_CHAT_MOD_ONLY);
return; return;
} } else modeTarget = ChatMode.MOD;
else modeTarget = ChatMode.MOD;
} else if (modeString.startsWith("p")) { } else if (modeString.startsWith("p")) {
modeTarget = ChatMode.PUBLIC; modeTarget = ChatMode.PUBLIC;
} else if (modeString.startsWith("a")) { } else if (modeString.startsWith("a")) {
@ -63,13 +61,22 @@ public class CmdChat extends FCommand {
fme.setChatMode(modeTarget); fme.setChatMode(modeTarget);
switch (fme.getChatMode()) switch (fme.getChatMode()) {
{ case MOD:
case MOD: msg(TL.COMMAND_CHAT_MODE_MOD); break; msg(TL.COMMAND_CHAT_MODE_MOD);
case PUBLIC: msg(TL.COMMAND_CHAT_MODE_PUBLIC); break; break;
case ALLIANCE: msg(TL.COMMAND_CHAT_MODE_ALLIANCE); break; case PUBLIC:
case TRUCE: msg(TL.COMMAND_CHAT_MODE_TRUCE); break; msg(TL.COMMAND_CHAT_MODE_PUBLIC);
default: msg(TL.COMMAND_CHAT_MODE_FACTION); break; break;
case ALLIANCE:
msg(TL.COMMAND_CHAT_MODE_ALLIANCE);
break;
case TRUCE:
msg(TL.COMMAND_CHAT_MODE_TRUCE);
break;
default:
msg(TL.COMMAND_CHAT_MODE_FACTION);
break;
} }
} }

View File

@ -46,8 +46,7 @@ public class CmdClaim extends FCommand {
} }
} }
if (forFaction.isWilderness()) if (forFaction.isWilderness()) {
{
CmdUnclaim cmdUnclaim = SavageFactions.plugin.cmdBase.cmdUnclaim; CmdUnclaim cmdUnclaim = SavageFactions.plugin.cmdBase.cmdUnclaim;
cmdUnclaim.execute(sender, args.size() > 1 ? args.subList(0, 1) : args); cmdUnclaim.execute(sender, args.size() > 1 ? args.subList(0, 1) : args);
return; return;

View File

@ -1,12 +1,10 @@
package com.massivecraft.factions.cmd; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.*;
import com.massivecraft.factions.FPlayers;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.SavageFactions;
import com.massivecraft.factions.event.FactionDisbandEvent.PlayerDisbandReason; import com.massivecraft.factions.event.FactionDisbandEvent.PlayerDisbandReason;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.struct.Role;
import com.massivecraft.factions.util.UtilFly;
import com.massivecraft.factions.zcore.fperms.Access; import com.massivecraft.factions.zcore.fperms.Access;
import com.massivecraft.factions.zcore.fperms.PermissableAction; import com.massivecraft.factions.zcore.fperms.PermissableAction;
import com.massivecraft.factions.zcore.util.TL; import com.massivecraft.factions.zcore.util.TL;
@ -93,6 +91,7 @@ public class CmdDisband extends FCommand {
if (SavageFactions.plugin.getConfig().getBoolean("faction-disband-broadcast", true)) { if (SavageFactions.plugin.getConfig().getBoolean("faction-disband-broadcast", true)) {
for (FPlayer follower : FPlayers.getInstance().getOnlinePlayers()) { for (FPlayer follower : FPlayers.getInstance().getOnlinePlayers()) {
String amountString = senderIsConsole ? TL.GENERIC_SERVERADMIN.toString() : fme.describeTo(follower); String amountString = senderIsConsole ? TL.GENERIC_SERVERADMIN.toString() : fme.describeTo(follower);
UtilFly.checkFly(this.fme, Board.getInstance().getFactionAt(new FLocation(follower)));
if (follower.getFaction() == faction) { if (follower.getFaction() == faction) {
follower.msg(TL.COMMAND_DISBAND_BROADCAST_YOURS, amountString); follower.msg(TL.COMMAND_DISBAND_BROADCAST_YOURS, amountString);
} else { } else {

View File

@ -21,7 +21,6 @@ public class CmdShowClaims extends FCommand {
this.senderMustBePlayer = true; this.senderMustBePlayer = true;
} }
@Override @Override

View File

@ -99,7 +99,7 @@ public class CmdTnt extends FCommand {
return; return;
} }
if (fme.getFaction().getTnt() < amount) { if (fme.getFaction().getTnt() < amount) {
fme.msg(TL.COMMAND_TNT_WIDTHDRAW_NOTENOUGH); fme.msg(TL.COMMAND_TNT_WIDTHDRAW_NOTENOUGH.toString());
return; return;
} }
int fullStacks = amount / 64; int fullStacks = amount / 64;

View File

@ -45,8 +45,7 @@ public abstract class FCommand extends MCommand<SavageFactions> {
} }
@Override @Override
public void setCommandSender(CommandSender sender) public void setCommandSender(CommandSender sender) {
{
super.setCommandSender(sender); super.setCommandSender(sender);
if (sender instanceof Player) { if (sender instanceof Player) {
this.fme = FPlayers.getInstance().getByPlayer((Player) sender); this.fme = FPlayers.getInstance().getByPlayer((Player) sender);

View File

@ -11,9 +11,9 @@ import org.bukkit.event.Cancellable;
*/ */
public class FactionDisbandEvent extends FactionEvent implements Cancellable { public class FactionDisbandEvent extends FactionEvent implements Cancellable {
private boolean cancelled = false;
private final Player sender; private final Player sender;
private final PlayerDisbandReason reason; private final PlayerDisbandReason reason;
private boolean cancelled = false;
public FactionDisbandEvent(Player sender, String factionId, PlayerDisbandReason reason) { public FactionDisbandEvent(Player sender, String factionId, PlayerDisbandReason reason) {
super(Factions.getInstance().getFactionById(factionId)); super(Factions.getInstance().getFactionById(factionId));

View File

@ -1,9 +1,8 @@
package com.massivecraft.factions.event; package com.massivecraft.factions.event;
import org.bukkit.event.Cancellable;
import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Faction; import com.massivecraft.factions.Faction;
import org.bukkit.event.Cancellable;
/** /**
* Event called when a player regenerate power. * Event called when a player regenerate power.

View File

@ -4,9 +4,9 @@ import com.massivecraft.factions.zcore.util.TL;
public interface EconomyParticipator extends RelationParticipator { public interface EconomyParticipator extends RelationParticipator {
public String getAccountId(); String getAccountId();
public void msg(String str, Object... args); void msg(String str, Object... args);
public void msg(TL translation, Object... args); void msg(TL translation, Object... args);
} }

View File

@ -5,13 +5,13 @@ import org.bukkit.ChatColor;
public interface RelationParticipator { public interface RelationParticipator {
public String describeTo(RelationParticipator that); String describeTo(RelationParticipator that);
public String describeTo(RelationParticipator that, boolean ucfirst); String describeTo(RelationParticipator that, boolean ucfirst);
public Relation getRelationTo(RelationParticipator that); Relation getRelationTo(RelationParticipator that);
public Relation getRelationTo(RelationParticipator that, boolean ignorePeaceful); Relation getRelationTo(RelationParticipator that, boolean ignorePeaceful);
public ChatColor getColorTo(RelationParticipator to); ChatColor getColorTo(RelationParticipator to);
} }

View File

@ -3,11 +3,7 @@ package com.massivecraft.factions.integration;
import com.earth2me.essentials.Teleport; import com.earth2me.essentials.Teleport;
import com.earth2me.essentials.Trade; import com.earth2me.essentials.Trade;
import com.massivecraft.factions.Conf; import com.massivecraft.factions.Conf;
import net.ess3.api.IEssentials; import net.ess3.api.IEssentials;
import java.math.BigDecimal;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
@ -15,6 +11,8 @@ import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import java.math.BigDecimal;
public class Essentials { public class Essentials {
private static IEssentials essentials; private static IEssentials essentials;

View File

@ -45,7 +45,8 @@ public class EngineDynmap {
public MarkerAPI markerApi; public MarkerAPI markerApi;
public MarkerSet markerset; public MarkerSet markerset;
private EngineDynmap() {} private EngineDynmap() {
}
public static EngineDynmap getInstance() { public static EngineDynmap getInstance() {
return i; return i;

View File

@ -10,8 +10,8 @@ public class TempAreaMarker {
public String label; public String label;
public String world; public String world;
public double x[]; public double[] x;
public double z[]; public double[] z;
public String description; public String description;
public int lineColor; public int lineColor;
@ -27,7 +27,7 @@ public class TempAreaMarker {
// CREATE // CREATE
// -------------------------------------------- // // -------------------------------------------- //
public static boolean equals(AreaMarker marker, double x[], double z[]) { public static boolean equals(AreaMarker marker, double[] x, double[] z) {
int length = marker.getCornerCount(); int length = marker.getCornerCount();
if (x.length != length) { if (x.length != length) {

View File

@ -9,7 +9,6 @@ import com.massivecraft.factions.util.Particles.ParticleEffect;
import com.massivecraft.factions.zcore.fperms.Access; import com.massivecraft.factions.zcore.fperms.Access;
import com.massivecraft.factions.zcore.fperms.PermissableAction; import com.massivecraft.factions.zcore.fperms.PermissableAction;
import com.massivecraft.factions.zcore.util.TL; import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
@ -507,13 +506,10 @@ public class FactionsBlockListener implements Listener {
} }
@EventHandler @EventHandler
public void onFarmLandDamage(EntityChangeBlockEvent event) public void onFarmLandDamage(EntityChangeBlockEvent event) {
{ if (event.getEntity() instanceof Player) {
if (event.getEntity() instanceof Player)
{
Player player = (Player) event.getEntity(); Player player = (Player) event.getEntity();
if (!playerCanBuildDestroyBlock(player, event.getBlock().getLocation(), PermissableAction.DESTROY.name(), true)) if (!playerCanBuildDestroyBlock(player, event.getBlock().getLocation(), PermissableAction.DESTROY.name(), true)) {
{
FPlayer me = FPlayers.getInstance().getById(player.getUniqueId().toString()); FPlayer me = FPlayers.getInstance().getById(player.getUniqueId().toString());
Faction otherFaction = Board.getInstance().getFactionAt(new FLocation(event.getBlock().getLocation())); Faction otherFaction = Board.getInstance().getFactionAt(new FLocation(event.getBlock().getLocation()));
Faction myFaction = me.getFaction(); Faction myFaction = me.getFaction();

View File

@ -1,5 +1,6 @@
package com.massivecraft.factions.listeners; package com.massivecraft.factions.listeners;
import com.earth2me.essentials.User;
import com.massivecraft.factions.*; import com.massivecraft.factions.*;
import com.massivecraft.factions.cmd.CmdFly; import com.massivecraft.factions.cmd.CmdFly;
import com.massivecraft.factions.cmd.CmdSeeChunk; import com.massivecraft.factions.cmd.CmdSeeChunk;
@ -23,6 +24,7 @@ import com.massivecraft.factions.zcore.util.TextUtil;
import net.coreprotect.CoreProtect; import net.coreprotect.CoreProtect;
import net.coreprotect.CoreProtectAPI; import net.coreprotect.CoreProtectAPI;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
@ -648,6 +650,93 @@ public class FactionsPlayerListener implements Listener {
} }
} }
//For Blocking Homes and Blocking Teleportation To Homes
@EventHandler
public void onPlayerHomeCheck(PlayerTeleportEvent event) throws Exception {
if (event.getPlayer().hasPermission("factions.homes.bypass")) {
return;
}
boolean isHome = false;
for (String str : SavageFactions.plugin.ess.getUser(event.getPlayer()).getHomes()) {
Location home = SavageFactions.plugin.ess.getUser(event.getPlayer()).getHome(str);
if (home.getBlockX() == event.getTo().getBlockX() && home.getBlockY() == event.getTo().getBlockY() && home.getBlockZ() == event.getTo().getBlockZ()) {
isHome = true;
}
}
if (!isHome) {
return;
}
Location loc = event.getTo();
FLocation floc = new FLocation(event.getTo());
Faction fac = Board.getInstance().getFactionAt(floc);
Player player = event.getPlayer();
FPlayer fplayer = FPlayers.getInstance().getByPlayer(player);
User user = SavageFactions.plugin.ess.getUser(event.getPlayer());
List<String> homes = user.getHomes();
if (fac.isWilderness() || FPlayers.getInstance().getByPlayer(event.getPlayer()).getFactionId().equals(fac.getId())) {
return;
}
//Warzone and SafeZone Home Initializers
if (fac.isWarZone() || fac.isSafeZone() && SavageFactions.plugin.getConfig().getBoolean("deny-homes-in-system-factions")) {
event.setCancelled(true);
fplayer.msg(TL.COMMAND_HOME_BLOCKED, fac.getTag());
if (SavageFactions.plugin.getConfig().getBoolean("remove-homes-in-system-factions"))
for (String s : homes) {
if (user.getHome(s).getBlock().getLocation().getChunk().equals(loc.getChunk())) {
user.delHome(s);
}
}
}
if (fplayer.getFaction().getRelationTo(fac) == Relation.ENEMY && SavageFactions.plugin.getConfig().getBoolean("deny-homes-in-enemy-factions")) {
event.setCancelled(true);
fplayer.msg(TL.COMMAND_HOME_BLOCKED, fac.getTag());
if (SavageFactions.plugin.getConfig().getBoolean("remove-homes-in-enemy-factions"))
for (String s : homes) {
if (user.getHome(s).getBlock().getLocation().getChunk().equals(loc.getChunk())) {
user.delHome(s);
}
}
}
if (fplayer.getFaction().getRelationTo(fac) == Relation.NEUTRAL && SavageFactions.plugin.getConfig().getBoolean("deny-homes-in-neutral-factions")) {
event.setCancelled(true);
fplayer.msg(TL.COMMAND_HOME_BLOCKED, fac.getTag());
if (SavageFactions.plugin.getConfig().getBoolean("remove-homes-in-neutral-factions"))
for (String s : homes) {
if (user.getHome(s).getBlock().getLocation().getChunk().equals(loc.getChunk())) {
user.delHome(s);
}
}
}
if (fplayer.getFaction().getRelationTo(fac) == Relation.ALLY && SavageFactions.plugin.getConfig().getBoolean("deny-homes-in-ally-factions")) {
event.setCancelled(true);
fplayer.msg(TL.COMMAND_HOME_BLOCKED, fac.getTag());
if (SavageFactions.plugin.getConfig().getBoolean("remove-homes-in-ally-factions"))
for (String s : homes) {
if (user.getHome(s).getBlock().getLocation().getChunk().equals(loc.getChunk())) {
user.delHome(s);
}
}
}
if (fplayer.getFaction().getRelationTo(fac) == Relation.TRUCE && SavageFactions.plugin.getConfig().getBoolean("deny-homes-in-truce-factions")) {
event.setCancelled(true);
fplayer.msg(TL.COMMAND_HOME_BLOCKED, fac.getTag());
if (SavageFactions.plugin.getConfig().getBoolean("remove-homes-in-truce-factions"))
for (String s : homes) {
if (user.getHome(s).getBlock().getLocation().getChunk().equals(loc.getChunk())) {
user.delHome(s);
}
}
}
}
//Colors a String
public String color(String s) {
return ChatColor.translateAlternateColorCodes('&', s);
}
private String convertTime(int time) { private String convertTime(int time) {
String result = String.valueOf(Math.round((System.currentTimeMillis() / 1000L - time) / 36.0D) / 100.0D); String result = String.valueOf(Math.round((System.currentTimeMillis() / 1000L - time) / 36.0D) / 100.0D);
return (result.length() == 3 ? result + "0" : result) + "/hrs ago"; return (result.length() == 3 ? result + "0" : result) + "/hrs ago";
@ -859,15 +948,12 @@ public class FactionsPlayerListener implements Listener {
} }
@EventHandler @EventHandler
public void onPlayerBoneMeal(PlayerInteractEvent event) public void onPlayerBoneMeal(PlayerInteractEvent event) {
{
Block block = event.getClickedBlock(); Block block = event.getClickedBlock();
if (event.getAction() == Action.RIGHT_CLICK_BLOCK && block.getType() == Material.GRASS_BLOCK if (event.getAction() == Action.RIGHT_CLICK_BLOCK && block.getType() == Material.GRASS_BLOCK
&& event.hasItem() && event.getItem().getType() == Material.BONE_MEAL) && event.hasItem() && event.getItem().getType() == Material.BONE_MEAL) {
{ if (!FactionsBlockListener.playerCanBuildDestroyBlock(event.getPlayer(), block.getLocation(), PermissableAction.BUILD.name(), true)) {
if (!FactionsBlockListener.playerCanBuildDestroyBlock(event.getPlayer(), block.getLocation(), PermissableAction.BUILD.name(), true))
{
FPlayer me = FPlayers.getInstance().getById(event.getPlayer().getUniqueId().toString()); FPlayer me = FPlayers.getInstance().getById(event.getPlayer().getUniqueId().toString());
Faction otherFaction = Board.getInstance().getFactionAt(new FLocation(block.getLocation())); Faction otherFaction = Board.getInstance().getFactionAt(new FLocation(block.getLocation()));
Faction myFaction = me.getFaction(); Faction myFaction = me.getFaction();

View File

@ -96,13 +96,17 @@ public enum Relation implements Permissable {
public ChatColor getColor() { public ChatColor getColor() {
switch (this) switch (this) {
{ case MEMBER:
case MEMBER: return Conf.colorMember; return Conf.colorMember;
case ALLY: return Conf.colorAlly; case ALLY:
case NEUTRAL: return Conf.colorNeutral; return Conf.colorAlly;
case TRUCE: return Conf.colorTruce; case NEUTRAL:
default: return Conf.colorEnemy; return Conf.colorNeutral;
case TRUCE:
return Conf.colorTruce;
default:
return Conf.colorEnemy;
} }
} }

View File

@ -93,13 +93,17 @@ public enum Role implements Permissable {
public String getPrefix() { public String getPrefix() {
switch (this) switch (this) {
{ case LEADER:
case LEADER: return Conf.prefixLeader; return Conf.prefixLeader;
case COLEADER: return Conf.prefixCoLeader; case COLEADER:
case MODERATOR: return Conf.prefixMod; return Conf.prefixCoLeader;
case NORMAL: return Conf.prefixNormal; case MODERATOR:
case RECRUIT: return Conf.prefixRecruit; return Conf.prefixMod;
case NORMAL:
return Conf.prefixNormal;
case RECRUIT:
return Conf.prefixRecruit;
} }
return ""; return "";

View File

@ -107,7 +107,7 @@ public class ClipPlaceholderAPIManager extends PlaceholderExpansion implements R
case "faction_claims": case "faction_claims":
return String.valueOf(faction.getAllClaims().size()); return String.valueOf(faction.getAllClaims().size());
case "faction_founded": case "faction_founded":
return String.valueOf(TL.sdf.format(faction.getFoundedDate())); return TL.sdf.format(faction.getFoundedDate());
case "faction_joining": case "faction_joining":
return (faction.getOpen() ? TL.COMMAND_SHOW_UNINVITED.toString() : TL.COMMAND_SHOW_INVITATION.toString()); return (faction.getOpen() ? TL.COMMAND_SHOW_UNINVITED.toString() : TL.COMMAND_SHOW_INVITATION.toString());
case "faction_peaceful": case "faction_peaceful":

View File

@ -4,8 +4,8 @@ import org.bukkit.event.inventory.ClickType;
public interface FactionGUI { public interface FactionGUI {
public void onClick(int slot, ClickType action); void onClick(int slot, ClickType action);
public void build(); void build();
} }

View File

@ -100,11 +100,21 @@ public class MiscUtil {
} }
switch (player.getRole()) { switch (player.getRole()) {
case LEADER: admins.add(player); break; case LEADER:
case COLEADER: admins.add(player); break; admins.add(player);
case MODERATOR: moderators.add(player); break; break;
case NORMAL: normal.add(player); break; case COLEADER:
case RECRUIT: recruit.add(player); break; admins.add(player);
break;
case MODERATOR:
moderators.add(player);
break;
case NORMAL:
normal.add(player);
break;
case RECRUIT:
recruit.add(player);
break;
} }
} }

View File

@ -20,7 +20,7 @@ import java.util.Map.Entry;
/** /**
* <b>ParticleEffect Library</b> * <b>ParticleEffect Library</b>
* This library was created by @DarkBlade12 and allows you to display all Minecraft particle effects on a Bukkit server * This library was created by @DarkBlade12 and allows you to display all Minecraft particle effects on a Bukkit server
* * <p>
* You are welcome to use it, modify it and redistribute it under the following conditions: * You are welcome to use it, modify it and redistribute it under the following conditions:
* <ul> * <ul>
* <li>Don't claim this class as your own * <li>Don't claim this class as your own
@ -524,7 +524,6 @@ public enum ParticleEffect {
/** /**
* Determine if this particle effect has a specific property * Determine if this particle effect has a specific property
* *
*
* @param property - property to check. * @param property - property to check.
* @return Whether it has the property or not * @return Whether it has the property or not
*/ */
@ -1177,7 +1176,7 @@ public enum ParticleEffect {
/** /**
* Represents the color for the {@link ParticleEffect#NOTE} effect * Represents the color for the {@link ParticleEffect#NOTE} effect
* * <p>
* This class is part of the <b>ParticleEffect Library</b> and follows the same usage conditions * This class is part of the <b>ParticleEffect Library</b> and follows the same usage conditions
* *
* @author DarkBlade12 * @author DarkBlade12
@ -1236,7 +1235,7 @@ public enum ParticleEffect {
/** /**
* Represents a runtime exception that is thrown either if the displayed particle effect requires data and has none or vice-versa or if the data type is incorrect * Represents a runtime exception that is thrown either if the displayed particle effect requires data and has none or vice-versa or if the data type is incorrect
* * <p>
* This class is part of the <b>ParticleEffect Library</b> and follows the same usage conditions * This class is part of the <b>ParticleEffect Library</b> and follows the same usage conditions
* *
* @author DarkBlade12 * @author DarkBlade12
@ -1257,7 +1256,7 @@ public enum ParticleEffect {
/** /**
* Represents a runtime exception that is thrown either if the displayed particle effect is not colorable or if the particle color type is incorrect * Represents a runtime exception that is thrown either if the displayed particle effect is not colorable or if the particle color type is incorrect
* * <p>
* This class is part of the <b>ParticleEffect Library</b> and follows the same usage conditions * This class is part of the <b>ParticleEffect Library</b> and follows the same usage conditions
* *
* @author DarkBlade12 * @author DarkBlade12
@ -1278,7 +1277,7 @@ public enum ParticleEffect {
/** /**
* Represents a runtime exception that is thrown if the displayed particle effect requires a newer version * Represents a runtime exception that is thrown if the displayed particle effect requires a newer version
* * <p>
* This class is part of the <b>ParticleEffect Library</b> and follows the same usage conditions * This class is part of the <b>ParticleEffect Library</b> and follows the same usage conditions
* *
* @author DarkBlade12 * @author DarkBlade12
@ -1299,7 +1298,7 @@ public enum ParticleEffect {
/** /**
* Represents a particle effect packet with all attributes which is used for sending packets to the players * Represents a particle effect packet with all attributes which is used for sending packets to the players
* * <p>
* This class is part of the <b>ParticleEffect Library</b> and follows the same usage conditions * This class is part of the <b>ParticleEffect Library</b> and follows the same usage conditions
* *
* @author DarkBlade12 * @author DarkBlade12
@ -1532,7 +1531,7 @@ public enum ParticleEffect {
/** /**
* Represents a runtime exception that is thrown if a bukkit version is not compatible with this library * Represents a runtime exception that is thrown if a bukkit version is not compatible with this library
* * <p>
* This class is part of the <b>ParticleEffect Library</b> and follows the same usage conditions * This class is part of the <b>ParticleEffect Library</b> and follows the same usage conditions
* *
* @author DarkBlade12 * @author DarkBlade12
@ -1554,7 +1553,7 @@ public enum ParticleEffect {
/** /**
* Represents a runtime exception that is thrown if packet instantiation fails * Represents a runtime exception that is thrown if packet instantiation fails
* * <p>
* This class is part of the <b>ParticleEffect Library</b> and follows the same usage conditions * This class is part of the <b>ParticleEffect Library</b> and follows the same usage conditions
* *
* @author DarkBlade12 * @author DarkBlade12
@ -1576,7 +1575,7 @@ public enum ParticleEffect {
/** /**
* Represents a runtime exception that is thrown if packet sending fails * Represents a runtime exception that is thrown if packet sending fails
* * <p>
* This class is part of the <b>ParticleEffect Library</b> and follows the same usage conditions * This class is part of the <b>ParticleEffect Library</b> and follows the same usage conditions
* *
* @author DarkBlade12 * @author DarkBlade12

View File

@ -11,9 +11,9 @@ import java.util.Map;
/** /**
* <b>ReflectionUtils</b> * <b>ReflectionUtils</b>
* * <p>
* This class provides useful methods which makes dealing with reflection much easier, especially when working with Bukkit * This class provides useful methods which makes dealing with reflection much easier, especially when working with Bukkit
* * <p>
* You are welcome to use it, modify it and redistribute it under the following conditions: * You are welcome to use it, modify it and redistribute it under the following conditions:
* <ul> * <ul>
* <li>Don't claim this class as your own * <li>Don't claim this class as your own
@ -346,7 +346,7 @@ public final class ReflectionUtils {
/** /**
* Represents an enumeration of dynamic packages of NMS and CraftBukkit * Represents an enumeration of dynamic packages of NMS and CraftBukkit
* * <p>
* This class is part of the <b>ReflectionUtils</b> and follows the same usage conditions * This class is part of the <b>ReflectionUtils</b> and follows the same usage conditions
* *
* @author DarkBlade12 * @author DarkBlade12
@ -433,7 +433,7 @@ public final class ReflectionUtils {
/** /**
* Represents an enumeration of Java data types with corresponding classes * Represents an enumeration of Java data types with corresponding classes
* * <p>
* This class is part of the <b>ReflectionUtils</b> and follows the same usage conditions * This class is part of the <b>ReflectionUtils</b> and follows the same usage conditions
* *
* @author DarkBlade12 * @author DarkBlade12

View File

@ -0,0 +1,114 @@
package com.massivecraft.factions.util;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.SavageFactions;
import com.massivecraft.factions.struct.Relation;
import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.Bukkit;
import java.util.ArrayList;
import java.util.Iterator;
public class UtilFly {
public static ArrayList<FPlayer> playersFlying;
static {
playersFlying = SavageFactions.playersFlying;
}
public UtilFly() {
}
public static void run() {
if (SavageFactions.plugin.getConfig().getBoolean("enable-faction-flight")) {
playersFlying.clear();
Bukkit.getScheduler().scheduleSyncRepeatingTask(SavageFactions.plugin, new Runnable() {
public void run() {
Iterator var2 = UtilFly.playersFlying.iterator();
while (var2.hasNext()) {
FPlayer fp = (FPlayer) var2.next();
if (fp != null) {
fp.checkIfNearbyEnemies();
}
}
}
}, 0L, (long) SavageFactions.plugin.getConfig().getInt("fly-task-interval", 10));
}
}
public static void setFly(FPlayer fp, boolean fly, boolean silent, boolean damage) {
if (SavageFactions.plugin.getConfig().getBoolean("enable-faction-flight")) {
fp.getPlayer().setAllowFlight(fly);
fp.getPlayer().setFlying(fly);
fp.setFlying(fly);
if (fly) {
playersFlying.add(fp);
} else {
playersFlying.remove(fp);
}
if (!silent) {
if (!damage) {
fp.msg(TL.COMMAND_FLY_CHANGE, fly ? "enabled" : "disabled");
} else {
fp.msg(TL.COMMAND_FLY_DAMAGE);
}
}
setFallDamage(fp, fly, damage);
}
}
public static void checkFly(FPlayer me, Faction factionTo) {
if (SavageFactions.plugin.getConfig().getBoolean("enable-faction-flight")) {
if (!me.isAdminBypassing() || !me.isFlying()) {
Relation relationTo;
if (!me.isFlying()) {
if (me.isAdminBypassing()) {
setFly(me, true, false, false);
return;
}
if (factionTo == me.getFaction() && me.getPlayer().hasPermission("factions.fly")) {
setFly(me, true, false, false);
} else {
relationTo = factionTo.getRelationTo(me);
if (factionTo.isWilderness() && me.canflyinWilderness() || factionTo.isWarZone() && me.canflyinWarzone() || factionTo.isSafeZone() && me.canflyinSafezone() || relationTo == Relation.ENEMY && me.canflyinEnemy() || relationTo == Relation.ALLY && me.canflyinAlly() || relationTo == Relation.TRUCE && me.canflyinTruce() || relationTo == Relation.NEUTRAL && me.canflyinNeutral()) {
setFly(me, true, false, false);
}
}
} else {
relationTo = factionTo.getRelationTo(me);
if (factionTo.equals(me.getFaction()) && !me.getPlayer().hasPermission("factions.fly") || factionTo.isWilderness() && !me.canflyinWilderness() || factionTo.isWarZone() && !me.canflyinWarzone() || factionTo.isSafeZone() && !me.canflyinSafezone() || relationTo == Relation.ENEMY && !me.canflyinEnemy() || relationTo == Relation.ALLY && !me.canflyinAlly() || relationTo == Relation.TRUCE && !me.canflyinTruce() || relationTo == Relation.NEUTRAL && !me.canflyinNeutral()) {
setFly(me, false, false, false);
}
}
}
}
}
public static void setFallDamage(final FPlayer fp, boolean fly, boolean damage) {
if (!fly) {
if (!damage) {
fp.sendMessage(TL.COMMAND_FLY_COOLDOWN.toString().replace("{amount}", String.valueOf(SavageFactions.plugin.getConfig().getInt("fly-falldamage-cooldown", 3))));
}
int cooldown = SavageFactions.plugin.getConfig().getInt("fly-falldamage-cooldown", 3);
if (cooldown > 0) {
fp.setTakeFallDamage(false);
Bukkit.getScheduler().runTaskLater(SavageFactions.plugin, new Runnable() {
public void run() {
fp.setTakeFallDamage(true);
}
}, 20L * (long) cooldown);
}
}
}
}

View File

@ -12,7 +12,7 @@ public class WarmUpUtil {
* @param action The action, inserted into the notification message. * @param action The action, inserted into the notification message.
* @param runnable The task to run after the delay. If the delay is 0, the task is instantly ran. * @param runnable The task to run after the delay. If the delay is 0, the task is instantly ran.
* @param delay The time used, in seconds, for the delay. * @param delay The time used, in seconds, for the delay.
* * <p>
* note: for translations: %s = action, %d = delay * note: for translations: %s = action, %d = delay
*/ */
public static void process(final FPlayer player, Warmup warmup, TL translationKey, String action, final Runnable runnable, long delay) { public static void process(final FPlayer player, Warmup warmup, TL translationKey, String action, final Runnable runnable, long delay) {

View File

@ -85,8 +85,7 @@ public abstract class MCommand<T extends MPlugin> {
public abstract TL getUsageTranslation(); public abstract TL getUsageTranslation();
public void setCommandSender(CommandSender sender) public void setCommandSender(CommandSender sender) {
{
this.sender = sender; this.sender = sender;
if (sender instanceof Player) { if (sender instanceof Player) {
this.me = (Player) sender; this.me = (Player) sender;

View File

@ -4,10 +4,10 @@ import org.bukkit.inventory.ItemStack;
public interface Permissable { public interface Permissable {
public ItemStack buildItem(); ItemStack buildItem();
public String replacePlaceholders(String string); String replacePlaceholders(String string);
public String name(); String name();
} }

View File

@ -109,11 +109,16 @@ public enum PermissableAction {
String accessValue = null; String accessValue = null;
switch (access) switch (access) {
{ case ALLOW:
case ALLOW: accessValue = "allow"; break; accessValue = "allow";
case DENY: accessValue = "deny"; break; break;
case UNDEFINED: accessValue = "undefined"; break; case DENY:
accessValue = "deny";
break;
case UNDEFINED:
accessValue = "undefined";
break;
} }
// If under the 1.13 version we will use the colorable option. // If under the 1.13 version we will use the colorable option.

View File

@ -27,15 +27,19 @@ public class CropUpgrades implements Listener {
if (level != 0) { if (level != 0) {
int chance = -1; int chance = -1;
switch (level) switch (level) {
{ case 1:
case 1: chance = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Crops.Crop-Boost.level-1"); break; chance = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Crops.Crop-Boost.level-1");
case 2: chance = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Crops.Crop-Boost.level-2"); break; break;
case 3: chance = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Crops.Crop-Boost.level-3"); break; case 2:
chance = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Crops.Crop-Boost.level-2");
break;
case 3:
chance = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Crops.Crop-Boost.level-3");
break;
} }
if (chance >= 0) if (chance >= 0) {
{
int randomNum = ThreadLocalRandom.current().nextInt(1, 100 + 1); int randomNum = ThreadLocalRandom.current().nextInt(1, 100 + 1);
if (randomNum <= chance) if (randomNum <= chance)
growCrop(e); growCrop(e);
@ -63,8 +67,7 @@ public class CropUpgrades implements Listener {
above.setType(SavageFactions.plugin.SUGAR_CANE_BLOCK); above.setType(SavageFactions.plugin.SUGAR_CANE_BLOCK);
} }
} } else if (below.getType() == Material.CACTUS) {
else if (below.getType() == Material.CACTUS) {
Block above = e.getBlock().getLocation().add(0, 1, 0).getBlock(); Block above = e.getBlock().getLocation().add(0, 1, 0).getBlock();
if (above.getType() == Material.AIR && above.getLocation().add(0, -2, 0).getBlock().getType() != Material.AIR) { if (above.getType() == Material.AIR && above.getLocation().add(0, -2, 0).getBlock().getType() != Material.AIR) {

View File

@ -28,11 +28,16 @@ public class EXPUpgrade implements Listener {
double multiplier = -1; double multiplier = -1;
switch (level) switch (level) {
{ case 1:
case 1: multiplier = SavageFactions.plugin.getConfig().getDouble("fupgrades.MainMenu.EXP.EXP-Boost.level-1"); break; multiplier = SavageFactions.plugin.getConfig().getDouble("fupgrades.MainMenu.EXP.EXP-Boost.level-1");
case 2: multiplier = SavageFactions.plugin.getConfig().getDouble("fupgrades.MainMenu.EXP.EXP-Boost.level-2"); break; break;
case 3: multiplier = SavageFactions.plugin.getConfig().getDouble("fupgrades.MainMenu.EXP.EXP-Boost.level-3"); break; case 2:
multiplier = SavageFactions.plugin.getConfig().getDouble("fupgrades.MainMenu.EXP.EXP-Boost.level-2");
break;
case 3:
multiplier = SavageFactions.plugin.getConfig().getDouble("fupgrades.MainMenu.EXP.EXP-Boost.level-3");
break;
} }
if (multiplier >= 0) if (multiplier >= 0)

View File

@ -74,9 +74,9 @@ public class FUpgradesGUI implements Listener {
if (e.getCurrentItem().equals(cropItem)) { if (e.getCurrentItem().equals(cropItem)) {
int cropLevel = fme.getFaction().getUpgrade(Upgrade.CROP); int cropLevel = fme.getFaction().getUpgrade(Upgrade.CROP);
switch (cropLevel) switch (cropLevel) {
{ case 3:
case 3: return; return;
case 2: case 2:
upgradeItem(fme, Upgrade.CROP, 3, SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Crops.Cost.level-3")); upgradeItem(fme, Upgrade.CROP, 3, SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Crops.Cost.level-3"));
break; break;
@ -87,13 +87,12 @@ public class FUpgradesGUI implements Listener {
upgradeItem(fme, Upgrade.CROP, 1, SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Crops.Cost.level-1")); upgradeItem(fme, Upgrade.CROP, 1, SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Crops.Cost.level-1"));
break; break;
} }
} } else if (e.getCurrentItem().equals(spawnerItem)) {
else if (e.getCurrentItem().equals(spawnerItem)) {
int spawnerLevel = fme.getFaction().getUpgrade(Upgrade.SPAWNER); int spawnerLevel = fme.getFaction().getUpgrade(Upgrade.SPAWNER);
switch(spawnerLevel) switch (spawnerLevel) {
{ case 3:
case 3: return; return;
case 2: case 2:
upgradeItem(fme, Upgrade.SPAWNER, 3, SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Spawners.Cost.level-3")); upgradeItem(fme, Upgrade.SPAWNER, 3, SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Spawners.Cost.level-3"));
break; break;
@ -104,13 +103,12 @@ public class FUpgradesGUI implements Listener {
upgradeItem(fme, Upgrade.SPAWNER, 1, SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Spawners.Cost.level-1")); upgradeItem(fme, Upgrade.SPAWNER, 1, SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Spawners.Cost.level-1"));
break; break;
} }
} } else if (e.getCurrentItem().equals(expItem)) {
else if (e.getCurrentItem().equals(expItem)) {
int expLevel = fme.getFaction().getUpgrade(Upgrade.EXP); int expLevel = fme.getFaction().getUpgrade(Upgrade.EXP);
switch (expLevel) switch (expLevel) {
{ case 3:
case 3: return; return;
case 2: case 2:
upgradeItem(fme, Upgrade.EXP, 3, SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.EXP.Cost.level-3")); upgradeItem(fme, Upgrade.EXP, 3, SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.EXP.Cost.level-3"));
break; break;
@ -121,27 +119,23 @@ public class FUpgradesGUI implements Listener {
upgradeItem(fme, Upgrade.EXP, 1, SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.EXP.Cost.level-1")); upgradeItem(fme, Upgrade.EXP, 1, SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.EXP.Cost.level-1"));
break; break;
} }
} } else if (e.getCurrentItem().equals(chestitem)) {
else if (e.getCurrentItem().equals(chestitem)) {
int chestLevel = fme.getFaction().getUpgrade(Upgrade.CHEST); int chestLevel = fme.getFaction().getUpgrade(Upgrade.CHEST);
switch (chestLevel) switch (chestLevel) {
{ case 3:
case 3: return; return;
case 2: case 2: {
{
if (upgradeItem(fme, Upgrade.CHEST, 3, SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.Cost.level-3"))) if (upgradeItem(fme, Upgrade.CHEST, 3, SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.Cost.level-3")))
updateChests(fme.getFaction()); updateChests(fme.getFaction());
break; break;
} }
case 1: case 1: {
{
if (upgradeItem(fme, Upgrade.CHEST, 2, SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.Cost.level-2"))) if (upgradeItem(fme, Upgrade.CHEST, 2, SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.Cost.level-2")))
updateChests(fme.getFaction()); updateChests(fme.getFaction());
break; break;
} }
case 0: case 0: {
{
if (upgradeItem(fme, Upgrade.CHEST, 1, SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.Cost.level-1"))) if (upgradeItem(fme, Upgrade.CHEST, 1, SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.Cost.level-1")))
updateChests(fme.getFaction()); updateChests(fme.getFaction());
break; break;
@ -162,11 +156,16 @@ public class FUpgradesGUI implements Listener {
int level = faction.getUpgrade(Upgrade.CHEST); int level = faction.getUpgrade(Upgrade.CHEST);
int size = 1; int size = 1;
switch (level) switch (level) {
{ case 1:
case 1: size = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.Chest-Size.level-1"); break; size = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.Chest-Size.level-1");
case 2: size = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.Chest-Size.level-2"); break; break;
case 3: size = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.Chest-Size.level-3"); break; case 2:
size = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.Chest-Size.level-2");
break;
case 3:
size = SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Chest.Chest-Size.level-3");
break;
} }
faction.setChestSize(size * 9); faction.setChestSize(size * 9);
} }
@ -286,8 +285,7 @@ public class FUpgradesGUI implements Listener {
fme.takeMoney(amt); fme.takeMoney(amt);
} }
private boolean upgradeItem(FPlayer fme, Upgrade upgrade, int level, int cost) private boolean upgradeItem(FPlayer fme, Upgrade upgrade, int level, int cost) {
{
if (hasMoney(fme, cost)) { if (hasMoney(fme, cost)) {
takeMoney(fme, cost); takeMoney(fme, cost);
fme.getFaction().setUpgrade(upgrade, level); fme.getFaction().setUpgrade(upgrade, level);

View File

@ -18,11 +18,16 @@ public class SpawnerUpgrades implements Listener {
if (!factionAtLoc.isWilderness()) { if (!factionAtLoc.isWilderness()) {
int level = factionAtLoc.getUpgrade(Upgrade.SPAWNER); int level = factionAtLoc.getUpgrade(Upgrade.SPAWNER);
if (level != 0) { if (level != 0) {
switch (level) switch (level) {
{ case 1:
case 1: lowerSpawnerDelay(e, SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Spawners.Spawner-Boost.level-1")); break; lowerSpawnerDelay(e, SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Spawners.Spawner-Boost.level-1"));
case 2: lowerSpawnerDelay(e, SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Spawners.Spawner-Boost.level-2")); break; break;
case 3: lowerSpawnerDelay(e, SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Spawners.Spawner-Boost.level-3")); break; case 2:
lowerSpawnerDelay(e, SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Spawners.Spawner-Boost.level-2"));
break;
case 3:
lowerSpawnerDelay(e, SavageFactions.plugin.getConfig().getInt("fupgrades.MainMenu.Spawners.Spawner-Boost.level-3"));
break;
} }
} }
} }

View File

@ -10,8 +10,8 @@ public class NBTCompound {
private String compundName; private String compundName;
private NBTCompound parent; private NBTCompound parent;
protected NBTCompound() protected NBTCompound() {
{} }
protected NBTCompound(NBTCompound owner, String name) { protected NBTCompound(NBTCompound owner, String name) {
this.compundName = name; this.compundName = name;

View File

@ -22,8 +22,7 @@ public enum MinecraftVersion {
} }
public static MinecraftVersion getVersion() { public static MinecraftVersion getVersion() {
if (version == null) if (version == null) {
{
final String ver = Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3]; final String ver = Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3];
System.out.println("[NBTAPI] Found Spigot: " + ver + "!Trying to find NMS support"); System.out.println("[NBTAPI] Found Spigot: " + ver + "!Trying to find NMS support");

View File

@ -2,11 +2,7 @@ package com.massivecraft.factions.zcore.persist;
import com.massivecraft.factions.*; import com.massivecraft.factions.*;
import com.massivecraft.factions.cmd.CmdFly; import com.massivecraft.factions.cmd.CmdFly;
import com.massivecraft.factions.event.FPlayerLeaveEvent; import com.massivecraft.factions.event.*;
import com.massivecraft.factions.event.FPlayerStoppedFlying;
import com.massivecraft.factions.event.FactionDisbandEvent;
import com.massivecraft.factions.event.LandClaimEvent;
import com.massivecraft.factions.event.PowerRegenEvent;
import com.massivecraft.factions.event.FactionDisbandEvent.PlayerDisbandReason; import com.massivecraft.factions.event.FactionDisbandEvent.PlayerDisbandReason;
import com.massivecraft.factions.iface.EconomyParticipator; import com.massivecraft.factions.iface.EconomyParticipator;
import com.massivecraft.factions.iface.RelationParticipator; import com.massivecraft.factions.iface.RelationParticipator;
@ -1195,13 +1191,17 @@ public abstract class MemoryFPlayer implements FPlayer {
@Override @Override
public String getRolePrefix() { public String getRolePrefix() {
switch (getRole()) switch (getRole()) {
{ case RECRUIT:
case RECRUIT: return Conf.prefixRecruit; return Conf.prefixRecruit;
case NORMAL: return Conf.prefixNormal; case NORMAL:
case MODERATOR: return Conf.prefixMod; return Conf.prefixNormal;
case COLEADER: return Conf.prefixCoLeader; case MODERATOR:
case LEADER: return Conf.prefixLeader; return Conf.prefixMod;
case COLEADER:
return Conf.prefixCoLeader;
case LEADER:
return Conf.prefixLeader;
} }
return null; return null;

View File

@ -196,9 +196,13 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
this.maxVaults = value; this.maxVaults = value;
} }
public String getFocused() { return this.player; } public String getFocused() {
return this.player;
}
public void setFocused(String fp) { this.player = fp; } public void setFocused(String fp) {
this.player = fp;
}
public Set<String> getInvites() { public Set<String> getInvites() {
return invites; return invites;

View File

@ -43,7 +43,7 @@ public class PermUtil {
* This method tests if me has a certain permission and returns true if me has. Otherwise false * This method tests if me has a certain permission and returns true if me has. Otherwise false
*/ */
public boolean has(CommandSender me, String perm) { public boolean has(CommandSender me, String perm) {
return me != null ? me.hasPermission(perm):false; return me != null && me.hasPermission(perm);
} }
public boolean has(CommandSender me, String perm, boolean informSenderIfNot) { public boolean has(CommandSender me, String perm, boolean informSenderIfNot) {

View File

@ -317,6 +317,7 @@ public enum TL {
COMMAND_HOME_TOTELEPORT("to teleport to your faction home"), COMMAND_HOME_TOTELEPORT("to teleport to your faction home"),
COMMAND_HOME_FORTELEPORT("for teleporting to your faction home"), COMMAND_HOME_FORTELEPORT("for teleporting to your faction home"),
COMMAND_HOME_DESCRIPTION("Teleport to the faction home"), COMMAND_HOME_DESCRIPTION("Teleport to the faction home"),
COMMAND_HOME_BLOCKED("&c&l[!] You may not teleport to a home that is claimed by &b%1$s"),
COMMAND_INSPECT_DISABLED_MSG("&c&l[!]&7 Inspect mode is now &cdisabled."), COMMAND_INSPECT_DISABLED_MSG("&c&l[!]&7 Inspect mode is now &cdisabled."),
COMMAND_INSPECT_DISABLED_NOFAC("&c&l[!]&7 Inspect mode is now &cdisabled,&7 because you &cdo not have a faction!"), COMMAND_INSPECT_DISABLED_NOFAC("&c&l[!]&7 Inspect mode is now &cdisabled,&7 because you &cdo not have a faction!"),

View File

@ -629,6 +629,7 @@ fperm-gui:
name: ' ' name: ' '
lore: lore:
- -
############################################################ ############################################################
# +------------------------------------------------------+ # # +------------------------------------------------------+ #
# | Faction Warp GUI | # # | Faction Warp GUI | #
@ -692,6 +693,30 @@ fwarp-gui:
lore: lore:
- -
############################################################
# +------------------------------------------------------+ #
# | Faction Homes Essentials | #
# +------------------------------------------------------+ #
############################################################
# Warzone/SafeZone
deny-homes-in-system-factions: false
remove-homes-in-system-factions: false
deny-homes-in-enemy-factions: false
remove-homes-in-enemy-factions: false
deny-homes-in-neutral-factions: false
remove-homes-in-neutral-factions: false
deny-homes-in-ally-factions: false
remove-homes-in-ally-factions: false
deny-homes-in-truce-factions: false
remove-homes-in-truce-factions: false
############################################################ ############################################################
# +------------------------------------------------------+ # # +------------------------------------------------------+ #
# | Faction Creation/Disband Broadcast | # # | Faction Creation/Disband Broadcast | #

View File

@ -150,6 +150,8 @@ permissions:
description: display a help page description: display a help page
factions.home: factions.home:
description: teleport to the faction home description: teleport to the faction home
factions.homes.bypass:
description: bypass all home teleports
factions.invite: factions.invite:
description: invite a player to your faction description: invite a player to your faction
factions.join: factions.join: