Add Faction warps

This commit is contained in:
Magnus Ulf 2019-01-26 15:04:47 +01:00
parent b13d2665da
commit 19de471de0
28 changed files with 726 additions and 354 deletions

View File

@ -38,7 +38,6 @@ permissions:
factions.flag.list: {description: list flags, default: false}
factions.flag.set: {description: set flags, default: false}
factions.flag.show: {description: show flags, default: false}
factions.home: {description: teleport to faction home, default: false}
factions.invite: {description: manage invites, default: false}
factions.invite.list: {description: list invited players, default: false}
factions.invite.list.other: {description: list invited players of another factions, default: false}
@ -87,7 +86,6 @@ permissions:
factions.relation.wishes: {description: list the relation wishes, default: false}
factions.seechunk: {description: see the chunk you stand in, default: false}
factions.seechunkold: {description: see the chunk you stand in, default: false}
factions.sethome: {description: set the faction home, default: false}
factions.setpower: {description: set power, default: false}
factions.status: {description: show status, default: false}
factions.name: {description: set faction name, default: false}
@ -101,7 +99,11 @@ permissions:
factions.unclaim.square: {description: unclaim by square and radius, default: false}
factions.unclaim.circle: {description: unclaim by circle and radius, default: false}
factions.unclaim.all: {description: unclaim all faction land, default: false}
factions.unsethome: {description: unset faction home, default: false}
factions.warp: {description: use warps, default: false}
factions.warp.go: {description: go to a warp, default: false}
factions.warp.list: {description: list warps, default: false}
factions.warp.add: {description: add new warp, default: false}
factions.warp.remove: {description: remove warp, default: false}
factions.unstuck: {description: teleport to nearest wilderness, default: false}
factions.config: {description: edit the factions config, default: false}
factions.clean: {description: clean the factions database, default: false}
@ -209,6 +211,11 @@ permissions:
factions.unclaim.all: true
factions.unsethome: true
factions.unstuck: true
factions.warp: true
factions.warp.go: true
factions.warp.list: true
factions.warp.add: true
factions.warp.remove: true
factions.config: true
factions.clean: true
factions.version: true
@ -335,6 +342,11 @@ permissions:
factions.unclaim.all: true
factions.unsethome: true
factions.unstuck: true
factions.warp: true
factions.warp.go: true
factions.warp.list: true
factions.warp.add: true
factions.warp.remove: true
factions.version: true
factions.kit.default:
default: true

View File

@ -53,10 +53,12 @@ import com.massivecraft.factions.entity.MPermColl;
import com.massivecraft.factions.entity.MPlayerColl;
import com.massivecraft.factions.entity.migrator.MigratorFaction001Invitations;
import com.massivecraft.factions.entity.migrator.MigratorFaction002Ranks;
import com.massivecraft.factions.entity.migrator.MigratorFaction003Warps;
import com.massivecraft.factions.entity.migrator.MigratorMConf001EnumerationUtil;
import com.massivecraft.factions.entity.migrator.MigratorMConf002CleanInactivity;
import com.massivecraft.factions.entity.migrator.MigratorMConf003CleanInactivity;
import com.massivecraft.factions.entity.migrator.MigratorMConf004Rank;
import com.massivecraft.factions.entity.migrator.MigratorMConf005Warps;
import com.massivecraft.factions.entity.migrator.MigratorMPlayer001Ranks;
import com.massivecraft.factions.event.EventFactionsChunkChangeType;
import com.massivecraft.factions.integration.V18.IntegrationV18;
@ -139,10 +141,12 @@ public class Factions extends MassivePlugin
return MUtil.list(
MigratorFaction001Invitations.class,
MigratorFaction002Ranks.class,
MigratorFaction003Warps.class,
MigratorMConf001EnumerationUtil.class,
MigratorMConf002CleanInactivity.class,
MigratorMConf003CleanInactivity.class,
MigratorMConf004Rank.class,
MigratorMConf005Warps.class,
MigratorMPlayer001Ranks.class
);
}

View File

@ -102,6 +102,11 @@ public enum Perm implements Identified
UNCLAIM_ALL,
UNSETHOME,
UNSTUCK,
WARP,
WARP_GO,
WARP_LIST,
WARP_ADD,
WARP_REMOVE,
CONFIG,
CLEAN,
VERSION,

View File

@ -29,14 +29,12 @@ public class CmdFactions extends FactionsCommand
public CmdFactionsStatus cmdFactionsStatus = new CmdFactionsStatus();
public CmdFactionsJoin cmdFactionsJoin = new CmdFactionsJoin();
public CmdFactionsLeave cmdFactionsLeave = new CmdFactionsLeave();
public CmdFactionsHome cmdFactionsHome = new CmdFactionsHome();
public CmdFactionsWarp cmdFactionsWarp = new CmdFactionsWarp();
public CmdFactionsMap cmdFactionsMap = new CmdFactionsMap();
public CmdFactionsCreate cmdFactionsCreate = new CmdFactionsCreate();
public CmdFactionsName cmdFactionsName = new CmdFactionsName();
public CmdFactionsDescription cmdFactionsDescription = new CmdFactionsDescription();
public CmdFactionsMotd cmdFactionsMotd = new CmdFactionsMotd();
public CmdFactionsSethome cmdFactionsSethome = new CmdFactionsSethome();
public CmdFactionsUnsethome cmdFactionsUnsethome = new CmdFactionsUnsethome();
public CmdFactionsInvite cmdFactionsInvite = new CmdFactionsInvite();
public CmdFactionsKick cmdFactionsKick = new CmdFactionsKick();
public CmdFactionsTitle cmdFactionsTitle = new CmdFactionsTitle();

View File

