区域刷新,区域黑名单,世界黑名单完成
This commit is contained in:
@@ -4,11 +4,13 @@ import com.yuyu.srwildentity.JDBC.JdbcSqlClass;
|
||||
import com.yuyu.srwildentity.config.ConfigManager;
|
||||
import com.yuyu.srwildentity.listener.AreaRefershListener;
|
||||
import com.yuyu.srwildentity.listener.EntityRefreshListener;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
/**
|
||||
@@ -25,6 +27,11 @@ public final class SrWildEntity extends JavaPlugin implements CommandExecutor {
|
||||
private EntityRefreshListener entityRefreshListener;
|
||||
private AreaRefershListener areaRefershListener;
|
||||
|
||||
public static Plugin getInance(){
|
||||
return Bukkit.getPluginManager().getPlugin("SrWildEntity");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
|
@@ -43,25 +43,6 @@ public class ConditionCheck {
|
||||
&& checkY(location,entityCondition.getyMax(), entityCondition.getyMin()));
|
||||
}
|
||||
|
||||
// private static boolean checkHeight(Location location, World world) {
|
||||
// int blockY = location.getBlockY();
|
||||
// for (int i = 1;i<2;i++){
|
||||
// blockY+=2;
|
||||
// location.setY(blockY);
|
||||
// Block block = location.getBlock();
|
||||
// if(block.getType() != Material.AIR
|
||||
// && block.getType() != Material.WATER
|
||||
// && block.getType() != Material.STATIONARY_WATER
|
||||
// && block.getType() != Material.LONG_GRASS
|
||||
// && block.getType() != Material.YELLOW_FLOWER
|
||||
// && block.getType() != Material.FLOWER_POT
|
||||
// && block.getType() != Material.CHORUS_FLOWER){
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 检查刷新位置
|
||||
* @param world
|
||||
@@ -81,11 +62,11 @@ public class ConditionCheck {
|
||||
//实体的落脚点
|
||||
Block blockAt = world.getBlockAt(new Location(world,location.getBlockX(),location.getBlockY() + 1,location.getBlockZ()));
|
||||
Block blockAt0 = world.getBlockAt(new Location(world,location.getBlockX(),location.getBlockY() + 2,location.getBlockZ()));
|
||||
Block blockAt1 = world.getBlockAt(new Location(world,location.getBlockX(),location.getBlockY() - 1,location.getBlockZ()));
|
||||
Block b = world.getBlockAt(new Location(world,location.getBlockX(),location.getBlockY() - 1,location.getBlockZ()));
|
||||
|
||||
return (noEntityCollision.contains(block.getType()) &&
|
||||
noEntityCollision.contains(blockAt.getType()) &&
|
||||
!noEntityCollision.contains(blockAt1.getType()) &&
|
||||
!noEntityCollision.contains(b.getType()) &&
|
||||
noEntityCollision.contains(blockAt0.getType()));
|
||||
|
||||
}
|
||||
|
@@ -170,10 +170,11 @@ public class EntityRefreshListener implements Listener, CommandExecutor {
|
||||
if (commandSender instanceof Player){
|
||||
Player player = (Player) commandSender;
|
||||
Location location = player.getLocation();
|
||||
String blockname = location.getBlock().getType().name();
|
||||
player.sendMessage(ChatColor.GREEN+"x:"+location.getBlockX()+"\ty:"
|
||||
+location.getBlockY()+"\tz:"+location.getBlockZ()+"\tworld:"+location.getWorld().getName());
|
||||
+location.getBlockY()+"\tz:"+location.getBlockZ()+"\tworld:"+location.getWorld().getName()+"\t"+blockname);
|
||||
logger.info(ChatColor.GREEN+"x:"+location.getBlockX()+"\ty:"
|
||||
+location.getBlockY()+"\tz:"+location.getBlockZ()+"\tworld:"+location.getWorld().getName());
|
||||
+location.getBlockY()+"\tz:"+location.getBlockZ()+"\tworld:"+location.getWorld().getName()+"\t"+blockname);
|
||||
return true;
|
||||
}else {
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user