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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(fyou.isAlt()){
|
if (fyou.isAlt()) {
|
||||||
return;
|
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");
|
FactionsPlugin.instance.getFlogManager().log(targetFaction, FLogType.RANK_EDIT, context.fPlayer.getName(), fyou.getName(), ChatColor.RED + "Admin");
|
||||||
|
|
||||||
// Inform all players
|
// 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()) {
|
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));
|
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,65 +8,60 @@ 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;
|
||||||
|
|
||||||
public class CmdCheckpoint extends FCommand
|
public class CmdCheckpoint extends FCommand {
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Illyria Team
|
* @author Illyria Team
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public CmdCheckpoint()
|
public CmdCheckpoint() {
|
||||||
{
|
super();
|
||||||
super();
|
this.aliases.addAll(Aliases.checkpoint);
|
||||||
this.aliases.addAll(Aliases.checkpoint);
|
|
||||||
|
|
||||||
this.optionalArgs.put("set", "");
|
this.optionalArgs.put("set", "");
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.CHECKPOINT).playerOnly().memberOnly().build();
|
this.requirements = new CommandRequirements.Builder(Permission.CHECKPOINT).playerOnly().memberOnly().build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void perform(CommandContext context) {
|
public void perform(CommandContext context) {
|
||||||
if (!FactionsPlugin.getInstance().getConfig().getBoolean("checkpoints.Enabled")) {
|
if (!FactionsPlugin.getInstance().getConfig().getBoolean("checkpoints.Enabled")) {
|
||||||
context.msg(TL.COMMAND_CHECKPOINT_DISABLED);
|
context.msg(TL.COMMAND_CHECKPOINT_DISABLED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (context.args.size() == 1 && context.args.get(0).equalsIgnoreCase("set")) {
|
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());
|
||||||
FLocation myLocation = new FLocation(context.player.getLocation());
|
Faction myLocFaction = Board.getInstance().getFactionAt(myLocation);
|
||||||
Faction myLocFaction = Board.getInstance().getFactionAt(myLocation);
|
if (myLocFaction == Factions.getInstance().getWilderness() || myLocFaction == context.faction) {
|
||||||
if (myLocFaction == Factions.getInstance().getWilderness() || myLocFaction == context.faction) {
|
context.faction.setCheckpoint(context.player.getLocation());
|
||||||
context.faction.setCheckpoint(context.player.getLocation());
|
context.msg(TL.COMMAND_CHECKPOINT_SET);
|
||||||
context.msg(TL.COMMAND_CHECKPOINT_SET);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
context.msg(TL.COMMAND_CHECKPOINT_INVALIDLOCATION);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
PermissableAction action = PermissableAction.SETWARP;
|
context.msg(TL.COMMAND_CHECKPOINT_INVALIDLOCATION);
|
||||||
Access access = context.faction.getAccess(context.fPlayer, action);
|
|
||||||
if (access == Access.DENY) {
|
|
||||||
context.msg(TL.GENERIC_FPERM_NOPERMISSION, action.getName());
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
PermissableAction action = PermissableAction.SETWARP;
|
||||||
FLocation myLocation = new FLocation(context.player.getLocation());
|
Access access = context.faction.getAccess(context.fPlayer, action);
|
||||||
Faction myLocFaction = Board.getInstance().getFactionAt(myLocation);
|
if (access == Access.DENY) {
|
||||||
if (myLocFaction == Factions.getInstance().getWilderness() || myLocFaction == context.faction) {
|
context.msg(TL.GENERIC_FPERM_NOPERMISSION, action.getName());
|
||||||
context.faction.setCheckpoint(context.player.getLocation());
|
return;
|
||||||
context.msg(TL.COMMAND_CHECKPOINT_SET);
|
} else {
|
||||||
return;
|
FLocation myLocation = new FLocation(context.player.getLocation());
|
||||||
}else {
|
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 {
|
||||||
context.msg(TL.COMMAND_CHECKPOINT_INVALIDLOCATION);
|
context.msg(TL.COMMAND_CHECKPOINT_INVALIDLOCATION);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context.faction.getCheckpoint() == null) {
|
if (context.faction.getCheckpoint() == null) {
|
||||||
context.msg(TL.COMMAND_CHECKPOINT_NOT_SET);
|
context.msg(TL.COMMAND_CHECKPOINT_NOT_SET);
|
||||||
return;
|
return;
|
||||||
@ -85,9 +80,8 @@ public class CmdCheckpoint extends FCommand
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TL getUsageTranslation()
|
public TL getUsageTranslation() {
|
||||||
{
|
return TL.COMMAND_CHECKPOINT_DESCRIPTION;
|
||||||
return TL.COMMAND_CHECKPOINT_DESCRIPTION;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ public class CmdColeader extends FCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(you.isAlt()){
|
if (you.isAlt()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ public class CmdCreate extends FCommand {
|
|||||||
return;
|
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);
|
context.msg(TL.COMMAND_COOLDOWN);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -3,10 +3,7 @@ package com.massivecraft.factions.cmd;
|
|||||||
import com.massivecraft.factions.Conf;
|
import com.massivecraft.factions.Conf;
|
||||||
import com.massivecraft.factions.FPlayer;
|
import com.massivecraft.factions.FPlayer;
|
||||||
import com.massivecraft.factions.FPlayers;
|
import com.massivecraft.factions.FPlayers;
|
||||||
import com.massivecraft.factions.FactionsPlugin;
|
|
||||||
import com.massivecraft.factions.struct.Permission;
|
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.fperms.PermissableAction;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
import mkremins.fanciful.FancyMessage;
|
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));
|
context.faction.msg(TL.COMMAND_DEINVITE_REVOKES, context.fPlayer.describeTo(context.faction), you.describeTo(context.faction));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TL getUsageTranslation() {
|
public TL getUsageTranslation() {
|
||||||
return TL.COMMAND_DEINVITE_DESCRIPTION;
|
return TL.COMMAND_DEINVITE_DESCRIPTION;
|
||||||
|
@ -70,7 +70,7 @@ public class CmdDisband extends FCommand {
|
|||||||
return;
|
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);
|
context.msg(TL.COMMAND_COOLDOWN);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
|
|
||||||
public class CmdFly extends FCommand {
|
public class CmdFly extends FCommand {
|
||||||
|
|
||||||
|
public static final boolean fly = FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight");
|
||||||
/**
|
/**
|
||||||
* @author FactionsUUID Team
|
* @author FactionsUUID Team
|
||||||
*/
|
*/
|
||||||
@ -27,8 +28,6 @@ public class CmdFly extends FCommand {
|
|||||||
public static ConcurrentHashMap<String, Boolean> flyMap = new ConcurrentHashMap<>();
|
public static ConcurrentHashMap<String, Boolean> flyMap = new ConcurrentHashMap<>();
|
||||||
public static BukkitTask particleTask = null;
|
public static BukkitTask particleTask = null;
|
||||||
|
|
||||||
public static final boolean fly = FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight");
|
|
||||||
|
|
||||||
|
|
||||||
public CmdFly() {
|
public CmdFly() {
|
||||||
super();
|
super();
|
||||||
@ -65,25 +64,25 @@ public class CmdFly extends FCommand {
|
|||||||
|
|
||||||
if (toFac != fme.getFaction()) {
|
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 (!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;
|
return false;
|
||||||
}
|
}
|
||||||
Access access = toFac.getAccess(fme, PermissableAction.FLY);
|
Access access = toFac.getAccess(fme, PermissableAction.FLY);
|
||||||
if ((!(me.hasPermission(Permission.FLY_ENEMY.node) || access == Access.ALLOW)) && toFac.getRelationTo(fme.getFaction()) == Relation.ENEMY) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
if (!(me.hasPermission(Permission.FLY_ALLY.node) || access == Access.ALLOW) && toFac.getRelationTo(fme.getFaction()) == Relation.ALLY) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
if (!(me.hasPermission(Permission.FLY_TRUCE.node) || access == Access.ALLOW) && toFac.getRelationTo(fme.getFaction()) == Relation.TRUCE) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(me.hasPermission(Permission.FLY_NEUTRAL.node) || access == Access.ALLOW) && toFac.getRelationTo(fme.getFaction()) == Relation.NEUTRAL && !toFac.isSystemFaction()) {
|
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 false;
|
||||||
}
|
}
|
||||||
return me.hasPermission(Permission.FLY_FLY.node) && (access != Access.DENY || toFac.isSystemFaction());
|
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 class CmdFriendlyFire extends FCommand {
|
||||||
|
|
||||||
public CmdFriendlyFire(){
|
public CmdFriendlyFire() {
|
||||||
super();
|
super();
|
||||||
this.aliases.addAll(Aliases.friendlyFire);
|
this.aliases.addAll(Aliases.friendlyFire);
|
||||||
|
|
||||||
@ -23,12 +23,12 @@ public class CmdFriendlyFire extends FCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void perform(CommandContext context) {
|
public void perform(CommandContext context) {
|
||||||
if(!Conf.friendlyFireFPlayersCommand){
|
if (!Conf.friendlyFireFPlayersCommand) {
|
||||||
context.msg(TL.GENERIC_DISABLED, "friendly fire");
|
context.msg(TL.GENERIC_DISABLED, "friendly fire");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(context.fPlayer.hasFriendlyFire()){
|
if (context.fPlayer.hasFriendlyFire()) {
|
||||||
context.fPlayer.setFriendlyFire(false);
|
context.fPlayer.setFriendlyFire(false);
|
||||||
context.msg(TL.COMMAND_FRIENDLY_FIRE_TOGGLE_OFF);
|
context.msg(TL.COMMAND_FRIENDLY_FIRE_TOGGLE_OFF);
|
||||||
} else {
|
} else {
|
||||||
|
@ -9,7 +9,6 @@ import com.massivecraft.factions.util.CC;
|
|||||||
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 mkremins.fanciful.FancyMessage;
|
import mkremins.fanciful.FancyMessage;
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
|
|
||||||
public class CmdInvite extends FCommand {
|
public class CmdInvite extends FCommand {
|
||||||
|
|
||||||
@ -61,9 +60,9 @@ public class CmdInvite extends FCommand {
|
|||||||
if (target.isOnline()) {
|
if (target.isOnline()) {
|
||||||
// Tooltips, colors, and commands only apply to the string immediately before it.
|
// Tooltips, colors, and commands only apply to the string immediately before it.
|
||||||
FancyMessage message = new FancyMessage(TL.COMMAND_INVITE_INVITEDYOU.toString()
|
FancyMessage message = new FancyMessage(TL.COMMAND_INVITE_INVITEDYOU.toString()
|
||||||
.replace("%1$s", context.fPlayer.describeTo(target, true))
|
.replace("%1$s", context.fPlayer.describeTo(target, true))
|
||||||
.replace("%2$s", context.faction.getTag())
|
.replace("%2$s", context.faction.getTag())
|
||||||
.replaceAll("&", "§"))
|
.replaceAll("&", "§"))
|
||||||
.tooltip(TL.COMMAND_INVITE_CLICKTOJOIN.toString())
|
.tooltip(TL.COMMAND_INVITE_CLICKTOJOIN.toString())
|
||||||
.command("/" + Conf.baseCommandAliases.get(0) + " join " + context.faction.getTag());
|
.command("/" + Conf.baseCommandAliases.get(0) + " join " + context.faction.getTag());
|
||||||
message.send(target.getPlayer());
|
message.send(target.getPlayer());
|
||||||
|
@ -1,19 +1,12 @@
|
|||||||
package com.massivecraft.factions.cmd;
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
import com.massivecraft.factions.*;
|
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.event.FPlayerJoinEvent;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
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.frame.fupgrades.UpgradeType;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
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 org.bukkit.Bukkit;
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
public class CmdJoin extends FCommand {
|
public class CmdJoin extends FCommand {
|
||||||
|
|
||||||
public CmdJoin() {
|
public CmdJoin() {
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
package com.massivecraft.factions.cmd;
|
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.cmd.audit.FLogType;
|
||||||
import com.massivecraft.factions.event.FPlayerLeaveEvent;
|
import com.massivecraft.factions.event.FPlayerLeaveEvent;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
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());
|
FactionsPlugin.instance.logFactionEvent(toKickFaction, FLogType.INVITES, context.fPlayer.getName(), CC.Red + "kicked", toKick.getName());
|
||||||
toKickFaction.deinvite(toKick);
|
toKickFaction.deinvite(toKick);
|
||||||
toKick.resetFactionData();
|
toKick.resetFactionData();
|
||||||
if(!CmdFly.checkBypassPerms(toKick, toKick.getPlayer(), toKickFaction, false)){
|
if (!CmdFly.checkBypassPerms(toKick, toKick.getPlayer(), toKickFaction, false)) {
|
||||||
CmdFly.disableFlight(toKick);
|
CmdFly.disableFlight(toKick);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ public class CmdMod extends FCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(you.isAlt()){
|
if (you.isAlt()) {
|
||||||
return;
|
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();
|
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);
|
context.msg(TL.COMMAND_COOLDOWN);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -51,7 +51,7 @@ public class CmdOpen extends FCommand {
|
|||||||
Cooldown.setCooldown(fplayer.getPlayer(), "openCooldown", FactionsPlugin.getInstance().getConfig().getInt("fcooldowns.f-open"));
|
Cooldown.setCooldown(fplayer.getPlayer(), "openCooldown", FactionsPlugin.getInstance().getConfig().getInt("fcooldowns.f-open"));
|
||||||
continue;
|
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);
|
fplayer.msg(TL.COMMAND_OPEN_CHANGED, context.faction.getTag(fplayer.getFaction()), open);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -54,7 +54,7 @@ public class CmdTag extends FCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Cooldown.isOnCooldown(context.player, "tagCooldown") && !context.fPlayer.isAdminBypassing()){
|
if (Cooldown.isOnCooldown(context.player, "tagCooldown") && !context.fPlayer.isAdminBypassing()) {
|
||||||
context.msg(TL.COMMAND_COOLDOWN);
|
context.msg(TL.COMMAND_COOLDOWN);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -72,7 +72,6 @@ public class CmdTag extends FCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
String oldtag = context.faction.getTag();
|
String oldtag = context.faction.getTag();
|
||||||
context.faction.setTag(tag);
|
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.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.Material;
|
|
||||||
|
|
||||||
public class CmdUnban extends FCommand {
|
public class CmdUnban extends FCommand {
|
||||||
|
|
||||||
|
@ -83,10 +83,13 @@ public class CmdUnclaim extends FCommand {
|
|||||||
this.stop();
|
this.stop();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
boolean didUnClaim = unClaim(new FLocation(context.player), context);
|
||||||
|
if (didUnClaim && !context.fPlayer.canFlyAtLocation())
|
||||||
|
context.fPlayer.setFFlying(false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,14 +57,8 @@ public class CmdUnclaimall extends FCommand {
|
|||||||
}
|
}
|
||||||
if (Econ.shouldBeUsed()) {
|
if (Econ.shouldBeUsed()) {
|
||||||
double refund = Econ.calculateTotalLandRefund(target.getLandRounded());
|
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())) {
|
||||||
if (!Econ.modifyMoney(target, refund, TL.COMMAND_UNCLAIMALL_TOUNCLAIM.toString(), TL.COMMAND_UNCLAIMALL_FORUNCLAIM.toString())) {
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!Econ.modifyMoney(target, refund, TL.COMMAND_UNCLAIMALL_TOUNCLAIM.toString(), TL.COMMAND_UNCLAIMALL_FORUNCLAIM.toString())) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ public class CmdGrace extends FCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(context.args.size() == 1) {
|
if (context.args.size() == 1) {
|
||||||
if (context.sender.hasPermission(String.valueOf(Permission.GRACETOGGLE))) {
|
if (context.sender.hasPermission(String.valueOf(Permission.GRACETOGGLE))) {
|
||||||
if (context.argAsString(0).equalsIgnoreCase("on") || context.argAsString(0).equalsIgnoreCase("start")) {
|
if (context.argAsString(0).equalsIgnoreCase("on") || context.argAsString(0).equalsIgnoreCase("start")) {
|
||||||
FactionsPlugin.getInstance().getTimerManager().graceTimer.setPaused(false);
|
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());
|
context.fPlayer.msg(TL.COMMAND_GRACE_DISABLED_NO_FORMAT.toString());
|
||||||
} else {
|
} else {
|
||||||
context.fPlayer.msg(TL.COMMAND_GRACE_TIME_REMAINING, String.valueOf(TimerManager.getRemaining(FactionsPlugin.getInstance().getTimerManager().graceTimer.getRemaining(), true)));
|
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);
|
Faction them = context.argAsFaction(0);
|
||||||
if (them == null) return;
|
if (them == null) return;
|
||||||
|
|
||||||
if(!context.faction.isNormal()) return;
|
if (!context.faction.isNormal()) return;
|
||||||
|
|
||||||
if (!them.isNormal()) {
|
if (!them.isNormal()) {
|
||||||
context.msg(TL.COMMAND_RELATIONS_ALLTHENOPE);
|
context.msg(TL.COMMAND_RELATIONS_ALLTHENOPE);
|
||||||
|
@ -74,7 +74,7 @@ public class FPromoteCommand extends FCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(target.isAlt()){
|
if (target.isAlt()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,8 @@ public class Econ {
|
|||||||
}
|
}
|
||||||
econ = rsp.getProvider();
|
econ = rsp.getProvider();
|
||||||
FactionsPlugin.getInstance().log("Economy integration through Vault plugin successful.");
|
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();
|
//FactionsPlugin.getInstance().cmdBase.cmdHelp.updateHelp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,151 +1,129 @@
|
|||||||
package com.massivecraft.factions.integration.dynmap;
|
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.AreaMarker;
|
||||||
import org.dynmap.markers.MarkerSet;
|
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
|
|
||||||
*/
|
|
||||||
|
|
||||||
// -------------------------------------------- //
|
/**
|
||||||
// FIELDS
|
* @author FactionsUUID Team
|
||||||
// -------------------------------------------- //
|
*/
|
||||||
|
|
||||||
public String label;
|
// -------------------------------------------- //
|
||||||
public String world;
|
// FIELDS
|
||||||
public double[] x;
|
// -------------------------------------------- //
|
||||||
public double[] z;
|
|
||||||
|
|
||||||
private List<List<Point>> polyLine = new ArrayList<List<Point>>();
|
public String label;
|
||||||
|
public String world;
|
||||||
|
public double[] x;
|
||||||
|
public double[] z;
|
||||||
|
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>>();
|
||||||
|
|
||||||
public String description;
|
// -------------------------------------------- //
|
||||||
|
// CREATE
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public int lineColor;
|
public static boolean equals(AreaMarker marker, double[] x, double[] z) {
|
||||||
public double lineOpacity;
|
int length = marker.getCornerCount();
|
||||||
public int lineWeight;
|
|
||||||
|
|
||||||
public int fillColor;
|
if (x.length != length) {
|
||||||
public double fillOpacity;
|
return false;
|
||||||
|
}
|
||||||
|
if (z.length != length) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean boost;
|
for (int i = 0; i < length; i++) {
|
||||||
|
if (marker.getCornerX(i) != x[i]) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (marker.getCornerZ(i) != z[i]) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
return true;
|
||||||
// CREATE
|
}
|
||||||
// -------------------------------------------- //
|
|
||||||
|
|
||||||
public static boolean equals(AreaMarker marker, double[] x, double[] z)
|
public List<List<Point>> getPolyLine() {
|
||||||
{
|
return polyLine;
|
||||||
int length = marker.getCornerCount();
|
}
|
||||||
|
|
||||||
if (x.length != length)
|
public void setPolyLine(List<List<Point>> points) {
|
||||||
{
|
polyLine.clear();
|
||||||
return false;
|
polyLine.addAll(points);
|
||||||
}
|
}
|
||||||
if (z.length != length)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < length; i++)
|
// -------------------------------------------- //
|
||||||
{
|
// UPDATE
|
||||||
if (marker.getCornerX(i) != x[i])
|
// -------------------------------------------- //
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (marker.getCornerZ(i) != z[i])
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
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) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public void setPolyLine(List<List<Point>> points)
|
int counter = 0;
|
||||||
{
|
|
||||||
polyLine.clear();
|
|
||||||
polyLine.addAll(points);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<List<Point>> getPolyLine()
|
// Description
|
||||||
{
|
ret.setDescription(this.description);
|
||||||
return polyLine;
|
|
||||||
}
|
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// Line Style
|
||||||
// UPDATE
|
ret.setLineStyle(0, 0, 0);
|
||||||
// -------------------------------------------- //
|
|
||||||
|
|
||||||
public AreaMarker create(MarkerSet markerset, String markerId)
|
// Fill Style
|
||||||
{
|
ret.setFillStyle(this.fillOpacity, this.fillColor);
|
||||||
AreaMarker ret = markerset.createAreaMarker(markerId, this.label, false, this.world, this.x, this.z, false // not persistent
|
|
||||||
);
|
|
||||||
if (ret == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
int counter = 0;
|
// Boost Flag
|
||||||
|
ret.setBoostFlag(this.boost);
|
||||||
|
|
||||||
// Description
|
return ret;
|
||||||
ret.setDescription(this.description);
|
}
|
||||||
|
// -------------------------------------------- //
|
||||||
|
// UTIL
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
// Line Style
|
public void update(AreaMarker marker) {
|
||||||
ret.setLineStyle(0, 0, 0);
|
// Corner Locations
|
||||||
|
if (!equals(marker, this.x, this.z)) {
|
||||||
|
marker.setCornerLocations(this.x, this.z);
|
||||||
|
}
|
||||||
|
|
||||||
// Fill Style
|
// Label
|
||||||
ret.setFillStyle(this.fillOpacity, this.fillColor);
|
if (!marker.getLabel().equals(this.label)) {
|
||||||
|
marker.setLabel(this.label);
|
||||||
|
}
|
||||||
|
if (!marker.getDescription().equals(this.description)) {
|
||||||
|
marker.setDescription(this.description);
|
||||||
|
}
|
||||||
|
|
||||||
// Boost Flag
|
// // Line Style
|
||||||
ret.setBoostFlag(this.boost);
|
// if (marker.getLineWeight() != this.lineWeight || marker.getLineOpacity() != this.lineOpacity || marker.getLineColor() != this.lineColor)
|
||||||
|
// {
|
||||||
|
// marker.setLineStyle(this.lineWeight, this.lineOpacity, this.lineColor);
|
||||||
|
// }
|
||||||
|
|
||||||
return ret;
|
// Fill Style
|
||||||
}
|
if ((marker.getFillOpacity() != this.fillOpacity) || (marker.getFillColor() != this.fillColor)) {
|
||||||
// -------------------------------------------- //
|
marker.setFillStyle(this.fillOpacity, this.fillColor);
|
||||||
// UTIL
|
}
|
||||||
// -------------------------------------------- //
|
// Boost Flag
|
||||||
|
if (marker.getBoostFlag() != this.boost) {
|
||||||
public void update(AreaMarker marker)
|
marker.setBoostFlag(this.boost);
|
||||||
{
|
}
|
||||||
// Corner Locations
|
}
|
||||||
if (!equals(marker, this.x, this.z))
|
|
||||||
{
|
|
||||||
marker.setCornerLocations(this.x, this.z);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Label
|
|
||||||
if (!marker.getLabel().equals(this.label))
|
|
||||||
{
|
|
||||||
marker.setLabel(this.label);
|
|
||||||
}
|
|
||||||
if (!marker.getDescription().equals(this.description))
|
|
||||||
{
|
|
||||||
marker.setDescription(this.description);
|
|
||||||
}
|
|
||||||
|
|
||||||
// // Line Style
|
|
||||||
// if (marker.getLineWeight() != this.lineWeight || marker.getLineOpacity() != this.lineOpacity || marker.getLineColor() != this.lineColor)
|
|
||||||
// {
|
|
||||||
// marker.setLineStyle(this.lineWeight, this.lineOpacity, this.lineColor);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Fill Style
|
|
||||||
if ((marker.getFillOpacity() != this.fillOpacity) || (marker.getFillColor() != this.fillColor))
|
|
||||||
{
|
|
||||||
marker.setFillStyle(this.fillOpacity, this.fillColor);
|
|
||||||
}
|
|
||||||
// Boost Flag
|
|
||||||
if (marker.getBoostFlag() != this.boost)
|
|
||||||
{
|
|
||||||
marker.setBoostFlag(this.boost);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,62 +1,49 @@
|
|||||||
package com.massivecraft.factions.integration.dynmap;
|
package com.massivecraft.factions.integration.dynmap;
|
||||||
|
|
||||||
import java.awt.Point;
|
import java.awt.*;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class TempLine
|
public class TempLine {
|
||||||
{
|
private Point p1;
|
||||||
private Point p1;
|
private Point p2;
|
||||||
private Point p2;
|
private List<TempLine> connectedLines = new ArrayList<TempLine>();
|
||||||
private List<TempLine> connectedLines = new ArrayList<TempLine>();
|
|
||||||
|
|
||||||
TempLine(Point p1, Point p2)
|
TempLine(Point p1, Point p2) {
|
||||||
{
|
this.p1 = p1;
|
||||||
this.p1 = p1;
|
this.p2 = p2;
|
||||||
this.p2 = p2;
|
}
|
||||||
|
|
||||||
|
public Point getP1() {
|
||||||
|
return p1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Point getP2() {
|
||||||
|
return p2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addAdditionLines(List<TempLine> connectedLines) {
|
||||||
|
this.connectedLines = connectedLines;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TempLine> getConnectedLines() {
|
||||||
|
return connectedLines;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
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) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Point getP1()
|
@Override
|
||||||
{
|
public int hashCode() {
|
||||||
return p1;
|
String test = "" + (p1.x + p2.x);
|
||||||
}
|
test += " " + (p1.y + p2.y);
|
||||||
|
return test.hashCode();
|
||||||
public Point getP2()
|
}
|
||||||
{
|
|
||||||
return p2;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addAdditionLines(List<TempLine> connectedLines)
|
|
||||||
{
|
|
||||||
this.connectedLines = connectedLines;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<TempLine> getConnectedLines()
|
|
||||||
{
|
|
||||||
return connectedLines;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode()
|
|
||||||
{
|
|
||||||
String test = "" + (p1.x + p2.x);
|
|
||||||
test += " " + (p1.y + p2.y);
|
|
||||||
return test.hashCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,111 +1,99 @@
|
|||||||
package com.massivecraft.factions.integration.dynmap;
|
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.MarkerSet;
|
||||||
import org.dynmap.markers.PolyLineMarker;
|
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
|
|
||||||
*/
|
|
||||||
|
|
||||||
// -------------------------------------------- //
|
/**
|
||||||
// FIELDS
|
* @author FactionsUUID Team
|
||||||
// -------------------------------------------- //
|
*/
|
||||||
|
|
||||||
public String world;
|
// -------------------------------------------- //
|
||||||
|
// FIELDS
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public List<Point> polyLine = new ArrayList<Point>();
|
public String world;
|
||||||
|
|
||||||
public int lineColor;
|
public List<Point> polyLine = new ArrayList<Point>();
|
||||||
public double lineOpacity;
|
|
||||||
public int lineWeight;
|
|
||||||
|
|
||||||
// -------------------------------------------- //
|
public int lineColor;
|
||||||
// CREATE
|
public double lineOpacity;
|
||||||
// -------------------------------------------- //
|
public int lineWeight;
|
||||||
|
|
||||||
public static boolean equals(PolyLineMarker marker, List<Point> points)
|
// -------------------------------------------- //
|
||||||
{
|
// CREATE
|
||||||
int length = marker.getCornerCount();
|
// -------------------------------------------- //
|
||||||
|
|
||||||
if (points.size() != length)
|
public static boolean equals(PolyLineMarker marker, List<Point> points) {
|
||||||
{
|
int length = marker.getCornerCount();
|
||||||
return false;
|
|
||||||
}
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
if (points.size() != length) {
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
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) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
return true;
|
||||||
// UPDATE
|
}
|
||||||
// -------------------------------------------- //
|
|
||||||
|
|
||||||
public PolyLineMarker create(MarkerSet markerset, String markerId)
|
// -------------------------------------------- //
|
||||||
{
|
// UPDATE
|
||||||
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++)
|
|
||||||
{
|
|
||||||
Point p = polyLine.get(i);
|
|
||||||
polyX[i] = p.getX();
|
|
||||||
polyY[i] = 64;
|
|
||||||
polyZ[i] = p.getY();
|
|
||||||
}
|
|
||||||
PolyLineMarker poly = markerset.createPolyLineMarker(markerId, "", false, this.world, polyX, polyY, polyZ, false);
|
|
||||||
// Poly Line Style
|
|
||||||
if (poly != null)
|
|
||||||
{
|
|
||||||
poly.setLineStyle(this.lineWeight, this.lineOpacity, this.lineColor);
|
|
||||||
}
|
|
||||||
return poly;
|
|
||||||
}
|
|
||||||
|
|
||||||
// -------------------------------------------- //
|
public PolyLineMarker create(MarkerSet markerset, String markerId) {
|
||||||
// UTIL
|
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++) {
|
||||||
|
Point p = polyLine.get(i);
|
||||||
|
polyX[i] = p.getX();
|
||||||
|
polyY[i] = 64;
|
||||||
|
polyZ[i] = p.getY();
|
||||||
|
}
|
||||||
|
PolyLineMarker poly = markerset.createPolyLineMarker(markerId, "", false, this.world, polyX, polyY, polyZ, false);
|
||||||
|
// Poly Line Style
|
||||||
|
if (poly != null) {
|
||||||
|
poly.setLineStyle(this.lineWeight, this.lineOpacity, this.lineColor);
|
||||||
|
}
|
||||||
|
return poly;
|
||||||
|
}
|
||||||
|
|
||||||
public void update(PolyLineMarker marker)
|
// -------------------------------------------- //
|
||||||
{
|
// UTIL
|
||||||
// Corner Locations
|
// -------------------------------------------- //
|
||||||
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++)
|
|
||||||
{
|
|
||||||
Point p = polyLine.get(i);
|
|
||||||
polyX[i] = p.getX();
|
|
||||||
polyY[i] = 64;
|
|
||||||
polyZ[i] = p.getY();
|
|
||||||
}
|
|
||||||
marker.setCornerLocations(polyX, polyY, polyZ);
|
|
||||||
marker.setLineStyle(this.lineWeight, this.lineOpacity, this.lineColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Line Style
|
public void update(PolyLineMarker marker) {
|
||||||
if (marker.getLineWeight() != this.lineWeight || marker.getLineOpacity() != this.lineOpacity || marker.getLineColor() != this.lineColor)
|
// Corner Locations
|
||||||
{
|
if (!equals(marker, polyLine)) {
|
||||||
marker.setLineStyle(this.lineWeight, this.lineOpacity, this.lineColor);
|
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++) {
|
||||||
|
Point p = polyLine.get(i);
|
||||||
|
polyX[i] = p.getX();
|
||||||
|
polyY[i] = 64;
|
||||||
|
polyZ[i] = p.getY();
|
||||||
|
}
|
||||||
|
marker.setCornerLocations(polyX, polyY, polyZ);
|
||||||
|
marker.setLineStyle(this.lineWeight, this.lineOpacity, this.lineColor);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
// Line Style
|
||||||
|
if (marker.getLineWeight() != this.lineWeight || marker.getLineOpacity() != this.lineOpacity || marker.getLineColor() != this.lineColor) {
|
||||||
|
marker.setLineStyle(this.lineWeight, this.lineOpacity, this.lineColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -4,7 +4,6 @@ import com.massivecraft.factions.*;
|
|||||||
import com.massivecraft.factions.event.PowerLossEvent;
|
import com.massivecraft.factions.event.PowerLossEvent;
|
||||||
import com.massivecraft.factions.struct.Relation;
|
import com.massivecraft.factions.struct.Relation;
|
||||||
import com.massivecraft.factions.util.MiscUtil;
|
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.fperms.PermissableAction;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
@ -4,7 +4,6 @@ import com.massivecraft.factions.*;
|
|||||||
import com.massivecraft.factions.cmd.CmdFGlobal;
|
import com.massivecraft.factions.cmd.CmdFGlobal;
|
||||||
import com.massivecraft.factions.cmd.CmdFly;
|
import com.massivecraft.factions.cmd.CmdFly;
|
||||||
import com.massivecraft.factions.cmd.CmdSeeChunk;
|
import com.massivecraft.factions.cmd.CmdSeeChunk;
|
||||||
import com.massivecraft.factions.cmd.FCmdRoot;
|
|
||||||
import com.massivecraft.factions.cmd.audit.FLogType;
|
import com.massivecraft.factions.cmd.audit.FLogType;
|
||||||
import com.massivecraft.factions.cmd.logout.LogoutHandler;
|
import com.massivecraft.factions.cmd.logout.LogoutHandler;
|
||||||
import com.massivecraft.factions.cmd.wild.CmdWild;
|
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 net.dv8tion.jda.core.entities.TextChannel;
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Boat;
|
|
||||||
import org.bukkit.entity.Minecart;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -57,7 +54,9 @@ import java.util.logging.Level;
|
|||||||
|
|
||||||
public class FactionsPlayerListener implements Listener {
|
public class FactionsPlayerListener implements Listener {
|
||||||
|
|
||||||
|
public final static Map<UUID, Location> lastLocations = new HashMap<>();
|
||||||
public static Set<FLocation> corners;
|
public static Set<FLocation> corners;
|
||||||
|
public static BukkitTask positionTask = null;
|
||||||
/**
|
/**
|
||||||
* @author FactionsUUID Team
|
* @author FactionsUUID Team
|
||||||
*/
|
*/
|
||||||
@ -655,9 +654,6 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
return (result.length() == 3 ? result + "0" : result) + "/hrs ago";
|
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() {
|
public void startPositionCheck() {
|
||||||
positionTask = Bukkit.getScheduler().runTaskTimer(FactionsPlugin.getInstance(), () -> {
|
positionTask = Bukkit.getScheduler().runTaskTimer(FactionsPlugin.getInstance(), () -> {
|
||||||
if (lastLocations.isEmpty()) return;
|
if (lastLocations.isEmpty()) return;
|
||||||
@ -741,7 +737,8 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
me.attemptClaim(me.getAutoClaimFor(), newLocation, true);
|
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(","));
|
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()) {
|
} else if (me.isAutoSafeClaimEnabled()) {
|
||||||
if (!Permission.MANAGE_SAFE_ZONE.has(player)) {
|
if (!Permission.MANAGE_SAFE_ZONE.has(player)) {
|
||||||
|
@ -26,205 +26,166 @@ import java.util.Set;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class ShopGUIFrame
|
public class ShopGUIFrame {
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Driftay
|
* @author Driftay
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private Gui gui;
|
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")));
|
||||||
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());
|
||||||
PaginatedPane pane = new PaginatedPane(0, 0, 9, gui.getRows());
|
List<GuiItem> GUIItems = new ArrayList<>();
|
||||||
List<GuiItem> GUIItems = new ArrayList<>();
|
ItemStack dummy = buildDummyItem(fplayer.getFaction());
|
||||||
ItemStack dummy = buildDummyItem(fplayer.getFaction());
|
for (int x = 0; x <= (gui.getRows() * 9) - 1; x++)
|
||||||
for (int x = 0; x <= (gui.getRows() * 9) - 1; x++)
|
GUIItems.add(new GuiItem(dummy, e -> e.setCancelled(true)));
|
||||||
GUIItems.add(new GuiItem(dummy, e -> e.setCancelled(true)));
|
|
||||||
|
|
||||||
Set<String> items = FactionsPlugin.getInstance().getFileManager().getShop().getConfig().getConfigurationSection("items").getKeys(false);
|
Set<String> items = FactionsPlugin.getInstance().getFileManager().getShop().getConfig().getConfigurationSection("items").getKeys(false);
|
||||||
for (String s : items)
|
for (String s : items) {
|
||||||
{
|
if (!checkShopConfig(s)) {
|
||||||
if (!checkShopConfig(s))
|
continue;
|
||||||
{
|
}
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
int slot = FactionsPlugin.getInstance().getFileManager().getShop().fetchInt("items." + s + ".slot");
|
int slot = FactionsPlugin.getInstance().getFileManager().getShop().fetchInt("items." + s + ".slot");
|
||||||
ItemStack item = XMaterial.matchXMaterial(FactionsPlugin.getInstance().getFileManager().getShop().fetchString("items." + s + ".block")).get().parseItem();
|
ItemStack item = XMaterial.matchXMaterial(FactionsPlugin.getInstance().getFileManager().getShop().fetchString("items." + s + ".block")).get().parseItem();
|
||||||
int cost = FactionsPlugin.getInstance().getFileManager().getShop().fetchInt("items." + s + ".cost");
|
int cost = FactionsPlugin.getInstance().getFileManager().getShop().fetchInt("items." + s + ".cost");
|
||||||
String name = FactionsPlugin.getInstance().getFileManager().getShop().fetchString("items." + s + ".name");
|
String name = FactionsPlugin.getInstance().getFileManager().getShop().fetchString("items." + s + ".name");
|
||||||
boolean glowing = FactionsPlugin.getInstance().getFileManager().getShop().fetchBoolean("items." + s + ".glowing");
|
boolean glowing = FactionsPlugin.getInstance().getFileManager().getShop().fetchBoolean("items." + s + ".glowing");
|
||||||
List<String> lore = FactionsPlugin.getInstance().getFileManager().getShop().fetchStringList("items." + s + ".lore");
|
List<String> lore = FactionsPlugin.getInstance().getFileManager().getShop().fetchStringList("items." + s + ".lore");
|
||||||
|
|
||||||
assert item != null;
|
assert item != null;
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
meta.setDisplayName(FactionsPlugin.instance.color(name));
|
meta.setDisplayName(FactionsPlugin.instance.color(name));
|
||||||
meta.addItemFlags();
|
meta.addItemFlags();
|
||||||
if (glowing)
|
if (glowing) {
|
||||||
{
|
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
||||||
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
meta.addEnchant(Enchantment.DURABILITY, 1, true);
|
||||||
meta.addEnchant(Enchantment.DURABILITY, 1, true);
|
}
|
||||||
}
|
if (!glowing)
|
||||||
if (!glowing)
|
meta.removeEnchant(Enchantment.DURABILITY);
|
||||||
meta.removeEnchant(Enchantment.DURABILITY);
|
List<String> replacedLore = lore.stream().map(t -> t.replace("{cost}", cost + "")).collect(Collectors.toList());
|
||||||
List<String> replacedLore = lore.stream().map(t -> t.replace("{cost}", cost + "")).collect(Collectors.toList());
|
meta.setLore(FactionsPlugin.instance.colorList(replacedLore));
|
||||||
meta.setLore(FactionsPlugin.instance.colorList(replacedLore));
|
item.setItemMeta(meta);
|
||||||
item.setItemMeta(meta);
|
GUIItems.set(slot, new GuiItem(item, e ->
|
||||||
GUIItems.set(slot, new GuiItem(item, e ->
|
{
|
||||||
{
|
e.setCancelled(true);
|
||||||
e.setCancelled(true);
|
FPlayer fme = FPlayers.getInstance().getByPlayer((Player) e.getWhoClicked());
|
||||||
FPlayer fme = FPlayers.getInstance().getByPlayer((Player) e.getWhoClicked());
|
if (fplayer.getFaction().getPoints() >= cost) {
|
||||||
if (fplayer.getFaction().getPoints() >= cost)
|
if (runCommands(FactionsPlugin.getInstance().getFileManager().getShop().fetchStringList("items." + s + ".cmds"), fplayer.getPlayer())) {
|
||||||
{
|
fplayer.getFaction().setPoints(fplayer.getFaction().getPoints() - cost);
|
||||||
if (runCommands(FactionsPlugin.getInstance().getFileManager().getShop().fetchStringList("items." + s + ".cmds"), fplayer.getPlayer()))
|
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)))
|
||||||
fplayer.getFaction().setPoints(fplayer.getFaction().getPoints() - cost);
|
.replace("{cost}", cost + ""));
|
||||||
for (FPlayer fplayerBuy : fplayer.getFaction().getFPlayers())
|
}
|
||||||
{
|
buildGUI(fme);
|
||||||
fplayerBuy.getPlayer().sendMessage(TL.SHOP_BOUGHT_BROADCAST_FACTION.toString().replace("{player}", fplayer.getPlayer().getName()).replace("{item}", ChatColor.stripColor(FactionsPlugin.getInstance().color(name)))
|
} else {
|
||||||
.replace("{cost}", cost + ""));
|
fplayer.msg(TL.SHOP_ERROR_DURING_PURCHASE);
|
||||||
}
|
}
|
||||||
buildGUI(fme);
|
} else {
|
||||||
}
|
fplayer.msg(TL.SHOP_NOT_ENOUGH_POINTS);
|
||||||
else
|
}
|
||||||
{
|
}));
|
||||||
fplayer.msg(TL.SHOP_ERROR_DURING_PURCHASE);
|
pane.populateWithGuiItems(GUIItems);
|
||||||
}
|
gui.addPane(pane);
|
||||||
}
|
gui.update();
|
||||||
else
|
gui.show(fplayer.getPlayer());
|
||||||
{
|
}
|
||||||
fplayer.msg(TL.SHOP_NOT_ENOUGH_POINTS);
|
}
|
||||||
}
|
|
||||||
}));
|
|
||||||
pane.populateWithGuiItems(GUIItems);
|
|
||||||
gui.addPane(pane);
|
|
||||||
gui.update();
|
|
||||||
gui.show(fplayer.getPlayer());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private ItemStack buildDummyItem(Faction f)
|
private ItemStack buildDummyItem(Faction f) {
|
||||||
{
|
ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("F-Shop.GUI.dummy-item");
|
||||||
ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("F-Shop.GUI.dummy-item");
|
ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).get().parseItem();
|
||||||
ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).get().parseItem();
|
ItemMeta meta = item.getItemMeta();
|
||||||
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() + "")));
|
||||||
meta.setLore(FactionsPlugin.getInstance().colorList(config.getStringList("Lore")));
|
item.setItemMeta(meta);
|
||||||
meta.setDisplayName(FactionsPlugin.getInstance().color(config.getString("Name").replace("{points}", f.getPoints() + "")));
|
}
|
||||||
item.setItemMeta(meta);
|
return item;
|
||||||
}
|
}
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean checkShopConfig()
|
public boolean checkShopConfig() {
|
||||||
{
|
boolean ret = true;
|
||||||
boolean ret = true;
|
Set<String> items = FactionsPlugin.getInstance().getFileManager().getShop().getConfig().getConfigurationSection("items").getKeys(false);
|
||||||
Set<String> items = FactionsPlugin.getInstance().getFileManager().getShop().getConfig().getConfigurationSection("items").getKeys(false);
|
for (String s : items) {
|
||||||
for (String s : items)
|
if (checkShopConfig(s) == false) {
|
||||||
{
|
ret = false;
|
||||||
if (checkShopConfig(s) == false)
|
}
|
||||||
{
|
}
|
||||||
ret = false;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean checkShopConfig(String s)
|
public boolean checkShopConfig(String s) {
|
||||||
{
|
boolean ret = true;
|
||||||
boolean ret = true;
|
if (!FactionsPlugin.getInstance().getFileManager().getShop().containsKey("items." + s + ".slot")) {
|
||||||
if (!FactionsPlugin.getInstance().getFileManager().getShop().containsKey("items." + s + ".slot"))
|
FactionsPlugin.getInstance().log(Level.WARNING, "Problem with config item '" + s + "' missing slot variable");
|
||||||
{
|
ret = false;
|
||||||
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"))
|
ret = false;
|
||||||
{
|
}
|
||||||
FactionsPlugin.getInstance().log(Level.WARNING, "Problem with config item \'" + s + "\' missing block variable");
|
|
||||||
ret = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!FactionsPlugin.getInstance().getFileManager().getShop().containsKey("items." + s + ".cmds"))
|
if (!FactionsPlugin.getInstance().getFileManager().getShop().containsKey("items." + s + ".cmds")) {
|
||||||
{
|
FactionsPlugin.getInstance().log(Level.WARNING, "Problee with config item '" + s + "' missing cmds variable");
|
||||||
FactionsPlugin.getInstance().log(Level.WARNING, "Problee with config item \'" + s + "\' missing cmds variable");
|
ret = false;
|
||||||
ret = false;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!FactionsPlugin.getInstance().getFileManager().getShop().containsKey("items." + s + ".cost"))
|
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");
|
||||||
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")) {
|
||||||
if (!FactionsPlugin.getInstance().getFileManager().getShop().containsKey("items." + s + ".name"))
|
FactionsPlugin.getInstance().log(Level.WARNING, "Problem with config item '" + s + "' missing name variable");
|
||||||
{
|
ret = false;
|
||||||
FactionsPlugin.getInstance().log(Level.WARNING, "Problem with config item \'" + s + "\' missing name variable");
|
}
|
||||||
ret = false;
|
return ret;
|
||||||
}
|
}
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @param list The list of commands to be ran.
|
||||||
* @param list
|
* @param p The player that is using the shop
|
||||||
* The list of commands to be ran.
|
* @return if all commands are able to be ran or if they did run.
|
||||||
* @param p
|
*/
|
||||||
* The player that is using the shop
|
public boolean runCommands(List<String> list, Player p) {
|
||||||
* @return if all commands are able to be ran or if they did run.
|
for (String cmd : list) {
|
||||||
*/
|
cmd = cmd.replace("%player%", p.getName());
|
||||||
public boolean runCommands(List<String> list, Player p)
|
if (cmd.toLowerCase().startsWith("give")) {
|
||||||
{
|
String[] args = cmd.split(" ");
|
||||||
for (String cmd : list)
|
if (args.length == 4) {
|
||||||
{
|
Material material = Material.matchMaterial(args[2]);
|
||||||
cmd = cmd.replace("%player%", p.getName());
|
int amount = Integer.parseInt(args[3]);
|
||||||
if (cmd.toLowerCase().startsWith("give"))
|
Player player = Bukkit.getPlayer(args[1]);
|
||||||
{
|
if (!player.isOnline()) {
|
||||||
String[] args = cmd.split(" ");
|
return false;
|
||||||
if (args.length == 4)
|
}
|
||||||
{
|
// See if the player has this item in their inventory;
|
||||||
Material material = Material.matchMaterial(args[2]);
|
if (player.getInventory().contains(material) && player.getInventory().firstEmpty() < 0) {
|
||||||
int amount = Integer.parseInt(args[3]);
|
int spacesAvailable = 0;
|
||||||
Player player = Bukkit.getPlayer(args[1]);
|
Map<Integer, ? extends ItemStack> contents = player.getInventory().all(material);
|
||||||
if (!player.isOnline())
|
for (ItemStack stack : contents.values()) {
|
||||||
{
|
spacesAvailable += stack.getMaxStackSize() - stack.getAmount();
|
||||||
return false;
|
}
|
||||||
}
|
if (spacesAvailable < amount) {
|
||||||
// See if the player has this item in their inventory;
|
return false;
|
||||||
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())
|
|
||||||
{
|
|
||||||
spacesAvailable += stack.getMaxStackSize() - stack.getAmount();
|
|
||||||
}
|
|
||||||
if (spacesAvailable < amount)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
} else {
|
||||||
else
|
if (player.getInventory().firstEmpty() < 0) {
|
||||||
{
|
return false;
|
||||||
if (player.getInventory().firstEmpty() < 0)
|
}
|
||||||
{
|
}
|
||||||
return false;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
for (String cmd : list) {
|
||||||
}
|
cmd = cmd.replace("%player%", p.getName());
|
||||||
}
|
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), cmd);
|
||||||
for (String cmd : list)
|
}
|
||||||
{
|
return true;
|
||||||
cmd = cmd.replace("%player%", p.getName());
|
}
|
||||||
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), cmd);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -15,12 +15,15 @@ import org.bukkit.ChatColor;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
public class ClipPlaceholderAPIManager extends PlaceholderExpansion implements Relational {
|
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
|
// Identifier for this expansion
|
||||||
@Override
|
@Override
|
||||||
public String getIdentifier() {
|
public String getIdentifier() {
|
||||||
@ -214,7 +217,7 @@ public class ClipPlaceholderAPIManager extends PlaceholderExpansion implements R
|
|||||||
case "faction_relation_color":
|
case "faction_relation_color":
|
||||||
return fPlayer.getColorTo(faction).toString();
|
return fPlayer.getColorTo(faction).toString();
|
||||||
case "grace_time":
|
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));
|
return String.valueOf(TimerManager.getRemaining(FactionsPlugin.getInstance().getTimerManager().graceTimer.getRemaining(), true));
|
||||||
} else {
|
} else {
|
||||||
return TL.GRACE_DISABLED_PLACEHOLDER.toString();
|
return TL.GRACE_DISABLED_PLACEHOLDER.toString();
|
||||||
@ -249,10 +252,6 @@ public class ClipPlaceholderAPIManager extends PlaceholderExpansion implements R
|
|||||||
return TL.PLACEHOLDERAPI_NULL.toString();
|
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) {
|
private int countOn(Faction f, Relation relation, Boolean status, FPlayer player) {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (Faction faction : Factions.getInstance().getAllFactions()) {
|
for (Faction faction : Factions.getInstance().getAllFactions()) {
|
||||||
|
@ -3,7 +3,6 @@ package com.massivecraft.factions.util;
|
|||||||
import com.massivecraft.factions.FactionsPlugin;
|
import com.massivecraft.factions.FactionsPlugin;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.metadata.FixedMetadataValue;
|
import org.bukkit.metadata.FixedMetadataValue;
|
||||||
import org.bukkit.metadata.MetadataValue;
|
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
package com.massivecraft.factions.util.timer;
|
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.
|
* Factions - Developed by Driftay.
|
||||||
* All rights reserved 2020.
|
* All rights reserved 2020.
|
||||||
|
@ -8,8 +8,8 @@ import com.massivecraft.factions.util.Config;
|
|||||||
* Creation Date: 4/7/2020
|
* Creation Date: 4/7/2020
|
||||||
*/
|
*/
|
||||||
public abstract class Timer {
|
public abstract class Timer {
|
||||||
protected final String name;
|
|
||||||
public final long defaultCooldown;
|
public final long defaultCooldown;
|
||||||
|
protected final String name;
|
||||||
|
|
||||||
|
|
||||||
public Timer(String name, long defaultCooldown) {
|
public Timer(String name, long defaultCooldown) {
|
||||||
|
@ -16,14 +16,24 @@ import java.util.concurrent.TimeUnit;
|
|||||||
* Creation Date: 4/7/2020
|
* Creation Date: 4/7/2020
|
||||||
*/
|
*/
|
||||||
public class TimerManager implements Listener, Runnable {
|
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 MINUTE = TimeUnit.MINUTES.toMillis(1L);
|
||||||
private static final long HOUR = TimeUnit.HOURS.toMillis(1L);
|
private static final long HOUR = TimeUnit.HOURS.toMillis(1L);
|
||||||
private static final long MULTI_HOUR = TimeUnit.HOURS.toMillis(10);
|
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) {
|
public static String getRemaining(long millis, boolean milliseconds) {
|
||||||
return getRemaining(millis, milliseconds, true);
|
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) {
|
public static String getRemaining(long duration, boolean milliseconds, boolean trail) {
|
||||||
if ((milliseconds) && (duration < MINUTE)) {
|
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");
|
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() {
|
public Collection<Timer> getTimers() {
|
||||||
return this.timers;
|
return this.timers;
|
||||||
}
|
}
|
||||||
|
@ -45,15 +45,13 @@ public class TimerRunnable {
|
|||||||
return getRemaining(false);
|
return getRemaining(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getRemaining(long now) {
|
|
||||||
return getRemaining(false, now);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void setRemaining(long remaining) {
|
public void setRemaining(long remaining) {
|
||||||
setExpiryMillis(remaining);
|
setExpiryMillis(remaining);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long getRemaining(long now) {
|
||||||
|
return getRemaining(false, now);
|
||||||
|
}
|
||||||
|
|
||||||
public long getRemaining(boolean ignorePaused) {
|
public long getRemaining(boolean ignorePaused) {
|
||||||
if ((!ignorePaused) && (this.pauseMillis != 0L)) return this.pauseMillis;
|
if ((!ignorePaused) && (this.pauseMillis != 0L)) return this.pauseMillis;
|
||||||
|
@ -26,14 +26,14 @@ public class GraceTimer extends GlobalTimer implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onBreak(EntityExplodeEvent e) {
|
public void onBreak(EntityExplodeEvent e) {
|
||||||
if(getRemaining() > 0)
|
if (getRemaining() > 0)
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onTNTPlace(BlockPlaceEvent event) {
|
public void onTNTPlace(BlockPlaceEvent event) {
|
||||||
FPlayer fp = FPlayers.getInstance().getByPlayer(event.getPlayer());
|
FPlayer fp = FPlayers.getInstance().getByPlayer(event.getPlayer());
|
||||||
if(getRemaining() > 0) {
|
if (getRemaining() > 0) {
|
||||||
if (!fp.isAdminBypassing()) {
|
if (!fp.isAdminBypassing()) {
|
||||||
if (event.getBlock().getType().equals(Material.TNT)) {
|
if (event.getBlock().getType().equals(Material.TNT)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
@ -3,7 +3,10 @@ package com.massivecraft.factions.zcore;
|
|||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
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.*;
|
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.persist.SaveTask;
|
||||||
import com.massivecraft.factions.zcore.util.PermUtil;
|
import com.massivecraft.factions.zcore.util.PermUtil;
|
||||||
import com.massivecraft.factions.zcore.util.Persist;
|
import com.massivecraft.factions.zcore.util.Persist;
|
||||||
|
@ -55,9 +55,9 @@ public class CustomFile {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean containsKey(String key) {
|
public boolean containsKey(String key) {
|
||||||
return getCachedObjects().containsKey(key)|| getConfig().contains(key);
|
return getCachedObjects().containsKey(key) || getConfig().contains(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String fetchString(String 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.FPlayer;
|
||||||
import com.massivecraft.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
import com.massivecraft.factions.FactionsPlugin;
|
import com.massivecraft.factions.FactionsPlugin;
|
||||||
import com.massivecraft.factions.cmd.audit.FLogType;
|
|
||||||
import com.massivecraft.factions.util.XMaterial;
|
import com.massivecraft.factions.util.XMaterial;
|
||||||
import com.massivecraft.factions.zcore.fperms.Access;
|
import com.massivecraft.factions.zcore.fperms.Access;
|
||||||
import com.massivecraft.factions.zcore.fperms.Permissable;
|
import com.massivecraft.factions.zcore.fperms.Permissable;
|
||||||
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.ChatColor;
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
@ -16,7 +16,6 @@ import org.bukkit.inventory.meta.ItemMeta;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Saser
|
* @author Saser
|
||||||
@ -36,7 +35,8 @@ public class FUpgradeFrame {
|
|||||||
PaginatedPane pane = new PaginatedPane(0, 0, 9, this.gui.getRows());
|
PaginatedPane pane = new PaginatedPane(0, 0, 9, this.gui.getRows());
|
||||||
List<GuiItem> GUIItems = new ArrayList<>();
|
List<GuiItem> GUIItems = new ArrayList<>();
|
||||||
ItemStack dummy = buildDummyItem();
|
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()) {
|
for (UpgradeType value : UpgradeType.values()) {
|
||||||
if (value.getSlot() != -1) {
|
if (value.getSlot() != -1) {
|
||||||
GUIItems.set(value.getSlot(), new GuiItem(value.buildAsset(fplayer.getFaction()), e -> {
|
GUIItems.set(value.getSlot(), new GuiItem(value.buildAsset(fplayer.getFaction()), e -> {
|
||||||
@ -44,19 +44,19 @@ public class FUpgradeFrame {
|
|||||||
FPlayer fme = FPlayers.getInstance().getByPlayer((Player) e.getWhoClicked());
|
FPlayer fme = FPlayers.getInstance().getByPlayer((Player) e.getWhoClicked());
|
||||||
if (fme.getFaction().getUpgrade(value) == value.getMaxLevel()) return;
|
if (fme.getFaction().getUpgrade(value) == value.getMaxLevel()) return;
|
||||||
int cost = FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu." + value.toString() + ".Cost.level-" + (fme.getFaction().getUpgrade(value) + 1));
|
int cost = FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu." + value.toString() + ".Cost.level-" + (fme.getFaction().getUpgrade(value) + 1));
|
||||||
if (fme.hasMoney(cost)) {
|
if (fme.hasMoney(cost)) {
|
||||||
fme.takeMoney(cost);
|
fme.takeMoney(cost);
|
||||||
if (value == UpgradeType.CHEST) updateChests(fme.getFaction());
|
if (value == UpgradeType.CHEST) updateChests(fme.getFaction());
|
||||||
|
|
||||||
if (value == UpgradeType.POWER) updateFactionPowerBoost(fme.getFaction());
|
if (value == UpgradeType.POWER) updateFactionPowerBoost(fme.getFaction());
|
||||||
|
|
||||||
if (value == UpgradeType.TNT) updateTNT(fme.getFaction());
|
if (value == UpgradeType.TNT) updateTNT(fme.getFaction());
|
||||||
|
|
||||||
if (value == UpgradeType.WARP) updateWarps(fme.getFaction());
|
if (value == UpgradeType.WARP) updateWarps(fme.getFaction());
|
||||||
|
|
||||||
fme.getFaction().setUpgrade(value, fme.getFaction().getUpgrade(value) + 1);
|
fme.getFaction().setUpgrade(value, fme.getFaction().getUpgrade(value) + 1);
|
||||||
buildGUI(fme);
|
buildGUI(fme);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ public class UpgradesListener implements Listener {
|
|||||||
if (e.isCancelled()) return;
|
if (e.isCancelled()) return;
|
||||||
|
|
||||||
if (!(e.getDamager() instanceof Player) || !(e.getEntity() instanceof Player)) 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 fme = FPlayers.getInstance().getByPlayer((Player) e.getEntity());
|
||||||
FPlayer dame = FPlayers.getInstance().getByPlayer((Player) e.getDamager());
|
FPlayer dame = FPlayers.getInstance().getByPlayer((Player) e.getDamager());
|
||||||
@ -36,7 +36,7 @@ public class UpgradesListener implements Listener {
|
|||||||
if (fme == null || dame == null) return;
|
if (fme == null || dame == null) return;
|
||||||
FLocation floc = new FLocation(fme.getPlayer().getLocation());
|
FLocation floc = new FLocation(fme.getPlayer().getLocation());
|
||||||
|
|
||||||
if(floc == null) return;
|
if (floc == null) return;
|
||||||
|
|
||||||
if (Board.getInstance().getFactionAt(floc) == fme.getFaction()) {
|
if (Board.getInstance().getFactionAt(floc) == fme.getFaction()) {
|
||||||
if (dame.getFaction() == fme.getFaction()) return;
|
if (dame.getFaction() == fme.getFaction()) return;
|
||||||
|
@ -738,7 +738,7 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
public void sendFactionHereMessage(Faction from) {
|
public void sendFactionHereMessage(Faction from) {
|
||||||
Faction toShow = Board.getInstance().getFactionAt(getLastStoodAt());
|
Faction toShow = Board.getInstance().getFactionAt(getLastStoodAt());
|
||||||
|
|
||||||
if(Conf.worldsNoClaiming.contains(getLastStoodAt().getWorldName())) return;
|
if (Conf.worldsNoClaiming.contains(getLastStoodAt().getWorldName())) return;
|
||||||
|
|
||||||
if (showInfoBoard(toShow)) {
|
if (showInfoBoard(toShow)) {
|
||||||
FScoreboard.get(this).setTemporarySidebar(new FInfoSidebar(toShow));
|
FScoreboard.get(this).setTemporarySidebar(new FInfoSidebar(toShow));
|
||||||
@ -860,7 +860,7 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
int factionBuffer = plugin.getConfig().getInt("hcf.buffer-zone", 0);
|
int factionBuffer = plugin.getConfig().getInt("hcf.buffer-zone", 0);
|
||||||
int worldBuffer = plugin.getConfig().getInt("world-border.buffer", 0) - 1;
|
int worldBuffer = plugin.getConfig().getInt("world-border.buffer", 0) - 1;
|
||||||
|
|
||||||
if (Conf.worldGuardChecking && Worldguard.getInstance().checkForRegionsInChunk(flocation)) {
|
if (Conf.worldGuardChecking && Worldguard.getInstance().checkForRegionsInChunk(flocation)) {
|
||||||
// Checks for WorldGuard regions in the chunk attempting to be claimed
|
// Checks for WorldGuard regions in the chunk attempting to be claimed
|
||||||
error = plugin.txt.parse(TL.CLAIM_PROTECTED.toString());
|
error = plugin.txt.parse(TL.CLAIM_PROTECTED.toString());
|
||||||
} else if (flocation.isOutsideWorldBorder(plugin.getConfig().getInt("world-border.buffer", 0) - 1)) {
|
} else if (flocation.isOutsideWorldBorder(plugin.getConfig().getInt("world-border.buffer", 0) - 1)) {
|
||||||
@ -873,7 +873,7 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
return true;
|
return true;
|
||||||
} else if (forFaction.isWarZone() && Permission.MANAGE_WAR_ZONE.has(getPlayer())) {
|
} else if (forFaction.isWarZone() && Permission.MANAGE_WAR_ZONE.has(getPlayer())) {
|
||||||
return true;
|
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;
|
return true;
|
||||||
} else if (myFaction != forFaction) {
|
} else if (myFaction != forFaction) {
|
||||||
error = plugin.txt.parse(TL.CLAIM_CANTCLAIM.toString(), forFaction.describeTo(this));
|
error = plugin.txt.parse(TL.CLAIM_CANTCLAIM.toString(), forFaction.describeTo(this));
|
||||||
@ -972,39 +972,38 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setFFlying(boolean fly, boolean damage) {
|
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();
|
||||||
Player player = getPlayer();
|
if (player == null) return;
|
||||||
if (player == null) return;
|
|
||||||
|
player.setAllowFlight(fly);
|
||||||
player.setAllowFlight(fly);
|
player.setFlying(fly);
|
||||||
player.setFlying(fly);
|
|
||||||
|
if (!damage) {
|
||||||
if (!damage) {
|
msg(TL.COMMAND_FLY_CHANGE, fly ? "enabled" : "disabled");
|
||||||
msg(TL.COMMAND_FLY_CHANGE, fly ? "enabled" : "disabled");
|
if (!fly) {
|
||||||
if (!fly) {
|
sendMessage(TL.COMMAND_FLY_COOLDOWN.toString().replace("{amount}", FactionsPlugin.getInstance().getConfig().getInt("fly-falldamage-cooldown", 3) + ""));
|
||||||
sendMessage(TL.COMMAND_FLY_COOLDOWN.toString().replace("{amount}", FactionsPlugin.getInstance().getConfig().getInt("fly-falldamage-cooldown", 3) + ""));
|
}
|
||||||
}
|
} else {
|
||||||
} else {
|
msg(TL.COMMAND_FLY_DAMAGE);
|
||||||
msg(TL.COMMAND_FLY_DAMAGE);
|
}
|
||||||
}
|
|
||||||
|
// If leaving fly mode, don't let them take fall damage for x seconds.
|
||||||
// If leaving fly mode, don't let them take fall damage for x seconds.
|
if (!fly) {
|
||||||
if (!fly) {
|
int cooldown = FactionsPlugin.getInstance().getConfig().getInt("fly-falldamage-cooldown", 3);
|
||||||
int cooldown = FactionsPlugin.getInstance().getConfig().getInt("fly-falldamage-cooldown", 3);
|
CmdFly.flyMap.remove(player.getName());
|
||||||
CmdFly.flyMap.remove(player.getName());
|
|
||||||
|
// If the value is 0 or lower, make them take fall damage.
|
||||||
// If the value is 0 or lower, make them take fall damage.
|
// Otherwise, start a timer and have this cancel after a few seconds.
|
||||||
// Otherwise, start a timer and have this cancel after a few seconds.
|
// Short task so we're just doing it in method. Not clean but eh.
|
||||||
// Short task so we're just doing it in method. Not clean but eh.
|
if (cooldown > 0) {
|
||||||
if (cooldown > 0) {
|
setTakeFallDamage(false);
|
||||||
setTakeFallDamage(false);
|
Bukkit.getScheduler().runTaskLater(FactionsPlugin.getInstance(), () -> setTakeFallDamage(true), 20L * cooldown);
|
||||||
Bukkit.getScheduler().runTaskLater(FactionsPlugin.getInstance(), () -> setTakeFallDamage(true), 20L * cooldown);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
isFlying = fly;
|
||||||
isFlying = fly;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInFactionsChest() {
|
public boolean isInFactionsChest() {
|
||||||
@ -1223,11 +1222,11 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean hasFriendlyFire(){
|
public boolean hasFriendlyFire() {
|
||||||
return friendlyFire;
|
return friendlyFire;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFriendlyFire(boolean status){
|
public void setFriendlyFire(boolean status) {
|
||||||
friendlyFire = status;
|
friendlyFire = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1305,7 +1304,7 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
|
|
||||||
|
|
||||||
// announce success
|
// announce success
|
||||||
if(!FactionsPlugin.cachedRadiusClaim) {
|
if (!FactionsPlugin.cachedRadiusClaim) {
|
||||||
Set<FPlayer> informTheseFPlayers = new HashSet<>();
|
Set<FPlayer> informTheseFPlayers = new HashSet<>();
|
||||||
informTheseFPlayers.add(this);
|
informTheseFPlayers.add(this);
|
||||||
informTheseFPlayers.addAll(forFaction.getFPlayersWhereOnline(true));
|
informTheseFPlayers.addAll(forFaction.getFPlayersWhereOnline(true));
|
||||||
|
@ -1277,7 +1277,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
|||||||
if (Conf.logFactionDisband)
|
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" : "") + ".");
|
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())
|
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers())
|
||||||
fplayer.msg(TL.COMMAND_DISBAND_BROADCAST_GENERIC, this.getTag(fplayer));
|
fplayer.msg(TL.COMMAND_DISBAND_BROADCAST_GENERIC, this.getTag(fplayer));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user