mirror of
https://gitlab.com/SamB440/rpgregions-2.git
synced 2025-12-28 19:29:16 +00:00
fix: /discoveries discover not calling RegionsDiscoverEvent
This commit is contained in:
@@ -7,9 +7,11 @@ import co.aikar.commands.annotation.CommandPermission;
|
||||
import co.aikar.commands.annotation.Default;
|
||||
import co.aikar.commands.annotation.Subcommand;
|
||||
import net.islandearth.rpgregions.RPGRegions;
|
||||
import net.islandearth.rpgregions.api.events.RegionDiscoverEvent;
|
||||
import net.islandearth.rpgregions.gui.DiscoveryGUI;
|
||||
import net.islandearth.rpgregions.managers.data.region.ConfiguredRegion;
|
||||
import net.islandearth.rpgregions.managers.data.region.WorldDiscovery;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -42,12 +44,15 @@ public class DiscoveriesCommand extends BaseCommand {
|
||||
DateTimeFormatter format = DateTimeFormatter.ofPattern(plugin.getConfig().getString("settings.server.discoveries.date.format"));
|
||||
|
||||
String formattedDate = date.format(format);
|
||||
account.addDiscovery(new WorldDiscovery(formattedDate, configuredRegion.getId()));
|
||||
final WorldDiscovery worldDiscovery = new WorldDiscovery(formattedDate, configuredRegion.getId());
|
||||
account.addDiscovery(worldDiscovery);
|
||||
if (target.getPlayer() != null) {
|
||||
Player player = target.getPlayer();
|
||||
player.sendMessage(ChatColor.GREEN + "An administrator added a discovery to your account.");
|
||||
Bukkit.getPluginManager().callEvent(new RegionDiscoverEvent(player, configuredRegion.getId(), worldDiscovery));
|
||||
}
|
||||
plugin.getManagers().getStorageManager().removeCachedAccount(target.getUniqueId());
|
||||
|
||||
sender.sendMessage(ChatColor.GREEN + "The player " + target.getName() + " has had the discovery added.");
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user