实现自定义事件后为空指针,不知道缺少了什么

问题描述

这只是我的第二个问题,因此,如果我做错任何事情,请多包涵。

我一直在编码一个Bukkit插件,其中包括一个辐射效果,如果您不在指定的安全区域内,则会受到损坏。我正在使用WorldEdit API来指定上述区域,但是在实现破坏效果本身之后,现在接收到空指针。

这是辐射等级:

package com.psychoticatt.outerrimcore;


import java.util.HashMap;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;

import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;

import com.psychoticatt.outerrimcore.events.PlayerIrradiatedEvent;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.world.World;

public class Radiation implements Listener {
    
    public org.bukkit.World waste = Bukkit.getServer().getWorld("wasteland");
    public World w = BukkitAdapter.adapt(waste);
    
    Location loc1 = new Location(waste,207,3,124);
    Location loc2 = new Location(waste,226,23,143);
    
    BlockVector3 vect1 = BukkitAdapter.asBlockVector(loc1);
    BlockVector3 vect2 = BukkitAdapter.asBlockVector(loc2);
    
    CuboidRegion cRegion1 = new CuboidRegion(w,vect1,vect2);
    
    PotionEffect rStage1 = new PotionEffect(PotionEffectType.WITHER,1,10000,false,true);
    PotionEffect rStage2 = new PotionEffect(PotionEffectType.WITHER,2,1000000,true);
    
    HashMap<Player,Boolean> radStatus = new HashMap<Player,Boolean>();
    
    @EventHandler
    public void onPlayerMove(PlayerMoveEvent e) {

        Player p = (Player) e.getPlayer();

        BlockVector3 to = BukkitAdapter.asBlockVector(e.getTo());
        BlockVector3 from = BukkitAdapter.asBlockVector(e.getFrom());

        if(cRegion1.contains(to) && !cRegion1.contains(from)) {

            p.sendMessage(ChatColor.AQUA + "Entering Safezone!");
            PlayerIrradiatedEvent isIrradiated = new PlayerIrradiatedEvent(p,false);
            Bukkit.getServer().getPluginManager().callEvent(isIrradiated);

        } else if(!cRegion1.contains(to) && cRegion1.contains(from)) {

            p.sendMessage(ChatColor.RED + "Exiting Safezone,You Are Exposed To " + ChatColor.GREEN + "Radiation!");

            PlayerIrradiatedEvent isIrradiated = new PlayerIrradiatedEvent(p,true);
            Bukkit.getServer().getPluginManager().callEvent(isIrradiated);
        }
    }
    
    @EventHandler
    public void onPlayerJoin(PlayerJoinEvent e) {
        Player p = (Player) e.getPlayer();
        radStatus.put(p,false);
    }
    
    @EventHandler
    public void onIrradiated(PlayerIrradiatedEvent e) throws InterruptedException {
        Player p = (Player) e.getPlayer();
        Boolean s = e.getStatus();

        if(radStatus.containsKey(p)) {

            radStatus.replace(p,s);

            if(radStatus.get(p).equals(true)) {

                p.addPotionEffect(rStage1);
                Thread.sleep(10000);
                p.addPotionEffect(rStage2);

            } else {

                p.removePotionEffect(PotionEffectType.WITHER);

            }
        }
    }
    
}

这是我引用的自定义事件:

package com.psychoticatt.outerrimcore.events;

import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;

public class PlayerIrradiatedEvent extends Event {
    
    private Player player;
    private Boolean status;
    
    public PlayerIrradiatedEvent(Player p,boolean b) {
        player = p;
        status = b;
    }
    
    public Boolean getStatus() {
        return status;
    }
    
    public Player getPlayer() {
        return player;
    }
    
    public HandlerList getHandlers() {
        return null;
    }
    
}

我的主班:

package com.psychoticatt.outerrimcore;

import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public class Main extends JavaPlugin {
    
    public void onEnable() {
        this.getServer().getLogger().info("[OuterRimCore] Works!");
        
        Bukkit.getServer().getPluginManager().registerEvents(new Radiation(),this);
    }
}

这是错误日志:

