Permalink
Browse files

Use fake player build override for NPCs in SessionManager too.

  • Loading branch information...
wizjany committed Feb 9, 2019
1 parent d24157e commit 144c31645cae4d5f5d96eb1cbdd9e63cad46c593
@@ -19,6 +19,9 @@

package com.sk89q.worldguard.bukkit.session;

import com.sk89q.worldedit.world.World;
import com.sk89q.worldguard.LocalPlayer;
import com.sk89q.worldguard.WorldGuard;
import com.sk89q.worldguard.bukkit.BukkitPlayer;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import com.sk89q.worldguard.session.AbstractSessionManager;
@@ -65,4 +68,14 @@ public void run() {
get(new BukkitPlayer(WorldGuardPlugin.inst(), player)).tick(new BukkitPlayer(WorldGuardPlugin.inst(), player));
}
}

@Override
public boolean hasBypass(LocalPlayer player, World world) {
if (player instanceof BukkitPlayer) {
if (((BukkitPlayer) player).getPlayer().hasMetadata("NPC")
&& WorldGuard.getInstance().getPlatform().getGlobalStateManager().get(world).fakePlayerBuildOverride)
return true;
}
return super.hasBypass(player, world);
}
}

0 comments on commit 144c316

Please sign in to comment.