Java Code Examples for ch.njol.skript.Skript#error()

The following examples show how to use ch.njol.skript.Skript#error() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EffHealth.java    From Skript with GNU General Public License v3.0 6 votes vote down vote up
@SuppressWarnings({"unchecked", "null"})
@Override
public boolean init(final Expression<?>[] vars, final int matchedPattern, final Kleenean isDelayed, final ParseResult parser) {
	damageables = vars[0];
	if (ItemStack.class.isAssignableFrom(damageables.getReturnType())) {
		if (!ChangerUtils.acceptsChange(damageables, ChangeMode.SET, ItemType.class)) {
			Skript.error(damageables + " cannot be changed, thus it cannot be damaged or repaired.");
			return false;
		}
	}
	damage = (Expression<Number>) vars[1];
	heal = (matchedPattern >= 1);
	
	if (vars.length >= 3) dmgCause = (Expression<DamageCause>) vars[2];
	return true;
}
 
Example 2
Source File: SkriptParser.java    From Skript with GNU General Public License v3.0 6 votes vote down vote up
@Nullable
public static <T extends SyntaxElement> T parseStatic(String expr, final Iterator<? extends SyntaxElementInfo<? extends T>> source, final @Nullable String defaultError) {
	expr = "" + expr.trim();
	if (expr.isEmpty()) {
		Skript.error(defaultError);
		return null;
	}
	final ParseLogHandler log = SkriptLogger.startParseLogHandler();
	final T e;
	try {
		e = new SkriptParser(expr, PARSE_LITERALS).parse(source);
		if (e != null) {
			log.printLog();
			return e;
		}
		log.printError(defaultError);
		return null;
	} finally {
		log.stop();
	}
}
 
Example 3
Source File: ExprAmount.java    From Skript with GNU General Public License v3.0 6 votes vote down vote up
@SuppressWarnings("null")
@Override
public boolean init(final Expression<?>[] exprs, final int matchedPattern, final Kleenean isDelayed, final ParseResult parseResult) {
	expr = exprs[0];
	if (expr instanceof Literal)
		return false;
	if (expr.isSingle()) {
		Skript.error("'" + expr.toString(null, false) + "' can only ever have one value at most, thus the 'amount of ...' expression is useless. Use '... exists' instead to find out whether the expression has a value.");
		return false;
	}
	this.recursive = matchedPattern == 1;
	if (recursive && !(expr instanceof Variable<?>)) {
		Skript.error("Getting the recursive size of a list only applies to variables, thus the '" + expr.toString(null, false) + "' expression is useless.");
		return false;
	}
	return true;
}
 
Example 4
Source File: SimpleExpressionFork.java    From skript-yaml with MIT License 5 votes vote down vote up
protected final boolean setTime(final int time, final Class<? extends Event> applicableEvent, final Expression<?>... mustbeDefaultVars) {
	if (ScriptLoader.hasDelayBefore == Kleenean.TRUE && time != 0) {
		Skript.error("Can't use time states after the event has already passed");
		return false;
	}
	if (!ScriptLoader.isCurrentEvent(applicableEvent))
		return false;
	for (final Expression<?> var : mustbeDefaultVars) {
		if (!var.isDefault()) {
			return false;
		}
	}
	this.time = time;
	return true;
}
 
Example 5
Source File: EnumParser.java    From Skript with GNU General Public License v3.0 5 votes vote down vote up
@Override
@Nullable
public E convert(final String s) {
	try {
		return Enum.valueOf(enumType, s.toUpperCase(Locale.ENGLISH).replace(' ', '_'));
	} catch (final IllegalArgumentException e) {
		Skript.error("'" + s + "' is not a valid value for " + type + (allowedValues == null ? "" : ". Allowed values are: " + allowedValues));
		return null;
	}
}
 
Example 6
Source File: EvtExperienceSpawn.java    From Skript with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean init(final Literal<?>[] args, final int matchedPattern, final ParseResult parseResult) {
	if (!Skript.isRunningMinecraft(1, 4, 5)) {
		Skript.error("The experience spawn event can only be used in Minecraft 1.4.5 and later");
		return false;
	}
	return true;
}
 
