Skip to content

Commit

Permalink
Add default options for inactive variables
Browse files Browse the repository at this point in the history
Format and cleanup code 

Remove debug code, and cleanup.
  • Loading branch information
Magnum97 committed Oct 28, 2019
1 parent 2033f69 commit 1160b09
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/main/java/de/epiceric/shopchest/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -503,8 +503,8 @@ public void reload(boolean firstLoad, boolean langReload, boolean showMessages)
defaultLimit = plugin.getConfig().getInt("shop-limits.default");
mainCommandName = plugin.getConfig().getString("main-command-name");
languageFile = plugin.getConfig().getString("language-file");
removeInactive = plugin.getConfig().getBoolean("enable-inactive-removal");
inactiveDays = plugin.getConfig().getInt("inactive-time");
removeInactive = plugin.getConfig().getBoolean("enable-inactive-removal",true);
inactiveDays = plugin.getConfig().getInt("inactive-time",30);


if (firstLoad || langReload) loadLanguageConfig(showMessages);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

Expand Down Expand Up @@ -627,16 +628,15 @@ private void info(Player executor, Shop shop) {
if (shop.getShopType() != ShopType.ADMIN && shop.getSellPrice() > 0) executor.sendMessage(chestSpace);
executor.sendMessage(priceString);
executor.sendMessage(shopType);
if (essentials != null){
if (essentials != null) {
User user = essentials.getUser(shop.getVendor().getUniqueId());
long seen = user.getLastOnlineActivity();
int days = (int) (System.currentTimeMillis() - seen) / (1000*60*60*24);
executor.sendMessage("§6Online: §eLast login was §a" + days + "§e ago.");

if (user.getConfigUUID().toString().equals("f05b6506-c11e-4fec-bc36-f260a01f3fcf")
||days>30){ // user is Magnum or chest expired // todo get from config
int days = (int) (System.currentTimeMillis() - seen) / (1000 * 60 * 60 * 24);
executor.sendMessage("§6Online: §eLast login was §a" + days + "§e ago.");
if ((Config.removeInactive) && (days > Config.inactiveDays)) {
Logger log = plugin.getLogger();
log.info("Removed inactive shop of " + user.getName());
remove(executor, shop);

executor.sendMessage("§cShop removed due to inactivity");
}
}
Expand Down

0 comments on commit 1160b09

Please sign in to comment.