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


Java Skript.error方法代码示例

本文整理汇总了Java中ch.njol.skript.Skript.error方法的典型用法代码示例。如果您正苦于以下问题:Java Skript.error方法的具体用法?Java Skript.error怎么用?Java Skript.error使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ch.njol.skript.Skript的用法示例。


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

示例1: init

import ch.njol.skript.Skript; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed,
                    SkriptParser.ParseResult parseResult) {
  if (!ScriptLoader.isCurrentEvent(
      CustomEffect.EffectEvent.class,
      CustomExpression.ExpressionGetEvent.class,
      CustomExpression.ExpressionChangeEvent.class,
      CustomCondition.ConditionEvent.class

  )) {
    Skript.error("Only custom syntax may be continued.", ErrorQuality.SEMANTIC_ERROR);
    return false;
  }

  objects = Util.defendExpression(exprs[0]);

  return Util.canInitSafely(objects);
}
 
开发者ID:btk5h,项目名称:skript-mirror,代码行数:20,代码来源:EffContinue.java

示例2: init

import ch.njol.skript.Skript; //导入方法依赖的package包/类
@Override
public boolean init(Expression<?>[] expressions, int i, Kleenean kleenean, SkriptParser.ParseResult parseResult) {
	VariableString s = VariableString.newInstance(parseResult.regexes.get(0).group(), StringMode.VARIABLE_NAME);
	if (s == null) {
		Skript.error("Invalid reference naming. A reference should be named like a variable");
		return false;
	}
	variableName = s;
	Expression<?> v = expressions[0];
	if (v instanceof UnparsedLiteral) {
		Skript.error("Unknown expression : " + ((UnparsedLiteral) v).getData());
		return false;
	}
	value = v;
	return true;
}
 
开发者ID:Syst3ms,项目名称:QuarSK,代码行数:17,代码来源:EffLinkReference.java

示例3: get

import ch.njol.skript.Skript; //导入方法依赖的package包/类
@Override
@Nullable
protected String[] get(Event arg0) {
	String cmd = commandsk.getSingle(arg0);
	String commandStr = cmd.startsWith("/") ? cmd.substring(1) : cmd;
	PluginCommand command = Bukkit.getServer().getPluginCommand(commandStr);
	if (command != null) {
		if (command.getDescription() != null) {
			return new String[] {command.getDescription()};
		} else {
			Skript.error("Command does not have a description!");
			return null;
		}
	}
	Skript.error("Command not found!");
	return null;
}
 
开发者ID:WheezyGold7931,项目名称:skLib,代码行数:18,代码来源:ExprCommandDescription.java

示例4: get

import ch.njol.skript.Skript; //导入方法依赖的package包/类
@Override
@Nullable
protected String[] get(Event arg0) {
	String cmd = commandsk.getSingle(arg0);
	String commandStr = cmd.startsWith("/") ? cmd.substring(1) : cmd;
	PluginCommand command = Bukkit.getServer().getPluginCommand(commandStr);
	if (command != null) {
		if (command.getPermission() != null) {
			return new String[] {command.getPermission()};
		} else {
			Skript.error("Command does not have a permission!");
			return null;
		}
	}
	Skript.error("Command not found!");
	return null;
}
 
开发者ID:WheezyGold7931,项目名称:skLib,代码行数:18,代码来源:ExprCommandPermission.java

示例5: getValue

