Fix some errors without Vault / PEX

This commit is contained in:
Daniel Saukel 2016-06-17 16:16:40 +02:00
parent 2ee39cbba8
commit e3aeebd07f
2 changed files with 10 additions and 4 deletions

View File

@ -531,7 +531,7 @@ public class PlayerListener implements Listener {
return;
}
if (plugin.getPermissionProvider() == null) {
if (plugin.getPermissionProvider() == null || !plugin.getPermissionProvider().hasGroupSupport()) {
return;
}
@ -575,28 +575,34 @@ public class PlayerListener implements Listener {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerLogin(PlayerLoginEvent event) {
Player player = event.getPlayer();
MainConfig config = plugin.getMainConfig();
if (!config.isTutorialActivated()) {
return;
}
if (DGamePlayer.getByPlayer(player) != null) {
return;
}
if (plugin.getPermissionProvider() == null) {
if (plugin.getPermissionProvider() == null || !plugin.getPermissionProvider().hasGroupSupport()) {
return;
}
if ((config.getTutorialDungeon() == null || config.getTutorialStartGroup() == null || config.getTutorialEndGroup() == null)) {
return;
}
for (String group : plugin.getPermissionProvider().getPlayerGroups(player)) {
if (!config.getTutorialStartGroup().equalsIgnoreCase(group)) {
continue;
}
if (plugin.getGameWorlds().size() >= config.getMaxInstances()) {
event.setResult(PlayerLoginEvent.Result.KICK_FULL);
event.setKickMessage(DMessages.ERROR_TOO_MANY_TUTORIALS.getMessage());
}
return;
}
}

View File

@ -405,7 +405,7 @@ public class DGamePlayer extends DInstancePlayer {
getData().logTimeLastPlayed(dGroup.getDungeon().getName());
// Tutorial Permissions
if (gameWorld.isTutorial()) {
if (gameWorld.isTutorial() && plugin.getPermissionProvider() != null && plugin.getPermissionProvider().hasGroupSupport()) {
String endGroup = plugin.getMainConfig().getTutorialEndGroup();
if (plugin.isGroupEnabled(endGroup)) {
plugin.getPermissionProvider().playerAddGroup(getPlayer(), endGroup);