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

Events not called #595

Closed Dev0Louis closed 1 year ago

Dev0Louis commented 1 year ago

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

What kind of server do you have (Bungeecord/single server)? single Bukkit

What server version (/version) are you using? This server is running Paper version git-Paper-296 (MC: 1.19.2) (Implementing API version 1.19.2-R0.1-SNAPSHOT) (Git: f1583fc) You are 11 version(s) behind Download the new version at: https://papermc.io/downloads Previous version: git-Paper-94 (MC: 1.19.1)

Please provide the EXACT steps required to reproduce the problem...

  1. Create Plugin
  2. Write Listener
  3. Register Listener
  4. Put Plugin on Server
  5. Ban someone
  6. Event does not fire :c

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

Add any additional information below. Tried modifing it. The Event call is reached. But it does not work.

Hopefuls commented 1 year ago

Could you provide a minimal reproducible sample of the event callers not working? As there's nothing to really go off when trying to approach this issue. This minimal reproducible sample can be for example a smaller plugin that simply logs the event if it is fired.

Additionally: Please use a non-modified version of AdvancedBan obtained through spigotmc.org as support regarding it will fall away if modified by you.

Dev0Louis commented 1 year ago

I tried it without Modifications and without. I coded a simple plugin that should print in the Console, but it does not.

import me.leoko.advancedban.bukkit.event.PunishmentEvent;
    @EventHandler
    public void on(PunishmentEvent event) {
        System.out.println("event fired.");
    }

It does not fire with an unmodified Version of Advancedban.

And my only Modifications to test afterwards were:

    @Override
    public void callPunishmentEvent(Punishment punishment, boolean silent) {
        runSync(() -> Bukkit.getPluginManager().callEvent(new PunishmentEvent(punishment, silent)));
    }

->

    @Override
    public void callPunishmentEvent(Punishment punishment, boolean silent) {
        runSync(() -> Bukkit.getPluginManager().callEvent(new PunishmentEvent(punishment, silent)));
        System.out.println("event should be fired?");
    }

Weirdly with both Plugins loaded only "event should be fired?" is printed.

Hopefuls commented 1 year ago

Could you provide both your whole Main class file and your whole Class containing the EventListener that according to you does not fire. You can use gist for that.

If nothing outputs on your plugin, your plugin might not have loaded, the EventListener wasn't properly registered or something failing while firing the event.

But seeing the first code you've added, this seems like to be missing the other parts of the code (such as the class definition), unsure if that's just a cutout to demonstrate the issue.

I'll try to check the issue you've mentioned myself.

Dev0Louis commented 1 year ago

Found the Issue That is what I used.

        <dependency>
            <groupId>com.github.DevLeoko</groupId>
            <artifactId>AdvancedBan</artifactId>
            <version>v2.3.0</version>
        </dependency>

But if I set the scope to provided it works. (How could I miss this 🤦🏼) Thank you for your help.

        <dependency>
            <groupId>com.github.DevLeoko</groupId>
            <artifactId>AdvancedBan</artifactId>
            <version>v2.3.0</version>
            <scope>provided</scope>
        </dependency>
Hopefuls commented 1 year ago

Found the Issue That is what I used.

        <dependency>
            <groupId>com.github.DevLeoko</groupId>
            <artifactId>AdvancedBan</artifactId>
            <version>v2.3.0</version>
        </dependency>

But if I set the scope to provided it works. (How could I miss this 🤦🏼) Thank you for your help.

        <dependency>
            <groupId>com.github.DevLeoko</groupId>
            <artifactId>AdvancedBan</artifactId>
            <version>v2.3.0</version>
            <scope>provided</scope>
        </dependency>

then you entirely included Advancedban in your plugin, which would explain the events not being called as they're improperly added.

Have you not seen any error messages?

Dev0Louis commented 1 year ago

Nope I saw no error Messages. Maybe I overlooked the Plugin was already loaded message. But the example for the API on Github does include it too. Maybe that should be changed?