Example 7
Source File: Aliases.java    From Skript with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Gets an item type that matches the given name.
 * If it doesn't exist, an exception is thrown instead.
 * 
 * <p>Item types provided by this method are updated when aliases are
 * reloaded. However, this also means they are tracked by aliases system
 * and NOT necessarily garbage-collected.
 * @param name Name of item to search from aliases.
 * @return An item.
 * @throws IllegalArgumentException When item is not found.
 */
public static ItemType javaItemType(String name) {
	ItemType type = parseItemType(name);
	if (type == null) {
		if (noHardExceptions) {
			Skript.error("type " + name + " not found");
			type = new ItemType(); // Return garbage
		} else {
			throw new IllegalArgumentException("type " + name + " not found");
		}
	}
	trackedTypes.put(name, type);
	return type;
}
 
Example 8
Source File: EffSetTeamPrefix.java    From skRayFall with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void execute(Event evt) {
    if (team != null && pre != null) {
        String prefix = pre.getSingle(evt).replace("\"", "");
        if (prefix.length() < 16) {
            Core.teamManager.setPrefix(team.getSingle(evt).replace("\"", ""), prefix);
        } else {
            Skript.error(
                    "Prefix can not be greater than 16 characters. It's currently " + prefix.length());
        }
    }

}
 
Example 9
Source File: Option.java    From Skript with GNU General Public License v3.0 5 votes vote down vote up
public final void set(final Config config, final String path) {
	final String oldValue = value;
	value = config.getByPath(path + key);
	if (value == null && !optional)
		Skript.error("Required entry '" + path + key + "' is missing in " + config.getFileName() + ". Please make sure that you have the latest version of the config.");
	if ((value == null ^ oldValue == null) || value != null && !value.equals(oldValue)) {
		T parsedValue = value != null ? parser.convert(value) : defaultValue;
		if (parsedValue == null)
			parsedValue = defaultValue;
		this.parsedValue = parsedValue;
		onValueChange();
	}
}
 
Example 10
Source File: EvtClick.java    From Skript with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean init(final Literal<?>[] args, final int matchedPattern, final ParseResult parser) {
	click = parser.mark == 0 ? ANY : parser.mark;
	types = args[matchedPattern];
	if (types != null && !ItemType.class.isAssignableFrom(types.getReturnType())) {
		if (click == LEFT) {
			Skript.error("A leftclick on an entity is an attack and thus not covered by the 'click' event, but the 'damage' event.", ErrorQuality.SEMANTIC_ERROR);
			return false;
		} else if (click == ANY) {
			Skript.warning("A leftclick on an entity is an attack and thus not covered by the 'click' event, but the 'damage' event. Change this event to a rightclick to disable this warning message.");
		}
	}
	tools = (Literal<ItemType>) args[1 - matchedPattern];
	return true;
}
 
Example 11
Source File: ExprGroup.java    From Skript with GNU General Public License v3.0 5 votes vote down vote up
@SuppressWarnings({"unchecked"})
@Override
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult) {
	if (!VaultHook.permission.hasGroupSupport()) {
		Skript.error(VaultHook.NO_GROUP_SUPPORT);
		return false;
	}
	players = (Expression<OfflinePlayer>) exprs[0];
	primary = parseResult.mark == 0;
	return true;
}
 
Example 12
Source File: Noun.java    From Skript with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onLanguageChange() {
	Map<String, String> lang = Language.useLocal ? Language.localized : Language.english;
	if (lang == null)
		lang = Language.english;
	genders.clear();
	indefiniteArticles.clear();
	definiteArticles.clear();
	for (int i = 0; i < 100; i++) {
		final String g = lang.get(GENDERS_SECTION + i + ".id");
		if (g == null)
			break;
		if (g.equalsIgnoreCase(PLURAL_TOKEN) || g.equalsIgnoreCase(NO_GENDER_TOKEN)) {
			Skript.error("gender #" + i + " uses a reserved character as ID, please use something different!");
			continue;
		}
		genders.put(g, i);
		final String ia = lang.get(GENDERS_SECTION + i + ".indefinite article");
		indefiniteArticles.add(ia == null ? "" : ia);
		final String da = lang.get(GENDERS_SECTION + i + ".definite article");
		definiteArticles.add(da == null ? "" : da);
	}
	if (genders.isEmpty()) {
		Skript.error("No genders defined in language file " + Language.getName() + ".lang!");
		indefiniteArticles.add("");
		definiteArticles.add("");
	}
	final String dpa = lang.get(GENDERS_SECTION + "plural.definite article");
	if (dpa == null)
		Skript.error("Missing entry '" + GENDERS_SECTION + "plural.definite article' in the " + Language.getName() + " language file!");
	definitePluralArticle = dpa == null ? "" : dpa;
	
	if (Language.useLocal || localIndefiniteArticles.isEmpty()) {
		localIndefiniteArticles.clear();
		localIndefiniteArticles.addAll(indefiniteArticles);
		localDefiniteArticles.clear();
		localDefiniteArticles.addAll(definiteArticles);
		localDefinitePluralArticle = definitePluralArticle;
	}
}
 
