Skip to content

Commit

Permalink
Add a placeholder for grants (#4380)
Browse files Browse the repository at this point in the history
* Add a placeholder for grants

Signed-off-by: Alexander Brandes <mc.cache@web.de>

* Address feedback

Signed-off-by: Alexander Brandes <mc.cache@web.de>

---------

Signed-off-by: Alexander Brandes <mc.cache@web.de>
  • Loading branch information
NotMyFault committed Mar 30, 2024
1 parent 111ea70 commit ff83868
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.caption.LocaleHolder;
import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.player.MetaDataAccess;
import com.plotsquared.core.player.PlayerMetaDataKeys;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.flag.GlobalFlagContainer;
Expand Down Expand Up @@ -197,6 +199,11 @@ private void registerDefault() {
});
this.createPlaceholder("currentplot_biome", (player, plot) -> plot.getBiomeSynchronous().toString());
this.createPlaceholder("currentplot_size", (player, plot) -> String.valueOf(plot.getConnectedPlots().size()));
this.createPlaceholder("total_grants", player -> {
try (final MetaDataAccess<Integer> metaDataAccess = player.accessPersistentMetaData(PlayerMetaDataKeys.PERSISTENT_GRANTED_PLOTS)) {
return Integer.toString(metaDataAccess.get().orElse(0));
}
});
}

/**
Expand Down

0 comments on commit ff83868

Please sign in to comment.