Hcf core

Status
This thread has been locked.

felldownstairs

Gypsy Boy | Java Developer
Supreme
Feedback score
4
Posts
783
Reactions
144
Resources
0
so im trying to make a hcf core, and for some reason this code doesnt work. it adds enderpearl: to the scoreboard and i cant use an enderpearl when its on, but when i use an enderpearl and the timer is off, then it adds the scoreboard, sends me the wrong message, but doesnt register the enderpearl:

public class EnderpearlEvent implements Listener {

@EventHandler
public void onPlayerInteract(PlayerInteractEvent e) {
Player p = e.getPlayer();
PlayerScoreboard scoreboard = PlayerScoreboard.getScoreboard(p);
if(e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) {
if(p.getItemInHand().getType() == Material.ENDER_PEARL) {
if(scoreboard.getEntry("enderpearl") == null) {
e.setCancelled(false);
new Entry("enderpearl", scoreboard)
.setCountdown(true)
.setText(ChatColor.GOLD + "Enderpearl:" + ChatColor.WHITE)
.setTime(16)
.send();
}
if(scoreboard.getEntry("enderpearl") != null) {
e.setCancelled(true);
p.updateInventory();
p.sendMessage(ChatColor.RED + "You are still on enderpearl cooldown!");
}
}
}
}

}

help would be appreciated, thanks!
 
PebbleHost
High performance, consistent uptime and fast support. Minecraft hosting that just works.

Larjd

Supreme
Feedback score
11
Posts
429
Reactions
199
Resources
0
I'd suggest you go for something simpler than an HCF Core if you need other people to help you with code.
 

Fle

Top tier Random.
Supreme
Feedback score
11
Posts
1,025
Reactions
425
Resources
0
OMG dude, why you are trying to make an hcf core if you dont know anything of java?
OMG DUDE, why are you so fucking rude.
 

Edvio

Feedback score
8
Posts
351
Reactions
113
Resources
0
public class EnderpearlEvent implements Listener {

@EventHandler
public void onPlayerInteract(PlayerInteractEvent e) {
Player p = e.getPlayer();
PlayerScoreboard scoreboard = PlayerScoreboard.getScoreboard(p);
if(e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) {
if(p.getItemInHand().getType() == Material.ENDER_PEARL) {
if(scoreboard.getEntry("enderpearl") == null) {
e.setCancelled(false);
new Entry("enderpearl", scoreboard)
.setCountdown(true)
.setText(ChatColor.GOLD + "Enderpearl:" + ChatColor.WHITE)
.setTime(16)
.send();
}
if(scoreboard.getEntry("enderpearl") != null) {
e.setCancelled(true);
p.updateInventory();
p.sendMessage(ChatColor.RED + "You are still on enderpearl cooldown!");
}
}
}
}

}

help would be appreciated, thanks!
first off, you don't need e.setcancelled(false)
second off, why tf are you using glaedr? it's known for being bad
third off, what do you mean doesn't register the enderpearl?
 

Tylerzz

Premium
Feedback score
13
Posts
959
Reactions
515
Resources
0
He's probably using someone elses HCF source and doesn't have a clue on how to fix it, at least put the code in some code tags so we can read it...

Code:
private String example = "like this";
 

felldownstairs

Gypsy Boy | Java Developer
Supreme
Feedback score
4
Posts
783
Reactions
144
Resources
0
He's probably using someone elses HCF source and doesn't have a clue on how to fix it, at least put the code in some code tags so we can read it...

Code:
private String example = "like this";
well im not using someone elses hcf source lmao, and i dont even know how to put it in tags which is why i am asking[DOUBLEPOST=1501405508][/DOUBLEPOST]
Code:
public class EnderpearlEvent implements Listener {
   
    @EventHandler
    public void onPlayerInteract(PlayerInteractEvent e) {
        Player p = e.getPlayer();
        PlayerScoreboard scoreboard = PlayerScoreboard.getScoreboard(p);
        if(e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) {
            if(p.getItemInHand().getType() == Material.ENDER_PEARL) {
                if(scoreboard.getEntry("enderpearl") == null) {
                    new Entry("enderpearl", scoreboard)
                    .setCountdown(true)
                    .setText(ChatColor.GOLD + "Enderpearl:" + ChatColor.WHITE)
                    .setTime(16)
                    .send();
                }
                if(scoreboard.getEntry("enderpearl") != null) {
                    e.setCancelled(true);
                    p.updateInventory();
                    p.sendMessage(ChatColor.RED + "You are still on enderpearl cooldown!");
                }
            }
        }
    }

}
 
Last edited:

Edvio

Feedback score
8
Posts
351
Reactions
113
Resources
0
I think I know the problem. You're adding a scoreboard entry, then not returning, which means it continues to run the other if check, since the scoreboard entry no longer is null
 

felldownstairs

Gypsy Boy | Java Developer
Supreme
Feedback score
4
Posts
783
Reactions
144
Resources
0
I think I know the problem. You're adding a scoreboard entry, then not returning, which means it continues to run the other if check, since the scoreboard entry no longer is null
ive added return; under each check and it still isnt working :(
 
Status
This thread has been locked.
Top