-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
XIII-MC
committed
Oct 18, 2024
1 parent
312c02c
commit da62c0c
Showing
2 changed files
with
51 additions
and
0 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
44 changes: 44 additions & 0 deletions
44
src/main/java/net/gteam/wave/playerdata/processors/impl/GhostBlockProcessor.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,44 @@ | ||
package net.gteam.wave.playerdata.processors.impl; | ||
|
||
import net.gteam.wave.managers.profile.Profile; | ||
import net.gteam.wave.playerdata.data.impl.MovementData; | ||
import net.gteam.wave.playerdata.processors.Processor; | ||
import net.gteam.wave.utils.TaskUtils; | ||
import org.bukkit.Bukkit; | ||
import org.bukkit.Location; | ||
import org.bukkit.Material; | ||
import org.bukkit.block.Block; | ||
import org.bukkit.entity.Player; | ||
|
||
public class GhostBlockProcessor implements Processor { | ||
|
||
private final Profile profile; | ||
|
||
public GhostBlockProcessor(final Profile profile) { | ||
this.profile = profile; | ||
} | ||
|
||
@Override | ||
public void process() { | ||
|
||
final MovementData movementData = profile.getMovementData(); | ||
|
||
if (movementData.isOnGround() && movementData.isServerGround()) { | ||
|
||
if (movementData.getNearGroundTicks() >= 2) { | ||
|
||
final Player player = profile.getPlayer(); | ||
|
||
TaskUtils.task(() -> { | ||
|
||
player.getLocation().subtract(0, 1, 0).getBlock().setType(Material.STONE); | ||
|
||
player.sendBlockChange(player.getLocation().subtract(0, 1, 0), player.getLocation().subtract(0, 1, 0).getBlock().getBlockData()); | ||
|
||
Bukkit.broadcastMessage("Ghost block processed for " + player.getName()); | ||
|
||
}); | ||
} | ||
} | ||
} | ||
} |