@ -1,69 +0,0 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.type.TypeFaction;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MPerm;
import com.massivecraft.factions.event.EventFactionsHomeChange;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
import com.massivecraft.massivecore.ps.PS;
public class CmdFactionsSethome extends FactionsCommandHome
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsSethome()
{
// Parameters
this.addParameter(TypeFaction.get(), "faction", "you");
// Requirements
this.addRequirements(RequirementHasPerm.get(Perm.SETHOME));
this.addRequirements(RequirementIsPlayer.get());
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void perform() throws MassiveException
{
// Args
Faction faction = this.readArg(msenderFaction);
PS newHome = PS.valueOf(me.getLocation());
// MPerm
if ( ! MPerm.getPermSethome().has(msender, faction, true)) return;
// Verify
if (!msender.isOverriding() && !faction.isValidHome(newHome))
{
msender.msg("<b>Sorry, your faction home can only be set inside your own claimed territory.");
return;
}
// Event
EventFactionsHomeChange event = new EventFactionsHomeChange(sender, faction, newHome);
event.run();
if (event.isCancelled()) return;
newHome = event.getNewHome();
// Apply
faction.setHome(newHome);
// Inform
faction.msg("%s<i> set the home for your faction. You can now use:", msender.describeTo(msenderFaction, true));
faction.sendMessage(CmdFactions.get().cmdFactionsHome.getTemplate());
if (faction != msenderFaction)
{
msender.msg("<i>You have set the home for " + faction.getName(msender) + "<i>.");
}
}
}

View File

@ -0,0 +1,14 @@
package com.massivecraft.factions.cmd;
public class CmdFactionsWarp extends FactionsCommand
{
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
public CmdFactionsWarpGo cmdFactionsWarpGo = new CmdFactionsWarpGo();
public CmdFactionsWarpList cmdFactionsWarpList = new CmdFactionsWarpList();
public CmdFactionsWarpAdd cmdFactionWarpAdd = new CmdFactionsWarpAdd();
public CmdFactionsWarpRemove cmdFactionWarpRemove = new CmdFactionsWarpRemove();
}

View File

@ -0,0 +1,85 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.cmd.type.TypeFaction;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.entity.MPerm;
import com.massivecraft.factions.entity.Warp;
import com.massivecraft.factions.event.EventFactionsWarpAdd;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
import com.massivecraft.massivecore.command.type.primitive.TypeString;
import com.massivecraft.massivecore.ps.PS;
public class CmdFactionsWarpAdd extends FactionsCommandWarp
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsWarpAdd()
{
// Parameters
this.addParameter(TypeString.get(), "name");
this.addParameter(TypeFaction.get(), "faction", "you");
// Aliases
this.addAliases("create");
// Requirements
this.addRequirements(RequirementIsPlayer.get());
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void perform() throws MassiveException
{
// Args
String name = this.readArg();
Faction faction = this.readArg(msenderFaction);
PS ps = PS.valueOf(me.getLocation());
Warp warp = new Warp(name, ps);
// MPerm
if ( ! MPerm.getPermSethome().has(msender, faction, true)) return;
if (faction.getWarps().getAll().stream().map(Warp::getName).anyMatch(s -> s.equalsIgnoreCase(name)))
{
throw new MassiveException().addMsg("<b>There is already a warp called <h>%s<b>.", name);
}
// Verify
if (!msender.isOverriding() && !warp.isValidFor(faction))
{
throw new MassiveException().addMsg("<b>Sorry, your faction warps can only be set inside your own claimed territory.");
}
if (!msender.isOverriding() && faction.getWarps().size() >= MConf.get().warpsMax && MConf.get().warpsMax >= 0)
{
throw new MassiveException().addMsg("<b>You can at most have <h>%d <b>warps at a time.", MConf.get().warpsMax);
}
// Event
EventFactionsWarpAdd event = new EventFactionsWarpAdd(sender, faction, warp);
event.run();
if (event.isCancelled()) return;
warp = event.getNewWarp();
// Apply
faction.getWarps().attach(warp);
// Inform
faction.msg("%s<i> added the warp <h>%s <i>to your faction. You can now use:", msender.describeTo(msenderFaction, true), warp.getName());
faction.sendMessage(CmdFactions.get().cmdFactionsWarp.cmdFactionsWarpGo.getTemplateWithArgs(null, warp.getName()));
if (faction != msenderFaction)
{
msender.msg("<i>You added the warp <h>%s <i>to %s<i>.", warp.getName(), faction.describeTo(msender));
}
}
}

View File

