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


Java ChangeMode.ADD属性代码示例

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


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

示例1: change

@Override
public void change(Event e, Object[] delta, Changer.ChangeMode mode){
	Number strength = (Number)delta[0];
	if (block != null) {
		try {
			Number strengthNow = getHardness(block.getSingle(e));
			Method method = ReflectionUtil.getNMSClass("Block").getDeclaredMethod("c", Float.TYPE);
			method.setAccessible(true);
			Object nmsBlock = ReflectionUtil.getNMSBlock(block.getSingle(e));
			if (mode == ChangeMode.SET) {
				method.invoke(nmsBlock, strength.floatValue());
			} else if (mode == ChangeMode.ADD) {
				method.invoke(nmsBlock, strength.floatValue() + strengthNow.floatValue());
			} else if (mode == ChangeMode.REMOVE) {
				method.invoke(nmsBlock, strength.floatValue() - strengthNow.floatValue());
			}
		} catch (SecurityException | NoSuchMethodException | IllegalArgumentException | IllegalAccessException | InvocationTargetException | ClassNotFoundException e1) {
			e1.printStackTrace();
		}
	}
}
 
开发者ID:TheLimeGlass,项目名称:Skellett,代码行数:21,代码来源:ExprBlockHardness.java

示例2: change

@Override
public void change(Event e, Object[] delta, Changer.ChangeMode mode){
	if (spawner != null) {
		Number delay = (Number)delta[0];
		Number delayNow = ((CreatureSpawner)spawner.getSingle(e).getState()).getDelay();
		CreatureSpawner spawn = ((CreatureSpawner)spawner.getSingle(e).getState());
		if (mode == ChangeMode.SET) {
			spawn.setDelay(delay.intValue());
		} else if (mode == ChangeMode.ADD) {
			spawn.setDelay(delayNow.intValue() + delay.intValue());
		} else if (mode == ChangeMode.REMOVE) {
			spawn.setDelay(delayNow.intValue() - delay.intValue());
		}
		spawn.update();
	}
}
 
开发者ID:TheLimeGlass,项目名称:Skellett,代码行数:16,代码来源:ExprSpawnerDelay.java

示例3: change

@Override
public void change(Event e, Object[] delta, Changer.ChangeMode mode){
	if (entity.getSingle(e) instanceof TNTPrimed) {
		Number ticks = (Number)delta[0];
		Number ticksNow = ((TNTPrimed)entity.getSingle(e)).getFuseTicks();
		if (mode == ChangeMode.SET) {
			((TNTPrimed)entity.getSingle(e)).setFuseTicks(ticks.intValue());
		} else if (mode == ChangeMode.ADD) {
			((TNTPrimed)entity.getSingle(e)).setFuseTicks(ticksNow.intValue() + ticks.intValue());
		} else if (mode == ChangeMode.REMOVE) {
			((TNTPrimed)entity.getSingle(e)).setFuseTicks(ticksNow.intValue() - ticks.intValue());
		}
	} else {
		return;
	}
}
 
开发者ID:TheLimeGlass,项目名称:Skellett,代码行数:16,代码来源:ExprFuseTime.java

示例4: change

@Override
public void change(Event e, Object[] delta, Changer.ChangeMode mode){
	if (entity.getSingle(e) == null) {
		return;
	}
	Number num = (Number)delta[0];
	Number numNow = ((Slime)entity.getSingle(e)).getSize();
	if (entity.getSingle(e).toString().equals("CraftSlime") || entity.getSingle(e).toString().equals("CraftMagmaCube")) {
		if (mode == ChangeMode.SET) {
			((Slime)entity.getSingle(e)).setSize(num.intValue());
		} else if (mode == ChangeMode.ADD) {
			((Slime)entity.getSingle(e)).setSize(numNow.intValue() + num.intValue());
		} else if (mode == ChangeMode.REMOVE) {
			((Slime)entity.getSingle(e)).setSize(numNow.intValue() - num.intValue());
		}
	}
}
 
开发者ID:TheLimeGlass,项目名称:Skellett,代码行数:17,代码来源:ExprSlimeSize.java

示例5: change

