Fixed issues with panels not scaling in size correctly.

This commit is contained in:
Tastybento 2018-04-02 18:20:54 -07:00
parent e09cb30cb5
commit c49e2b07d3
4 changed files with 13 additions and 11 deletions

View File

@ -15,8 +15,11 @@ permissions:
children:
bskyblock.island.*:
children:
bskyblock.island:
description: Allow island command usage
default: true
bskyblock.island.create:
description: Allow island command usage
description: Allow island creation
default: true
bskyblock.island.home:
description: Allow teleporting to player island

View File

@ -65,7 +65,8 @@ public class BSkyBlock extends JavaPlugin {
//settings.saveSettings();
settings = settings.loadSettings();
} catch (Exception e) {
getLogger().severe("Settings could not be loaded" + e.getMessage());
getLogger().severe("Settings could not be loaded " + e.getMessage());
e.printStackTrace();
}
// Save a backup of settings to the database so it can be checked next time

View File

@ -154,6 +154,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
// Check perms, but only if this isn't the console
if ((sender instanceof Player) && !sender.isOp() && !cmd.getPermission().isEmpty() && !sender.hasPermission(cmd.getPermission())) {
user.sendMessage("general.errors.no-permission");
user.sendRawMessage("You need " + cmd.getPermission());
return true;
}
// Fire an event to see if this command should be cancelled

View File

@ -69,15 +69,12 @@ public class PanelBuilder {
return this;
}
/**
* Get the next free slot number
* @return next slot number
*/
public int nextSlot() {
if (items.isEmpty()) {
return 0;
} else {
for (int i = 0; i < (size != 0 ? size : 54); i++) {
if (!slotOccupied(i)) return i;
}
}
return 0;
return items.isEmpty() ? 0 : items.lastKey() + 1;
}
/**
@ -94,6 +91,6 @@ public class PanelBuilder {
* @return Panel
*/
public Panel build() {
return new Panel(name, items, size, user, listener);
return new Panel(name, items, Math.max(size, items.lastKey()), user, listener);
}
}