本文整理汇总了Java中org.spongepowered.api.text.channel.MutableMessageChannel类的典型用法代码示例。如果您正苦于以下问题:Java MutableMessageChannel类的具体用法?Java MutableMessageChannel怎么用?Java MutableMessageChannel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MutableMessageChannel类属于org.spongepowered.api.text.channel包,在下文中一共展示了MutableMessageChannel类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: awardPowerup
import org.spongepowered.api.text.channel.MutableMessageChannel; //导入依赖的package包/类
public void awardPowerup(Player player, ItemStack held) {
ItemStack powerup;
Optional<String> optSuffix = SkyFeather.getSuffix(held);
if (optSuffix.isPresent() && optSuffix.get().equals("Doom")) {
return;
}
int uses = 5;
double radius = 3;
double flight = 2;
double pushBack = 4;
if (Probability.getChance(2)) {
radius = 5;
pushBack = 6;
} else {
flight = 6;
}
if (Probability.getChance(50)) {
uses = -1;
radius = 7;
flight = 6;
pushBack = 6;
MutableMessageChannel targets = getPlayerMessageChannel(PlayerClassifier.SPECTATOR).asMutable();
targets.removeMember(player);
targets.send(Text.of(TextColors.RED, player.getName(), " has been given a Doom feather!"));
player.getInventory().clear();
}
powerup = newItemStack(CustomItemTypes.SKY_FEATHER);
SkyFeather.setFeatherProperties(powerup, uses, radius, flight, pushBack);
player.getInventory().offer(powerup);
tf(player).inventoryContainer.detectAndSendChanges();
// Display name doesn't need checked as all power ups have one assigned
player.sendMessage(Text.of(TextColors.YELLOW, "You obtain a power-up!"));
}