Using global operations.
This commit is contained in:
@ -18,7 +18,7 @@ import java.util.concurrent.ThreadLocalRandom;
|
|||||||
public class OnBlockBreakEventHandler {
|
public class OnBlockBreakEventHandler {
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void OnBlockBreakEvent(BlockEvent.BreakEvent event) {
|
public void OnBlockBreakEvent(BlockEvent.BreakEvent event) {
|
||||||
float xpToDrop = (Config.Server.blockBreakDefaultNoXp.get()) ? 0 : event.getExpToDrop();
|
float xpToDrop = event.getExpToDrop();
|
||||||
List<OperationItem> operations = new ArrayList<>();
|
List<OperationItem> operations = new ArrayList<>();
|
||||||
|
|
||||||
// Collect operations on relevant block_id
|
// Collect operations on relevant block_id
|
||||||
@ -45,6 +45,9 @@ public class OnBlockBreakEventHandler {
|
|||||||
// Sort operations based on priority
|
// Sort operations based on priority
|
||||||
operations.sort(Comparator.comparingInt(OperationItem::getPriority));
|
operations.sort(Comparator.comparingInt(OperationItem::getPriority));
|
||||||
|
|
||||||
|
// Add global operations before all others
|
||||||
|
operations.addAll(0, Config.Server.blockBreakGlobalOperationItems);
|
||||||
|
|
||||||
// Apply operations to xp drops
|
// Apply operations to xp drops
|
||||||
for (OperationItem operation : operations) {
|
for (OperationItem operation : operations) {
|
||||||
// Calculate operation value
|
// Calculate operation value
|
||||||
|
Reference in New Issue
Block a user