1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-29 22:13:25 +01:00

Lets record BP when player places block in any situation if bp is set

This commit is contained in:
Zrips 2020-12-17 15:16:30 +02:00
parent 751b57095f
commit a9540c784e
3 changed files with 36 additions and 22 deletions

View File

@ -1202,7 +1202,6 @@ public class Jobs extends JavaPlugin {
if (bp != null) { if (bp != null) {
Long time = bp.getTime(); Long time = bp.getTime();
Integer cd = getBpManager().getBlockDelayTime(block); Integer cd = getBpManager().getBlockDelayTime(block);
if (time != -1L) { if (time != -1L) {
if (time < System.currentTimeMillis() && bp.getAction() != DBAction.DELETE) { if (time < System.currentTimeMillis() && bp.getAction() != DBAction.DELETE) {
getBpManager().add(block, cd); getBpManager().add(block, cd);
@ -1218,6 +1217,10 @@ public class Jobs extends JavaPlugin {
getBpManager().add(block, cd); getBpManager().add(block, cd);
return false; return false;
} }
// Lets add protection in any case
getBpManager().add(block, cd);
} else if (bp.isPaid().booleanValue() && bp.getTime() == -1L && cd != null && cd == -1) { } else if (bp.isPaid().booleanValue() && bp.getTime() == -1L && cd != null && cd == -1) {
getBpManager().add(block, cd); getBpManager().add(block, cd);
return false; return false;

View File

@ -2,6 +2,7 @@ package com.gamingmesh.jobs.commands.list;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.block.Block; import org.bukkit.block.Block;
@ -53,6 +54,15 @@ public class bp implements Cmd {
} }
} }
changedBlocks.add(l.getBlock()); changedBlocks.add(l.getBlock());
if (Version.isCurrentEqualOrHigher(Version.v1_15_R1)) {
if (bp.getAction() == DBAction.DELETE)
player.sendBlockChange(l, CMIMaterial.RED_STAINED_GLASS.getMaterial().createBlockData());
else if (time == -1)
player.sendBlockChange(l, CMIMaterial.BLACK_STAINED_GLASS.getMaterial().createBlockData());
else
player.sendBlockChange(l, CMIMaterial.WHITE_STAINED_GLASS.getMaterial().createBlockData());
} else {
if (bp.getAction() == DBAction.DELETE) if (bp.getAction() == DBAction.DELETE)
player.sendBlockChange(l, CMIMaterial.RED_STAINED_GLASS.getMaterial(), (byte) 14); player.sendBlockChange(l, CMIMaterial.RED_STAINED_GLASS.getMaterial(), (byte) 14);
else if (time == -1) else if (time == -1)
@ -63,6 +73,7 @@ public class bp implements Cmd {
} }
} }
} }
}
if (changedBlocks.isEmpty()) if (changedBlocks.isEmpty())
sender.sendMessage(Jobs.getLanguage().getMessage("command.bp.output.notFound")); sender.sendMessage(Jobs.getLanguage().getMessage("command.bp.output.notFound"));