[03:57:18] [main/INFO]: Environment: authHost='https://authserver.mojang.com',accountsHost='https://api.mojang.com',sessionHost='https://sessionserver.mojang.com',name='PROD'
[03:57:19] [main/INFO]: Reloading ResourceManager: Default,bukkit
[03:57:19] [Worker-Main-14/INFO]: Loaded 7 recipes
[03:57:22] [Server thread/INFO]: Starting minecraft server version 1.16.2
[03:57:22] [Server thread/INFO]: Loading properties
[03:57:24] [Server thread/INFO]: This server is running CraftBukkit version git-Spigot-b5a13e6-3980640 (MC: 1.16.2) (Implementing API version 1.16.2-R0.1-SNAPSHOT)
[03:57:24] [Server thread/INFO]: Debug logging is disabled
[03:57:24] [Server thread/INFO]: Server Ping Player Sample Count: 12
[03:57:24] [Server thread/INFO]: Using 4 threads for Netty based IO
[03:57:24] [Server thread/INFO]: Default game type: SURVIVAL
[03:57:24] [Server thread/INFO]: Generating keypair
[03:57:24] [Server thread/INFO]: Starting minecraft server on *:25565
[03:57:24] [Server thread/INFO]: Using default channel type
[03:57:27] [Server thread/WARN]: Initializing Legacy Material Support. Unless you have legacy plugins and/or data this is a bug!
[03:57:32] [Server thread/WARN]: Legacy plugin OuterRimCore v0.1 does not specify an api-version.
[03:57:32] [Server thread/INFO]: [WorldEdit] Loading WorldEdit v7.1.0;8e55131
[03:57:33] [Server thread/INFO]: Got request to register class com.sk89q.worldedit.bukkit.BukkitServerInterface with WorldEdit [com.sk89q.worldedit.extension.platform.PlatformManager@3a33813c]
[03:57:33] [Server thread/INFO]: [OuterRimCore] Loading OuterRimCore v0.1
[03:57:33] [Server thread/INFO]: [Essentials] Loading Essentials v2.18.1.3
[03:57:33] [Server thread/INFO]: [Essentialsspawn] Loading Essentialsspawn v2.18.1.3
[03:57:33] [Server thread/INFO]: [Multiverse-Core] Loading Multiverse-Core v4.1.0-b775
[03:57:33] [Server thread/INFO]: [WorldEdit] Enabling WorldEdit v7.1.0;8e55131
[03:57:33] [Server thread/INFO]: WEPIF: Using the Bukkit Permissions API.
[03:57:34] [Server thread/WARN]: 
**********************************************
** This WorldEdit version does not fully support your version of Bukkit.
**
** When working with blocks or undoing,chests will be empty,signs
** will be blank,and so on. There will be no support for entity
** and block property-related functions.
**
** Please see https://worldedit.enginehub.org/en/latest/faq/#bukkit-adapters
**********************************************

