Add optional essentials integration for /f home delay and cooldown (enabled by default).
This commit is contained in:
parent
ace3853694
commit
92bddb0f9a
BIN
lib/Essentials.jar
Normal file
BIN
lib/Essentials.jar
Normal file
Binary file not shown.
@ -102,8 +102,8 @@ public class Conf
|
|||||||
public static boolean homesTeleportToOnDeath = true;
|
public static boolean homesTeleportToOnDeath = true;
|
||||||
public static boolean homesRespawnFromNoPowerLossWorlds = true;
|
public static boolean homesRespawnFromNoPowerLossWorlds = true;
|
||||||
public static boolean homesTeleportCommandEnabled = true;
|
public static boolean homesTeleportCommandEnabled = true;
|
||||||
|
public static boolean homesTeleportCommandEssentialsIntegration = true;
|
||||||
public static boolean homesTeleportCommandSmokeEffectEnabled = true;
|
public static boolean homesTeleportCommandSmokeEffectEnabled = true;
|
||||||
public static float homesTeleportCommandSmokeEffectThickness = 3f;
|
|
||||||
public static boolean homesTeleportAllowedFromEnemyTerritory = true;
|
public static boolean homesTeleportAllowedFromEnemyTerritory = true;
|
||||||
public static boolean homesTeleportAllowedFromDifferentWorld = true;
|
public static boolean homesTeleportAllowedFromDifferentWorld = true;
|
||||||
public static double homesTeleportAllowedEnemyDistance = 32.0;
|
public static double homesTeleportAllowedEnemyDistance = 32.0;
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.massivecraft.factions;
|
package com.massivecraft.factions;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -361,7 +360,7 @@ public class Faction extends Entity implements EconomyParticipator
|
|||||||
public Set<FPlayer> getFPlayers()
|
public Set<FPlayer> getFPlayers()
|
||||||
{
|
{
|
||||||
// return a shallow copy of the FPlayer list, to prevent tampering and concurrency issues
|
// return a shallow copy of the FPlayer list, to prevent tampering and concurrency issues
|
||||||
Set<FPlayer> ret = new HashSet(fplayers);
|
Set<FPlayer> ret = new HashSet<FPlayer>(fplayers);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,10 +3,16 @@ package com.massivecraft.factions.cmd;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
|
import com.earth2me.essentials.IEssentials;
|
||||||
|
import com.earth2me.essentials.Teleport;
|
||||||
|
import com.earth2me.essentials.Trade;
|
||||||
import com.massivecraft.factions.Board;
|
import com.massivecraft.factions.Board;
|
||||||
import com.massivecraft.factions.Conf;
|
import com.massivecraft.factions.Conf;
|
||||||
import com.massivecraft.factions.FLocation;
|
import com.massivecraft.factions.FLocation;
|
||||||
@ -18,6 +24,7 @@ import com.massivecraft.factions.struct.Permission;
|
|||||||
import com.massivecraft.factions.struct.Rel;
|
import com.massivecraft.factions.struct.Rel;
|
||||||
import com.massivecraft.factions.zcore.util.SmokeUtil;
|
import com.massivecraft.factions.zcore.util.SmokeUtil;
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public class CmdHome extends FCommand
|
public class CmdHome extends FCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -123,21 +130,44 @@ public class CmdHome extends FCommand
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
// The teleport is either handled inhouse or by the Essentials plugin as a warp
|
||||||
if ( ! payForCommand(Conf.econCostHome, "to teleport to your faction home", "for teleporting to your faction home")) return;
|
final Plugin grab = Bukkit.getPluginManager().getPlugin("Essentials");
|
||||||
|
if (Conf.homesTeleportCommandEssentialsIntegration && grab != null && grab.isEnabled())
|
||||||
// Create a smoke effect
|
|
||||||
if (Conf.homesTeleportCommandSmokeEffectEnabled)
|
|
||||||
{
|
{
|
||||||
List<Location> smokeLocations = new ArrayList<Location>();
|
// Handled by Essentials
|
||||||
smokeLocations.add(me.getLocation());
|
IEssentials ess = (IEssentials) grab;
|
||||||
smokeLocations.add(me.getLocation().clone().add(0, 1, 0));
|
Teleport teleport = (Teleport) ess.getUser(this.me).getTeleport();
|
||||||
smokeLocations.add(myFaction.getHome());
|
Trade trade = new Trade(Conf.econCostHome, ess);
|
||||||
smokeLocations.add(myFaction.getHome().clone().add(0, 1, 0));
|
try
|
||||||
SmokeUtil.spawnCloudRandom(smokeLocations, Conf.homesTeleportCommandSmokeEffectThickness);
|
{
|
||||||
|
teleport.teleport(myFaction.getHome(), trade);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
me.sendMessage(ChatColor.RED.toString()+e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Handled by Factions
|
||||||
|
|
||||||
|
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
||||||
|
if ( ! payForCommand(Conf.econCostHome, "to teleport to your faction home", "for teleporting to your faction home")) return;
|
||||||
|
|
||||||
|
// Create a smoke effect
|
||||||
|
if (Conf.homesTeleportCommandSmokeEffectEnabled)
|
||||||
|
{
|
||||||
|
List<Location> smokeLocations = new ArrayList<Location>();
|
||||||
|
smokeLocations.add(me.getLocation());
|
||||||
|
smokeLocations.add(me.getLocation().clone().add(0, 1, 0));
|
||||||
|
smokeLocations.add(myFaction.getHome());
|
||||||
|
smokeLocations.add(myFaction.getHome().clone().add(0, 1, 0));
|
||||||
|
SmokeUtil.spawnCloudRandom(smokeLocations, 3f);
|
||||||
|
}
|
||||||
|
|
||||||
|
me.teleport(myFaction.getHome());
|
||||||
}
|
}
|
||||||
|
|
||||||
me.teleport(myFaction.getHome());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user