@EventHandler(priority = EventPriority.LOW)
public void onBucketFill(final PlayerBucketFillEvent e) {
if (DEBUG) {
plugin.getLogger().info(e.getEventName());
}
if (inWorld(e.getPlayer())) {
// This permission bypasses protection
if (VaultHelper.checkPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")) {
return;
}
Island island = plugin.getGrid().getProtectedIslandAt(e.getBlockClicked().getLocation());
if (island != null) {
if (island.getMembers().contains(e.getPlayer().getUniqueId())) {
return;
}
if (island.getIgsFlag(SettingsFlag.COLLECT_LAVA) && e.getItemStack().getType().equals(Material.LAVA_BUCKET)) {
return;
}
if (island.getIgsFlag(SettingsFlag.COLLECT_WATER) && e.getItemStack().getType().equals(Material.WATER_BUCKET)) {
return;
}
if (island.getIgsFlag(SettingsFlag.MILKING) && e.getItemStack().getType().equals(Material.MILK_BUCKET)) {
return;
}
if (island.getIgsFlag(SettingsFlag.BUCKET)) {
return;
}
} else {
// Null
if (Settings.defaultWorldSettings.get(SettingsFlag.BUCKET)) {
return;
}
}
// Not allowed
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
e.setCancelled(true);
}
}
IslandGuard.java 文件源码
java
阅读 27
收藏 0
点赞 0
评论 0
项目:askyblock
作者:
评论列表
文章目录