Added "minecraftgpt.receive" permission to still receive messages from users using minecraftgpt

This commit is contained in:
ohAlee 2023-05-10 15:49:11 +02:00
parent 62eb8abf71
commit b408c42ea8
3 changed files with 8 additions and 2 deletions

View File

@ -4,7 +4,7 @@ plugins {
}
group = 'it.ohalee.minecraftgpt'
version = '1.2.6'
version = '1.2.7'
sourceCompatibility = 1.17
targetCompatibility = 1.17

View File

@ -5,6 +5,7 @@ import it.ohalee.minecraftgpt.OpenAI;
import it.ohalee.minecraftgpt.Type;
import it.ohalee.minecraftgpt.util.Messages;
import lombok.RequiredArgsConstructor;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@ -59,8 +60,13 @@ public class ChatHandler implements Listener {
}
private void sendMessage(String message, Collection<Player> players) {
Bukkit.getOnlinePlayers().stream()
.filter(player -> !players.contains(player) && player.hasPermission("minecraftgpt.receive"))
.forEach(player -> player.sendMessage(message));
for (Player player : players)
player.sendMessage(message);
if (plugin.getConfig().getBoolean("send-messages-to-console", true))
plugin.getServer().getConsoleSender().sendMessage(message);
}

View File

@ -1,6 +1,6 @@
name: MinecraftGPT
main: it.ohalee.minecraftgpt.Main
version: 1.2.6
version: 1.2.7
author: ohAlee
description: A Minecraft plugin that uses ChatGPT
api-version: 1.16