Merge remote-tracking branch 'origin/master' into develop

This commit is contained in:
tastybento 2018-09-01 17:10:02 -07:00
commit 5d2f4f3316
2 changed files with 14 additions and 0 deletions

View File

@ -6,6 +6,7 @@ import bentobox.addon.challenges.commands.ChallengesCommand;
import bentobox.addon.challenges.commands.admin.Challenges;
import world.bentobox.bentobox.api.addons.Addon;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.configuration.Config;
/**
* Add-on to BSkyBlock that enables challenges
@ -18,6 +19,12 @@ public class ChallengesAddon extends Addon {
private String permissionPrefix = "addon";
private FreshSqueezedChallenges importManager;
@Override
public void onLoad() {
// Save default config.yml
saveDefaultConfig();
}
@Override
public void onEnable() {
// Check if it is enabled - it might be loaded, but not enabled.

View File

@ -11,6 +11,7 @@ import java.util.Map;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
@ -71,6 +72,12 @@ public class TryToComplete {
// Run commands
runCommands(challenge.getRewardCommands());
user.sendMessage("challenges.you-completed", "[challenge]", challenge.getFriendlyName());
if (addon.getConfig().getBoolean("broadcastmessages", false)) {
for (Player p : addon.getServer().getOnlinePlayers()) {
User.getInstance(p).sendMessage("challenges.name-has-completed",
"[name]", user.getName(), "[challenge]", challenge.getFriendlyName());
}
}
} else {
// Give rewards
for (ItemStack reward : challenge.getRepeatItemReward()) {