Rename packages to lower case

This commit is contained in:
Daniil Z committed 2021-02-28 23:12:14 +03:00
1 parent eed97287b3
commit d61d76f3f3
76 files changed
+166 -171

No files matched your search

@@ -0,0 +1,125 @@
package me.william278.huskhomes2.api;
import me.william278.huskhomes2.objects.Home;
import me.william278.huskhomes2.objects.TeleportationPoint;
import me.william278.huskhomes2.objects.Warp;
import me.william278.huskhomes2.dataManager;
import me.william278.huskhomes2.teleportManager;
import org.bukkit.entity.Player;
import java.util.ArrayList;
/**
* The HuskHomes API
* Only use methods/events found within the API package
*/
public class HuskHomesAPI {
public HuskHomesAPI() { }
/**
Returns a Home set by a player, or NULL if it does not exist
@param player A player
@param homeName Name of the player's home you wish to retrieve
@return the player's Home, or NULL if it does not exist
@see Home
*/
public Home getHome(Player player, String homeName) {
return getHome(player.getName(), homeName);
}
/**
Returns a Home set by a player, or NULL if it does not exist
@param ownerUsername Username of the player
@param homeName Name of the player's home you wish to retrieve
@return the player's Home, or NULL if it does not exist
@see Home
*/
public Home getHome(String ownerUsername, String homeName) {
return dataManager.getHome(ownerUsername, homeName);
}
/**
Returns a Warp set on the server, or NULL if it does not exist
@param warpName Name of the warp
@return a Warp, or NULL if it does not exist
@see Warp
*/
public Warp getWarp(String warpName) {
return dataManager.getWarp(warpName);
}
/**
Returns an ArrayList of homes set by a Player
@param player A Player
@return an ArrayList of Homes
@see Home
*/
public ArrayList<Home> getHomes(Player player) {
return dataManager.getPlayerHomes(player.getName());
}
/**
Returns an ArrayList of homes set by a player
@param ownerUsername Username of the player who's homes you want to get
@return an ArrayList of Homes
@see Home
*/
public ArrayList<Home> getHomes(String ownerUsername) {
return dataManager.getPlayerHomes(ownerUsername);
}
/**
* Returns how many Homes a given Player has set
* @param player the Player being checked
* @return an integer of how many homes a player has set
* @see Home
*/
public int getHomeCount(Player player) {
return getHomes(player).size();
}
/**
Returns an ArrayList of all the public homes set
@return an ArrayList of Homes
@see Home
*/
public ArrayList<Home> getPublicHomes() {
return dataManager.getPublicHomes();
}
/**
* Returns how many public Homes there are
* @return an integer of how many public homes there are
* @see Home
*/
public int getPublicHomeCount() {
return getPublicHomes().size();
}
/**
Returns an ArrayList of all the warps set
@return an ArrayList of Warps
@see Warp
*/
public ArrayList<Warp> getWarps() {
return dataManager.getWarps();
}
/**
* Returns how many Warps have been set
* @return an integer of how many warps have been set
* @see Warp
*/
public int getWarpCount() {
return getWarps().size();
}
/**
* Returns the current spawn position as a TeleportationPoint
* @return the spawn position as a TeleportationPoint
*/
public TeleportationPoint getSpawnPosition() {
return teleportManager.spawnLocation;
}
}
@@ -0,0 +1,42 @@
package me.william278.huskhomes2.api.events;
import me.william278.huskhomes2.objects.Home;
import org.bukkit.entity.Player;
/**
* An event, fired when a player changes the description of a home.
*/
public class PlayerChangeHomeDescriptionEvent extends PlayerHomeUpdateEvent {
private final String oldDescription;
private final String newDescription;
/**
* An event, fired when a player changes the description of a home.
* @param player The Player who is changing the home's description
* @param home The Home being changed
* @param newDescription The new description being set
* @see PlayerHomeUpdateEvent
*/
public PlayerChangeHomeDescriptionEvent(Player player, Home home, String newDescription) {
super(player, home);
this.oldDescription = home.getDescription();
this.newDescription = newDescription;
}
/**
* Returns the old description of the home
* @return the old description String
*/
public String getOldDescription() {
return oldDescription;
}
/**
* Returns the new description being set to the home
* @return the new description String
*/
public String getNewDescription() {
return newDescription;
}
}
@@ -0,0 +1,40 @@
package me.william278.huskhomes2.api.events;
import me.william278.huskhomes2.objects.Warp;
import org.bukkit.entity.Player;
/**
An event, fired when a player changes the description of a warp.
*/
public class PlayerChangeWarpDescriptionEvent extends PlayerWarpUpdateEvent {
private final String oldDescription;
private final String newDescription;
/**
* An event, fired when a player changes the description of a warp.
* @param player The Player who is changing the warp's description
* @param warp The Warp being changed
* @param newDescription The new description being set
* @see PlayerWarpUpdateEvent
*/
public PlayerChangeWarpDescriptionEvent(Player player, Warp warp, String newDescription) {
super(player, warp);
this.oldDescription = warp.getDescription();
this.newDescription = newDescription;
}
/**
* Returns the old description of the home
* @return the old description String
*/
public String getOldDescription() {
return oldDescription;
}
/**
* Returns the new description being set to the home
* @return the new description String
*/
public String getNewDescription() {
return newDescription;
}}
@@ -0,0 +1,19 @@
package me.william278.huskhomes2.api.events;
import me.william278.huskhomes2.objects.Home;
import org.bukkit.entity.Player;
/**
* An event, fired when a player deletes a home
*/
public class PlayerDeleteHomeEvent extends PlayerHomeUpdateEvent {
/**
* An event, fired when a player deletes a home
* @param player The Player who is deleting the home
* @param home The Home being deleted
* @see PlayerHomeUpdateEvent
*/
public PlayerDeleteHomeEvent(Player player, Home home) {
super(player, home);
}
}
@@ -0,0 +1,19 @@
package me.william278.huskhomes2.api.events;
import me.william278.huskhomes2.objects.Warp;
import org.bukkit.entity.Player;
/**
* An event, fired when a player deletes a warp
*/
public class PlayerDeleteWarpEvent extends PlayerWarpUpdateEvent {
/**
* An event, fired when a player deletes a warp
* @param player The Player who is deleting the warp
* @param warp The Warp being deleted
* @see PlayerWarpUpdateEvent
*/
public PlayerDeleteWarpEvent(Player player, Warp warp) {
super(player, warp);
}
}
@@ -0,0 +1,67 @@
package me.william278.huskhomes2.api.events;
import me.william278.huskhomes2.objects.Home;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
/**
* An event, fired when a home is updated
* Fires when a player renames a Home, updates its' location, changes its' name, changes whether or not it is public/private.
* Also fires when it is deleted
*/
public class PlayerHomeUpdateEvent extends Event implements Cancellable {
private final Player player;
private final Home home;
private static final HandlerList HANDLER_LIST = new HandlerList();
private boolean isCancelled;
/**
* An event, fired when a home is updated
* Fires when a player renames a Home, updates its' location, changes its' name, changes whether or not it is public/private, or when it is deleted
* Does not fire when a player sets a Home
*
* @param player The Player who is updating the Home
* @param home The Home being changed
*/
public PlayerHomeUpdateEvent(Player player, Home home) {
this.player = player;
this.home = home;
this.isCancelled = false;
}
@Override
public boolean isCancelled() {
return isCancelled;
}
@Override
public void setCancelled(boolean cancelled) {
this.isCancelled = cancelled;
}
@Override
public HandlerList getHandlers() {
return HANDLER_LIST;
}
/**
* Get the Player involved in this event
*
* @return the Player who updated the home
*/
public Player getPlayer() {
return player;
}
/**
* Get the Player involved in this event
*
* @return the Home being updated
*/
public Home getHome() {
return home;
}
}
@@ -0,0 +1,19 @@
package me.william278.huskhomes2.api.events;
import me.william278.huskhomes2.objects.Home;
import org.bukkit.entity.Player;
/**
* An event, fired when a player makes a home private
*/
public class PlayerMakeHomePrivateEvent extends PlayerHomeUpdateEvent {
/**
* An event, fired when a player makes a home private
* @param player The Player who is making the Home private
* @param home The Home being changed
* @see PlayerHomeUpdateEvent
*/
public PlayerMakeHomePrivateEvent(Player player, Home home) {
super(player, home);
}
}
@@ -0,0 +1,19 @@
package me.william278.huskhomes2.api.events;
import me.william278.huskhomes2.objects.Home;
import org.bukkit.entity.Player;
/**
* An event, fired when a player makes a home public
*/
public class PlayerMakeHomePublicEvent extends PlayerHomeUpdateEvent {
/**
* An event, fired when a player makes a home public
* @param player The Player who is making the Home public
* @param home The Home being changed
* @see PlayerHomeUpdateEvent
*/
public PlayerMakeHomePublicEvent(Player player, Home home) {
super(player, home);
}
}
@@ -0,0 +1,43 @@
package me.william278.huskhomes2.api.events;
import me.william278.huskhomes2.objects.Home;
import me.william278.huskhomes2.objects.TeleportationPoint;
import org.bukkit.entity.Player;
/**
* An event, fired when a player edits a Warp to change it's location
*/
public class PlayerRelocateHomeEvent extends PlayerHomeUpdateEvent {
final TeleportationPoint oldTeleportationPoint;
final TeleportationPoint newTeleportationPoint;
/**
* An event, fired when a player relocates a home
* @param player The Player who is relocating the Home
* @param home The Home being moved
* @param newTeleportationPoint The new teleportation position of the Home
* @see PlayerWarpUpdateEvent
*/
public PlayerRelocateHomeEvent(Player player, Home home, TeleportationPoint newTeleportationPoint) {
super(player, home);
this.oldTeleportationPoint = home;
this.newTeleportationPoint = newTeleportationPoint;
}
/**
* Returns the teleportation position of the Home before it is updated
* @return the pre-update teleportation position
*/
public TeleportationPoint getOldTeleportationPoint() {
return oldTeleportationPoint;
}
/**
* Returns the updated teleportation position of the Home
* @return the updated teleportation position
*/
public TeleportationPoint getNewTeleportationPoint() {
return newTeleportationPoint;
}
}
@@ -0,0 +1,43 @@
package me.william278.huskhomes2.api.events;
import me.william278.huskhomes2.objects.TeleportationPoint;
import me.william278.huskhomes2.objects.Warp;
import org.bukkit.entity.Player;
/**
* An event, fired when a player edits a Warp to change it's location
*/
public class PlayerRelocateWarpEvent extends PlayerWarpUpdateEvent {
final TeleportationPoint oldTeleportationPoint;
final TeleportationPoint newTeleportationPoint;
/**
* An event, fired when a player relocates a warp
* @param player The Player who is relocating the Warp
* @param warp The Warp being moved
* @param newTeleportationPoint The new teleportation position of the Warp
* @see PlayerWarpUpdateEvent
*/
public PlayerRelocateWarpEvent(Player player, Warp warp, TeleportationPoint newTeleportationPoint) {
super(player, warp);
this.oldTeleportationPoint = warp;
this.newTeleportationPoint = newTeleportationPoint;
}
/**
* Returns the teleportation position of the Warp before it is updated
* @return the pre-update teleportation position
*/
public TeleportationPoint getOldTeleportationPoint() {
return oldTeleportationPoint;
}
/**
* Returns the updated teleportation position of the Warp
* @return the updated teleportation position
*/
public TeleportationPoint getNewTeleportationPoint() {
return newTeleportationPoint;
}
}
@@ -0,0 +1,42 @@
package me.william278.huskhomes2.api.events;
import me.william278.huskhomes2.objects.Home;
import org.bukkit.entity.Player;
/**
* An event, fired when a player renames a home
*/
public class PlayerRenameHomeEvent extends PlayerHomeUpdateEvent {
private final String oldName;
private final String newName;
/**
* An event, fired when a player changes the name of a home
* @param player The Player who is changing the Home's name
* @param home The Home being changed
* @param newName The new name of the home
* @see PlayerHomeUpdateEvent
*/
public PlayerRenameHomeEvent(Player player, Home home, String newName) {
super(player, home);
this.oldName = home.getName();
this.newName = newName;
}
/**
* Get the name of the Home pre-update
* @return the name of the Home before it is updated
*/
public String getOldName() {
return oldName;
}
/**
* Get the changed name of the Home
* @return the new name of the Home
*/
public String getNewName() {
return newName;
}
}
@@ -0,0 +1,40 @@
package me.william278.huskhomes2.api.events;
import me.william278.huskhomes2.objects.Warp;
import org.bukkit.entity.Player;
/**
* An event, fired when a player renames a warp
*/
public class PlayerRenameWarpEvent extends PlayerWarpUpdateEvent {
private final String oldName;
private final String newName;
/**
* An event, fired when a player changes the name of a warp
* @param player The Player who is changing the Warp's name
* @param warp The Warp being changed
* @param newName The new name of the warp
* @see PlayerWarpUpdateEvent
*/
public PlayerRenameWarpEvent(Player player, Warp warp, String newName) {
super(player, warp);
this.oldName = warp.getName();
this.newName = newName;
}
/**
* Get the name of the Warp pre-update
* @return the name of the Warp before it is updated
*/
public String getOldName() {
return oldName;
}
/**
* Get the changed name of the Warp
* @return the new name of the Warp
*/
public String getNewName() {
return newName;
}}
@@ -0,0 +1,60 @@
package me.william278.huskhomes2.api.events;
import me.william278.huskhomes2.objects.Home;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
/**
* An event, fired when a player sets a new home
*/
public class PlayerSetHomeEvent extends Event implements Cancellable {
private Player player;
private Home home;
private static final HandlerList HANDLER_LIST = new HandlerList();
private boolean isCancelled;
/**
* An event, fired when a player sets a Home
* @param player the Player setting the Home
* @param home the Home being set
*/
public PlayerSetHomeEvent(Player player, Home home) {
this.player = player;
this.home = home;
this.isCancelled = false;
}
@Override
public boolean isCancelled() {
return isCancelled;
}
@Override
public void setCancelled(boolean cancelled) {
this.isCancelled = cancelled;
}
@Override
public HandlerList getHandlers() {
return HANDLER_LIST;
}
/**
* Get the player involved in this event
* @return the Player who is setting the home
*/
public Player getPlayer() {
return player;
}
/**
* Get the Home being set
* @return the Home being set
*/
public Home getHome() {
return home;
}
}
@@ -0,0 +1,60 @@
package me.william278.huskhomes2.api.events;
import me.william278.huskhomes2.objects.Warp;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
/**
* An event, fired when a player sets a new warp
*/
public class PlayerSetWarpEvent extends Event implements Cancellable {
private final Player player;
private final Warp warp;
private static final HandlerList HANDLER_LIST = new HandlerList();
private boolean isCancelled;
/**
* An event, fired when a Player sets a Warp
* @param player the Player setting the warp
* @param warp the Warp being set
*/
public PlayerSetWarpEvent(Player player, Warp warp) {
this.player = player;
this.warp = warp;
this.isCancelled = false;
}
@Override
public boolean isCancelled() {
return isCancelled;
}
@Override
public void setCancelled(boolean cancelled) {
this.isCancelled = cancelled;
}
@Override
public HandlerList getHandlers() {
return HANDLER_LIST;
}
/**
* Get the Player involved in this event
* @return the Player who is setting the warp
*/
public Player getPlayer() {
return player;
}
/**
* Get the Warp being set
* @return the Warp that is being set
*/
public Warp getWarp() {
return warp;
}
}
@@ -0,0 +1,64 @@
package me.william278.huskhomes2.api.events;
import me.william278.huskhomes2.objects.Warp;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
/**
* An event, fired when a warp is updated
* Fires when a player renames a Warp, updates its' location or changes its' name.
* Also fires when a warp is deleted
*/
public class PlayerWarpUpdateEvent extends Event implements Cancellable {
private final Player player;
private final Warp warp;
private static final HandlerList HANDLER_LIST = new HandlerList();
private boolean isCancelled;
/**
* An event, fired when a Warp is updated.
* Fires when a player renames a Warp, updates its' location, changes its' name or when it is deleted.
* Does not fire when a player sets a Warp.
* @param player The Player who is updating the Warp
* @param warp The Warp being changed
*/
public PlayerWarpUpdateEvent(Player player, Warp warp) {
this.player = player;
this.warp = warp;
this.isCancelled = false;
}
@Override
public boolean isCancelled() {
return isCancelled;
}
@Override
public void setCancelled(boolean cancelled) {
this.isCancelled = cancelled;
}
@Override
public HandlerList getHandlers() {
return HANDLER_LIST;
}
/**
* Get the Player involved in this event
* @return the Player who updated the Warp
*/
public Player getPlayer() {
return player;
}
/**
* Get the Warp being updated
* @return the Warp being updated
*/
public Warp getWarp() {
return warp;
}
}