Example 13
Source File: ExprCmdCooldownInfo.java    From Skript with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult) {
	pattern = matchedPattern;
	if (!ScriptLoader.isCurrentEvent(ScriptCommandEvent.class)) {
		Skript.error("The " + getExpressionName() + " expression can only be used within a command", ErrorQuality.SEMANTIC_ERROR);
		return false;
	}
	return true;
}
 
Example 14
Source File: ExprAbsorbedBlocks.java    From Skript with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, ParseResult parseResult) {
	if (!ScriptLoader.isCurrentEvent(SpongeAbsorbEvent.class)) {
		Skript.error("The 'absorbed blocks' are only usable in sponge absorb events", ErrorQuality.SEMANTIC_ERROR);
		return false;
	}
	return true;
}
 
Example 15
Source File: EvtMoveOn.java    From Skript with GNU General Public License v3.0 5 votes vote down vote up
@Override
	public boolean init(final Literal<?>[] args, final int matchedPattern, final ParseResult parser) {
//		if (parser.regexes.get(0).group().equalsIgnoreCase("<block>")/* && isValidatingInput*/)
//			return true;
//		final Matcher m = Pattern.compile("<block:(.+)>").matcher(parser.regexes.get(0).group());
//		if (m.matches()) {
//			final Block b = (Block) Skript.deserialize("block", m.group(1));
//			if (b == null)
//				return false;
//			world = b.getWorld();
//			x = b.getX();
//			y = b.getY();
//			z = b.getZ();
//		} else {
		@SuppressWarnings("unchecked")
		final Literal<? extends ItemType> l = (Literal<? extends ItemType>) args[0];//SkriptParser.parseLiteral(parser.regexes.get(0).group(), ItemType.class, ParseContext.EVENT);
		if (l == null)
			return false;
		types = l.getAll();
		for (final ItemType t : types) {
			if (t.isAll()) {
				Skript.error("Can't use an 'on walk' event with an alias that matches all blocks");
				return false;
			}
			boolean hasBlock = false;
			for (final ItemData d : t) {
				if (d.getType().isBlock() && d.getType() != Material.AIR) // don't allow air
					hasBlock = true;
			}
			if (!hasBlock) {
				Skript.error(t + " is not a block and can thus not be walked on");
				return false;
			}
		}
//		}
		return true;
	}
 
Example 16
Source File: ExprServerIcon.java    From Skript with GNU General Public License v3.0 5 votes vote down vote up
@Override
@Nullable
public Class<?>[] acceptChange(ChangeMode mode) {
	if (isServerPingEvent && !isDefault) {
		if (ScriptLoader.hasDelayBefore.isTrue()) {
			Skript.error("Can't change the server icon anymore after the server list ping event has already passed");
			return null;
		}
		if (mode == ChangeMode.SET || mode == ChangeMode.RESET)
			return CollectionUtils.array(CachedServerIcon.class);
	}
	return null;
}
 
Example 17
Source File: PacketParticleGetterV1_9.java    From skRayFall with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Converts a string to a EnumParticle.
 *
 * @param testString String to be converted
 */