import ch.njol.skript.Skript; //导入方法依赖的package包/类
@Nullable
protected <T> T getValue(final SectionNode n, final String key, final Class<T> type) {
	final String v = n.getValue(key);
	if (v == null) {
		Skript.error("The config is missing the entry for '" + key + "' in the database '" + databaseName + "'");
		return null;
	}
	final ParseLogHandler log = SkriptLogger.startParseLogHandler();
	try {
		final T r = Classes.parse(v, type, ParseContext.CONFIG);
		if (r == null)
			log.printError("The entry for '" + key + "' in the database '" + databaseName + "' must be " + Classes.getSuperClassInfo(type).getName().withIndefiniteArticle());
		else
			log.printLog();
		return r;
	} finally {
		log.stop();
	}
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:20,代码来源:VariablesStorage.java

示例6: init

import ch.njol.skript.Skript; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public boolean init(final Expression<?>[] vars, final int matchedPattern, final Kleenean isDelayed, final ParseResult parser) {
	if (!ScriptLoader.isCurrentEvent(EntityDamageEvent.class, EntityDeathEvent.class)) {
		Skript.error("The expression 'victim' can only be used in a damage or death event", ErrorQuality.SEMANTIC_ERROR);
		return false;
	}
	final String type = parser.regexes.size() == 0 ? null : parser.regexes.get(0).group();
	if (type == null) {
		this.type = EntityData.fromClass(Entity.class);
	} else {
		final EntityData<?> t = EntityData.parse(type);
		if (t == null) {
			Skript.error("'" + type + "' is not an entity type", ErrorQuality.NOT_AN_EXPRESSION);
			return false;
		}
		this.type = t;
	}
	return true;
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:21,代码来源:ExprAttacked.java

示例7: save

import ch.njol.skript.Skript; //导入方法依赖的package包/类
/**
 * May be called from a different thread than Bukkit's main thread.
 */
final void save(final SerializedVariable var) {
	if (changesQueue.size() > FIRST_WARNING && lastWarning < System.currentTimeMillis() - WARNING_INTERVAL * 1000) {
		Skript.warning("Cannot write variables to the database '" + databaseName + "' at sufficient speed; server performance may suffer and many variables will be lost if the server crashes. (this warning will be repeated at most once every " + WARNING_INTERVAL + " seconds)");
		lastWarning = System.currentTimeMillis();
	}
	if (!changesQueue.offer(var)) {
		if (lastError < System.currentTimeMillis() - ERROR_INTERVAL * 1000) {
			Skript.error("Skript cannot save any variables to the database '" + databaseName + "'. The server will hang and may crash if no more variables can be saved.");
			lastError = System.currentTimeMillis();
		}
		while (true) {
			try {
				// REMIND add repetitive error and/or stop saving variables altogether?
				changesQueue.put(var);
				break;
			} catch (final InterruptedException e) {}
		}
	}
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:23,代码来源:VariablesStorage.java

示例8: execute

import ch.njol.skript.Skript; //导入方法依赖的package包/类
protected void execute(Event event) {
	String name = (String) this.name.getSingle(event);
	World world = (World) this.world.getSingle(event);
	ItemStack block = (ItemStack) this.block.getSingle(event);

	RegionManager regionManager = WGBukkit.getRegionManager((org.bukkit.World) world);
	if (!regionManager.hasRegion(name)) {
		Skript.error("Region \"" + name + "\" in world \"" + world.getName() + "\" does not exists.");
		return;
	}

	Vector v1 = regionManager.getRegion(name).getMaximumPoint();
	Vector v2 = regionManager.getRegion(name).getMinimumPoint();
	Region region = new CuboidRegion(v1, v2);
	BaseBlock b = new BaseBlock(block.getTypeId(), block.getData().getData());

	EditSession es = WorldEdit.getInstance().getEditSessionFactory().getEditSession(world, -1);
	try {
		es.setBlocks(region, b);
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:Sharpjaws,项目名称:SharpSK,代码行数:24,代码来源:EffSetBlocks.java

示例9: init

import ch.njol.skript.Skript; //导入方法依赖的package包/类
@Override
public boolean init(Expression<?>[] expressions, int i, Kleenean kleenean, SkriptParser.ParseResult parseResult) {
	if (!ScriptLoader.isCurrentEvent(PotionSplashEvent.class)) {
		Skript.error(
			"The 'affected entities' expression can only be used in potion splash events",
			ErrorQuality.SEMANTIC_ERROR
		);
		return false;
	}
	return true;
}
 
开发者ID:Syst3ms,项目名称:QuarSK,代码行数:12,代码来源:ExprPotionSplashAffectedEntities.java

示例10: init

import ch.njol.skript.Skript; //导入方法依赖的package包/类
@Override
public boolean init(Expression<?>[] expressions, int i, Kleenean kleenean, SkriptParser.ParseResult parseResult) {
	VariableString v = VariableString.newInstance(parseResult.regexes.get(0).group(), StringMode.VARIABLE_NAME);
	if (v == null) {
		Skript.error("Invalid reference name.");
		return false;
	}
	variableName = v;
	return true;
}
 
开发者ID:Syst3ms,项目名称:QuarSK,代码行数:11,代码来源:EffUnlinkReference.java

示例11: init

import ch.njol.skript.Skript; //导入方法依赖的package包/类
@Override
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed,
                    SkriptParser.ParseResult parseResult) {
  if (!ScriptLoader.isCurrentEvent(CustomEffect.EffectEvent.class)) {
    Skript.error("The effect 'delay effect' may only be used in a custom effect.",
        ErrorQuality.SEMANTIC_ERROR);
    return false;
  }
  return true;
}
 
开发者ID:btk5h,项目名称:skript-mirror,代码行数:11,代码来源:EffDelayEffect.java

示例12: init

import ch.njol.skript.Skript; //导入方法依赖的package包/类
@Override
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult) {
    if (!ScriptLoader.isCurrentEvent(PlaceholderAPIEvent.class)) {
        Skript.error("The PlaceholderAPI prefix can only be used in a placeholder request event", ErrorQuality.SEMANTIC_ERROR);
        return false;
    }
    return true;
}
 
开发者ID:Pikachu920,项目名称:Ersatz,代码行数:9,代码来源:ExprPrefix.java

示例13: init

import ch.njol.skript.Skript; //导入方法依赖的package包/类
@Override
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult) {
    if (!ScriptLoader.isCurrentEvent(PlaceholderAPIEvent.class)) {
        Skript.error("The PlaceholderAPI result can only be used in a placeholder request event", ErrorQuality.SEMANTIC_ERROR);
        return false;
    }
    return true;
}
 
开发者ID:Pikachu920,项目名称:Ersatz,代码行数:9,代码来源:ExprResult.java

示例14: init

import ch.njol.skript.Skript; //导入方法依赖的package包/类
@Override
public boolean init(final Literal<?>[] args, final int matchedPattern, final SkriptParser.ParseResult parser) {
    prefix = ((Literal<String>) args[0]).getSingle();
    if ("".equals(prefix)) {
        Skript.error(prefix + " is not a valid placeholder", ErrorQuality.SEMANTIC_ERROR);
        return false;
    }
    new PlaceholderAPIListener(Main.getInstance(), prefix).hook();
    return true;
}
 
开发者ID:Pikachu920,项目名称:Ersatz,代码行数:11,代码来源:EvtPlaceholderRequest.java

示例15: init

import ch.njol.skript.Skript; //导入方法依赖的package包/类
@Override
public boolean init(Expression<?>[] arg0, int arg1, Kleenean arg2, ParseResult arg3) {
	if (!ScriptLoader.isCurrentEvent(InventoryClickEvent.class)) {
		Skript.error("[SkLib] Hey idiot! You cannot use the clicked row expression in this event.");
		return false;
	}
	return true;
}
 
开发者ID:WheezyGold7931,项目名称:skLib,代码行数:9,代码来源:ExprClickedRow.java


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