1
0
mirror of https://e.coding.net/circlecloud/SimpleProtect.git synced 2024-12-27 07:39:03 +00:00

去除无效代码...

Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
502647092 2015-12-12 11:56:56 +08:00
parent d9f7ba3ff2
commit 0f3f81f575

View File

@ -3,7 +3,9 @@ package cn.citycraft.SimpleProtect.listen;
import java.util.Collection;
import java.util.Iterator;
import org.bukkit.*;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -17,36 +19,36 @@ public class Nightvision implements Listener {
SimpleProtect plugin;
public Nightvision(SimpleProtect main) {
public Nightvision(final SimpleProtect main) {
plugin = main;
}
@EventHandler
public void OnBlockBreak(BlockBreakEvent e) {
Player p = e.getPlayer();
public void OnBlockBreak(final BlockBreakEvent e) {
final Player p = e.getPlayer();
if (p.hasPermission("sp.ignore.nightvision") || p.isOp()) {
return;
}
int light = p.getLocation().getBlock().getLightLevel();
final int light = p.getLocation().getBlock().getLightLevel();
if (light > 0) {
return;
}
Block b = e.getBlock();
Material blockid = b.getType();
Location loc = b.getLocation();
World World = loc.getWorld();
int x = loc.getBlockX();
int y = loc.getBlockY();
int z = loc.getBlockZ();
Location loc_top = new Location(World, x, y + 1, z);
final Block b = e.getBlock();
final Material blockid = b.getType();
final Location loc = b.getLocation();
final World World = loc.getWorld();
final int x = loc.getBlockX();
final int y = loc.getBlockY();
final int z = loc.getBlockZ();
final Location loc_top = new Location(World, x, y + 1, z);
if (loc_top.getBlock().getType() == Material.AIR) {
return;
}
Collection<PotionEffect> effect = p.getActivePotionEffects();
Iterator<PotionEffect> iterator = effect.iterator();
final Collection<PotionEffect> effect = p.getActivePotionEffects();
final Iterator<PotionEffect> iterator = effect.iterator();
Boolean flag = Boolean.valueOf(false);
while (iterator.hasNext()) {
PotionEffect element = (PotionEffect) iterator.next();
final PotionEffect element = iterator.next();
if (element.toString().toUpperCase().contains("NIGHT_VISION")) {
flag = Boolean.valueOf(true);
break;
@ -56,13 +58,8 @@ public class Nightvision implements Listener {
if (blockid == Material.AIR) {
return;
}
if (blockid == Material.STONE || blockid == Material.GOLD_ORE
|| blockid == Material.IRON_ORE
|| blockid == Material.COAL_ORE
|| blockid == Material.DIAMOND_ORE
|| blockid == Material.REDSTONE_ORE
|| blockid == Material.LAPIS_ORE
|| blockid == Material.EMERALD_ORE) {
if (blockid == Material.STONE || blockid == Material.GOLD_ORE || blockid == Material.IRON_ORE || blockid == Material.COAL_ORE || blockid == Material.DIAMOND_ORE
|| blockid == Material.REDSTONE_ORE || blockid == Material.LAPIS_ORE || blockid == Material.EMERALD_ORE) {
e.setCancelled(true);
p.sendMessage(plugin.getfullmsg("Nightvision.Tip"));
}