public static EnumParticle get(String testString) {
    switch (testString.replace("\"", "").replace(" ", "_").toUpperCase()) {
        case "BARRIER":
            return EnumParticle.BARRIER;
        case "BLOCK_CRACK":
            return EnumParticle.BLOCK_CRACK;
        case "BLOCK_DUST":
            return EnumParticle.BLOCK_DUST;
        case "CLOUD":
            return EnumParticle.CLOUD;
        case "CRIT":
            return EnumParticle.CRIT;
        case "CRIT_MAGIC":
            return EnumParticle.CRIT_MAGIC;
        case "DRIP_LAVA":
            return EnumParticle.DRIP_LAVA;
        case "DRIP_WATER":
            return EnumParticle.DRIP_WATER;
        case "ENCHANTMENT_TABLE":
            return EnumParticle.ENCHANTMENT_TABLE;
        case "EXPLOSION_HUGE":
            return EnumParticle.EXPLOSION_HUGE;
        case "EXPLOSION_LARGE":
            return EnumParticle.EXPLOSION_LARGE;
        case "EXPLOSION_NORMAL":
            return EnumParticle.EXPLOSION_NORMAL;
        case "FIREWORKS_SPARK":
            return EnumParticle.FIREWORKS_SPARK;
        case "FLAME":
            return EnumParticle.FLAME;
        case "FOOTSTEP":
            return EnumParticle.FOOTSTEP;
        case "HEART":
            return EnumParticle.HEART;
        case "ITEM_CRACK":
            return EnumParticle.ITEM_CRACK;
        case "ITEM_TAKE":
            return EnumParticle.ITEM_TAKE;
        case "LAVA":
            return EnumParticle.LAVA;
        case "MOB_APPEARANCE":
            return EnumParticle.MOB_APPEARANCE;
        case "NOTE":
            return EnumParticle.NOTE;
        case "PORTAL":
            return EnumParticle.PORTAL;
        case "REDSTONE":
            return EnumParticle.REDSTONE;
        case "SLIME":
            return EnumParticle.SLIME;
        case "SMOKE_LARGE":
            return EnumParticle.SMOKE_LARGE;
        case "SMOKE_NORMAL":
            return EnumParticle.SMOKE_NORMAL;
        case "SNOW_SHOVEL":
            return EnumParticle.SNOW_SHOVEL;
        case "SNOWBALL":
            return EnumParticle.SNOWBALL;
        case "SPELL":
            return EnumParticle.SPELL;
        case "SPELL_INSTANT":
            return EnumParticle.SPELL_INSTANT;
        case "SPELL_MOB":
            return EnumParticle.SPELL_MOB;
        case "SPELL_MOB_AMBIENT":
            return EnumParticle.SPELL_MOB_AMBIENT;
        case "SPELL_WITCH":
            return EnumParticle.SPELL_WITCH;
        case "SUSPENDED":
            return EnumParticle.SUSPENDED;
        case "SUSPENDED_DEPTH":
            return EnumParticle.SUSPENDED_DEPTH;
        case "TOWN_AURA":
            return EnumParticle.TOWN_AURA;
        case "VILLAGER_ANGRY":
            return EnumParticle.VILLAGER_ANGRY;
        case "VILLAGER_HAPPY":
            return EnumParticle.VILLAGER_HAPPY;
        case "WATER_BUBBLE":
            return EnumParticle.WATER_BUBBLE;
        case "WATER_DROP":
            return EnumParticle.WATER_DROP;
        case "WATER_SPLASH":
            return EnumParticle.WATER_SPLASH;
        case "WATER_WAKE":
            return EnumParticle.WATER_WAKE;
        default:
            Skript.error("Invalid particle type selected! Using a Crit instead.");
            return EnumParticle.CRIT;
    }
}
 
Example 18
Source File: PacketParticleGetterV1_12.java    From skRayFall with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Converts a string to a EnumParticle.
 *
 * @param testString String to be converted
 */
