• Hello Guest! Did you know that ProjectKorra has an official Discord server? A lot of discussion about the official server, development process, and community discussion happens over there. Feel free to join now by clicking the link below.

    Join the Discord Server

[Programming Problem] Addon creation.

Galimordant

Verified Member
Hi Everyone.

I encountered a problem when trying to program my first addon ability called "Firedome". Everything went well until I created my manager class I wrote :

package com.projectkorra.ability;
import com.projectkorra.projectkorra.firebending.Firedome;

public class FiredomeManager implements Runnable {
public void run(){
Firedome.progressAll();
}
}


It gives me an error at "progressAll". I already of course created the "progressAll" method in my "Firedome" class. But when I hover my mouse over the error, it seems to say that I have to put some kind of argument in it but I just have no idea about what to do. Sorry if this may seems obvious for some of you but I'm really a newbie in these things. So if someone would be able to help me. Oh and I'm not really sure if this post is supposed to be in this section so excuse me if it wasn't.

Galimordant
 

jedk1

New Member
Hi Everyone.

I encountered a problem when trying to program my first addon ability called "Firedome". Everything went well until I created my manager class I wrote :

package com.projectkorra.ability;
import com.projectkorra.projectkorra.firebending.Firedome;

public class FiredomeManager implements Runnable {
public void run(){
Firedome.progressAll();
}
}


It gives me an error at "progressAll". I already of course created the "progressAll" method in my "Firedome" class. But when I hover my mouse over the error, it seems to say that I have to put some kind of argument in it but I just have no idea about what to do. Sorry if this may seems obvious for some of you but I'm really a newbie in these things. So if someone would be able to help me. Oh and I'm not really sure if this post is supposed to be in this section so excuse me if it wasn't.

Galimordant
Hey there, mind showing us your Firedome.class ?
 

Galimordant

Verified Member
package com.projectkorra.ability;

import java.util.concurrent.ConcurrentHashMap;

import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;

import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ProjectKorra;
import com.projectkorra.projectkorra.util.ParticleEffect;

public class Firedome {
public static ConcurrentHashMap<Integer, Firedome> instances = new ConcurrentHashMap<Integer, Firedome>();
private Player p;
private Location loc;
private boolean hasHit;
private double RANGE = ProjectKorra.plugin.getConfig().getDouble("com.projectkorra.ability.Firedome.Range");
private double DAMAGE = ProjectKorra.plugin.getConfig().getDouble("com.projectkorra.ability.Firedome.Damage");

private int id;
private int ID = Integer.MIN_VALUE;

public Firedome(Player player){
this.p = player;
loc = player.getLocation();
createInstance();
}
public void createInstance(){
id = ID;
instances.put(id, this);
if(ID == Integer.MAX_VALUE)
ID = Integer.MIN_VALUE;
ID++;
}
public void cancel(){
instances.remove(id);
}
public void evnts(){
if(p.isDead() || !p.isOnline()){
cancel();
return;
}
ParticleEffect.LARGE_SMOKE.display(loc, 0.1F, 0.1F, 0.1F, 0.01F, 2);
ParticleEffect.FLAME.display(loc, 0.2F, 0.2F, 0.2F, 0.02F, 5);

for(Entity entity : GeneralMethods.getEntitiesAroundPoint(loc, 2.0)){
if(entity instanceof LivingEntity && entity.getEntityId() != p.getEntityId()){
doDamage((LivingEntity) entity);
}
}
}
public void doDamage(LivingEntity entity){
hasHit = true;
GeneralMethods.damageEntity(p, entity, DAMAGE);
entity.setFireTicks(50);
}
public static void progressAll(){
for(int ID : instances.keySet()){
instances.get(ID).evnts();
}
}
public static void removeAll(){
instances.clear();
}

}
 

Varni1

Verified Member
Just a tip, make sure to format your code {CODE} tags... it makes is easier to read ;)[/CODE]
 

Finn_Bueno_

Staff member
Plugin Developer
Verified Member
You can also navigate to my youtube channel by clicking the youtube logo in my signature! :)
 
Top