Perf: Equipping the golden shovel.
This commit is contained in:
parent
4a3c105294
commit
b53ec39fbb
|
|
@ -36,20 +36,24 @@ class EquipShovelProcessingTask implements Runnable
|
|||
@Override
|
||||
public void run()
|
||||
{
|
||||
//if he logged out, don't do anything
|
||||
if(!player.isOnline()) return;
|
||||
|
||||
//if he's not holding the golden shovel anymore, do nothing
|
||||
if(player.getItemInHand().getType() != GriefPrevention.instance.config_claims_modificationTool) return;
|
||||
|
||||
PlayerData playerData = GriefPrevention.instance.dataStore.getPlayerData(player.getUniqueId());
|
||||
|
||||
int remainingBlocks = playerData.getRemainingClaimBlocks();
|
||||
//reset any work he might have been doing
|
||||
playerData.lastShovelLocation = null;
|
||||
playerData.claimResizing = null;
|
||||
|
||||
//if in basic claims mode...
|
||||
if(playerData.shovelMode == ShovelMode.Basic)
|
||||
//always reset to basic claims mode
|
||||
if(playerData.shovelMode != ShovelMode.Basic)
|
||||
{
|
||||
playerData.shovelMode = ShovelMode.Basic;
|
||||
GriefPrevention.sendMessage(player, TextMode.Info, Messages.ShovelBasicClaimMode);
|
||||
}
|
||||
|
||||
//tell him how many claim blocks he has available
|
||||
int remainingBlocks = playerData.getRemainingClaimBlocks();
|
||||
GriefPrevention.sendMessage(player, TextMode.Instr, Messages.RemainingBlocks, String.valueOf(remainingBlocks));
|
||||
|
||||
//link to a video demo of land claiming, based on world type
|
||||
|
|
@ -57,10 +61,9 @@ class EquipShovelProcessingTask implements Runnable
|
|||
{
|
||||
GriefPrevention.sendMessage(player, TextMode.Instr, Messages.CreativeBasicsVideo2, DataStore.CREATIVE_VIDEO_URL);
|
||||
}
|
||||
else
|
||||
else if(GriefPrevention.instance.claimsEnabledForWorld(player.getLocation().getWorld()))
|
||||
{
|
||||
GriefPrevention.sendMessage(player, TextMode.Instr, Messages.SurvivalBasicsVideo2, DataStore.SURVIVAL_VIDEO_URL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1233,22 +1233,10 @@ class PlayerEventHandler implements Listener
|
|||
Player player = event.getPlayer();
|
||||
|
||||
//if he's switching to the golden shovel
|
||||
ItemStack newItemStack = player.getInventory().getItem(event.getNewSlot());
|
||||
int newSlot = event.getNewSlot();
|
||||
ItemStack newItemStack = player.getInventory().getItem(newSlot);
|
||||
if(newItemStack != null && newItemStack.getType() == GriefPrevention.instance.config_claims_modificationTool)
|
||||
{
|
||||
PlayerData playerData = GriefPrevention.instance.dataStore.getPlayerData(player.getUniqueId());
|
||||
|
||||
//always reset to basic claims mode
|
||||
if(playerData.shovelMode != ShovelMode.Basic)
|
||||
{
|
||||
playerData.shovelMode = ShovelMode.Basic;
|
||||
GriefPrevention.sendMessage(player, TextMode.Info, Messages.ShovelBasicClaimMode);
|
||||
}
|
||||
|
||||
//reset any work he might have been doing
|
||||
playerData.lastShovelLocation = null;
|
||||
playerData.claimResizing = null;
|
||||
|
||||
//give the player his available claim blocks count and claiming instructions, but only if he keeps the shovel equipped for a minimum time, to avoid mouse wheel spam
|
||||
if(GriefPrevention.instance.claimsEnabledForWorld(player.getWorld()))
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user