mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI.git
synced 2024-11-26 04:25:18 +01:00
updated register command to attempt registration on the main thread. (event bullshit I think)
This commit is contained in:
parent
b6ec478dd6
commit
5861f9fe6a
@ -5,6 +5,7 @@ import me.clip.placeholderapi.commands.PlaceholderCommand;
|
||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||
import me.clip.placeholderapi.expansion.manager.LocalExpansionManager;
|
||||
import me.clip.placeholderapi.util.Msg;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
@ -44,7 +45,7 @@ public final class CommandExpansionRegister extends PlaceholderCommand
|
||||
return;
|
||||
}
|
||||
|
||||
manager.findExpansionsInFile(file).whenCompleteAsync((classes, exception) -> {
|
||||
manager.findExpansionsInFile(file).whenComplete((classes, exception) -> {
|
||||
if (exception != null)
|
||||
{
|
||||
Msg.msg(sender,
|
||||
@ -61,16 +62,18 @@ public final class CommandExpansionRegister extends PlaceholderCommand
|
||||
return;
|
||||
}
|
||||
|
||||
final Optional<PlaceholderExpansion> expansion = manager.register(classes.get(0));
|
||||
if (!expansion.isPresent())
|
||||
{
|
||||
Msg.msg(sender,
|
||||
"&cFailed to register expansion from &f" + params.get(0));
|
||||
return;
|
||||
}
|
||||
Bukkit.getScheduler().runTask(plugin, () -> {
|
||||
final Optional<PlaceholderExpansion> expansion = manager.register(classes.get(0));
|
||||
if (!expansion.isPresent())
|
||||
{
|
||||
Msg.msg(sender,
|
||||
"&cFailed to register expansion from &f" + params.get(0));
|
||||
return;
|
||||
}
|
||||
|
||||
Msg.msg(sender,
|
||||
"&aSuccessfully registered expansion: &f" + expansion.get().getName());
|
||||
Msg.msg(sender,
|
||||
"&aSuccessfully registered expansion: &f" + expansion.get().getName());
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user