Skip to content

Commit

Permalink
Place light blocks into games
Browse files Browse the repository at this point in the history
  • Loading branch information
lscgh committed Feb 6, 2024
1 parent eea0c87 commit 1b97327
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions mavenmcserver/src/main/java/mavenmcserver/game/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Levelled;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;

Expand Down Expand Up @@ -175,6 +177,20 @@ public void start() {
}
}

// Light blocks (to light up the game when it is night)
for(int x = 0; x < this.config.size.x - 1; x++) {
for(int y = 0; y < this.config.size.y - 1; y++) {
for(int z = 0; z < this.config.size.z - 1; z++) {
Block currentBlock = this.location.getWorld().getBlockAt(this.location.getBlockX() + 1 + x * 2, this.location.getBlockY() + 2 + y * 2, this.location.getBlockZ() + 1 + z * 2);
currentBlock.setType(Material.LIGHT);
Levelled levelledBlockData = (Levelled)currentBlock.getBlockData();
levelledBlockData.setLevel(13);
currentBlock.setBlockData(levelledBlockData);
}
}
}


this.gravityRunnable.runTaskTimer(this.plugin, 0, 10);

this.config.mainPlayer.sendMessage(ChatColor.AQUA + "" + ChatColor.BOLD + this.config.opponentPlayer.getName() + ChatColor.RESET + " has accepted your game!");
Expand Down

0 comments on commit 1b97327

Please sign in to comment.