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


Java WorldEditPlugin类代码示例

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


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

示例1: AsyncWorld

import com.sk89q.worldedit.bukkit.WorldEditPlugin; //导入依赖的package包/类
/**
 * @deprecated use {@link #wrap(org.bukkit.World)} instead
 * @param parent
 * @param queue
 */
@Deprecated
public AsyncWorld(World parent, FaweQueue queue) {
    super(queue);
    this.parent = parent;
    this.queue = queue;
    if (queue instanceof BukkitQueue_0) {
        this.adapter = (BukkitImplAdapter) ((BukkitQueue_0) queue).getAdapter();
    } else {
        try {
            WorldEditPlugin instance = (WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit");
            Field fieldAdapter = WorldEditPlugin.class.getDeclaredField("bukkitAdapter");
            fieldAdapter.setAccessible(true);
            this.adapter = (BukkitImplAdapter) fieldAdapter.get(instance);
        } catch (Throwable e) {
            e.printStackTrace();
        }
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:24,代码来源:AsyncWorld.java

示例2: registerWorldEditEvents

import com.sk89q.worldedit.bukkit.WorldEditPlugin; //导入依赖的package包/类
@Override
public void registerWorldEditEvents() {
    if (getServer().getPluginManager().getPlugin("WorldEdit") != null) {
        PlotSquared.worldEdit = (WorldEditPlugin) getServer().getPluginManager().getPlugin("WorldEdit");
        final String version = PlotSquared.worldEdit.getDescription().getVersion();
        if ((version != null) && version.startsWith("5.")) {
            log("&cPlotSquared地皮插件需要更高版本的WorldEdit.");
            log("&c请下载WorldEdit 6+ 版本的插件");
            log("&c下载地址 - http://builds.enginehub.org/job/worldedit");
        } else {
            getServer().getPluginManager().registerEvents(new WEListener(), this);
            WorldEdit.getInstance().getEventBus().register(new WESubscriber());
            MainCommand.subCommands.add(new WE_Anywhere());
        }
    }
}
 
开发者ID:Mayomi,项目名称:PlotSquared-Chinese,代码行数:17,代码来源:BukkitMain.java

示例3: onEnable

import com.sk89q.worldedit.bukkit.WorldEditPlugin; //导入依赖的package包/类
@Override
public void onEnable() {
    we = (WorldEditPlugin) getServer().getPluginManager().getPlugin("WorldEdit");
    try {
        am.load();
    } catch (IOException | InvalidConfigurationException ex) {
        Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
    }
    gm.load();
    cm.register();
    em.register();
    sm.load();
    prefix = ChatColor.translateAlternateColorCodes('&',
            getConfig().getString("prefix"));

    String spawnWorldName = getConfig().getString("spawn.world");
    if (spawnWorldName != null) {
        World spawnWorld = getServer().getWorld(spawnWorldName);
        if (spawnWorld != null) {
            spawn = spawnWorld.getSpawnLocation();
        }
    }
}
 
开发者ID:ddonofrio,项目名称:libelula,代码行数:24,代码来源:Main.java

示例4: spawnTree

import com.sk89q.worldedit.bukkit.WorldEditPlugin; //导入依赖的package包/类
private void spawnTree(Location startBlock, String fileName, Vector offset){
	BukkitWorld world = new BukkitWorld(startBlock.getWorld());
	EditSession session = new EditSession(world, 1000);
	WorldEditPlugin wep = ((WorldEditPlugin) Bukkit.getServer().getPluginManager().getPlugin("WorldEdit"));
	WorldEdit we = wep.getWorldEdit();
	LocalConfiguration config = we.getConfiguration();
	BukkitPlayer p = wep.wrapPlayer(startBlock.getWorld().getPlayers().get(0));
	File dir = we.getWorkingDirectoryFile(config.saveDir);
       File f;
       Vector v = new Vector(startBlock.getX(), startBlock.getY(), startBlock.getZ());
       
	try {
		f = we.getSafeOpenFile(p, dir, fileName, "schematic", "schematic");
		CuboidClipboard cc = SchematicFormat.MCEDIT.load(f);
		cc.setOffset(offset);
		
		cc.paste(session, v, true);
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:StarQuestMinecraft,项目名称:StarQuestCode,代码行数:22,代码来源:TreeListener.java

示例5: createLobbyFromSelection

import com.sk89q.worldedit.bukkit.WorldEditPlugin; //导入依赖的package包/类
public void createLobbyFromSelection(Player p, Game game){
    WorldEditPlugin worldEdit = plugin.getWorldEdit();
    Selection selection = worldEdit.getSelection(p);

    if(selection == null){
        MessageManager.getInstance().sendFMessage("error.noselection", p);
        return;
    }
    Location pos1 = selection.getMaximumPoint();//Max
    Location pos2 = selection.getMinimumPoint();//Min

    game.setLobby(new Lobby(pos1, pos2));

    YamlConfiguration config = SettingsManager.getInstance().getArenaConfig(game.getId());

    config.set("lobby.world", pos1.getWorld().getName());
    config.set("lobby.pos1.x", pos1.getBlockX());
    config.set("lobby.pos1.y", pos1.getBlockY());
    config.set("lobby.pos1.z", pos1.getBlockZ());
    config.set("lobby.pos2.x", pos2.getBlockX());
    config.set("lobby.pos2.y", pos2.getBlockY());
    config.set("lobby.pos2.z", pos2.getBlockZ());
    SettingsManager.getInstance().saveArenaConfig(game.getId());
    MessageManager.getInstance().sendFMessage("info.createlobby", p, "arena-" + game.getId());
}
 
开发者ID:endercrest,项目名称:ColorCube,代码行数:26,代码来源:LobbyManager.java

示例6: createArenaFromSelection

import com.sk89q.worldedit.bukkit.WorldEditPlugin; //导入依赖的package包/类
public void createArenaFromSelection(Player p){
    WorldEditPlugin we = plugin.getWorldEdit();
    Selection selection = we.getSelection(p);

    if(selection == null){
        msg.sendFMessage("error.noselection", p);
        return;
    }
    Location pos1 = selection.getMaximumPoint();
    Location pos2 = selection.getMinimumPoint();

    int id = settingsManager.getNextArenaID();
    YamlConfiguration config = SettingsManager.getInstance().createArenaConfig(id, pos1, pos2);
    if(config == null){
        MessageManager.getInstance().sendFMessage("error.nextid", p,
                "type-"+MessageManager.getInstance().getFValue("words.arena"));
        return;
    }
    SettingsManager.getInstance().incrementNextArenaId();
    addArena(id);
    msg.sendFMessage("info.create", p, "arena-" + id);
}
 
开发者ID:endercrest,项目名称:ColorCube,代码行数:23,代码来源:GameManager.java

示例7: WorldEditHistoryTracker

import com.sk89q.worldedit.bukkit.WorldEditPlugin; //导入依赖的package包/类
public WorldEditHistoryTracker(final Location refPoint, final Player forPlayer) {
  final Plugin plugin = Bukkit.getServer().getPluginManager()
                              .getPlugin("WorldEdit");
  if (plugin == null) { throw new IllegalStateException(
                                                        "WorldEdit not loaded. Cannot create WorldEditHistoryTracker"); }
  this.wePlugin = (WorldEditPlugin) plugin;

  this.localWorld = new NoChangeBukkitWorld(refPoint.getWorld());
  // No public alternative
  @SuppressWarnings("deprecation")
  final EditSession es = new EditSession(this.localWorld, Integer.MAX_VALUE);
  this.activeEditSession = es;
  this.activeEditSession.enableQueue();
  this.activeEditSession.setMask((com.sk89q.worldedit.function.mask.Mask) null);
  this.activeEditSession.setFastMode(true);
  this.forPlayer = forPlayer;
}
 
开发者ID:rmichela,项目名称:GiantTrees,代码行数:18,代码来源:WorldEditHistoryTracker.java

示例8: getWorldEditPlugin

import com.sk89q.worldedit.bukkit.WorldEditPlugin; //导入依赖的package包/类
public WorldEditPlugin getWorldEditPlugin()
{
    if (this.worldEditPlugin == null)
    {
        try
        {
            Plugin we = Bukkit.getServer().getPluginManager().getPlugin("WorldEdit");
            if (we != null)
            {
                if (we instanceof WorldEditPlugin)
                {
                    this.worldEditPlugin = (WorldEditPlugin) we;
                }
            }
        }
        catch (Exception ex)
        {
            TFM_Log.severe(ex);
        }
    }
    return this.worldEditPlugin;
}
 
开发者ID:Yoshi41023,项目名称:TatsuCraftMod,代码行数:23,代码来源:TFM_WorldEditBridge.java

示例9: getBukkitPlayer

import com.sk89q.worldedit.bukkit.WorldEditPlugin; //导入依赖的package包/类
public BukkitPlayer getBukkitPlayer(Player player)
{
    try
    {
        WorldEditPlugin wep = this.getWorldEditPlugin();
        if (wep != null)
        {
            return wep.wrapPlayer(player);
        }
    }
    catch (Exception ex)
    {
        TFM_Log.severe(ex);
    }
    return null;
}
 
开发者ID:Yoshi41023,项目名称:TatsuCraftMod,代码行数:17,代码来源:TFM_WorldEditBridge.java

示例10: getPlayerSession

import com.sk89q.worldedit.bukkit.WorldEditPlugin; //导入依赖的package包/类
public LocalSession getPlayerSession(Player player)
{
    try
    {
        WorldEditPlugin wep = this.getWorldEditPlugin();
        if (wep != null)
        {
            return wep.getSession(player);
        }
    }
    catch (Exception ex)
    {
        TFM_Log.severe(ex);
    }
    return null;
}
 
开发者ID:Yoshi41023,项目名称:TatsuCraftMod,代码行数:17,代码来源:TFM_WorldEditBridge.java

示例11: saveWEChunk

import com.sk89q.worldedit.bukkit.WorldEditPlugin; //导入依赖的package包/类
private void saveWEChunk(Chunk chunk, File saveFile)
{
	WorldEditPlugin wep = (WorldEditPlugin)Bukkit.getPluginManager().getPlugin("WorldEdit");
	if (wep == null) 
	{
		Bukkit.broadcastMessage(ChatColor.RED+"Unable to find WorldEdit plugin - Unable to restore.");
		return;
	}		
	EditSession editSession = new EditSession(new BukkitWorld(chunk.getWorld()), 1000);		
	Vector startPos =  locationToVector(chunk.getBlock(0, 0, 0).getLocation());
	Vector size = new Vector(16,256,16);
	
	CuboidClipboard clipboard = new CuboidClipboard(size, startPos);
	clipboard.copy(editSession);
	try 
	{
		SchematicFormat.MCEDIT.save(clipboard, saveFile);
	} 
	catch (Exception e) 
	{
		e.printStackTrace();
	}		
}
 
开发者ID:marsglorious,项目名称:NewNations,代码行数:24,代码来源:PlotRestoreManager.java

示例12: turnOffWand

import com.sk89q.worldedit.bukkit.WorldEditPlugin; //导入依赖的package包/类
/**
 * @author xize
 * @param disables the worldedit //wand
 * @return void
 */
public static void turnOffWand(Player player) {
	if(Bukkit.getPluginManager().isPluginEnabled("WorldEdit")) {

		WorldEditPlugin we = (WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit");

		if(player.hasPermission("worldedit.wand")) {	
			if(player.getGameMode() == GameMode.SURVIVAL) {
				if(we.getSession(player).isToolControlEnabled()) {
					we.getSession(player).setToolControl(false);
					player.sendMessage(ChatColor.GOLD + ".oO___[Gamemode alert]___Oo.");
					player.sendMessage(ChatColor.GRAY + "your worldedit wand has been " + ChatColor.GREEN + "disabled!");
					player.sendMessage(ChatColor.GRAY + "if you want to renable it switch to creative or use /toggleeditwand");
				}
			} else if(player.getGameMode() == GameMode.CREATIVE) {
				if(!we.getSession(player).isToolControlEnabled()) {
					we.getSession(player).setToolControl(true);
					player.sendMessage(ChatColor.GOLD + ".oO___[Gamemode alert]___Oo.");
					player.sendMessage(ChatColor.GRAY + "your worldedit wand has been " + ChatColor.GREEN + "Enabled!");
					player.sendMessage(ChatColor.GRAY + "if you want to redisable it switch to survival or use /toggleeditwand");
				}
			}
		}
	}
}
 
开发者ID:xEssentials,项目名称:xEssentials-deprecated-bukkit,代码行数:30,代码来源:WorldEditHook.java

示例13: turnOffWand

import com.sk89q.worldedit.bukkit.WorldEditPlugin; //导入依赖的package包/类
public static void turnOffWand(Player player) {
	if(Bukkit.getPluginManager().isPluginEnabled("WorldEdit")) {
		WorldEditPlugin we = (WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit");
		if(player.hasPermission("worldedit.wand")) {	
			if(player.getGameMode() == GameMode.SURVIVAL) {
				if(we.getSession(player).isToolControlEnabled()) {
					we.getSession(player).setToolControl(false);
					player.sendMessage(ChatColor.GOLD + ".oO___[Gamemode alert]___Oo.");
					player.sendMessage(ChatColor.GRAY + "your worldedit wand has been " + ChatColor.GREEN + "disabled!");
					player.sendMessage(ChatColor.GRAY + "if you want to renable it switch to creative or use /toggleeditwand");
				}
			} else if(player.getGameMode() == GameMode.CREATIVE) {
				if(!we.getSession(player).isToolControlEnabled()) {
					we.getSession(player).setToolControl(true);
					player.sendMessage(ChatColor.GOLD + ".oO___[Gamemode alert]___Oo.");
					player.sendMessage(ChatColor.GRAY + "your worldedit wand has been " + ChatColor.GREEN + "Enabled!");
					player.sendMessage(ChatColor.GRAY + "if you want to redisable it switch to survival or use /toggleeditwand");
				}
			}
		}
	}
}
 
开发者ID:xize,项目名称:xEssentials_old_Source,代码行数:23,代码来源:worldguard.java

示例14: inject

import com.sk89q.worldedit.bukkit.WorldEditPlugin; //导入依赖的package包/类
public void inject(Plugin plugin)
{
    BungeePerms.getLogger().info("Injection of Bungeeperms into WorldEdit"); //todo even more lang support
    try
    {
        WorldEditPlugin we = (WorldEditPlugin) plugin;
        
        if(!we.isEnabled())
        {
            return;
        }

        //inject BungeePerms
        Field f = we.getPermissionsResolver().getClass().getDeclaredField("enabledResolvers");
        f.setAccessible(true);
        ((List) f.get(we.getPermissionsResolver())).add(BungeePermsResolver.class);

        we.getPermissionsResolver().findResolver();
    }
    catch (Exception ex)
    {
    }
}
 
开发者ID:weaondara,项目名称:BungeePerms,代码行数:24,代码来源:WorldEditBridge.java

示例15: uninject

import com.sk89q.worldedit.bukkit.WorldEditPlugin; //导入依赖的package包/类
public void uninject(Plugin plugin)
{
    BungeePerms.getLogger().info("Uninjection of Bungeeperms into WorldEdit");
    try
    {
        WorldEditPlugin we = (WorldEditPlugin) plugin;

        //inject BungeePerms
        Field f = we.getPermissionsResolver().getClass().getDeclaredField("enabledResolvers");
        f.setAccessible(true);
        ((List) f.get(we.getPermissionsResolver())).remove(BungeePermsResolver.class);

        we.getPermissionsResolver().findResolver();
    }
    catch (Exception ex)//todo report error
    {
    }
}
 
开发者ID:weaondara,项目名称:BungeePerms,代码行数:19,代码来源:WorldEditBridge.java


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