(Is it up to date?) <--- What's wrong with it?

Discussion in 'Plugin Development' started by 李培綸, Apr 5, 2019.

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

    李培綸

    Code:
    [00:50:49 ERROR]: Error occurred while enabling TGM v1.0-SNAPSHOT (Is it up to date?)
    java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
            at java.util.ArrayList.rangeCheck(Unknown Source) ~[?:1.8.0_201]
            at java.util.ArrayList.get(Unknown Source) ~[?:1.8.0_201]
            at network.warzone.tgm.map.MapRotationFile.cycle(MapRotationFile.java:31) ~[?:?]
            at network.warzone.tgm.match.MatchManager.cycleNextMatch(MatchManager.java:76) ~[?:?]
            at network.warzone.tgm.TGM.onEnable(TGM.java:111) ~[?:?]
            at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:265) ~[patched_1.13.2.jar:git-Paper-605]
            at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:334) ~[patched_1.13.2.jar:git-Paper-605]
            at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:412) ~[patched_1.13.2.jar:git-Paper-605]
            at org.bukkit.craftbukkit.v1_13_R2.CraftServer.enablePlugin(CraftServer.java:443) ~[patched_1.13.2.jar:git-Paper-605]
            at org.bukkit.craftbukkit.v1_13_R2.CraftServer.enablePlugins(CraftServer.java:357) ~[patched_1.13.2.jar:git-Paper-605]
            at net.minecraft.server.v1_13_R2.MinecraftServer.l(MinecraftServer.java:608) ~[patched_1.13.2.jar:git-Paper-605]
            at net.minecraft.server.v1_13_R2.MinecraftServer.a(MinecraftServer.java:570) ~[patched_1.13.2.jar:git-Paper-605]
            at net.minecraft.server.v1_13_R2.MinecraftServer.a(MinecraftServer.java:431) ~[patched_1.13.2.jar:git-Paper-605]
            at net.minecraft.server.v1_13_R2.DedicatedServer.init(DedicatedServer.java:316) ~[patched_1.13.2.jar:git-Paper-605]
            at net.minecraft.server.v1_13_R2.MinecraftServer.run(MinecraftServer.java:787) ~[patched_1.13.2.jar:git-Paper-605]
            at java.lang.Thread.run(Unknown Source) [?:1.8.0_201]
    What's wrong with it?
     
  2. Offline

    timtower Ninja on the waves Moderator

  3. Offline

    李培綸

    No, This is not my plugin, but this plugin is open for modification.
     
  4. Offline

    timtower Ninja on the waves Moderator

    @李培綸 It wants to use something that doesn't exist. There are no elements in the list
     
    李培綸 likes this.
  5. Offline

    _Vallee

    There is an error in the code, the Imported Library "java.util.ArrayList.rangeCheck" does not exist.
    An Imported Library is Function or Variable you import into the Class.
    Code:
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.java.JavaPlugin;
    import org.bukkit.potion.PotionEffect;
    import org.bukkit.potion.PotionEffectType;
    You can then use that imported function or variable to set anything
    Code:
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
         {
         if(cmd.getName().equalsIgnoreCase("Kit_Scout") &&sender instanceof Player)
           {
           Scout = true;
           
           Player player = (Player) sender;
           player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 1000000, 0, false, false));
           player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 1000000, 0, false, false));
           player.setFoodLevel(20);
           
           return true;
           }
         return false;
         }
    if the Library import org.bukkit.potion.PotionEffect and import org.bukkit.potion.PotionEffectType was missing then the resulting error would be "PotionEffectType cannot be resolved to a variable"
     
    Last edited by a moderator: Apr 5, 2019
  6. Offline

    timtower Ninja on the waves Moderator

    @_Vallee Are you on the right thread?
     
  7. Offline

    _Vallee

    (Is it up to date?) <--- What's wrong with it?
    I explained why the Plugin was not working.
    at java.util.ArrayList.rangeCheck(Unknown Source), a Library is missing. I stated why the plugin was not working.
    "It wants to use something that doesn't exist." is true
     
  8. Offline

    timtower Ninja on the waves Moderator

    @_Vallee It is a function for ArrayList, and the error is an IndexOutOfBounds.
    That means that something is trying to get the first element of a list that has no items in it.
    No missing libraries here
     
    KarimAKL likes this.
  9. Offline

    _Vallee

    java.util.ArrayList.rangeCheck(Unknown Source), java.util is a library.
    Example: import java.util.function.*;.

    The library called "java.util.ArrayList.rangeCheck", while "java.util.ArrayList" is a library. The import "java.util.ArrayList.rangeCheck" does not exist and will give the error "
    The import java.util.ArrayList.rangeCheck cannot be resolved"
     
  10. Offline

    timtower Ninja on the waves Moderator

    The cannot be resolved is an IDE error. In this case for a standard library.
    The IndexOutOfBounds says everything.
    I don't know from where you get the "cannot be resolved" anyways because you are the first one to post it.
     
Thread Status:
Not open for further replies.

Share This Page