From e3aeebd07f5d2060966bd3e7cc5bacd266a0bb75 Mon Sep 17 00:00:00 2001 From: Daniel Saukel Date: Fri, 17 Jun 2016 16:16:40 +0200 Subject: [PATCH] Fix some errors without Vault / PEX --- .../dre2n/dungeonsxl/listener/PlayerListener.java | 12 +++++++++--- .../github/dre2n/dungeonsxl/player/DGamePlayer.java | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/io/github/dre2n/dungeonsxl/listener/PlayerListener.java b/src/main/java/io/github/dre2n/dungeonsxl/listener/PlayerListener.java index ac9afee8..f3e2685d 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/listener/PlayerListener.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/listener/PlayerListener.java @@ -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; } } diff --git a/src/main/java/io/github/dre2n/dungeonsxl/player/DGamePlayer.java b/src/main/java/io/github/dre2n/dungeonsxl/player/DGamePlayer.java index df86eaf6..65b18931 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/player/DGamePlayer.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/player/DGamePlayer.java @@ -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);