Ajout du gestionnaire de protection de la map survie (/cubo)
This commit is contained in:
@@ -5,31 +5,50 @@ import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.earth2me.essentials.Essentials;
|
||||
import com.earth2me.essentials.User;
|
||||
|
||||
public class EssentialsInterface {
|
||||
|
||||
public static Essentials getPlugin() {
|
||||
try {
|
||||
return (Essentials) PandacraftUtils.getInstance().getServer().getPluginManager().getPlugin("Essentials");
|
||||
} catch (Exception e) { return null; }
|
||||
}
|
||||
|
||||
|
||||
public static User getPlayer(Player p) {
|
||||
try {
|
||||
return getPlugin().getUser(p);
|
||||
} catch (Exception e) { }
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean isPlayerVanished(Player p) {
|
||||
try {
|
||||
return ((Essentials)PandacraftUtils.getInstance().getServer().getPluginManager().getPlugin("Essentials")).getUser(p).isVanished();
|
||||
return getPlayer(p).isVanished();
|
||||
} catch (Exception e) { }
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean canPlayerSeeVanishedPlayer(Player p, Player hiddenP) {
|
||||
try {
|
||||
Essentials ess = (Essentials)PandacraftUtils.getInstance().getServer().getPluginManager().getPlugin("Essentials");
|
||||
|
||||
return ess.getUser(p).canSee(hiddenP);
|
||||
return getPlugin().getUser(p).canSee(hiddenP);
|
||||
} catch (Exception e) { }
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isPlayerMuted(Player p) {
|
||||
try {
|
||||
return ((Essentials)PandacraftUtils.getInstance().getServer().getPluginManager().getPlugin("Essentials")).getUser(p).isMuted();
|
||||
return getPlugin().getUser(p).isMuted();
|
||||
} catch (Exception e) { }
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static double getPlayerMoney(Player p) {
|
||||
try {
|
||||
return getPlugin().getUser(p).getMoney().doubleValue();
|
||||
} catch (Exception e) { }
|
||||
return Double.NaN;
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,33 @@
|
||||
package net.mc_pandacraft.java.plugin.pandacraftutils.plugin_interface;
|
||||
|
||||
import net.mc_pandacraft.java.plugin.pandacraftutils.PandacraftUtils;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||
import com.sk89q.worldedit.bukkit.selections.CuboidSelection;
|
||||
import com.sk89q.worldedit.bukkit.selections.Selection;
|
||||
|
||||
public class WorldEditInterface {
|
||||
|
||||
public static WorldEditPlugin getPlugin() {
|
||||
try {
|
||||
return (WorldEditPlugin) PandacraftUtils.getInstance().getServer().getPluginManager().getPlugin("WorldEdit");
|
||||
} catch (Exception e) { return null; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static CuboidSelection getPlayerCuboSelection(Player p) {
|
||||
WorldEditPlugin wePlugin = getPlugin();
|
||||
if (wePlugin == null) return null;
|
||||
Selection sel = wePlugin.getSelection(p);
|
||||
if (sel == null) return null;
|
||||
// on garde que les cuboïdes (pas les autres formes)
|
||||
if (!(sel instanceof CuboidSelection))
|
||||
return null;
|
||||
return (CuboidSelection) sel;
|
||||
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user