mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-18 06:01:46 +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);
|
Player owningPlayer = Bukkit.getPlayer(ownerUUID);
|
||||||
|
|
||||||
if (owningPlayer != null && owningPlayer.isOnline()) {
|
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)));
|
true, true)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,13 +159,15 @@ public class BlockOwnerShip {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean remove(Block block) {
|
public boolean remove(Block block) {
|
||||||
UUID uuid = null;
|
UUID uuid = getOwnerByLocation(block.getLocation());
|
||||||
List<MetadataValue> data = getBlockMetadatas(block);
|
|
||||||
|
|
||||||
if (!data.isEmpty()) {
|
if (uuid == null) {
|
||||||
try {
|
List<MetadataValue> data = getBlockMetadatas(block);
|
||||||
uuid = UUID.fromString(data.get(0).asString());
|
if (!data.isEmpty()) {
|
||||||
} catch (IllegalArgumentException e) {
|
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();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
// Remove block owner ships
|
||||||
|
plugin.removeBlockOwnerShip(block);
|
||||||
|
|
||||||
// check if player is riding
|
// check if player is riding
|
||||||
if (Jobs.getGCManager().disablePaymentIfRiding && player.isInsideVehicle())
|
if (Jobs.getGCManager().disablePaymentIfRiding && player.isInsideVehicle())
|
||||||
return;
|
return;
|
||||||
@ -430,9 +433,6 @@ public final class JobsPaymentListener implements Listener {
|
|||||||
if (!payIfCreative(player))
|
if (!payIfCreative(player))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Remove block owner ships
|
|
||||||
plugin.removeBlockOwnerShip(block);
|
|
||||||
|
|
||||||
if (!Jobs.getPermissionHandler().hasWorldPermission(player, player.getLocation().getWorld().getName()))
|
if (!Jobs.getPermissionHandler().hasWorldPermission(player, player.getLocation().getWorld().getName()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user