本文整理汇总了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;
}
示例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
}
}
示例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;
}
示例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
}
}
示例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
}
}
示例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;
}
示例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
}
示例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
}
示例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;
}
示例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
}
}
示例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);
}
示例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());
}
}
示例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;
}
示例14: get
import org.bukkit.event.server.MapInitializeEvent; //导入依赖的package包/类
@Nullable
protected MapView[] get(Event e) {
return new MapView[]{((MapInitializeEvent)e).getMap()};
}
示例15: onMapInitialize
import org.bukkit.event.server.MapInitializeEvent; //导入依赖的package包/类
@EventHandler
public void onMapInitialize(MapInitializeEvent event){
createNewMap(event.getMap());
}