Make some notes in the source saying that we should use event based integration.

This commit is contained in:
Olof Larsson 2013-04-18 17:47:42 +02:00
parent 26a59fb01c
commit 5ddfb19861
2 changed files with 6 additions and 2 deletions

View File

@ -107,7 +107,7 @@ public class Board extends Entity<Board> implements BoardInterface
if (territoryAccess == null || (territoryAccess.getHostFactionId().equals(Const.FACTIONID_NONE) && territoryAccess.isDefault())) if (territoryAccess == null || (territoryAccess.getHostFactionId().equals(Const.FACTIONID_NONE) && territoryAccess.isDefault()))
{ {
// TODO: Listen to an event instead! // TODO: Listen to an event instead!
// And this is probably the place where the event should be triggered! // NOTE: And this is probably the place where the event should be triggered!
if (ConfServer.onUnclaimResetLwcLocks && LWCFeatures.getEnabled()) if (ConfServer.onUnclaimResetLwcLocks && LWCFeatures.getEnabled())
{ {
LWCFeatures.clearAllChests(ps); LWCFeatures.clearAllChests(ps);

View File

@ -859,13 +859,17 @@ public class FPlayer extends SenderEntity<FPlayer> implements EconomyParticipato
LandClaimEvent claimEvent = new LandClaimEvent(flocation, forFaction, this); LandClaimEvent claimEvent = new LandClaimEvent(flocation, forFaction, this);
Bukkit.getServer().getPluginManager().callEvent(claimEvent); Bukkit.getServer().getPluginManager().callEvent(claimEvent);
if(claimEvent.isCancelled()) return false; if (claimEvent.isCancelled()) return false;
// then make 'em pay (if applicable) // then make 'em pay (if applicable)
// TODO: The economy integration should cancel the event above!
if (mustPay && ! Econ.modifyMoney(payee, -cost, "to claim this land", "for claiming this land")) return false; if (mustPay && ! Econ.modifyMoney(payee, -cost, "to claim this land", "for claiming this land")) return false;
// TODO: The LWC integration should listen to Monitor for the claim event.
if (LWCFeatures.getEnabled() && forFaction.isNormal() && ConfServer.onCaptureResetLwcLocks) if (LWCFeatures.getEnabled() && forFaction.isNormal() && ConfServer.onCaptureResetLwcLocks)
{
LWCFeatures.clearOtherChests(flocation, this.getFaction()); LWCFeatures.clearOtherChests(flocation, this.getFaction());
}
// announce success // announce success
Set<FPlayer> informTheseFPlayers = new HashSet<FPlayer>(); Set<FPlayer> informTheseFPlayers = new HashSet<FPlayer>();