Readd essentials teleport cooldown hook. Fixes issue #5
This commit is contained in:
parent
7107829446
commit
024336d717
10
pom.xml
10
pom.xml
@ -65,6 +65,12 @@
|
|||||||
<artifactId>worldedit</artifactId>
|
<artifactId>worldedit</artifactId>
|
||||||
<version>5.6.1</version>
|
<version>5.6.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.ess3</groupId>
|
||||||
|
<artifactId>Essentials</artifactId>
|
||||||
|
<version>2.x-SNAPSHOT</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
@ -72,6 +78,10 @@
|
|||||||
<id>repo-daboross-net</id>
|
<id>repo-daboross-net</id>
|
||||||
<url>http://repo.daboross.net/</url>
|
<url>http://repo.daboross.net/</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>ess-repo</id>
|
||||||
|
<url>http://repo.ess3.net/content/groups/public</url>
|
||||||
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>bukkit-repo</id>
|
<id>bukkit-repo</id>
|
||||||
<url>http://repo.bukkit.org/content/groups/public/</url>
|
<url>http://repo.bukkit.org/content/groups/public/</url>
|
||||||
|
@ -3,6 +3,7 @@ package com.massivecraft.factions;
|
|||||||
import com.massivecraft.factions.cmd.CmdAutoHelp;
|
import com.massivecraft.factions.cmd.CmdAutoHelp;
|
||||||
import com.massivecraft.factions.cmd.FCmdRoot;
|
import com.massivecraft.factions.cmd.FCmdRoot;
|
||||||
import com.massivecraft.factions.integration.Econ;
|
import com.massivecraft.factions.integration.Econ;
|
||||||
|
import com.massivecraft.factions.integration.Essentials;
|
||||||
import com.massivecraft.factions.integration.Worldguard;
|
import com.massivecraft.factions.integration.Worldguard;
|
||||||
import com.massivecraft.factions.listeners.*;
|
import com.massivecraft.factions.listeners.*;
|
||||||
import com.massivecraft.factions.struct.ChatMode;
|
import com.massivecraft.factions.struct.ChatMode;
|
||||||
@ -86,6 +87,7 @@ public class P extends MPlugin {
|
|||||||
|
|
||||||
// Load Conf from disk
|
// Load Conf from disk
|
||||||
Conf.load();
|
Conf.load();
|
||||||
|
Essentials.setup();
|
||||||
FPlayers.i.loadFromDisc();
|
FPlayers.i.loadFromDisc();
|
||||||
Factions.i.loadFromDisc();
|
Factions.i.loadFromDisc();
|
||||||
Board.load();
|
Board.load();
|
||||||
|
@ -0,0 +1,37 @@
|
|||||||
|
package com.massivecraft.factions.integration;
|
||||||
|
|
||||||
|
import com.earth2me.essentials.IEssentials;
|
||||||
|
import com.earth2me.essentials.Teleport;
|
||||||
|
import com.earth2me.essentials.Trade;
|
||||||
|
import com.massivecraft.factions.Conf;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
|
public class Essentials {
|
||||||
|
|
||||||
|
private static IEssentials essentials;
|
||||||
|
|
||||||
|
public static void setup() {
|
||||||
|
Plugin ess = Bukkit.getPluginManager().getPlugin("Essentials");
|
||||||
|
if(ess != null) {
|
||||||
|
essentials = (IEssentials) ess;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// return false if feature is disabled or Essentials isn't available
|
||||||
|
public static boolean handleTeleport(Player player, Location loc) {
|
||||||
|
if (!Conf.homesTeleportCommandEssentialsIntegration || essentials == null) return false;
|
||||||
|
|
||||||
|
Teleport teleport = (Teleport) essentials.getUser(player).getTeleport();
|
||||||
|
Trade trade = new Trade(Conf.econCostHome, essentials);
|
||||||
|
try {
|
||||||
|
teleport.teleport(loc, trade);
|
||||||
|
} catch (Exception e) {
|
||||||
|
player.sendMessage(ChatColor.RED.toString() + e.getMessage());
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user