use of biz.princeps.landlord.persistent.LPlayer in project LandLord by SpatiumPrinceps.
the class LPlayerManager method getInactiveRemainingDays.
private Long getInactiveRemainingDays(UUID owner) {
long days = plugin.getConfig().getInt("BuyUpInactive.timegate");
LPlayer lPlayer = getLPlayer(owner);
if (lPlayer != null) {
return days - (Duration.between(LocalDateTime.now(), lPlayer.getLastSeen()).toDays());
}
return -1L;
}
use of biz.princeps.landlord.persistent.LPlayer in project LandLord by SpatiumPrinceps.
the class LPlayerManager method save.
public void save(UUID id) {
LPlayer lp = get(id);
Landlord.getInstance().getDatabaseAPI().saveObject(lp);
}
use of biz.princeps.landlord.persistent.LPlayer in project LandLord by SpatiumPrinceps.
the class Info method onInfo.
public void onInfo(Player player) {
if (plugin.getConfig().getStringList("disabled-worlds").contains(player.getWorld().getName())) {
player.sendMessage(lm.getString("Disabled-World"));
return;
}
Chunk chunk = player.getLocation().getChunk();
OwnedLand land = plugin.getWgHandler().getRegion(chunk);
new BukkitRunnable() {
@Override
public void run() {
// claimed
if (land != null) {
String lastseen;
LocalDateTime lastSeenDate = null;
OfflinePlayer op = Bukkit.getOfflinePlayer(land.getOwner());
if (op.isOnline()) {
lastseen = lm.getRawString("Commands.Info.online");
} else {
List<Object> list = plugin.getDatabaseAPI().retrieveObjects(LPlayer.class, new Conditions.Builder().addCondition("uuid", op.getUniqueId().toString()).create());
if (list.size() > 0) {
lastseen = ((LPlayer) list.get(0)).getLastSeenAsString();
lastSeenDate = ((LPlayer) list.get(0)).getLastSeen();
} else {
lastseen = lm.getRawString("Commands.Info.noLastSeen");
}
}
if (Util.isInactive(lastSeenDate)) {
player.sendMessage(replaceInMessage(inactive, land.getName(), land.printOwners(), land.printMembers(), lastseen, Util.formatCash(plugin.getCostManager().calculateCost(player.getUniqueId()))));
OwnedLand.highlightLand(player, CParticle.DRIPLAVA);
return;
}
Offers offer = plugin.getPlayerManager().getOffer(land.getName());
if (offer != null) {
// advertised land
player.sendMessage(replaceInMessage(advertised, land.getName(), land.printOwners(), land.printMembers(), lastseen, Util.formatCash(offer.getPrice())));
} else {
// normal owned land
player.sendMessage(replaceInMessage(owned, land.getName(), land.printOwners(), land.printMembers(), lastseen, ""));
}
OwnedLand.highlightLand(player, CParticle.DRIPWATER);
} else {
// unclaimed
player.sendMessage(replaceInMessage(free, OwnedLand.getName(chunk), "", "", "", Util.formatCash(plugin.getCostManager().calculateCost(player.getUniqueId()))));
OwnedLand.highlightLand(player, CParticle.DRIPLAVA);
}
}
}.runTaskAsynchronously(plugin);
}
Aggregations