Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# (All credits to [stdNullPtr/TorchLight-SpigotMC](https://github.com/stdNullPtr/TorchLight-SpigotMC))

# TorchLight - Offhand Torch Light Plugin

**Minecraft API:** 1.19
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ public PlayerActivityEventListener(final PluginMain plugin) {
public void onPlayerMove(final PlayerMoveEvent event) {
final Player player = event.getPlayer();
final UUID playerId = player.getUniqueId();

// Skip if off permission
if(player.hasPermission("torchlight.off") == true) {
return;
}

// Skip if moved too recently
final long currentTime = System.currentTimeMillis();
Expand Down Expand Up @@ -85,6 +90,10 @@ public void onPlayerMove(final PlayerMoveEvent event) {

// Schedule task to revert the block to its original state
Bukkit.getScheduler().runTaskLater(plugin, () -> {
// Skip if permanent permission
if(player.hasPermission("torchlight.permanent")) {
return;
}
if (blockAtPlayerLocation.getType() == Material.LIGHT &&
playerLightLocations.containsKey(playerId) &&
playerLightLocations.get(playerId).equals(blockLocationAtPlayer)
Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,9 @@ permissions:
torchlight.toggle:
description: Allows toggling the offhand torch lighting feature.
default: op
torchlight.off:
description: Disable light for the player.
default: false
torchlight.permanent:
description: offhand torch never light off.
default: false