Skip to content

Added /fly command and adjusted sleep requirement.#335

Open
junerhobart wants to merge 10 commits intooddlama:mainfrom
junerhobart:main
Open

Added /fly command and adjusted sleep requirement.#335
junerhobart wants to merge 10 commits intooddlama:mainfrom
junerhobart:main

Conversation

@junerhobart
Copy link

Changes

  • Added /fly command Players can now fly within their own region or any region where they have build permissions.

  • Adjusted bedtime percentage Reduced required sleep percentage from 50% to 20%.

June Hobart added 2 commits October 14, 2025 14:21
### Changes

- Added `/fly` command
  Players can now fly within their own region or any region where they have build permissions.

- Adjusted bedtime percentage
  Reduced required sleep percentage from **50%** to **20%**.
Updated the webpage to reflect my previous changes being /fly in regions and 50% sleep requirement to 20%
@junerhobart
Copy link
Author

If you have any questions please contact me at "@junologist" on discord

// Configuration
@ConfigDouble(
def = 0.5,
def = 0.2,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if changing this default value is a good idea.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, please remove that change

private static final long FALL_DAMAGE_PROTECTION_MS = 15000; // 15 seconds

// Track players who manually disabled flight via /fly (opt-out of auto-fly)
private java.util.HashSet<UUID> manual_fly_opt_out = new java.util.HashSet<>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can directly import HashSet

Comment on lines 97 to 99
if (event.getFrom().getBlockX() == event.getTo().getBlockX() &&
event.getFrom().getBlockY() == event.getTo().getBlockY() &&
event.getFrom().getBlockZ() == event.getTo().getBlockZ()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idk if event.getFrom.equals(event.getTo()) works here?


// Track players who are protected from fall damage after leaving a region
private Map<UUID, Long> fall_damage_protected = new HashMap<>();
private static final long FALL_DAMAGE_PROTECTION_MS = 15000; // 15 seconds
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be configurable

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will make sure to add that

final var region = get_module().region_at(player.getLocation());

if (region == null) {
player.sendMessage("§cYou must be inside a region to use this command.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This hard-coded message should be translatable

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot about that that might take a while for all of them

get_module().fly_manager.set_manual_opt_out(player.getUniqueId(), true);
// Stop visualizing the region
get_module().stop_visualizing_region(player.getUniqueId());
player.sendMessage("§aFlight disabled.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This hard-coded message should be translatable

get_module().fly_manager.set_manual_opt_out(player.getUniqueId(), false);
// Start visualizing the region
get_module().start_visualizing_region(player.getUniqueId(), region);
player.sendMessage("§aFlight enabled.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This hard-coded message should be translatable


if (get_module().is_visualizing_region(player_id)) {
get_module().stop_visualizing_region(player_id);
player.sendMessage("§cRegion visualization disabled.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This hard-coded message should be translatable

} else {
final var region = get_module().region_at(player.getLocation());
if (region == null) {
player.sendMessage("§cYou must be inside a region to visualize it.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This hard-coded message should be translatable

}

get_module().start_visualizing_region(player_id, region);
player.sendMessage("§aVisualizing region boundaries. Use §b/region visualize§a again to disable.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This hard-coded message should be translatable

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file seems quite old but idk if we should delete it

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It definitely is old. But you are right, if we decide to delete it, it probably shouldn't be in this PR. So let's keep it for now.

docs/index.html Outdated
Comment on lines 2166 to 2170
<li>Upon entering a region where you have permissions, flight is automatically enabled—just double-jump to start flying</li>
<li>Use <code>/fly</code> to manually toggle flight on/off with visual feedback</li>
<li>Particle visualization shows region boundaries while flying, automatically updating when moving between regions</li>
<li>Fall damage protection is provided when exiting a region while airborne</li>
<li>Flight automatically disables when leaving the region or entering an area without permissions</li>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These sentences does not have points at the end.

docs/index.html Outdated
<blockquote>
<p>Why can't I build anything?</p>
</blockquote>
"</blockquote>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trailing quote

Comment on lines 157 to 167
final var region = get_module().all_regions().stream()
.filter(r -> r.id().equals(region_id))
.findFirst()
.orElse(null);

if (region != null) {
// Mark as actively flying
flying_players.put(player_id, region_id);
// Start visualizing the region
get_module().start_visualizing_region(player_id, region);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ifPresent could be used here

get_module().all_regions().stream()
  .filter(r -> r.id().equals(region_id))
  .findFirst()
  .ifPresent(region -> {
     // Mark as actively flying
     flying_players.put(player_id, region_id);
     // Start visualizing the region
     get_module().start_visualizing_region(player_id, region);
  });

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It definitely is old. But you are right, if we decide to delete it, it probably shouldn't be in this PR. So let's keep it for now.

// Configuration
@ConfigDouble(
def = 0.5,
def = 0.2,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, please remove that change

junerhobart and others added 2 commits February 23, 2026 16:37
- revert sleep threshold default back to 0.5
- restore org.json relocation in build.gradle.kts
- import HashSet directly instead of fully-qualified
- fall damage protection now always applies, not just when high up
- simplify fall damage check using remove()
- use StringUtils.removeStart instead of substring
- drop /vane reload from graylist docs, just restart
- fix missing leading slash on perm add commands in graylist
- move flight in regions docs to regions.md source file
Copy link
Contributor

@Sylfare Sylfare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other lang files are not updated yet


### Quick start

- Enable in `vane-admin` config: set `world_protection.enabled: true`, then restart the server.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does /vane reload works here, or do you really have to restart the server?

docs/index.html Outdated
<div id="body-feature-vane-bedtime--night_to_day" class="hidden">
<div class="p-5 border border-b-0 border-gray-200 dark:border-gray-700 dark:bg-gray-900">
<div class="prose prose-slate prose-img:rounded-xl prose-img:w-1/3 prose-img:sm:m-4 prose-img:w-full prose-img:sm:w-1/2 prose-img:lg:w-2/5 prose-img:min-w-32 prose-img:max-w-full prose-img:float-right prose-img:clear-right prose-h1:clear-right prose-h2:clear-right prose-img:float-right dark:prose-invert max-w-none"><p>Once at least 50% of all players in the world are asleep, the night is skipped with a smooth transition to the next day.</p></div>
<div class="prose prose-slate prose-img:rounded-xl prose-img:w-1/3 prose-img:sm:m-4 prose-img:w-full prose-img:sm:w-1/2 prose-img:lg:w-2/5 prose-img:min-w-32 prose-img:max-w-full prose-img:float-right prose-img:clear-right prose-h1:clear-right prose-h2:clear-right prose-img:float-right dark:prose-invert max-w-none"><p>Once at least 20% of all players in the world are asleep, the night is skipped with a smooth transition to the next day.</p></div>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The limit is back to 50%, you should regenerate the docs

Comment on lines +74 to +76
if (region == null) {
return false;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a doubt about this: does it allows players who can fly with some other ways, like Essentials' /fly command?

Comment on lines 202 to 211
if (!(event.getEntity() instanceof Player)) {
return;
}

// Only handle fall damage
if (event.getCause() != EntityDamageEvent.DamageCause.FALL) {
return;
}

final var player = (Player) event.getEntity();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can avoid the cast on L211 by adding the variable name after instanceof

if (!(event.getEntity() instanceof Player player)) {
    return;
}
      
// Only handle fall damage
if (event.getCause() != EntityDamageEvent.DamageCause.FALL) {
    return;
}

final var player_id = player.getUniqueId();

Comment on lines 16 to 19
shadowJar {
configurations = listOf()
relocate("org.json", "org.oddlama.vane.external.json")
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know enough about shadowing, but I'm not sure this is a good idea to remove it

- fix bedtime docs still showing 20% instead of 50%
- restore org.json relocation in vane-trifles
- use instanceof pattern matching in fall damage handler
- don't manage flight for players who already have it from elsewhere (Essentials etc)
- add fly/visualize lang keys to all non-English lang files, bump to version 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants