本文整理匯總了Java中org.bukkit.Material.BEACON屬性的典型用法代碼示例。如果您正苦於以下問題:Java Material.BEACON屬性的具體用法?Java Material.BEACON怎麽用?Java Material.BEACON使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.bukkit.Material
的用法示例。
在下文中一共展示了Material.BEACON屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: get
@Nullable
@Override
protected PotionEffect[] get(Event e) {
Block b = beacon.getSingle(e);
if (b == null) {
return null;
}
if (b.getType() == Material.BEACON) {
return new PotionEffect[]{isPrimary
? ((Beacon) b.getState()).getPrimaryEffect()
: ((Beacon) b.getState()).getSecondaryEffect()};
}
return null;
}
示例2: change
@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);
}
}
示例3: get
@Nullable
@Override
protected LivingEntity[] get(Event e) {
Block b = beacon.getSingle(e);
if (b == null) {
return null;
}
if (b.getType() == Material.BEACON) {
Beacon state = (Beacon) b.getState();
return state.getEntitiesInRange().toArray(new LivingEntity[state.getEntitiesInRange().size()]);
}
return null;
}