[03:57:35] [Server thread/WARN]: [WorldEdit] ====================================================
[03:57:35] [Server thread/WARN]: [WorldEdit]  WorldEdit works better if you use Paper 
[03:57:35] [Server thread/WARN]: [WorldEdit]  as your server software. 
[03:57:35] [Server thread/WARN]: [WorldEdit]   
[03:57:35] [Server thread/WARN]: [WorldEdit]  Paper offers significant performance improvements,[03:57:35] [Server thread/WARN]: [WorldEdit]  bug fixes,security enhancements and optional
[03:57:35] [Server thread/WARN]: [WorldEdit]  features for server owners to enhance their server.
[03:57:35] [Server thread/WARN]: [WorldEdit]   
[03:57:35] [Server thread/WARN]: [WorldEdit]  Paper includes Timings v2,which is significantly
[03:57:35] [Server thread/WARN]: [WorldEdit]  better at diagnosing lag problems over v1.
[03:57:35] [Server thread/WARN]: [WorldEdit]   
[03:57:35] [Server thread/WARN]: [WorldEdit]  All of your plugins should still work,and the
[03:57:35] [Server thread/WARN]: [WorldEdit]  Paper community will gladly help you fix any issues.
[03:57:35] [Server thread/WARN]: [WorldEdit]   
[03:57:35] [Server thread/WARN]: [WorldEdit]  Join the Paper Community @ https://papermc.io
[03:57:35] [Server thread/WARN]: [WorldEdit] ====================================================
[03:57:35] [Server thread/INFO]: Preparing level "world"
[03:57:35] [Server thread/INFO]: -------- World Settings For [world] --------
[03:57:35] [Server thread/INFO]: Allow Zombie Pigmen to spawn from portal blocks: true
[03:57:35] [Server thread/INFO]: Item Despawn Rate: 6000
[03:57:35] [Server thread/INFO]: Item Merge Radius: 2.5
[03:57:35] [Server thread/INFO]: View distance: 10
[03:57:35] [Server thread/INFO]: Entity Tracking Range: Pl 48 / An 48 / Mo 48 / Mi 32 / Other 64
[03:57:35] [Server thread/INFO]: Tile Max Tick Time: 50ms Entity max Tick Time: 50ms
[03:57:35] [Server thread/INFO]: Max TNT Explosions: 100
[03:57:35] [Server thread/INFO]: Arrow Despawn Rate: 1200 Trident Respawn Rate:1200
[03:57:35] [Server thread/INFO]: Nerfing mobs spawned from spawners: false
[03:57:35] [Server thread/INFO]: Zombie Aggressive Towards Villager: true
[03:57:35] [Server thread/INFO]: Custom Map Seeds:  Village: 10387312 Desert: 14357617 Igloo: 14357618 Jungle: 14357619 Swamp: 14357620 Monument: 10387313 Ocean: 14357621 Shipwreck: 165745295 End City: 10387313 Slime: 987234911 Bastion: 30084232 Fortress: 30084232 Mansion: 10387319 Fossil: 14357921 Portal: 34222645
[03:57:35] [Server thread/INFO]: Hopper Transfer: 8 Hopper Check: 1 Hopper Amount: 1
[03:57:35] [Server thread/INFO]: Experience Merge Radius: 3.0
[03:57:35] [Server thread/INFO]: Cactus Growth Modifier: 100%
[03:57:35] [Server thread/INFO]: Cane Growth Modifier: 100%
[03:57:35] [Server thread/INFO]: Melon Growth Modifier: 100%
[03:57:35] [Server thread/INFO]: Mushroom Growth Modifier: 100%
[03:57:35] [Server thread/INFO]: Pumpkin Growth Modifier: 100%
[03:57:35] [Server thread/INFO]: Sapling Growth Modifier: 100%
[03:57:35] [Server thread/INFO]: Beetroot Growth Modifier: 100%
[03:57:35] [Server thread/INFO]: Carrot Growth Modifier: 100%
[03:57:35] [Server thread/INFO]: Potato Growth Modifier: 100%
[03:57:35] [Server thread/INFO]: Wheat Growth Modifier: 100%
[03:57:35] [Server thread/INFO]: NetherWart Growth Modifier: 100%
[03:57:35] [Server thread/INFO]: Vine Growth Modifier: 100%
[03:57:35] [Server thread/INFO]: Cocoa Growth Modifier: 100%
[03:57:35] [Server thread/INFO]: Bamboo Growth Modifier: 100%
[03:57:35] [Server thread/INFO]: SweetBerry Growth Modifier: 100%
[03:57:35] [Server thread/INFO]: Kelp Growth Modifier: 100%
[03:57:35] [Server thread/INFO]: Mob Spawn Range: 6
[03:57:35] [Server thread/INFO]: Entity Activation Range: An 32 / Mo 32 / Ra 48 / Mi 16 / Tiv true
[03:57:35] [Server thread/INFO]: Registering commands with com.sk89q.worldedit.bukkit.BukkitServerInterface
[03:57:35] [Server thread/INFO]: -------- World Settings For [world_nether] --------
[03:57:35] [Server thread/INFO]: Allow Zombie Pigmen to spawn from portal blocks: true
[03:57:35] [Server thread/INFO]: Item Despawn Rate: 6000
[03:57:35] [Server thread/INFO]: Item Merge Radius: 2.5
[03:57:35] [Server thread/INFO]: View distance: 10
[03:57:35] [Server thread/INFO]: Entity Tracking Range: Pl 48 / An 48 / Mo 48 / Mi 32 / Other 64
[03:57:35] [Server thread/INFO]: Tile Max Tick Time: 50ms Entity max Tick Time: 50ms
[03:57:35] [Server thread/INFO]: Max TNT Explosions: 100
[03:57:35] [Server thread/INFO]: Arrow Despawn Rate: 1200 Trident Respawn Rate:1200
[03:57:35] [Server thread/INFO]: Nerfing mobs spawned from spawners: false
[03:57:35] [Server thread/INFO]: Zombie Aggressive Towards Villager: true
[03:57:35] [Server thread/INFO]: Custom Map Seeds:  Village: 10387312 Desert: 14357617 Igloo: 14357618 Jungle: 14357619 Swamp: 14357620 Monument: 10387313 Ocean: 14357621 Shipwreck: 165745295 End City: 10387313 Slime: 987234911 Bastion: 30084232 Fortress: 30084232 Mansion: 10387319 Fossil: 14357921 Portal: 34222645
[03:57:35] [Server thread/INFO]: Hopper Transfer: 8 Hopper Check: 1 Hopper Amount: 1
[03:57:35] [Server thread/INFO]: Experience Merge Radius: 3.0
[03:57:35] [Server thread/INFO]: Cactus Growth Modifier: 100%
[03:57:35] [Server thread/INFO]: Cane Growth Modifier: 100%
[03:57:35] [Server thread/INFO]: Melon Growth Modifier: 100%
[03:57:35] [Server thread/INFO]: Mushroom Growth Modifier: 100%
[03:57:35] [Server thread/INFO]: Pumpkin Growth Modifier: 100%
[03:57:35] [Server thread/INFO]: Sapling Growth Modifier: 100%
[03:57:35] [Server thread/INFO]: Beetroot Growth Modifier: 100%
[03:57:35] [Server thread/INFO]: Carrot Growth Modifier: 100%
[03:57:35] [Server thread/INFO]: Potato Growth Modifier: 100%
[03:57:35] [Server thread/INFO]: Wheat Growth Modifier: 100%
[03:57:35] [Server thread/INFO]: NetherWart Growth Modifier: 100%
[03:57:35] [Server thread/INFO]: Vine Growth Modifier: 100%
[03:57:35] [Server thread/INFO]: Cocoa Growth Modifier: 100%
[03:57:35] [Server thread/INFO]: Bamboo Growth Modifier: 100%
[03:57:35] [Server thread/INFO]: SweetBerry Growth Modifier: 100%
[03:57:35] [Server thread/INFO]: Kelp Growth Modifier: 100%
[03:57:35] [Server thread/INFO]: Mob Spawn Range: 6
[03:57:35] [Server thread/INFO]: Entity Activation Range: An 32 / Mo 32 / Ra 48 / Mi 16 / Tiv true
[03:57:36] [Server thread/INFO]: -------- World Settings For [world_the_end] --------
[03:57:36] [Server thread/INFO]: Allow Zombie Pigmen to spawn from portal blocks: true
[03:57:36] [Server thread/INFO]: Item Despawn Rate: 6000
[03:57:36] [Server thread/INFO]: Item Merge Radius: 2.5
[03:57:36] [Server thread/INFO]: View distance: 10
[03:57:36] [Server thread/INFO]: Entity Tracking Range: Pl 48 / An 48 / Mo 48 / Mi 32 / Other 64
[03:57:36] [Server thread/INFO]: Tile Max Tick Time: 50ms Entity max Tick Time: 50ms
[03:57:36] [Server thread/INFO]: Max TNT Explosions: 100
[03:57:36] [Server thread/INFO]: Arrow Despawn Rate: 1200 Trident Respawn Rate:1200
[03:57:36] [Server thread/INFO]: Nerfing mobs spawned from spawners: false
[03:57:36] [Server thread/INFO]: Zombie Aggressive Towards Villager: true
[03:57:36] [Server thread/INFO]: Custom Map Seeds:  Village: 10387312 Desert: 14357617 Igloo: 14357618 Jungle: 14357619 Swamp: 14357620 Monument: 10387313 Ocean: 14357621 Shipwreck: 165745295 End City: 10387313 Slime: 987234911 Bastion: 30084232 Fortress: 30084232 Mansion: 10387319 Fossil: 14357921 Portal: 34222645
[03:57:36] [Server thread/INFO]: Hopper Transfer: 8 Hopper Check: 1 Hopper Amount: 1
[03:57:36] [Server thread/INFO]: Experience Merge Radius: 3.0
[03:57:36] [Server thread/INFO]: Cactus Growth Modifier: 100%
[03:57:36] [Server thread/INFO]: Cane Growth Modifier: 100%
[03:57:36] [Server thread/INFO]: Melon Growth Modifier: 100%
[03:57:36] [Server thread/INFO]: Mushroom Growth Modifier: 100%
[03:57:36] [Server thread/INFO]: Pumpkin Growth Modifier: 100%
[03:57:36] [Server thread/INFO]: Sapling Growth Modifier: 100%
[03:57:36] [Server thread/INFO]: Beetroot Growth Modifier: 100%
[03:57:36] [Server thread/INFO]: Carrot Growth Modifier: 100%
[03:57:36] [Server thread/INFO]: Potato Growth Modifier: 100%
[03:57:36] [Server thread/INFO]: Wheat Growth Modifier: 100%
[03:57:36] [Server thread/INFO]: NetherWart Growth Modifier: 100%
[03:57:36] [Server thread/INFO]: Vine Growth Modifier: 100%
[03:57:36] [Server thread/INFO]: Cocoa Growth Modifier: 100%
[03:57:36] [Server thread/INFO]: Bamboo Growth Modifier: 100%
[03:57:36] [Server thread/INFO]: SweetBerry Growth Modifier: 100%
[03:57:36] [Server thread/INFO]: Kelp Growth Modifier: 100%
[03:57:36] [Server thread/INFO]: Mob Spawn Range: 6
[03:57:36] [Server thread/INFO]: Entity Activation Range: An 32 / Mo 32 / Ra 48 / Mi 16 / Tiv true
[03:57:36] [Server thread/INFO]: Preparing start region for dimension minecraft:overworld
[03:57:38] [Server thread/INFO]: Preparing spawn area: 0%
[03:57:38] [Server thread/INFO]: Preparing spawn area: 0%
[03:57:38] [Server thread/INFO]: Preparing spawn area: 0%
[03:57:38] [Server thread/INFO]: Preparing spawn area: 0%
[03:57:38] [Server thread/INFO]: Preparing spawn area: 0%
[03:57:38] [Server thread/INFO]: Preparing spawn area: 0%
[03:57:42] [Worker-Main-9/INFO]: Preparing spawn area: 83%
[03:57:42] [Worker-Main-8/INFO]: Preparing spawn area: 83%
[03:57:42] [Worker-Main-17/INFO]: Preparing spawn area: 83%
[03:57:42] [Worker-Main-8/INFO]: Preparing spawn area: 83%
[03:57:42] [Worker-Main-10/INFO]: Preparing spawn area: 83%
[03:57:42] [Worker-Main-11/INFO]: Preparing spawn area: 83%
[03:57:42] [Worker-Main-11/INFO]: Preparing spawn area: 83%
[03:57:42] [Worker-Main-11/INFO]: Preparing spawn area: 83%
[03:57:43] [Server thread/INFO]: Preparing spawn area: 83%
[03:57:43] [Worker-Main-11/INFO]: Preparing spawn area: 88%
[03:57:44] [Worker-Main-11/INFO]: Preparing spawn area: 88%
[03:57:44] [Worker-Main-10/INFO]: Preparing spawn area: 88%
[03:57:45] [Worker-Main-10/INFO]: Preparing spawn area: 93%
[03:57:45] [Server thread/INFO]: Time elapsed: 9382 ms
[03:57:45] [Server thread/INFO]: Preparing start region for dimension minecraft:the_nether
[03:57:46] [Server thread/INFO]: Preparing spawn area: 0%
[03:57:46] [Server thread/INFO]: Preparing spawn area: 0%
[03:57:46] [Server thread/INFO]: Preparing spawn area: 0%
[03:57:46] [Worker-Main-8/INFO]: Preparing spawn area: 83%
[03:57:47] [Worker-Main-10/INFO]: Preparing spawn area: 83%
[03:57:47] [Worker-Main-16/INFO]: Preparing spawn area: 83%
[03:57:48] [Worker-Main-9/INFO]: Preparing spawn area: 89%
[03:57:48] [Worker-Main-10/INFO]: Preparing spawn area: 98%
[03:57:49] [Server thread/INFO]: Time elapsed: 3586 ms
[03:57:49] [Server thread/INFO]: Preparing start region for dimension minecraft:the_end
[03:57:49] [Server thread/INFO]: Preparing spawn area: 0%
[03:57:49] [Worker-Main-10/INFO]: Preparing spawn area: 83%
[03:57:49] [Server thread/INFO]: Time elapsed: 729 ms
[03:57:49] [Server thread/INFO]: [OuterRimCore] Enabling OuterRimCore v0.1
[03:57:49] [Server thread/INFO]: [OuterRimCore] Works!
[03:57:49] [Server thread/WARN]: [OuterRimCore] Loaded class com.sk89q.worldedit.bukkit.BukkitAdapter from WorldEdit v7.1.0;8e55131 which is not a depend,softdepend or loadbefore of this plugin.
[03:57:49] [Server thread/ERROR]: Error occurred while enabling OuterRimCore v0.1 (Is it up to date?)
java.lang.NullPointerException: null
    at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:770) ~[spigot.jar:git-Spigot-b5a13e6-3980640]
    at com.sk89q.worldedit.bukkit.BukkitAdapter.adapt(BukkitAdapter.java:120) ~[?:?]
    at com.psychoticatt.outerrimcore.Radiation.<init>(Radiation.java:27) ~[?:?]
    at com.psychoticatt.outerrimcore.Main.onEnable(Main.java:11) ~[?:?]
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[spigot.jar:git-Spigot-b5a13e6-3980640]
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:351) ~[spigot.jar:git-Spigot-b5a13e6-3980640]
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:480) ~[spigot.jar:git-Spigot-b5a13e6-3980640]
    at org.bukkit.craftbukkit.v1_16_R2.CraftServer.enablePlugin(CraftServer.java:492) ~[spigot.jar:git-Spigot-b5a13e6-3980640]
    at org.bukkit.craftbukkit.v1_16_R2.CraftServer.enablePlugins(CraftServer.java:406) ~[spigot.jar:git-Spigot-b5a13e6-3980640]
    at net.minecraft.server.v1_16_R2.minecraftServer.loadWorld(minecraftServer.java:435) ~[spigot.jar:git-Spigot-b5a13e6-3980640]
    at net.minecraft.server.v1_16_R2.DedicatedServer.init(DedicatedServer.java:219) ~[spigot.jar:git-Spigot-b5a13e6-3980640]
    at net.minecraft.server.v1_16_R2.minecraftServer.w(minecraftServer.java:808) ~[spigot.jar:git-Spigot-b5a13e6-3980640]
    at net.minecraft.server.v1_16_R2.minecraftServer.lambda$0(minecraftServer.java:164) ~[spigot.jar:git-Spigot-b5a13e6-3980640]
    at java.lang.Thread.run(UnkNown Source) [?:1.8.0_261]
