diff --git a/build.gradle b/build.gradle index 0ee839a..610b917 100644 --- a/build.gradle +++ b/build.gradle @@ -1,8 +1,9 @@ plugins { id 'java' + id 'maven-publish' } -version = '1.16_1.0.3' +version = '1.16_1.1.0' repositories { jcenter() @@ -19,4 +20,16 @@ repositories { dependencies { compileOnly 'org.spigotmc:spigot-api:1.16.1-R0.1-SNAPSHOT' +} + +publishing { + publications { + maven(MavenPublication) { + groupId 'nl.thedutchmc' + artifactId 'dutchyhome' + version '1.1.0' + + from components.java + } + } } \ No newline at end of file diff --git a/src/main/java/nl/thedutchmc/dutchyhome/CommandHandler.java b/src/main/java/nl/thedutchmc/dutchyhome/CommandHandler.java index b7e9cd3..bd30427 100644 --- a/src/main/java/nl/thedutchmc/dutchyhome/CommandHandler.java +++ b/src/main/java/nl/thedutchmc/dutchyhome/CommandHandler.java @@ -1,5 +1,6 @@ package nl.thedutchmc.dutchyhome; +import org.bukkit.Bukkit; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; @@ -18,6 +19,9 @@ public boolean onCommand(CommandSender sender, Command command, String label, St if(Home.homes.containsKey(senderP.getUniqueId())) { + SuccessfulHomeTeleportEvent event = new SuccessfulHomeTeleportEvent(senderP, senderP.getLocation()); + Bukkit.getPluginManager().callEvent(event); + sender.sendMessage(ChatColor.GOLD + "Teleporting..."); senderP.teleport(Home.homes.get(senderP.getUniqueId())); diff --git a/src/main/java/nl/thedutchmc/dutchyhome/SuccessfulHomeTeleportEvent.java b/src/main/java/nl/thedutchmc/dutchyhome/SuccessfulHomeTeleportEvent.java new file mode 100644 index 0000000..44efb68 --- /dev/null +++ b/src/main/java/nl/thedutchmc/dutchyhome/SuccessfulHomeTeleportEvent.java @@ -0,0 +1,57 @@ +package nl.thedutchmc.dutchyhome; + +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class SuccessfulHomeTeleportEvent extends Event implements Cancellable { + + private static final HandlerList HANDLERS_LIST = new HandlerList(); + private boolean isCancelled = false; + + private Player player; + private Location locationBeforeHomeTp; + + public SuccessfulHomeTeleportEvent(Player player, Location locationBeforeHomeTp) { + this.player = player; + this.locationBeforeHomeTp = locationBeforeHomeTp; + } + + @Override + public boolean isCancelled() { + return isCancelled; + } + + @Override + public void setCancelled(boolean isCancelled) { + this.isCancelled = isCancelled; + } + + @Override + public HandlerList getHandlers() { + return HANDLERS_LIST; + } + + public static HandlerList getHandlerList() { + return HANDLERS_LIST; + } + + public Player getPlayer() { + return player; + } + + public void setPlayer(Player player) { + this.player = player; + } + + public Location getLocationBeforeHomeTp() { + return locationBeforeHomeTp; + } + + public void setLocationBeforeHomeTp(Location locationBeforeHomeTp) { + this.locationBeforeHomeTp = locationBeforeHomeTp; + } + +} diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index e3e1643..1678e5b 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ name: DutchyHome main: nl.thedutchmc.dutchyhome.Home -version: 1.0.3 +version: 1.1.0 api-version: 1.16 author: TheDutchMC description: Homes!