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

View File

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