Solved player.setNoDamageTicks()

Discussion in 'Plugin Development' started by FShiwani, Jan 11, 2014.

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

    FShiwani

    Hi,
    I am using player.setNoDamageTicks(200) on PlayerLogin, however it does not seem to be working, damage is still being done in the first 200 ticks(10 seconds)
     
  2. Offline

    NetherResident

    Delay that code by about 2 ticks, then run it. It should add the invincibility to the player then.
     
    FShiwani likes this.
  3. Offline

    FShiwani


    NetherResident
    I delayed it by 2 ticks. However damage is still being done. Does it only work for mob damage or also for fall damage? Because I am testing it by fall damage.
     
  4. FShiwani I think its only damage by mobs/lava/entities... not fall damage...
     
    FShiwani likes this.
  5. Offline

    FShiwani


    Awesome! It is working now, fall damage is an exception.

    Thank you!
     
  6. Offline

    FShiwani

    @Someone_Like_You

    Yeah. It's not related to this topic. I am making custom invincibillity time variable in config and I seem to be getting a huge amount of errors when loading the plugin.

    Code:java
    1. //Invincible Time
    2. int sectime = this.getConfig().getInt("Time");//Time in seconds. Provided from config file.
    3. int time = sectime*20;//Time in seconds converted to time in ticks
    4.  
    5. @Override
    6. public void onEnable(){
    7. getLogger().info("LogProtect invoked. Developed by FShiwani");
    8. getServer().getPluginManager().registerEvents(this, this);
    9. getConfig().options().copyDefaults(true);
    10. saveConfig();
    11. }


    In onPlayerJoin:
    player.setNoDamageTicks(time);

    Someone_Like_You
    Here is the error I receive:

    Code:
    22:25:21 [SEVERE] Could not load 'plugins\LogProtect.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: java.lang.ClassNotFoundException: io.g
    ithub.FShiwani.LogProtect
            at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.j
    ava:184)
            at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.
    java:305)
            at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager
    .java:230)
            at org.bukkit.craftbukkit.v1_6_R3.CraftServer.loadPlugins(CraftServer.ja
    va:241)
            at org.bukkit.craftbukkit.v1_6_R3.CraftServer.<init>(CraftServer.java:21
    9)
            at net.minecraft.server.v1_6_R3.PlayerList.<init>(PlayerList.java:56)
            at net.minecraft.server.v1_6_R3.DedicatedPlayerList.<init>(SourceFile:11
    )
            at net.minecraft.server.v1_6_R3.DedicatedServer.init(DedicatedServer.jav
    a:107)
            at net.minecraft.server.v1_6_R3.MinecraftServer.run(MinecraftServer.java
    :393)
            at net.minecraft.server.v1_6_R3.ThreadServerApplication.run(SourceFile:5
    83)
    Caused by: java.lang.ClassNotFoundException: io.github.FShiwani.LogProtect
            at java.net.URLClassLoader$1.run(Unknown Source)
            at java.net.URLClassLoader$1.run(Unknown Source)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(Unknown Source)
            at org.bukkit.plugin.java.PluginClassLoader.findClass0(PluginClassLoader
    .java:80)
            at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.
    java:53)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at java.lang.Class.forName0(Native Method)
            at java.lang.Class.forName(Unknown Source)
            at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.j
    ava:173)
            ... 9 more
    Edit: Will start new topic, this is un related.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 6, 2016
Thread Status:
Not open for further replies.

Share This Page