1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-26 12:35:28 +01:00

Fixing bp command issue with newer server versions

This commit is contained in:
Zrips 2020-12-17 14:11:03 +02:00
parent 15ae2988e0
commit 751b57095f

View File

@ -10,6 +10,7 @@ import org.bukkit.entity.Player;
import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.CMILib.CMIMaterial; import com.gamingmesh.jobs.CMILib.CMIMaterial;
import com.gamingmesh.jobs.CMILib.Version;
import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.commands.Cmd;
import com.gamingmesh.jobs.commands.JobCommand; import com.gamingmesh.jobs.commands.JobCommand;
import com.gamingmesh.jobs.container.BlockProtection; import com.gamingmesh.jobs.container.BlockProtection;
@ -67,12 +68,18 @@ public class bp implements Cmd {
sender.sendMessage(Jobs.getLanguage().getMessage("command.bp.output.notFound")); sender.sendMessage(Jobs.getLanguage().getMessage("command.bp.output.notFound"));
else else
sender.sendMessage(Jobs.getLanguage().getMessage("command.bp.output.found", "%amount%", changedBlocks.size())); sender.sendMessage(Jobs.getLanguage().getMessage("command.bp.output.found", "%amount%", changedBlocks.size()));
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
@Override @Override
public void run() { public void run() {
for (Block one : changedBlocks) { if (Version.isCurrentEqualOrHigher(Version.v1_15_R1))
player.sendBlockChange(one.getLocation(), one.getType(), one.getData()); for (Block one : changedBlocks) {
} player.sendBlockChange(one.getLocation(), one.getBlockData());
}
else
for (Block one : changedBlocks) {
player.sendBlockChange(one.getLocation(), one.getType(), one.getData());
}
} }
}, 120L); }, 120L);