当前位置: 首页>>代码示例>>Java>>正文


Java MapInitializeEvent类代码示例

本文整理汇总了Java中org.bukkit.event.server.MapInitializeEvent的典型用法代码示例。如果您正苦于以下问题:Java MapInitializeEvent类的具体用法?Java MapInitializeEvent怎么用?Java MapInitializeEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MapInitializeEvent类属于org.bukkit.event.server包,在下文中一共展示了MapInitializeEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSavedMap

import org.bukkit.event.server.MapInitializeEvent; //导入依赖的package包/类
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;
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:27,代码来源:ItemWorldMap.java

示例2: d

import org.bukkit.event.server.MapInitializeEvent; //导入依赖的package包/类
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
    }
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:27,代码来源:ItemWorldMap.java

示例3: getSavedMap

import org.bukkit.event.server.MapInitializeEvent; //导入依赖的package包/类
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;
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:27,代码来源:ItemWorldMap.java

示例4: d

import org.bukkit.event.server.MapInitializeEvent; //导入依赖的package包/类
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
    }
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:27,代码来源:ItemWorldMap.java

示例5: onCreated

import org.bukkit.event.server.MapInitializeEvent; //导入依赖的package包/类
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
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:26,代码来源:ItemMap.java

示例6: getSavedMap

import org.bukkit.event.server.MapInitializeEvent; //导入依赖的package包/类
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;
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:24,代码来源:ItemWorldMap.java

示例7: a

import org.bukkit.event.server.MapInitializeEvent; //导入依赖的package包/类
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
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:19,代码来源:ItemWorldMap.java

示例8: b

import org.bukkit.event.server.MapInitializeEvent; //导入依赖的package包/类
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
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:20,代码来源:ItemWorldMap.java

示例9: getSavedMap

import org.bukkit.event.server.MapInitializeEvent; //导入依赖的package包/类
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;
}
 
开发者ID:didoupimpon,项目名称:Craft-city,代码行数:26,代码来源:ItemWorldMap.java

示例10: d

import org.bukkit.event.server.MapInitializeEvent; //导入依赖的package包/类
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
    }
}
 
开发者ID:didoupimpon,项目名称:Craft-city,代码行数:25,代码来源:ItemWorldMap.java

示例11: onMapInit

import org.bukkit.event.server.MapInitializeEvent; //导入依赖的package包/类
@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);
}
 
开发者ID:GigaGamma,项目名称:SuperiorCraft,代码行数:10,代码来源:CustomMap.java

示例12: onMapInitialize

import org.bukkit.event.server.MapInitializeEvent; //导入依赖的package包/类
@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());
	}
}
 
开发者ID:InventivetalentDev,项目名称:MapManager,代码行数:8,代码来源:MapListener.java

示例13: init

import org.bukkit.event.server.MapInitializeEvent; //导入依赖的package包/类
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;
}
 
开发者ID:TheLimeGlass,项目名称:Skellett,代码行数:8,代码来源:ExprEventMap.java

示例14: get

import org.bukkit.event.server.MapInitializeEvent; //导入依赖的package包/类
@Nullable
protected MapView[] get(Event e) {
	return new MapView[]{((MapInitializeEvent)e).getMap()};
}
 
开发者ID:TheLimeGlass,项目名称:Skellett,代码行数:5,代码来源:ExprEventMap.java

示例15: onMapInitialize

import org.bukkit.event.server.MapInitializeEvent; //导入依赖的package包/类
@EventHandler
public void onMapInitialize(MapInitializeEvent event){
	createNewMap(event.getMap());
}
 
开发者ID:robotman3000,项目名称:Spigot-Plus,代码行数:5,代码来源:mod_Minimap.java


注:本文中的org.bukkit.event.server.MapInitializeEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。