@EventHandler
public void onBrew(BrewEvent event) {
BrewerInventory inv = event.getContents();
// if the inventory doesn't contain glowstone AND a strength potion, return.
if (!containsStrengthOrGlowstone(inv)) {
return;
}
// cancel.
event.setCancelled(true);
Block block = event.getBlock();
Location blockL = block.getLocation();
// loop thru everyone online.
for (Player online : Bukkit.getOnlinePlayers()) {
Location playerL = online.getLocation();
// if they're within a radius send them a message.
if (block.getWorld() == online.getWorld() && playerL.distance(blockL) < 15) {
online.sendMessage(ChatColor.RED + "Strength II is disabled, brewing cancelled.");
}
}
}
BrewListener.java 文件源码
java
阅读 28
收藏 0
点赞 0
评论 0
项目:NoStrengthII
作者:
评论列表
文章目录