@ -2,13 +2,15 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Rel;
import com.massivecraft.factions.cmd.type.TypeFaction;
import com.massivecraft.factions.cmd.type.TypeWarp;
import com.massivecraft.factions.entity.BoardColl;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.entity.MFlag;
import com.massivecraft.factions.entity.MPerm;
import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.factions.event.EventFactionsHomeTeleport;
import com.massivecraft.factions.entity.Warp;
import com.massivecraft.factions.event.EventFactionsWarpTeleport;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
import com.massivecraft.massivecore.mixin.MixinMessage;
@ -18,19 +20,21 @@ import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.massivecore.teleport.Destination;
import com.massivecraft.massivecore.teleport.DestinationSimple;
import com.massivecraft.massivecore.util.MUtil;
import com.massivecraft.massivecore.util.Txt;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
public class CmdFactionsHome extends FactionsCommandHome
public class CmdFactionsWarpGo extends FactionsCommandWarp
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsHome()
public CmdFactionsWarpGo()
{
// Parameters
this.addParameter(TypeWarp.get(), "warp");
this.addParameter(TypeFaction.get(), "faction", "you");
// Requirements
@ -44,53 +48,31 @@ public class CmdFactionsHome extends FactionsCommandHome
@Override
public void perform() throws MassiveException
{
if ( ! MConf.get().homesTeleportCommandEnabled)
{
msender.msg("<b>Sorry, the ability to teleport to Faction homes is disabled on this server.");
return;
}
// Args
Faction faction = this.readArg(msenderFaction);
PS home = faction.getHome();
String homeDesc = "home for " + faction.describeTo(msender, false);
Faction faction = this.readArgAt(1, msenderFaction);
Warp warp = TypeWarp.get(faction).read(this.argAt(0), sender);
String warpDesc = Txt.parse("<h>%s <i>in <reset>%s<i>.", warp.getName(), faction.describeTo(msender, false));
// Any and MPerm
if ( ! MPerm.getPermHome().has(msender, faction, true)) return;
if (home == null)
if ( ! MConf.get().warpsTeleportAllowedFromEnemyTerritory && msender.isInEnemyTerritory())
{
msender.msg("<b>%s <b>does not have a home.", faction.describeTo(msender, true));
if (MPerm.getPermSethome().has(msender, faction, false))
{
msender.msg("<i>You should:");
msender.message(CmdFactions.get().cmdFactionsSethome.getTemplate());
}
return;
throw new MassiveException().addMsg("<b>You cannot teleport to %s <b>while in the territory of an enemy faction.", warp);
}
if ( ! MConf.get().homesTeleportAllowedFromEnemyTerritory && msender.isInEnemyTerritory())
if ( ! MConf.get().warpsTeleportAllowedFromDifferentWorld && !me.getWorld().getName().equalsIgnoreCase(warp.getWorld()))
{
msender.msg("<b>You cannot teleport to %s <b>while in the territory of an enemy faction.", homeDesc);
return;
throw new MassiveException().addMsg("<b>You cannot teleport to %s <b>while in a different world.", warpDesc);
}
if ( ! MConf.get().homesTeleportAllowedFromDifferentWorld && !me.getWorld().getName().equalsIgnoreCase(home.getWorld()))
{
msender.msg("<b>You cannot teleport to %s <b>while in a different world.", homeDesc);
return;
}
Faction factionHere = BoardColl.get().getFactionAt(PS.valueOf(me.getLocation()));
Location locationHere = me.getLocation().clone();
// if player is not in a safe zone or their own faction territory, only allow teleport if no enemies are nearby
if
(
MConf.get().homesTeleportAllowedEnemyDistance > 0
MConf.get().warpsTeleportAllowedEnemyDistance > 0
&&
factionHere.getFlag(MFlag.getFlagPvp())
&&
@ -100,7 +82,7 @@ public class CmdFactionsHome extends FactionsCommandHome
(
msender.isInOwnTerritory()
&&
! MConf.get().homesTeleportIgnoreEnemiesIfInOwnTerritory
! MConf.get().warpsTeleportIgnoreEnemiesIfInOwnTerritory
)
)
)
@ -110,41 +92,38 @@ public class CmdFactionsHome extends FactionsCommandHome
double y = locationHere.getY();
double z = locationHere.getZ();
for (Player p : me.getServer().getOnlinePlayers())
for (Player p : w.getPlayers())
{
if (MUtil.isntPlayer(p)) continue;
if (p == null || !p.isOnline() || p.isDead() || p == me || p.getWorld() != w)
continue;
if (p == null || !p.isOnline() || p.isDead() || p == me || p.getWorld() != w) continue;
MPlayer fp = MPlayer.get(p);
if (msender.getRelationTo(fp) != Rel.ENEMY)
continue;
if (msender.getRelationTo(fp) != Rel.ENEMY) continue;
Location l = p.getLocation();
double dx = Math.abs(x - l.getX());
double dy = Math.abs(y - l.getY());
double dz = Math.abs(z - l.getZ());
double max = MConf.get().homesTeleportAllowedEnemyDistance;
double max = MConf.get().warpsTeleportAllowedEnemyDistance;
// box-shaped distance check
if (dx > max || dy > max || dz > max)
continue;
msender.msg("<b>You cannot teleport to %s <b>while an enemy is within %f blocks of you.", homeDesc, MConf.get().homesTeleportAllowedEnemyDistance);
return;
throw new MassiveException().addMsg("<b>You cannot teleport to %s <b>while an enemy is within %f blocks of you.", warpDesc, max);
}
}
// Event
EventFactionsHomeTeleport event = new EventFactionsHomeTeleport(sender);
EventFactionsWarpTeleport event = new EventFactionsWarpTeleport(sender, warp);
event.run();
if (event.isCancelled()) return;
// Apply
try
{
Destination destination = new DestinationSimple(home, homeDesc);
Destination destination = new DestinationSimple(warp.getLocation(), warpDesc);
MixinTeleport.get().teleport(me, destination, sender);
}
catch (TeleporterException e)

View File

@ -0,0 +1,48 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.cmd.type.TypeFaction;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MPerm;
import com.massivecraft.factions.entity.Warp;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.Parameter;
import com.massivecraft.massivecore.pager.Pager;
import com.massivecraft.massivecore.pager.Stringifier;
import com.massivecraft.massivecore.ps.PSFormatDesc;
import com.massivecraft.massivecore.util.Txt;
public class CmdFactionsWarpList extends FactionsCommandWarp
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsWarpList()
{
// Parameters
this.addParameter(TypeFaction.get(), "faction", "you");
this.addParameter(Parameter.getPage());
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void perform() throws MassiveException
{
// Args
Faction faction = this.readArg(msenderFaction);
int idx = this.readArg();
// Any and MPerm
if ( ! MPerm.getPermHome().has(msender, faction, true)) return;
Pager<Warp> pager = new Pager<>(this, "Warps for " + faction.getName(), idx, faction.getWarps().getAll());
pager.setMsonifier((Stringifier<Warp>) (warp, i) ->
Txt.parse("<lime>%s<i>: %s", warp.getName(), warp.getLocation().getBlock(true).toString(PSFormatDesc.get())));
pager.message();
}
}

View File

