DevLeoko / AdvancedBan

AdvancedBan is a Spigot plugin to manage punishments on single servers and server networks
GNU General Public License v3.0
156 stars 128 forks source link

Problems using the API #638

Open sujyrokimora opened 4 months ago

sujyrokimora commented 4 months ago

What version of AdvancedBan (/AdvancedBan) are you using? 2.3.0

What kind of server do you have (Bungeecord/single server)? Single Running Paper

What server version (/version) are you using? Paper 299

Any error/log post it through pastebin.com and link it here. (Also include /plugins/AdvancedBan/logs/latest.log) https://pastebin.com/ReqF13Uw

Add any additional information below. Am I being to dum? Please tell what i did wrong (I've started making plugins yesterday this is a test plugin nothing more)

package network.meandtheboys.xavi.Listener;

import io.papermc.paper.event.player.AsyncChatEvent;

import me.leoko.advancedban.manager.PunishmentManager;

import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.plugin.Plugin;

import java.util.List;

public class AsyncPlayerChatListener implements Listener {
    private final FileConfiguration config;
    private final Plugin plugin;

    public AsyncPlayerChatListener(FileConfiguration config, Plugin plugin) {
        this.config = config;
        this.plugin = plugin;
    }

    @EventHandler
    public void onAsyncPlayerChat(AsyncChatEvent event) {
            Player player = event.getPlayer();
            List<String> words = config.getStringList("bannedwords");

            for (String word : words) {
                if (event.message().toString().toLowerCase().replaceAll("[^a-zA-Z0-9]", "").contains(word.toLowerCase())) {
                    player.sendMessage("Olha ai a conversa");
                    event.setCancelled(true);
                    plugin.getLogger().info(player.getName() + " teve paleio maligno");
                    boolean t =!PunishmentManager.get().isMuted(String.valueOf(player.getUniqueId()));
                    System.out.println(t);
                    if(t){
                        Bukkit.getScheduler().runTask(plugin, new Runnable() {
                            @Override
                            public void run() {
                                Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "broadcast calate");

                            }
                        });
                    }
                    break;
                }
            }
        }
    }
Hopefuls commented 4 months ago

Use the UUIDManager when working with uuids and advancedban, check the javadocs

Hopefuls commented 4 months ago

Also, make sure to not include the dependency in your artifact, always tell your build tool that it is provided (such as on maven through <scope>provided</scope>)

sujyrokimora commented 4 months ago

It still does the same thing cant find the class -- https://pastebin.com/GrJC4hWX Like this?

        <dependency>
            <groupId>com.github.DevLeoko.AdvancedBan</groupId>
            <artifactId>AdvancedBan-Bukkit</artifactId>
            <version>v2.3.0</version>
            <scope>provided</scope>
        </dependency>
Hopefuls commented 4 months ago

That error indicates that advancedban might not even be installed on your server.

Can you tell me more about your setup? You mentioned using spigot, is advancedban on it?

Hopefuls commented 4 months ago

Also, please refer to the readme on the GitHub repo, it seems like you're trying to use the non-core part of advancedban, which does not include the required class.

sujyrokimora commented 4 months ago

That error indicates that advancedban might not even be installed on your server.

Can you tell me more about your setup? You mentioned using spigot, is advancedban on it?

image I'm running a test Server on Paper

sujyrokimora commented 4 months ago

Also, please refer to the readme on the GitHub repo, it seems like you're trying to use the non-core part of advancedban, which does not include the required class. If I do it like the readme it will give me this error Maven logs https://pastebin.com/UEAcJ92Q


<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
network.meandtheboys xavi 0.1-ALPHA jar tools 1.8 UTF-8 org.apache.maven.plugins maven-compiler-plugin 3.8.1 ${java.version} ${java.version} org.apache.maven.plugins maven-shade-plugin 3.2.4 package shade src/main/resources true jitpack.io https://jitpack.io papermc-repo https://repo.papermc.io/repository/maven-public/ sonatype https://oss.sonatype.org/content/groups/public/ com.github.DevLeoko.AdvancedBan AdvancedBan v2.3.0 provided io.papermc.paper paper-api 1.20.2-R0.1-SNAPSHOT provided

Hopefuls commented 4 months ago

Something wrong with your maven setup then? Jitpack contains the AdvancedBan dependencies here: https://jitpack.io/#DevLeoko/AdvancedBan

sujyrokimora commented 4 months ago

Maven finds paper i dont know why it cant to the same for AdanvancedBans

Hopefuls commented 4 months ago

Otherwise try clearing your maven cache

sujyrokimora commented 4 months ago

Wtf he trying to download it from the wrong place even so i set the repo for it

      <repository>
          <id>jitpack.io</id>
          <url>https://jitpack.io</url>
      </repository>
Downloading from sonatype: https://oss.sonatype.org/content/groups/public/com/github/DevLeoko/AdvancedBan/AdvancedBan/v2.3.0/AdvancedBan-v2.3.0.jar
Downloading from central: https://repo.maven.apache.org/maven2/com/github/DevLeoko/AdvancedBan/AdvancedBan/v2.3.0/AdvancedBan-v2.3.0.jar

EDIT: i have no idea but it still tries in jit but fails

[ERROR] Failed to execute goal on project xavi: Could not resolve dependencies for project network.meandtheboys:xavi:jar:0.1-ALPHA: The following artifacts could not be resolved: com.github.DevLeoko.AdvancedBan:AdvancedBan:jar:v2.3.0 (absent): com.github.DevLeoko.AdvancedBan:AdvancedBan:jar:v2.3.0 was not found in https://jitpack.io during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of jitpack.io has elapsed or updates are forced -> [Help 1]