public boolean setCrop() { synchronized (_crop) { int amount = _crop.getAmount(); if (_count > amount) return false; // not enough crops _crop.setAmount(amount - _count); } if (Config.ALT_MANOR_SAVE_ALL_ACTIONS) CastleManager.getInstance() .getCastleById(_manorId) .updateCrop(_itemId, _crop.getAmount(), CastleManorManager.PERIOD_CURRENT); return true; }
public boolean getCrop() { try { _crop = CastleManager.getInstance() .getCastleById(_manorId) .getCrop(_itemId, CastleManorManager.PERIOD_CURRENT); } catch (NullPointerException e) { return false; } if (_crop == null || _crop.getId() == 0 || _crop.getPrice() == 0 || _count == 0) return false; if (_count > _crop.getAmount()) return false; if ((Integer.MAX_VALUE / _count) < _crop.getPrice()) return false; _reward = L2Manor.getInstance().getRewardItem(_itemId, _crop.getReward()); return true; }