refactors and basic api

This commit is contained in:
YouHaveTrouble
2021-02-19 04:02:06 +01:00
parent 905861079f
commit 8626d79825
32 changed files with 189 additions and 177 deletions
@@ -0,0 +1,27 @@
package eu.endermite.togglepvp;
import eu.endermite.togglepvp.players.SmartCache;
import java.util.UUID;
public class TogglePvpAPI {
/**
* Sets player PvP state. This will always save to database.
* @param uuid uuid of player to set
* @param newState State to set
*/
public static void setPvpEnabled(UUID uuid, boolean newState) {
SmartCache.setPlayerPvpState(uuid, newState);
}
/**
* Gets player's PvP state. If player is not cached this will query the database.
* @param uuid uuid of player to get data from.
* @return true if enabled, false if disabled
*/
public static boolean getPvpEnabled(UUID uuid) {
return SmartCache.getPlayerData(uuid).isPvpEnabled();
}
}