@ -1,20 +1,23 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.cmd.type.TypeFaction;
import com.massivecraft.factions.cmd.type.TypeWarp;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MPerm;
import com.massivecraft.factions.event.EventFactionsHomeChange;
import com.massivecraft.factions.entity.Warp;
import com.massivecraft.factions.event.EventFactionsWarpRemove;
import com.massivecraft.massivecore.MassiveException;
public class CmdFactionsUnsethome extends FactionsCommandHome
public class CmdFactionsWarpRemove extends FactionsCommandWarp
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsUnsethome()
public CmdFactionsWarpRemove()
{
// Parameters
this.addParameter(TypeWarp.get(), "warp");
this.addParameter(TypeFaction.get(), "faction", "you");
}
@ -26,31 +29,25 @@ public class CmdFactionsUnsethome extends FactionsCommandHome
public void perform() throws MassiveException
{
// Args
Faction faction = this.readArg(msenderFaction);
Faction faction = this.readArgAt(1, msenderFaction);
Warp warp = TypeWarp.get(faction).read(this.argAt(0), sender);
// Any and MPerm
if ( ! MPerm.getPermSethome().has(msender, faction, true)) return;
// NoChange
if ( ! faction.hasHome())
{
msender.msg("<i>%s <i>does already not have a home.", faction.describeTo(msender));
return;
}
// Event
EventFactionsHomeChange event = new EventFactionsHomeChange(sender, faction, null);
EventFactionsWarpRemove event = new EventFactionsWarpRemove(sender, faction, warp);
event.run();
if (event.isCancelled()) return;
// Apply
faction.setHome(null);
warp.detach();
// Inform
faction.msg("%s<i> unset the home for your faction.", msender.describeTo(msenderFaction, true));
faction.msg("%s<i> removed the warp <h>%s <i>for your faction.", msender.describeTo(msenderFaction, true), warp.getName());
if (faction != msenderFaction)
{
msender.msg("<i>You have unset the home for " + faction.getName(msender) + "<i>.");
msender.msg("<i>You have removed the warp <h>%s <i>for %s<i>.", warp.getName(), faction.getName(msender));
}
}

View File

@ -1,6 +1,6 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.cmd.req.ReqFactionHomesEnabled;
import com.massivecraft.factions.cmd.req.ReqFactionWarpsEnabled;
import com.massivecraft.massivecore.mson.Mson;
public class FactionsCommandDocumentation extends FactionsCommand
@ -11,7 +11,7 @@ public class FactionsCommandDocumentation extends FactionsCommand
public FactionsCommandDocumentation()
{
this.addRequirements(ReqFactionHomesEnabled.get());
this.addRequirements(ReqFactionWarpsEnabled.get());
}
// -------------------------------------------- //

View File

@ -1,18 +1,18 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.cmd.req.ReqFactionHomesEnabled;
import com.massivecraft.factions.cmd.req.ReqFactionWarpsEnabled;
import com.massivecraft.factions.entity.MConf;
import com.massivecraft.massivecore.command.Visibility;
public class FactionsCommandHome extends FactionsCommand
public class FactionsCommandWarp extends FactionsCommand
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public FactionsCommandHome()
public FactionsCommandWarp()
{
this.addRequirements(ReqFactionHomesEnabled.get());
this.addRequirements(ReqFactionWarpsEnabled.get());
}
// -------------------------------------------- //
@ -22,7 +22,7 @@ public class FactionsCommandHome extends FactionsCommand
@Override
public Visibility getVisibility()
{
return MConf.get().homesEnabled ? super.getVisibility() : Visibility.INVISIBLE;
return MConf.get().warpsEnabled ? super.getVisibility() : Visibility.INVISIBLE;
}
}

View File

@ -1,40 +1,40 @@
package com.massivecraft.factions.cmd.req;
import com.massivecraft.factions.entity.MConf;
import com.massivecraft.massivecore.command.MassiveCommand;
import com.massivecraft.massivecore.command.requirement.RequirementAbstract;
import com.massivecraft.massivecore.util.Txt;
import org.bukkit.command.CommandSender;
public class ReqFactionHomesEnabled extends RequirementAbstract
{
// -------------------------------------------- //
// SERIALIZABLE
// -------------------------------------------- //
private static final long serialVersionUID = 1L;
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
private static ReqFactionHomesEnabled i = new ReqFactionHomesEnabled();
public static ReqFactionHomesEnabled get() { return i; }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public boolean apply(CommandSender sender, MassiveCommand command)
{
return MConf.get().homesEnabled;
}
@Override
public String createErrorMessage(CommandSender sender, MassiveCommand command)
{
return Txt.parse("<b>Homes must be enabled on the server to %s.", getDesc(command));
}
}
package com.massivecraft.factions.cmd.req;
import com.massivecraft.factions.entity.MConf;
import com.massivecraft.massivecore.command.MassiveCommand;
import com.massivecraft.massivecore.command.requirement.RequirementAbstract;
import com.massivecraft.massivecore.util.Txt;
import org.bukkit.command.CommandSender;
public class ReqFactionWarpsEnabled extends RequirementAbstract
{
// -------------------------------------------- //
// SERIALIZABLE
// -------------------------------------------- //
private static final long serialVersionUID = 1L;
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
private static ReqFactionWarpsEnabled i = new ReqFactionWarpsEnabled();
public static ReqFactionWarpsEnabled get() { return i; }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public boolean apply(CommandSender sender, MassiveCommand command)
{
return MConf.get().warpsEnabled;
}
@Override
public String createErrorMessage(CommandSender sender, MassiveCommand command)
{
return Txt.parse("<b>Warps must be enabled on the server to %s.", getDesc(command));
}
}

View File