public static EnumParticle get(String testString) {
    switch (testString.replace("\"", "").replace(" ", "_").toUpperCase()) {
        case "BARRIER":
            return EnumParticle.BARRIER;
        case "BLOCK_CRACK":
            return EnumParticle.BLOCK_CRACK;
        case "BLOCK_DUST":
            return EnumParticle.BLOCK_DUST;
        case "CLOUD":
            return EnumParticle.CLOUD;
        case "CRIT":
            return EnumParticle.CRIT;
        case "CRIT_MAGIC":
            return EnumParticle.CRIT_MAGIC;
        case "DRIP_LAVA":
            return EnumParticle.DRIP_LAVA;
        case "DRIP_WATER":
            return EnumParticle.DRIP_WATER;
        case "ENCHANTMENT_TABLE":
            return EnumParticle.ENCHANTMENT_TABLE;
        case "EXPLOSION_HUGE":
            return EnumParticle.EXPLOSION_HUGE;
        case "EXPLOSION_LARGE":
            return EnumParticle.EXPLOSION_LARGE;
        case "EXPLOSION_NORMAL":
            return EnumParticle.EXPLOSION_NORMAL;
        case "FIREWORKS_SPARK":
            return EnumParticle.FIREWORKS_SPARK;
        case "FLAME":
            return EnumParticle.FLAME;
        case "FOOTSTEP":
            return EnumParticle.FOOTSTEP;
        case "HEART":
            return EnumParticle.HEART;
        case "ITEM_CRACK":
            return EnumParticle.ITEM_CRACK;
        case "ITEM_TAKE":
            return EnumParticle.ITEM_TAKE;
        case "LAVA":
            return EnumParticle.LAVA;
        case "MOB_APPEARANCE":
            return EnumParticle.MOB_APPEARANCE;
        case "NOTE":
            return EnumParticle.NOTE;
        case "PORTAL":
            return EnumParticle.PORTAL;
        case "REDSTONE":
            return EnumParticle.REDSTONE;
        case "SLIME":
            return EnumParticle.SLIME;
        case "SMOKE_LARGE":
            return EnumParticle.SMOKE_LARGE;
        case "SMOKE_NORMAL":
            return EnumParticle.SMOKE_NORMAL;
        case "SNOW_SHOVEL":
            return EnumParticle.SNOW_SHOVEL;
        case "SNOWBALL":
            return EnumParticle.SNOWBALL;
        case "SPELL":
            return EnumParticle.SPELL;
        case "SPELL_INSTANT":
            return EnumParticle.SPELL_INSTANT;
        case "SPELL_MOB":
            return EnumParticle.SPELL_MOB;
        case "SPELL_MOB_AMBIENT":
            return EnumParticle.SPELL_MOB_AMBIENT;
        case "SPELL_WITCH":
            return EnumParticle.SPELL_WITCH;
        case "SUSPENDED":
            return EnumParticle.SUSPENDED;
        case "SUSPENDED_DEPTH":
            return EnumParticle.SUSPENDED_DEPTH;
        case "TOWN_AURA":
            return EnumParticle.TOWN_AURA;
        case "VILLAGER_ANGRY":
            return EnumParticle.VILLAGER_ANGRY;
        case "VILLAGER_HAPPY":
            return EnumParticle.VILLAGER_HAPPY;
        case "WATER_BUBBLE":
            return EnumParticle.WATER_BUBBLE;
        case "WATER_DROP":
            return EnumParticle.WATER_DROP;
        case "WATER_SPLASH":
            return EnumParticle.WATER_SPLASH;
        case "WATER_WAKE":
            return EnumParticle.WATER_WAKE;
        default:
            Skript.error("Invalid particle type selected! Using a Crit instead.");
            return EnumParticle.CRIT;
    }
}
 
Example 19
Source File: PacketParticleGetterV1_8_4.java    From skRayFall with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Converts a string to a EnumParticle.
 *
 * @param testString String to be converted
 */
