This repository has been archived by the owner on Feb 24, 2024. It is now read-only.
forked from Minestom/Minestom
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
8 changed files
with
185 additions
and
187 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
demo/src/main/java/net/minestom/demo/commands/RelightCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package net.minestom.demo.commands; | ||
|
||
import net.minestom.server.command.builder.Command; | ||
import net.minestom.server.entity.Player; | ||
import net.minestom.server.instance.LightingChunk; | ||
|
||
public class RelightCommand extends Command { | ||
public RelightCommand() { | ||
super("relight"); | ||
setDefaultExecutor((source, args) -> { | ||
if (source instanceof Player player) { | ||
long start = System.currentTimeMillis(); | ||
source.sendMessage("Relighting..."); | ||
LightingChunk.relight(player.getInstance(), player.getInstance().getChunks()); | ||
source.sendMessage("Relighted " + player.getInstance().getChunks().size() + " chunks in " + (System.currentTimeMillis() - start) + "ms"); | ||
player.getInstance().getChunks().forEach(chunk -> chunk.sendChunk(player)); | ||
source.sendMessage("Chunks Received"); | ||
} | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.