Add abandonpet command.
This commit is contained in:
parent
98a0a06081
commit
9a687ec099
|
|
@ -1529,8 +1529,11 @@ public abstract class DataStore
|
||||||
this.addDefault(defaults, Messages.AdvertiseACB, "You may use /ACB to give yourself more claim blocks.", null);
|
this.addDefault(defaults, Messages.AdvertiseACB, "You may use /ACB to give yourself more claim blocks.", null);
|
||||||
this.addDefault(defaults, Messages.NotYourPet, "That belongs to {0} until it's given to you with /GivePet.", "0: owner name");
|
this.addDefault(defaults, Messages.NotYourPet, "That belongs to {0} until it's given to you with /GivePet.", "0: owner name");
|
||||||
this.addDefault(defaults, Messages.PetGiveawayConfirmation, "Pet transferred.", null);
|
this.addDefault(defaults, Messages.PetGiveawayConfirmation, "Pet transferred.", null);
|
||||||
|
this.addDefault(defaults, Messages.PetAbandonConfirmation, "Pet abandoned.", null);
|
||||||
this.addDefault(defaults, Messages.PetTransferCancellation, "Pet giveaway cancelled.", null);
|
this.addDefault(defaults, Messages.PetTransferCancellation, "Pet giveaway cancelled.", null);
|
||||||
|
this.addDefault(defaults, Messages.PetAbandonCancellation, "Pet giveaway cancelled.", null);
|
||||||
this.addDefault(defaults, Messages.ReadyToTransferPet, "Ready to transfer! Right-click the pet you'd like to give away, or cancel with /GivePet cancel.", null);
|
this.addDefault(defaults, Messages.ReadyToTransferPet, "Ready to transfer! Right-click the pet you'd like to give away, or cancel with /GivePet cancel.", null);
|
||||||
|
this.addDefault(defaults, Messages.ReadyToAbandonPet, "Ready to abandon! Right-click the pet you'd like to abandon.", null);
|
||||||
this.addDefault(defaults, Messages.AvoidGriefClaimLand, "Prevent grief! If you claim your land, you will be grief-proof.", null);
|
this.addDefault(defaults, Messages.AvoidGriefClaimLand, "Prevent grief! If you claim your land, you will be grief-proof.", null);
|
||||||
this.addDefault(defaults, Messages.BecomeMayor, "Subdivide your land claim and become a mayor!", null);
|
this.addDefault(defaults, Messages.BecomeMayor, "Subdivide your land claim and become a mayor!", null);
|
||||||
this.addDefault(defaults, Messages.ClaimCreationFailedOverClaimCountLimit, "You've reached your limit on land claims. Use /AbandonClaim to remove one before creating another.", null);
|
this.addDefault(defaults, Messages.ClaimCreationFailedOverClaimCountLimit, "You've reached your limit on land claims. Use /AbandonClaim to remove one before creating another.", null);
|
||||||
|
|
|
||||||
|
|
@ -2459,6 +2459,28 @@ public class GriefPrevention extends JavaPlugin
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//abandonpet
|
||||||
|
else if (cmd.getName().equalsIgnoreCase("abandonpet") && player != null)
|
||||||
|
{
|
||||||
|
|
||||||
|
PlayerData playerData = this.dataStore.getPlayerData(player.getUniqueId());
|
||||||
|
|
||||||
|
//special case: cancellation
|
||||||
|
if (args.length > 0 && args[0].equalsIgnoreCase("cancel"))
|
||||||
|
{
|
||||||
|
playerData.petAbandonment = false;
|
||||||
|
GriefPrevention.sendMessage(player, TextMode.Success, Messages.PetTransferCancellation);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
playerData.petAbandonment = true;
|
||||||
|
|
||||||
|
//send instructions
|
||||||
|
GriefPrevention.sendMessage(player, TextMode.Instr, Messages.ReadyToAbandonPet);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
//gpblockinfo
|
//gpblockinfo
|
||||||
else if (cmd.getName().equalsIgnoreCase("gpblockinfo") && player != null)
|
else if (cmd.getName().equalsIgnoreCase("gpblockinfo") && player != null)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -196,8 +196,11 @@ public enum Messages
|
||||||
AdvertiseACB,
|
AdvertiseACB,
|
||||||
NotYourPet,
|
NotYourPet,
|
||||||
PetGiveawayConfirmation,
|
PetGiveawayConfirmation,
|
||||||
|
PetAbandonConfirmation,
|
||||||
PetTransferCancellation,
|
PetTransferCancellation,
|
||||||
|
PetAbandonCancellation,
|
||||||
ReadyToTransferPet,
|
ReadyToTransferPet,
|
||||||
|
ReadyToAbandonPet,
|
||||||
AvoidGriefClaimLand,
|
AvoidGriefClaimLand,
|
||||||
BecomeMayor,
|
BecomeMayor,
|
||||||
ClaimCreationFailedOverClaimCountLimit,
|
ClaimCreationFailedOverClaimCountLimit,
|
||||||
|
|
|
||||||
|
|
@ -112,6 +112,7 @@ public class PlayerData
|
||||||
|
|
||||||
//player which a pet will be given to when it's right-clicked
|
//player which a pet will be given to when it's right-clicked
|
||||||
OfflinePlayer petGiveawayRecipient = null;
|
OfflinePlayer petGiveawayRecipient = null;
|
||||||
|
boolean petAbandonment = false;
|
||||||
|
|
||||||
//timestamp for last "you're building outside your land claims" message
|
//timestamp for last "you're building outside your land claims" message
|
||||||
Long buildWarningTimestamp = null;
|
Long buildWarningTimestamp = null;
|
||||||
|
|
|
||||||
|
|
@ -578,6 +578,15 @@ class PlayerEventHandler implements Listener
|
||||||
//if the player interacting is the owner or an admin in ignore claims mode, always allow
|
//if the player interacting is the owner or an admin in ignore claims mode, always allow
|
||||||
if (player.getUniqueId().equals(ownerID) || playerData.ignoreClaims)
|
if (player.getUniqueId().equals(ownerID) || playerData.ignoreClaims)
|
||||||
{
|
{
|
||||||
|
//if abandoning a pet, do that instead
|
||||||
|
if (playerData.petAbandonment)
|
||||||
|
{
|
||||||
|
tameable.setOwner(null);
|
||||||
|
playerData.petAbandonment = false;
|
||||||
|
GriefPrevention.sendMessage(player, TextMode.Success, Messages.PetGiveawayConfirmation);
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
|
||||||
//if giving away pet, do that instead
|
//if giving away pet, do that instead
|
||||||
if (playerData.petGiveawayRecipient != null)
|
if (playerData.petGiveawayRecipient != null)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -193,6 +193,10 @@ commands:
|
||||||
description: Allows a player to give away a pet he or she tamed.
|
description: Allows a player to give away a pet he or she tamed.
|
||||||
usage: /GivePet <player>
|
usage: /GivePet <player>
|
||||||
permission: griefprevention.givepet
|
permission: griefprevention.givepet
|
||||||
|
abandonpet:
|
||||||
|
description: Allows a player to abandon a pet he or she tamed.
|
||||||
|
usage: /Abandonpet <player>
|
||||||
|
permission: griefprevention.abandonpet
|
||||||
gpblockinfo:
|
gpblockinfo:
|
||||||
description: Allows an administrator to get technical information about blocks in the world and items in hand.
|
description: Allows an administrator to get technical information about blocks in the world and items in hand.
|
||||||
usage: /GPBlockInfo
|
usage: /GPBlockInfo
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user