本文整理汇总了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();
}
}
}
示例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());
}
}
}
示例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();
}
}
}
示例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();
}
}
示例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());
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
}
示例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");
}
}
}
}
}
示例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");
}
}
}
}
}
示例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)
{
}
}
示例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
{
}
}