LogoLogo
  • Welcome
  • zAPI
    • Usage
      • Getting Started
      • JavaDocs
  • zHomes
    • Commands & Permissions
    • Hooks
      • PlaceholderAPI
      • WorldGuard
      • Vault
    • Plugin Files
      • config.yml
      • menus/
        • menu-homes.yml
      • languages/
        • de.yml
        • en.yml
        • es.yml
        • fr.yml
        • it.yml
        • nl.yml
        • pl.yml
        • pt-br.yml
        • ru.yml
    • Developer API
      • Getting Started
      • Events
      • JavaDocs
Powered by GitBook

Copyright @ 2025 yLeoft

On this page
  • PreExecuteSethomeCommandEvent
  • PreExecuteDelhomeCommandEvent
  • PreExecuteHomeCommandEvent
  • ExecuteSethomeCommandEvent
  • ExecuteDelhomeCommandEvent
  • ExecuteHomesCommandEvent
  • ExecuteMainCommandEvent
  • TeleportToHomeEvent
  • Example

Was this helpful?

Export as PDF
  1. zHomes
  2. Developer API

Events

zHomes triggers a few events. You can find a list with all the events on this page.

PreviousGetting StartedNextJavaDocs

Last updated 10 days ago

Was this helpful?

You can see more detailed documentation about each holder and manager in the .

PreExecuteSethomeCommandEvent

Called when /sethome command is executed by a player

PreExecuteDelhomeCommandEvent

Called when /delhome command is executed by a player\

PreExecuteHomeCommandEvent

Called when /home command is executed by a player

ExecuteSethomeCommandEvent

Called when /sethome (Home) command is executed by a player

ExecuteDelhomeCommandEvent

Called when /delhome (Home) command is executed by a player

ExecuteHomesCommandEvent

Called when /homes command is executed by a player

ExecuteMainCommandEvent

Called when /zhomes command is executed by a playe

TeleportToHomeEvent

Called when a player is teleported to a home

Example

Example of a class listening to the PreExecuteSethomeCommandEvent and ExecuteSethomeCommandEvent and canceling it if the player's name is yLeoft (Or if the home's name is test)

On ExecuteSethomeCommandEvent it also sets the home to test if it's not the test home

JavaDocs
https://github.com/yL3oft/zHomes/blob/master/src/main/java/com/zhomes/api/examples/ExampleEvent.java
package com.zhomes.api.examples;

import com.zhomes.api.event.player.ExecuteSethomeCommandEvent;
import com.zhomes.api.event.player.PreExecuteSethomeCommandEvent;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;

public class ExampleEvent implements Listener {

    @EventHandler
    public void onPreExecuteSethomeCommandEvent(PreExecuteSethomeCommandEvent event) {
        Player player = event.getPlayer();
        if(player.getName().equals("yLeoft")) event.setCancelled(true);
    }

    @EventHandler
    public void onExecuteSethomeCommandEvent(ExecuteSethomeCommandEvent event) {
        Player player = event.getPlayer();
        String home = event.getHome();
        if(player.getName().equals("yLeoft")) event.setCancelled(true);
        if(home.equals("test")) event.setCancelled(true);
        else event.setHome("test");
    }

}