Java Code Examples for ch.njol.skript.classes.Changer.ChangeMode#REMOVE_ALL

The following examples show how to use ch.njol.skript.classes.Changer.ChangeMode#REMOVE_ALL . 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: ExprLevel.java    From Skript with GNU General Public License v3.0 6 votes vote down vote up
@Override
@Nullable
public Class<?>[] acceptChange(final ChangeMode mode) {
	if (mode == ChangeMode.REMOVE_ALL)
		return null;
	if (ScriptLoader.isCurrentEvent(PlayerRespawnEvent.class) && !ScriptLoader.hasDelayBefore.isTrue()) {
		Skript.error("Cannot change a player's level in a respawn event. Add a delay of 1 tick or change the 'new level' in a death event.");
		return null;
	}
	if (ScriptLoader.isCurrentEvent(PlayerDeathEvent.class) && getTime() == 0 && getExpr().isDefault() && !ScriptLoader.hasDelayBefore.isTrue()) {
		Skript.warning("Changing the player's level in a death event will change the player's level before he dies. " +
				"Use either 'past level of player' or 'new level of player' to clearly state whether to change the level before or after he dies.");
	}
	if (getTime() == -1 && !ScriptLoader.isCurrentEvent(PlayerDeathEvent.class))
		return null;
	return new Class[] {Number.class};
}
 
Example 2
Source File: ExprLevelProgress.java    From Skript with GNU General Public License v3.0 5 votes vote down vote up
@Override
@Nullable
public Class<?>[] acceptChange(final ChangeMode mode) {
	if (mode == ChangeMode.REMOVE_ALL)
		return null;
	return new Class[] {Number.class};
}
 
Example 3
Source File: ExprHealth.java    From Skript with GNU General Public License v3.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
@Nullable
public Class<?>[] acceptChange(final ChangeMode mode) {
	if (mode == ChangeMode.REMOVE_ALL)
		return null;
	return CollectionUtils.array(Number.class);
}
 
Example 4
Source File: ExprArrowsStuck.java    From Skript with GNU General Public License v3.0 5 votes vote down vote up
@Override
@Nullable
public Class<?>[] acceptChange(final ChangeMode mode) {
	if (mode == ChangeMode.REMOVE_ALL)
		return null;
	return CollectionUtils.array(Number.class);
}
 
Example 5
Source File: ExprDamage.java    From Skript with GNU General Public License v3.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
@Nullable
public Class<?>[] acceptChange(final ChangeMode mode) {
	if (delay != Kleenean.FALSE) {
		Skript.error("Can't change the damage anymore after the event has already passed");
		return null;
	}
	if (mode == ChangeMode.REMOVE_ALL)
		return null;
	return CollectionUtils.array(Number.class);
}
 
Example 6
Source File: ExprMaxHealth.java    From Skript with GNU General Public License v3.0 5 votes vote down vote up
@Override
@Nullable
public Class<?>[] acceptChange(final ChangeMode mode) {
	if(!Skript.isRunningMinecraft(1, 5, 2)) {
		Skript.error("The max health of an entity can only be changed in Minecraft 1.6 and later");
		return null;
	}
	
	if (mode != ChangeMode.DELETE && mode != ChangeMode.REMOVE_ALL)
		return new Class[] {Number.class};
	return null;
}
 
Example 7
Source File: ExprDurability.java    From Skript with GNU General Public License v3.0 5 votes vote down vote up
@Override
@Nullable
public Class<?>[] acceptChange(final ChangeMode mode) {
	if (mode == ChangeMode.REMOVE_ALL)
		return null;
	if (Slot.class.isAssignableFrom(getExpr().getReturnType()) || getExpr().isSingle() && ChangerUtils.acceptsChange(getExpr(), ChangeMode.SET, ItemStack.class, ItemType.class))
		return CollectionUtils.array(Number.class);
	return null;
}
 
Example 8
Source File: ExprFoodLevel.java    From Skript with GNU General Public License v3.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
@Nullable
public Class<?>[] acceptChange(final ChangeMode mode) {
	if (mode == ChangeMode.REMOVE_ALL)
		return null;
	return CollectionUtils.array(Number.class);
}
 
Example 9
Source File: ExprNoDamageTicks.java    From Skript with GNU General Public License v3.0 5 votes vote down vote up
@Override
@Nullable
public Class<?>[] acceptChange(final ChangeMode mode) {
	if (mode == ChangeMode.REMOVE_ALL)
		return null;
	return CollectionUtils.array(Number.class);
}
 
Example 10
Source File: ExprCreeperMaxFuseTicks.java    From Skript with GNU General Public License v3.0 5 votes vote down vote up
@Override
@Nullable
public Class<?>[] acceptChange(final ChangeMode mode) {
	if (mode == ChangeMode.REMOVE_ALL)
		return null;
	return CollectionUtils.array(Number.class);
}
 
Example 11
Source File: ExprLastDamageCause.java    From Skript with GNU General Public License v3.0 5 votes vote down vote up
@Override
@Nullable
public Class<?>[] acceptChange(final ChangeMode mode) {
	if (mode == ChangeMode.REMOVE_ALL)
		return null;
	return CollectionUtils.array(DamageCause.class);
}
 
Example 12
Source File: ExprBalance.java    From Skript with GNU General Public License v3.0 5 votes vote down vote up
@Override
@Nullable
public Class<?>[] acceptChange(final ChangeMode mode) {
	if (mode == ChangeMode.REMOVE_ALL)
		return null;
	return new Class[] {Money.class, Number.class};
}
 
Example 13
Source File: ExprRemainingAir.java    From Skript with GNU General Public License v3.0 4 votes vote down vote up
@Nullable
@Override
public Class<?>[] acceptChange(Changer.ChangeMode mode) {
	return (mode != ChangeMode.REMOVE_ALL) ? CollectionUtils.array(Timespan.class) : null;
}
 
Example 14
Source File: ExprItemAmount.java    From Skript with GNU General Public License v3.0 4 votes vote down vote up
@Override
public @Nullable Class<?>[] acceptChange(Changer.ChangeMode mode) {
    return (mode != ChangeMode.REMOVE_ALL) ? CollectionUtils.array(Number.class) : null;
}
 
Example 15
Source File: ExprSaturation.java    From Skript with GNU General Public License v3.0 4 votes vote down vote up
@Nullable
@Override
public Class<?>[] acceptChange(Changer.ChangeMode mode) {
	return (mode != ChangeMode.REMOVE_ALL) ? CollectionUtils.array(Number.class) : null;
}