@ -0,0 +1,56 @@
package com.massivecraft.factions.cmd.type;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.massivecore.command.type.TypeAbstractChoice;
import com.massivecraft.massivecore.store.EntityInternal;
import org.bukkit.command.CommandSender;
import java.util.Collection;
import java.util.Collections;
public abstract class TypeEntityInternalFaction<E extends EntityInternal<E>> extends TypeAbstractChoice<E>
{
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
protected TypeEntityInternalFaction(Class<E> clazz)
{
super(clazz);
this.faction = null;
this.setAll(Collections.emptyList());
}
protected TypeEntityInternalFaction(Class<E> clazz, Faction faction)
{
super(clazz);
if (faction == null) throw new NullPointerException("faction");
this.faction = faction;
this.setAll(this.getAll(faction));
}
protected abstract Collection<E> getAll(Faction faction);
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
private final Faction faction;
public Faction getFaction() { return this.faction; }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public boolean isValid(String arg, CommandSender sender)
{
// In the generic case accept all
if (this.getAll().isEmpty()) return true;
else return super.isValid(arg, sender);
}
}

View File

@ -1,16 +1,13 @@
package com.massivecraft.factions.cmd.type;
import com.massivecraft.factions.Rel;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.Rank;
import com.massivecraft.massivecore.command.type.TypeAbstractChoice;
import com.massivecraft.massivecore.util.MUtil;
import org.bukkit.command.CommandSender;
import java.util.Collections;
import java.util.Collection;
import java.util.Set;
public class TypeRank extends TypeAbstractChoice<Rank>
public class TypeRank extends TypeEntityInternalFaction<Rank>
{
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
@ -21,39 +18,22 @@ public class TypeRank extends TypeAbstractChoice<Rank>
private TypeRank()
{
super(Rank.class);
this.faction = null;
this.setAll(Collections.emptyList());
}
public static TypeRank get(Faction faction) { return new TypeRank(faction); }
public TypeRank(Faction faction)
{
super(Rel.class);
if (faction == null) throw new NullPointerException("faction");
this.faction = faction;
this.setAll(faction.getRanks().getAll());
super(Rank.class, faction);
}
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
private final Faction faction;
public Faction getFaction() { return this.faction; }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public boolean isValid(String arg, CommandSender sender)
public Collection<Rank> getAll(Faction faction)
{
// In the generic case accept all
if (this.getAll().isEmpty()) return true;
else return super.isValid(arg, sender);
return faction.getRanks().getAll();
}
@Override

View File

@ -0,0 +1,37 @@
package com.massivecraft.factions.cmd.type;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.Warp;
import java.util.Collection;
public class TypeWarp extends TypeEntityInternalFaction<Warp>
{
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
private static TypeWarp i = new TypeWarp();
public static TypeWarp get() { return i; }
private TypeWarp()
{
super(Warp.class);
}
public static TypeWarp get(Faction faction) { return new TypeWarp(faction); }
public TypeWarp(Faction faction)
{
super(Warp.class, faction);
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public Collection<Warp> getAll(Faction faction)
{
return faction.getWarps().getAll();
}
}

View File

@ -12,8 +12,9 @@ import com.massivecraft.factions.event.EventFactionsCreate;
import com.massivecraft.factions.event.EventFactionsDescriptionChange;
import com.massivecraft.factions.event.EventFactionsDisband;
import com.massivecraft.factions.event.EventFactionsFlagChange;
import com.massivecraft.factions.event.EventFactionsHomeChange;
import com.massivecraft.factions.event.EventFactionsHomeTeleport;
import com.massivecraft.factions.event.EventFactionsWarpAdd;
import com.massivecraft.factions.event.EventFactionsWarpRemove;
import com.massivecraft.factions.event.EventFactionsWarpTeleport;
import com.massivecraft.factions.event.EventFactionsInvitedChange;
import com.massivecraft.factions.event.EventFactionsMembershipChange;
import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason;
@ -177,13 +178,22 @@ public class EngineEcon extends Engine
}
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void payForCommand(EventFactionsHomeChange event)
public void payForCommand(EventFactionsWarpAdd event)
{
Double cost = MConf.get().econCostSethome;
String desc = CmdFactions.get().cmdFactionsSethome.getDesc();
Double cost = MConf.get().econCostWarpAdd;
String desc = CmdFactions.get().cmdFactionsWarp.cmdFactionWarpAdd.getDesc();
payForAction(event, cost, desc);
}
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void payForCommand(EventFactionsWarpRemove event)
{
Double cost = MConf.get().econCostWarpRemove;
String desc = CmdFactions.get().cmdFactionsWarp.cmdFactionWarpRemove.getDesc();
payForAction(event, cost, desc);
}
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void payForCommand(EventFactionsCreate event)
@ -240,13 +250,12 @@ public class EngineEcon extends Engine
}
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void payForCommand(EventFactionsHomeTeleport event)
public void payForCommand(EventFactionsWarpTeleport event)
{
Double cost = MConf.get().econCostHome;
String desc = CmdFactions.get().cmdFactionsHome.getDesc();
Double cost = MConf.get().econCostWarpGo;
String desc = CmdFactions.get().cmdFactionsWarp.cmdFactionsWarpGo.getDesc();
payForAction(event, cost, desc);
}
}

View File

