Skip to content
Permalink
Browse files

Use PaperLib for some performance enhancements.

  • Loading branch information...
wizjany committed Jun 15, 2019
1 parent 4044e2b commit 2e828e6ecd5bfc7fc75d58aafd678447c206d408
@@ -22,6 +22,8 @@
<subpackage name="bukkit">
<allow pkg="org.bukkit"/>
<allow pkg="org.bstats.bukkit"/>
<allow pkg="io.papermc.lib"/>
<allow pkg="com.destroystokyo.paper"/>
</subpackage>

<subpackage name="sponge">
@@ -2,10 +2,8 @@ apply plugin: 'eclipse'
apply plugin: 'idea'

repositories {
maven {
name = 'bstats repo'
url = 'https://repo.codemc.org/repository/maven-public'
}
maven { url = 'https://repo.codemc.org/repository/maven-public' }
maven { url = 'https://papermc.io/repo/repository/maven-public/' }
}

dependencies {
@@ -14,6 +12,8 @@ dependencies {
api ('com.sk89q.worldedit:worldedit-bukkit:7.0.1-SNAPSHOT') {
exclude group: 'io.papermc', module: 'paperlib'
}
implementation 'io.papermc:paperlib:1.0.2'
compileOnly 'com.destroystokyo.paper:paper-api:1.13.2-R0.1-SNAPSHOT'
implementation ('com.sk89q:commandbook:2.3') {
exclude group: 'com.sk89q', module: 'worldedit'
exclude group: 'com.zachsthings.libcomponents'
@@ -46,6 +46,9 @@ shadowJar {
relocate ("org.bstats", "com.sk89q.worldguard.bukkit.bstats") {
include(dependency("org.bstats:bstats-bukkit:1.5"))
}
relocate ("io.papermc.lib", "com.sk89q.worldguard.bukkit.paperlib") {
include(dependency("io.papermc:paperlib:1.0.2"))
}
}

relocate('org.flywaydb', 'com.sk89q.worldguard.internal.flywaydb')
@@ -419,8 +419,8 @@ public void onPlayerInteract(PlayerInteractEvent event) {
// Only fire events for blocks that are modified when right clicked
final boolean hasItemInteraction = item != null && isItemAppliedToBlock(item, clicked)
&& event.getAction() == Action.RIGHT_CLICK_BLOCK;
modifiesWorld = isBlockModifiedOnClick(clicked, event.getAction() == Action.RIGHT_CLICK_BLOCK)
|| hasItemInteraction;
modifiesWorld = hasItemInteraction
|| isBlockModifiedOnClick(clicked, event.getAction() == Action.RIGHT_CLICK_BLOCK);

if (Events.fireAndTestCancel(new UseBlockEvent(event, cause, clicked).setAllowed(!modifiesWorld))) {
event.setUseInteractedBlock(Result.DENY);
@@ -19,6 +19,7 @@

package com.sk89q.worldguard.bukkit.util;

import io.papermc.lib.PaperLib;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.block.data.BlockData;
@@ -45,7 +46,7 @@ private Blocks() {
* @return a list of connected blocks, not including the given block
*/
public static List<Block> getConnected(Block block) {
BlockState state = block.getState();
BlockState state = PaperLib.getBlockState(block, false).getState();
BlockData data = state.getBlockData();

if (data instanceof Bed) {

0 comments on commit 2e828e6

Please sign in to comment.
You can’t perform that action at this time.