@Override
public void change(Event e, Object[] delta, Changer.ChangeMode mode){
	if (time == 1) {
		if (mode == ChangeMode.SET) {
			((BlockRedstoneEvent)e).setNewCurrent(((Integer)delta[0]));
		} else if (mode == ChangeMode.ADD) {
			((BlockRedstoneEvent)e).setNewCurrent((((BlockRedstoneEvent)e).getNewCurrent() + (Integer)delta[0]));
		} else if (mode == ChangeMode.REMOVE) {
			((BlockRedstoneEvent)e).setNewCurrent((((BlockRedstoneEvent)e).getNewCurrent() - (Integer)delta[0]));
		} else if (mode == ChangeMode.RESET) {
			((BlockRedstoneEvent)e).setNewCurrent(((BlockRedstoneEvent)e).getNewCurrent());
		}
	}
}
 
开发者ID:TheLimeGlass,项目名称:Skellett,代码行数:14,代码来源:ExprRedstoneCurrent.java

示例6: change

@Override
public void change(Event e, Object[] delta, Changer.ChangeMode mode){
	Number xp = (Number)delta[0];
	Number xpNow = ((EntityBreedEvent)e).getExperience();
	if (mode == ChangeMode.SET) {
		((EntityBreedEvent)e).setExperience(xp.intValue());
	} else if (mode == ChangeMode.RESET) {
		((EntityBreedEvent)e).setExperience(0);
	} else if (mode == ChangeMode.ADD) {
		((EntityBreedEvent)e).setExperience(xpNow.intValue() + xp.intValue());
	} else if (mode == ChangeMode.REMOVE) {
		((EntityBreedEvent)e).setExperience(xpNow.intValue() - xp.intValue());
	}
}
 
开发者ID:TheLimeGlass,项目名称:Skellett,代码行数:14,代码来源:ExprBreedingXP.java

示例7: change

@Override
public void change(Event e, Object[] delta, Changer.ChangeMode mode){
	if (e instanceof SpectralArrow) {
		Number data = (Number)delta[0];
		if (mode == ChangeMode.SET) {
			((SpectralArrow)arrow.getSingle(e)).setGlowingTicks(data.intValue());
		} else if (mode == ChangeMode.ADD) {
			((SpectralArrow)arrow.getSingle(e)).setGlowingTicks(((SpectralArrow)arrow.getSingle(e)).getGlowingTicks() + data.intValue());
		} else if (mode == ChangeMode.REMOVE) {
			((SpectralArrow)arrow.getSingle(e)).setGlowingTicks(((SpectralArrow)arrow.getSingle(e)).getGlowingTicks() - data.intValue());
		}
	}
	return;
}
 
开发者ID:TheLimeGlass,项目名称:Skellett,代码行数:14,代码来源:ExprGlowingSpectralArrow.java

示例8: acceptChange

@Override
public Class<?>[] acceptChange(final Changer.ChangeMode mode) {
	if (mode == ChangeMode.SET || mode == ChangeMode.RESET || mode == ChangeMode.REMOVE || mode == ChangeMode.ADD || mode == ChangeMode.DELETE || mode == ChangeMode.REMOVE_ALL) {
		return CollectionUtils.array(Number.class);
	}
	return null;
}
 
开发者ID:TheLimeGlass,项目名称:Skellett,代码行数:7,代码来源:ExprStatistics.java

示例9: acceptChange

@Override
public Class<?>[] acceptChange(final Changer.ChangeMode mode) {
	if (mode == ChangeMode.SET || mode == ChangeMode.RESET || mode == ChangeMode.ADD || mode == ChangeMode.REMOVE) {
		return CollectionUtils.array(Number.class);
	}
	return null;
}
 
开发者ID:TheLimeGlass,项目名称:Skellett,代码行数:7,代码来源:ExprBrewingFuelPower.java

示例10: acceptChange

@Override
public Class<?>[] acceptChange(final Changer.ChangeMode mode) {
	if (mode == ChangeMode.ADD || mode == ChangeMode.REMOVE) {
		return CollectionUtils.array(Player.class, String.class);
	}
	return null;
}
 
开发者ID:TheLimeGlass,项目名称:Skellett,代码行数:7,代码来源:ExprFeudalKingdomFighters.java

示例11: acceptChange

