Solved Null Error

Discussion in 'Plugin Development' started by notdew, Oct 27, 2021.

Thread Status:
Not open for further replies.
  1. Offline

    notdew

    Hello I am making a plugin that once you get hit by an arrow getting 'passed to' after 3 hits it does something. I have attached my code below and this happens whenever I hit my alt account with a bow. This is a minecraft football tackling plugin. Attached is my log from recent load.
    Code:
    [19:35:14] [Server thread/INFO]: Starting minecraft server version 1.12.2
    [19:35:14] [Server thread/INFO]: Loading properties
    [19:35:14] [Server thread/WARN]: resource-pack-hash is deprecated and found along side resource-pack-sha1. resource-pack-hash will be ignored.
    [19:35:14] [Server thread/INFO]: Default game type: SURVIVAL
    [19:35:14] [Server thread/INFO]: This server is running CraftBukkit version git-Spigot-dcd1643-e60fc34 (MC: 1.12.2) (Implementing API version 1.12.2-R0.1-SNAPSHOT)
    [19:35:14] [Server thread/INFO]: Debug logging is disabled
    [19:35:14] [Server thread/INFO]: Server Ping Player Sample Count: 12
    [19:35:14] [Server thread/INFO]: Using 4 threads for Netty based IO
    [19:35:14] [Server thread/INFO]: Generating keypair
    [19:35:14] [Server thread/INFO]: Starting Minecraft server on *:25565
    [19:35:14] [Server thread/INFO]: Using default channel type
    [19:35:15] [Server thread/INFO]: Set PluginClassLoader as parallel capable
    [19:35:15] [Server thread/INFO]: [PlugMan] Loading PlugMan v2.1.7
    [19:35:15] [Server thread/INFO]: [RoboRef] Loading RoboRef v1.0
    [19:35:15] [Server thread/INFO]: [Vault] Loading Vault v1.7.3-b131
    [19:35:15] [Server thread/INFO]: [Testing] Loading Testing v1.0-SNAPSHOT
    [19:35:15] [Server thread/INFO]: [WheatMoney] Loading WheatMoney v1.0-SNAPSHOT
    [19:35:15] [Server thread/INFO]: [Essentials] Loading Essentials v2.18.2.0
    [19:35:15] [Server thread/INFO]: [Vault] Enabling Vault v1.7.3-b131
    [19:35:15] [Server thread/INFO]: [Vault] [Economy] Essentials Economy found: Waiting
    [19:35:15] [Server thread/INFO]: [Vault] [Permission] SuperPermissions loaded as backup permission system.
    [19:35:15] [Server thread/INFO]: [Vault] Enabled Version 1.7.3-b131
    [19:35:15] [Server thread/INFO]: **** Beginning UUID conversion, this may take A LONG time ****
    [19:35:15] [Server thread/INFO]: Preparing level "world"
    [19:35:15] [Server thread/INFO]: -------- World Settings For [world] --------
    [19:35:15] [Server thread/INFO]: Item Merge Radius: 2.5
    [19:35:15] [Server thread/INFO]: Item Despawn Rate: 6000
    [19:35:15] [Server thread/INFO]: Arrow Despawn Rate: 1200
    [19:35:15] [Server thread/INFO]: Allow Zombie Pigmen to spawn from portal blocks: true
    [19:35:15] [Server thread/INFO]: Zombie Aggressive Towards Villager: true
    [19:35:15] [Server thread/INFO]: View Distance: 10
    [19:35:15] [Server thread/INFO]: Experience Merge Radius: 3.0
    [19:35:15] [Server thread/INFO]: Nerfing mobs spawned from spawners: false
    [19:35:15] [Server thread/INFO]: Tile Max Tick Time: 50ms Entity max Tick Time: 50ms
    [19:35:15] [Server thread/INFO]: Entity Activation Range: An 32 / Mo 32 / Mi 16 / Tiv true
    [19:35:15] [Server thread/INFO]: Entity Tracking Range: Pl 48 / An 48 / Mo 48 / Mi 32 / Other 64
    [19:35:15] [Server thread/INFO]: Random Lighting Updates: false
    [19:35:15] [Server thread/INFO]: Structure Info Saving: true
    [19:35:15] [Server thread/INFO]: Custom Map Seeds:  Village: 10387312 Feature: 14357617 Monument: 10387313 Slime: 987234911
    [19:35:15] [Server thread/INFO]: Cactus Growth Modifier: 100%
    [19:35:15] [Server thread/INFO]: Cane Growth Modifier: 100%
    [19:35:15] [Server thread/INFO]: Melon Growth Modifier: 100%
    [19:35:15] [Server thread/INFO]: Mushroom Growth Modifier: 100%
    [19:35:15] [Server thread/INFO]: Pumpkin Growth Modifier: 100%
    [19:35:15] [Server thread/INFO]: Sapling Growth Modifier: 100%
    [19:35:15] [Server thread/INFO]: Wheat Growth Modifier: 100%
    [19:35:15] [Server thread/INFO]: NetherWart Growth Modifier: 100%
    [19:35:15] [Server thread/INFO]: Vine Growth Modifier: 100%
    [19:35:15] [Server thread/INFO]: Cocoa Growth Modifier: 100%
    [19:35:15] [Server thread/INFO]: Max TNT Explosions: 100
    [19:35:15] [Server thread/INFO]: Mob Spawn Range: 6
    [19:35:15] [Server thread/INFO]: Hopper Transfer: 8 Hopper Check: 1 Hopper Amount: 1
    [19:35:16] [Server thread/INFO]: -------- World Settings For [world_nether] --------
    [19:35:16] [Server thread/INFO]: Item Merge Radius: 2.5
    [19:35:16] [Server thread/INFO]: Item Despawn Rate: 6000
    [19:35:16] [Server thread/INFO]: Arrow Despawn Rate: 1200
    [19:35:16] [Server thread/INFO]: Allow Zombie Pigmen to spawn from portal blocks: true
    [19:35:16] [Server thread/INFO]: Zombie Aggressive Towards Villager: true
    [19:35:16] [Server thread/INFO]: View Distance: 10
    [19:35:16] [Server thread/INFO]: Experience Merge Radius: 3.0
    [19:35:16] [Server thread/INFO]: Nerfing mobs spawned from spawners: false
    [19:35:16] [Server thread/INFO]: Tile Max Tick Time: 50ms Entity max Tick Time: 50ms
    [19:35:16] [Server thread/INFO]: Entity Activation Range: An 32 / Mo 32 / Mi 16 / Tiv true
    [19:35:16] [Server thread/INFO]: Entity Tracking Range: Pl 48 / An 48 / Mo 48 / Mi 32 / Other 64
    [19:35:16] [Server thread/INFO]: Random Lighting Updates: false
    [19:35:16] [Server thread/INFO]: Structure Info Saving: true
    [19:35:16] [Server thread/INFO]: Custom Map Seeds:  Village: 10387312 Feature: 14357617 Monument: 10387313 Slime: 987234911
    [19:35:16] [Server thread/INFO]: Cactus Growth Modifier: 100%
    [19:35:16] [Server thread/INFO]: Cane Growth Modifier: 100%
    [19:35:16] [Server thread/INFO]: Melon Growth Modifier: 100%
    [19:35:16] [Server thread/INFO]: Mushroom Growth Modifier: 100%
    [19:35:16] [Server thread/INFO]: Pumpkin Growth Modifier: 100%
    [19:35:16] [Server thread/INFO]: Sapling Growth Modifier: 100%
    [19:35:16] [Server thread/INFO]: Wheat Growth Modifier: 100%
    [19:35:16] [Server thread/INFO]: NetherWart Growth Modifier: 100%
    [19:35:16] [Server thread/INFO]: Vine Growth Modifier: 100%
    [19:35:16] [Server thread/INFO]: Cocoa Growth Modifier: 100%
    [19:35:16] [Server thread/INFO]: Max TNT Explosions: 100
    [19:35:16] [Server thread/INFO]: Mob Spawn Range: 6
    [19:35:16] [Server thread/INFO]: Hopper Transfer: 8 Hopper Check: 1 Hopper Amount: 1
    [19:35:16] [Server thread/INFO]: -------- World Settings For [world_the_end] --------
    [19:35:16] [Server thread/INFO]: Item Merge Radius: 2.5
    [19:35:16] [Server thread/INFO]: Item Despawn Rate: 6000
    [19:35:16] [Server thread/INFO]: Arrow Despawn Rate: 1200
    [19:35:16] [Server thread/INFO]: Allow Zombie Pigmen to spawn from portal blocks: true
    [19:35:16] [Server thread/INFO]: Zombie Aggressive Towards Villager: true
    [19:35:16] [Server thread/INFO]: View Distance: 10
    [19:35:16] [Server thread/INFO]: Experience Merge Radius: 3.0
    [19:35:16] [Server thread/INFO]: Nerfing mobs spawned from spawners: false
    [19:35:16] [Server thread/INFO]: Tile Max Tick Time: 50ms Entity max Tick Time: 50ms
    [19:35:16] [Server thread/INFO]: Entity Activation Range: An 32 / Mo 32 / Mi 16 / Tiv true
    [19:35:16] [Server thread/INFO]: Entity Tracking Range: Pl 48 / An 48 / Mo 48 / Mi 32 / Other 64
    [19:35:16] [Server thread/INFO]: Random Lighting Updates: false
    [19:35:16] [Server thread/INFO]: Structure Info Saving: true
    [19:35:16] [Server thread/INFO]: Custom Map Seeds:  Village: 10387312 Feature: 14357617 Monument: 10387313 Slime: 987234911
    [19:35:16] [Server thread/INFO]: Cactus Growth Modifier: 100%
    [19:35:16] [Server thread/INFO]: Cane Growth Modifier: 100%
    [19:35:16] [Server thread/INFO]: Melon Growth Modifier: 100%
    [19:35:16] [Server thread/INFO]: Mushroom Growth Modifier: 100%
    [19:35:16] [Server thread/INFO]: Pumpkin Growth Modifier: 100%
    [19:35:16] [Server thread/INFO]: Sapling Growth Modifier: 100%
    [19:35:16] [Server thread/INFO]: Wheat Growth Modifier: 100%
    [19:35:16] [Server thread/INFO]: NetherWart Growth Modifier: 100%
    [19:35:16] [Server thread/INFO]: Vine Growth Modifier: 100%
    [19:35:16] [Server thread/INFO]: Cocoa Growth Modifier: 100%
    [19:35:16] [Server thread/INFO]: Max TNT Explosions: 100
    [19:35:16] [Server thread/INFO]: Mob Spawn Range: 6
    [19:35:16] [Server thread/INFO]: Hopper Transfer: 8 Hopper Check: 1 Hopper Amount: 1
    [19:35:16] [Server thread/INFO]: Preparing start region for level 0 (Seed: 1391075044624263318)
    [19:35:16] [User Authenticator #1/INFO]: UUID of player JohnnyyJohnnyy is ab285988-5a9e-4428-869f-ed2e75e08c6d
    [19:35:16] [User Authenticator #2/INFO]: UUID of player NotDew is 9655f153-c668-4b65-a160-720e5bc48a11
    [19:35:17] [Server thread/INFO]: Preparing spawn area: 27%
    [19:35:18] [Server thread/INFO]: Preparing spawn area: 90%
    [19:35:18] [Server thread/INFO]: Preparing start region for level 1 (Seed: 1391075044624263318)
    [19:35:19] [Server thread/INFO]: Preparing spawn area: 45%
    [19:35:20] [Server thread/INFO]: Preparing spawn area: 94%
    [19:35:20] [Server thread/INFO]: Preparing start region for level 2 (Seed: 1391075044624263318)
    [19:35:20] [Server thread/INFO]: [PlugMan] Enabling PlugMan v2.1.7
    [19:35:20] [Server thread/INFO]: [RoboRef] Enabling RoboRef v1.0
    [19:35:20] [Server thread/ERROR]: RoboRef is enabling!
    [19:35:20] [Server thread/INFO]: [Testing] Enabling Testing v1.0-SNAPSHOT
    [19:35:20] [Server thread/INFO]: Starting!
    [19:35:20] [Server thread/INFO]: [WheatMoney] Enabling WheatMoney v1.0-SNAPSHOT
    [19:35:20] [Server thread/ERROR]: WheatMoney is enabling... Helllllo!
    [19:35:20] [Server thread/INFO]: [Essentials] Enabling Essentials v2.18.2.0
    [19:35:20] [Server thread/INFO]: [Essentials] You are running a server with limited API functionality. EssentialsX will still work, but certain features may be disabled.
    [19:35:20] [Server thread/INFO]: Attempting to convert old kits in config.yml to new kits.yml
    [19:35:20] [Server thread/INFO]: No kits found to migrate.
    [19:35:21] [Server thread/INFO]: Loaded 852 items from items.csv.
    [19:35:21] [Server thread/INFO]: Using locale en_US
    [19:35:21] [Server thread/INFO]: [Essentials] ServerListPingEvent: Spigot iterator API
    [19:35:21] [Server thread/INFO]: [Essentials] Starting Metrics. Opt-out using the global bStats config.
    [19:35:21] [Server thread/INFO]: [Vault] [Economy] Essentials Economy hooked.
    [19:35:21] [Server thread/INFO]: [Essentials] Using superperms-based permissions.
    [19:35:21] [Server thread/INFO]: Server permissions file permissions.yml is empty, ignoring it
    [19:35:21] [Server thread/INFO]: Done (5.590s)! For help, type "help" or "?"
    [19:35:21] [Craft Scheduler Thread - 3/INFO]: [Vault] Checking for Updates ...
    [19:35:21] [Craft Scheduler Thread - 3/INFO]: [Vault] No new version available
    [19:35:21] [Server thread/INFO]: JohnnyyJohnnyy[/127.0.0.1:55022] logged in with entity id 230 at ([world]-198.69999998807907, 72.0, 179.30000001192093)
    [19:35:21] [Server thread/INFO]: NotDew[/127.0.0.1:55024] logged in with entity id 231 at ([world]-197.98415171023757, 73.0, 181.60794877437183)
    [19:35:24] [Server thread/INFO]: Projectile Hit[m
    [19:35:24] [Server thread/ERROR]: Could not pass event ProjectileHitEvent to RoboRef v1.0
    org.bukkit.event.EventException: null
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
        at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:500) [spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:485) [spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
        at org.bukkit.craftbukkit.v1_12_R1.event.CraftEventFactory.callProjectileHitEvent(CraftEventFactory.java:803) [spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
        at net.minecraft.server.v1_12_R1.EntityArrow.a(EntityArrow.java:259) [spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
        at net.minecraft.server.v1_12_R1.EntityArrow.B_(EntityArrow.java:194) [spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
        at net.minecraft.server.v1_12_R1.EntityTippedArrow.B_(EntityTippedArrow.java:86) [spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
        at net.minecraft.server.v1_12_R1.World.entityJoinedWorld(World.java:1631) [spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
        at net.minecraft.server.v1_12_R1.World.h(World.java:1601) [spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
        at net.minecraft.server.v1_12_R1.World.tickEntities(World.java:1435) [spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
        at net.minecraft.server.v1_12_R1.WorldServer.tickEntities(WorldServer.java:668) [spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
        at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:817) [spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
        at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:406) [spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
        at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:679) [spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
        at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:577) [spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
        at java.lang.Thread.run(Thread.java:829) [?:?]
    Caused by: java.lang.IllegalArgumentException: Plugin already initialized!
        at org.bukkit.plugin.java.PluginClassLoader.initialize(PluginClassLoader.java:183) ~[spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
        at org.bukkit.plugin.java.JavaPlugin.<init>(JavaPlugin.java:60) ~[spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
        at me.notdew.com.roboref.RoboRef.<init>(RoboRef.java:14) ~[?:?]
        at me.notdew.com.roboref.Events.ArrowHit.onProjectileHit(ArrowHit.java:21) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:302) ~[spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
        ... 16 more
    Caused by: java.lang.IllegalStateException: Initial initialization
        at org.bukkit.plugin.java.PluginClassLoader.initialize(PluginClassLoader.java:186) ~[spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
        at org.bukkit.plugin.java.JavaPlugin.<init>(JavaPlugin.java:60) ~[spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
        at me.notdew.com.roboref.RoboRef.<init>(RoboRef.java:14) ~[?:?]
        at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
        at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:?]
        at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:490) ~[?:?]
        at java.lang.Class.newInstance(Class.java:584) ~[?:?]
        at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:90) ~[spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:129) ~[spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
        at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:327) ~[spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:248) ~[spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
        at org.bukkit.craftbukkit.v1_12_R1.CraftServer.loadPlugins(CraftServer.java:305) ~[spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
        at net.minecraft.server.v1_12_R1.DedicatedServer.init(DedicatedServer.java:205) ~[spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
        at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:545) ~[spigot-1.12.2.jar:git-Spigot-dcd1643-e60fc34]
        ... 1 more
    [19:35:29] [Server thread/INFO]: NotDew issued server command: /fly
    [19:38:14] [Server thread/INFO]: Stopping the server
    [19:38:14] [Server thread/INFO]: Stopping server
    [19:38:14] [Server thread/INFO]: [Essentials] Disabling Essentials v2.18.2.0
    [19:38:14] [Server thread/INFO]: [Vault] [Economy] Essentials Economy unhooked.
    [19:38:14] [Server thread/INFO]: [WheatMoney] Disabling WheatMoney v1.0-SNAPSHOT
    [19:38:14] [Server thread/INFO]: [WheatMoney] Disabled Version 1.0-SNAPSHOT
    [19:38:14] [Server thread/INFO]: WheatMoney is disabling... Bye!
    [19:38:14] [Server thread/INFO]: [Testing] Disabling Testing v1.0-SNAPSHOT
    [19:38:14] [Server thread/INFO]: [Vault] Disabling Vault v1.7.3-b131
    [19:38:14] [Server thread/INFO]: [RoboRef] Disabling RoboRef v1.0
    [19:38:14] [Server thread/INFO]: [PlugMan] Disabling PlugMan v2.1.7
    [19:38:14] [Server thread/INFO]: Saving players
    [19:38:14] [Server thread/INFO]: JohnnyyJohnnyy lost connection: Server closed
    [19:38:14] [Server thread/INFO]: JohnnyyJohnnyy left the game
    [19:38:14] [Server thread/INFO]: NotDew lost connection: Server closed
    [19:38:14] [Server thread/INFO]: NotDew left the game
    [19:38:14] [Server thread/INFO]: Saving worlds
    [19:38:14] [Server thread/INFO]: Saving chunks for level 'world'/overworld
    [19:38:14] [Server thread/INFO]: Saving chunks for level 'world_nether'/the_nether
    [19:38:14] [Server thread/INFO]: Saving chunks for level 'world_the_end'/the_end
    

    And here is my code
    Code:
    package me.notdew.com.roboref;
    
    import me.notdew.com.roboref.Events.ArrowHit;
    import me.notdew.com.roboref.Events.PlayerHit;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.java.JavaPlugin;
    
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.List;
    import java.util.Map;
    import java.util.logging.Logger;
    
    public final class RoboRef extends JavaPlugin {
        private static final Logger log = Logger.getLogger("Minecraft");
    
        public ArrayList<Player> HitList = new ArrayList<Player>();
        public ArrayList<Player> OneHitList = new ArrayList<Player>();
        public ArrayList<Player> TwoHitList = new ArrayList<Player>();
    
    
    
        @Override
        public void onEnable() {
            // Plugin startup logic
    
            log.severe(String.format("RoboRef is enabling!"));
            getServer().getPluginManager().registerEvents(new ArrowHit(), this);
            getServer().getPluginManager().registerEvents(new PlayerHit(), this);
    
        }
    
        @Override
        public void onDisable() {
            // Plugin shutdown logic
        }
    }
    
    Code:
    package me.notdew.com.roboref.Events;
    
    import org.bukkit.Bukkit;
    import org.bukkit.entity.Entity;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.entity.ProjectileHitEvent;
    import me.notdew.com.roboref.RoboRef;
    
    import java.util.ArrayList;
    
    
    public class ArrowHit implements Listener {
    
        @EventHandler
        public void onProjectileHit(ProjectileHitEvent e){
            if (e.getHitEntity() instanceof Player){
                Player damageTaker = (Player)e.getHitEntity();
                Bukkit.broadcastMessage("Projectile Hit");
                RoboRef roboref = new RoboRef();
                roboref.HitList.add(damageTaker);
            }
            else {
            }
    
    
    
        }
    
    }
    
    Code:
    package me.notdew.com.roboref.Events;
    
    import me.notdew.com.roboref.RoboRef;
    import org.bukkit.Bukkit;
    import org.bukkit.Location;
    import org.bukkit.Material;
    import org.bukkit.World;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.entity.EntityDamageByEntityEvent;
    import org.bukkit.event.player.PlayerInteractAtEntityEvent;
    import org.bukkit.event.player.PlayerInteractEntityEvent;
    
    public class PlayerHit implements Listener {
    
    
        @EventHandler
        public void onPlayerHit(EntityDamageByEntityEvent e){
    
            if ((e.getDamager() instanceof Player && e.getEntity() instanceof Player)){
    
                Bukkit.broadcastMessage("a");
                Player player = (Player) e.getEntity();
    
                RoboRef Hit = new RoboRef();
    
    
                if (Hit.HitList.contains(player)){
                    Bukkit.broadcastMessage("b");
                    Hit.OneHitList.add(player);
                    Hit.HitList.remove(player);
                }
                if(Hit.OneHitList.contains(player)) {
                    Bukkit.broadcastMessage("c");
                    Hit.OneHitList.remove(player);
    
                }
                if(Hit.TwoHitList.contains(player)) {
                    Bukkit.broadcastMessage("d");
                    Hit.TwoHitList.remove(player);
    
                    Location l = player.getLocation();
                    World w = player.getWorld();
                    w.getBlockAt(l).setType(Material.DIRT);
    
                }
                else {
                    return;
                }
    
            }
    
    
    
    
    
        }
    }
    
    RoboRef is the name of the plugin and main class. Ty.
     
  2. Offline

    Kars

    You are doing this
    PHP:
    RoboRef roboref = new RoboRef();
    And your error is this
    I will let you figure the rest out.
     
Thread Status:
Not open for further replies.

Share This Page