Fix GamemodeInventories incompatibility; resolves #184

This commit is contained in:
Daniel Saukel 2016-12-03 13:30:47 +01:00
parent d900c80cf7
commit 3801466746

View File

@ -31,6 +31,7 @@ import org.bukkit.block.Block;
import org.bukkit.block.Sign;
import org.bukkit.entity.Player;
import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.scheduler.BukkitRunnable;
/**
* Represents a player in a DEditWorld.
@ -41,10 +42,17 @@ public class DEditPlayer extends DInstancePlayer {
private String[] linesCopy;
public DEditPlayer(Player player, DEditWorld world) {
public DEditPlayer(final Player player, DEditWorld world) {
super(player, world.getWorld());
// Set gamemode a few ticks later to avoid incompatibilities with plugins that force a gamemode
new BukkitRunnable() {
@Override
public void run() {
player.setGameMode(GameMode.CREATIVE);
}
}.runTaskLater(plugin, 10L);
clearPlayerData();
Location teleport = world.getLobbyLocation();