Get rid of Essentials integrations, use MCore teleporter for now and PS homes. As for chat I need to rewrite the chat system. Essentials integration can be readded later if needed.

This commit is contained in:
Olof Larsson
2013-04-17 11:47:48 +02:00
parent 4449b56246
commit 109d6059ce
15 changed files with 88 additions and 291 deletions

View File

@ -1,8 +1,5 @@
package com.massivecraft.factions.cmd;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
@ -17,11 +14,11 @@ import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.Rel;
import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
import com.massivecraft.factions.integration.EssentialsFeatures;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.cmd.req.ReqIsPlayer;
import com.massivecraft.mcore.mixin.Mixin;
import com.massivecraft.mcore.mixin.TeleporterException;
import com.massivecraft.mcore.ps.PS;
import com.massivecraft.mcore.util.SmokeUtil;
public class CmdFactionsHome extends FCommand
@ -64,7 +61,7 @@ public class CmdFactionsHome extends FCommand
return;
}
if ( ! ConfServer.homesTeleportAllowedFromDifferentWorld && me.getWorld().getUID() != myFaction.getHome().getWorld().getUID())
if (!ConfServer.homesTeleportAllowedFromDifferentWorld && !me.getWorld().getName().equalsIgnoreCase(myFaction.getHome().getWorld()))
{
fme.msg("<b>You cannot teleport to your faction home while in a different world.");
return;
@ -121,24 +118,17 @@ public class CmdFactionsHome extends FCommand
}
}
// if Essentials teleport handling is enabled and available, pass the teleport off to it (for delay and cooldown)
if (EssentialsFeatures.handleTeleport(me, myFaction.getHome())) return;
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if ( ! payForCommand(ConfServer.econCostHome, "to teleport to your faction home", "for teleporting to your faction home")) return;
// Create a smoke effect
if (ConfServer.homesTeleportCommandSmokeEffectEnabled)
try
{
List<Location> smokeLocations = new ArrayList<Location>();
smokeLocations.add(loc);
smokeLocations.add(loc.add(0, 1, 0));
smokeLocations.add(myFaction.getHome());
smokeLocations.add(myFaction.getHome().clone().add(0, 1, 0));
SmokeUtil.spawnCloudRandom(smokeLocations, 3f);
Mixin.teleport(me, myFaction.getHome(), "your faction home", sender);
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if ( ! payForCommand(ConfServer.econCostHome, "to teleport to your faction home", "for teleporting to your faction home")) return;
}
catch (TeleporterException e)
{
me.sendMessage(e.getMessage());
}
me.teleport(myFaction.getHome());
}
}

View File

@ -1,6 +1,5 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.BoardColl;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.FPerm;
import com.massivecraft.factions.Faction;
@ -26,6 +25,7 @@ public class CmdFactionsSethome extends FCommand
@Override
public void perform()
{
// TODO: Make a command REQ instead?
if ( ! ConfServer.homesEnabled)
{
fme.msg("<b>Sorry, Faction homes are disabled on this server.");
@ -35,18 +35,13 @@ public class CmdFactionsSethome extends FCommand
Faction faction = this.arg(0, ARFaction.get(), myFaction);
if (faction == null) return;
// Can the player set the home for this faction?
// Has faction permission?
if ( ! FPerm.SETHOME.has(sender, faction, true)) return;
PS ps = PS.valueOf(me.getLocation());
// Can the player set the faction home HERE?
if
(
! fme.isUsingAdminMode()
&&
ConfServer.homesMustBeInClaimedTerritory
&&
BoardColl.get().getFactionAt(PS.valueOf(me)) != faction
)
if (!fme.isUsingAdminMode() && !faction.isValidHome(ps))
{
fme.msg("<b>Sorry, your faction home can only be set inside your own claimed territory.");
return;
@ -55,7 +50,7 @@ public class CmdFactionsSethome extends FCommand
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if ( ! payForCommand(ConfServer.econCostSethome, "to set the faction home", "for setting the faction home")) return;
faction.setHome(me.getLocation());
faction.setHome(ps);
faction.msg("%s<i> set the home for your faction. You can now use:", fme.describeTo(myFaction, true));
faction.sendMessage(Factions.get().getOuterCmdFactions().cmdFactionsHome.getUseageTemplate());