Fix item locked meta not being removed on pickup.

* Fix '/claimcreate' error message on invalid type.
This commit is contained in:
bloodshot 2020-11-18 20:31:00 -05:00
parent 28622cf4f4
commit 91156f0722
15 changed files with 51 additions and 49 deletions

View File

@ -55,7 +55,6 @@
import com.griefdefender.permission.GDPermissions;
import com.griefdefender.registry.ClaimTypeRegistryModule;
import com.griefdefender.util.EconomyUtil;
import com.griefdefender.util.PlayerUtil;
import co.aikar.commands.BaseCommand;
import co.aikar.commands.annotation.CommandAlias;
@ -74,7 +73,7 @@ public class CommandClaimCreate extends BaseCommand {
@CommandCompletion("@gddummy @gdclaimtypes @gddummy")
@CommandAlias("claimcreate")
@Description("Creates a claim around the player.")
@Syntax("<radius> [type] [player]")
@Syntax("<radius> [type]")
@Subcommand("claim create")
public void execute(Player player, int radius, @Optional String type) {
final Location location = player.getLocation();
@ -104,12 +103,12 @@ public void execute(Player player, int radius, @Optional String type) {
final ClaimType claimType = ClaimTypeRegistryModule.getInstance().getById(type).orElse(ClaimTypes.BASIC);
if (claimType == ClaimTypes.WILDERNESS) {
GriefDefenderPlugin.sendMessage(player, GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.CREATE_FAILED_RESULT,
ImmutableMap.of("reason", ResultTypes.TARGET_NOT_VALID)));
ImmutableMap.of("reason", ResultTypes.TARGET_NOT_VALID.getName())));
return;
}
if (claimType == ClaimTypes.ADMIN && !playerData.ignoreAdminClaims && !playerData.canManageAdminClaims) {
GriefDefenderPlugin.sendMessage(player, GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.CREATE_FAILED_RESULT,
ImmutableMap.of("reason", ResultTypes.TARGET_NOT_VALID)));
ImmutableMap.of("reason", ResultTypes.TARGET_NOT_VALID.getName())));
return;
}
@ -139,7 +138,7 @@ public void execute(Player player, int radius, @Optional String type) {
GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().CREATE_CANCEL);
} else {
GriefDefenderPlugin.sendMessage(player, GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.CREATE_FAILED_RESULT,
ImmutableMap.of("reason", result.getResultType())));
ImmutableMap.of("reason", result.getResultType().name())));
}
return;
} else {

View File

@ -439,12 +439,16 @@ public void onPlayerPickupItem(PlayerPickupItemEvent event) {
if (GDOptions.PLAYER_ITEM_DROP_LOCK || GDOptions.PVP_ITEM_DROP_LOCK) {
final String data = NMSUtil.getInstance().getItemPersistentData(event.getItem().getItemStack(), "owner");
if (data != null && !data.equalsIgnoreCase(player.getUniqueId().toString())) {
final UUID ownerUniqueId = UUID.fromString(data);
final GDPlayerData playerData = this.dataStore.getOrCreatePlayerData(location.getWorld(), ownerUniqueId);
if (playerData.lockPlayerDeathDrops) {
event.setCancelled(true);
if (data != null) {
if(!data.equalsIgnoreCase(player.getUniqueId().toString())) {
final UUID ownerUniqueId = UUID.fromString(data);
final GDPlayerData playerData = this.dataStore.getOrCreatePlayerData(location.getWorld(), ownerUniqueId);
if (playerData.lockPlayerDeathDrops) {
event.setCancelled(true);
}
return;
}
NMSUtil.getInstance().removeItemPersistentData(event.getItem().getItemStack(), "owner");
}
}
}

View File

@ -3,9 +3,9 @@
"libraries": [
{
"name": "com.griefdefender:adapter:1.12.2",
"sha1": "ba160138712a42dedb910f7b4730400666a1f336",
"path": "com/griefdefender/adapter/1.12.2-SNAPSHOT/adapter-1.12.2-20201116.073333-50.jar",
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/adapter/1.12.2-SNAPSHOT/adapter-1.12.2-20201116.073333-50.jar"
"sha1": "7b086572a2108f5fd8a2cb39b2b0e6784ec54a3f",
"path": "com/griefdefender/adapter/1.12.2-SNAPSHOT/adapter-1.12.2-20201119.011146-51.jar",
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/adapter/1.12.2-SNAPSHOT/adapter-1.12.2-20201119.011146-51.jar"
},
{
"name": "com.griefdefender:api:1.0.0",

View File

@ -3,9 +3,9 @@
"libraries": [
{
"name": "com.griefdefender:adapter:1.13.2",
"sha1": "64dd782fa3a3b9c0c6ec1e8db06865562330edd5",
"path": "com/griefdefender/adapter/1.13.2-SNAPSHOT/adapter-1.13.2-20201116.073141-48.jar",
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/adapter/1.13.2-SNAPSHOT/adapter-1.13.2-20201116.073141-48.jar"
"sha1": "9e6e02256f3f51500723f0595c6b0566dae87c36",
"path": "com/griefdefender/adapter/1.13.2-SNAPSHOT/adapter-1.13.2-20201119.011100-49.jar",
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/adapter/1.13.2-SNAPSHOT/adapter-1.13.2-20201119.011100-49.jar"
},
{
"name": "com.griefdefender:api:1.0.0",

View File

@ -3,9 +3,9 @@
"libraries": [
{
"name": "com.griefdefender:adapter:1.14.2",
"sha1": "a011f6cf39392eff76af6d1c3120b993d4eaebef",
"path": "com/griefdefender/adapter/1.14.2-SNAPSHOT/adapter-1.14.2-20201116.072822-48.jar",
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/adapter/1.14.2-SNAPSHOT/adapter-1.14.2-20201116.072822-48.jar"
"sha1": "afbea62a2efee9c46af750753499b6be9731d752",
"path": "com/griefdefender/adapter/1.14.2-SNAPSHOT/adapter-1.14.2-20201119.010953-49.jar",
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/adapter/1.14.2-SNAPSHOT/adapter-1.14.2-20201119.010953-49.jar"
},
{
"name": "com.griefdefender:api:1.0.0",

View File

@ -3,9 +3,9 @@
"libraries": [
{
"name": "com.griefdefender:adapter:1.14.3",
"sha1": "003468e4132615899fbeee30b514025b44f1ed1d",
"path": "com/griefdefender/adapter/1.14.3-SNAPSHOT/adapter-1.14.3-20201116.072740-50.jar",
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/adapter/1.14.3-SNAPSHOT/adapter-1.14.3-20201116.072740-50.jar"
"sha1": "dd00d269cf72bc6c063b5104481f78eb0758cb3b",
"path": "com/griefdefender/adapter/1.14.3-SNAPSHOT/adapter-1.14.3-20201119.010924-51.jar",
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/adapter/1.14.3-SNAPSHOT/adapter-1.14.3-20201119.010924-51.jar"
},
{
"name": "com.griefdefender:api:1.0.0",

View File

@ -3,9 +3,9 @@
"libraries": [
{
"name": "com.griefdefender:adapter:1.14.4",
"sha1": "0315521b33b732eaed58b0c23ed04767ef9f23c5",
"path": "com/griefdefender/adapter/1.14.4-SNAPSHOT/adapter-1.14.4-20201116.072707-48.jar",
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/adapter/1.14.4-SNAPSHOT/adapter-1.14.4-20201116.072707-48.jar"
"sha1": "e3cb586e72e789882c7f591b5fc803c4f542f72e",
"path": "com/griefdefender/adapter/1.14.4-SNAPSHOT/adapter-1.14.4-20201119.010857-49.jar",
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/adapter/1.14.4-SNAPSHOT/adapter-1.14.4-20201119.010857-49.jar"
},
{
"name": "com.griefdefender:api:1.0.0",

View File

@ -3,9 +3,9 @@
"libraries": [
{
"name": "com.griefdefender:adapter:1.15.2",
"sha1": "d9dee65c3db2895d2f6830604ad398466e82be81",
"path": "com/griefdefender/adapter/1.15.2-SNAPSHOT/adapter-1.15.2-20201116.033004-31.jar",
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/adapter/1.15.2-SNAPSHOT/adapter-1.15.2-20201116.033004-31.jar"
"sha1": "17b06ececd30b9c8e51444423505d6c4452a093d",
"path": "com/griefdefender/adapter/1.15.2-SNAPSHOT/adapter-1.15.2-20201119.010750-32.jar",
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/adapter/1.15.2-SNAPSHOT/adapter-1.15.2-20201119.010750-32.jar"
},
{
"name": "com.griefdefender:api:1.0.0",

View File

@ -3,9 +3,9 @@
"libraries": [
{
"name": "com.griefdefender:adapter:1.15",
"sha1": "446cb0bf17cee8edfb92e12b6f818b309aff4d61",
"path": "com/griefdefender/adapter/1.15-SNAPSHOT/adapter-1.15-20201116.033118-31.jar",
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/adapter/1.15-SNAPSHOT/adapter-1.15-20201116.033118-31.jar"
"sha1": "042d8b3ca7caddee01f0c0c8007b2c139a9aa939",
"path": "com/griefdefender/adapter/1.15-SNAPSHOT/adapter-1.15-20201119.010819-32.jar",
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/adapter/1.15-SNAPSHOT/adapter-1.15-20201119.010819-32.jar"
},
{
"name": "com.griefdefender:api:1.0.0",

View File

@ -3,9 +3,9 @@
"libraries": [
{
"name": "com.griefdefender:adapter:1.16.1",
"sha1": "5c81832d3b8570a0bd78384e8642f619e787b34a",
"path": "com/griefdefender/adapter/1.16.1-SNAPSHOT/adapter-1.16.1-20201116.032656-11.jar",
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/adapter/1.16.1-SNAPSHOT/adapter-1.16.1-20201116.032656-11.jar"
"sha1": "07844e70e02c8b980bf055b9ab9e45075daebe58",
"path": "com/griefdefender/adapter/1.16.1-SNAPSHOT/adapter-1.16.1-20201119.010531-12.jar",
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/adapter/1.16.1-SNAPSHOT/adapter-1.16.1-20201119.010531-12.jar"
},
{
"name": "com.griefdefender:api:1.0.0",

View File

@ -3,9 +3,9 @@
"libraries": [
{
"name": "com.griefdefender:adapter:1.16.2",
"sha1": "dc88329c5d311cda3bd4847c224d9322b9ec019f",
"path": "com/griefdefender/adapter/1.16.2-SNAPSHOT/adapter-1.16.2-20201116.032543-4.jar",
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/adapter/1.16.2-SNAPSHOT/adapter-1.16.2-20201116.032543-4.jar"
"sha1": "dfc108d05c33feb685d652c45374f6f0a1770650",
"path": "com/griefdefender/adapter/1.16.2-SNAPSHOT/adapter-1.16.2-20201119.010459-5.jar",
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/adapter/1.16.2-SNAPSHOT/adapter-1.16.2-20201119.010459-5.jar"
},
{
"name": "com.griefdefender:api:1.0.0",

View File

@ -3,9 +3,9 @@
"libraries": [
{
"name": "com.griefdefender:adapter:1.16.4",
"sha1": "4838b9941cd55e2d097a73be2194d6a865afc03c",
"path": "com/griefdefender/adapter/1.16.4-SNAPSHOT/adapter-1.16.4-20201116.032340-3.jar",
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/adapter/1.16.4-SNAPSHOT/adapter-1.16.4-20201116.032340-3.jar"
"sha1": "831b75e0ea5f5c90c21e914fc94e075fa318421e",
"path": "com/griefdefender/adapter/1.16.4-SNAPSHOT/adapter-1.16.4-20201119.010350-4.jar",
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/adapter/1.16.4-SNAPSHOT/adapter-1.16.4-20201119.010350-4.jar"
},
{
"name": "com.griefdefender:api:1.0.0",

View File

@ -3,9 +3,9 @@
"libraries": [
{
"name": "com.griefdefender:adapter:1.8.8",
"sha1": "65304ed1652fe4d3ea237d0e6c265915afe1c77d",
"path": "com/griefdefender/adapter/1.8.8-SNAPSHOT/adapter-1.8.8-20201116.073548-48.jar",
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/adapter/1.8.8-SNAPSHOT/adapter-1.8.8-20201116.073548-48.jar"
"sha1": "cfc92b5ee3335dbd6e807ab21b36f711e982d060",
"path": "com/griefdefender/adapter/1.8.8-SNAPSHOT/adapter-1.8.8-20201119.011223-49.jar",
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/adapter/1.8.8-SNAPSHOT/adapter-1.8.8-20201119.011223-49.jar"
},
{
"name": "com.griefdefender:api:1.0.0",

View File

@ -5,7 +5,7 @@ url=https://github.com/bloodmc/GriefDefender
version=1.5.4-DEV
apiVersion=1.0.0-20201116.204822-26
# Bukkit
adapterVersion=1.16.4-20201116.032340-3
adapterVersion=1.16.4-20201119.010350-4
spigotVersion=1.16.4-R0.1-SNAPSHOT
# Sponge
adapterSpongeVersion=1.12.2-20201114.012057-13

View File

@ -51,7 +51,6 @@
import com.griefdefender.permission.GDPermissions;
import com.griefdefender.registry.ClaimTypeRegistryModule;
import com.griefdefender.util.EconomyUtil;
import com.griefdefender.util.PlayerUtil;
import co.aikar.commands.BaseCommand;
import co.aikar.commands.annotation.CommandAlias;
@ -73,7 +72,7 @@ public class CommandClaimCreate extends BaseCommand {
@CommandCompletion("@gddummy @gdclaimtypes @gddummy")
@CommandAlias("claimcreate")
@Description("Creates a claim around the player.")
@Syntax("<radius> [type] [player]")
@Syntax("<radius> [type]")
@Subcommand("claim create")
public void execute(Player player, int radius, @Optional String type) {
final Location<World> location = player.getLocation();
@ -103,12 +102,12 @@ public void execute(Player player, int radius, @Optional String type) {
final ClaimType claimType = ClaimTypeRegistryModule.getInstance().getById(type).orElse(ClaimTypes.BASIC);
if (claimType == ClaimTypes.WILDERNESS) {
GriefDefenderPlugin.sendMessage(player, GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.CREATE_FAILED_RESULT,
ImmutableMap.of("reason", ResultTypes.TARGET_NOT_VALID)));
ImmutableMap.of("reason", ResultTypes.TARGET_NOT_VALID.getName())));
return;
}
if (claimType == ClaimTypes.ADMIN && !playerData.ignoreAdminClaims && !playerData.canManageAdminClaims) {
GriefDefenderPlugin.sendMessage(player, GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.CREATE_FAILED_RESULT,
ImmutableMap.of("reason", ResultTypes.TARGET_NOT_VALID)));
ImmutableMap.of("reason", ResultTypes.TARGET_NOT_VALID.getName())));
return;
}
@ -138,7 +137,7 @@ public void execute(Player player, int radius, @Optional String type) {
GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().CREATE_CANCEL);
} else {
GriefDefenderPlugin.sendMessage(player, GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.CREATE_FAILED_RESULT,
ImmutableMap.of("reason", result.getResultType())));
ImmutableMap.of("reason", result.getResultType().name())));
}
return;
} else {