Code Cleanup & Fix With Fly Unclaiming
This commit is contained in:
parent
3e530487d7
commit
e84c69f2b0
@ -57,7 +57,7 @@ public class CmdAdmin extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if(fyou.isAlt()){
|
||||
if (fyou.isAlt()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ public class CmdAdmin extends FCommand {
|
||||
FactionsPlugin.instance.getFlogManager().log(targetFaction, FLogType.RANK_EDIT, context.fPlayer.getName(), fyou.getName(), ChatColor.RED + "Admin");
|
||||
|
||||
// Inform all players
|
||||
if(FactionsPlugin.instance.getConfig().getBoolean("faction-leader-broadcast")) {
|
||||
if (FactionsPlugin.instance.getConfig().getBoolean("faction-leader-broadcast")) {
|
||||
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
|
||||
fplayer.msg(TL.COMMAND_ADMIN_PROMOTED, context.player == null ? TL.GENERIC_SERVERADMIN.toString() : context.fPlayer.describeTo(fplayer, true), fyou.describeTo(fplayer), targetFaction.describeTo(fplayer));
|
||||
}
|
||||
|
@ -8,15 +8,13 @@ import com.massivecraft.factions.zcore.fperms.Access;
|
||||
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
|
||||
public class CmdCheckpoint extends FCommand
|
||||
{
|
||||
public class CmdCheckpoint extends FCommand {
|
||||
|
||||
/**
|
||||
* @author Illyria Team
|
||||
*/
|
||||
|
||||
public CmdCheckpoint()
|
||||
{
|
||||
public CmdCheckpoint() {
|
||||
super();
|
||||
this.aliases.addAll(Aliases.checkpoint);
|
||||
|
||||
@ -32,8 +30,7 @@ public class CmdCheckpoint extends FCommand
|
||||
return;
|
||||
}
|
||||
if (context.args.size() == 1 && context.args.get(0).equalsIgnoreCase("set")) {
|
||||
if (context.fPlayer.getRole() == Role.LEADER)
|
||||
{
|
||||
if (context.fPlayer.getRole() == Role.LEADER) {
|
||||
FLocation myLocation = new FLocation(context.player.getLocation());
|
||||
Faction myLocFaction = Board.getInstance().getFactionAt(myLocation);
|
||||
if (myLocFaction == Factions.getInstance().getWilderness() || myLocFaction == context.faction) {
|
||||
@ -51,16 +48,14 @@ public class CmdCheckpoint extends FCommand
|
||||
if (access == Access.DENY) {
|
||||
context.msg(TL.GENERIC_FPERM_NOPERMISSION, action.getName());
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
FLocation myLocation = new FLocation(context.player.getLocation());
|
||||
Faction myLocFaction = Board.getInstance().getFactionAt(myLocation);
|
||||
if (myLocFaction == Factions.getInstance().getWilderness() || myLocFaction == context.faction) {
|
||||
context.faction.setCheckpoint(context.player.getLocation());
|
||||
context.msg(TL.COMMAND_CHECKPOINT_SET);
|
||||
return;
|
||||
}else {
|
||||
} else {
|
||||
context.msg(TL.COMMAND_CHECKPOINT_INVALIDLOCATION);
|
||||
return;
|
||||
}
|
||||
@ -86,8 +81,7 @@ public class CmdCheckpoint extends FCommand
|
||||
}
|
||||
|
||||
@Override
|
||||
public TL getUsageTranslation()
|
||||
{
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_CHECKPOINT_DESCRIPTION;
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ public class CmdColeader extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if(you.isAlt()){
|
||||
if (you.isAlt()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ public class CmdCreate extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if(Cooldown.isOnCooldown(context.fPlayer.getPlayer(), "createCooldown") && !context.fPlayer.isAdminBypassing()){
|
||||
if (Cooldown.isOnCooldown(context.fPlayer.getPlayer(), "createCooldown") && !context.fPlayer.isAdminBypassing()) {
|
||||
context.msg(TL.COMMAND_COOLDOWN);
|
||||
return;
|
||||
}
|
||||
|
@ -3,10 +3,7 @@ package com.massivecraft.factions.cmd;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.zcore.fperms.Access;
|
||||
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import mkremins.fanciful.FancyMessage;
|
||||
@ -56,6 +53,7 @@ public class CmdDeinvite extends FCommand {
|
||||
|
||||
context.faction.msg(TL.COMMAND_DEINVITE_REVOKES, context.fPlayer.describeTo(context.faction), you.describeTo(context.faction));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_DEINVITE_DESCRIPTION;
|
||||
|
@ -70,7 +70,7 @@ public class CmdDisband extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if(Cooldown.isOnCooldown(context.fPlayer.getPlayer(), "disbandCooldown") && !context.fPlayer.isAdminBypassing()){
|
||||
if (Cooldown.isOnCooldown(context.fPlayer.getPlayer(), "disbandCooldown") && !context.fPlayer.isAdminBypassing()) {
|
||||
context.msg(TL.COMMAND_COOLDOWN);
|
||||
return;
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class CmdFly extends FCommand {
|
||||
|
||||
public static final boolean fly = FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight");
|
||||
/**
|
||||
* @author FactionsUUID Team
|
||||
*/
|
||||
@ -27,8 +28,6 @@ public class CmdFly extends FCommand {
|
||||
public static ConcurrentHashMap<String, Boolean> flyMap = new ConcurrentHashMap<>();
|
||||
public static BukkitTask particleTask = null;
|
||||
|
||||
public static final boolean fly = FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight");
|
||||
|
||||
|
||||
public CmdFly() {
|
||||
super();
|
||||
@ -65,25 +64,25 @@ public class CmdFly extends FCommand {
|
||||
|
||||
if (toFac != fme.getFaction()) {
|
||||
if (!me.hasPermission(Permission.FLY_WILDERNESS.node) && toFac.isWilderness() || !me.hasPermission(Permission.FLY_SAFEZONE.node) && toFac.isSafeZone() || !me.hasPermission(Permission.FLY_WARZONE.node) && toFac.isWarZone()) {
|
||||
if(sendMessage) fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme));
|
||||
if (sendMessage) fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme));
|
||||
return false;
|
||||
}
|
||||
Access access = toFac.getAccess(fme, PermissableAction.FLY);
|
||||
if ((!(me.hasPermission(Permission.FLY_ENEMY.node) || access == Access.ALLOW)) && toFac.getRelationTo(fme.getFaction()) == Relation.ENEMY) {
|
||||
if(sendMessage) fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme));
|
||||
if (sendMessage) fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme));
|
||||
return false;
|
||||
}
|
||||
if (!(me.hasPermission(Permission.FLY_ALLY.node) || access == Access.ALLOW) && toFac.getRelationTo(fme.getFaction()) == Relation.ALLY) {
|
||||
if(sendMessage) fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme));
|
||||
if (sendMessage) fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme));
|
||||
return false;
|
||||
}
|
||||
if (!(me.hasPermission(Permission.FLY_TRUCE.node) || access == Access.ALLOW) && toFac.getRelationTo(fme.getFaction()) == Relation.TRUCE) {
|
||||
if(sendMessage) fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme));
|
||||
if (sendMessage) fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(me.hasPermission(Permission.FLY_NEUTRAL.node) || access == Access.ALLOW) && toFac.getRelationTo(fme.getFaction()) == Relation.NEUTRAL && !toFac.isSystemFaction()) {
|
||||
if(sendMessage) fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme));
|
||||
if (sendMessage) fme.msg(TL.COMMAND_FLY_NO_ACCESS, toFac.getTag(fme));
|
||||
return false;
|
||||
}
|
||||
return me.hasPermission(Permission.FLY_FLY.node) && (access != Access.DENY || toFac.isSystemFaction());
|
||||
|
@ -11,7 +11,7 @@ import com.massivecraft.factions.zcore.util.TL;
|
||||
*/
|
||||
public class CmdFriendlyFire extends FCommand {
|
||||
|
||||
public CmdFriendlyFire(){
|
||||
public CmdFriendlyFire() {
|
||||
super();
|
||||
this.aliases.addAll(Aliases.friendlyFire);
|
||||
|
||||
@ -23,12 +23,12 @@ public class CmdFriendlyFire extends FCommand {
|
||||
|
||||
@Override
|
||||
public void perform(CommandContext context) {
|
||||
if(!Conf.friendlyFireFPlayersCommand){
|
||||
if (!Conf.friendlyFireFPlayersCommand) {
|
||||
context.msg(TL.GENERIC_DISABLED, "friendly fire");
|
||||
return;
|
||||
}
|
||||
|
||||
if(context.fPlayer.hasFriendlyFire()){
|
||||
if (context.fPlayer.hasFriendlyFire()) {
|
||||
context.fPlayer.setFriendlyFire(false);
|
||||
context.msg(TL.COMMAND_FRIENDLY_FIRE_TOGGLE_OFF);
|
||||
} else {
|
||||
|
@ -9,7 +9,6 @@ import com.massivecraft.factions.util.CC;
|
||||
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import mkremins.fanciful.FancyMessage;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
public class CmdInvite extends FCommand {
|
||||
|
||||
|
@ -1,19 +1,12 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.*;
|
||||
import com.massivecraft.factions.cmd.audit.FLogType;
|
||||
import com.massivecraft.factions.discord.Discord;
|
||||
import com.massivecraft.factions.event.FPlayerJoinEvent;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.util.CC;
|
||||
import com.massivecraft.factions.zcore.frame.fupgrades.UpgradeType;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import net.dv8tion.jda.core.entities.Member;
|
||||
import net.dv8tion.jda.core.exceptions.HierarchyException;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class CmdJoin extends FCommand {
|
||||
|
||||
public CmdJoin() {
|
||||
|
@ -1,6 +1,9 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.*;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
import com.massivecraft.factions.cmd.audit.FLogType;
|
||||
import com.massivecraft.factions.event.FPlayerLeaveEvent;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
@ -125,7 +128,7 @@ public class CmdKick extends FCommand {
|
||||
FactionsPlugin.instance.logFactionEvent(toKickFaction, FLogType.INVITES, context.fPlayer.getName(), CC.Red + "kicked", toKick.getName());
|
||||
toKickFaction.deinvite(toKick);
|
||||
toKick.resetFactionData();
|
||||
if(!CmdFly.checkBypassPerms(toKick, toKick.getPlayer(), toKickFaction, false)){
|
||||
if (!CmdFly.checkBypassPerms(toKick, toKick.getPlayer(), toKickFaction, false)) {
|
||||
CmdFly.disableFlight(toKick);
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ public class CmdMod extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if(you.isAlt()){
|
||||
if (you.isAlt()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ public class CmdOpen extends FCommand {
|
||||
|
||||
String open = context.faction.getOpen() ? TL.COMMAND_OPEN_OPEN.toString() : TL.COMMAND_OPEN_CLOSED.toString();
|
||||
|
||||
if(Cooldown.isOnCooldown(context.fPlayer.getPlayer(), "openCooldown") && !context.fPlayer.isAdminBypassing()){
|
||||
if (Cooldown.isOnCooldown(context.fPlayer.getPlayer(), "openCooldown") && !context.fPlayer.isAdminBypassing()) {
|
||||
context.msg(TL.COMMAND_COOLDOWN);
|
||||
return;
|
||||
}
|
||||
@ -51,7 +51,7 @@ public class CmdOpen extends FCommand {
|
||||
Cooldown.setCooldown(fplayer.getPlayer(), "openCooldown", FactionsPlugin.getInstance().getConfig().getInt("fcooldowns.f-open"));
|
||||
continue;
|
||||
}
|
||||
if(FactionsPlugin.getInstance().getConfig().getBoolean("faction-open-broadcast")) return;
|
||||
if (FactionsPlugin.getInstance().getConfig().getBoolean("faction-open-broadcast")) return;
|
||||
fplayer.msg(TL.COMMAND_OPEN_CHANGED, context.faction.getTag(fplayer.getFaction()), open);
|
||||
}
|
||||
});
|
||||
|
@ -54,7 +54,7 @@ public class CmdTag extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if(Cooldown.isOnCooldown(context.player, "tagCooldown") && !context.fPlayer.isAdminBypassing()){
|
||||
if (Cooldown.isOnCooldown(context.player, "tagCooldown") && !context.fPlayer.isAdminBypassing()) {
|
||||
context.msg(TL.COMMAND_COOLDOWN);
|
||||
return;
|
||||
}
|
||||
@ -72,7 +72,6 @@ public class CmdTag extends FCommand {
|
||||
}
|
||||
|
||||
|
||||
|
||||
String oldtag = context.faction.getTag();
|
||||
context.faction.setTag(tag);
|
||||
|
||||
|
@ -5,7 +5,6 @@ import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.zcore.fperms.Access;
|
||||
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import org.bukkit.Material;
|
||||
|
||||
public class CmdUnban extends FCommand {
|
||||
|
||||
|
@ -83,10 +83,13 @@ public class CmdUnclaim extends FCommand {
|
||||
this.stop();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
boolean didUnClaim = unClaim(new FLocation(context.player), context);
|
||||
if (didUnClaim && !context.fPlayer.canFlyAtLocation())
|
||||
context.fPlayer.setFFlying(false, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -57,15 +57,9 @@ public class CmdUnclaimall extends FCommand {
|
||||
}
|
||||
if (Econ.shouldBeUsed()) {
|
||||
double refund = Econ.calculateTotalLandRefund(target.getLandRounded());
|
||||
if (Conf.bankEnabled && Conf.bankFactionPaysLandCosts) {
|
||||
if (!Econ.modifyMoney(target, refund, TL.COMMAND_UNCLAIMALL_TOUNCLAIM.toString(), TL.COMMAND_UNCLAIMALL_FORUNCLAIM.toString())) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (!Econ.modifyMoney(target, refund, TL.COMMAND_UNCLAIMALL_TOUNCLAIM.toString(), TL.COMMAND_UNCLAIMALL_FORUNCLAIM.toString())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LandUnclaimAllEvent unclaimAllEvent = new LandUnclaimAllEvent(target, context.fPlayer);
|
||||
|
@ -37,7 +37,7 @@ public class CmdGrace extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if(context.args.size() == 1) {
|
||||
if (context.args.size() == 1) {
|
||||
if (context.sender.hasPermission(String.valueOf(Permission.GRACETOGGLE))) {
|
||||
if (context.argAsString(0).equalsIgnoreCase("on") || context.argAsString(0).equalsIgnoreCase("start")) {
|
||||
FactionsPlugin.getInstance().getTimerManager().graceTimer.setPaused(false);
|
||||
@ -61,7 +61,7 @@ public class CmdGrace extends FCommand {
|
||||
}
|
||||
}
|
||||
|
||||
if(FactionsPlugin.getInstance().getTimerManager().graceTimer.getRemaining() <= 0L) {
|
||||
if (FactionsPlugin.getInstance().getTimerManager().graceTimer.getRemaining() <= 0L) {
|
||||
context.fPlayer.msg(TL.COMMAND_GRACE_DISABLED_NO_FORMAT.toString());
|
||||
} else {
|
||||
context.fPlayer.msg(TL.COMMAND_GRACE_TIME_REMAINING, String.valueOf(TimerManager.getRemaining(FactionsPlugin.getInstance().getTimerManager().graceTimer.getRemaining(), true)));
|
||||
|
@ -41,7 +41,7 @@ public abstract class FRelationCommand extends FCommand {
|
||||
Faction them = context.argAsFaction(0);
|
||||
if (them == null) return;
|
||||
|
||||
if(!context.faction.isNormal()) return;
|
||||
if (!context.faction.isNormal()) return;
|
||||
|
||||
if (!them.isNormal()) {
|
||||
context.msg(TL.COMMAND_RELATIONS_ALLTHENOPE);
|
||||
|
@ -74,7 +74,7 @@ public class FPromoteCommand extends FCommand {
|
||||
}
|
||||
}
|
||||
|
||||
if(target.isAlt()){
|
||||
if (target.isAlt()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,8 @@ public class Econ {
|
||||
}
|
||||
econ = rsp.getProvider();
|
||||
FactionsPlugin.getInstance().log("Economy integration through Vault plugin successful.");
|
||||
if (!Conf.econEnabled) FactionsPlugin.getInstance().log("NOTE: Economy is disabled. You can enable it with the command: f config econEnabled true");
|
||||
if (!Conf.econEnabled)
|
||||
FactionsPlugin.getInstance().log("NOTE: Economy is disabled. You can enable it with the command: f config econEnabled true");
|
||||
//FactionsPlugin.getInstance().cmdBase.cmdHelp.updateHelp();
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,14 +1,13 @@
|
||||
package com.massivecraft.factions.integration.dynmap;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.dynmap.markers.AreaMarker;
|
||||
import org.dynmap.markers.MarkerSet;
|
||||
|
||||
public class TempAreaMarker
|
||||
{
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TempAreaMarker {
|
||||
|
||||
/**
|
||||
* @author FactionsUUID Team
|
||||
@ -22,45 +21,34 @@ public class TempAreaMarker
|
||||
public String world;
|
||||
public double[] x;
|
||||
public double[] z;
|
||||
|
||||
private List<List<Point>> polyLine = new ArrayList<List<Point>>();
|
||||
|
||||
public String description;
|
||||
|
||||
public int lineColor;
|
||||
public double lineOpacity;
|
||||
public int lineWeight;
|
||||
|
||||
public int fillColor;
|
||||
public double fillOpacity;
|
||||
|
||||
public boolean boost;
|
||||
private List<List<Point>> polyLine = new ArrayList<List<Point>>();
|
||||
|
||||
// -------------------------------------------- //
|
||||
// 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();
|
||||
|
||||
if (x.length != length)
|
||||
{
|
||||
if (x.length != length) {
|
||||
return false;
|
||||
}
|
||||
if (z.length != length)
|
||||
{
|
||||
if (z.length != length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
if (marker.getCornerX(i) != x[i])
|
||||
{
|
||||
for (int i = 0; i < length; i++) {
|
||||
if (marker.getCornerX(i) != x[i]) {
|
||||
return false;
|
||||
}
|
||||
if (marker.getCornerZ(i) != z[i])
|
||||
{
|
||||
if (marker.getCornerZ(i) != z[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -68,27 +56,23 @@ public class TempAreaMarker
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setPolyLine(List<List<Point>> points)
|
||||
{
|
||||
polyLine.clear();
|
||||
polyLine.addAll(points);
|
||||
public List<List<Point>> getPolyLine() {
|
||||
return polyLine;
|
||||
}
|
||||
|
||||
public List<List<Point>> getPolyLine()
|
||||
{
|
||||
return polyLine;
|
||||
public void setPolyLine(List<List<Point>> points) {
|
||||
polyLine.clear();
|
||||
polyLine.addAll(points);
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// UPDATE
|
||||
// -------------------------------------------- //
|
||||
|
||||
public AreaMarker create(MarkerSet markerset, String markerId)
|
||||
{
|
||||
public AreaMarker create(MarkerSet markerset, String markerId) {
|
||||
AreaMarker ret = markerset.createAreaMarker(markerId, this.label, false, this.world, this.x, this.z, false // not persistent
|
||||
);
|
||||
if (ret == null)
|
||||
{
|
||||
if (ret == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -112,21 +96,17 @@ public class TempAreaMarker
|
||||
// UTIL
|
||||
// -------------------------------------------- //
|
||||
|
||||
public void update(AreaMarker marker)
|
||||
{
|
||||
public void update(AreaMarker marker) {
|
||||
// Corner Locations
|
||||
if (!equals(marker, this.x, this.z))
|
||||
{
|
||||
if (!equals(marker, this.x, this.z)) {
|
||||
marker.setCornerLocations(this.x, this.z);
|
||||
}
|
||||
|
||||
// Label
|
||||
if (!marker.getLabel().equals(this.label))
|
||||
{
|
||||
if (!marker.getLabel().equals(this.label)) {
|
||||
marker.setLabel(this.label);
|
||||
}
|
||||
if (!marker.getDescription().equals(this.description))
|
||||
{
|
||||
if (!marker.getDescription().equals(this.description)) {
|
||||
marker.setDescription(this.description);
|
||||
}
|
||||
|
||||
@ -137,13 +117,11 @@ public class TempAreaMarker
|
||||
// }
|
||||
|
||||
// Fill Style
|
||||
if ((marker.getFillOpacity() != this.fillOpacity) || (marker.getFillColor() != this.fillColor))
|
||||
{
|
||||
if ((marker.getFillOpacity() != this.fillOpacity) || (marker.getFillColor() != this.fillColor)) {
|
||||
marker.setFillStyle(this.fillOpacity, this.fillColor);
|
||||
}
|
||||
// Boost Flag
|
||||
if (marker.getBoostFlag() != this.boost)
|
||||
{
|
||||
if (marker.getBoostFlag() != this.boost) {
|
||||
marker.setBoostFlag(this.boost);
|
||||
}
|
||||
}
|
||||
|
@ -1,59 +1,46 @@
|
||||
package com.massivecraft.factions.integration.dynmap;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TempLine
|
||||
{
|
||||
public class TempLine {
|
||||
private Point p1;
|
||||
private Point p2;
|
||||
private List<TempLine> connectedLines = new ArrayList<TempLine>();
|
||||
|
||||
TempLine(Point p1, Point p2)
|
||||
{
|
||||
TempLine(Point p1, Point p2) {
|
||||
this.p1 = p1;
|
||||
this.p2 = p2;
|
||||
}
|
||||
|
||||
public Point getP1()
|
||||
{
|
||||
public Point getP1() {
|
||||
return p1;
|
||||
}
|
||||
|
||||
public Point getP2()
|
||||
{
|
||||
public Point getP2() {
|
||||
return p2;
|
||||
}
|
||||
|
||||
public void addAdditionLines(List<TempLine> connectedLines)
|
||||
{
|
||||
public void addAdditionLines(List<TempLine> connectedLines) {
|
||||
this.connectedLines = connectedLines;
|
||||
}
|
||||
|
||||
public List<TempLine> getConnectedLines()
|
||||
{
|
||||
public List<TempLine> getConnectedLines() {
|
||||
return connectedLines;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
public boolean equals(Object o) {
|
||||
TempLine line = (TempLine) o;
|
||||
if (line.p1.x == this.p1.x && line.p2.x == this.p2.x && line.p1.y == this.p1.y && line.p2.y == this.p2.y)
|
||||
{
|
||||
if (line.p1.x == this.p1.x && line.p2.x == this.p2.x && line.p1.y == this.p1.y && line.p2.y == this.p2.y) {
|
||||
return true;
|
||||
}
|
||||
if (line.p1.x == this.p2.x && line.p2.x == this.p1.x && line.p1.y == this.p2.y && line.p2.y == this.p1.y)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return line.p1.x == this.p2.x && line.p2.x == this.p1.x && line.p1.y == this.p2.y && line.p2.y == this.p1.y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
public int hashCode() {
|
||||
String test = "" + (p1.x + p2.x);
|
||||
test += " " + (p1.y + p2.y);
|
||||
return test.hashCode();
|
||||
|
@ -1,13 +1,13 @@
|
||||
package com.massivecraft.factions.integration.dynmap;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.dynmap.markers.MarkerSet;
|
||||
import org.dynmap.markers.PolyLineMarker;
|
||||
|
||||
public class TempPolyLineMarker
|
||||
{
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TempPolyLineMarker {
|
||||
|
||||
/**
|
||||
* @author FactionsUUID Team
|
||||
@ -29,22 +29,17 @@ public class TempPolyLineMarker
|
||||
// CREATE
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static boolean equals(PolyLineMarker marker, List<Point> points)
|
||||
{
|
||||
public static boolean equals(PolyLineMarker marker, List<Point> points) {
|
||||
int length = marker.getCornerCount();
|
||||
|
||||
if (points.size() != length)
|
||||
{
|
||||
if (points.size() != length) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
if (marker.getCornerX(i) != points.get(i).x)
|
||||
{
|
||||
for (int i = 0; i < length; i++) {
|
||||
if (marker.getCornerX(i) != points.get(i).x) {
|
||||
return false;
|
||||
}
|
||||
if (marker.getCornerZ(i) != points.get(i).y)
|
||||
{
|
||||
if (marker.getCornerZ(i) != points.get(i).y) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -56,13 +51,11 @@ public class TempPolyLineMarker
|
||||
// UPDATE
|
||||
// -------------------------------------------- //
|
||||
|
||||
public PolyLineMarker create(MarkerSet markerset, String markerId)
|
||||
{
|
||||
public PolyLineMarker create(MarkerSet markerset, String markerId) {
|
||||
double[] polyX = new double[polyLine.size()];
|
||||
double[] polyY = new double[polyLine.size()];
|
||||
double[] polyZ = new double[polyLine.size()];
|
||||
for (int i = 0; i < polyLine.size(); i++)
|
||||
{
|
||||
for (int i = 0; i < polyLine.size(); i++) {
|
||||
Point p = polyLine.get(i);
|
||||
polyX[i] = p.getX();
|
||||
polyY[i] = 64;
|
||||
@ -70,8 +63,7 @@ public class TempPolyLineMarker
|
||||
}
|
||||
PolyLineMarker poly = markerset.createPolyLineMarker(markerId, "", false, this.world, polyX, polyY, polyZ, false);
|
||||
// Poly Line Style
|
||||
if (poly != null)
|
||||
{
|
||||
if (poly != null) {
|
||||
poly.setLineStyle(this.lineWeight, this.lineOpacity, this.lineColor);
|
||||
}
|
||||
return poly;
|
||||
@ -81,16 +73,13 @@ public class TempPolyLineMarker
|
||||
// UTIL
|
||||
// -------------------------------------------- //
|
||||
|
||||
public void update(PolyLineMarker marker)
|
||||
{
|
||||
public void update(PolyLineMarker marker) {
|
||||
// Corner Locations
|
||||
if (!equals(marker, polyLine))
|
||||
{
|
||||
if (!equals(marker, polyLine)) {
|
||||
double[] polyX = new double[polyLine.size()];
|
||||
double[] polyY = new double[polyLine.size()];
|
||||
double[] polyZ = new double[polyLine.size()];
|
||||
for (int i = 0; i < polyLine.size(); i++)
|
||||
{
|
||||
for (int i = 0; i < polyLine.size(); i++) {
|
||||
Point p = polyLine.get(i);
|
||||
polyX[i] = p.getX();
|
||||
polyY[i] = 64;
|
||||
@ -101,8 +90,7 @@ public class TempPolyLineMarker
|
||||
}
|
||||
|
||||
// Line Style
|
||||
if (marker.getLineWeight() != this.lineWeight || marker.getLineOpacity() != this.lineOpacity || marker.getLineColor() != this.lineColor)
|
||||
{
|
||||
if (marker.getLineWeight() != this.lineWeight || marker.getLineOpacity() != this.lineOpacity || marker.getLineColor() != this.lineColor) {
|
||||
marker.setLineStyle(this.lineWeight, this.lineOpacity, this.lineColor);
|
||||
}
|
||||
|
||||
|
@ -42,15 +42,13 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
|
||||
public class FactionsBlockListener implements Listener
|
||||
{
|
||||
public class FactionsBlockListener implements Listener {
|
||||
|
||||
public static HashMap<String, Location> bannerLocations = new HashMap<>();
|
||||
private HashMap<String, Boolean> bannerCooldownMap = new HashMap<>();
|
||||
private long placeTimer = TimeUnit.SECONDS.toMillis(15L);
|
||||
|
||||
public static boolean playerCanBuildDestroyBlock(Player player, Location location, PermissableAction action, boolean justCheck)
|
||||
{
|
||||
public static boolean playerCanBuildDestroyBlock(Player player, Location location, PermissableAction action, boolean justCheck) {
|
||||
if (Conf.playersWhoBypassAllProtection.contains(player.getName()))
|
||||
return true;
|
||||
|
||||
@ -62,21 +60,17 @@ public class FactionsBlockListener implements Listener
|
||||
Faction otherFaction = Board.getInstance().getFactionAt(loc);
|
||||
Faction myFaction = me.getFaction();
|
||||
|
||||
if (otherFaction.isWilderness())
|
||||
{
|
||||
if (otherFaction.isWilderness()) {
|
||||
if (Conf.worldGuardBuildPriority && Worldguard.getInstance().playerCanBuild(player, location))
|
||||
return true;
|
||||
if (location.getWorld() != null)
|
||||
{
|
||||
if (location.getWorld() != null) {
|
||||
if (!Conf.wildernessDenyBuild || Conf.worldsNoWildernessProtection.contains(location.getWorld().getName()))
|
||||
return true;
|
||||
}
|
||||
if (!justCheck)
|
||||
me.msg(TL.ACTION_DENIED_WILDERNESS, action.toString());
|
||||
return false;
|
||||
}
|
||||
else if (otherFaction.isSafeZone())
|
||||
{
|
||||
} else if (otherFaction.isSafeZone()) {
|
||||
if (Conf.worldGuardBuildPriority && Worldguard.getInstance().playerCanBuild(player, location))
|
||||
return true;
|
||||
if (!Conf.safeZoneDenyBuild || Permission.MANAGE_SAFE_ZONE.has(player))
|
||||
@ -84,9 +78,7 @@ public class FactionsBlockListener implements Listener
|
||||
if (!justCheck)
|
||||
me.msg(TL.ACTION_DENIED_SAFEZONE, action.toString());
|
||||
return false;
|
||||
}
|
||||
else if (otherFaction.isWarZone())
|
||||
{
|
||||
} else if (otherFaction.isWarZone()) {
|
||||
if (Conf.worldGuardBuildPriority && Worldguard.getInstance().playerCanBuild(player, location))
|
||||
return true;
|
||||
if (!Conf.warZoneDenyBuild || Permission.MANAGE_WAR_ZONE.has(player))
|
||||
@ -94,41 +86,31 @@ public class FactionsBlockListener implements Listener
|
||||
if (!justCheck)
|
||||
me.msg(TL.ACTION_DENIED_WARZONE, action.toString());
|
||||
return false;
|
||||
}
|
||||
else if (!otherFaction.getId().equals(myFaction.getId()))
|
||||
{ // If the faction target is not my own
|
||||
} else if (!otherFaction.getId().equals(myFaction.getId())) { // If the faction target is not my own
|
||||
if (FactionsPlugin.getInstance().getConfig().getBoolean("hcf.raidable", false) && otherFaction.getLandRounded() > otherFaction.getPowerRounded())
|
||||
return true;
|
||||
boolean pain = !justCheck && otherFaction.getAccess(me, PermissableAction.PAIN_BUILD) == Access.ALLOW;
|
||||
return CheckActionState(otherFaction, loc, me, action, pain, justCheck);
|
||||
}
|
||||
else if (otherFaction.getId().equals(myFaction.getId()))
|
||||
{
|
||||
} else if (otherFaction.getId().equals(myFaction.getId())) {
|
||||
boolean pain = !justCheck && myFaction.getAccess(me, PermissableAction.PAIN_BUILD) == Access.ALLOW;
|
||||
return CheckActionState(myFaction, loc, me, action, pain, justCheck);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean CheckPlayerAccess(Player player, FPlayer me, FLocation loc, Faction myFaction, Access access, PermissableAction action, boolean shouldHurt, boolean justCheck)
|
||||
{
|
||||
private static boolean CheckPlayerAccess(Player player, FPlayer me, FLocation loc, Faction myFaction, Access access, PermissableAction action, boolean shouldHurt, boolean justCheck) {
|
||||
boolean landOwned = (myFaction.doesLocationHaveOwnersSet(loc) && !myFaction.getOwnerList(loc).isEmpty());
|
||||
if ((landOwned && myFaction.getOwnerListString(loc).contains(player.getName())) || (me.getRole() == Role.LEADER && me.getFactionId().equals(myFaction.getId())))
|
||||
return true;
|
||||
else if (landOwned && !myFaction.getOwnerListString(loc).contains(player.getName()))
|
||||
{
|
||||
else if (landOwned && !myFaction.getOwnerListString(loc).contains(player.getName())) {
|
||||
me.msg(TL.ACTIONS_OWNEDTERRITORYDENY.toString().replace("{owners}", myFaction.getOwnerListString(loc)));
|
||||
if (shouldHurt)
|
||||
{
|
||||
if (shouldHurt) {
|
||||
player.damage(Conf.actionDeniedPainAmount);
|
||||
me.msg(TL.ACTIONS_NOPERMISSIONPAIN.toString().replace("{action}", action.toString()).replace("{faction}", Board.getInstance().getFactionAt(loc).getTag(myFaction)));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else if (!landOwned && access == Access.DENY)
|
||||
{ // If land is not owned but access is set to DENY anyway
|
||||
if (shouldHurt)
|
||||
{
|
||||
} else if (!landOwned && access == Access.DENY) { // If land is not owned but access is set to DENY anyway
|
||||
if (shouldHurt) {
|
||||
player.damage(Conf.actionDeniedPainAmount);
|
||||
if ((Board.getInstance().getFactionAt(loc).getTag(myFaction)) != null)
|
||||
me.msg(TL.ACTIONS_NOPERMISSIONPAIN.toString().replace("{action}", action.toString()).replace("{faction}", Board.getInstance().getFactionAt(loc).getTag(myFaction)));
|
||||
@ -136,8 +118,7 @@ public class FactionsBlockListener implements Listener
|
||||
if (myFaction.getTag(me.getFaction()) != null && action != null && !justCheck)
|
||||
me.msg(TL.ACTIONS_NOPERMISSION.toString().replace("{faction}", myFaction.getTag(me.getFaction())).replace("{action}", action.toString()));
|
||||
return false;
|
||||
}
|
||||
else if (access == Access.ALLOW)
|
||||
} else if (access == Access.ALLOW)
|
||||
return true;
|
||||
|
||||
if (!justCheck)
|
||||
@ -145,19 +126,16 @@ public class FactionsBlockListener implements Listener
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean CheckActionState(Faction target, FLocation location, FPlayer me, PermissableAction action, boolean pain, boolean justCheck)
|
||||
{
|
||||
if (Conf.ownedAreasEnabled && target.doesLocationHaveOwnersSet(location) && !target.playerHasOwnershipRights(me, location))
|
||||
{
|
||||
private static boolean CheckActionState(Faction target, FLocation location, FPlayer me, PermissableAction action, boolean pain, boolean justCheck) {
|
||||
if (Conf.ownedAreasEnabled && target.doesLocationHaveOwnersSet(location) && !target.playerHasOwnershipRights(me, location)) {
|
||||
// If pain should be applied
|
||||
|
||||
if (pain && Conf.ownedAreaPainBuild)
|
||||
me.msg(TL.ACTIONS_OWNEDTERRITORYPAINDENY.toString().replace("{action}", action.toString()).replace("{faction}", target.getOwnerListString(location)));
|
||||
if (Conf.ownedAreaDenyBuild && pain)
|
||||
return false;
|
||||
else if (Conf.ownedAreaDenyBuild)
|
||||
{
|
||||
if(!justCheck)
|
||||
else if (Conf.ownedAreaDenyBuild) {
|
||||
if (!justCheck)
|
||||
me.msg(TL.ACTIONS_NOPERMISSION.toString().replace("{faction}", target.getTag(me.getFaction())).replace("{action}", action.toString()));
|
||||
return false;
|
||||
}
|
||||
@ -165,32 +143,26 @@ public class FactionsBlockListener implements Listener
|
||||
return CheckPlayerAccess(me.getPlayer(), me, location, target, target.getAccess(me, action), action, pain, justCheck);
|
||||
}
|
||||
|
||||
public void handleSpawnerUpdate(Faction at, Player player, ItemStack spawnerItem, LogTimer.TimerSubType subType)
|
||||
{
|
||||
public void handleSpawnerUpdate(Faction at, Player player, ItemStack spawnerItem, LogTimer.TimerSubType subType) {
|
||||
FLogManager manager = FactionsPlugin.instance.getFlogManager();
|
||||
LogTimer logTimer = manager.getLogTimers().computeIfAbsent(player.getUniqueId(), e -> new LogTimer(player.getName(), at.getId()));
|
||||
LogTimer.Timer timer = logTimer.attemptLog(LogTimer.TimerType.SPAWNER_EDIT, subType, 0L);
|
||||
Map<MaterialData, AtomicInteger> currentCounts = (timer.getExtraData() == null) ? new HashMap<>() : ((Map) timer.getExtraData());
|
||||
currentCounts.computeIfAbsent(spawnerItem.getData(), e -> new AtomicInteger(0)).addAndGet(1);
|
||||
timer.setExtraData(currentCounts);
|
||||
if (timer.isReadyToLog(this.placeTimer))
|
||||
{
|
||||
if (timer.isReadyToLog(this.placeTimer)) {
|
||||
logTimer.pushLogs(at, LogTimer.TimerType.SPAWNER_EDIT);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onPlayerPlace(BlockPlaceEvent event)
|
||||
{
|
||||
public void onPlayerPlace(BlockPlaceEvent event) {
|
||||
ItemStack item = event.getItemInHand();
|
||||
if (item != null && item.getType() == XMaterial.SPAWNER.parseMaterial())
|
||||
{
|
||||
if (item != null && item.getType() == XMaterial.SPAWNER.parseMaterial()) {
|
||||
Faction at = Board.getInstance().getFactionAt(new FLocation(event.getBlockPlaced()));
|
||||
if (at != null && at.isNormal())
|
||||
{
|
||||
if (at != null && at.isNormal()) {
|
||||
FPlayer fplayer = FPlayers.getInstance().getByPlayer(event.getPlayer());
|
||||
if (fplayer != null && at.getRelationTo(fplayer.getFaction()).isAtLeast(Relation.TRUCE))
|
||||
{
|
||||
if (fplayer != null && at.getRelationTo(fplayer.getFaction()).isAtLeast(Relation.TRUCE)) {
|
||||
this.handleSpawnerUpdate(at, event.getPlayer(), item, LogTimer.TimerSubType.SPAWNER_PLACE);
|
||||
}
|
||||
}
|
||||
@ -198,24 +170,20 @@ public class FactionsBlockListener implements Listener
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onBlockPlace(BlockPlaceEvent event)
|
||||
{
|
||||
public void onBlockPlace(BlockPlaceEvent event) {
|
||||
|
||||
if (!event.canBuild())
|
||||
return;
|
||||
if (event.getBlockPlaced().getType() == Material.FIRE)
|
||||
return;
|
||||
boolean isSpawner = event.getBlock().getType().equals(XMaterial.SPAWNER.parseMaterial());
|
||||
if (!playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), PermissableAction.BUILD, false))
|
||||
{
|
||||
if (!playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), PermissableAction.BUILD, false)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isSpawner)
|
||||
{
|
||||
if (Conf.spawnerLock)
|
||||
{
|
||||
if (isSpawner) {
|
||||
if (Conf.spawnerLock) {
|
||||
event.setCancelled(true);
|
||||
event.getPlayer().sendMessage(FactionsPlugin.getInstance().color(TL.COMMAND_SPAWNER_LOCK_CANNOT_PLACE.toString()));
|
||||
}
|
||||
@ -223,30 +191,24 @@ public class FactionsBlockListener implements Listener
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onBlockFromTo(BlockFromToEvent event)
|
||||
{
|
||||
public void onBlockFromTo(BlockFromToEvent event) {
|
||||
if (!Conf.handleExploitLiquidFlow)
|
||||
return;
|
||||
|
||||
if (event.getBlock().isLiquid())
|
||||
{
|
||||
if (event.getToBlock().isEmpty())
|
||||
{
|
||||
if (event.getBlock().isLiquid()) {
|
||||
if (event.getToBlock().isEmpty()) {
|
||||
Faction from = Board.getInstance().getFactionAt(new FLocation(event.getBlock()));
|
||||
Faction to = Board.getInstance().getFactionAt(new FLocation(event.getToBlock()));
|
||||
if (from == to)
|
||||
return;
|
||||
// from faction != to faction
|
||||
if (to.isSystemFaction())
|
||||
{
|
||||
if (to.isSystemFaction()) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (to.isNormal())
|
||||
{
|
||||
if (from.isNormal() && from.getRelationTo(to).isAlly())
|
||||
{
|
||||
if (to.isNormal()) {
|
||||
if (from.isNormal() && from.getRelationTo(to).isAlly()) {
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
@ -256,17 +218,14 @@ public class FactionsBlockListener implements Listener
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onBlockDamage(BlockDamageEvent event)
|
||||
{
|
||||
if (event.getInstaBreak() && !playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), PermissableAction.DESTROY, false))
|
||||
{
|
||||
public void onBlockDamage(BlockDamageEvent event) {
|
||||
if (event.getInstaBreak() && !playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), PermissableAction.DESTROY, false)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onBlockPistonExtend(BlockPistonExtendEvent event)
|
||||
{
|
||||
public void onBlockPistonExtend(BlockPistonExtendEvent event) {
|
||||
if (!Conf.pistonProtectionThroughDenyBuild)
|
||||
return;
|
||||
Faction pistonFaction = Board.getInstance().getFactionAt(new FLocation(event.getBlock()));
|
||||
@ -280,45 +239,35 @@ public class FactionsBlockListener implements Listener
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onVaultPlace(BlockPlaceEvent e)
|
||||
{
|
||||
if (e.getItemInHand().getType() == Material.CHEST)
|
||||
{
|
||||
public void onVaultPlace(BlockPlaceEvent e) {
|
||||
if (e.getItemInHand().getType() == Material.CHEST) {
|
||||
|
||||
ItemStack vault = new ItemBuilder(Material.CHEST).amount(1).name(FactionsPlugin.instance.getConfig().getString("fvault.Item.Name")).lore(FactionsPlugin.instance.getConfig().getStringList("fvault.Item.Lore")).build();
|
||||
|
||||
if (e.getItemInHand().isSimilar(vault))
|
||||
{
|
||||
if (e.getItemInHand().isSimilar(vault)) {
|
||||
FPlayer fme = FPlayers.getInstance().getByPlayer(e.getPlayer());
|
||||
if (fme.getFaction().getVault() != null)
|
||||
{
|
||||
if (fme.getFaction().getVault() != null) {
|
||||
fme.msg(TL.COMMAND_GETVAULT_ALREADYSET);
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
FLocation flocation = new FLocation(e.getBlockPlaced().getLocation());
|
||||
if (Board.getInstance().getFactionAt(flocation) != fme.getFaction())
|
||||
{
|
||||
if (Board.getInstance().getFactionAt(flocation) != fme.getFaction()) {
|
||||
fme.msg(TL.COMMAND_GETVAULT_INVALIDLOCATION);
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
Block start = e.getBlockPlaced();
|
||||
int radius = 1;
|
||||
for (double x = start.getLocation().getX() - radius; x <= start.getLocation().getX() + radius; x++)
|
||||
{
|
||||
for (double y = start.getLocation().getY() - radius; y <= start.getLocation().getY() + radius; y++)
|
||||
{
|
||||
for (double z = start.getLocation().getZ() - radius; z <= start.getLocation().getZ() + radius; z++)
|
||||
{
|
||||
for (double x = start.getLocation().getX() - radius; x <= start.getLocation().getX() + radius; x++) {
|
||||
for (double y = start.getLocation().getY() - radius; y <= start.getLocation().getY() + radius; y++) {
|
||||
for (double z = start.getLocation().getZ() - radius; z <= start.getLocation().getZ() + radius; z++) {
|
||||
Location blockLoc = new Location(e.getPlayer().getWorld(), x, y, z);
|
||||
if (blockLoc.getX() == start.getLocation().getX() && blockLoc.getY() == start.getLocation().getY() && blockLoc.getZ() == start.getLocation().getZ())
|
||||
{
|
||||
if (blockLoc.getX() == start.getLocation().getX() && blockLoc.getY() == start.getLocation().getY() && blockLoc.getZ() == start.getLocation().getZ()) {
|
||||
continue;
|
||||
}
|
||||
Material blockMaterial = blockLoc.getBlock().getType();
|
||||
if (blockMaterial == Material.CHEST || (FactionsPlugin.instance.getConfig().getBoolean("fvault.No-Hoppers-near-vault") && blockMaterial == Material.HOPPER))
|
||||
{
|
||||
if (blockMaterial == Material.CHEST || (FactionsPlugin.instance.getConfig().getBoolean("fvault.No-Hoppers-near-vault") && blockMaterial == Material.HOPPER)) {
|
||||
e.setCancelled(true);
|
||||
fme.msg(TL.COMMAND_GETVAULT_CHESTNEAR);
|
||||
return;
|
||||
@ -334,8 +283,7 @@ public class FactionsBlockListener implements Listener
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onHopperPlace(BlockPlaceEvent e)
|
||||
{
|
||||
public void onHopperPlace(BlockPlaceEvent e) {
|
||||
if (e.getItemInHand().getType() != Material.HOPPER && !FactionsPlugin.instance.getConfig().getBoolean("fvault.No-Hoppers-near-vault"))
|
||||
return;
|
||||
Faction factionAt = Board.getInstance().getFactionAt(new FLocation(e.getBlockPlaced().getLocation()));
|
||||
@ -344,22 +292,16 @@ public class FactionsBlockListener implements Listener
|
||||
FPlayer fme = FPlayers.getInstance().getByPlayer(e.getPlayer());
|
||||
Block start = e.getBlockPlaced();
|
||||
int radius = 1;
|
||||
for (double x = start.getLocation().getX() - radius; x <= start.getLocation().getX() + radius; x++)
|
||||
{
|
||||
for (double y = start.getLocation().getY() - radius; y <= start.getLocation().getY() + radius; y++)
|
||||
{
|
||||
for (double z = start.getLocation().getZ() - radius; z <= start.getLocation().getZ() + radius; z++)
|
||||
{
|
||||
for (double x = start.getLocation().getX() - radius; x <= start.getLocation().getX() + radius; x++) {
|
||||
for (double y = start.getLocation().getY() - radius; y <= start.getLocation().getY() + radius; y++) {
|
||||
for (double z = start.getLocation().getZ() - radius; z <= start.getLocation().getZ() + radius; z++) {
|
||||
Location blockLoc = new Location(e.getPlayer().getWorld(), x, y, z);
|
||||
if (blockLoc.getX() == start.getLocation().getX() && blockLoc.getY() == start.getLocation().getY() && blockLoc.getZ() == start.getLocation().getZ())
|
||||
{
|
||||
if (blockLoc.getX() == start.getLocation().getX() && blockLoc.getY() == start.getLocation().getY() && blockLoc.getZ() == start.getLocation().getZ()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (blockLoc.getBlock().getType() == XMaterial.CHEST.parseMaterial())
|
||||
{
|
||||
if (factionAt.getVault().equals(blockLoc))
|
||||
{
|
||||
if (blockLoc.getBlock().getType() == XMaterial.CHEST.parseMaterial()) {
|
||||
if (factionAt.getVault().equals(blockLoc)) {
|
||||
e.setCancelled(true);
|
||||
fme.msg(TL.COMMAND_VAULT_NO_HOPPER);
|
||||
return;
|
||||
@ -372,8 +314,7 @@ public class FactionsBlockListener implements Listener
|
||||
}
|
||||
|
||||
@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 (!event.isSticky() || !Conf.pistonProtectionThroughDenyBuild)
|
||||
return;
|
||||
@ -382,8 +323,7 @@ public class FactionsBlockListener implements Listener
|
||||
Faction otherFaction = Board.getInstance().getFactionAt(new FLocation(targetLoc));
|
||||
|
||||
// Check if the piston is moving in a faction's territory. This disables pistons entirely in faction territory.
|
||||
if (otherFaction.isNormal() && FactionsPlugin.instance.getConfig().getBoolean("disable-pistons-in-territory", false))
|
||||
{
|
||||
if (otherFaction.isNormal() && FactionsPlugin.instance.getConfig().getBoolean("disable-pistons-in-territory", false)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@ -397,18 +337,14 @@ public class FactionsBlockListener implements Listener
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBannerBreak(BlockBreakEvent e)
|
||||
{
|
||||
public void onBannerBreak(BlockBreakEvent e) {
|
||||
FPlayer fme = FPlayers.getInstance().getByPlayer(e.getPlayer());
|
||||
if (FactionsPlugin.getInstance().mc17)
|
||||
{
|
||||
if (FactionsPlugin.getInstance().mc17) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (bannerLocations.containsValue(e.getBlock().getLocation()))
|
||||
{
|
||||
if (e.getBlock().getType().name().contains("BANNER"))
|
||||
{
|
||||
if (bannerLocations.containsValue(e.getBlock().getLocation())) {
|
||||
if (e.getBlock().getType().name().contains("BANNER")) {
|
||||
e.setCancelled(true);
|
||||
fme.msg(TL.BANNER_CANNOT_BREAK);
|
||||
}
|
||||
@ -416,13 +352,11 @@ public class FactionsBlockListener implements Listener
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBannerPlace(BlockPlaceEvent e)
|
||||
{
|
||||
public void onBannerPlace(BlockPlaceEvent e) {
|
||||
if (FactionsPlugin.getInstance().mc17)
|
||||
return;
|
||||
|
||||
if (e.getItemInHand().getType().name().contains("BANNER"))
|
||||
{
|
||||
if (e.getItemInHand().getType().name().contains("BANNER")) {
|
||||
ItemStack bannerInHand = e.getItemInHand();
|
||||
FPlayer fme = FPlayers.getInstance().getByPlayer(e.getPlayer());
|
||||
ItemStack warBanner = fme.getFaction().getBanner();
|
||||
@ -432,10 +366,8 @@ public class FactionsBlockListener implements Listener
|
||||
warmeta.setDisplayName(FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("fbanners.Item.Name")));
|
||||
warmeta.setLore(FactionsPlugin.getInstance().colorList(FactionsPlugin.getInstance().getConfig().getStringList("fbanners.Item.Lore")));
|
||||
warBanner.setItemMeta(warmeta);
|
||||
if (warBanner.isSimilar(bannerInHand))
|
||||
{
|
||||
if (fme.getFaction().isWilderness())
|
||||
{
|
||||
if (warBanner.isSimilar(bannerInHand)) {
|
||||
if (fme.getFaction().isWilderness()) {
|
||||
fme.msg(TL.WARBANNER_NOFACTION);
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
@ -444,16 +376,13 @@ public class FactionsBlockListener implements Listener
|
||||
Location placedLoc = e.getBlockPlaced().getLocation();
|
||||
FLocation fplacedLoc = new FLocation(placedLoc);
|
||||
if ((Board.getInstance().getFactionAt(fplacedLoc).isWarZone() && FactionsPlugin.getInstance().getConfig().getBoolean("fbanners.Placeable.Warzone"))
|
||||
|| (fme.getFaction().getRelationTo(Board.getInstance().getFactionAt(fplacedLoc)) == Relation.ENEMY && FactionsPlugin.getInstance().getConfig().getBoolean("fbanners.Placeable.Enemy")))
|
||||
{
|
||||
if (bannerCooldownMap.containsKey(fme.getTag()))
|
||||
{
|
||||
|| (fme.getFaction().getRelationTo(Board.getInstance().getFactionAt(fplacedLoc)) == Relation.ENEMY && FactionsPlugin.getInstance().getConfig().getBoolean("fbanners.Placeable.Enemy"))) {
|
||||
if (bannerCooldownMap.containsKey(fme.getTag())) {
|
||||
fme.msg(TL.WARBANNER_COOLDOWN);
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
for (FPlayer fplayer : fme.getFaction().getFPlayers())
|
||||
{
|
||||
for (FPlayer fplayer : fme.getFaction().getFPlayers()) {
|
||||
fplayer.getPlayer().sendTitle(FactionsPlugin.getInstance().color(fme.getTag() + " Placed A WarBanner!"), FactionsPlugin.getInstance().color("&7use &c/f tpbanner&7 to tp to the banner!"));
|
||||
}
|
||||
bannerCooldownMap.put(fme.getTag(), true);
|
||||
@ -475,23 +404,18 @@ public class FactionsBlockListener implements Listener
|
||||
List<String> effects = FactionsPlugin.getInstance().getConfig().getStringList("fbanners.Effects");
|
||||
int affectorTask = Bukkit.getScheduler().scheduleSyncRepeatingTask(FactionsPlugin.getInstance(), () ->
|
||||
{
|
||||
for (Entity e1 : Objects.requireNonNull(banner.getLocation().getWorld()).getNearbyEntities(banner.getLocation(), radius, 255.0, radius))
|
||||
{
|
||||
if (e1 instanceof Player)
|
||||
{
|
||||
for (Entity e1 : Objects.requireNonNull(banner.getLocation().getWorld()).getNearbyEntities(banner.getLocation(), radius, 255.0, radius)) {
|
||||
if (e1 instanceof Player) {
|
||||
Player player = (Player) e1;
|
||||
FPlayer fplayer = FPlayers.getInstance().getByPlayer(player);
|
||||
if (fplayer.getFaction() != bannerFaction)
|
||||
{
|
||||
if (fplayer.getFaction() != bannerFaction) {
|
||||
continue;
|
||||
}
|
||||
for (String effect : effects)
|
||||
{
|
||||
for (String effect : effects) {
|
||||
String[] components = effect.split(":");
|
||||
player.addPotionEffect(new PotionEffect(Objects.requireNonNull(PotionEffectType.getByName(components[0])), 100, Integer.parseInt(components[1])));
|
||||
}
|
||||
if (banner.getType() == bannerType)
|
||||
{
|
||||
if (banner.getType() == bannerType) {
|
||||
continue;
|
||||
}
|
||||
banner.setType(bannerType);
|
||||
@ -506,9 +430,7 @@ public class FactionsBlockListener implements Listener
|
||||
Bukkit.getScheduler().cancelTask(affectorTask);
|
||||
FactionsBlockListener.bannerLocations.remove(bannerFaction.getTag());
|
||||
}, Long.parseLong(bannerTime + ""));
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
fme.msg(TL.WARBANNER_INVALIDLOC);
|
||||
e.setCancelled(true);
|
||||
}
|
||||
@ -517,15 +439,13 @@ public class FactionsBlockListener implements Listener
|
||||
}
|
||||
|
||||
@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)
|
||||
return;
|
||||
Player player = (Player) event.getEntity();
|
||||
Location location = event.getBlock().getLocation();
|
||||
|
||||
if (!event.getBlock().getType().equals(Material.WATER))
|
||||
{
|
||||
if (!event.getBlock().getType().equals(Material.WATER)) {
|
||||
// If we are not replacing water then this is clearly not a frostwalker event.
|
||||
return;
|
||||
}
|
||||
@ -542,21 +462,18 @@ public class FactionsBlockListener implements Listener
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onFallingBlock(EntityChangeBlockEvent event)
|
||||
{
|
||||
public void onFallingBlock(EntityChangeBlockEvent event) {
|
||||
if (!FactionsPlugin.getInstance().getConfig().getBoolean("Falling-Block-Fix.Enabled"))
|
||||
return;
|
||||
|
||||
Faction faction = Board.getInstance().getFactionAt(new FLocation(event.getBlock()));
|
||||
if (faction.isWarZone() || faction.isSafeZone())
|
||||
{
|
||||
if (faction.isWarZone() || faction.isSafeZone()) {
|
||||
event.getBlock().setType(Material.AIR);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean canPistonMoveBlock(Faction pistonFaction, Location target)
|
||||
{
|
||||
private boolean canPistonMoveBlock(Faction pistonFaction, Location target) {
|
||||
Faction otherFaction = Board.getInstance().getFactionAt(new FLocation(target));
|
||||
|
||||
if (pistonFaction == otherFaction)
|
||||
@ -574,17 +491,14 @@ public class FactionsBlockListener implements Listener
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onBlockBreak(BlockBreakEvent event)
|
||||
{
|
||||
public void onBlockBreak(BlockBreakEvent event) {
|
||||
// If there is an error its much safer to not allow the block to be broken
|
||||
try
|
||||
{
|
||||
try {
|
||||
Block block = event.getBlock();
|
||||
|
||||
Faction at = Board.getInstance().getFactionAt(new FLocation(block));
|
||||
boolean isSpawner = event.getBlock().getType().equals(XMaterial.SPAWNER.parseMaterial());
|
||||
if (!playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), PermissableAction.DESTROY, false))
|
||||
{
|
||||
if (!playerCanBuildDestroyBlock(event.getPlayer(), event.getBlock().getLocation(), PermissableAction.DESTROY, false)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@ -593,26 +507,20 @@ public class FactionsBlockListener implements Listener
|
||||
if (fme == null || !fme.hasFaction())
|
||||
return;
|
||||
|
||||
if (isSpawner)
|
||||
{
|
||||
if (isSpawner) {
|
||||
Access access = fme.getFaction().getAccess(fme, PermissableAction.SPAWNER);
|
||||
if (access != Access.ALLOW && fme.getRole() != Role.LEADER)
|
||||
{
|
||||
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
|
||||
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "mine spawners");
|
||||
}
|
||||
}
|
||||
|
||||
if (isSpawner && !fme.isAdminBypassing())
|
||||
{
|
||||
if (isSpawner && !fme.isAdminBypassing()) {
|
||||
ItemStack item = new ItemStack(block.getType(), 1, block.getData());
|
||||
if (at != null && at.isNormal())
|
||||
{
|
||||
if (at != null && at.isNormal()) {
|
||||
FPlayer fplayer = FPlayers.getInstance().getByPlayer(event.getPlayer());
|
||||
if (fplayer != null)
|
||||
{
|
||||
if (fplayer != null) {
|
||||
BlockState state = block.getState();
|
||||
if (state instanceof CreatureSpawner)
|
||||
{
|
||||
if (state instanceof CreatureSpawner) {
|
||||
CreatureSpawner spawner = (CreatureSpawner) state;
|
||||
item.setDurability(spawner.getSpawnedType().getTypeId());
|
||||
}
|
||||
@ -620,26 +528,20 @@ public class FactionsBlockListener implements Listener
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
event.setCancelled(true);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void FrameRemove(HangingBreakByEntityEvent event)
|
||||
{
|
||||
public void FrameRemove(HangingBreakByEntityEvent event) {
|
||||
if (event.getRemover() == null)
|
||||
return;
|
||||
if ((event.getRemover() instanceof Player))
|
||||
{
|
||||
if (event.getEntity().getType().equals(EntityType.ITEM_FRAME))
|
||||
{
|
||||
if ((event.getRemover() instanceof Player)) {
|
||||
if (event.getEntity().getType().equals(EntityType.ITEM_FRAME)) {
|
||||
Player p = (Player) event.getRemover();
|
||||
if (!playerCanBuildDestroyBlock(p, event.getEntity().getLocation(), PermissableAction.DESTROY, true))
|
||||
{
|
||||
if (!playerCanBuildDestroyBlock(p, event.getEntity().getLocation(), PermissableAction.DESTROY, true)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@ -648,13 +550,10 @@ public class FactionsBlockListener implements Listener
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onFarmLandDamage(EntityChangeBlockEvent event)
|
||||
{
|
||||
if (event.getEntity() instanceof Player)
|
||||
{
|
||||
public void onFarmLandDamage(EntityChangeBlockEvent event) {
|
||||
if (event.getEntity() instanceof Player) {
|
||||
Player player = (Player) event.getEntity();
|
||||
if (!playerCanBuildDestroyBlock(player, event.getBlock().getLocation(), PermissableAction.DESTROY, true))
|
||||
{
|
||||
if (!playerCanBuildDestroyBlock(player, event.getBlock().getLocation(), PermissableAction.DESTROY, true)) {
|
||||
FPlayer me = FPlayers.getInstance().getByPlayer(player);
|
||||
Faction otherFaction = Board.getInstance().getFactionAt(new FLocation(event.getBlock().getLocation()));
|
||||
me.msg(TL.ACTION_DENIED_OTHER, otherFaction.getTag(), "trample crops");
|
||||
|
@ -4,7 +4,6 @@ import com.massivecraft.factions.*;
|
||||
import com.massivecraft.factions.event.PowerLossEvent;
|
||||
import com.massivecraft.factions.struct.Relation;
|
||||
import com.massivecraft.factions.util.MiscUtil;
|
||||
import com.massivecraft.factions.util.timer.type.GraceTimer;
|
||||
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import org.bukkit.Bukkit;
|
||||
|
@ -4,7 +4,6 @@ import com.massivecraft.factions.*;
|
||||
import com.massivecraft.factions.cmd.CmdFGlobal;
|
||||
import com.massivecraft.factions.cmd.CmdFly;
|
||||
import com.massivecraft.factions.cmd.CmdSeeChunk;
|
||||
import com.massivecraft.factions.cmd.FCmdRoot;
|
||||
import com.massivecraft.factions.cmd.audit.FLogType;
|
||||
import com.massivecraft.factions.cmd.logout.LogoutHandler;
|
||||
import com.massivecraft.factions.cmd.wild.CmdWild;
|
||||
@ -36,8 +35,6 @@ import net.dv8tion.jda.core.entities.Member;
|
||||
import net.dv8tion.jda.core.entities.TextChannel;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Boat;
|
||||
import org.bukkit.entity.Minecart;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -57,7 +54,9 @@ import java.util.logging.Level;
|
||||
|
||||
public class FactionsPlayerListener implements Listener {
|
||||
|
||||
public final static Map<UUID, Location> lastLocations = new HashMap<>();
|
||||
public static Set<FLocation> corners;
|
||||
public static BukkitTask positionTask = null;
|
||||
/**
|
||||
* @author FactionsUUID Team
|
||||
*/
|
||||
@ -655,9 +654,6 @@ public class FactionsPlayerListener implements Listener {
|
||||
return (result.length() == 3 ? result + "0" : result) + "/hrs ago";
|
||||
}
|
||||
|
||||
public static BukkitTask positionTask = null;
|
||||
public final static Map<UUID, Location> lastLocations = new HashMap<>();
|
||||
|
||||
public void startPositionCheck() {
|
||||
positionTask = Bukkit.getScheduler().runTaskTimer(FactionsPlugin.getInstance(), () -> {
|
||||
if (lastLocations.isEmpty()) return;
|
||||
@ -741,7 +737,8 @@ public class FactionsPlayerListener implements Listener {
|
||||
me.attemptClaim(me.getAutoClaimFor(), newLocation, true);
|
||||
}
|
||||
FactionsPlugin.instance.logFactionEvent(me.getAutoClaimFor(), FLogType.CHUNK_CLAIMS, me.getName(), CC.GreenB + "CLAIMED", String.valueOf(1), (new FLocation(player.getLocation())).formatXAndZ(","));
|
||||
if (Conf.disableFlightOnFactionClaimChange && FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight")) CmdFly.disableFlight(me);
|
||||
if (Conf.disableFlightOnFactionClaimChange && FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight"))
|
||||
CmdFly.disableFlight(me);
|
||||
|
||||
} else if (me.isAutoSafeClaimEnabled()) {
|
||||
if (!Permission.MANAGE_SAFE_ZONE.has(player)) {
|
||||
|
@ -26,8 +26,7 @@ import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ShopGUIFrame
|
||||
{
|
||||
public class ShopGUIFrame {
|
||||
|
||||
/**
|
||||
* @author Driftay
|
||||
@ -35,13 +34,11 @@ public class ShopGUIFrame
|
||||
|
||||
private Gui gui;
|
||||
|
||||
public ShopGUIFrame(Faction f)
|
||||
{
|
||||
public ShopGUIFrame(Faction f) {
|
||||
gui = new Gui(FactionsPlugin.getInstance(), FactionsPlugin.getInstance().getConfig().getInt("F-Shop.GUI.Rows", 4), FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("F-Shop.GUI.Name")));
|
||||
}
|
||||
|
||||
public void buildGUI(FPlayer fplayer)
|
||||
{
|
||||
public void buildGUI(FPlayer fplayer) {
|
||||
PaginatedPane pane = new PaginatedPane(0, 0, 9, gui.getRows());
|
||||
List<GuiItem> GUIItems = new ArrayList<>();
|
||||
ItemStack dummy = buildDummyItem(fplayer.getFaction());
|
||||
@ -49,10 +46,8 @@ public class ShopGUIFrame
|
||||
GUIItems.add(new GuiItem(dummy, e -> e.setCancelled(true)));
|
||||
|
||||
Set<String> items = FactionsPlugin.getInstance().getFileManager().getShop().getConfig().getConfigurationSection("items").getKeys(false);
|
||||
for (String s : items)
|
||||
{
|
||||
if (!checkShopConfig(s))
|
||||
{
|
||||
for (String s : items) {
|
||||
if (!checkShopConfig(s)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -67,8 +62,7 @@ public class ShopGUIFrame
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
meta.setDisplayName(FactionsPlugin.instance.color(name));
|
||||
meta.addItemFlags();
|
||||
if (glowing)
|
||||
{
|
||||
if (glowing) {
|
||||
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
||||
meta.addEnchant(Enchantment.DURABILITY, 1, true);
|
||||
}
|
||||
@ -81,25 +75,18 @@ public class ShopGUIFrame
|
||||
{
|
||||
e.setCancelled(true);
|
||||
FPlayer fme = FPlayers.getInstance().getByPlayer((Player) e.getWhoClicked());
|
||||
if (fplayer.getFaction().getPoints() >= cost)
|
||||
{
|
||||
if (runCommands(FactionsPlugin.getInstance().getFileManager().getShop().fetchStringList("items." + s + ".cmds"), fplayer.getPlayer()))
|
||||
{
|
||||
if (fplayer.getFaction().getPoints() >= cost) {
|
||||
if (runCommands(FactionsPlugin.getInstance().getFileManager().getShop().fetchStringList("items." + s + ".cmds"), fplayer.getPlayer())) {
|
||||
fplayer.getFaction().setPoints(fplayer.getFaction().getPoints() - cost);
|
||||
for (FPlayer fplayerBuy : fplayer.getFaction().getFPlayers())
|
||||
{
|
||||
for (FPlayer fplayerBuy : fplayer.getFaction().getFPlayers()) {
|
||||
fplayerBuy.getPlayer().sendMessage(TL.SHOP_BOUGHT_BROADCAST_FACTION.toString().replace("{player}", fplayer.getPlayer().getName()).replace("{item}", ChatColor.stripColor(FactionsPlugin.getInstance().color(name)))
|
||||
.replace("{cost}", cost + ""));
|
||||
}
|
||||
buildGUI(fme);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
fplayer.msg(TL.SHOP_ERROR_DURING_PURCHASE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
fplayer.msg(TL.SHOP_NOT_ENOUGH_POINTS);
|
||||
}
|
||||
}));
|
||||
@ -110,13 +97,11 @@ public class ShopGUIFrame
|
||||
}
|
||||
}
|
||||
|
||||
private ItemStack buildDummyItem(Faction f)
|
||||
{
|
||||
private ItemStack buildDummyItem(Faction f) {
|
||||
ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("F-Shop.GUI.dummy-item");
|
||||
ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).get().parseItem();
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
if (meta != null)
|
||||
{
|
||||
if (meta != null) {
|
||||
meta.setLore(FactionsPlugin.getInstance().colorList(config.getStringList("Lore")));
|
||||
meta.setDisplayName(FactionsPlugin.getInstance().color(config.getString("Name").replace("{points}", f.getPoints() + "")));
|
||||
item.setItemMeta(meta);
|
||||
@ -124,104 +109,80 @@ public class ShopGUIFrame
|
||||
return item;
|
||||
}
|
||||
|
||||
public boolean checkShopConfig()
|
||||
{
|
||||
public boolean checkShopConfig() {
|
||||
boolean ret = true;
|
||||
Set<String> items = FactionsPlugin.getInstance().getFileManager().getShop().getConfig().getConfigurationSection("items").getKeys(false);
|
||||
for (String s : items)
|
||||
{
|
||||
if (checkShopConfig(s) == false)
|
||||
{
|
||||
for (String s : items) {
|
||||
if (checkShopConfig(s) == false) {
|
||||
ret = false;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public boolean checkShopConfig(String s)
|
||||
{
|
||||
public boolean checkShopConfig(String s) {
|
||||
boolean ret = true;
|
||||
if (!FactionsPlugin.getInstance().getFileManager().getShop().containsKey("items." + s + ".slot"))
|
||||
{
|
||||
FactionsPlugin.getInstance().log(Level.WARNING, "Problem with config item \'" + s + "\' missing slot variable");
|
||||
if (!FactionsPlugin.getInstance().getFileManager().getShop().containsKey("items." + s + ".slot")) {
|
||||
FactionsPlugin.getInstance().log(Level.WARNING, "Problem with config item '" + s + "' missing slot variable");
|
||||
ret = false;
|
||||
}
|
||||
if (!FactionsPlugin.getInstance().getFileManager().getShop().containsKey("items." + s + ".block"))
|
||||
{
|
||||
FactionsPlugin.getInstance().log(Level.WARNING, "Problem with config item \'" + s + "\' missing block variable");
|
||||
if (!FactionsPlugin.getInstance().getFileManager().getShop().containsKey("items." + s + ".block")) {
|
||||
FactionsPlugin.getInstance().log(Level.WARNING, "Problem with config item '" + s + "' missing block variable");
|
||||
ret = false;
|
||||
}
|
||||
|
||||
if (!FactionsPlugin.getInstance().getFileManager().getShop().containsKey("items." + s + ".cmds"))
|
||||
{
|
||||
FactionsPlugin.getInstance().log(Level.WARNING, "Problee with config item \'" + s + "\' missing cmds variable");
|
||||
if (!FactionsPlugin.getInstance().getFileManager().getShop().containsKey("items." + s + ".cmds")) {
|
||||
FactionsPlugin.getInstance().log(Level.WARNING, "Problee with config item '" + s + "' missing cmds variable");
|
||||
ret = false;
|
||||
}
|
||||
|
||||
if (!FactionsPlugin.getInstance().getFileManager().getShop().containsKey("items." + s + ".cost"))
|
||||
{
|
||||
FactionsPlugin.getInstance().log(Level.WARNING, "Problem with config item \'" + s + "\' missing cost variable this item will cost 0");
|
||||
if (!FactionsPlugin.getInstance().getFileManager().getShop().containsKey("items." + s + ".cost")) {
|
||||
FactionsPlugin.getInstance().log(Level.WARNING, "Problem with config item '" + s + "' missing cost variable this item will cost 0");
|
||||
}
|
||||
if (!FactionsPlugin.getInstance().getFileManager().getShop().containsKey("items." + s + ".name"))
|
||||
{
|
||||
FactionsPlugin.getInstance().log(Level.WARNING, "Problem with config item \'" + s + "\' missing name variable");
|
||||
if (!FactionsPlugin.getInstance().getFileManager().getShop().containsKey("items." + s + ".name")) {
|
||||
FactionsPlugin.getInstance().log(Level.WARNING, "Problem with config item '" + s + "' missing name variable");
|
||||
ret = false;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param list
|
||||
* The list of commands to be ran.
|
||||
* @param p
|
||||
* The player that is using the shop
|
||||
* @param list The list of commands to be ran.
|
||||
* @param p The player that is using the shop
|
||||
* @return if all commands are able to be ran or if they did run.
|
||||
*/
|
||||
public boolean runCommands(List<String> list, Player p)
|
||||
{
|
||||
for (String cmd : list)
|
||||
{
|
||||
public boolean runCommands(List<String> list, Player p) {
|
||||
for (String cmd : list) {
|
||||
cmd = cmd.replace("%player%", p.getName());
|
||||
if (cmd.toLowerCase().startsWith("give"))
|
||||
{
|
||||
if (cmd.toLowerCase().startsWith("give")) {
|
||||
String[] args = cmd.split(" ");
|
||||
if (args.length == 4)
|
||||
{
|
||||
if (args.length == 4) {
|
||||
Material material = Material.matchMaterial(args[2]);
|
||||
int amount = Integer.parseInt(args[3]);
|
||||
Player player = Bukkit.getPlayer(args[1]);
|
||||
if (!player.isOnline())
|
||||
{
|
||||
if (!player.isOnline()) {
|
||||
return false;
|
||||
}
|
||||
// See if the player has this item in their inventory;
|
||||
if (player.getInventory().contains(material) && player.getInventory().firstEmpty() < 0)
|
||||
{
|
||||
if (player.getInventory().contains(material) && player.getInventory().firstEmpty() < 0) {
|
||||
int spacesAvailable = 0;
|
||||
Map<Integer, ? extends ItemStack> contents = player.getInventory().all(material);
|
||||
for (ItemStack stack : contents.values())
|
||||
{
|
||||
for (ItemStack stack : contents.values()) {
|
||||
spacesAvailable += stack.getMaxStackSize() - stack.getAmount();
|
||||
}
|
||||
if (spacesAvailable < amount)
|
||||
{
|
||||
if (spacesAvailable < amount) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (player.getInventory().firstEmpty() < 0)
|
||||
{
|
||||
} else {
|
||||
if (player.getInventory().firstEmpty() < 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (String cmd : list)
|
||||
{
|
||||
for (String cmd : list) {
|
||||
cmd = cmd.replace("%player%", p.getName());
|
||||
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), cmd);
|
||||
}
|
||||
|
@ -15,12 +15,15 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.Arrays;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class ClipPlaceholderAPIManager extends PlaceholderExpansion implements Relational {
|
||||
|
||||
private static void logInvalid(String placeholder) {
|
||||
FactionsPlugin.getInstance().getLogger().log(Level.INFO, "Invalid request through PlaceholderAPI for placeholder '" + placeholder + "'");
|
||||
}
|
||||
|
||||
// Identifier for this expansion
|
||||
@Override
|
||||
public String getIdentifier() {
|
||||
@ -214,7 +217,7 @@ public class ClipPlaceholderAPIManager extends PlaceholderExpansion implements R
|
||||
case "faction_relation_color":
|
||||
return fPlayer.getColorTo(faction).toString();
|
||||
case "grace_time":
|
||||
if(FactionsPlugin.getInstance().getTimerManager().graceTimer.getRemaining() >= 0) {
|
||||
if (FactionsPlugin.getInstance().getTimerManager().graceTimer.getRemaining() >= 0) {
|
||||
return String.valueOf(TimerManager.getRemaining(FactionsPlugin.getInstance().getTimerManager().graceTimer.getRemaining(), true));
|
||||
} else {
|
||||
return TL.GRACE_DISABLED_PLACEHOLDER.toString();
|
||||
@ -249,10 +252,6 @@ public class ClipPlaceholderAPIManager extends PlaceholderExpansion implements R
|
||||
return TL.PLACEHOLDERAPI_NULL.toString();
|
||||
}
|
||||
|
||||
private static void logInvalid(String placeholder) {
|
||||
FactionsPlugin.getInstance().getLogger().log(Level.INFO, "Invalid request through PlaceholderAPI for placeholder '" + placeholder + "'");
|
||||
}
|
||||
|
||||
private int countOn(Faction f, Relation relation, Boolean status, FPlayer player) {
|
||||
int count = 0;
|
||||
for (Faction faction : Factions.getInstance().getAllFactions()) {
|
||||
|
@ -3,7 +3,6 @@ package com.massivecraft.factions.util;
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
import org.bukkit.metadata.MetadataValue;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
@ -1,12 +1,5 @@
|
||||
package com.massivecraft.factions.util.timer;
|
||||
|
||||
import com.massivecraft.factions.util.Config;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Factions - Developed by Driftay.
|
||||
* All rights reserved 2020.
|
||||
|
@ -8,8 +8,8 @@ import com.massivecraft.factions.util.Config;
|
||||
* Creation Date: 4/7/2020
|
||||
*/
|
||||
public abstract class Timer {
|
||||
protected final String name;
|
||||
public final long defaultCooldown;
|
||||
protected final String name;
|
||||
|
||||
|
||||
public Timer(String name, long defaultCooldown) {
|
||||
|
@ -16,14 +16,24 @@ import java.util.concurrent.TimeUnit;
|
||||
* Creation Date: 4/7/2020
|
||||
*/
|
||||
public class TimerManager implements Listener, Runnable {
|
||||
private final Set<Timer> timers;
|
||||
private final FactionsPlugin plugin;
|
||||
private final List<TimerRunnable> timerRunnableList = new ArrayList<>();
|
||||
private Config config;
|
||||
public GraceTimer graceTimer;
|
||||
private static final long MINUTE = TimeUnit.MINUTES.toMillis(1L);
|
||||
private static final long HOUR = TimeUnit.HOURS.toMillis(1L);
|
||||
private static final long MULTI_HOUR = TimeUnit.HOURS.toMillis(10);
|
||||
private final Set<Timer> timers;
|
||||
private final FactionsPlugin plugin;
|
||||
private final List<TimerRunnable> timerRunnableList = new ArrayList<>();
|
||||
public GraceTimer graceTimer;
|
||||
private Config config;
|
||||
|
||||
public TimerManager(FactionsPlugin plugin) {
|
||||
this.timers = new HashSet<>();
|
||||
this.plugin = plugin;
|
||||
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||
if (Conf.useGraceSystem) {
|
||||
this.registerTimer(this.graceTimer = new GraceTimer());
|
||||
}
|
||||
plugin.getServer().getScheduler().runTaskTimer(plugin, this, 4, 4);
|
||||
}
|
||||
|
||||
public static String getRemaining(long millis, boolean milliseconds) {
|
||||
return getRemaining(millis, milliseconds, true);
|
||||
@ -31,21 +41,11 @@ public class TimerManager implements Listener, Runnable {
|
||||
|
||||
public static String getRemaining(long duration, boolean milliseconds, boolean trail) {
|
||||
if ((milliseconds) && (duration < MINUTE)) {
|
||||
return ( (trail ? DateTimeFormats.REMAINING_SECONDS_TRAILING : DateTimeFormats.REMAINING_SECONDS).get()).format(duration * 0.001D) + 's';
|
||||
return ((trail ? DateTimeFormats.REMAINING_SECONDS_TRAILING : DateTimeFormats.REMAINING_SECONDS).get()).format(duration * 0.001D) + 's';
|
||||
}
|
||||
return DurationFormatUtils.formatDuration(duration, (duration >= HOUR ? (duration >= MULTI_HOUR ? "d" : "") + "d:" : "") + "HH:mm:ss");
|
||||
}
|
||||
|
||||
public TimerManager(FactionsPlugin plugin) {
|
||||
this.timers = new HashSet<>();
|
||||
this.plugin = plugin;
|
||||
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||
if(Conf.useGraceSystem) {
|
||||
this.registerTimer(this.graceTimer = new GraceTimer());
|
||||
}
|
||||
plugin.getServer().getScheduler().runTaskTimer(plugin, this, 4, 4);
|
||||
}
|
||||
|
||||
public Collection<Timer> getTimers() {
|
||||
return this.timers;
|
||||
}
|
||||
|
@ -45,15 +45,13 @@ public class TimerRunnable {
|
||||
return getRemaining(false);
|
||||
}
|
||||
|
||||
public long getRemaining(long now) {
|
||||
return getRemaining(false, now);
|
||||
}
|
||||
|
||||
|
||||
public void setRemaining(long remaining) {
|
||||
setExpiryMillis(remaining);
|
||||
}
|
||||
|
||||
public long getRemaining(long now) {
|
||||
return getRemaining(false, now);
|
||||
}
|
||||
|
||||
public long getRemaining(boolean ignorePaused) {
|
||||
if ((!ignorePaused) && (this.pauseMillis != 0L)) return this.pauseMillis;
|
||||
|
@ -26,14 +26,14 @@ public class GraceTimer extends GlobalTimer implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onBreak(EntityExplodeEvent e) {
|
||||
if(getRemaining() > 0)
|
||||
if (getRemaining() > 0)
|
||||
e.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onTNTPlace(BlockPlaceEvent event) {
|
||||
FPlayer fp = FPlayers.getInstance().getByPlayer(event.getPlayer());
|
||||
if(getRemaining() > 0) {
|
||||
if (getRemaining() > 0) {
|
||||
if (!fp.isAdminBypassing()) {
|
||||
if (event.getBlock().getType().equals(Material.TNT)) {
|
||||
event.setCancelled(true);
|
||||
|
@ -3,7 +3,10 @@ package com.massivecraft.factions.zcore;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.massivecraft.factions.*;
|
||||
import com.massivecraft.factions.Board;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.zcore.persist.SaveTask;
|
||||
import com.massivecraft.factions.zcore.util.PermUtil;
|
||||
import com.massivecraft.factions.zcore.util.Persist;
|
||||
|
@ -57,7 +57,7 @@ public class CustomFile {
|
||||
}
|
||||
|
||||
public boolean containsKey(String key) {
|
||||
return getCachedObjects().containsKey(key)|| getConfig().contains(key);
|
||||
return getCachedObjects().containsKey(key) || getConfig().contains(key);
|
||||
}
|
||||
|
||||
public String fetchString(String key) {
|
||||
|
@ -6,13 +6,11 @@ import com.github.stefvanschie.inventoryframework.pane.PaginatedPane;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
import com.massivecraft.factions.cmd.audit.FLogType;
|
||||
import com.massivecraft.factions.util.XMaterial;
|
||||
import com.massivecraft.factions.zcore.fperms.Access;
|
||||
import com.massivecraft.factions.zcore.fperms.Permissable;
|
||||
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
@ -16,7 +16,6 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author Saser
|
||||
@ -36,7 +35,8 @@ public class FUpgradeFrame {
|
||||
PaginatedPane pane = new PaginatedPane(0, 0, 9, this.gui.getRows());
|
||||
List<GuiItem> GUIItems = new ArrayList<>();
|
||||
ItemStack dummy = buildDummyItem();
|
||||
for (int x = 0; x <= this.gui.getRows() * 9 - 1; ++x) GUIItems.add(new GuiItem(dummy, e -> e.setCancelled(true)));
|
||||
for (int x = 0; x <= this.gui.getRows() * 9 - 1; ++x)
|
||||
GUIItems.add(new GuiItem(dummy, e -> e.setCancelled(true)));
|
||||
for (UpgradeType value : UpgradeType.values()) {
|
||||
if (value.getSlot() != -1) {
|
||||
GUIItems.set(value.getSlot(), new GuiItem(value.buildAsset(fplayer.getFaction()), e -> {
|
||||
|
@ -28,7 +28,7 @@ public class UpgradesListener implements Listener {
|
||||
if (e.isCancelled()) return;
|
||||
|
||||
if (!(e.getDamager() instanceof Player) || !(e.getEntity() instanceof Player)) return;
|
||||
if(e.getEntity() == null) return;
|
||||
if (e.getEntity() == null) return;
|
||||
|
||||
FPlayer fme = FPlayers.getInstance().getByPlayer((Player) e.getEntity());
|
||||
FPlayer dame = FPlayers.getInstance().getByPlayer((Player) e.getDamager());
|
||||
@ -36,7 +36,7 @@ public class UpgradesListener implements Listener {
|
||||
if (fme == null || dame == null) return;
|
||||
FLocation floc = new FLocation(fme.getPlayer().getLocation());
|
||||
|
||||
if(floc == null) return;
|
||||
if (floc == null) return;
|
||||
|
||||
if (Board.getInstance().getFactionAt(floc) == fme.getFaction()) {
|
||||
if (dame.getFaction() == fme.getFaction()) return;
|
||||
|
@ -738,7 +738,7 @@ public abstract class MemoryFPlayer implements FPlayer {
|
||||
public void sendFactionHereMessage(Faction from) {
|
||||
Faction toShow = Board.getInstance().getFactionAt(getLastStoodAt());
|
||||
|
||||
if(Conf.worldsNoClaiming.contains(getLastStoodAt().getWorldName())) return;
|
||||
if (Conf.worldsNoClaiming.contains(getLastStoodAt().getWorldName())) return;
|
||||
|
||||
if (showInfoBoard(toShow)) {
|
||||
FScoreboard.get(this).setTemporarySidebar(new FInfoSidebar(toShow));
|
||||
@ -873,7 +873,7 @@ public abstract class MemoryFPlayer implements FPlayer {
|
||||
return true;
|
||||
} else if (forFaction.isWarZone() && Permission.MANAGE_WAR_ZONE.has(getPlayer())) {
|
||||
return true;
|
||||
} else if (currentFaction.getAccess(this, PermissableAction.TERRITORY) == Access.ALLOW && forFaction != currentFaction ) {
|
||||
} else if (currentFaction.getAccess(this, PermissableAction.TERRITORY) == Access.ALLOW && forFaction != currentFaction) {
|
||||
return true;
|
||||
} else if (myFaction != forFaction) {
|
||||
error = plugin.txt.parse(TL.CLAIM_CANTCLAIM.toString(), forFaction.describeTo(this));
|
||||
@ -972,8 +972,7 @@ public abstract class MemoryFPlayer implements FPlayer {
|
||||
}
|
||||
|
||||
public void setFFlying(boolean fly, boolean damage) {
|
||||
if(FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight"))
|
||||
{
|
||||
if (FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight")) {
|
||||
Player player = getPlayer();
|
||||
if (player == null) return;
|
||||
|
||||
@ -1223,11 +1222,11 @@ public abstract class MemoryFPlayer implements FPlayer {
|
||||
}
|
||||
|
||||
|
||||
public boolean hasFriendlyFire(){
|
||||
public boolean hasFriendlyFire() {
|
||||
return friendlyFire;
|
||||
}
|
||||
|
||||
public void setFriendlyFire(boolean status){
|
||||
public void setFriendlyFire(boolean status) {
|
||||
friendlyFire = status;
|
||||
}
|
||||
|
||||
@ -1305,7 +1304,7 @@ public abstract class MemoryFPlayer implements FPlayer {
|
||||
|
||||
|
||||
// announce success
|
||||
if(!FactionsPlugin.cachedRadiusClaim) {
|
||||
if (!FactionsPlugin.cachedRadiusClaim) {
|
||||
Set<FPlayer> informTheseFPlayers = new HashSet<>();
|
||||
informTheseFPlayers.add(this);
|
||||
informTheseFPlayers.addAll(forFaction.getFPlayersWhereOnline(true));
|
||||
|
@ -1277,7 +1277,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
||||
if (Conf.logFactionDisband)
|
||||
FactionsPlugin.getInstance().log("The faction " + this.getTag() + " (" + this.getId() + ") has been disbanded since it has no members left" + (autoLeave ? " and by inactivity" : "") + ".");
|
||||
|
||||
if(FactionsPlugin.getInstance().getConfig().getBoolean("faction-disband-broadcast")) {
|
||||
if (FactionsPlugin.getInstance().getConfig().getBoolean("faction-disband-broadcast")) {
|
||||
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers())
|
||||
fplayer.msg(TL.COMMAND_DISBAND_BROADCAST_GENERIC, this.getTag(fplayer));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user