Grant permission rewards to offline players

This commit is contained in:
PikaMug 2020-03-07 17:57:59 -05:00
parent bde9eae68f
commit 6eb71d6021
2 changed files with 18 additions and 6 deletions

View File

@ -498,14 +498,19 @@ public class Quest {
} }
none = null; none = null;
} }
if (player.isOnline()) { for (int i = 0; i < rews.getPermissions().size(); i++) {
for (String s : rews.getPermissions()) {
if (plugin.getDependencies().getVaultPermission() != null) { if (plugin.getDependencies().getVaultPermission() != null) {
plugin.getDependencies().getVaultPermission().playerAdd((Player)player, s); String perm = rews.getPermissions().get(i);
plugin.getDependencies().getVaultPermission().playerAdd(null, player, perm);
/*String world = rews.getPermissionWorlds().get(i);
if (world == null) {
plugin.getDependencies().getVaultPermission().playerAdd(null, player, perm);
} else {
plugin.getDependencies().getVaultPermission().playerAdd(world, player, perm);
}*/
} }
none = null; none = null;
} }
}
for (String s : rews.getMcmmoSkills()) { for (String s : rews.getMcmmoSkills()) {
UserManager.getOfflinePlayer(player).getProfile().addLevels(Quests.getMcMMOSkill(s), UserManager.getOfflinePlayer(player).getProfile().addLevels(Quests.getMcMMOSkill(s),
rews.getMcmmoAmounts().get(rews.getMcmmoSkills().indexOf(s))); rews.getMcmmoAmounts().get(rews.getMcmmoSkills().indexOf(s)));

View File

@ -26,6 +26,7 @@ public class Rewards {
private List<String> commands = new LinkedList<String>(); private List<String> commands = new LinkedList<String>();
private List<String> commandsOverrideDisplay = new LinkedList<String>(); private List<String> commandsOverrideDisplay = new LinkedList<String>();
private List<String> permissions = new LinkedList<String>(); private List<String> permissions = new LinkedList<String>();
private List<String> permissionWorlds = new LinkedList<String>();
private List<ItemStack> items = new LinkedList<ItemStack>(); private List<ItemStack> items = new LinkedList<ItemStack>();
private List<String> mcmmoSkills = new LinkedList<String>(); private List<String> mcmmoSkills = new LinkedList<String>();
private List<Integer> mcmmoAmounts = new LinkedList<Integer>(); private List<Integer> mcmmoAmounts = new LinkedList<Integer>();
@ -70,6 +71,12 @@ public class Rewards {
public void setPermissions(List<String> permissions) { public void setPermissions(List<String> permissions) {
this.permissions = permissions; this.permissions = permissions;
} }
public List<String> getPermissionWorlds() {
return permissionWorlds;
}
public void setPermissionWorlds(List<String> worldNames) {
this.permissionWorlds = worldNames;
}
public List<ItemStack> getItems() { public List<ItemStack> getItems() {
return items; return items;
} }