mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 22:17:17 +00:00
Add /rtp with normal distribution, economy hook, home limits, new tests, locales
This commit is contained in:
1 parent
0bb33c6f1e
commit
08e6569027
39 files changed
+1128
-188
No files matched your search
@@ -0,0 +1,40 @@
|
||||
package net.william278.huskhomes.hook;
|
||||
|
||||
import net.william278.huskhomes.HuskHomes;
|
||||
import net.william278.huskhomes.player.OnlineUser;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* A hook that provides economy features
|
||||
*/
|
||||
public abstract class EconomyHook extends PluginHook {
|
||||
|
||||
protected EconomyHook(@NotNull HuskHomes implementor, @NotNull String hookName) {
|
||||
super(implementor, hookName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the balance of a player
|
||||
*
|
||||
* @param player the player to get the balance of
|
||||
* @return the balance of the player
|
||||
*/
|
||||
public abstract double getPlayerBalance(@NotNull OnlineUser player);
|
||||
|
||||
/**
|
||||
* Set the balance of a player
|
||||
*
|
||||
* @param player the player to set the balance of
|
||||
* @param amount the amount to set the balance to
|
||||
*/
|
||||
public abstract void changePlayerBalance(@NotNull OnlineUser player, final double amount);
|
||||
|
||||
/**
|
||||
* Format a balance to a string
|
||||
*
|
||||
* @param amount the amount to format
|
||||
* @return the formatted string
|
||||
*/
|
||||
public abstract String formatCurrency(final double amount);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package net.william278.huskhomes.hook;
|
||||
|
||||
import net.william278.huskhomes.HuskHomes;
|
||||
import net.william278.huskhomes.HuskHomesInitializationException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* A plugin hook, where HuskHomes hooks into another plugin
|
||||
*/
|
||||
public abstract class PluginHook {
|
||||
|
||||
/**
|
||||
* The plugin that this hook is for
|
||||
*/
|
||||
protected final HuskHomes plugin;
|
||||
|
||||
/**
|
||||
* The name of the hook
|
||||
*/
|
||||
protected final String hookName;
|
||||
|
||||
/**
|
||||
* Construct a new {@link PluginHook}
|
||||
*
|
||||
* @param implementor the {@link HuskHomes} instance
|
||||
*/
|
||||
protected PluginHook(@NotNull HuskHomes implementor, @NotNull String hookName) {
|
||||
this.plugin = implementor;
|
||||
this.hookName = hookName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the hook and return {@code true} if it could be enabled
|
||||
*
|
||||
* @return {@code true} if the hook could be enabled
|
||||
* @throws HuskHomesInitializationException if an exception occurred enabling the hook
|
||||
*/
|
||||
public abstract boolean initialize() throws HuskHomesInitializationException;
|
||||
|
||||
@NotNull
|
||||
public String getHookName() {
|
||||
return hookName;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user