tested making block displays smaller
This commit is contained in:
		@@ -6,42 +6,51 @@ import org.bukkit.command.Command;
 | 
				
			|||||||
import org.bukkit.command.CommandExecutor;
 | 
					import org.bukkit.command.CommandExecutor;
 | 
				
			||||||
import org.bukkit.command.CommandSender;
 | 
					import org.bukkit.command.CommandSender;
 | 
				
			||||||
import org.bukkit.entity.BlockDisplay;
 | 
					import org.bukkit.entity.BlockDisplay;
 | 
				
			||||||
 | 
					import org.bukkit.entity.EntityType;
 | 
				
			||||||
import org.bukkit.entity.Player;
 | 
					import org.bukkit.entity.Player;
 | 
				
			||||||
 | 
					import org.bukkit.util.Transformation;
 | 
				
			||||||
import org.jetbrains.annotations.NotNull;
 | 
					import org.jetbrains.annotations.NotNull;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class ChessCommand implements CommandExecutor {
 | 
					public class ChessCommand implements CommandExecutor {
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
 | 
					    public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
 | 
				
			||||||
        if(sender instanceof Player p) {
 | 
					        if(sender instanceof Player p) {
 | 
				
			||||||
            Location playerLocation = p.getLocation();
 | 
					            Location playerLocation = p.getLocation().toBlockLocation();
 | 
				
			||||||
 | 
					            double scale = (double) 1/16;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            for (int i = 0; i < 8; i++) {
 | 
					            for (int i = 0; i < 16; i++) {
 | 
				
			||||||
                int finalI = i+1;
 | 
					                int finalI = i+1;
 | 
				
			||||||
                for (int j = 0; j < 8; j++) {
 | 
					                for (int j = 0; j < 16; j++) {
 | 
				
			||||||
                    int finalJ = j+1;
 | 
					                    int finalJ = j+1;
 | 
				
			||||||
                    p.getWorld().spawn(
 | 
					
 | 
				
			||||||
                        new Location(p.getWorld(),
 | 
					                    double blockPositionX = playerLocation.x()+i*scale;
 | 
				
			||||||
                                playerLocation.x()+i,
 | 
					                    double blockPositionY = playerLocation.y();
 | 
				
			||||||
                                playerLocation.y(),
 | 
					                    double blockPositionZ = playerLocation.z()+j*scale;
 | 
				
			||||||
                                playerLocation.z()+j),
 | 
					
 | 
				
			||||||
                        BlockDisplay.class, blockDisplay -> {
 | 
					                    BlockDisplay bd;
 | 
				
			||||||
                            if(finalI % 2 == 0 && finalJ % 2 == 0) {
 | 
					                    bd = (BlockDisplay) p.getWorld().spawnEntity(
 | 
				
			||||||
                                blockDisplay.setBlock(Material.BLACK_CONCRETE.createBlockData());
 | 
					                        new Location(p.getWorld(), blockPositionX, blockPositionY, blockPositionZ),
 | 
				
			||||||
                            } else if(finalI % 2 != 0 && finalJ % 2 != 0) {
 | 
					                            EntityType.BLOCK_DISPLAY
 | 
				
			||||||
                                blockDisplay.setBlock(Material.BLACK_CONCRETE.createBlockData());
 | 
					 | 
				
			||||||
                            } else {
 | 
					 | 
				
			||||||
                                blockDisplay.setBlock(Material.WHITE_CONCRETE.createBlockData());
 | 
					 | 
				
			||||||
                            }
 | 
					 | 
				
			||||||
                            blockDisplay.setDisplayHeight(0.5f);
 | 
					 | 
				
			||||||
                            blockDisplay.setDisplayWidth(0.5f);
 | 
					 | 
				
			||||||
                        }
 | 
					 | 
				
			||||||
                    );
 | 
					                    );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    if(finalI % 2 == 0 && finalJ % 2 == 0) {
 | 
				
			||||||
 | 
					                        bd.setBlock(Material.BLACK_CONCRETE.createBlockData());
 | 
				
			||||||
 | 
					                    } else if(finalI % 2 != 0 && finalJ % 2 != 0) {
 | 
				
			||||||
 | 
					                        bd.setBlock(Material.BLACK_CONCRETE.createBlockData());
 | 
				
			||||||
 | 
					                    } else {
 | 
				
			||||||
 | 
					                        bd.setBlock(Material.WHITE_CONCRETE.createBlockData());
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    Transformation transform = bd.getTransformation();
 | 
				
			||||||
 | 
					                    transform.getScale().set(scale);
 | 
				
			||||||
 | 
					                    bd.setTransformation(transform);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
 | 
					            sender.sendMessage("This command is only for real Players!");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        return(true);
 | 
					        return(true);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
        return true;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user