[03:57:49] [Server thread/INFO]: [Essentials] Enabling Essentials v2.18.1.3
[03:57:49] [Server thread/INFO]: Attempting to convert old kits in config.yml to new kits.yml
[03:57:49] [Server thread/INFO]: No kits found to migrate.
[03:57:50] [Server thread/INFO]: Loaded 25599 items from items.json.
[03:57:50] [Server thread/INFO]: Using locale en_US
[03:57:50] [Server thread/INFO]: [Essentials] ServerListPingEvent: Spigot iterator API
[03:57:50] [Server thread/INFO]: [Essentials] Starting Metrics. Opt-out using the global bStats config.
[03:57:50] [Server thread/INFO]: [Essentials] Using superperms-based permissions.
[03:57:50] [Server thread/INFO]: [Essentialsspawn] Enabling Essentialsspawn v2.18.1.3
[03:57:50] [Server thread/INFO]: [Essentialsspawn] Starting Metrics. Opt-out using the global bStats config.
[03:57:50] [Server thread/INFO]: [Multiverse-Core] Enabling Multiverse-Core v4.1.0-b775
[03:57:50] [Server thread/WARN]: [Multiverse-Core] "Multiverse-Core v4.1.0-b775" has registered a listener for org.bukkit.event.entity.EntityCreatePortalEvent on method "public void com.onarandomBox.MultiverseCore.listeners.MVPortalListener.entityPortalCreate(org.bukkit.event.entity.EntityCreatePortalEvent)",but the event is Deprecated. "Server performance will be affected"; please notify the authors [Rigby,fern@R_212_5023@,lithium3141,main--,dumptruckman].
[03:57:50] [Server thread/INFO]: [Multiverse-Core] We are aware of the warning about the deprecated event. There is no alternative that allows us to do what we need to do. The performance impact is negligible.
[03:57:50] [Server thread/INFO]: -------- World Settings For [wasteland] --------
[03:57:50] [Server thread/INFO]: Allow Zombie Pigmen to spawn from portal blocks: true
[03:57:50] [Server thread/INFO]: Item Despawn Rate: 6000
[03:57:50] [Server thread/INFO]: Item Merge Radius: 2.5
[03:57:50] [Server thread/INFO]: View distance: 10
[03:57:50] [Server thread/INFO]: Entity Tracking Range: Pl 48 / An 48 / Mo 48 / Mi 32 / Other 64
[03:57:50] [Server thread/INFO]: Tile Max Tick Time: 50ms Entity max Tick Time: 50ms
[03:57:50] [Server thread/INFO]: Max TNT Explosions: 100
[03:57:50] [Server thread/INFO]: Arrow Despawn Rate: 1200 Trident Respawn Rate:1200
[03:57:50] [Server thread/INFO]: Nerfing mobs spawned from spawners: false
[03:57:50] [Server thread/INFO]: Zombie Aggressive Towards Villager: true
[03:57:50] [Server thread/INFO]: Custom Map Seeds:  Village: 10387312 Desert: 14357617 Igloo: 14357618 Jungle: 14357619 Swamp: 14357620 Monument: 10387313 Ocean: 14357621 Shipwreck: 165745295 End City: 10387313 Slime: 987234911 Bastion: 30084232 Fortress: 30084232 Mansion: 10387319 Fossil: 14357921 Portal: 34222645
[03:57:50] [Server thread/INFO]: Hopper Transfer: 8 Hopper Check: 1 Hopper Amount: 1
[03:57:50] [Server thread/INFO]: Experience Merge Radius: 3.0
[03:57:50] [Server thread/INFO]: Cactus Growth Modifier: 100%
[03:57:50] [Server thread/INFO]: Cane Growth Modifier: 100%
[03:57:50] [Server thread/INFO]: Melon Growth Modifier: 100%
[03:57:50] [Server thread/INFO]: Mushroom Growth Modifier: 100%
[03:57:50] [Server thread/INFO]: Pumpkin Growth Modifier: 100%
[03:57:50] [Server thread/INFO]: Sapling Growth Modifier: 100%
[03:57:50] [Server thread/INFO]: Beetroot Growth Modifier: 100%
[03:57:50] [Server thread/INFO]: Carrot Growth Modifier: 100%
[03:57:50] [Server thread/INFO]: Potato Growth Modifier: 100%
[03:57:50] [Server thread/INFO]: Wheat Growth Modifier: 100%
[03:57:50] [Server thread/INFO]: NetherWart Growth Modifier: 100%
[03:57:50] [Server thread/INFO]: Vine Growth Modifier: 100%
[03:57:50] [Server thread/INFO]: Cocoa Growth Modifier: 100%
[03:57:50] [Server thread/INFO]: Bamboo Growth Modifier: 100%
[03:57:50] [Server thread/INFO]: SweetBerry Growth Modifier: 100%
[03:57:50] [Server thread/INFO]: Kelp Growth Modifier: 100%
[03:57:50] [Server thread/INFO]: Mob Spawn Range: 6
[03:57:50] [Server thread/INFO]: Entity Activation Range: An 32 / Mo 32 / Ra 48 / Mi 16 / Tiv true
[03:57:50] [Server thread/INFO]: Preparing start region for dimension minecraft:wasteland
[03:57:50] [Server thread/INFO]: Preparing spawn area: 0%
[03:57:50] [Server thread/INFO]: Time elapsed: 381 ms
[03:57:50] [Server thread/INFO]: [Multiverse-Core] 4 - World(s) loaded.
[03:57:51] [Server thread/INFO]: [Multiverse-Core] Version 4.1.0-b775 (API v24) Enabled - By Rigby,main-- and dumptruckman
[03:57:51] [Server thread/INFO]: [Multiverse-Core] Help dumptruckman keep this project alive. Become a patron! https://www.patreon.com/dumptruckman
[03:57:51] [Server thread/INFO]: [Multiverse-Core] One time donations are also appreciated: https://www.paypal.me/dumptruckman
[03:57:51] [Server thread/INFO]: Server permissions file permissions.yml is empty,ignoring it
[03:57:51] [Server thread/INFO]: Done (16.310s)! For help,type "help"
[03:57:53] [Server thread/INFO]: Stopping server
[03:57:53] [Server thread/INFO]: [Multiverse-Core] disabling Multiverse-Core v4.1.0-b775
[03:57:53] [Server thread/INFO]: [Essentialsspawn] disabling Essentialsspawn v2.18.1.3
[03:57:53] [Server thread/INFO]: [Essentials] disabling Essentials v2.18.1.3
[03:57:53] [Server thread/INFO]: [OuterRimCore] disabling OuterRimCore v0.1
[03:57:53] [Server thread/INFO]: [WorldEdit] disabling WorldEdit v7.1.0;8e55131
[03:57:53] [Server thread/INFO]: Unregistering com.sk89q.worldedit.bukkit.BukkitServerInterface from WorldEdit
[03:57:53] [Server thread/INFO]: Saving players
[03:57:54] [Server thread/INFO]: Saving worlds
[03:57:54] [Server thread/INFO]: Saving chunks for level 'ServerLevel[world]'/minecraft:overworld
[03:57:55] [Server thread/INFO]: ThreadedAnvilChunkStorage (world): All chunks are saved
[03:57:55] [Server thread/INFO]: Saving chunks for level 'ServerLevel[world_nether]'/minecraft:the_nether
[03:57:56] [Server thread/INFO]: ThreadedAnvilChunkStorage (DIM-1): All chunks are saved
[03:57:56] [Server thread/INFO]: Saving chunks for level 'ServerLevel[world_the_end]'/minecraft:the_end
[03:57:56] [Server thread/INFO]: ThreadedAnvilChunkStorage (DIM1): All chunks are saved
[03:57:56] [Server thread/INFO]: Saving chunks for level 'ServerLevel[wasteland]'/minecraft:wasteland
[03:57:56] [Server thread/INFO]: ThreadedAnvilChunkStorage (wasteland): All chunks are saved
[03:57:56] [Server thread/INFO]: ThreadedAnvilChunkStorage (world): All chunks are saved
[03:57:56] [Server thread/INFO]: ThreadedAnvilChunkStorage (DIM-1): All chunks are saved
[03:57:56] [Server thread/INFO]: ThreadedAnvilChunkStorage (DIM1): All chunks are saved
[03:57:56] [Server thread/INFO]: ThreadedAnvilChunkStorage (wasteland): All chunks are saved

任何帮助将不胜感激,因为我似乎无法在其他任何地方找到解决方案。

解决方法

我知道了!

事实证明,我的自定义事件类不完整,并且未设置为返回事件处理程序。所以我主类中的onEnable()方法试图获取所有事件处理程序,并为其中一个获取空值。

我在这里包括了更新的代码:

Traceback (most recent call last):
 File "C:/Users/Softech/Desktop/tkinterproject.py",line 29,in <module>
 reg=Button(home,text="Register",bg='brown',fg='white',width=20,command=regc)
 NameError: name 'regc' is not defined

感谢大家如此迅速的答复,您帮助我走上了正轨!