mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-17 21:51:20 +01:00
Fixing block ownership removal by destroying block
This commit is contained in:
parent
6c4923bcb2
commit
be88eee903
@ -105,7 +105,8 @@ public class BlockOwnerShip {
|
||||
Player owningPlayer = Bukkit.getPlayer(ownerUUID);
|
||||
|
||||
if (owningPlayer != null && owningPlayer.isOnline()) {
|
||||
owningPlayer.sendMessage(Jobs.getLanguage().getMessage("command.clearownership.output.lost", "[type]", CMIMaterial.get(type.toString()).getName(), "[location]", CMILocation.toString(block.getLocation(), ":",
|
||||
owningPlayer.sendMessage(Jobs.getLanguage().getMessage("command.clearownership.output.lost", "[type]", CMIMaterial.get(type.toString()).getName(), "[location]", CMILocation.toString(
|
||||
block.getLocation(), ":",
|
||||
true, true)));
|
||||
}
|
||||
|
||||
@ -158,13 +159,15 @@ public class BlockOwnerShip {
|
||||
}
|
||||
|
||||
public boolean remove(Block block) {
|
||||
UUID uuid = null;
|
||||
List<MetadataValue> data = getBlockMetadatas(block);
|
||||
UUID uuid = getOwnerByLocation(block.getLocation());
|
||||
|
||||
if (!data.isEmpty()) {
|
||||
try {
|
||||
uuid = UUID.fromString(data.get(0).asString());
|
||||
} catch (IllegalArgumentException e) {
|
||||
if (uuid == null) {
|
||||
List<MetadataValue> data = getBlockMetadatas(block);
|
||||
if (!data.isEmpty()) {
|
||||
try {
|
||||
uuid = UUID.fromString(data.get(0).asString());
|
||||
} catch (IllegalArgumentException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -422,6 +422,9 @@ public final class JobsPaymentListener implements Listener {
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
// Remove block owner ships
|
||||
plugin.removeBlockOwnerShip(block);
|
||||
|
||||
// check if player is riding
|
||||
if (Jobs.getGCManager().disablePaymentIfRiding && player.isInsideVehicle())
|
||||
return;
|
||||
@ -430,9 +433,6 @@ public final class JobsPaymentListener implements Listener {
|
||||
if (!payIfCreative(player))
|
||||
return;
|
||||
|
||||
// Remove block owner ships
|
||||
plugin.removeBlockOwnerShip(block);
|
||||
|
||||
if (!Jobs.getPermissionHandler().hasWorldPermission(player, player.getLocation().getWorld().getName()))
|
||||
return;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user