Java 类org.bukkit.event.server.MapInitializeEvent 实例源码

项目:CraftBukkit    文件:ItemWorldMap.java   
public WorldMap getSavedMap(ItemStack itemstack, World world) {
    World worldMain = world.getServer().getServer().worlds.get(0); // CraftBukkit - store reference to primary world
    String s = "map_" + itemstack.getData();
    WorldMap worldmap = (WorldMap) worldMain.a(WorldMap.class, s); // CraftBukkit - use primary world for maps

    if (worldmap == null && !world.isStatic) {
        itemstack.setData(worldMain.b("map")); // CraftBukkit - use primary world for maps
        s = "map_" + itemstack.getData();
        worldmap = new WorldMap(s);
        worldmap.scale = 3;
        int i = 128 * (1 << worldmap.scale);

        worldmap.centerX = Math.round((float) world.getWorldData().c() / (float) i) * i;
        worldmap.centerZ = Math.round((float) (world.getWorldData().e() / i)) * i;
        worldmap.map = (byte) ((WorldServer) world).dimension; // CraftBukkit - fixes Bukkit multiworld maps
        worldmap.c();
        worldMain.a(s, (PersistentBase) worldmap); // CraftBukkit - use primary world for maps

        // CraftBukkit start
        MapInitializeEvent event = new MapInitializeEvent(worldmap.mapView);
        Bukkit.getServer().getPluginManager().callEvent(event);
        // CraftBukkit end
    }

    return worldmap;
}
项目:CraftBukkit    文件:ItemWorldMap.java   
public void d(ItemStack itemstack, World world, EntityHuman entityhuman) {
    if (itemstack.hasTag() && itemstack.getTag().getBoolean("map_is_scaling")) {
        WorldMap worldmap = Items.MAP.getSavedMap(itemstack, world);

        world = world.getServer().getServer().worlds.get(0); // CraftBukkit - use primary world for maps

        itemstack.setData(world.b("map"));
        WorldMap worldmap1 = new WorldMap("map_" + itemstack.getData());

        worldmap1.scale = (byte) (worldmap.scale + 1);
        if (worldmap1.scale > 4) {
            worldmap1.scale = 4;
        }

        worldmap1.centerX = worldmap.centerX;
        worldmap1.centerZ = worldmap.centerZ;
        worldmap1.map = worldmap.map;
        worldmap1.c();
        world.a("map_" + itemstack.getData(), (PersistentBase) worldmap1);

        // CraftBukkit start
        MapInitializeEvent event = new MapInitializeEvent(worldmap1.mapView);
        Bukkit.getServer().getPluginManager().callEvent(event);
        // CraftBukkit end
    }
}
项目:Almura-Server    文件:ItemWorldMap.java   
public WorldMap getSavedMap(ItemStack itemstack, World world) {
    World worldMain = world.getServer().getServer().worlds.get(0); // CraftBukkit - store reference to primary world
    String s = "map_" + itemstack.getData();
    WorldMap worldmap = (WorldMap) worldMain.a(WorldMap.class, s); // CraftBukkit - use primary world for maps

    if (worldmap == null && !world.isStatic) {
        itemstack.setData(worldMain.b("map")); // CraftBukkit - use primary world for maps
        s = "map_" + itemstack.getData();
        worldmap = new WorldMap(s);
        worldmap.scale = 3;
        int i = 128 * (1 << worldmap.scale);

        worldmap.centerX = Math.round((float) world.getWorldData().c() / (float) i) * i;
        worldmap.centerZ = Math.round((float) (world.getWorldData().e() / i)) * i;
        worldmap.map = (byte) ((WorldServer) world).dimension; // CraftBukkit - fixes Bukkit multiworld maps
        worldmap.c();
        worldMain.a(s, (WorldMapBase) worldmap); // CraftBukkit - use primary world for maps

        // CraftBukkit start
        MapInitializeEvent event = new MapInitializeEvent(worldmap.mapView);
        Bukkit.getServer().getPluginManager().callEvent(event);
        // CraftBukkit end
    }

    return worldmap;
}
项目:Almura-Server    文件:ItemWorldMap.java   
public void d(ItemStack itemstack, World world, EntityHuman entityhuman) {
    if (itemstack.hasTag() && itemstack.getTag().getBoolean("map_is_scaling")) {
        WorldMap worldmap = Item.MAP.getSavedMap(itemstack, world);

        world = world.getServer().getServer().worlds.get(0); // CraftBukkit - use primary world for maps

        itemstack.setData(world.b("map"));
        WorldMap worldmap1 = new WorldMap("map_" + itemstack.getData());

        worldmap1.scale = (byte) (worldmap.scale + 1);
        if (worldmap1.scale > 4) {
            worldmap1.scale = 4;
        }

        worldmap1.centerX = worldmap.centerX;
        worldmap1.centerZ = worldmap.centerZ;
        worldmap1.map = worldmap.map;
        worldmap1.c();
        world.a("map_" + itemstack.getData(), (WorldMapBase) worldmap1);

        // CraftBukkit start
        MapInitializeEvent event = new MapInitializeEvent(worldmap1.mapView);
        Bukkit.getServer().getPluginManager().callEvent(event);
        // CraftBukkit end
    }
}
项目:Tweakkit-Server    文件:ItemWorldMap.java   
public WorldMap getSavedMap(ItemStack itemstack, World world) {
    World worldMain = world.getServer().getServer().worlds.get(0); // CraftBukkit - store reference to primary world
    String s = "map_" + itemstack.getData();
    WorldMap worldmap = (WorldMap) worldMain.a(WorldMap.class, s); // CraftBukkit - use primary world for maps

    if (worldmap == null && !world.isStatic) {
        itemstack.setData(worldMain.b("map")); // CraftBukkit - use primary world for maps
        s = "map_" + itemstack.getData();
        worldmap = new WorldMap(s);
        worldmap.scale = 3;
        int i = 128 * (1 << worldmap.scale);

        worldmap.centerX = Math.round((float) world.getWorldData().c() / (float) i) * i;
        worldmap.centerZ = Math.round((float) (world.getWorldData().e() / i)) * i;
        worldmap.map = (byte) ((WorldServer) world).dimension; // CraftBukkit - fixes Bukkit multiworld maps
        worldmap.c();
        worldMain.a(s, (PersistentBase) worldmap); // CraftBukkit - use primary world for maps

        // CraftBukkit start
        MapInitializeEvent event = new MapInitializeEvent(worldmap.mapView);
        Bukkit.getServer().getPluginManager().callEvent(event);
        // CraftBukkit end
    }

    return worldmap;
}
项目:Tweakkit-Server    文件:ItemWorldMap.java   
public void d(ItemStack itemstack, World world, EntityHuman entityhuman) {
    if (itemstack.hasTag() && itemstack.getTag().getBoolean("map_is_scaling")) {
        WorldMap worldmap = Items.MAP.getSavedMap(itemstack, world);

        world = world.getServer().getServer().worlds.get(0); // CraftBukkit - use primary world for maps

        itemstack.setData(world.b("map"));
        WorldMap worldmap1 = new WorldMap("map_" + itemstack.getData());

        worldmap1.scale = (byte) (worldmap.scale + 1);
        if (worldmap1.scale > 4) {
            worldmap1.scale = 4;
        }

        worldmap1.centerX = worldmap.centerX;
        worldmap1.centerZ = worldmap.centerZ;
        worldmap1.map = worldmap.map;
        worldmap1.c();
        world.a("map_" + itemstack.getData(), (PersistentBase) worldmap1);

        // CraftBukkit start
        MapInitializeEvent event = new MapInitializeEvent(worldmap1.mapView);
        Bukkit.getServer().getPluginManager().callEvent(event);
        // CraftBukkit end
    }
}
项目:Cauldron    文件:ItemMap.java   
public void onCreated(ItemStack p_77622_1_, World p_77622_2_, EntityPlayer p_77622_3_)
{
    if (p_77622_1_.hasTagCompound() && p_77622_1_.getTagCompound().getBoolean("map_is_scaling"))
    {
        MapData mapdata = Items.filled_map.getMapData(p_77622_1_, p_77622_2_);
        p_77622_1_.setItemDamage(p_77622_2_.getUniqueDataId("map"));
        MapData mapdata1 = new MapData("map_" + p_77622_1_.getItemDamage());
        mapdata1.scale = (byte)(mapdata.scale + 1);

        if (mapdata1.scale > 4)
        {
            mapdata1.scale = 4;
        }

        mapdata1.xCenter = mapdata.xCenter;
        mapdata1.zCenter = mapdata.zCenter;
        mapdata1.dimension = mapdata.dimension;
        mapdata1.markDirty();
        p_77622_2_.setItemData("map_" + p_77622_1_.getItemDamage(), mapdata1);
        // CraftBukkit start
        MapInitializeEvent event = new MapInitializeEvent(mapdata1.mapView);
        Bukkit.getServer().getPluginManager().callEvent(event);
        // CraftBukkit end
    }
}
项目:SpigotSource    文件:ItemWorldMap.java   
public WorldMap getSavedMap(ItemStack itemstack, World world) {
    World worldMain = world.getServer().getServer().worlds.get(0); // CraftBukkit - store reference to primary world
    String s = "map_" + itemstack.getData();
    WorldMap worldmap = (WorldMap) worldMain.a(WorldMap.class, s); // CraftBukkit - use primary world for maps

    if (worldmap == null && !world.isClientSide) {
        itemstack.setData(worldMain.b("map")); // CraftBukkit - use primary world for maps
        s = "map_" + itemstack.getData();
        worldmap = new WorldMap(s);
        worldmap.scale = 3;
        worldmap.a((double) world.getWorldData().b(), (double) world.getWorldData().d(), worldmap.scale);
        worldmap.map = (byte) ((WorldServer) world).dimension; // CraftBukkit - fixes Bukkit multiworld maps
        worldmap.c();
        worldMain.a(s, (PersistentBase) worldmap); // CraftBukkit - use primary world for maps

        // CraftBukkit start
        MapInitializeEvent event = new MapInitializeEvent(worldmap.mapView);
        Bukkit.getServer().getPluginManager().callEvent(event);
        // CraftBukkit end
    }

    return worldmap;
}
项目:SpigotSource    文件:ItemWorldMap.java   
protected static void a(ItemStack itemstack, World world, int i) {
    WorldMap worldmap = Items.FILLED_MAP.getSavedMap(itemstack, world);

    world = world.getServer().getServer().worlds.get(0); // CraftBukkit - use primary world for maps
    itemstack.setData(world.b("map"));
    WorldMap worldmap1 = new WorldMap("map_" + itemstack.getData());

    worldmap1.scale = (byte) MathHelper.clamp(worldmap.scale + i, 0, 4);
    worldmap1.track = worldmap.track;
    worldmap1.a((double) worldmap.centerX, (double) worldmap.centerZ, worldmap1.scale);
    worldmap1.map = worldmap.map;
    worldmap1.c();
    world.a("map_" + itemstack.getData(), (PersistentBase) worldmap1);
    // CraftBukkit start
    MapInitializeEvent event = new MapInitializeEvent(worldmap1.mapView);
    Bukkit.getServer().getPluginManager().callEvent(event);
    // CraftBukkit end
}
项目:SpigotSource    文件:ItemWorldMap.java   
protected static void b(ItemStack itemstack, World world) {
    WorldMap worldmap = Items.FILLED_MAP.getSavedMap(itemstack, world);

    world = world.getServer().getServer().worlds.get(0); // CraftBukkit - use primary world for maps
    itemstack.setData(world.b("map"));
    WorldMap worldmap1 = new WorldMap("map_" + itemstack.getData());

    worldmap1.track = true;
    worldmap1.centerX = worldmap.centerX;
    worldmap1.centerZ = worldmap.centerZ;
    worldmap1.scale = worldmap.scale;
    worldmap1.map = worldmap.map;
    worldmap1.c();
    world.a("map_" + itemstack.getData(), (PersistentBase) worldmap1);
    // CraftBukkit start
    MapInitializeEvent event = new MapInitializeEvent(worldmap1.mapView);
    Bukkit.getServer().getPluginManager().callEvent(event);
    // CraftBukkit end
}
项目:Craft-city    文件:ItemWorldMap.java   
public WorldMap getSavedMap(ItemStack itemstack, World world) {
    String s = "map_" + itemstack.getData();
    WorldMap worldmap = (WorldMap) world.a(WorldMap.class, s);

    if (worldmap == null && !world.isStatic) {
        itemstack.setData(world.b("map"));
        s = "map_" + itemstack.getData();
        worldmap = new WorldMap(s);
        worldmap.scale = 3;
        int i = 128 * (1 << worldmap.scale);

        worldmap.centerX = Math.round((float) world.getWorldData().c() / (float) i) * i;
        worldmap.centerZ = Math.round((float) (world.getWorldData().e() / i)) * i;
        worldmap.map = (byte) ((WorldServer) world).dimension; // CraftBukkit - fixes Bukkit multiworld maps
        worldmap.c();
        world.a(s, (WorldMapBase) worldmap);

        // CraftBukkit start
        MapInitializeEvent event = new MapInitializeEvent(worldmap.mapView);
        Bukkit.getServer().getPluginManager().callEvent(event);
        // CraftBukkit end
    }

    return worldmap;
}
项目:Craft-city    文件:ItemWorldMap.java   
public void d(ItemStack itemstack, World world, EntityHuman entityhuman) {
    if (itemstack.hasTag() && itemstack.getTag().getBoolean("map_is_scaling")) {
        WorldMap worldmap = Item.MAP.getSavedMap(itemstack, world);

        itemstack.setData(world.b("map"));
        WorldMap worldmap1 = new WorldMap("map_" + itemstack.getData());

        worldmap1.scale = (byte) (worldmap.scale + 1);
        if (worldmap1.scale > 4) {
            worldmap1.scale = 4;
        }

        worldmap1.centerX = worldmap.centerX;
        worldmap1.centerZ = worldmap.centerZ;
        worldmap1.map = worldmap.map;
        worldmap1.c();
        world.a("map_" + itemstack.getData(), (WorldMapBase) worldmap1);

        // CraftBukkit start
        MapInitializeEvent event = new MapInitializeEvent(worldmap1.mapView);
        Bukkit.getServer().getPluginManager().callEvent(event);
        // CraftBukkit end
    }
}
项目:SuperiorCraft    文件:CustomMap.java   
@EventHandler
public void onMapInit(MapInitializeEvent e) {
    //e.getMap().setUnlimitedTracking(true);
    for (MapRenderer r : e.getMap().getRenderers()) {
        e.getMap().removeRenderer(r);
    }
    e.getMap().addRenderer(new GameManRenderer());
    //e.getMap().addRenderer(new MapRendererMa);
}
项目:SuperiorCraft    文件:CustomMap.java   
@EventHandler
public void onMapInit(MapInitializeEvent e) {
    //e.getMap().setUnlimitedTracking(true);
    for (MapRenderer r : e.getMap().getRenderers()) {
        e.getMap().removeRenderer(r);
    }
    e.getMap().addRenderer(new GameManRenderer());
    //e.getMap().addRenderer(new MapRendererMa);
}
项目:MapManager    文件:MapListener.java   
@EventHandler
public void onMapInitialize(MapInitializeEvent event) {
    if (MapManager.Options.ALLOW_VANILLA) {
        plugin.getLogger().info("Adding new Map #" + event.getMap().getId() + " to occupied IDs.");
        plugin.getMapManager().registerOccupiedID(event.getMap().getId());
    }
}
项目:Skellett    文件:ExprEventMap.java   
public boolean init(Expression<?>[] args, int arg1, Kleenean arg2, SkriptParser.ParseResult arg3) {
    if (!ScriptLoader.isCurrentEvent(MapInitializeEvent.class)) {
        Skript.error("You can not use event-map expression in any event but map initialize event!");
        return false;
    }
    return true;
}
项目:Skellett    文件:ExprEventMap.java   
@Nullable
protected MapView[] get(Event e) {
    return new MapView[]{((MapInitializeEvent)e).getMap()};
}
项目:Spigot-Plus    文件:mod_Minimap.java   
@EventHandler
public void onMapInitialize(MapInitializeEvent event){
    createNewMap(event.getMap());
}