public static EnumParticle get(String testString) {
    switch (testString.replace("\"", "").replace(" ", "_").toUpperCase()) {
        case "BARRIER":
            return EnumParticle.BARRIER;
        case "BLOCK_CRACK":
            return EnumParticle.BLOCK_CRACK;
        case "BLOCK_DUST":
            return EnumParticle.BLOCK_DUST;
        case "CLOUD":
            return EnumParticle.CLOUD;
        case "CRIT":
            return EnumParticle.CRIT;
        case "CRIT_MAGIC":
            return EnumParticle.CRIT_MAGIC;
        case "DRIP_LAVA":
            return EnumParticle.DRIP_LAVA;
        case "DRIP_WATER":
            return EnumParticle.DRIP_WATER;
        case "ENCHANTMENT_TABLE":
            return EnumParticle.ENCHANTMENT_TABLE;
        case "EXPLOSION_HUGE":
            return EnumParticle.EXPLOSION_HUGE;
        case "EXPLOSION_LARGE":
            return EnumParticle.EXPLOSION_LARGE;
        case "EXPLOSION_NORMAL":
            return EnumParticle.EXPLOSION_NORMAL;
        case "FIREWORKS_SPARK":
            return EnumParticle.FIREWORKS_SPARK;
        case "FLAME":
            return EnumParticle.FLAME;
        case "FOOTSTEP":
            return EnumParticle.FOOTSTEP;
        case "HEART":
            return EnumParticle.HEART;
        case "ITEM_CRACK":
            return EnumParticle.ITEM_CRACK;
        case "ITEM_TAKE":
            return EnumParticle.ITEM_TAKE;
        case "LAVA":
            return EnumParticle.LAVA;
        case "MOB_APPEARANCE":
            return EnumParticle.MOB_APPEARANCE;
        case "NOTE":
            return EnumParticle.NOTE;
        case "PORTAL":
            return EnumParticle.PORTAL;
        case "REDSTONE":
            return EnumParticle.REDSTONE;
        case "SLIME":
            return EnumParticle.SLIME;
        case "SMOKE_LARGE":
            return EnumParticle.SMOKE_LARGE;
        case "SMOKE_NORMAL":
            return EnumParticle.SMOKE_NORMAL;
        case "SNOW_SHOVEL":
            return EnumParticle.SNOW_SHOVEL;
        case "SNOWBALL":
            return EnumParticle.SNOWBALL;
        case "SPELL":
            return EnumParticle.SPELL;
        case "SPELL_INSTANT":
            return EnumParticle.SPELL_INSTANT;
        case "SPELL_MOB":
            return EnumParticle.SPELL_MOB;
        case "SPELL_MOB_AMBIENT":
            return EnumParticle.SPELL_MOB_AMBIENT;
        case "SPELL_WITCH":
            return EnumParticle.SPELL_WITCH;
        case "SUSPENDED":
            return EnumParticle.SUSPENDED;
        case "SUSPENDED_DEPTH":
            return EnumParticle.SUSPENDED_DEPTH;
        case "TOWN_AURA":
            return EnumParticle.TOWN_AURA;
        case "VILLAGER_ANGRY":
            return EnumParticle.VILLAGER_ANGRY;
        case "VILLAGER_HAPPY":
            return EnumParticle.VILLAGER_HAPPY;
        case "WATER_BUBBLE":
            return EnumParticle.WATER_BUBBLE;
        case "WATER_DROP":
            return EnumParticle.WATER_DROP;
        case "WATER_SPLASH":
            return EnumParticle.WATER_SPLASH;
        case "WATER_WAKE":
            return EnumParticle.WATER_WAKE;
        default:
            Skript.error("Invalid particle type selected! Using a Crit instead.");
            return EnumParticle.CRIT;
    }
}
 
Example 20
Source File: EffEquipCitizen.java    From skRayFall with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void execute(Event evt) {
    NPCRegistry registry = CitizensAPI.getNPCRegistry();
    NPC getter = registry.getById(id.getSingle(evt).intValue());
    EquipmentSlot slot = EquipmentSlot.HAND;
    switch (item.getSingle(evt).getType()) {
        case LEATHER_BOOTS:
        case IRON_BOOTS:
        case GOLD_BOOTS:
        case CHAINMAIL_BOOTS:
        case DIAMOND_BOOTS:
            slot = EquipmentSlot.BOOTS;
            break;
        case LEATHER_LEGGINGS:
        case IRON_LEGGINGS:
        case GOLD_LEGGINGS:
        case CHAINMAIL_LEGGINGS:
        case DIAMOND_LEGGINGS:
            slot = EquipmentSlot.LEGGINGS;
            break;
        case LEATHER_CHESTPLATE:
        case IRON_CHESTPLATE:
        case GOLD_CHESTPLATE:
        case CHAINMAIL_CHESTPLATE:
        case DIAMOND_CHESTPLATE:
            slot = EquipmentSlot.CHESTPLATE;
            break;
        case LEATHER_HELMET:
        case IRON_HELMET:
        case GOLD_HELMET:
        case CHAINMAIL_HELMET:
        case DIAMOND_HELMET:
            slot = EquipmentSlot.HELMET;
            break;
        default:
            break;

    }
    if (getter.getEntity().getType().equals(EntityType.PLAYER)
            || getter.getEntity().getType() == EntityType.ENDERMAN
            || getter.getEntity().getType() == EntityType.ZOMBIE
            || getter.getEntity().getType() == EntityType.SKELETON) {
        Equipment equ = getter.getTrait(Equipment.class);
        equ.set(slot, item.getSingle(evt));
    } else {
        Skript.error("Entity must be equipable!");
    }
}