Fixed a if error:
Should use equals not "=="
This commit is contained in:
parent
ea6a3fb936
commit
04d193f040
@ -3,18 +3,18 @@ package net.theprogrammersworld.herobrine.AI.cores;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import net.theprogrammersworld.herobrine.Herobrine;
|
||||
import net.theprogrammersworld.herobrine.AI.AICore;
|
||||
import net.theprogrammersworld.herobrine.AI.Core;
|
||||
import net.theprogrammersworld.herobrine.AI.CoreResult;
|
||||
import net.theprogrammersworld.herobrine.misc.BlockChanger;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.theprogrammersworld.herobrine.Herobrine;
|
||||
import net.theprogrammersworld.herobrine.AI.AICore;
|
||||
import net.theprogrammersworld.herobrine.AI.Core;
|
||||
import net.theprogrammersworld.herobrine.AI.CoreResult;
|
||||
import net.theprogrammersworld.herobrine.misc.BlockChanger;
|
||||
|
||||
public class Heads extends Core {
|
||||
|
||||
private boolean isCalled;
|
||||
@ -23,21 +23,23 @@ public class Heads extends Core {
|
||||
public Heads() {
|
||||
super(CoreType.HEADS, AppearType.NORMAL);
|
||||
isCalled = false;
|
||||
headList = new ArrayList<Block>();
|
||||
headList = new ArrayList<>();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public CoreResult callCore(final Object[] data) {
|
||||
if (isCalled) {
|
||||
return new CoreResult(false, "This player is already being haunted by heads. Please wait until they disappear.");
|
||||
return new CoreResult(false,
|
||||
"This player is already being haunted by heads. Please wait until they disappear.");
|
||||
}
|
||||
if (!Bukkit.getPlayer((String) data[0]).isOnline()) {
|
||||
return new CoreResult(false, "This player cannot be haunted by heads because they are not online.");
|
||||
}
|
||||
final Player player = Bukkit.getServer().getPlayer((String) data[0]);
|
||||
if (!Herobrine.getPluginCore().getSupport().checkBuild(player.getLocation())) {
|
||||
return new CoreResult(false, player.getDisplayName() + " cannot be haunted by heads because they are in a protected area.");
|
||||
return new CoreResult(false,
|
||||
player.getDisplayName() + " cannot be haunted by heads because they are in a protected area.");
|
||||
}
|
||||
if (Herobrine.getPluginCore().getConfigDB().UseHeads) {
|
||||
final Location loc = player.getLocation();
|
||||
@ -55,7 +57,7 @@ public class Heads extends Core {
|
||||
y = loc.getWorld().getHighestBlockYAt(px + x, pz + z) + 1;
|
||||
}
|
||||
final Block block = loc.getWorld().getBlockAt(px + x, y, pz + z);
|
||||
if (loc.getBlock().getType() == Material.AIR) {
|
||||
if (loc.getBlock().getType().equals(Material.AIR)) {
|
||||
BlockChanger.PlaceSkull(block.getLocation(), "Herobrine");
|
||||
headList.add(block);
|
||||
}
|
||||
|
@ -41,6 +41,24 @@ public class BlockListener implements Listener {
|
||||
&& (block.getWorld().getBlockAt(blockloc.getBlockX() + 1, blockloc.getBlockY(), blockloc.getBlockZ()).getType() == Material.REDSTONE_TORCH_ON)
|
||||
&& (block.getWorld().getBlockAt(blockloc.getBlockX() - 1, blockloc.getBlockY(), blockloc.getBlockZ()).getType() == Material.REDSTONE_TORCH_ON)
|
||||
&& Herobrine.getPluginCore().getConfigDB().UseTotem && !AICore.isTotemCalled) {
|
||||
if(!Herobrine.getPluginCore().getSupport().checkBuild(blockloc)) {
|
||||
event.getPlayer().sendMessage("§c[Herobrine] You can't summon the Herobrine in you can't break zone!");
|
||||
return;
|
||||
}
|
||||
block.getWorld().getBlockAt(blockloc.getBlockX(), blockloc.getBlockY() , blockloc.getBlockZ()).setType(Material.AIR);
|
||||
block.getWorld().getBlockAt(blockloc.getBlockX(), blockloc.getBlockY() - 1, blockloc.getBlockZ()).setType(Material.AIR);
|
||||
block.getWorld().getBlockAt(blockloc.getBlockX() - 1, blockloc.getBlockY() - 1, blockloc.getBlockZ()).setType(Material.AIR);
|
||||
block.getWorld().getBlockAt(blockloc.getBlockX() - 1, blockloc.getBlockY() - 1, blockloc.getBlockZ() - 1).setType(Material.AIR);
|
||||
block.getWorld().getBlockAt(blockloc.getBlockX() - 1, blockloc.getBlockY() - 1, blockloc.getBlockZ() + 1).setType(Material.AIR);
|
||||
block.getWorld().getBlockAt(blockloc.getBlockX() + 1, blockloc.getBlockY() - 1, blockloc.getBlockZ()).setType(Material.AIR);
|
||||
block.getWorld().getBlockAt(blockloc.getBlockX() + 1, blockloc.getBlockY() - 1, blockloc.getBlockZ() - 1).setType(Material.AIR);
|
||||
block.getWorld().getBlockAt(blockloc.getBlockX() + 1, blockloc.getBlockY() - 1, blockloc.getBlockZ() + 1).setType(Material.AIR);
|
||||
block.getWorld().getBlockAt(blockloc.getBlockX(), blockloc.getBlockY() - 1, blockloc.getBlockZ() - 1).setType(Material.AIR);
|
||||
block.getWorld().getBlockAt(blockloc.getBlockX(), blockloc.getBlockY() - 1, blockloc.getBlockZ() + 1).setType(Material.AIR);
|
||||
block.getWorld().getBlockAt(blockloc.getBlockX(), blockloc.getBlockY(), blockloc.getBlockZ() + 1).setType(Material.AIR);
|
||||
block.getWorld().getBlockAt(blockloc.getBlockX(), blockloc.getBlockY(), blockloc.getBlockZ() - 1).setType(Material.AIR);
|
||||
block.getWorld().getBlockAt(blockloc.getBlockX() + 1, blockloc.getBlockY(), blockloc.getBlockZ()).setType(Material.AIR);
|
||||
block.getWorld().getBlockAt(blockloc.getBlockX() - 1, blockloc.getBlockY(), blockloc.getBlockZ()).setType(Material.AIR);
|
||||
Herobrine.getPluginCore().getAICore().playerCallTotem(event.getPlayer());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user