Hot Summer Deals are Here!
Celebrate with up to 99% off on 17,000 resources
03
Days
16
Hours
42
Mins
25
Secs

Reduced XP From Ores Plugin

Status
This thread has been locked.

room

ifear#0069 ☕
Banned
Feedback score
18
Posts
115
Reactions
29
Resources
0
I am looking for someone who can make me a plugin which makes it so certain ores drop less XP levels then normal / vanilla minecraft.


What I want:

When a player mines a quartz, it drops 30% less XP then normal.


This does not need a config; only needs what I stated above.


If you can do this please contact me asap.


Contact Info:
Discord: paul#8502








 
PebbleHost
High performance, consistent uptime and fast support. Minecraft hosting that just works.

room

ifear#0069 ☕
Banned
Feedback score
18
Posts
115
Reactions
29
Resources
0
Code:
    @EventHandler
    public void onBlockBreak(BlockBreakEvent event) {
        Block block = event.getBlock();
       
        if (block == null || block.getType() == Material.AIR) {
            return;
        }
       
        if (block.getType() == Material.QUARTZ_ORE) {
            event.setExpToDrop(event.getExpToDrop() * 70 / 100);
        }
    }

i suck at math but that's it (i believe haha)
ay ty man <3
 
Banned forever. Reason: Ban Evading (iFear, https://builtbybit.com/members/ifear.18208/)

qIooIp

Supreme
Feedback score
3
Posts
14
Reactions
149
Resources
0
Code:
@EventHandler(ignoreCancelled = true)
public void onBlockBreak(BlockBreakEvent event) {
    if(event.getBlock().getType() != Material.QUARTZ_ORE) return;

    event.setExpToDrop(Math.round(event.getExpToDrop() * 0.7f));
}

@EventHandler(ignoreCancelled = true)
public void onBlockBreak(BlockBreakEvent event) {
    if(event.getBlock().getType() != Material.QUARTZ_ORE) return;

    event.setExpToDrop((int) (event.getExpToDrop() * 0.7));
}

It doesn't get easier than that. Only difference is that, since setExpToDrop() function takes integer as argument, first event will round reduced amount to higher or lower whole number and second event will only cast it to integer and use lower whole number.[DOUBLEPOST=1539645400][/DOUBLEPOST]paulie

https://mega.nz/#!475AgALK!Wohhqao0BjLajmEBvbxRBLAaPvDWusr046JmnS-4lhc

I even added config.yml for you so you can add any blocks you wish to reduce XP for.
 
Last edited:

room

ifear#0069 ☕
Banned
Feedback score
18
Posts
115
Reactions
29
Resources
0
Code:
@EventHandler(ignoreCancelled = true)
public void onBlockBreak(BlockBreakEvent event) {
    if(event.getBlock().getType() != Material.QUARTZ_ORE) return;

    event.setExpToDrop(Math.round(event.getExpToDrop() * 0.7f));
}

@EventHandler(ignoreCancelled = true)
public void onBlockBreak(BlockBreakEvent event) {
    if(event.getBlock().getType() != Material.QUARTZ_ORE) return;

    event.setExpToDrop((int) (event.getExpToDrop() * 0.7));
}

It doesn't get easier than that. Only difference is that, since setExpToDrop() function takes integer as argument, first event will round reduced amount to higher or lower whole number and second event will only cast it to integer and use lower whole number.[DOUBLEPOST=1539645400][/DOUBLEPOST]paulie

https://mega.nz/#!475AgALK!Wohhqao0BjLajmEBvbxRBLAaPvDWusr046JmnS-4lhc

I even added config.yml for you so you can add any blocks you wish to reduce XP for.
wow, thank you so much
 
Banned forever. Reason: Ban Evading (iFear, https://builtbybit.com/members/ifear.18208/)
Status
This thread has been locked.
Top