fixed perms and added live countdowns on kits page

This commit is contained in:
Brianna O'Keefe 2018-12-16 13:24:28 -05:00
parent 45b1f4283b
commit 44f5b23e3b
2 changed files with 10 additions and 4 deletions

View File

@ -7,7 +7,6 @@ import com.songoda.ultimatekits.UltimateKits;
import com.songoda.ultimatekits.kit.Kit;
import com.songoda.ultimatekits.utils.Methods;
import com.songoda.ultimatekits.utils.gui.AbstractGUI;
import org.apache.commons.lang.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
@ -25,6 +24,7 @@ public class GUIKitSelector extends AbstractGUI {
private Player player;
private UltimateKits plugin;
private int timer;
private int page = 1;
private int max;
private List<String> kitList;
@ -63,9 +63,15 @@ public class GUIKitSelector extends AbstractGUI {
if (glassless) max -= 18;
init(Lang.KITS_TITLE.getConfigValue(), max);
timer = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, () -> {
Bukkit.broadcastMessage("af");
if (inventory.getViewers().isEmpty()) return;
constructGUI();
}, 20L, 20L);
}
public void setUpPage() {
private void setUpPage() {
int ino = 14;
if (plugin.getConfig().getBoolean("Interfaces.Do Not Use Glass Borders")) ino = 54;
int num = 0;
@ -295,7 +301,7 @@ public class GUIKitSelector extends AbstractGUI {
@Override
protected void registerOnCloses() {
registerOnClose(((player1, inventory1) -> Bukkit.getScheduler().cancelTask(timer)));
}
}

View File

@ -66,7 +66,7 @@ public class Kit {
public void buy(Player player) {
try {
if (hasPermission(player) && !player.isOp() && plugin.getConfig().getBoolean("Main.Allow Players To Receive Kits For Free If They Have Permission")) {
if (hasPermission(player) && plugin.getConfig().getBoolean("Main.Allow Players To Receive Kits For Free If They Have Permission")) {
give(player, false, false, false);
return;
}