@ -3,8 +3,8 @@ package com.massivecraft.factions.engine;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.factions.entity.Warp;
import com.massivecraft.massivecore.Engine;
import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.massivecore.util.MUtil;
import org.bukkit.Location;
import org.bukkit.entity.Player;
@ -12,6 +12,8 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerRespawnEvent;
import java.util.List;
public class EngineTeleportHomeOnDeath extends Engine
{
// -------------------------------------------- //
@ -33,23 +35,25 @@ public class EngineTeleportHomeOnDeath extends Engine
final MPlayer mplayer = MPlayer.get(player);
// ... homes are enabled, active and at this priority ...
if (!MConf.get().homesEnabled) return;
if (!MConf.get().homesTeleportToOnDeathActive) return;
if (MConf.get().homesTeleportToOnDeathPriority != priority) return;
if (!MConf.get().warpsEnabled) return;
if (!MConf.get().warpsTeleportToOnDeathActive) return;
if (MConf.get().warpsTeleportToOnDeathPriority != priority) return;
// ... and the player has a faction ...
final Faction faction = mplayer.getFaction();
if (faction.isNone()) return;
// ... and the faction has a home ...
PS home = faction.getHome();
if (home == null) return;
List<Warp> warps = faction.getWarps().getAll(warp -> warp.getName().equalsIgnoreCase(MConf.get().warpsTeleportToOnDeathName));
if (warps.isEmpty()) return;
Warp warp = warps.get(0);
// ... and the home is translatable ...
Location respawnLocation = null;
try
{
respawnLocation = home.asBukkitLocation(true);
respawnLocation = warp.getLocation().asBukkitLocation(true);
}
catch (Exception e)
{

View File

@ -70,7 +70,7 @@ public class Faction extends Entity<Faction> implements FactionsParticipator, MP
this.setDescription(that.description);
this.setMotd(that.motd);
this.setCreatedAtMillis(that.createdAtMillis);
this.setHome(that.home);
this.warps.load(that.warps);
this.setPowerBoost(that.powerBoost);
this.invitations.load(that.invitations);
this.ranks.load(that.ranks);
@ -99,7 +99,7 @@ public class Faction extends Entity<Faction> implements FactionsParticipator, MP
// VERSION
// -------------------------------------------- //
public int version = 2;
public int version = 3;
// -------------------------------------------- //
// FIELDS: RAW
@ -125,11 +125,9 @@ public class Faction extends Entity<Faction> implements FactionsParticipator, MP
// We store the creation date for the faction.
// It can be displayed on info pages etc.
private long createdAtMillis = System.currentTimeMillis();
// Factions can optionally set a home location.
// If they do their members can teleport there using /f home
// Null means the faction has no home.
private PS home = null;
// Factions can set a few significant locations (warps)
private EntityInternalMap<Warp> warps = new EntityInternalMap<>(this, Warp.class);
// Factions usually do not have a powerboost. It defaults to 0.
// The powerBoost is a custom increase/decrease to default and maximum power.
@ -362,46 +360,37 @@ public class Faction extends Entity<Faction> implements FactionsParticipator, MP
}
// -------------------------------------------- //
// FIELD: home
// FIELD: warp
// -------------------------------------------- //
public PS getHome()
public EntityInternalMap<Warp> getWarps() { return this.warps; }
public Warp getWarp(Object oid)
{
this.verifyHomeIsValid();
return this.home;
if (oid == null) throw new NullPointerException("oid");
Warp warp = this.getWarps().get(oid);
if (warp == null) return null;
if (!warp.verifyIsValid()) return null;
return warp;
}
public PS getWarpPS(Object oid)
{
if (oid == null) throw new NullPointerException("oid");
Warp warp = this.getWarp(oid);
if (warp == null) return null;
return warp.getLocation();
}
public void verifyHomeIsValid()
public String addWarp(Warp warp)
{
if (this.isValidHome(this.home)) return;
this.home = null;
this.changed();
msg("<b>Your faction home has been un-set since it is no longer in your territory.");
return this.getWarps().attach(warp);
}
public boolean isValidHome(PS ps)
public Warp removeWarp(Warp warp)
{
if (ps == null) return true;
if (!MConf.get().homesMustBeInClaimedTerritory) return true;
if (BoardColl.get().getFactionAt(ps) == this) return true;
return false;
}
public boolean hasHome()
{
return this.getHome() != null;
}
public void setHome(PS home)
{
// Detect Nochange
if (MUtil.equals(this.home, home)) return;
// Apply
this.home = home;
// Mark as changed
this.changed();
return this.getWarps().detachEntity(warp);
}
// -------------------------------------------- //

View File

@ -23,11 +23,11 @@ public class Invitation extends EntityInternal<Invitation>
private String inviterId;
public String getInviterId() { return inviterId; }
public void setInviterId(String inviterId) { this.inviterId = inviterId; }
public void setInviterId(String inviterId) { this.inviterId = inviterId; this.changed(); }
private Long creationMillis;
public Long getCreationMillis() { return creationMillis; }
public void setCreationMillis(Long creationMillis) { this.creationMillis = creationMillis; }
public void setCreationMillis(Long creationMillis) { this.creationMillis = creationMillis; this.changed(); }
// -------------------------------------------- //
// CONSTRUCT

View File

@ -59,7 +59,7 @@ public class MConf extends Entity<MConf>
// VERSION
// -------------------------------------------- //
public int version = 4;
public int version = 5;
// -------------------------------------------- //
// COMMAND ALIASES
@ -243,32 +243,34 @@ public class MConf extends Entity<MConf>
// HOMES
// -------------------------------------------- //
// Is the home feature enabled?
// If you set this to false players can't set homes or teleport home.
public boolean homesEnabled = true;
// Must homes be located inside the faction's territory?
// Is the warps feature enabled?
// If you set this to false players can't set warps or teleport to a warp.
public boolean warpsEnabled = true;
// How many warps can they have?
public int warpsMax = 1;
// Must warps be located inside the faction's territory?
// It's usually a wise idea keeping this true.
// Otherwise players can set their homes inside enemy territory.
public boolean homesMustBeInClaimedTerritory = true;
// Otherwise players can set their warps inside enemy territory.
public boolean warpsMustBeInClaimedTerritory = true;
// Is the home teleport command available?
// One reason you might set this to false is if you only want players going home on respawn after death.
public boolean homesTeleportCommandEnabled = true;
// These options can be used to limit rights to warp under different circumstances.
public boolean warpsTeleportAllowedFromEnemyTerritory = true;
public boolean warpsTeleportAllowedFromDifferentWorld = true;
public double warpsTeleportAllowedEnemyDistance = 32.0;
public boolean warpsTeleportIgnoreEnemiesIfInOwnTerritory = true;
// These options can be used to limit rights to tp home under different circumstances.
public boolean homesTeleportAllowedFromEnemyTerritory = true;
public boolean homesTeleportAllowedFromDifferentWorld = true;
public double homesTeleportAllowedEnemyDistance = 32.0;
public boolean homesTeleportIgnoreEnemiesIfInOwnTerritory = true;
// Should players teleport to faction home on death?
// Should players teleport to faction warp on death?
// Set this to true to override the default respawn location.
public boolean homesTeleportToOnDeathActive = false;
public boolean warpsTeleportToOnDeathActive = false;
// And waht faction warp should it be? It must have a specific name.
public String warpsTeleportToOnDeathName = "home";
// This value can be used to tweak compatibility with other plugins altering the respawn location.
// Choose between: LOWEST, LOW, NORMAL, HIGH, HIGHEST and MONITOR.
public EventPriority homesTeleportToOnDeathPriority = EventPriority.NORMAL;
public EventPriority warpsTeleportToOnDeathPriority = EventPriority.NORMAL;
// -------------------------------------------- //
// TERRITORY INFO
@ -590,13 +592,16 @@ public class MConf extends Entity<MConf>
public double econCostCreate = 100.0;
// And so on and so forth ... you get the idea.
public double econCostSethome = 0.0;
@Deprecated public double econCostSethome = 0.0;
public double econCostWarpAdd = 0.0;
public double econCostWarpRemove = 0.0;
public double econCostJoin = 0.0;
public double econCostLeave = 0.0;
public double econCostKick = 0.0;
public double econCostInvite = 0.0;
public double econCostDeinvite = 0.0;
public double econCostHome = 0.0;
@Deprecated public double econCostHome = 0.0;
public double econCostWarpGo = 0.0;
public double econCostName = 0.0;
public double econCostDescription = 0.0;
public double econCostTitle = 0.0;

View File

@ -0,0 +1,93 @@
package com.massivecraft.factions.entity;
import com.massivecraft.massivecore.Named;
import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.massivecore.ps.PSFormatHumanSpace;
import com.massivecraft.massivecore.store.EntityInternal;
import com.massivecraft.massivecore.store.EntityInternalMap;
import com.massivecraft.massivecore.util.Txt;
public class Warp extends EntityInternal<Warp> implements Named
{
// -------------------------------------------- //
// OVERRIDE: ENTITY
// -------------------------------------------- //
@Override
public Warp load(Warp that)
{
this.name = that.name;
this.location = that.location;
return this;
}
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
private String name;
public String getName() { return name; }
public void setName(String name) { this.name = name; this.changed(); }
private PS location;
public PS getLocation() { return location; }
public void setLocation(PS location) { this.location = location; this.changed(); }
public String getWorld() { return this.getLocation().getWorld(); }
public Faction getFaction()
{
EntityInternalMap<?> internalMap = (EntityInternalMap<?>) this.getContainer();
Faction faction = (Faction) internalMap.getEntity();
return faction;
}
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public Warp()
{
this(null, null);
}
public Warp(String name, PS location)
{
this.name = name;
this.location = location;
}
// -------------------------------------------- //
// VISUAL
// -------------------------------------------- //
public String getVisual(Object senderObject)
{
return Txt.parse("<h>%s<reset>:%s", this.getName(), this.getLocation().toString(PSFormatHumanSpace.get()));
}
// -------------------------------------------- //
// VALID
// -------------------------------------------- //
public boolean verifyIsValid()
{
if (this.isValid()) return true;
this.detach();
this.getFaction().msg("<b>Your faction warp <h>%s <b>has been un-set since it is no longer in your territory.", this.getName());
return false;
}
public boolean isValidFor(Faction faction)
{
if (!MConf.get().warpsMustBeInClaimedTerritory) return true;
if (BoardColl.get().getFactionAt(this.getLocation()) == faction) return true;
return false;
}
public boolean isValid()
{
return this.isValidFor(this.getFaction());
}
}

View File

@ -0,0 +1,51 @@
package com.massivecraft.factions.entity.migrator;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.reflect.TypeToken;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.Warp;
import com.massivecraft.massivecore.MassiveCore;
import com.massivecraft.massivecore.collections.MassiveMap;
import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.massivecore.store.MStore;
import com.massivecraft.massivecore.store.migrator.MigratorRoot;
import java.util.Map;
public class MigratorFaction003Warps extends MigratorRoot
{
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
private static MigratorFaction003Warps i = new MigratorFaction003Warps();
public static MigratorFaction003Warps get() { return i; }
private MigratorFaction003Warps()
{
super(Faction.class);
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void migrateInner(JsonObject entity)
{
JsonElement jsonHome = entity.remove("home");
if (jsonHome == null ||jsonHome.isJsonNull()) return;
if (!jsonHome.isJsonObject()) throw new RuntimeException("not JsonObject " + jsonHome);
PS psHome = MassiveCore.gson.fromJson(jsonHome, PS.class);
Warp warp = new Warp("home", psHome);
Map<String, Warp> warps = new MassiveMap<>();
warps.put(MStore.createId(), warp);
JsonElement jsonMap = MassiveCore.gson.toJsonTree(warps, (new TypeToken<Map<String,Warp>>(){}).getType());
entity.add("warps", jsonMap);
}
}

View File

@ -0,0 +1,28 @@
package com.massivecraft.factions.entity.migrator;
import com.massivecraft.factions.entity.MConf;
import com.massivecraft.massivecore.store.migrator.MigratorFieldRename;
import com.massivecraft.massivecore.store.migrator.MigratorRoot;
public class MigratorMConf005Warps extends MigratorRoot
{
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
private static MigratorMConf005Warps i = new MigratorMConf005Warps();
public static MigratorMConf005Warps get() { return i; }
private MigratorMConf005Warps()
{
super(MConf.class);
this.addInnerMigrator(MigratorFieldRename.get("homesEnabled", "warpsEnabled"));
this.addInnerMigrator(MigratorFieldRename.get("homesMustBeInClaimedTerritory", "warpsMustBeInClaimedTerritory"));
this.addInnerMigrator(MigratorFieldRename.get("homesTeleportAllowedFromEnemyTerritory", "warpsTeleportAllowedFromEnemyTerritory"));
this.addInnerMigrator(MigratorFieldRename.get("homesTeleportAllowedFromDifferentWorld", "warpsTeleportAllowedFromDifferentWorld"));
this.addInnerMigrator(MigratorFieldRename.get("homesTeleportAllowedEnemyDistance", "warpsTeleportAllowedEnemyDistance"));
this.addInnerMigrator(MigratorFieldRename.get("homesTeleportIgnoreEnemiesIfInOwnTerritory", "warpsTeleportIgnoreEnemiesIfInOwnTerritory"));
this.addInnerMigrator(MigratorFieldRename.get("homesTeleportToOnDeathActive", "warpsTeleportToOnDeathActive"));
this.addInnerMigrator(MigratorFieldRename.get("homesTeleportToOnDeathPriority", "warpsTeleportToOnDeathPriority"));
}
}

View File

@ -1,40 +1,40 @@
package com.massivecraft.factions.event;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.massivecore.ps.PS;
import org.bukkit.command.CommandSender;
import org.bukkit.event.HandlerList;
public class EventFactionsHomeChange extends EventFactionsAbstractSender
{
// -------------------------------------------- //
// REQUIRED EVENT CODE
// -------------------------------------------- //
private static final HandlerList handlers = new HandlerList();
@Override public HandlerList getHandlers() { return handlers; }
public static HandlerList getHandlerList() { return handlers; }
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
private final Faction faction;
public Faction getFaction() { return this.faction; }
private PS newHome;
public PS getNewHome() { return this.newHome; }
public void setNewHome(PS newHome) { this.newHome = newHome; }
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public EventFactionsHomeChange(CommandSender sender, Faction faction, PS newHome)
{
super(sender);
this.faction = faction;
this.newHome = newHome;
}
}
package com.massivecraft.factions.event;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.Warp;
import org.bukkit.command.CommandSender;
import org.bukkit.event.HandlerList;
public class EventFactionsWarpAdd extends EventFactionsAbstractSender
{
// -------------------------------------------- //
// REQUIRED EVENT CODE
// -------------------------------------------- //
private static final HandlerList handlers = new HandlerList();
@Override public HandlerList getHandlers() { return handlers; }
public static HandlerList getHandlerList() { return handlers; }
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
private final Faction faction;
public Faction getFaction() { return this.faction; }
private Warp warp;
public Warp getNewWarp() { return this.warp; }
public void setNewWarp(Warp warp) { this.warp = warp; }
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public EventFactionsWarpAdd(CommandSender sender, Faction faction, Warp warp)
{
super(sender);
this.faction = faction;
this.warp = warp;
}
}

View File

@ -0,0 +1,40 @@
package com.massivecraft.factions.event;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.Warp;
import org.bukkit.command.CommandSender;
import org.bukkit.event.HandlerList;
public class EventFactionsWarpRemove extends EventFactionsAbstractSender
{
// -------------------------------------------- //
// REQUIRED EVENT CODE
// -------------------------------------------- //
private static final HandlerList handlers = new HandlerList();
@Override public HandlerList getHandlers() { return handlers; }
public static HandlerList getHandlerList() { return handlers; }
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
private final Faction faction;
public Faction getFaction() { return this.faction; }
private Warp warp;
public Warp getNewWarp() { return this.warp; }
public void setNewWarp(Warp warp) { this.warp = warp; }
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public EventFactionsWarpRemove(CommandSender sender, Faction faction, Warp warp)
{
super(sender);
this.faction = faction;
this.warp = warp;
}
}

View File

@ -1,25 +1,34 @@
package com.massivecraft.factions.event;
import org.bukkit.command.CommandSender;
import org.bukkit.event.HandlerList;
public class EventFactionsHomeTeleport extends EventFactionsAbstractSender
{
// -------------------------------------------- //
// REQUIRED EVENT CODE
// -------------------------------------------- //
private static final HandlerList handlers = new HandlerList();
@Override public HandlerList getHandlers() { return handlers; }
public static HandlerList getHandlerList() { return handlers; }
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public EventFactionsHomeTeleport(CommandSender sender)
{
super(sender);
}
}
package com.massivecraft.factions.event;
import com.massivecraft.factions.entity.Warp;
import org.bukkit.command.CommandSender;
import org.bukkit.event.HandlerList;
public class EventFactionsWarpTeleport extends EventFactionsAbstractSender
{
// -------------------------------------------- //
// REQUIRED EVENT CODE
// -------------------------------------------- //
private static final HandlerList handlers = new HandlerList();
@Override public HandlerList getHandlers() { return handlers; }
public static HandlerList getHandlerList() { return handlers; }
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
private final Warp warp;
public Warp getWarp() { return this.warp; }
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public EventFactionsWarpTeleport(CommandSender sender, Warp warp)
{
super(sender);
this.warp = warp;
}
}

View File

@ -5,7 +5,6 @@ import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.massivecore.Engine;
import kangarko.chatcontrol.ChatControl;
import mineverse.Aust1n46.chat.api.MineverseChatAPI;
import mineverse.Aust1n46.chat.api.MineverseChatPlayer;
import mineverse.Aust1n46.chat.channel.ChatChannel;
@ -68,7 +67,6 @@ public class EngineVentureChat extends Engine
Predicate<Player> predicate = isSpy.or(predicateChannel);
EngineChat.filterToPredicate(event, predicate);
ChatControl
}
}