PowerRegenEvent and optimization
- Add power regeneration event - Change getNone(), a deprecated method, to getWilderness() - Optimization
This commit is contained in:
@@ -1,13 +1,18 @@
|
||||
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 net.ess3.api.IEssentials;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
public class Essentials {
|
||||
@@ -28,9 +33,9 @@ public class Essentials {
|
||||
}
|
||||
|
||||
Teleport teleport = essentials.getUser(player).getTeleport();
|
||||
Trade trade = new Trade(Conf.econCostHome, essentials);
|
||||
Trade trade = new Trade(new BigDecimal(Conf.econCostHome), essentials);
|
||||
try {
|
||||
teleport.teleport(loc, trade);
|
||||
teleport.teleport(loc, trade, TeleportCause.PLUGIN);
|
||||
} catch (Exception e) {
|
||||
player.sendMessage(ChatColor.RED.toString() + e.getMessage());
|
||||
}
|
||||
|
||||
@@ -54,7 +54,8 @@ public class Worldguard {
|
||||
// Returns:
|
||||
// True: PVP is allowed
|
||||
// False: PVP is disallowed
|
||||
public static boolean isPVP(Player player) {
|
||||
@SuppressWarnings("deprecation")
|
||||
public static boolean isPVP(Player player) {
|
||||
if (!enabled) {
|
||||
// No WG hooks so we'll always bypass this check.
|
||||
return true;
|
||||
|
||||
@@ -40,13 +40,12 @@ public class EngineDynmap {
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static EngineDynmap i = new EngineDynmap();
|
||||
private static final EngineDynmap i = new EngineDynmap();
|
||||
public DynmapAPI dynmapApi;
|
||||
public MarkerAPI markerApi;
|
||||
public MarkerSet markerset;
|
||||
|
||||
private EngineDynmap() {
|
||||
}
|
||||
private EngineDynmap() {}
|
||||
|
||||
public static EngineDynmap getInstance() {
|
||||
return i;
|
||||
@@ -64,10 +63,7 @@ public class EngineDynmap {
|
||||
}
|
||||
|
||||
public static String getHtmlPlayerName(FPlayer fplayer) {
|
||||
if (fplayer == null) {
|
||||
return "none";
|
||||
}
|
||||
return escapeHtml(fplayer.getName());
|
||||
return fplayer != null ? escapeHtml(fplayer.getName()):"none";
|
||||
}
|
||||
|
||||
public static String escapeHtml(String string) {
|
||||
@@ -75,9 +71,9 @@ public class EngineDynmap {
|
||||
for (int i = 0; i < string.length(); i++) {
|
||||
char c = string.charAt(i);
|
||||
if (c > 127 || c == '"' || c == '<' || c == '>' || c == '&') {
|
||||
out.append("&#");
|
||||
out.append((int) c);
|
||||
out.append(';');
|
||||
out.append("&#")
|
||||
.append((int) c)
|
||||
.append(';');
|
||||
} else {
|
||||
out.append(c);
|
||||
}
|
||||
@@ -87,8 +83,7 @@ public class EngineDynmap {
|
||||
|
||||
// Thread Safe / Asynchronous: Yes
|
||||
public static void info(String msg) {
|
||||
String message = DYNMAP_INTEGRATION + msg;
|
||||
System.out.println(message);
|
||||
System.out.println(DYNMAP_INTEGRATION + msg);
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
@@ -97,8 +92,7 @@ public class EngineDynmap {
|
||||
|
||||
// Thread Safe / Asynchronous: Yes
|
||||
public static void severe(String msg) {
|
||||
String message = DYNMAP_INTEGRATION + ChatColor.RED.toString() + msg;
|
||||
System.out.println(message);
|
||||
System.out.println(DYNMAP_INTEGRATION + ChatColor.RED.toString() + msg);
|
||||
}
|
||||
|
||||
public void init() {
|
||||
|
||||
Reference in New Issue
Block a user