@Override
public Class<?>[] acceptChange(final Changer.ChangeMode mode) {
	if (mode == ChangeMode.SET || mode == ChangeMode.ADD || mode == ChangeMode.REMOVE) {
		return CollectionUtils.array(Number.class);
	}
	return null;
}
 
开发者ID:TheLimeGlass,项目名称:Skellett,代码行数:7,代码来源:ExprMapCenter.java

示例12: change

@Override
public void change(Event e, Object[] delta, Changer.ChangeMode mode){
	Number scoreNew = (Number)delta[0];
	Number scoreNow = score.getSingle(e).getScore();
	if (mode == ChangeMode.SET) {
		score.getSingle(e).setScore(scoreNew.intValue());
	} else if (mode == ChangeMode.ADD) {
		score.getSingle(e).setScore(scoreNow.intValue() + scoreNew.intValue());
	} else if (mode == ChangeMode.REMOVE) {
		score.getSingle(e).setScore(scoreNow.intValue() - scoreNew.intValue());
	}
}
 
开发者ID:TheLimeGlass,项目名称:Skellett,代码行数:12,代码来源:ExprScore.java

示例13: change

@SuppressWarnings("deprecation")
@Override
public void change(Event e, Object[] delta, Changer.ChangeMode mode){
	UUID uniqueId = null;
	try {
		uniqueId = UUID.fromString(player.getSingle(e));
	} catch (IllegalArgumentException ex) {}
	Number amount = (Number)delta[0];
	if (mode == ChangeMode.SET) {
		if (uniqueId != null) {
			Skellett.playerPoints.getAPI().set(uniqueId, amount.intValue());
		} else {
			Skellett.playerPoints.getAPI().set(player.getSingle(e), amount.intValue());
		}
	} else if (mode == ChangeMode.ADD) {
		if (uniqueId != null) {
			Skellett.playerPoints.getAPI().give(uniqueId, amount.intValue());
		} else {
			Skellett.playerPoints.getAPI().give(player.getSingle(e), amount.intValue());
		}
	} else if (mode == ChangeMode.REMOVE) {
		if (uniqueId != null) {
			Skellett.playerPoints.getAPI().take(uniqueId, amount.intValue());
		} else {
			Skellett.playerPoints.getAPI().take(player.getSingle(e), amount.intValue());
		}
	} else if (mode == ChangeMode.REMOVE_ALL || mode == ChangeMode.RESET || mode == ChangeMode.DELETE) {
		if (uniqueId != null) {
			Skellett.playerPoints.getAPI().reset(uniqueId);
		} else {
			Skellett.playerPoints.getAPI().reset(player.getSingle(e), 0);
		}
	}
}
 
开发者ID:TheLimeGlass,项目名称:Skellett,代码行数:34,代码来源:ExprPlayerPoints.java

示例14: change

@SuppressWarnings("deprecation")
@Override
public void change(Event e, Object[] delta, Changer.ChangeMode mode){
	Timespan before = Timespan.fromTicks((int)(entity.getSingle(e)).getMaximumNoDamageTicks());
	if (mode == ChangeMode.SET) {
		((LivingEntity)entity.getSingle(e)).setMaximumNoDamageTicks(((Timespan)delta[0]).getTicks());
	} else if (mode == ChangeMode.ADD) {
		((LivingEntity)entity.getSingle(e)).setMaximumNoDamageTicks(before.getTicks() + ((Timespan)delta[0]).getTicks());
	} else if (mode == ChangeMode.REMOVE) {
		((LivingEntity)entity.getSingle(e)).setMaximumNoDamageTicks(before.getTicks() - ((Timespan)delta[0]).getTicks());
	}
}
 
开发者ID:TheLimeGlass,项目名称:Skellett,代码行数:12,代码来源:ExprMaxDamageTicks.java

示例15: acceptChange

@Override
public Class<?>[] acceptChange(final Changer.ChangeMode mode) {
	if (mode == ChangeMode.SET || mode == ChangeMode.REMOVE || mode == ChangeMode.ADD) {
		return CollectionUtils.array(Number.class);
	}
	return null;
}
 
开发者ID:TheLimeGlass,项目名称:Skellett,代码行数:7,代码来源:ExprFuseTime.java


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