本文整理汇总了Java中ch.njol.skript.classes.Changer类的典型用法代码示例。如果您正苦于以下问题:Java Changer类的具体用法?Java Changer怎么用?Java Changer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Changer类属于ch.njol.skript.classes包,在下文中一共展示了Changer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: change
import ch.njol.skript.classes.Changer; //导入依赖的package包/类
@Override
public void change(Event e, Object[] delta, @NotNull Changer.ChangeMode mode) {
ItemStack i = item.getSingle(e);
if (i == null) {
return;
}
if (i.getType() == Material.BANNER || i.getType() == Material.SHIELD) {
BannerMeta meta = ((BannerMeta) i.getItemMeta());
switch (mode) {
case ADD:
Arrays.asList(((Pattern[]) delta)).forEach(meta::addPattern);
break;
case SET:
meta.setPatterns(Arrays.asList(((Pattern[]) delta)));
break;
case DELETE:
case RESET:
for (int j = 1; j <= meta.numberOfPatterns(); j++) {
meta.removePattern(j);
}
break;
}
i.setItemMeta(meta);
}
}
开发者ID:Syst3ms,项目名称:QuarSK,代码行数:27,代码来源:SExprItemLayers.java
示例2: change
import ch.njol.skript.classes.Changer; //导入依赖的package包/类
@Override
public void change(Event e, Object[] delta, @NotNull Changer.ChangeMode mode) {
Block b = block.getSingle(e);
if (b == null) {
return;
}
if (b.getType() == Material.BANNER) {
Banner banner = (Banner) b.getState();
Pattern[] patterns = (Pattern[]) delta;
switch (mode) {
case ADD:
Arrays.asList(patterns).forEach(banner::addPattern);
break;
case SET:
banner.setPatterns(Arrays.asList(patterns));
break;
case DELETE:
case RESET:
for (int i = 1; i <= banner.numberOfPatterns(); i++)
banner.removePattern(i);
break;
}
banner.update(true, false);
}
}
开发者ID:Syst3ms,项目名称:QuarSK,代码行数:26,代码来源:SExprBannerBlockLayers.java
示例3: change
import ch.njol.skript.classes.Changer; //导入依赖的package包/类
@Override
public void change(Event e, Object[] delta, @NotNull Changer.ChangeMode mode) {
Block b = block.getSingle(e);
if (b == null) {
return;
}
if (b.getType() == Material.BANNER) {
Banner banner = ((Banner) b.getState());
switch (mode) {
case SET:
Color c = (Color) delta[0];
banner.setBaseColor(c.getWoolColor());
break;
case RESET:
banner.setBaseColor(DyeColor.WHITE);
break;
}
banner.update(true, false);
}
}
开发者ID:Syst3ms,项目名称:QuarSK,代码行数:22,代码来源:SExprBannerBlockBaseColor.java
示例4: change
import ch.njol.skript.classes.Changer; //导入依赖的package包/类
@Override
public void change(Event e, Object[] delta, @NotNull Changer.ChangeMode mode) {
ItemStack i = item.getSingle(e);
if (i == null) {
return;
}
if (i.getType() == Material.BANNER || i.getType() == Material.SHIELD) {
BannerMeta meta = ((BannerMeta) i.getItemMeta());
switch (mode) {
case SET:
Color c = (Color) delta[0];
meta.setBaseColor(c.getWoolColor());
break;
case RESET:
meta.setBaseColor(DyeColor.WHITE);
break;
}
i.setItemMeta(meta);
}
}
开发者ID:Syst3ms,项目名称:QuarSK,代码行数:21,代码来源:SExprItemBaseColor.java
示例5: execute
import ch.njol.skript.classes.Changer; //导入依赖的package包/类
@Override
protected void execute(Event e) {
String cls = className.getSingle(e);
if (cls == null) {
return;
}
JavaType javaType;
try {
javaType = new JavaType(LibraryLoader.getClassLoader().loadClass(cls));
} catch (ClassNotFoundException ex) {
Skript.warning(cls + " refers to a non-existent class.");
return;
}
if (var == null) {
Variables.setVariable(javaType.getJavaClass().getSimpleName().toLowerCase(), javaType, e,
false);
} else {
var.change(e, new Object[]{javaType}, Changer.ChangeMode.SET);
}
}
开发者ID:btk5h,项目名称:skript-mirror,代码行数:24,代码来源:EffImport.java
示例6: change
import ch.njol.skript.classes.Changer; //导入依赖的package包/类
@Override
public void change(Event e, Object[] delta, Changer.ChangeMode mode) {
Object target = targetArg.getSingle(e);
if (target == null) {
return;
}
Object[] args = new Object[1];
switch (mode) {
case SET:
args[0] = delta[0];
break;
case DELETE:
args[0] = null;
break;
}
invoke(target, args, getDescriptor(e));
}
开发者ID:btk5h,项目名称:skript-mirror,代码行数:21,代码来源:ExprJavaCall.java
示例7: change
import ch.njol.skript.classes.Changer; //导入依赖的package包/类
@Override
public void change(Event e, Object[] delta, Changer.ChangeMode mode){
if (mode == ChangeMode.SET) {
String string = (String)delta[0];
if (string.equals("BELOW_NAME")||string.equals("PLAYER_LIST")||string.equals("SIDEBAR")) {
DisplaySlot slot = DisplaySlot.valueOf(string.replace("\"", "").trim().replace(" ", "_").toUpperCase());
try {
slot = DisplaySlot.valueOf(slot.toString().replace("\"", "").trim().replace(" ", "_").toUpperCase());
} catch (IllegalArgumentException t) {
return;
}
obj.getSingle(e).setDisplaySlot(slot);
} else {
return;
}
}
}
开发者ID:TheLimeGlass,项目名称:Skellett,代码行数:18,代码来源:ExprObjectiveDisplaySlot.java
示例8: execute
import ch.njol.skript.classes.Changer; //导入依赖的package包/类
@Override
protected void execute(Event event) {
Variable<?> listVariable = (Variable<?>) this.listVariable;
listVariable.change(event, null, Changer.ChangeMode.DELETE);
if (isArray) {
JSONObject[] jsonObjects = jsonObjectExpression.getArray(event);
Logging.debug(this, "Expression: " + jsonObjectExpression);
Logging.debug(this, "Array size: " + jsonObjects.length);
Logging.debug(this, "Actual array: " + jsonObjects);
List<Object> jsonObjectList = Arrays.asList((Object[]) jsonObjects);
Logging.debug(this, "List size: " + jsonObjectList.size());
Logging.debug(this, "Actual list: " + jsonObjects);
setToJSONArray(listVariableName, jsonObjectList, listVariable.isLocal(), event);
} else {
JSONObject jsonObject = jsonObjectExpression.getSingle(event);
setToJSONObject(listVariableName, jsonObject, listVariable.isLocal(), event);
}
}
开发者ID:MundoSK,项目名称:MundoSK,代码行数:19,代码来源:EffPutJsonInListVariable.java
示例9: acceptChange
import ch.njol.skript.classes.Changer; //导入依赖的package包/类
@Nullable
@Override
public Class<?>[] acceptChange(Changer.ChangeMode mode) {
if (mode == Changer.ChangeMode.DELETE || mode == Changer.ChangeMode.RESET) {
return CollectionUtils.array(Pattern.class);
} else if (mode == Changer.ChangeMode.ADD || mode == Changer.ChangeMode.SET) {
return CollectionUtils.array(Pattern[].class);
}
return null;
}
开发者ID:Syst3ms,项目名称:QuarSK,代码行数:11,代码来源:SExprItemLayers.java
示例10: acceptChange
import ch.njol.skript.classes.Changer; //导入依赖的package包/类
@Nullable
@Override
public Class<?>[] acceptChange(Changer.ChangeMode mode) {
if (mode == Changer.ChangeMode.DELETE || mode == Changer.ChangeMode.RESET) {
return CollectionUtils.array(Pattern.class);
} else if (mode == Changer.ChangeMode.ADD || mode == Changer.ChangeMode.SET) {
return CollectionUtils.array(Pattern[].class);
} else {
return null;
}
}
开发者ID:Syst3ms,项目名称:QuarSK,代码行数:12,代码来源:SExprBannerBlockLayers.java
示例11: acceptChange
import ch.njol.skript.classes.Changer; //导入依赖的package包/类
@Nullable
@Override
public Class<?>[] acceptChange(Changer.ChangeMode mode) {
return (mode == Changer.ChangeMode.SET || mode == Changer.ChangeMode.RESET)
? CollectionUtils.array(Color.class)
: null;
}
开发者ID:Syst3ms,项目名称:QuarSK,代码行数:8,代码来源:SExprBannerBlockBaseColor.java
示例12: change
import ch.njol.skript.classes.Changer; //导入依赖的package包/类
@Override
public void change(Event e, Object[] delta, @NotNull Changer.ChangeMode changeMode) {
Block b = beacon.getSingle(e);
if (b == null) {
return;
}
if (b.getType() == Material.BEACON) {
Beacon state = ((Beacon) b.getState());
switch (changeMode) {
case SET:
if (isPrimary) {
state.setPrimaryEffect((PotionEffectType) delta[0]);
} else {
state.setSecondaryEffect((PotionEffectType) delta[0]);
}
break;
case DELETE:
case RESET:
if (isPrimary) {
state.setPrimaryEffect(null);
} else {
state.setSecondaryEffect(null);
}
break;
}
state.update(true, false);
}
}
开发者ID:Syst3ms,项目名称:QuarSK,代码行数:29,代码来源:SExprBeaconEffects.java
示例13: acceptChange
import ch.njol.skript.classes.Changer; //导入依赖的package包/类
@Nullable
@Override
public Class<?>[] acceptChange(Changer.ChangeMode mode) {
if (mode != Changer.ChangeMode.REMOVE && mode != Changer.ChangeMode.REMOVE_ALL
&& mode != Changer.ChangeMode.ADD) {
return CollectionUtils.array(PotionEffectType.class);
}
return null;
}
开发者ID:Syst3ms,项目名称:QuarSK,代码行数:10,代码来源:SExprBeaconEffects.java
示例14: change
import ch.njol.skript.classes.Changer; //导入依赖的package包/类
@Override
public void change(Event e, Object[] delta, Changer.ChangeMode mode) {
Block b = getExpr().getSingle(e);
if (b == null) {
return;
}
if (b.getState() instanceof BeaconInventory) {
((BeaconInventory) b.getState()).setItem((ItemStack) delta[0]);
}
}
开发者ID:Syst3ms,项目名称:QuarSK,代码行数:11,代码来源:SExprBeaconFuel.java
示例15: acceptChange
import ch.njol.skript.classes.Changer; //导入依赖的package包/类
@Override
public Class<?>[] acceptChange(Changer.ChangeMode mode) {
if (mode != Changer.ChangeMode.REMOVE && mode != Changer.ChangeMode.REMOVE_ALL) {
return CollectionUtils.array(PotionEffect[].class);
} else {
return CollectionUtils.array(PotionEffectType[].class);
}
}
开发者ID:Syst3ms,项目名称:QuarSK,代码行数:9,代码来源:SExprPotionItemEffects.java
示例16: acceptChange
import ch.njol.skript.classes.Changer; //导入依赖的package包/类
@Nullable
@Override
public Class<?>[] acceptChange(Changer.ChangeMode mode) {
if (mode == Changer.ChangeMode.REMOVE) {
return CollectionUtils.array(PotionEffectType.class);
} else if (mode != Changer.ChangeMode.RESET) {
return CollectionUtils.array(PotionEffect[].class);
}
return null;
}
开发者ID:Syst3ms,项目名称:QuarSK,代码行数:11,代码来源:SExprThrownPotionEffects.java
示例17: acceptChange
import ch.njol.skript.classes.Changer; //导入依赖的package包/类
@Nullable
@Override
public Class<?>[] acceptChange(Changer.ChangeMode mode) {
if (mode != Changer.ChangeMode.REMOVE_ALL && mode != Changer.ChangeMode.RESET
&& mode != Changer.ChangeMode.DELETE) {
return CollectionUtils.array(Number.class);
}
return null;
}
开发者ID:Syst3ms,项目名称:QuarSK,代码行数:10,代码来源:SExprItemEffectTypeAmplifier.java
示例18: acceptChange
import ch.njol.skript.classes.Changer; //导入依赖的package包/类
@Nullable
@Override
public Class<?>[] acceptChange(Changer.ChangeMode mode) {
if (mode != Changer.ChangeMode.REMOVE_ALL && mode != Changer.ChangeMode.RESET
&& mode != Changer.ChangeMode.DELETE) {
return CollectionUtils.array(Timespan.class);
}
return null;
}
开发者ID:Syst3ms,项目名称:QuarSK,代码行数:10,代码来源:SExprItemEffectTypeDuration.java
示例19: change
import ch.njol.skript.classes.Changer; //导入依赖的package包/类
@Override
public void change(Event e, Object[] delta, Changer.ChangeMode mode) {
if (mode == ChangeMode.SET) {
ItemType item = (ItemType)delta[0];
ItemStack m = item.getRandom();
((InventoryClickEvent)e).setCurrentItem(m);
}
}
开发者ID:WheezyGold7931,项目名称:skLib,代码行数:9,代码来源:ExprClickedItem.java
示例20: acceptChange
import ch.njol.skript.classes.Changer; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public Class<?>[] acceptChange(final Changer.ChangeMode mode) {
if (mode == ChangeMode.SET) {
return CollectionUtils.array(ItemType.class);
}
return null;
}
开发者ID:WheezyGold7931,项目名称:skLib,代码行数:9,代码来源:ExprClickedItem.java
注:本文中的ch.njol.skript.classes.Changer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论