use of com.elmakers.mine.bukkit.world.MagicWorld in project MagicPlugin by elBukkit.
the class MagicController method getMaxHeight.
@Override
public int getMaxHeight(World world) {
MagicWorld magicWorld = getMagicWorld(world.getName());
int maxHeight = CompatibilityLib.getCompatibilityUtils().getMaxHeight(world);
if (magicWorld != null) {
maxHeight = magicWorld.getMaxHeight(maxHeight);
}
return maxHeight;
}
use of com.elmakers.mine.bukkit.world.MagicWorld in project MagicPlugin by elBukkit.
the class MagicController method getMinHeight.
@Override
public int getMinHeight(World world) {
MagicWorld magicWorld = getMagicWorld(world.getName());
int minHeight = CompatibilityLib.getCompatibilityUtils().getMinHeight(world);
if (magicWorld != null) {
minHeight = magicWorld.getMinHeight(minHeight);
}
return minHeight;
}
use of com.elmakers.mine.bukkit.world.MagicWorld in project MagicPlugin by elBukkit.
the class BlockController method onWorldSaveEvent.
@EventHandler
public void onWorldSaveEvent(WorldSaveEvent event) {
World world = event.getWorld();
MagicWorld magicWorld = controller.getMagicWorld(world.getName());
boolean undo = undoOnWorldSave;
if (undo && magicWorld != null && !magicWorld.isCancelSpellsOnSave()) {
undo = false;
}
if (undo) {
undoPending(world, "save");
}
Collection<Player> players = world.getPlayers();
for (Player player : players) {
Mage mage = controller.getRegisteredMage(player);
if (mage != null) {
controller.saveMage(mage, true);
}
}
}
use of com.elmakers.mine.bukkit.world.MagicWorld in project MagicPlugin by elBukkit.
the class WorldPlayerListener method onBlockPlace.
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onBlockPlace(BlockPlaceEvent event) {
Block block = event.getBlock();
MagicWorld magicWorld = controller.getWorld(block.getWorld().getName());
if (magicWorld == null)
return;
BlockResult result = magicWorld.processBlockPlace(block, event.getPlayer());
if (result == BlockResult.CANCEL) {
event.setCancelled(true);
}
}
use of com.elmakers.mine.bukkit.world.MagicWorld in project MagicPlugin by elBukkit.
the class WorldPlayerListener method onPlayerChangeWorld.
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlayerChangeWorld(PlayerChangedWorldEvent event) {
Player player = event.getPlayer();
Mage mage = controller.getMagicController().getMage(player);
MagicWorld fromWorld = controller.getWorld(event.getFrom().getName());
MagicWorld toWorld = controller.getWorld(player.getWorld().getName());
if (fromWorld != null) {
fromWorld.playerLeft(mage, toWorld);
}
if (toWorld != null) {
toWorld.playerEntered(mage, fromWorld);
}
}
Aggregations