forked from TownyAdvanced/Towny
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'TownyAdvanced:master' into fork
- Loading branch information
Showing
71 changed files
with
2,073 additions
and
480 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
...rc/main/java/com/palmergames/bukkit/towny/event/teleport/CancelledTownyTeleportEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package com.palmergames.bukkit.towny.event.teleport; | ||
|
||
import org.bukkit.Bukkit; | ||
import org.bukkit.Location; | ||
import org.bukkit.event.Event; | ||
import org.bukkit.event.HandlerList; | ||
import org.jetbrains.annotations.NotNull; | ||
import com.palmergames.bukkit.towny.object.Resident; | ||
|
||
/** | ||
* An event thrown by Towny when a player that was supposed to teleport to the | ||
* /res, /town, or /nation spawn, but the action was cancelled. This can be due | ||
* to Movement, Damage or an Unknown source (when cancelled via the TownyAPI | ||
* class. | ||
* | ||
* @since 0.100.2.2 | ||
* @author LlmDl | ||
*/ | ||
public class CancelledTownyTeleportEvent extends Event { | ||
|
||
private static final HandlerList handlers = new HandlerList(); | ||
private final Resident resident; | ||
private final Location location; | ||
private final double teleportCost; | ||
private final CancelledTeleportReason reason; | ||
|
||
public CancelledTownyTeleportEvent(Resident resident, Location location, double teleportCost, CancelledTeleportReason reason) { | ||
super(!Bukkit.isPrimaryThread()); | ||
this.resident = resident; | ||
this.location = location; | ||
this.teleportCost = teleportCost; | ||
this.reason = reason; | ||
} | ||
|
||
/** | ||
* @return Resident which is not going to teleport. | ||
*/ | ||
public Resident getResident() { | ||
return resident; | ||
} | ||
|
||
/** | ||
* @return Location that resident was going to go to. | ||
*/ | ||
public Location getLocation() { | ||
return location; | ||
} | ||
|
||
/** | ||
* @return the amount of money which was refunded to the player. | ||
*/ | ||
public double getTeleportCost() { | ||
return teleportCost; | ||
} | ||
|
||
/** | ||
* @return the {@link CancelledTeleportReason} that the resident will not teleport. | ||
* When cancelled via the TownyAPI class, this will return UNKNOWN. | ||
*/ | ||
public CancelledTeleportReason getReason() { | ||
return reason; | ||
} | ||
|
||
@NotNull | ||
@Override | ||
public HandlerList getHandlers() { | ||
return handlers; | ||
} | ||
|
||
public static HandlerList getHandlerList() { | ||
return handlers; | ||
} | ||
|
||
public enum CancelledTeleportReason { | ||
MOVEMENT, DAMAGE, UNKNOWN | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.