mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2024-11-28 05:25:21 +01:00
Broadcast messages
This commit is contained in:
parent
44910200f5
commit
22dc2721d7
@ -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.
|
||||
|
@ -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()) {
|
||||
|
Loading…
Reference in New Issue
Block a user