本文整理汇总了Java中com.elmakers.mine.bukkit.api.spell.SpellResult.NO_ACTION属性的典型用法代码示例。如果您正苦于以下问题:Java SpellResult.NO_ACTION属性的具体用法?Java SpellResult.NO_ACTION怎么用?Java SpellResult.NO_ACTION使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.elmakers.mine.bukkit.api.spell.SpellResult
的用法示例。
在下文中一共展示了SpellResult.NO_ACTION属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: step
@Override
public SpellResult step(CastContext context)
{
while (currentEntity < entities.size())
{
Entity entity = entities.get(currentEntity).get();
if (entity == null)
{
currentEntity++;
skippedActions(context);
continue;
}
actionContext.setTargetEntity(entity);
if (entity instanceof LivingEntity) {
actionContext.setTargetLocation(((LivingEntity)entity).getEyeLocation());
} else {
actionContext.setTargetLocation(entity.getLocation());
}
return startActions();
}
return SpellResult.NO_ACTION;
}
示例2: startActions
protected SpellResult startActions(String handlerKey) {
currentHandler = handlerKey;
ActionHandler handler = handlers.get(currentHandler);
if (handler != null) {
handler.reset(actionContext);
} else {
currentHandler = null;
}
return SpellResult.NO_ACTION;
}
示例3: perform
@Override
public SpellResult perform(CastContext context) {
SpellResult result = SpellResult.NO_ACTION;
while (!result.isStop()) {
if (state == State.NOT_STARTED) {
result = result.min(start(context));
// Don't continue if the action failed to start
if (result.isStop() || result.isFailure()) break;
state = State.STARTED;
}
if (state == State.STARTED) {
result = result.min(step(context));
if (result.isStop()) break;
state = State.STEPPING;
}
ActionHandler handler = currentHandler == null ? null : handlers.get(currentHandler);
if (handler != null) {
result = result.min(handler.perform(actionContext));
if (result.isStop()) break;
if (stopOnSuccess && result.isSuccess()) {
result = SpellResult.STOP;
break;
}
}
if (!next(context)) {
if (handler != null) {
handler.finish(actionContext);
}
break;
}
result = result.min(step(context));
}
return result;
}
示例4: CastContext
public CastContext() {
this.location = null;
this.entity = null;
this.base = this;
this.result = SpellResult.NO_ACTION;
targetMessagesSent = new HashSet<UUID>();
currentEffects = new ArrayList<EffectPlay>();
}
示例5: processHandlers
@Override
public SpellResult processHandlers() {
SpellResult result = SpellResult.NO_ACTION;
if (handlers == null) return result;
if (finishedHandlers == null) {
finishedHandlers = new ArrayList<ActionHandlerContext>();
}
int startingWork = getWorkAllowed();
int splitWork = Math.max(1, startingWork / handlers.size());
for (Iterator<ActionHandlerContext> iterator = handlers.iterator(); iterator.hasNext();) {
ActionHandlerContext handler = iterator.next();
handler.setWorkAllowed(splitWork);
SpellResult actionResult = handler.perform();
if (actionResult != SpellResult.PENDING) {
result = result.min(actionResult);
finishedHandlers.add(handler);
iterator.remove();
}
}
if (handlers.isEmpty()) {
handlers = null;
return result;
}
return SpellResult.PENDING;
}
示例6: perform
public SpellResult perform(CastContext context)
{
boolean hasTarget = context.getTargetLocation() != null;
boolean hasEntityTarget = context.getTargetEntity() != null;
if (action.requiresTarget() && !hasTarget) return SpellResult.NO_TARGET;
if (action.requiresTargetEntity() && !hasEntityTarget) return SpellResult.NO_TARGET;
SpellResult result = action.perform(context);
return action.ignoreResult() && !result.isStop() ? SpellResult.NO_ACTION : result;
}
示例7: finalizeCast
protected boolean finalizeCast(ConfigurationSection parameters) {
SpellResult result = null;
// Global parameters
controller.disablePhysics(parameters.getInt("disable_physics", 0));
if (!mage.isSuperPowered()) {
if (backfireChance > 0 && random.nextDouble() < backfireChance) {
backfire();
} else if (fizzleChance > 0 && random.nextDouble() < fizzleChance) {
result = SpellResult.FIZZLE;
}
}
if (result == null) {
result = onCast(parameters);
}
if (backfired) {
result = SpellResult.BACKFIRE;
}
if (result == SpellResult.CAST) {
LivingEntity sourceEntity = mage.getLivingEntity();
Entity targetEntity = getTargetEntity();
if (sourceEntity == targetEntity) {
result = SpellResult.CAST_SELF;
}
}
processResult(result, parameters);
boolean success = result.isSuccess();
boolean requiresCost = success || (castOnNoTarget && (result == SpellResult.NO_TARGET || result == SpellResult.NO_ACTION));
boolean free = !requiresCost && result.isFree();
if (!free) {
if (costs != null && !mage.isCostFree()) {
for (CastingCost cost : costs)
{
if (cost.isItem() && currentCast != null) {
currentCast.getUndoList().setConsumed(true);
}
cost.use(this);
}
}
updateCooldown();
}
sendCastMessage(result, " (" + success + ")");
return success;
}
示例8: step
public SpellResult step(CastContext context) {
return SpellResult.NO_ACTION;
}
示例9: start
public SpellResult start(CastContext context) {
return SpellResult.NO_ACTION;
}