Add admin command to unlock the drops of other players.

This commit is contained in:
jjm223 2016-09-08 18:54:11 -05:00
parent 9e1be73d46
commit d4ea1cfa03
3 changed files with 22 additions and 2 deletions

View File

@ -1557,6 +1557,7 @@ public abstract class DataStore
this.addDefault(defaults, Messages.DropUnlockAdvertisement, "Other players can't pick up your dropped items unless you /UnlockDrops first.", null);
this.addDefault(defaults, Messages.PickupBlockedExplanation, "You can't pick this up unless {0} uses /UnlockDrops.", "0: The item stack's owner.");
this.addDefault(defaults, Messages.DropUnlockConfirmation, "Unlocked your drops. Other players may now pick them up (until you die again).", null);
this.addDefault(defaults, Messages.DropUnlockOthersConfirmation, "Unlocked {0}'s drops.", "0: The owner of the unlocked drops.");
this.addDefault(defaults, Messages.AdvertiseACandACB, "You may use /ACB to give yourself more claim blocks, or /AdminClaims to create a free administrative claim.", null);
this.addDefault(defaults, Messages.AdvertiseAdminClaims, "You could create an administrative land claim instead using /AdminClaims, which you'd share with other administrators.", null);
this.addDefault(defaults, Messages.AdvertiseACB, "You may use /ACB to give yourself more claim blocks.", null);

View File

@ -2131,9 +2131,27 @@ public class GriefPrevention extends JavaPlugin
//unlockItems
else if(cmd.getName().equalsIgnoreCase("unlockdrops") && player != null)
{
PlayerData playerData = this.dataStore.getPlayerData(player.getUniqueId());
PlayerData playerData;
if (player.hasPermission("griefprevention.unlockothersdrops") && args.length == 1)
{
Player otherPlayer = Bukkit.getPlayer(args[0]);
if (otherPlayer == null)
{
GriefPrevention.sendMessage(player, TextMode.Err, Messages.PlayerNotFound2);
return true;
}
playerData = this.dataStore.getPlayerData(otherPlayer.getUniqueId());
GriefPrevention.sendMessage(player, TextMode.Success, Messages.DropUnlockOthersConfirmation, otherPlayer.getName());
}
else
{
playerData = this.dataStore.getPlayerData(player.getUniqueId());
GriefPrevention.sendMessage(player, TextMode.Success, Messages.DropUnlockConfirmation);
}
playerData.dropsAreUnlocked = true;
GriefPrevention.sendMessage(player, TextMode.Success, Messages.DropUnlockConfirmation);
return true;
}

View File

@ -187,6 +187,7 @@ public enum Messages
DropUnlockAdvertisement,
PickupBlockedExplanation,
DropUnlockConfirmation,
DropUnlockOthersConfirmation,
AdvertiseACandACB,
AdvertiseAdminClaims,
AdvertiseACB,