本文整理汇总了Java中com.sk89q.worldedit.LocalSession.tellVersion方法的典型用法代码示例。如果您正苦于以下问题:Java LocalSession.tellVersion方法的具体用法?Java LocalSession.tellVersion怎么用?Java LocalSession.tellVersion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sk89q.worldedit.LocalSession
的用法示例。
在下文中一共展示了LocalSession.tellVersion方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getExtent
import com.sk89q.worldedit.LocalSession; //导入方法依赖的package包/类
@BindingMatch(
type = {Extent.class},
behavior = BindingBehavior.PROVIDES
)
public Extent getExtent(ArgumentStack context) throws ParameterException {
Extent extent = context.getContext().getLocals().get(EditSession.class);
if (extent != null) return extent;
extent = Request.request().getExtent();
if (extent != null) return extent;
Actor actor = context.getContext().getLocals().get(Actor.class);
if (actor == null) throw new ParameterException("No player to get a session for");
if (!(actor instanceof Player)) throw new ParameterException("Caller is not a player");
LocalSession session = WorldEdit.getInstance().getSessionManager().get(actor);
EditSession editSession = session.createEditSession((Player) actor);
editSession.enableQueue();
context.getContext().getLocals().put(EditSession.class, editSession);
session.tellVersion(actor);
return editSession;
}
示例2: getEditSession
import com.sk89q.worldedit.LocalSession; //导入方法依赖的package包/类
/**
* Gets an {@link EditSession} from a {@link ArgumentStack}.
*
* @param context the context
* @return an edit session
* @throws ParameterException on other error
*/
@BindingMatch(type = EditSession.class,
behavior = BindingBehavior.PROVIDES)
public EditSession getEditSession(ArgumentStack context) throws ParameterException {
Player sender = getPlayer(context);
LocalSession session = worldEdit.getSessionManager().get(sender);
EditSession editSession = session.createEditSession(sender);
editSession.enableQueue();
context.getContext().getLocals().put(EditSession.class, editSession);
session.tellVersion(sender);
return editSession;
}