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

@ -35,7 +35,7 @@ public class Conf {
public static ChatColor colorWar = ChatColor.DARK_RED; public static ChatColor colorWar = ChatColor.DARK_RED;
// Power // Power
public static double powerPlayerMax = 10.0; public static double powerPlayerMax = 10.0;
public static double powerPlayerMin = - 10.0; public static double powerPlayerMin = -10.0;
public static double powerPlayerStarting = 0.0; public static double powerPlayerStarting = 0.0;
public static double powerPerMinute = 0.2; // Default health rate... it takes 5 min to heal one power public static double powerPerMinute = 0.2; // Default health rate... it takes 5 min to heal one power
public static double powerPerDeath = 4.0; // A death makes you lose 4 power public static double powerPerDeath = 4.0; // A death makes you lose 4 power

View File

@ -11,7 +11,7 @@ import java.util.LinkedHashSet;
import java.util.Set; import java.util.Set;
public class FLocation implements Serializable { public class FLocation implements Serializable {
private static final long serialVersionUID = - 8292915234027387983L; private static final long serialVersionUID = -8292915234027387983L;
private static final boolean worldBorderSupport; private static final boolean worldBorderSupport;
static { static {

View File

@ -31,7 +31,7 @@ import java.net.URL;
* @author Sam Jakob Harker, Brianna Hazel O'Keefe * @author Sam Jakob Harker, Brianna Hazel O'Keefe
* @version 3.0 * @version 3.0
*/ */
@SuppressWarnings ("all") @SuppressWarnings("all")
public class MassiveStats implements Listener { public class MassiveStats implements Listener {
/* START: MASSIVESTATS SETTINGS */ /* START: MASSIVESTATS SETTINGS */
@ -258,7 +258,7 @@ class MassiveStatsUpdateTask extends BukkitRunnable {
} }
@Override @Override
@SuppressWarnings ("all") @SuppressWarnings("all")
public void run() { public void run() {
try { try {
// Generate the request payload and serialize it as JSON. // Generate the request payload and serialize it as JSON.
@ -431,7 +431,7 @@ class MassiveStatsDataRequest {
} }
} }
@SuppressWarnings ("all") @SuppressWarnings("all")
public String serialize() { public String serialize() {
//return object.toString(); //return object.toString();
try { try {

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();
@ -219,7 +223,7 @@ public class SavageFactions extends MPlugin {
// Register Event Handlers // Register Event Handlers
eventsListener = new Listener[] { eventsListener = new Listener[]{
new FactionsPlayerListener(), new FactionsPlayerListener(),
new FactionsChatListener(), new FactionsChatListener(),
new FactionsEntityListener(), new FactionsEntityListener(),
@ -231,13 +235,15 @@ public class SavageFactions extends MPlugin {
new SpawnerUpgrades(), new SpawnerUpgrades(),
}; };
for (Listener eventListener: eventsListener) for (Listener eventListener : eventsListener)
getServer().getPluginManager().registerEvents(eventListener, this); getServer().getPluginManager().registerEvents(eventListener, this);
// since some other plugins execute commands directly through this command interface, provide it // since some other plugins execute commands directly through this command interface, provide it
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,10 +46,9 @@ 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

@ -174,7 +174,7 @@ public class CmdConfig extends FCommand {
return; return;
} }
@SuppressWarnings ("unchecked") Set<Material> matSet = (Set<Material>) target.get(null); @SuppressWarnings("unchecked") Set<Material> matSet = (Set<Material>) target.get(null);
// Material already present, so remove it // Material already present, so remove it
if (matSet.contains(newMat)) { if (matSet.contains(newMat)) {
@ -192,7 +192,7 @@ public class CmdConfig extends FCommand {
// Set<String> // Set<String>
else if (innerType == String.class) { else if (innerType == String.class) {
@SuppressWarnings ("unchecked") Set<String> stringSet = (Set<String>) target.get(null); @SuppressWarnings("unchecked") Set<String> stringSet = (Set<String>) target.get(null);
// String already present, so remove it // String already present, so remove it
if (stringSet.contains(value.toString())) { if (stringSet.contains(value.toString())) {

View File

@ -4,6 +4,6 @@ public class CmdDemote extends FPromoteCommand {
public CmdDemote() { public CmdDemote() {
aliases.add("demote"); aliases.add("demote");
this.relative = - 1; this.relative = -1;
} }
} }

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

@ -23,8 +23,8 @@ public class CmdFly extends FCommand {
public static ConcurrentHashMap<String, Boolean> flyMap = new ConcurrentHashMap<String, Boolean>(); public static ConcurrentHashMap<String, Boolean> flyMap = new ConcurrentHashMap<String, Boolean>();
public static int id = - 1; public static int id = -1;
public static int flyid = - 1; public static int flyid = -1;
public CmdFly() { public CmdFly() {
super(); super();
@ -73,15 +73,15 @@ public class CmdFly extends FCommand {
// 1.9+ based servers will use the built in particleAPI instead of packet based. // 1.9+ based servers will use the built in particleAPI instead of packet based.
// any particle amount higher than 0 made them go everywhere, and the offset at 0 was not working. // any particle amount higher than 0 made them go everywhere, and the offset at 0 was not working.
// So setting the amount to 0 spawns 1 in the precise location // So setting the amount to 0 spawns 1 in the precise location
player.getWorld().spawnParticle(Particle.CLOUD, player.getLocation().add(0, - 0.35, 0), 0); player.getWorld().spawnParticle(Particle.CLOUD, player.getLocation().add(0, -0.35, 0), 0);
} else { } else {
ParticleEffect.CLOUD.display((float) 0, (float) 0, (float) 0, (float) 0, 3, player.getLocation().add(0, - 0.35, 0), 16); ParticleEffect.CLOUD.display((float) 0, (float) 0, (float) 0, (float) 0, 3, player.getLocation().add(0, -0.35, 0), 16);
} }
} }
if (flyMap.keySet().size() == 0) { if (flyMap.keySet().size() == 0) {
Bukkit.getScheduler().cancelTask(id); Bukkit.getScheduler().cancelTask(id);
id = - 1; id = -1;
} }
} }
}, 10L, 3L); }, 10L, 3L);
@ -178,7 +178,7 @@ public class CmdFly extends FCommand {
public static void checkTaskState() { public static void checkTaskState() {
if (flyMap.keySet().size() == 0) { if (flyMap.keySet().size() == 0) {
Bukkit.getScheduler().cancelTask(flyid); Bukkit.getScheduler().cancelTask(flyid);
flyid = - 1; flyid = -1;
} }
} }
@ -199,7 +199,7 @@ public class CmdFly extends FCommand {
if (!checkBypassPerms(fme, me, toFac)) return; if (!checkBypassPerms(fme, me, toFac)) return;
List<Entity> entities = this.me.getNearbyEntities(16.0D, 256.0D, 16.0D); List<Entity> entities = this.me.getNearbyEntities(16.0D, 256.0D, 16.0D);
for (int i = 0; i <= entities.size() - 1; ++ i) { for (int i = 0; i <= entities.size() - 1; ++i) {
if (entities.get(i) instanceof Player) { if (entities.get(i) instanceof Player) {
Player eplayer = (Player) entities.get(i); Player eplayer = (Player) entities.get(i);
FPlayer efplayer = FPlayers.getInstance().getByPlayer(eplayer); FPlayer efplayer = FPlayers.getInstance().getByPlayer(eplayer);
@ -231,12 +231,12 @@ public class CmdFly extends FCommand {
public void run() { public void run() {
fme.setFlying(true); fme.setFlying(true);
flyMap.put(player.getName(), true); flyMap.put(player.getName(), true);
if (id == - 1) { if (id == -1) {
if (SavageFactions.plugin.getConfig().getBoolean("ffly.Particles.Enabled")) { if (SavageFactions.plugin.getConfig().getBoolean("ffly.Particles.Enabled")) {
startParticles(); startParticles();
} }
} }
if (flyid == - 1) { if (flyid == -1) {
startFlyCheck(); startFlyCheck();
} }
} }

View File

@ -70,7 +70,7 @@ public class CmdList extends FCommand {
if (f1Size < f2Size) { if (f1Size < f2Size) {
return 1; return 1;
} else if (f1Size > f2Size) { } else if (f1Size > f2Size) {
return - 1; return -1;
} }
return 0; return 0;
} }
@ -85,7 +85,7 @@ public class CmdList extends FCommand {
if (f1Size < f2Size) { if (f1Size < f2Size) {
return 1; return 1;
} else if (f1Size > f2Size) { } else if (f1Size > f2Size) {
return - 1; return -1;
} }
return 0; return 0;
} }

View File

@ -21,7 +21,7 @@ public class CmdSeeChunk extends FCommand {
private boolean useParticles; private boolean useParticles;
private int length; private int length;
private ParticleEffect effect; private ParticleEffect effect;
private int taskID = - 1; private int taskID = -1;
//I remade it cause of people getting mad that I had the same seechunk as drtshock //I remade it cause of people getting mad that I had the same seechunk as drtshock
@ -61,10 +61,10 @@ public class CmdSeeChunk extends FCommand {
} }
private void manageTask() { private void manageTask() {
if (taskID != - 1) { if (taskID != -1) {
if (seeChunkMap.keySet().size() == 0) { if (seeChunkMap.keySet().size() == 0) {
Bukkit.getScheduler().cancelTask(taskID); Bukkit.getScheduler().cancelTask(taskID);
taskID = - 1; taskID = -1;
} }
} else { } else {
startTask(); startTask();

View File

@ -28,7 +28,7 @@ public class CmdSetMaxVaults extends FCommand {
@Override @Override
public void perform() { public void perform() {
Faction targetFaction = argAsFaction(0); Faction targetFaction = argAsFaction(0);
int value = argAsInt(1, - 1); int value = argAsInt(1, -1);
if (value < 0) { if (value < 0) {
sender.sendMessage(ChatColor.RED + "Number must be greater than 0."); sender.sendMessage(ChatColor.RED + "Number must be greater than 0.");
return; return;

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

@ -55,7 +55,7 @@ public class CmdTop extends FCommand {
if (f1Size < f2Size) { if (f1Size < f2Size) {
return 1; return 1;
} else if (f1Size > f2Size) { } else if (f1Size > f2Size) {
return - 1; return -1;
} }
return 0; return 0;
} }
@ -70,7 +70,7 @@ public class CmdTop extends FCommand {
if (f1start > f2start) { if (f1start > f2start) {
return 1; return 1;
} else if (f1start < f2start) { } else if (f1start < f2start) {
return - 1; return -1;
} }
return 0; return 0;
} }
@ -84,7 +84,7 @@ public class CmdTop extends FCommand {
if (f1Size < f2Size) { if (f1Size < f2Size) {
return 1; return 1;
} else if (f1Size > f2Size) { } else if (f1Size > f2Size) {
return - 1; return -1;
} }
return 0; return 0;
} }
@ -98,7 +98,7 @@ public class CmdTop extends FCommand {
if (f1Size < f2Size) { if (f1Size < f2Size) {
return 1; return 1;
} else if (f1Size > f2Size) { } else if (f1Size > f2Size) {
return - 1; return -1;
} }
return 0; return 0;
} }
@ -112,7 +112,7 @@ public class CmdTop extends FCommand {
if (f1Size < f2Size) { if (f1Size < f2Size) {
return 1; return 1;
} else if (f1Size > f2Size) { } else if (f1Size > f2Size) {
return - 1; return -1;
} }
return 0; return 0;
} }
@ -133,7 +133,7 @@ public class CmdTop extends FCommand {
if (f1Size < f2Size) { if (f1Size < f2Size) {
return 1; return 1;
} else if (f1Size > f2Size) { } else if (f1Size > f2Size) {
return - 1; return -1;
} }
return 0; return 0;
} }

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);
@ -312,9 +311,9 @@ public abstract class FCommand extends MCommand<SavageFactions> {
} }
if (Conf.bankEnabled && Conf.bankFactionPaysCosts && fme.hasFaction()) { if (Conf.bankEnabled && Conf.bankFactionPaysCosts && fme.hasFaction()) {
return Econ.modifyMoney(myFaction, - cost, toDoThis, forDoingThis); return Econ.modifyMoney(myFaction, -cost, toDoThis, forDoingThis);
} else { } else {
return Econ.modifyMoney(fme, - cost, toDoThis, forDoingThis); return Econ.modifyMoney(fme, -cost, toDoThis, forDoingThis);
} }
} }

View File

@ -39,7 +39,7 @@ public class FPromoteCommand extends FCommand {
} }
Role current = target.getRole(); Role current = target.getRole();
Role promotion = Role.getRelative(current, + relative); Role promotion = Role.getRelative(current, +relative);
// Now it ain't that messy // Now it ain't that messy
if (!fme.isAdminBypassing()) { if (!fme.isAdminBypassing()) {

View File

@ -103,9 +103,9 @@ public abstract class FRelationCommand extends FCommand {
} }
private boolean hasMaxRelations(Faction them, Relation targetRelation) { private boolean hasMaxRelations(Faction them, Relation targetRelation) {
int max = SavageFactions.plugin.getConfig().getInt("max-relations." + targetRelation.toString(), - 1); int max = SavageFactions.plugin.getConfig().getInt("max-relations." + targetRelation.toString(), -1);
if (SavageFactions.plugin.getConfig().getBoolean("max-relations.enabled", false)) { if (SavageFactions.plugin.getConfig().getBoolean("max-relations.enabled", false)) {
if (max != - 1) { if (max != -1) {
if (myFaction.getRelationCount(targetRelation) >= max) { if (myFaction.getRelationCount(targetRelation) >= max) {
msg(TL.COMMAND_RELATIONS_EXCEEDS_ME, max, targetRelation.getPluralTranslation()); msg(TL.COMMAND_RELATIONS_EXCEEDS_ME, max, targetRelation.getPluralTranslation());
return true; return true;

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

@ -141,7 +141,7 @@ public class Econ {
// The amount must be positive. // The amount must be positive.
// If the amount is negative we must flip and multiply amount with -1. // If the amount is negative we must flip and multiply amount with -1.
if (amount < 0) { if (amount < 0) {
amount *= - 1; amount *= -1;
EconomyParticipator temp = from; EconomyParticipator temp = from;
from = to; from = to;
to = temp; to = temp;
@ -308,7 +308,7 @@ public class Econ {
// The account might not have enough space // The account might not have enough space
EconomyResponse er = econ.depositPlayer(acc, delta); EconomyResponse er = econ.depositPlayer(acc, delta);
if (er.transactionSuccess()) { if (er.transactionSuccess()) {
modifyUniverseMoney(- delta); modifyUniverseMoney(-delta);
if (forDoingThis != null && !forDoingThis.isEmpty()) { if (forDoingThis != null && !forDoingThis.isEmpty()) {
ep.msg("<h>%s<i> gained <h>%s<i> %s.", You, moneyString(delta), forDoingThis); ep.msg("<h>%s<i> gained <h>%s<i> %s.", You, moneyString(delta), forDoingThis);
} }
@ -324,17 +324,17 @@ public class Econ {
// The player should loose money // The player should loose money
// The player might not have enough. // The player might not have enough.
if (econ.has(acc, - delta) && econ.withdrawPlayer(acc, - delta).transactionSuccess()) { if (econ.has(acc, -delta) && econ.withdrawPlayer(acc, -delta).transactionSuccess()) {
// There is enough money to pay // There is enough money to pay
modifyUniverseMoney(- delta); modifyUniverseMoney(-delta);
if (forDoingThis != null && !forDoingThis.isEmpty()) { if (forDoingThis != null && !forDoingThis.isEmpty()) {
ep.msg("<h>%s<i> lost <h>%s<i> %s.", You, moneyString(- delta), forDoingThis); ep.msg("<h>%s<i> lost <h>%s<i> %s.", You, moneyString(-delta), forDoingThis);
} }
return true; return true;
} else { } else {
// There was not enough money to pay // There was not enough money to pay
if (toDoThis != null && !toDoThis.isEmpty()) { if (toDoThis != null && !toDoThis.isEmpty()) {
ep.msg("<h>%s<i> can't afford <h>%s<i> %s.", You, moneyString(- delta), toDoThis); ep.msg("<h>%s<i> can't afford <h>%s<i> %s.", You, moneyString(-delta), toDoThis);
} }
return false; return false;
} }
@ -410,7 +410,7 @@ public class Econ {
public static boolean modifyBalance(String account, double amount) { public static boolean modifyBalance(String account, double amount) {
if (amount < 0) { if (amount < 0) {
return econ.withdrawPlayer(account, - amount).transactionSuccess(); return econ.withdrawPlayer(account, -amount).transactionSuccess();
} else { } else {
return econ.depositPlayer(account, amount).transactionSuccess(); return econ.depositPlayer(account, amount).transactionSuccess();
} }

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;
@ -63,7 +64,7 @@ public class EngineDynmap {
} }
public static String getHtmlPlayerName(FPlayer fplayer) { public static String getHtmlPlayerName(FPlayer fplayer) {
return fplayer != null ? escapeHtml(fplayer.getName()):"none"; return fplayer != null ? escapeHtml(fplayer.getName()) : "none";
} }
public static String escapeHtml(String string) { public static String escapeHtml(String string) {

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;
@ -150,7 +149,7 @@ public class FactionsBlockListener implements Listener {
return true; return true;
} }
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onBlockPlace(BlockPlaceEvent event) { public void onBlockPlace(BlockPlaceEvent event) {
if (!event.canBuild()) { if (!event.canBuild()) {
return; return;
@ -166,7 +165,7 @@ public class FactionsBlockListener implements Listener {
} }
} }
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onBlockFromTo(BlockFromToEvent event) { public void onBlockFromTo(BlockFromToEvent event) {
if (!Conf.handleExploitLiquidFlow) { if (!Conf.handleExploitLiquidFlow) {
return; return;
@ -190,14 +189,14 @@ public class FactionsBlockListener implements Listener {
} }
} }
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onBlockDamage(BlockDamageEvent event) { public void onBlockDamage(BlockDamageEvent event) {
if (event.getInstaBreak() && !playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "destroy", false)) { if (event.getInstaBreak() && !playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "destroy", false)) {
event.setCancelled(true); event.setCancelled(true);
} }
} }
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onBlockPistonExtend(BlockPistonExtendEvent event) { public void onBlockPistonExtend(BlockPistonExtendEvent event) {
if (!Conf.pistonProtectionThroughDenyBuild) { if (!Conf.pistonProtectionThroughDenyBuild) {
return; return;
@ -304,7 +303,7 @@ public class FactionsBlockListener implements Listener {
} }
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onBlockPistonRetract(BlockPistonRetractEvent event) { public void onBlockPistonRetract(BlockPistonRetractEvent event) {
// if not a sticky piston, retraction should be fine // if not a sticky piston, retraction should be fine
if (!event.isSticky() || !Conf.pistonProtectionThroughDenyBuild) { if (!event.isSticky() || !Conf.pistonProtectionThroughDenyBuild) {
@ -439,7 +438,7 @@ public class FactionsBlockListener implements Listener {
} }
} }
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onFrostWalker(EntityBlockFormEvent event) { public void onFrostWalker(EntityBlockFormEvent event) {
if (event.getEntity() == null || event.getEntity().getType() != EntityType.PLAYER || event.getBlock() == null) { if (event.getEntity() == null || event.getEntity().getType() != EntityType.PLAYER || event.getBlock() == null) {
return; return;
@ -485,7 +484,7 @@ public class FactionsBlockListener implements Listener {
return !rel.confDenyBuild(otherFaction.hasPlayersOnline()); return !rel.confDenyBuild(otherFaction.hasPlayersOnline());
} }
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onBlockBreak(BlockBreakEvent event) { public void onBlockBreak(BlockBreakEvent event) {
if (!playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "destroy", false)) { if (!playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "destroy", false)) {
event.setCancelled(true); event.setCancelled(true);
@ -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

@ -20,7 +20,7 @@ import java.util.logging.Level;
public class FactionsChatListener implements Listener { public class FactionsChatListener implements Listener {
// this is for handling slashless command usage and faction/alliance chat, set at lowest priority so Factions gets to them first // this is for handling slashless command usage and faction/alliance chat, set at lowest priority so Factions gets to them first
@EventHandler (priority = EventPriority.LOW, ignoreCancelled = true) @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onPlayerEarlyChat(AsyncPlayerChatEvent event) { public void onPlayerEarlyChat(AsyncPlayerChatEvent event) {
Player talkingPlayer = event.getPlayer(); Player talkingPlayer = event.getPlayer();
String msg = event.getMessage(); String msg = event.getMessage();
@ -127,7 +127,7 @@ public class FactionsChatListener implements Listener {
// this is for handling insertion of the player's faction tag, set at highest priority to give other plugins a chance to modify chat first // this is for handling insertion of the player's faction tag, set at highest priority to give other plugins a chance to modify chat first
@EventHandler (priority = EventPriority.HIGHEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlayerChat(AsyncPlayerChatEvent event) { public void onPlayerChat(AsyncPlayerChatEvent event) {
// Are we to insert the Faction tag into the format? // Are we to insert the Faction tag into the format?
// If we are not to insert it - we are done. // If we are not to insert it - we are done.

View File

@ -33,7 +33,7 @@ public class FactionsEntityListener implements Listener {
private static final Set<PotionEffectType> badPotionEffects = new LinkedHashSet<>(Arrays.asList(PotionEffectType.BLINDNESS, PotionEffectType.CONFUSION, PotionEffectType.HARM, PotionEffectType.HUNGER, PotionEffectType.POISON, PotionEffectType.SLOW, PotionEffectType.SLOW_DIGGING, PotionEffectType.WEAKNESS, PotionEffectType.WITHER)); private static final Set<PotionEffectType> badPotionEffects = new LinkedHashSet<>(Arrays.asList(PotionEffectType.BLINDNESS, PotionEffectType.CONFUSION, PotionEffectType.HARM, PotionEffectType.HUNGER, PotionEffectType.POISON, PotionEffectType.SLOW, PotionEffectType.SLOW_DIGGING, PotionEffectType.WEAKNESS, PotionEffectType.WITHER));
@EventHandler (priority = EventPriority.NORMAL) @EventHandler(priority = EventPriority.NORMAL)
public void onEntityDeath(EntityDeathEvent event) { public void onEntityDeath(EntityDeathEvent event) {
Entity entity = event.getEntity(); Entity entity = event.getEntity();
if (!(entity instanceof Player)) { if (!(entity instanceof Player)) {
@ -86,7 +86,7 @@ public class FactionsEntityListener implements Listener {
* Who can I hurt? I can never hurt members or allies. I can always hurt enemies. I can hurt neutrals as long as * Who can I hurt? I can never hurt members or allies. I can always hurt enemies. I can hurt neutrals as long as
* they are outside their own territory. * they are outside their own territory.
*/ */
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onEntityDamage(EntityDamageEvent event) { public void onEntityDamage(EntityDamageEvent event) {
if (event instanceof EntityDamageByEntityEvent) { if (event instanceof EntityDamageByEntityEvent) {
EntityDamageByEntityEvent sub = (EntityDamageByEntityEvent) event; EntityDamageByEntityEvent sub = (EntityDamageByEntityEvent) event;
@ -233,7 +233,7 @@ public class FactionsEntityListener implements Listener {
} }
} }
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onEntityExplode(EntityExplodeEvent event) { public void onEntityExplode(EntityExplodeEvent event) {
Entity boomer = event.getEntity(); Entity boomer = event.getEntity();
@ -270,11 +270,11 @@ public class FactionsEntityListener implements Listener {
// a single surrounding block in all 6 directions is broken if the material is weak enough // a single surrounding block in all 6 directions is broken if the material is weak enough
List<Block> targets = new ArrayList<>(); List<Block> targets = new ArrayList<>();
targets.add(center.getRelative(0, 0, 1)); targets.add(center.getRelative(0, 0, 1));
targets.add(center.getRelative(0, 0, - 1)); targets.add(center.getRelative(0, 0, -1));
targets.add(center.getRelative(0, 1, 0)); targets.add(center.getRelative(0, 1, 0));
targets.add(center.getRelative(0, - 1, 0)); targets.add(center.getRelative(0, -1, 0));
targets.add(center.getRelative(1, 0, 0)); targets.add(center.getRelative(1, 0, 0));
targets.add(center.getRelative(- 1, 0, 0)); targets.add(center.getRelative(-1, 0, 0));
for (Block target : targets) { for (Block target : targets) {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@ -322,7 +322,7 @@ public class FactionsEntityListener implements Listener {
} }
// mainly for flaming arrows; don't want allies or people in safe zones to be ignited even after damage event is cancelled // mainly for flaming arrows; don't want allies or people in safe zones to be ignited even after damage event is cancelled
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onEntityCombustByEntity(EntityCombustByEntityEvent event) { public void onEntityCombustByEntity(EntityCombustByEntityEvent event) {
EntityDamageByEntityEvent sub = new EntityDamageByEntityEvent(event.getCombuster(), event.getEntity(), EntityDamageEvent.DamageCause.FIRE, 0d); EntityDamageByEntityEvent sub = new EntityDamageByEntityEvent(event.getCombuster(), event.getEntity(), EntityDamageEvent.DamageCause.FIRE, 0d);
if (!this.canDamagerHurtDamagee(sub, false)) { if (!this.canDamagerHurtDamagee(sub, false)) {
@ -330,7 +330,7 @@ public class FactionsEntityListener implements Listener {
} }
} }
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPotionSplashEvent(PotionSplashEvent event) { public void onPotionSplashEvent(PotionSplashEvent event) {
// see if the potion has a harmful effect // see if the potion has a harmful effect
boolean badjuju = false; boolean badjuju = false;
@ -544,7 +544,7 @@ public class FactionsEntityListener implements Listener {
return true; return true;
} }
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onCreatureSpawn(CreatureSpawnEvent event) { public void onCreatureSpawn(CreatureSpawnEvent event) {
if (event.getLocation() == null) { if (event.getLocation() == null) {
return; return;
@ -555,7 +555,7 @@ public class FactionsEntityListener implements Listener {
} }
} }
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onEntityTarget(EntityTargetEvent event) { public void onEntityTarget(EntityTargetEvent event) {
// if there is a target // if there is a target
Entity target = event.getTarget(); Entity target = event.getTarget();
@ -574,7 +574,7 @@ public class FactionsEntityListener implements Listener {
} }
} }
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPaintingBreak(HangingBreakEvent event) { public void onPaintingBreak(HangingBreakEvent event) {
if (event.getCause() == RemoveCause.EXPLOSION) { if (event.getCause() == RemoveCause.EXPLOSION) {
Location loc = event.getEntity().getLocation(); Location loc = event.getEntity().getLocation();
@ -610,7 +610,7 @@ public class FactionsEntityListener implements Listener {
} }
} }
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPaintingPlace(HangingPlaceEvent event) { public void onPaintingPlace(HangingPlaceEvent event) {
if (!FactionsBlockListener.playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "place paintings", false)) { if (!FactionsBlockListener.playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), "place paintings", false)) {
event.setCancelled(true); event.setCancelled(true);
@ -619,7 +619,7 @@ public class FactionsEntityListener implements Listener {
} }
} }
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onEntityChangeBlock(EntityChangeBlockEvent event) { public void onEntityChangeBlock(EntityChangeBlockEvent event) {
Entity entity = event.getEntity(); Entity entity = event.getEntity();
@ -715,7 +715,7 @@ public class FactionsEntityListener implements Listener {
} }
// For disabling interactions with item frames in another faction's territory // For disabling interactions with item frames in another faction's territory
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) { public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
// only need to check for item frames // only need to check for item frames
if (event.getRightClicked().getType() != EntityType.ITEM_FRAME) { if (event.getRightClicked().getType() != EntityType.ITEM_FRAME) {
@ -731,7 +731,7 @@ public class FactionsEntityListener implements Listener {
} }
// For disabling interactions with armor stands in another faction's territory // For disabling interactions with armor stands in another faction's territory
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerInteractAtEntity(PlayerInteractAtEntityEvent event) { public void onPlayerInteractAtEntity(PlayerInteractAtEntityEvent event) {
Entity entity = event.getRightClicked(); Entity entity = event.getRightClicked();

View File

@ -19,7 +19,7 @@ public class FactionsExploitListener implements Listener {
} }
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void obsidianGenerator(BlockFromToEvent event) { public void obsidianGenerator(BlockFromToEvent event) {
if (!Conf.handleExploitObsidianGenerators) { if (!Conf.handleExploitObsidianGenerators) {
return; return;
@ -34,7 +34,7 @@ public class FactionsExploitListener implements Listener {
} }
} }
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void enderPearlTeleport(PlayerTeleportEvent event) { public void enderPearlTeleport(PlayerTeleportEvent event) {
if (!Conf.handleExploitEnderPearlClipping) { if (!Conf.handleExploitEnderPearlClipping) {
return; return;

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;
@ -441,7 +443,7 @@ public class FactionsPlayerListener implements Listener {
return false; return false;
} }
@EventHandler (priority = EventPriority.NORMAL) @EventHandler(priority = EventPriority.NORMAL)
public void onPlayerJoin(PlayerJoinEvent event) { public void onPlayerJoin(PlayerJoinEvent event) {
initPlayer(event.getPlayer()); initPlayer(event.getPlayer());
} }
@ -524,7 +526,7 @@ public class FactionsPlayerListener implements Listener {
} }
} }
@EventHandler (priority = EventPriority.NORMAL) @EventHandler(priority = EventPriority.NORMAL)
public void onPlayerQuit(PlayerQuitEvent event) { public void onPlayerQuit(PlayerQuitEvent event) {
FPlayer me = FPlayers.getInstance().getByPlayer(event.getPlayer()); FPlayer me = FPlayers.getInstance().getByPlayer(event.getPlayer());
@ -578,12 +580,12 @@ public class FactionsPlayerListener implements Listener {
me.setFlying(true); me.setFlying(true);
CmdFly.flyMap.put(me.getName(), true); CmdFly.flyMap.put(me.getName(), true);
if (CmdFly.id == - 1) { if (CmdFly.id == -1) {
if (SavageFactions.plugin.getConfig().getBoolean("ffly.Particles.Enabled")) { if (SavageFactions.plugin.getConfig().getBoolean("ffly.Particles.Enabled")) {
CmdFly.startParticles(); CmdFly.startParticles();
} }
} }
if (CmdFly.flyid == - 1) { if (CmdFly.flyid == -1) {
CmdFly.startFlyCheck(); CmdFly.startFlyCheck();
} }
} }
@ -648,13 +650,100 @@ 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";
} }
@EventHandler (priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerMove(PlayerMoveEvent event) { public void onPlayerMove(PlayerMoveEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
FPlayer me = FPlayers.getInstance().getByPlayer(player); FPlayer me = FPlayers.getInstance().getByPlayer(player);
@ -799,7 +888,7 @@ public class FactionsPlayerListener implements Listener {
fme.setInVault(false); fme.setInVault(false);
} }
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerInteract(PlayerInteractEvent event) { public void onPlayerInteract(PlayerInteractEvent event) {
/// Prevents the use of montster eggs in oned land. /// Prevents the use of montster eggs in oned land.
/*if (event.getAction() == Action.RIGHT_CLICK_BLOCK) { /*if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
@ -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();
@ -878,7 +964,7 @@ public class FactionsPlayerListener implements Listener {
} }
} }
@EventHandler (priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
public void onPlayerRespawn(PlayerRespawnEvent event) { public void onPlayerRespawn(PlayerRespawnEvent event) {
FPlayer me = FPlayers.getInstance().getByPlayer(event.getPlayer()); FPlayer me = FPlayers.getInstance().getByPlayer(event.getPlayer());
@ -895,7 +981,7 @@ public class FactionsPlayerListener implements Listener {
// For some reason onPlayerInteract() sometimes misses bucket events depending on distance (something like 2-3 blocks away isn't detected), // For some reason onPlayerInteract() sometimes misses bucket events depending on distance (something like 2-3 blocks away isn't detected),
// but these separate bucket events below always fire without fail // but these separate bucket events below always fire without fail
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event) { public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event) {
Block block = event.getBlockClicked(); Block block = event.getBlockClicked();
Player player = event.getPlayer(); Player player = event.getPlayer();
@ -905,7 +991,7 @@ public class FactionsPlayerListener implements Listener {
} }
} }
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerBucketFill(PlayerBucketFillEvent event) { public void onPlayerBucketFill(PlayerBucketFillEvent event) {
Block block = event.getBlockClicked(); Block block = event.getBlockClicked();
Player player = event.getPlayer(); Player player = event.getPlayer();
@ -915,7 +1001,7 @@ public class FactionsPlayerListener implements Listener {
} }
} }
@EventHandler (priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
public void onPlayerInteractGUI(InventoryClickEvent event) { public void onPlayerInteractGUI(InventoryClickEvent event) {
if (event.getClickedInventory() == null) { if (event.getClickedInventory() == null) {
return; return;
@ -926,14 +1012,14 @@ public class FactionsPlayerListener implements Listener {
} }
} }
@EventHandler (priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
public void onPlayerMoveGUI(InventoryDragEvent event) { public void onPlayerMoveGUI(InventoryDragEvent event) {
if (event.getInventory().getHolder() instanceof FactionGUI) { if (event.getInventory().getHolder() instanceof FactionGUI) {
event.setCancelled(true); event.setCancelled(true);
} }
} }
@EventHandler (priority = EventPriority.NORMAL, ignoreCancelled = true) @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerKick(PlayerKickEvent event) { public void onPlayerKick(PlayerKickEvent event) {
FPlayer badGuy = FPlayers.getInstance().getByPlayer(event.getPlayer()); FPlayer badGuy = FPlayers.getInstance().getByPlayer(event.getPlayer());
if (badGuy == null) { if (badGuy == null) {
@ -951,12 +1037,12 @@ public class FactionsPlayerListener implements Listener {
} }
} }
@EventHandler (priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
final public void onFactionJoin(FPlayerJoinEvent event) { final public void onFactionJoin(FPlayerJoinEvent event) {
FTeamWrapper.applyUpdatesLater(event.getFaction()); FTeamWrapper.applyUpdatesLater(event.getFaction());
} }
@EventHandler (priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onFactionLeave(FPlayerLeaveEvent event) { public void onFactionLeave(FPlayerLeaveEvent event) {
FTeamWrapper.applyUpdatesLater(event.getFaction()); FTeamWrapper.applyUpdatesLater(event.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":
@ -157,7 +157,7 @@ public class ClipPlaceholderAPIManager extends PlaceholderExpansion implements R
return String.valueOf(faction.getMaxVaults()); return String.valueOf(faction.getMaxVaults());
case "faction_name_at_location": case "faction_name_at_location":
Faction factionAtLocation = Board.getInstance().getFactionAt(new FLocation(player.getLocation())); Faction factionAtLocation = Board.getInstance().getFactionAt(new FLocation(player.getLocation()));
return factionAtLocation != null ? factionAtLocation.getTag():Factions.getInstance().getWilderness().getTag(); return factionAtLocation != null ? factionAtLocation.getTag() : Factions.getInstance().getWilderness().getTag();
} }
return null; return null;

View File

@ -37,7 +37,7 @@ public final class EnumTypeAdapter<T extends Enum<T>> extends TypeAdapter<T> {
public static <TT> TypeAdapterFactory newEnumTypeHierarchyFactory() { public static <TT> TypeAdapterFactory newEnumTypeHierarchyFactory() {
return new TypeAdapterFactory() { return new TypeAdapterFactory() {
@SuppressWarnings ({"rawtypes", "unchecked"}) @SuppressWarnings({"rawtypes", "unchecked"})
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> typeToken) { public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> typeToken) {
Class<? super T> rawType = typeToken.getRawType(); Class<? super T> rawType = typeToken.getRawType();
if (!Enum.class.isAssignableFrom(rawType) || rawType == Enum.class) { if (!Enum.class.isAssignableFrom(rawType) || rawType == Enum.class) {

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

@ -12,7 +12,7 @@ import java.io.Serializable;
*/ */
public class LazyLocation implements Serializable { public class LazyLocation implements Serializable {
private static final long serialVersionUID = - 6049901271320963314L; private static final long serialVersionUID = -6049901271320963314L;
private transient Location location = null; private transient Location location = null;
private String worldName; private String worldName;
private double x; private double x;

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

@ -859,7 +859,7 @@ public enum MultiversionMaterials {
ZOMBIE_WALL_HEAD("SKULL", 0), ZOMBIE_WALL_HEAD("SKULL", 0),
; ;
static int newV = - 1; static int newV = -1;
private static HashMap<String, MultiversionMaterials> cachedSearch = new HashMap<>(); private static HashMap<String, MultiversionMaterials> cachedSearch = new HashMap<>();
String m; String m;
int data; int data;
@ -902,7 +902,7 @@ public enum MultiversionMaterials {
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
String[] split = key.split(":"); String[] split = key.split(":");
return split.length == 1 ? requestXMaterial(key, (byte) 0):requestXMaterial(split[0], (byte) Integer.parseInt(split[1])); return split.length == 1 ? requestXMaterial(key, (byte) 0) : requestXMaterial(split[0], (byte) Integer.parseInt(split[1]));
} }
} }
@ -968,7 +968,7 @@ public enum MultiversionMaterials {
public Material parseMaterial() { public Material parseMaterial() {
Material mat = Material.matchMaterial(this.toString()); Material mat = Material.matchMaterial(this.toString());
return mat != null ? mat:Material.matchMaterial(m); return mat != null ? mat : Material.matchMaterial(m);
} }
} }

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
@ -47,7 +47,7 @@ public enum ParticleEffect {
* <li>The speed value influences the velocity at which the particle flies off * <li>The speed value influences the velocity at which the particle flies off
* </ul> * </ul>
*/ */
EXPLOSION_NORMAL("explode", 0, - 1, ParticleProperty.DIRECTIONAL), EXPLOSION_NORMAL("explode", 0, -1, ParticleProperty.DIRECTIONAL),
/** /**
* A particle effect which is displayed by exploding ghast fireballs and wither skulls: * A particle effect which is displayed by exploding ghast fireballs and wither skulls:
* <ul> * <ul>
@ -55,7 +55,7 @@ public enum ParticleEffect {
* <li>The speed value slightly influences the size of this particle effect * <li>The speed value slightly influences the size of this particle effect
* </ul> * </ul>
*/ */
EXPLOSION_LARGE("largeexplode", 1, - 1), EXPLOSION_LARGE("largeexplode", 1, -1),
/** /**
* A particle effect which is displayed by exploding tnt and creepers: * A particle effect which is displayed by exploding tnt and creepers:
* <ul> * <ul>
@ -63,7 +63,7 @@ public enum ParticleEffect {
* <li>The speed value has no influence on this particle effect * <li>The speed value has no influence on this particle effect
* </ul> * </ul>
*/ */
EXPLOSION_HUGE("hugeexplosion", 2, - 1), EXPLOSION_HUGE("hugeexplosion", 2, -1),
/** /**
* A particle effect which is displayed by launching fireworks: * A particle effect which is displayed by launching fireworks:
* <ul> * <ul>
@ -71,7 +71,7 @@ public enum ParticleEffect {
* <li>The speed value influences the velocity at which the particle flies off * <li>The speed value influences the velocity at which the particle flies off
* </ul> * </ul>
*/ */
FIREWORKS_SPARK("fireworksSpark", 3, - 1, ParticleProperty.DIRECTIONAL), FIREWORKS_SPARK("fireworksSpark", 3, -1, ParticleProperty.DIRECTIONAL),
/** /**
* A particle effect which is displayed by swimming entities and arrows in water: * A particle effect which is displayed by swimming entities and arrows in water:
* <ul> * <ul>
@ -79,7 +79,7 @@ public enum ParticleEffect {
* <li>The speed value influences the velocity at which the particle flies off * <li>The speed value influences the velocity at which the particle flies off
* </ul> * </ul>
*/ */
WATER_BUBBLE("bubble", 4, - 1, ParticleProperty.DIRECTIONAL, ParticleProperty.REQUIRES_WATER), WATER_BUBBLE("bubble", 4, -1, ParticleProperty.DIRECTIONAL, ParticleProperty.REQUIRES_WATER),
/** /**
* A particle effect which is displayed by swimming entities and shaking wolves: * A particle effect which is displayed by swimming entities and shaking wolves:
* <ul> * <ul>
@ -87,7 +87,7 @@ public enum ParticleEffect {
* <li>The speed value has no influence on this particle effect * <li>The speed value has no influence on this particle effect
* </ul> * </ul>
*/ */
WATER_SPLASH("splash", 5, - 1, ParticleProperty.DIRECTIONAL), WATER_SPLASH("splash", 5, -1, ParticleProperty.DIRECTIONAL),
/** /**
* A particle effect which is displayed on water when fishing: * A particle effect which is displayed on water when fishing:
* <ul> * <ul>
@ -103,7 +103,7 @@ public enum ParticleEffect {
* <li>The speed value has no influence on this particle effect * <li>The speed value has no influence on this particle effect
* </ul> * </ul>
*/ */
SUSPENDED("suspended", 7, - 1, ParticleProperty.REQUIRES_WATER), SUSPENDED("suspended", 7, -1, ParticleProperty.REQUIRES_WATER),
/** /**
* A particle effect which is displayed by air when close to bedrock and the in the void: * A particle effect which is displayed by air when close to bedrock and the in the void:
* <ul> * <ul>
@ -111,7 +111,7 @@ public enum ParticleEffect {
* <li>The speed value has no influence on this particle effect * <li>The speed value has no influence on this particle effect
* </ul> * </ul>
*/ */
SUSPENDED_DEPTH("depthSuspend", 8, - 1, ParticleProperty.DIRECTIONAL), SUSPENDED_DEPTH("depthSuspend", 8, -1, ParticleProperty.DIRECTIONAL),
/** /**
* A particle effect which is displayed when landing a critical hit and by arrows: * A particle effect which is displayed when landing a critical hit and by arrows:
* <ul> * <ul>
@ -119,7 +119,7 @@ public enum ParticleEffect {
* <li>The speed value influences the velocity at which the particle flies off * <li>The speed value influences the velocity at which the particle flies off
* </ul> * </ul>
*/ */
CRIT("crit", 9, - 1, ParticleProperty.DIRECTIONAL), CRIT("crit", 9, -1, ParticleProperty.DIRECTIONAL),
/** /**
* A particle effect which is displayed when landing a hit with an enchanted weapon: * A particle effect which is displayed when landing a hit with an enchanted weapon:
* <ul> * <ul>
@ -127,7 +127,7 @@ public enum ParticleEffect {
* <li>The speed value influences the velocity at which the particle flies off * <li>The speed value influences the velocity at which the particle flies off
* </ul> * </ul>
*/ */
CRIT_MAGIC("magicCrit", 10, - 1, ParticleProperty.DIRECTIONAL), CRIT_MAGIC("magicCrit", 10, -1, ParticleProperty.DIRECTIONAL),
/** /**
* A particle effect which is displayed by primed tnt, torches, droppers, dispensers, end portals, brewing stands and monster spawners: * A particle effect which is displayed by primed tnt, torches, droppers, dispensers, end portals, brewing stands and monster spawners:
* <ul> * <ul>
@ -135,7 +135,7 @@ public enum ParticleEffect {
* <li>The speed value influences the velocity at which the particle flies off * <li>The speed value influences the velocity at which the particle flies off
* </ul> * </ul>
*/ */
SMOKE_NORMAL("smoke", 11, - 1, ParticleProperty.DIRECTIONAL), SMOKE_NORMAL("smoke", 11, -1, ParticleProperty.DIRECTIONAL),
/** /**
* A particle effect which is displayed by fire, minecarts with furnace and blazes: * A particle effect which is displayed by fire, minecarts with furnace and blazes:
* <ul> * <ul>
@ -143,7 +143,7 @@ public enum ParticleEffect {
* <li>The speed value influences the velocity at which the particle flies off * <li>The speed value influences the velocity at which the particle flies off
* </ul> * </ul>
*/ */
SMOKE_LARGE("largesmoke", 12, - 1, ParticleProperty.DIRECTIONAL), SMOKE_LARGE("largesmoke", 12, -1, ParticleProperty.DIRECTIONAL),
/** /**
* A particle effect which is displayed when splash potions or bottles o' enchanting hit something: * A particle effect which is displayed when splash potions or bottles o' enchanting hit something:
* <ul> * <ul>
@ -152,7 +152,7 @@ public enum ParticleEffect {
* <li>Only the motion on the y-axis can be controlled, the motion on the x- and z-axis are multiplied by 0.1 when setting the values to 0 * <li>Only the motion on the y-axis can be controlled, the motion on the x- and z-axis are multiplied by 0.1 when setting the values to 0
* </ul> * </ul>
*/ */
SPELL("spell", 13, - 1), SPELL("spell", 13, -1),
/** /**
* A particle effect which is displayed when instant splash potions hit something: * A particle effect which is displayed when instant splash potions hit something:
* <ul> * <ul>
@ -161,7 +161,7 @@ public enum ParticleEffect {
* <li>Only the motion on the y-axis can be controlled, the motion on the x- and z-axis are multiplied by 0.1 when setting the values to 0 * <li>Only the motion on the y-axis can be controlled, the motion on the x- and z-axis are multiplied by 0.1 when setting the values to 0
* </ul> * </ul>
*/ */
SPELL_INSTANT("instantSpell", 14, - 1), SPELL_INSTANT("instantSpell", 14, -1),
/** /**
* A particle effect which is displayed by entities with active potion effects: * A particle effect which is displayed by entities with active potion effects:
* <ul> * <ul>
@ -170,7 +170,7 @@ public enum ParticleEffect {
* <li>The particle color gets lighter when increasing the speed and darker when decreasing the speed * <li>The particle color gets lighter when increasing the speed and darker when decreasing the speed
* </ul> * </ul>
*/ */
SPELL_MOB("mobSpell", 15, - 1, ParticleProperty.COLORABLE), SPELL_MOB("mobSpell", 15, -1, ParticleProperty.COLORABLE),
/** /**
* A particle effect which is displayed by entities with active potion effects applied through a beacon: * A particle effect which is displayed by entities with active potion effects applied through a beacon:
* <ul> * <ul>
@ -179,7 +179,7 @@ public enum ParticleEffect {
* <li>The particle color gets lighter when increasing the speed and darker when decreasing the speed * <li>The particle color gets lighter when increasing the speed and darker when decreasing the speed
* </ul> * </ul>
*/ */
SPELL_MOB_AMBIENT("mobSpellAmbient", 16, - 1, ParticleProperty.COLORABLE), SPELL_MOB_AMBIENT("mobSpellAmbient", 16, -1, ParticleProperty.COLORABLE),
/** /**
* A particle effect which is displayed by witches: * A particle effect which is displayed by witches:
* <ul> * <ul>
@ -188,7 +188,7 @@ public enum ParticleEffect {
* <li>Only the motion on the y-axis can be controlled, the motion on the x- and z-axis are multiplied by 0.1 when setting the values to 0 * <li>Only the motion on the y-axis can be controlled, the motion on the x- and z-axis are multiplied by 0.1 when setting the values to 0
* </ul> * </ul>
*/ */
SPELL_WITCH("witchMagic", 17, - 1), SPELL_WITCH("witchMagic", 17, -1),
/** /**
* A particle effect which is displayed by blocks beneath a water source: * A particle effect which is displayed by blocks beneath a water source:
* <ul> * <ul>
@ -196,7 +196,7 @@ public enum ParticleEffect {
* <li>The speed value has no influence on this particle effect * <li>The speed value has no influence on this particle effect
* </ul> * </ul>
*/ */
DRIP_WATER("dripWater", 18, - 1), DRIP_WATER("dripWater", 18, -1),
/** /**
* A particle effect which is displayed by blocks beneath a lava source: * A particle effect which is displayed by blocks beneath a lava source:
* <ul> * <ul>
@ -204,7 +204,7 @@ public enum ParticleEffect {
* <li>The speed value has no influence on this particle effect * <li>The speed value has no influence on this particle effect
* </ul> * </ul>
*/ */
DRIP_LAVA("dripLava", 19, - 1), DRIP_LAVA("dripLava", 19, -1),
/** /**
* A particle effect which is displayed when attacking a villager in a village: * A particle effect which is displayed when attacking a villager in a village:
* <ul> * <ul>
@ -212,7 +212,7 @@ public enum ParticleEffect {
* <li>The speed value has no influence on this particle effect * <li>The speed value has no influence on this particle effect
* </ul> * </ul>
*/ */
VILLAGER_ANGRY("angryVillager", 20, - 1), VILLAGER_ANGRY("angryVillager", 20, -1),
/** /**
* A particle effect which is displayed when using bone meal and trading with a villager in a village: * A particle effect which is displayed when using bone meal and trading with a villager in a village:
* <ul> * <ul>
@ -220,7 +220,7 @@ public enum ParticleEffect {
* <li>The speed value has no influence on this particle effect * <li>The speed value has no influence on this particle effect
* </ul> * </ul>
*/ */
VILLAGER_HAPPY("happyVillager", 21, - 1, ParticleProperty.DIRECTIONAL), VILLAGER_HAPPY("happyVillager", 21, -1, ParticleProperty.DIRECTIONAL),
/** /**
* A particle effect which is displayed by mycelium: * A particle effect which is displayed by mycelium:
* <ul> * <ul>
@ -228,7 +228,7 @@ public enum ParticleEffect {
* <li>The speed value has no influence on this particle effect * <li>The speed value has no influence on this particle effect
* </ul> * </ul>
*/ */
TOWN_AURA("townaura", 22, - 1, ParticleProperty.DIRECTIONAL), TOWN_AURA("townaura", 22, -1, ParticleProperty.DIRECTIONAL),
/** /**
* A particle effect which is displayed by note blocks: * A particle effect which is displayed by note blocks:
* <ul> * <ul>
@ -236,7 +236,7 @@ public enum ParticleEffect {
* <li>The speed value causes the particle to be colored green when set to 0 * <li>The speed value causes the particle to be colored green when set to 0
* </ul> * </ul>
*/ */
NOTE("note", 23, - 1, ParticleProperty.COLORABLE), NOTE("note", 23, -1, ParticleProperty.COLORABLE),
/** /**
* A particle effect which is displayed by nether portals, endermen, ender pearls, eyes of ender, ender chests and dragon eggs: * A particle effect which is displayed by nether portals, endermen, ender pearls, eyes of ender, ender chests and dragon eggs:
* <ul> * <ul>
@ -244,7 +244,7 @@ public enum ParticleEffect {
* <li>The speed value influences the spread of this particle effect * <li>The speed value influences the spread of this particle effect
* </ul> * </ul>
*/ */
PORTAL("portal", 24, - 1, ParticleProperty.DIRECTIONAL), PORTAL("portal", 24, -1, ParticleProperty.DIRECTIONAL),
/** /**
* A particle effect which is displayed by enchantment tables which are nearby bookshelves: * A particle effect which is displayed by enchantment tables which are nearby bookshelves:
* <ul> * <ul>
@ -252,7 +252,7 @@ public enum ParticleEffect {
* <li>The speed value influences the spread of this particle effect * <li>The speed value influences the spread of this particle effect
* </ul> * </ul>
*/ */
ENCHANTMENT_TABLE("enchantmenttable", 25, - 1, ParticleProperty.DIRECTIONAL), ENCHANTMENT_TABLE("enchantmenttable", 25, -1, ParticleProperty.DIRECTIONAL),
/** /**
* A particle effect which is displayed by torches, active furnaces, magma cubes and monster spawners: * A particle effect which is displayed by torches, active furnaces, magma cubes and monster spawners:
* <ul> * <ul>
@ -260,7 +260,7 @@ public enum ParticleEffect {
* <li>The speed value influences the velocity at which the particle flies off * <li>The speed value influences the velocity at which the particle flies off
* </ul> * </ul>
*/ */
FLAME("flame", 26, - 1, ParticleProperty.DIRECTIONAL), FLAME("flame", 26, -1, ParticleProperty.DIRECTIONAL),
/** /**
* A particle effect which is displayed by lava: * A particle effect which is displayed by lava:
* <ul> * <ul>
@ -268,7 +268,7 @@ public enum ParticleEffect {
* <li>The speed value has no influence on this particle effect * <li>The speed value has no influence on this particle effect
* </ul> * </ul>
*/ */
LAVA("lava", 27, - 1), LAVA("lava", 27, -1),
/** /**
* A particle effect which is currently unused: * A particle effect which is currently unused:
* <ul> * <ul>
@ -276,7 +276,7 @@ public enum ParticleEffect {
* <li>The speed value has no influence on this particle effect * <li>The speed value has no influence on this particle effect
* </ul> * </ul>
*/ */
FOOTSTEP("footstep", 28, - 1), FOOTSTEP("footstep", 28, -1),
/** /**
* A particle effect which is displayed when a mob dies: * A particle effect which is displayed when a mob dies:
* <ul> * <ul>
@ -284,7 +284,7 @@ public enum ParticleEffect {
* <li>The speed value influences the velocity at which the particle flies off * <li>The speed value influences the velocity at which the particle flies off
* </ul> * </ul>
*/ */
CLOUD("cloud", 29, - 1, ParticleProperty.DIRECTIONAL), CLOUD("cloud", 29, -1, ParticleProperty.DIRECTIONAL),
/** /**
* A particle effect which is displayed by redstone ore, powered redstone, redstone torches and redstone repeaters: * A particle effect which is displayed by redstone ore, powered redstone, redstone torches and redstone repeaters:
* <ul> * <ul>
@ -292,7 +292,7 @@ public enum ParticleEffect {
* <li>The speed value causes the particle to be colored red when set to 0 * <li>The speed value causes the particle to be colored red when set to 0
* </ul> * </ul>
*/ */
REDSTONE("reddust", 30, - 1, ParticleProperty.COLORABLE), REDSTONE("reddust", 30, -1, ParticleProperty.COLORABLE),
/** /**
* A particle effect which is displayed when snowballs hit a block: * A particle effect which is displayed when snowballs hit a block:
* <ul> * <ul>
@ -300,7 +300,7 @@ public enum ParticleEffect {
* <li>The speed value has no influence on this particle effect * <li>The speed value has no influence on this particle effect
* </ul> * </ul>
*/ */
SNOWBALL("snowballpoof", 31, - 1), SNOWBALL("snowballpoof", 31, -1),
/** /**
* A particle effect which is currently unused: * A particle effect which is currently unused:
* <ul> * <ul>
@ -308,7 +308,7 @@ public enum ParticleEffect {
* <li>The speed value influences the velocity at which the particle flies off * <li>The speed value influences the velocity at which the particle flies off
* </ul> * </ul>
*/ */
SNOW_SHOVEL("snowshovel", 32, - 1, ParticleProperty.DIRECTIONAL), SNOW_SHOVEL("snowshovel", 32, -1, ParticleProperty.DIRECTIONAL),
/** /**
* A particle effect which is displayed by slimes: * A particle effect which is displayed by slimes:
* <ul> * <ul>
@ -316,7 +316,7 @@ public enum ParticleEffect {
* <li>The speed value has no influence on this particle effect * <li>The speed value has no influence on this particle effect
* </ul> * </ul>
*/ */
SLIME("slime", 33, - 1), SLIME("slime", 33, -1),
/** /**
* A particle effect which is displayed when breeding and taming animals: * A particle effect which is displayed when breeding and taming animals:
* <ul> * <ul>
@ -324,7 +324,7 @@ public enum ParticleEffect {
* <li>The speed value has no influence on this particle effect * <li>The speed value has no influence on this particle effect
* </ul> * </ul>
*/ */
HEART("heart", 34, - 1), HEART("heart", 34, -1),
/** /**
* A particle effect which is displayed by barriers: * A particle effect which is displayed by barriers:
* <ul> * <ul>
@ -339,7 +339,7 @@ public enum ParticleEffect {
* <li>It looks like a little piece with an item texture * <li>It looks like a little piece with an item texture
* </ul> * </ul>
*/ */
ITEM_CRACK("iconcrack", 36, - 1, ParticleProperty.DIRECTIONAL, ParticleProperty.REQUIRES_DATA), ITEM_CRACK("iconcrack", 36, -1, ParticleProperty.DIRECTIONAL, ParticleProperty.REQUIRES_DATA),
/** /**
* A particle effect which is displayed when breaking blocks or sprinting: * A particle effect which is displayed when breaking blocks or sprinting:
* <ul> * <ul>
@ -347,7 +347,7 @@ public enum ParticleEffect {
* <li>The speed value has no influence on this particle effect * <li>The speed value has no influence on this particle effect
* </ul> * </ul>
*/ */
BLOCK_CRACK("blockcrack", 37, - 1, ParticleProperty.REQUIRES_DATA), BLOCK_CRACK("blockcrack", 37, -1, ParticleProperty.REQUIRES_DATA),
/** /**
* A particle effect which is displayed when falling: * A particle effect which is displayed when falling:
* <ul> * <ul>
@ -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
*/ */
@ -538,7 +537,7 @@ public enum ParticleEffect {
* @return Whether the particle effect is supported or not * @return Whether the particle effect is supported or not
*/ */
public boolean isSupported() { public boolean isSupported() {
if (requiredVersion == - 1) { if (requiredVersion == -1) {
return true; return true;
} }
return ParticlePacket.getVersion() >= requiredVersion; return ParticlePacket.getVersion() >= requiredVersion;
@ -946,7 +945,7 @@ public enum ParticleEffect {
* @param material Material of the item/block * @param material Material of the item/block
* @param data Data value of the item/block * @param data Data value of the item/block
*/ */
@SuppressWarnings ("deprecation") @SuppressWarnings("deprecation")
public ParticleData(Material material, byte data) { public ParticleData(Material material, byte data) {
this.material = material; this.material = material;
this.data = data; this.data = data;
@ -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

@ -27,7 +27,7 @@ public abstract class SpiralTask implements Runnable {
// general task-related reference data // general task-related reference data
private transient World world = null; private transient World world = null;
private transient boolean readyToGo = false; private transient boolean readyToGo = false;
private transient int taskID = - 1; private transient int taskID = -1;
private transient int limit = 0; private transient int limit = 0;
// values for the spiral pattern routine // values for the spiral pattern routine
@ -35,10 +35,10 @@ public abstract class SpiralTask implements Runnable {
private transient int z = 0; private transient int z = 0;
private transient boolean isZLeg = false; private transient boolean isZLeg = false;
private transient boolean isNeg = false; private transient boolean isNeg = false;
private transient int length = - 1; private transient int length = -1;
private transient int current = 0; private transient int current = 0;
@SuppressWarnings ("LeakingThisInConstructor") @SuppressWarnings("LeakingThisInConstructor")
public SpiralTask(FLocation fLocation, int radius) { public SpiralTask(FLocation fLocation, int radius) {
// limit is determined based on spiral leg length for given radius; see insideRadius() // limit is determined based on spiral leg length for given radius; see insideRadius()
this.limit = (radius - 1) * 2; this.limit = (radius - 1) * 2;
@ -103,7 +103,7 @@ public abstract class SpiralTask implements Runnable {
} }
public final void setTaskID(int ID) { public final void setTaskID(int ID) {
if (ID == - 1) { if (ID == -1) {
this.stop(); this.stop();
} }
taskID = ID; taskID = ID;
@ -169,9 +169,9 @@ public abstract class SpiralTask implements Runnable {
// move one chunk further in the appropriate direction // move one chunk further in the appropriate direction
if (isZLeg) { if (isZLeg) {
z += (isNeg) ? - 1 : 1; z += (isNeg) ? -1 : 1;
} else { } else {
x += (isNeg) ? - 1 : 1; x += (isNeg) ? -1 : 1;
} }
return true; return true;
@ -199,11 +199,11 @@ public abstract class SpiralTask implements Runnable {
readyToGo = false; readyToGo = false;
Bukkit.getServer().getScheduler().cancelTask(taskID); Bukkit.getServer().getScheduler().cancelTask(taskID);
taskID = - 1; taskID = -1;
} }
// is this task still valid/workable? // is this task still valid/workable?
public final boolean valid() { public final boolean valid() {
return taskID != - 1; return taskID != -1;
} }
} }

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

@ -24,20 +24,20 @@ public class VisualizeUtil {
return ret; return ret;
} }
@SuppressWarnings ("deprecation") @SuppressWarnings("deprecation")
public static void addLocation(Player player, Location location, Material type, byte data) { public static void addLocation(Player player, Location location, Material type, byte data) {
getPlayerLocations(player).add(location); getPlayerLocations(player).add(location);
player.sendBlockChange(location, type, data); player.sendBlockChange(location, type, data);
} }
@SuppressWarnings ("deprecation") @SuppressWarnings("deprecation")
public static void addLocation(Player player, Location location, Material material) { public static void addLocation(Player player, Location location, Material material) {
getPlayerLocations(player).add(location); getPlayerLocations(player).add(location);
player.sendBlockChange(location, material, (byte) 0); player.sendBlockChange(location, material, (byte) 0);
} }
@SuppressWarnings ("deprecation") @SuppressWarnings("deprecation")
public static void addLocations(Player player, Collection<Location> locations, Material material) { public static void addLocations(Player player, Collection<Location> locations, Material material) {
Set<Location> ploc = getPlayerLocations(player); Set<Location> ploc = getPlayerLocations(player);
for (Location location : locations) { for (Location location : locations) {
@ -46,7 +46,7 @@ public class VisualizeUtil {
} }
} }
@SuppressWarnings ("deprecation") @SuppressWarnings("deprecation")
public static void addBlocks(Player player, Collection<Block> blocks, Material material) { public static void addBlocks(Player player, Collection<Block> blocks, Material material) {
Set<Location> ploc = getPlayerLocations(player); Set<Location> ploc = getPlayerLocations(player);
for (Block block : blocks) { for (Block block : blocks) {
@ -56,7 +56,7 @@ public class VisualizeUtil {
} }
} }
@SuppressWarnings ("deprecation") @SuppressWarnings("deprecation")
public static void clear(Player player) { public static void clear(Player player) {
Set<Location> locations = getPlayerLocations(player); Set<Location> locations = getPlayerLocations(player);
if (locations == null) { if (locations == null) {

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

@ -140,9 +140,9 @@ public class WarpGUI implements InventoryHolder, FactionGUI {
} }
if (Conf.bankEnabled && Conf.bankFactionPaysCosts && fme.hasFaction()) { if (Conf.bankEnabled && Conf.bankFactionPaysCosts && fme.hasFaction()) {
return Econ.modifyMoney(fme.getFaction(), - cost, TL.COMMAND_FWARP_TOWARP.toString(), TL.COMMAND_FWARP_FORWARPING.toString()); return Econ.modifyMoney(fme.getFaction(), -cost, TL.COMMAND_FWARP_TOWARP.toString(), TL.COMMAND_FWARP_FORWARPING.toString());
} else { } else {
return Econ.modifyMoney(fme, - cost, TL.COMMAND_FWARP_TOWARP.toString(), TL.COMMAND_FWARP_FORWARPING.toString()); return Econ.modifyMoney(fme, -cost, TL.COMMAND_FWARP_TOWARP.toString(), TL.COMMAND_FWARP_FORWARPING.toString());
} }
} }

View File

@ -76,7 +76,7 @@ public abstract class MCommand<T extends MPlugin> {
} }
public String getHelpShort() { public String getHelpShort() {
return this.helpShort != null ? this.helpShort:getUsageTranslation().toString(); return this.helpShort != null ? this.helpShort : getUsageTranslation().toString();
} }
public void setHelpShort(String val) { public void setHelpShort(String val) {
@ -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

@ -123,7 +123,7 @@ public abstract class MPlugin extends JavaPlugin {
int read; int read;
byte[] bytes = new byte[1024]; byte[] bytes = new byte[1024];
while ((read = defLangStream.read(bytes)) != - 1) { while ((read = defLangStream.read(bytes)) != -1) {
out.write(bytes, 0, read); out.write(bytes, 0, read);
} }
YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(new BufferedReader(new InputStreamReader(defLangStream))); YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(new BufferedReader(new InputStreamReader(defLangStream)));

View File

@ -18,7 +18,7 @@ public class MPluginSecretPlayerListener implements Listener {
this.p = p; this.p = p;
} }
@EventHandler (priority = EventPriority.LOW, ignoreCancelled = true) @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) { public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
if (FactionsPlayerListener.preventCommand(event.getMessage(), event.getPlayer())) { if (FactionsPlayerListener.preventCommand(event.getMessage(), event.getPlayer())) {
if (p.logPlayerCommands()) { if (p.logPlayerCommands()) {
@ -28,7 +28,7 @@ public class MPluginSecretPlayerListener implements Listener {
} }
} }
@EventHandler (priority = EventPriority.LOW, ignoreCancelled = true) @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onPlayerChat(AsyncPlayerChatEvent event) { public void onPlayerChat(AsyncPlayerChatEvent event) {
if (p.handleCommand(event.getPlayer(), event.getMessage(), false, true)) { if (p.handleCommand(event.getPlayer(), event.getMessage(), false, true)) {
if (p.logPlayerCommands()) { if (p.logPlayerCommands()) {
@ -45,7 +45,7 @@ public class MPluginSecretPlayerListener implements Listener {
*/ */
} }
@EventHandler (priority = EventPriority.LOWEST) @EventHandler(priority = EventPriority.LOWEST)
public void onPlayerPreLogin(PlayerLoginEvent event) { public void onPlayerPreLogin(PlayerLoginEvent event) {
FPlayers.getInstance().getByPlayer(event.getPlayer()); FPlayers.getInstance().getByPlayer(event.getPlayer());
} }

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

@ -58,7 +58,7 @@ public class PermissableActionGUI implements InventoryHolder, FactionGUI {
boolean disabled = false; boolean disabled = false;
for (String key : section.getConfigurationSection("slots").getKeys(false)) { for (String key : section.getConfigurationSection("slots").getKeys(false)) {
int slot = section.getInt("slots." + key); int slot = section.getInt("slots." + key);
if (slot == - 1) { if (slot == -1) {
disabled = true; disabled = true;
continue; continue;
} }
@ -97,7 +97,7 @@ public class PermissableActionGUI implements InventoryHolder, FactionGUI {
actionSlots.put(slot, action); actionSlots.put(slot, action);
} else { } else {
int slot = actionGUI.firstEmpty(); int slot = actionGUI.firstEmpty();
if (slot != - 1) { if (slot != -1) {
actionSlots.put(slot, action); actionSlots.put(slot, action);
} }
} }

View File

@ -58,7 +58,7 @@ public class PermissableRelationGUI implements InventoryHolder, FactionGUI {
for (String key : section.getConfigurationSection("slots").getKeys(false)) { for (String key : section.getConfigurationSection("slots").getKeys(false)) {
int slot = section.getInt("slots." + key); int slot = section.getInt("slots." + key);
if (slot == - 1) { if (slot == -1) {
continue; continue;
} }
if (slot + 1 > guiSize && slot > 0) { if (slot + 1 > guiSize && slot > 0) {

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);
@ -59,15 +63,14 @@ public class CropUpgrades implements Listener {
if (below.getType() == SavageFactions.plugin.SUGAR_CANE_BLOCK) { if (below.getType() == SavageFactions.plugin.SUGAR_CANE_BLOCK) {
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) {
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) {
above.setType(Material.CACTUS); above.setType(Material.CACTUS);
} }
} }

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

@ -115,7 +115,7 @@ public class NBTList {
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
} }
return - 1; return -1;
} }
public NBTType getType() { public NBTType getType() {

View File

@ -81,7 +81,7 @@ public class NBTListCompound {
return false; return false;
} }
@SuppressWarnings ("unchecked") @SuppressWarnings("unchecked")
public Set<String> getKeys() { public Set<String> getKeys() {
try { try {
return (Set<String>) compound.getClass().getMethod("c").invoke(compound); return (Set<String>) compound.getClass().getMethod("c").invoke(compound);

View File

@ -271,7 +271,7 @@ public class NBTReflectionUtil {
Method method = c.getMethod(MethodNames.getEntityNbtGetterMethodName(), getNBTTagCompound()); Method method = c.getMethod(MethodNames.getEntityNbtGetterMethodName(), getNBTTagCompound());
Object nbt = getNBTTagCompound().newInstance(); Object nbt = getNBTTagCompound().newInstance();
Object answer = method.invoke(nmsitem, nbt); Object answer = method.invoke(nmsitem, nbt);
return answer != null ? answer:nbt; return answer != null ? answer : nbt;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -300,7 +300,7 @@ public class NBTReflectionUtil {
Object tag = getNBTTagCompound().newInstance(); Object tag = getNBTTagCompound().newInstance();
Object answer = method.invoke(o, tag); Object answer = method.invoke(o, tag);
return answer != null ? answer:tag; return answer != null ? answer : tag;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -864,7 +864,7 @@ public class NBTReflectionUtil {
if (!MinecraftVersion.hasGsonSupport()) return null; if (!MinecraftVersion.hasGsonSupport()) return null;
String json = getString(comp, key); String json = getString(comp, key);
return json != null ? GsonWrapper.deserializeJson(json, type):null; return json != null ? GsonWrapper.deserializeJson(json, type) : null;
} }
public static void remove(NBTCompound comp, String key) { public static void remove(NBTCompound comp, String key) {
@ -901,7 +901,7 @@ public class NBTReflectionUtil {
return null; return null;
} }
@SuppressWarnings ("unchecked") @SuppressWarnings("unchecked")
public static Set<String> getKeys(NBTCompound comp) { public static Set<String> getKeys(NBTCompound comp) {
Object rootnbttag = comp.getCompound(); Object rootnbttag = comp.getCompound();
if (rootnbttag == null) { if (rootnbttag == null) {

View File

@ -5,11 +5,11 @@ public class MethodNames {
private final static MinecraftVersion MINECRAFT_VERSION = MinecraftVersion.getVersion(); private final static MinecraftVersion MINECRAFT_VERSION = MinecraftVersion.getVersion();
public static String getTileDataMethodName() { public static String getTileDataMethodName() {
return MINECRAFT_VERSION == MinecraftVersion.MC1_8_R3 ? "b":"save"; return MINECRAFT_VERSION == MinecraftVersion.MC1_8_R3 ? "b" : "save";
} }
public static String getTypeMethodName() { public static String getTypeMethodName() {
return MINECRAFT_VERSION == MinecraftVersion.MC1_8_R3 ? "b":"d"; return MINECRAFT_VERSION == MinecraftVersion.MC1_8_R3 ? "b" : "d";
} }
public static String getEntityNbtGetterMethodName() { public static String getEntityNbtGetterMethodName() {
@ -21,6 +21,6 @@ public class MethodNames {
} }
public static String getRemoveMethodName() { public static String getRemoveMethodName() {
return MINECRAFT_VERSION == MinecraftVersion.MC1_8_R3 ? "a":"remove"; return MINECRAFT_VERSION == MinecraftVersion.MC1_8_R3 ? "a" : "remove";
} }
} }

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

@ -111,18 +111,18 @@ public abstract class MemoryBoard extends Board {
public boolean isBorderLocation(FLocation flocation) { public boolean isBorderLocation(FLocation flocation) {
Faction faction = getFactionAt(flocation); Faction faction = getFactionAt(flocation);
FLocation a = flocation.getRelative(1, 0); FLocation a = flocation.getRelative(1, 0);
FLocation b = flocation.getRelative(- 1, 0); FLocation b = flocation.getRelative(-1, 0);
FLocation c = flocation.getRelative(0, 1); FLocation c = flocation.getRelative(0, 1);
FLocation d = flocation.getRelative(0, - 1); FLocation d = flocation.getRelative(0, -1);
return faction != getFactionAt(a) || faction != getFactionAt(b) || faction != getFactionAt(c) || faction != getFactionAt(d); return faction != getFactionAt(a) || faction != getFactionAt(b) || faction != getFactionAt(c) || faction != getFactionAt(d);
} }
// Is this coord connected to any coord claimed by the specified faction? // Is this coord connected to any coord claimed by the specified faction?
public boolean isConnectedLocation(FLocation flocation, Faction faction) { public boolean isConnectedLocation(FLocation flocation, Faction faction) {
FLocation a = flocation.getRelative(1, 0); FLocation a = flocation.getRelative(1, 0);
FLocation b = flocation.getRelative(- 1, 0); FLocation b = flocation.getRelative(-1, 0);
FLocation c = flocation.getRelative(0, 1); FLocation c = flocation.getRelative(0, 1);
FLocation d = flocation.getRelative(0, - 1); FLocation d = flocation.getRelative(0, -1);
return faction == getFactionAt(a) || faction == getFactionAt(b) || faction == getFactionAt(c) || faction == getFactionAt(d); return faction == getFactionAt(a) || faction == getFactionAt(b) || faction == getFactionAt(c) || faction == getFactionAt(d);
} }
@ -136,8 +136,8 @@ public abstract class MemoryBoard extends Board {
* @return true if another Faction is within the radius, otherwise false. * @return true if another Faction is within the radius, otherwise false.
*/ */
public boolean hasFactionWithin(FLocation flocation, Faction faction, int radius) { public boolean hasFactionWithin(FLocation flocation, Faction faction, int radius) {
for (int x = - radius; x <= radius; x++) { for (int x = -radius; x <= radius; x++) {
for (int z = - radius; z <= radius; z++) { for (int z = -radius; z <= radius; z++) {
if (x == 0 && z == 0) { if (x == 0 && z == 0) {
continue; continue;
} }
@ -210,7 +210,7 @@ public abstract class MemoryBoard extends Board {
int halfWidth = Conf.mapWidth / 2; int halfWidth = Conf.mapWidth / 2;
// Use player's value for height // Use player's value for height
int halfHeight = fplayer.getMapHeight() / 2; int halfHeight = fplayer.getMapHeight() / 2;
FLocation topLeft = flocation.getRelative(- halfWidth, - halfHeight); FLocation topLeft = flocation.getRelative(-halfWidth, -halfHeight);
int width = halfWidth * 2 + 1; int width = halfWidth * 2 + 1;
int height = halfHeight * 2 + 1; int height = halfHeight * 2 + 1;
@ -345,7 +345,7 @@ public abstract class MemoryBoard extends Board {
public abstract void convertFrom(MemoryBoard old); public abstract void convertFrom(MemoryBoard old);
public class MemoryBoardMap extends HashMap<FLocation, String> { public class MemoryBoardMap extends HashMap<FLocation, String> {
private static final long serialVersionUID = - 6689617828610585368L; private static final long serialVersionUID = -6689617828610585368L;
Multimap<String, FLocation> factionToLandMap = HashMultimap.create(); Multimap<String, FLocation> factionToLandMap = HashMultimap.create();

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;
@ -576,13 +572,13 @@ public abstract class MemoryFPlayer implements FPlayer {
if (this.power - loss < Conf.powerOfflineLossLimit) { if (this.power - loss < Conf.powerOfflineLossLimit) {
loss = this.power; loss = this.power;
} }
this.alterPower(- loss); this.alterPower(-loss);
} }
} }
public void onDeath() { public void onDeath() {
this.updatePower(); this.updatePower();
this.alterPower(- Conf.powerPerDeath); this.alterPower(-Conf.powerPerDeath);
if (hasFaction()) { if (hasFaction()) {
getFaction().setLastDeath(System.currentTimeMillis()); getFaction().setLastDeath(System.currentTimeMillis());
} }
@ -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;
@ -1017,14 +1021,14 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
// no members left and faction isn't permanent, so disband it // no members left and faction isn't permanent, so disband it
if (Conf.logFactionDisband) { if (Conf.logFactionDisband) {
SavageFactions.plugin.log("The faction " + this.getTag() + " (" + this.getId() + ") has been disbanded since it has no members left" + (autoLeave ? " and by inactivity":"")+ "."); SavageFactions.plugin.log("The faction " + this.getTag() + " (" + this.getId() + ") has been disbanded since it has no members left" + (autoLeave ? " and by inactivity" : "") + ".");
} }
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) { for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
fplayer.msg("The faction %s<i> was disbanded.", this.getTag(fplayer)); fplayer.msg("The faction %s<i> was disbanded.", this.getTag(fplayer));
} }
FactionDisbandEvent disbandEvent = new FactionDisbandEvent(null, getId(), autoLeave ? PlayerDisbandReason.INACTIVITY:PlayerDisbandReason.LEAVE); FactionDisbandEvent disbandEvent = new FactionDisbandEvent(null, getId(), autoLeave ? PlayerDisbandReason.INACTIVITY : PlayerDisbandReason.LEAVE);
Bukkit.getPluginManager().callEvent(disbandEvent); Bukkit.getPluginManager().callEvent(disbandEvent);
Factions.getInstance().removeFaction(getId()); Factions.getInstance().removeFaction(getId());

View File

@ -36,14 +36,14 @@ public class PermUtil {
public String getPermissionDescription(String perm) { public String getPermissionDescription(String perm) {
String desc = permissionDescriptions.get(perm); String desc = permissionDescriptions.get(perm);
return desc != null ? desc:TL.GENERIC_DOTHAT.toString(); return desc != null ? desc : TL.GENERIC_DOTHAT.toString();
} }
/** /**
* 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

@ -130,12 +130,12 @@ public class Persist {
// LOAD BY TYPE // LOAD BY TYPE
@SuppressWarnings ("unchecked") @SuppressWarnings("unchecked")
public <T> T load(Type typeOfT, String name) { public <T> T load(Type typeOfT, String name) {
return (T) load(typeOfT, getFile(name)); return (T) load(typeOfT, getFile(name));
} }
@SuppressWarnings ("unchecked") @SuppressWarnings("unchecked")
public <T> T load(Type typeOfT, File file) { public <T> T load(Type typeOfT, File file) {
String content = DiscUtil.readCatch(file); String content = DiscUtil.readCatch(file);
if (content == null) { if (content == null) {

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!"),
@ -1013,7 +1014,7 @@ public enum TL {
@Override @Override
public String toString() { public String toString() {
return ChatColor.translateAlternateColorCodes('&', LANG.getString(this.path, def)) + (this == TITLE ? " ":""); return ChatColor.translateAlternateColorCodes('&', LANG.getString(this.path, def)) + (this == TITLE ? " " : "");
} }
public String format(Object... args) { public String format(Object... args) {

View File

@ -147,7 +147,7 @@ public class TagUtil {
String s = otherFaction.getTag(fme); String s = otherFaction.getTag(fme);
if (otherFaction.getRelationTo(target).isAlly()) { if (otherFaction.getRelationTo(target).isAlly()) {
currentAllies.then(firstAlly ? s : ", " + s); currentAllies.then(firstAlly ? s : ", " + s);
currentAllies.tooltip(tipFaction(otherFaction)).color(fme != null ? fme.getColorTo(otherFaction):Relation.NEUTRAL.getColor()); currentAllies.tooltip(tipFaction(otherFaction)).color(fme != null ? fme.getColorTo(otherFaction) : Relation.NEUTRAL.getColor());
firstAlly = false; firstAlly = false;
if (currentAllies.toJSONString().length() > ARBITRARY_LIMIT) { if (currentAllies.toJSONString().length() > ARBITRARY_LIMIT) {
fancyMessages.add(currentAllies); fancyMessages.add(currentAllies);
@ -167,7 +167,7 @@ public class TagUtil {
String s = otherFaction.getTag(fme); String s = otherFaction.getTag(fme);
if (otherFaction.getRelationTo(target).isEnemy()) { if (otherFaction.getRelationTo(target).isEnemy()) {
currentEnemies.then(firstEnemy ? s : ", " + s); currentEnemies.then(firstEnemy ? s : ", " + s);
currentEnemies.tooltip(tipFaction(otherFaction)).color(fme != null ? fme.getColorTo(otherFaction):Relation.NEUTRAL.getColor()); currentEnemies.tooltip(tipFaction(otherFaction)).color(fme != null ? fme.getColorTo(otherFaction) : Relation.NEUTRAL.getColor());
firstEnemy = false; firstEnemy = false;
if (currentEnemies.toJSONString().length() > ARBITRARY_LIMIT) { if (currentEnemies.toJSONString().length() > ARBITRARY_LIMIT) {
fancyMessages.add(currentEnemies); fancyMessages.add(currentEnemies);
@ -187,7 +187,7 @@ public class TagUtil {
String s = otherFaction.getTag(fme); String s = otherFaction.getTag(fme);
if (otherFaction.getRelationTo(target).isTruce()) { if (otherFaction.getRelationTo(target).isTruce()) {
currentTruces.then(firstTruce ? s : ", " + s); currentTruces.then(firstTruce ? s : ", " + s);
currentTruces.tooltip(tipFaction(otherFaction)).color(fme != null ? fme.getColorTo(otherFaction):Relation.NEUTRAL.getColor()); currentTruces.tooltip(tipFaction(otherFaction)).color(fme != null ? fme.getColorTo(otherFaction) : Relation.NEUTRAL.getColor());
firstTruce = false; firstTruce = false;
if (currentTruces.toJSONString().length() > ARBITRARY_LIMIT) { if (currentTruces.toJSONString().length() > ARBITRARY_LIMIT) {
fancyMessages.add(currentTruces); fancyMessages.add(currentTruces);
@ -206,7 +206,7 @@ public class TagUtil {
} }
String name = p.getNameAndTitle(); String name = p.getNameAndTitle();
currentOnline.then(firstOnline ? name : ", " + name); currentOnline.then(firstOnline ? name : ", " + name);
currentOnline.tooltip(tipPlayer(p)).color(fme != null ? fme.getColorTo(p):Relation.NEUTRAL.getColor()); currentOnline.tooltip(tipPlayer(p)).color(fme != null ? fme.getColorTo(p) : Relation.NEUTRAL.getColor());
firstOnline = false; firstOnline = false;
if (currentOnline.toJSONString().length() > ARBITRARY_LIMIT) { if (currentOnline.toJSONString().length() > ARBITRARY_LIMIT) {
fancyMessages.add(currentOnline); fancyMessages.add(currentOnline);
@ -223,7 +223,7 @@ public class TagUtil {
// Also make sure to add players that are online BUT can't be seen. // Also make sure to add players that are online BUT can't be seen.
if (!p.isOnline() || (fme != null && fme.getPlayer() != null && !fme.getPlayer().canSee(p.getPlayer()))) { if (!p.isOnline() || (fme != null && fme.getPlayer() != null && !fme.getPlayer().canSee(p.getPlayer()))) {
currentOffline.then(firstOffline ? name : ", " + name); currentOffline.then(firstOffline ? name : ", " + name);
currentOffline.tooltip(tipPlayer(p)).color(fme != null ? fme.getColorTo(p):Relation.NEUTRAL.getColor()); currentOffline.tooltip(tipPlayer(p)).color(fme != null ? fme.getColorTo(p) : Relation.NEUTRAL.getColor());
firstOffline = false; firstOffline = false;
if (currentOffline.toJSONString().length() > ARBITRARY_LIMIT) { if (currentOffline.toJSONString().length() > ARBITRARY_LIMIT) {
fancyMessages.add(currentOffline); fancyMessages.add(currentOffline);

View File

@ -16,7 +16,7 @@ public class TextUtil {
// -------------------------------------------- // // -------------------------------------------- //
// Top-level parsing functions. // Top-level parsing functions.
// -------------------------------------------- // // -------------------------------------------- //
private final static int titleizeBalance = - 1; private final static int titleizeBalance = -1;
public Map<String, String> tags; public Map<String, String> tags;
// -------------------------------------------- // // -------------------------------------------- //
@ -122,7 +122,7 @@ public class TextUtil {
for (int i = 0; i < list.size(); i++) for (int i = 0; i < list.size(); i++)
ret.append(glue).append(list.get(i)); ret.append(glue).append(list.get(i));
return ret.length() > 0 ? ret.toString().substring(glue.length()):""; return ret.length() > 0 ? ret.toString().substring(glue.length()) : "";
} }
// -------------------------------------------- // // -------------------------------------------- //
@ -130,7 +130,7 @@ public class TextUtil {
// -------------------------------------------- // // -------------------------------------------- //
public static String repeat(String s, int times) { public static String repeat(String s, int times) {
return times > 0 ? s + repeat(s, times - 1):""; return times > 0 ? s + repeat(s, times - 1) : "";
} }
public static String getMaterialName(Material material) { public static String getMaterialName(Material material) {

View File

@ -275,26 +275,26 @@ hcf:
# SUPPORTS PLACEHOLDERS # SUPPORTS PLACEHOLDERS
show: show:
# First line can be {header} for default header, or any string (we recommend &m for smooth lines ;plugin) # First line can be {header} for default header, or any string (we recommend &m for smooth lines ;plugin)
- '&8&m--------------&7 &8<&e{faction}&8> &8&m--------------' - '&8&m--------------&7 &8<&e{faction}&8> &8&m--------------'
- '&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 * &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}'
- '&6 * &eEnemies &c{enemies-list}' - '&6 * &eEnemies &c{enemies-list}'
- '&6 * &eOnline Members &8(&7{online}/{members}&8) &7{online-list}' - '&6 * &eOnline Members &8(&7{online}/{members}&8) &7{online-list}'
- '&6 * &eOffline Members &8(&7{offline}/{members}&8) &7{offline-list}' - '&6 * &eOffline Members &8(&7{offline}/{members}&8) &7{offline-list}'
- '&6 * &eBans &7{faction-bancount}' - '&6 * &eBans &7{faction-bancount}'
- '&8&m----------------------------------------' - '&8&m----------------------------------------'
# For a /f show that does not display fancy messages that are essentially empty, use minimal-show # For a /f show that does not display fancy messages that are essentially empty, use minimal-show
minimal-show: false minimal-show: false
# Factions that should be exempt from /f show, case sensitive, useful for a # Factions that should be exempt from /f show, case sensitive, useful for a
# serverteam faction, since the command shows vanished players otherwise # serverteam faction, since the command shows vanished players otherwise
show-exempt: show-exempt:
- Wilderness - Wilderness
# THIS IS FOR /f map tool tips. # THIS IS FOR /f map tool tips.
@ -302,14 +302,14 @@ show-exempt:
# You can use any variable here, including fancy messages. Color codes and or tags work fine. # You can use any variable here, including fancy messages. Color codes and or tags work fine.
# Lines that arent defined wont be sent (home not set, faction not peaceful / permanent, dtr freeze) # Lines that arent defined wont be sent (home not set, faction not peaceful / permanent, dtr freeze)
map: map:
# First line can be {header} for default header, or any string (we recommend &m for smooth lines ;plugin) # First line can be {header} for default header, or any string (we recommend &m for smooth lines ;plugin)
- '&6* &eFaction &7{faction}' - '&6* &eFaction &7{faction}'
- '&6* &eOwner &7{leader}' - '&6* &eOwner &7{leader}'
- '&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* &eAllies &c{allies-list}' - '&6* &eAllies &c{allies-list}'
- '&6* &eEnemies &c{enemies-list}' - '&6* &eEnemies &c{enemies-list}'
- '&6* &eOnline Members &8(&7{online}/{members}&8) {online-list}' - '&6* &eOnline Members &8(&7{online}/{members}&8) {online-list}'
- '&6* &eOffline Members &7{offline-list}' - '&6* &eOffline Members &7{offline-list}'
############################################################ ############################################################
# +------------------------------------------------------+ # # +------------------------------------------------------+ #
@ -629,11 +629,12 @@ fperm-gui:
name: ' ' name: ' '
lore: lore:
- -
############################################################
# +------------------------------------------------------+ # ############################################################
# | Faction Warp GUI | # # +------------------------------------------------------+ #
# +------------------------------------------------------+ # # | Faction Warp GUI | #
############################################################ # +------------------------------------------------------+ #
############################################################
fwarp-gui: fwarp-gui:
name: "Faction Warps" name: "Faction Warps"
@ -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: