Skip to content

Commit

Permalink
Integration Update
Browse files Browse the repository at this point in the history
- Added SuccessfulHomeTeleportEvent, fired when you teleport to your home
- Added MavenPublisher plugin, and its required components
  • Loading branch information
TheDutchMC committed Jul 1, 2020
1 parent cebe31a commit d5d1132
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 2 deletions.
15 changes: 14 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
plugins {
id 'java'
id 'maven-publish'
}

version = '1.16_1.0.3'
version = '1.16_1.1.0'

repositories {
jcenter()
Expand All @@ -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
}
}
}
4 changes: 4 additions & 0 deletions src/main/java/nl/thedutchmc/dutchyhome/CommandHandler.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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()));

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}

}
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -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!
Expand Down

0 comments on commit d5d1132

Please sign in to comment.