com.openrsc.server.model.entity.player.Player

Here are the examples of the java api com.openrsc.server.model.entity.player.Player taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2419 Examples 7

19 Source : Formulae.java
with GNU Affero General Public License v3.0
from Open-RSC

/**
 * Decide if the food we are cooking should be burned or not Gauntlets of
 * Cooking. These gauntlets lowers lvl to burn of lobs, sword and shark
 */
public static boolean burnFood(Player player, int foodId, int cookingLevel) {
    // gauntlets of cooking effective on lobsters, swordfish and shark
    // chef: Wearing them means you will burn your lobsters, swordfish and shark less
    int bonusLevel = player.getCarriedItems().getEquipment().hasEquipped(ItemId.GAUNTLETS_OF_COOKING.id()) ? (foodId == ItemId.RAW_SWORDFISH.id() ? 6 : foodId == ItemId.RAW_LOBSTER.id() || foodId == ItemId.RAW_SHARK.id() ? 11 : 0) : 0;
    int effectiveLevel = cookingLevel + bonusLevel;
    int levelReq = player.getWorld().getServer().getEnreplacedyHandler().gereplacedemCookingDef(foodId).getReqLevel();
    // if not on def file from cooking training table, level stop failing
    // is usually 35 since player can cook item
    int levelStopFail = player.getWorld().getServer().getEnreplacedyHandler().gereplacedemPerfectCookingDef(foodId) != null ? player.getWorld().getServer().getEnreplacedyHandler().gereplacedemPerfectCookingDef(foodId).getReqLevel() : levelReq + 35;
    return !Formulae.calcProductionSuccessfulLegacy(levelReq, effectiveLevel, true, levelStopFail);
}

19 Source : Formulae.java
with GNU Affero General Public License v3.0
from Open-RSC

public static int calculateGemDrop(Player player) throws InvalidParameterException {
    int roll1 = weightedRandomChoice(gemDropIDs, gemDropWeights, ItemId.NOTHING.id());
    if (roll1 != ItemId.NOTHING_REROLL.id())
        return roll1;
    return calculateRareDrop(player);
}

19 Source : Formulae.java
with GNU Affero General Public License v3.0
from Open-RSC

/**
 * Decide if we fall off the obstacle or not
 */
// TODO: This should be moved to the appropriate plugin clreplaced.
public static boolean failCalculation(Player player, int skill, int reqLevel) {
    int levelDiff = player.getSkills().getMaxStat(skill) - reqLevel;
    if (levelDiff < 0) {
        return false;
    }
    if (levelDiff >= 20) {
        return true;
    }
    return DataConversions.random(0, levelDiff + 1) != 0;
}

19 Source : Formulae.java
with GNU Affero General Public License v3.0
from Open-RSC

public static int getLevelsToReduceAttackKBD(Player player) {
    int levels = 0;
    int currLvl = getCurrentLevel(player, Skills.RANGED);
    int maxLvl = getMaxLevel(player, Skills.RANGED);
    int ratio = currLvl * 100 / maxLvl;
    if (currLvl <= 3) {
        return 0;
    }
    if (ratio >= 81)
        levels = (int) (maxLvl * 0.3);
    else if (ratio >= 61)
        levels = (int) (maxLvl * 0.2);
    else if (ratio >= 41)
        levels = (int) (maxLvl * 0.15);
    else if (ratio >= 31)
        levels = (int) (maxLvl * 0.1);
    else if (ratio >= 21)
        levels = (int) (maxLvl * 0.075);
    else if (ratio >= 16)
        levels = (int) (maxLvl * 0.05);
    else if (ratio >= 11)
        levels = (int) (maxLvl * 0.025);
    else
        levels = 1;
    return levels;
}

19 Source : Formulae.java
with GNU Affero General Public License v3.0
from Open-RSC

public static int getRepeatTimes(Player player, int skill) {
    // Number of time repeats is based on your highest level using this method
    int maxStat = player.getSkills().getMaxStat(skill);
    if (maxStat <= 10)
        return 10;
    if (maxStat <= 19)
        return 12;
    if (maxStat <= 29)
        return 14;
    if (maxStat <= 39)
        return 16;
    if (maxStat <= 49)
        return 20;
    if (maxStat <= 59)
        return 24;
    if (maxStat <= 69)
        return 32;
    if (maxStat <= 79)
        return 40;
    if (maxStat <= 89)
        return 48;
    if (maxStat <= 95)
        return 56;
    if (maxStat <= 99)
        return 64;
    return 1000;
}

19 Source : Server.java
with GNU Affero General Public License v3.0
from Open-RSC

private long processIncomingPackets() {
    return bench(() -> {
        for (final Player player : getWorld().getPlayers()) {
            player.processIncomingPackets();
        }
    });
}

19 Source : PluginHandler.java
with GNU Affero General Public License v3.0
from Open-RSC

public boolean handlePlugin(final Player owner, final String interfce, final Object[] data, final WalkToAction walkToAction) {
    return handlePlugin(owner, owner.getWorld(), interfce, data, walkToAction);
}

19 Source : PluginHandler.java
with GNU Affero General Public License v3.0
from Open-RSC

public boolean handlePlugin(final Player owner, final World world, final String interfce, final Object[] data, final WalkToAction walkToAction) {
    synchronized (plugins) {
        if (reloading) {
            for (Object o : data) {
                if (o instanceof Player) {
                    ((Player) o).message("Plugins are being updated, please wait.");
                }
            }
            return false;
        }
        boolean shouldBlockDefault = false;
        if (plugins.containsKey(interfce + "Trigger")) {
            for (final Object c : plugins.get(interfce + "Trigger")) {
                try {
                    final Clreplaced<?>[] dataClreplacedes = new Clreplaced<?>[data.length];
                    int i = 0;
                    for (final Object o : data) {
                        dataClreplacedes[i++] = o.getClreplaced();
                    }
                    final Method m = c.getClreplaced().getMethod("block" + interfce, dataClreplacedes);
                    final boolean shouldBlock = (Boolean) m.invoke(c, data);
                    if (shouldBlock) {
                        shouldBlockDefault = true;
                        invokePluginAction(owner, world, interfce, c, data, walkToAction);
                    }
                } catch (final Exception e) {
                    LOGGER.catching(e);
                }
            }
        }
        try {
            if (!shouldBlockDefault) {
                invokePluginAction(owner, world, interfce, defaultHandler, data, walkToAction);
            }
        } catch (final Exception e) {
            LOGGER.catching(e);
        }
        return shouldBlockDefault;
    }
}

19 Source : PluginHandler.java
with GNU Affero General Public License v3.0
from Open-RSC

public boolean handlePlugin(final Player owner, final String interfce, final Object[] data) {
    return handlePlugin(owner, owner.getWorld(), interfce, data, null);
}

19 Source : PluginHandler.java
with GNU Affero General Public License v3.0
from Open-RSC

private void invokePluginAction(final Player owner, final World world, final String interfce, final Object cls, final Object[] data, final WalkToAction walkToAction) {
    if (reloading) {
        return;
    }
    if (plugins.containsKey(interfce + "Trigger")) {
        try {
            final Clreplaced<?>[] dataClreplacedes = new Clreplaced<?>[data.length];
            int i = 0;
            for (final Object o : data) {
                dataClreplacedes[i++] = o.getClreplaced();
            }
            try {
                final Method m = cls.getClreplaced().getMethod("on" + interfce, dataClreplacedes);
                final String pluginName = cls.getClreplaced().getSimpleName() + "." + m.getName();
                final PluginTask task = new PluginTask(world, owner, interfce, data) {

                    @Override
                    public int action() {
                        try {
                            LOGGER.info("Tick " + getWorld().getServer().getCurrentTick() + " : " + pluginName + " : " + Arrays.deepToString(data));
                            m.invoke(cls, data);
                            return 1;
                        } catch (final InvocationTargetException ex) {
                            if (ex.getCause() instanceof PluginInterruptedException) {
                                // PluginTask.call() will do stop() after this which will correctly shut down the Plugin.
                                // LOGGER.info("Plugin Interrupted: " + ex.getMessage());
                                return 1;
                            } else {
                                LOGGER.catching(ex);
                                return 0;
                            }
                        } catch (final Exception ex) {
                            LOGGER.catching(ex);
                            return 0;
                        }
                    }
                };
                final PluginTickEvent e = new PluginTickEvent(world, owner, pluginName, walkToAction, task);
                getServer().getGameEventHandler().add(e);
            } catch (final NoSuchMethodException ex) {
                LOGGER.info(ex.getMessage());
                LOGGER.info(cls.getClreplaced().getSimpleName() + ".on" + interfce + " : " + Arrays.deepToString(data));
            // getClreplaced().getMethod() failed because there is an executive listener, but NOT a corresponding action listener, OR
            // there is no action listener defined in Default plugin
            }
        } catch (final Exception e) {
            System.err.println("Exception at plugin handling: ");
            LOGGER.catching(e);
        }
    }
}

19 Source : Menu.java
with GNU Affero General Public License v3.0
from Open-RSC

private void doReply(final Player player) {
    final int i = player.getOption();
    if (i >= 0 && i <= options.size()) {
        Option option = options.get(i);
        if (option != null) {
            say(player, null, option.getOption());
            option.action();
        }
    }
}

19 Source : Functions.java
with GNU Affero General Public License v3.0
from Open-RSC

/**
 * Checks if player has item and returns true/false
 *
 * @param player
 * @param id
 * @param amt
 * @return
 */
public static boolean ifheld(final Player player, final int id, final int amt) {
    int amount = player.getCarriedItems().getInventory().countId(id);
    int equipslot = -1;
    if (player.getConfig().WANT_EQUIPMENT_TAB) {
        if ((equipslot = player.getCarriedItems().getEquipment().searchEquipmentForItem(id)) != -1) {
            amount += player.getCarriedItems().getEquipment().get(equipslot).getAmount();
        }
    }
    return amount >= amt;
}

19 Source : Functions.java
with GNU Affero General Public License v3.0
from Open-RSC

/**
 * Returns true if you are in any stages provided.
 *
 * @param player
 * @param quest
 * @param stage
 * @return
 */
public static boolean atQuestStages(Player player, QuestInterface quest, int... stage) {
    boolean flag = false;
    for (int s : stage) {
        if (atQuestStage(player, quest, s)) {
            flag = true;
        }
    }
    return flag;
}

19 Source : Functions.java
with GNU Affero General Public License v3.0
from Open-RSC

public static int multi(final Player player, final String... options) {
    return multi(player, null, true, options);
}

19 Source : Functions.java
with GNU Affero General Public License v3.0
from Open-RSC

public static void updatebatch() {
    final ScriptContext scriptContext = PluginTask.getContextPluginTask().getScriptContext();
    if (scriptContext == null)
        return;
    Player player = scriptContext.getContextPlayer();
    if (player == null)
        return;
    Batch batch = scriptContext.getBatch();
    if (batch == null)
        return;
    batch.update();
}

19 Source : Functions.java
with GNU Affero General Public License v3.0
from Open-RSC

public static int multi(final Player player, final Npc npc, final String... options) {
    return multi(player, npc, true, options);
}

19 Source : Functions.java
with GNU Affero General Public License v3.0
from Open-RSC

public static void say(final Player player, final String message) {
    player.getUpdateFlags().setChatMessage(new ChatMessage(player, message, player));
    delay(calcDelay(message));
}

19 Source : Functions.java
with GNU Affero General Public License v3.0
from Open-RSC

public static void resetGnomeCooking(Player player) {
    player.getCache().remove("gnome_recipe");
}

19 Source : Functions.java
with GNU Affero General Public License v3.0
from Open-RSC

/**
 * Displays server message(s)
 *
 * @param messages
 */
public static void mes(final Npc npc, final String... messages) {
    final ScriptContext scriptContext = PluginTask.getContextPluginTask().getScriptContext();
    if (scriptContext == null)
        return;
    final Player player = scriptContext.getContextPlayer();
    if (player == null)
        return;
    for (final String message : messages) {
        if (!message.equalsIgnoreCase("null")) {
            if (npc != null) {
                if (npc.isRemoved()) {
                    player.setBusy(false);
                    return;
                }
            }
            player.message(message);
        }
    }
}

19 Source : Functions.java
with GNU Affero General Public License v3.0
from Open-RSC

/**
 * Checks if players quest stage for this quest is @param stage
 *
 * @param player
 * @param qID
 * @param stage
 * @return
 */
public static boolean atQuestStage(Player player, int qID, int stage) {
    return getQuestStage(player, qID) == stage;
}

19 Source : Functions.java
with GNU Affero General Public License v3.0
from Open-RSC

public static boolean ifbeginningbatch() {
    final ScriptContext scriptContext = PluginTask.getContextPluginTask().getScriptContext();
    if (scriptContext == null)
        return false;
    Player player = scriptContext.getContextPlayer();
    if (player == null)
        return false;
    Batch batch = scriptContext.getBatch();
    if (batch == null)
        return false;
    return batch.getBeginningBatch();
}

19 Source : Functions.java
with GNU Affero General Public License v3.0
from Open-RSC

/**
 * Starts a batch and, if enabled, shows a batch bar to the client
 * @param totalBatch The total repereplacedions of a task
 */
public static void startbatch(int totalBatch) {
    final ScriptContext scriptContext = PluginTask.getContextPluginTask().getScriptContext();
    if (scriptContext == null)
        return;
    Player player = scriptContext.getContextPlayer();
    if (player == null)
        return;
    Batch batch = new Batch(player);
    batch.initialize(totalBatch);
    batch.start();
    scriptContext.setBatch(batch);
}

19 Source : Functions.java
with GNU Affero General Public License v3.0
from Open-RSC

/**
 * Npc chat method
 *  @param player
 * @param npc
 * @param messages - String array of npc dialogue lines.
 */
public static void npcsay(final Player player, final Npc npc, final String... messages) {
    // Reset the walk action on the Npc (stop them from walking).
    if (npc != null) {
        npc.resetPath();
        npc.face(player);
    }
    if (npc != null && !player.inCombat()) {
        player.face(npc);
    }
    // Send each message with a delay between.
    for (final String message : messages) {
        if (!message.equalsIgnoreCase("null")) {
            if (npc != null) {
                if (npc.isRemoved()) {
                    return;
                }
                npc.getUpdateFlags().setChatMessage(new ChatMessage(npc, message, player));
            }
        }
        delay(calcDelay(message));
    }
}

19 Source : Functions.java
with GNU Affero General Public License v3.0
from Open-RSC

public static ServerConfiguration config() {
    final ScriptContext scriptContext = PluginTask.getContextPluginTask().getScriptContext();
    if (scriptContext == null)
        return null;
    final Player player = scriptContext.getContextPlayer();
    if (player == null)
        return null;
    return player.getConfig();
}

19 Source : Functions.java
with GNU Affero General Public License v3.0
from Open-RSC

public static boolean validatebankpin(final Player player, final Npc n) {
    BankPinVerifyRequest request;
    String pin;
    if (!player.getConfig().WANT_BANK_PINS) {
        return true;
    }
    if (!player.getCache().hasKey("bank_pin")) {
        player.setAttribute("bankpin", true);
        return true;
    }
    if (player.getAttribute("bankpin", false)) {
        return true;
    }
    pin = showbankpin(player, n);
    if (pin == null)
        return false;
    request = new BankPinVerifyRequest(player.getWorld().getServer(), player, pin);
    player.getWorld().getServer().getLoginExecutor().add(request);
    while (!request.isProcessed()) {
        delay();
    }
    return player.getAttribute("bankpin", false);
}

19 Source : Functions.java
with GNU Affero General Public License v3.0
from Open-RSC

public static boolean ifbankorheld(Player player, int id) {
    return ifbank(player, id) || ifheld(player, id);
}

19 Source : Functions.java
with GNU Affero General Public License v3.0
from Open-RSC

public static Npc addnpc(int id, int x, int y, final int time, final Player spawnedFor) {
    final Npc npc = new Npc(spawnedFor.getWorld(), id, x, y);
    npc.setShouldRespawn(false);
    npc.setAttribute("spawnedFor", spawnedFor);
    spawnedFor.getWorld().registerNpc(npc);
    spawnedFor.getWorld().getServer().getGameEventHandler().add(new SingleEvent(spawnedFor.getWorld(), null, time, "Spawn Pet NPC Timed") {

        public void action() {
            npc.remove();
        }
    });
    return npc;
}

19 Source : Functions.java
with GNU Affero General Public License v3.0
from Open-RSC

/**
 * Returns true if you are in any stages provided.
 *
 * @param player
 * @param qID
 * @param stage
 * @return
 */
public static boolean atQuestStages(Player player, int qID, int... stage) {
    boolean flag = false;
    for (int s : stage) {
        if (atQuestStage(player, qID, s)) {
            flag = true;
        }
    }
    return flag;
}

19 Source : Functions.java
with GNU Affero General Public License v3.0
from Open-RSC

public static void teleport(Player player, int x, int y) {
    player.teleport(x, y);
}

19 Source : Functions.java
with GNU Affero General Public License v3.0
from Open-RSC

public static Npc addnpc(Player player, int id, int x, int y, int radius, final int time) {
    final Npc npc = new Npc(player.getWorld(), id, x, y, radius);
    npc.setShouldRespawn(false);
    player.getWorld().registerNpc(npc);
    player.getWorld().getServer().getGameEventHandler().add(new SingleEvent(player.getWorld(), null, time, "Spawn Radius NPC Timed") {

        public void action() {
            npc.remove();
        }
    });
    return npc;
}

19 Source : Functions.java
with GNU Affero General Public License v3.0
from Open-RSC

/**
 * Returns the quest stage for @param qID
 */
public static int getQuestStage(Player player, int questID) {
    return player.getQuestStage(questID);
}

19 Source : Functions.java
with GNU Affero General Public License v3.0
from Open-RSC

/**
 * Npc chat method not blocking
 *
 * @param player
 * @param npc
 * @param messages - String array of npc dialogue lines.
 */
public static void npcYell(final Player player, final Npc npc, final String... messages) {
    for (final String message : messages) {
        if (!message.equalsIgnoreCase("null")) {
            player.getWorld().getServer().getGameEventHandler().submit(() -> npc.getUpdateFlags().setChatMessage(new ChatMessage(npc, message, player)), "NPC Yell");
        }
    }
}

19 Source : Functions.java
with GNU Affero General Public License v3.0
from Open-RSC

/**
 * Player message(s), each message has 2.2s delay between.
 *
 * @param player
 * @param npc
 * @param messages
 */
public static void say(final Player player, Npc npc, final String... messages) {
    final ScriptContext scriptContext = PluginTask.getContextPluginTask().getScriptContext();
    if (scriptContext == null)
        return;
    npc = npc != null ? npc : scriptContext.getInteractingNpc();
    if (npc != null) {
        npc.face(player);
    }
    if (npc != null && !player.inCombat()) {
        player.face(npc);
    }
    for (final String message : messages) {
        if (!message.equalsIgnoreCase("null")) {
            if (npc != null) {
                if (npc.isRemoved()) {
                    player.setBusy(false);
                    return;
                }
            }
            if (npc != null) {
                npc.resetPath();
            }
            if (!player.inCombat()) {
                player.resetPath();
            }
            player.getUpdateFlags().setChatMessage(new ChatMessage(player, message, (npc == null ? player : npc)));
        }
        delay(calcDelay(message));
    }
}

19 Source : Functions.java
with GNU Affero General Public License v3.0
from Open-RSC

/**
 * Checks if player has an item, and returns true/false.
 *
 * @param player
 * @param item
 * @return
 */
public static boolean ifheld(final Player player, final int item) {
    boolean retval = player.getCarriedItems().hasCatalogID(item);
    return retval;
}

19 Source : Functions.java
with GNU Affero General Public License v3.0
from Open-RSC

public static void resetGnomeBartending(Player player) {
    player.getCache().remove("replacedtail_recipe");
}

19 Source : Functions.java
with GNU Affero General Public License v3.0
from Open-RSC

/**
 * Adds an item to players inventory.
 */
public static void give(final Player player, final int item, final int amt) {
    final Item items = new Item(item, amt);
    if (!items.getDef(player.getWorld()).isStackable() && amt > 1) {
        for (int i = 0; i < amt; i++) {
            player.getCarriedItems().getInventory().add(new Item(item, 1));
        }
    } else {
        player.getCarriedItems().getInventory().add(items);
    }
}

19 Source : Functions.java
with GNU Affero General Public License v3.0
from Open-RSC

public static boolean ifbatchcompleted() {
    final ScriptContext scriptContext = PluginTask.getContextPluginTask().getScriptContext();
    if (scriptContext == null)
        return true;
    Player player = scriptContext.getContextPlayer();
    if (player == null)
        return true;
    Batch batch = scriptContext.getBatch();
    if (batch == null)
        return true;
    return batch.isCompleted();
}

19 Source : Functions.java
with GNU Affero General Public License v3.0
from Open-RSC

public static void boundaryTeleport(Player player, Point location) {
    player.setLocation(location);
}

19 Source : Functions.java
with GNU Affero General Public License v3.0
from Open-RSC

/**
 * Sets @param quest 's stage to @param stage
 *
 * @param player
 * @param quest
 * @param stage
 */
public static void setQuestStage(Player player, QuestInterface quest, int stage) {
    player.updateQuestStage(quest, stage);
}

19 Source : Functions.java
with GNU Affero General Public License v3.0
from Open-RSC

/**
 * Returns the quest stage for @param quest
 *
 * @param player
 * @param quest
 * @return
 */
public static int getQuestStage(Player player, QuestInterface quest) {
    return player.getQuestStage(quest);
}

19 Source : Functions.java
with GNU Affero General Public License v3.0
from Open-RSC

/**
 * Creates a new ground item
 *
 * @param id
 * @param amount
 * @param x
 * @param y
 * @param player
 */
public static void addobject(int id, int amount, int x, int y, Player player) {
    player.getWorld().registerItem(new GroundItem(player.getWorld(), id, x, y, amount, player));
}

19 Source : Functions.java
with GNU Affero General Public License v3.0
from Open-RSC

/**
 * Functions below here are not in the Runescript API doreplacedentation
 */
/**
 * Checks if player has an item in bank, and returns true/false.
 *
 * @param player
 * @param item
 * @return
 */
public static boolean ifbank(final Player player, final int item) {
    return player.getBank().hasItemId(item);
}

19 Source : Functions.java
with GNU Affero General Public License v3.0
from Open-RSC

/**
 * Checks if players quest stage for this quest is @param stage
 */
public static boolean atQuestStage(Player player, QuestInterface quest, int stage) {
    return getQuestStage(player, quest) == stage;
}

19 Source : Batch.java
with GNU Affero General Public License v3.0
from Open-RSC

public clreplaced Batch {

    private Player player;

    private int current;

    private int totalBatch;

    private int delay;

    private boolean showingBar = false;

    private boolean completed;

    private Point location;

    /**
     * Creates a new instance of a Batch bar.
     * @param player The player the bar belongs to
     */
    public Batch(Player player) {
        this.player = player;
        this.location = player.getLocation();
    }

    /**
     * Creates a new batch bar. Call start() to send to client
     * @param totalBatch The total repereplacedions of a task
     */
    public void initialize(int totalBatch) {
        this.current = 0;
        this.delay = getPlayer().getConfig().GAME_TICK * 3;
        this.totalBatch = totalBatch;
        this.completed = false;
    }

    /**
     * Displays the batch bar to the client
     */
    public void start() {
        if (wantBatching() && getTotalBatch() > 1) {
            ActionSender.sendProgressBar(getPlayer(), getDelay(), getTotalBatch());
            this.showingBar = true;
        }
    }

    /**
     * Stops displaying the batch bar to the client.
     * Gives it 3 ticks to close
     */
    public void stop() {
        if (wantBatching() && isShowingBar()) {
            getPlayer().getWorld().getServer().getGameEventHandler().add(new SingleEvent(getPlayer().getWorld(), null, getDelay(), "Close Batch Bar") {

                @Override
                public void action() {
                    ActionSender.sendRemoveProgressBar(getPlayer());
                }
            });
            this.showingBar = false;
        }
        this.completed = true;
    }

    /**
     * Increments the current batch's progress by 1.
     * @return Returns false when the batch is complete
     */
    public void update() {
        if (!getPlayer().getLocation().equals(this.location)) {
            stop();
            return;
        }
        incrementBatch();
        if (wantBatching() && isShowingBar())
            ActionSender.sendUpdateProgressBar(getPlayer(), getCurrentBatchProgress());
        if (getCurrentBatchProgress() == getTotalBatch()) {
            stop();
        }
    }

    private Player getPlayer() {
        return player;
    }

    private int getDelay() {
        return delay;
    }

    private int getTotalBatch() {
        return totalBatch;
    }

    private void incrementBatch() {
        current++;
    }

    private int getCurrentBatchProgress() {
        return current;
    }

    private boolean wantBatching() {
        return getPlayer().getConfig().BATCH_PROGRESSION;
    }

    public boolean getBeginningBatch() {
        return current == 0;
    }

    public boolean isShowingBar() {
        return showingBar;
    }

    public boolean isCompleted() {
        return completed;
    }

    public void setLocation(Point location) {
        this.location = location;
    }
}

19 Source : AbstractShop.java
with GNU Affero General Public License v3.0
from Open-RSC

@Override
public boolean blockOpNpc(Player player, Npc n, String command) {
    return blockTalkNpc(player, n);
}

19 Source : LoginPacketHandler.java
with GNU Affero General Public License v3.0
from Open-RSC

private void initializePcapLogger(Player loadedPlayer, ConnectionAttachment attachment) {
    if (loadedPlayer.getWorld().getServer().getConfig().WANT_PCAP_LOGGING) {
        long startTime = System.currentTimeMillis();
        String timeStamp = new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss ").format(new Date());
        String fname = timeStamp + loadedPlayer.getUsername();
        attachment.pcapLogger.set(new PcapLogger(fname));
        com.openrsc.server.net.PacketBuilder s = new com.openrsc.server.net.PacketBuilder();
        s.setID(VIRTUAL_OPCODE_SERVER_METADATA);
        s.writeInt(loginResponse);
        s.writeInt(loadedPlayer.getClientVersion());
        s.writeInt(loadedPlayer.isUsingAuthenticClient() ? 1 : 0);
        s.writeLong(startTime);
        s.writeInt(loadedPlayer.getWorld().getServer().getConfig().WORLD_NUMBER);
        s.writeZeroQuotedString(loadedPlayer.getWorld().getServer().getName());
        s.writeZeroQuotedString(loadedPlayer.getUsername());
        s.writeZeroQuotedString(loadedPlayer.getCurrentIP());
        attachment.pcapLogger.get().addPacket(s.toPacket(), true);
    }
}

19 Source : StyleHandler.java
with GNU Affero General Public License v3.0
from Open-RSC

public void handlePacket(Packet packet, Player player) throws Exception {
    int style = packet.readByte();
    if (style < Skills.CONTROLLED_MODE || style > Skills.DEFENSIVE_MODE) {
        player.setSuspiciousPlayer(true, "style handler style < 0 or style > 3");
        return;
    }
    player.setCombatStyle(style);
}

19 Source : ReportHandler.java
with GNU Affero General Public License v3.0
from Open-RSC

private void muteCommand(Player player, String s) {
    int firstSpace = s.indexOf(" ");
    String cmd = s;
    String[] args = new String[0];
    if (firstSpace != -1) {
        cmd = s.substring(0, firstSpace).trim();
        args = s.substring(firstSpace + 1).trim().split(" ");
    }
    player.getWorld().getServer().getPluginHandler().handlePlugin(player, "Command", new Object[] { player, cmd.toLowerCase(), args });
}

19 Source : PrayerHandler.java
with GNU Affero General Public License v3.0
from Open-RSC

private boolean deactivatePrayer(Player player, int prayerID) {
    if (player.getPrayers().isPrayerActivated(prayerID)) {
        player.getPrayers().setPrayer(prayerID, false);
        if (prayerID == 6 || prayerID == 7) {
        // TODO:
        }
        return true;
    }
    return false;
}

19 Source : PrayerHandler.java
with GNU Affero General Public License v3.0
from Open-RSC

private boolean activatePrayer(Player player, int prayerID) {
    if (!player.getPrayers().isPrayerActivated(prayerID)) {
        if (prayerID == 11) {
            deactivatePrayer(player, 5);
            deactivatePrayer(player, 2);
        } else if (prayerID == 5) {
            deactivatePrayer(player, 2);
            deactivatePrayer(player, 11);
        } else if (prayerID == 2) {
            deactivatePrayer(player, 5);
            deactivatePrayer(player, 11);
        } else if (prayerID == 10) {
            deactivatePrayer(player, 4);
            deactivatePrayer(player, 1);
        } else if (prayerID == 4) {
            deactivatePrayer(player, 10);
            deactivatePrayer(player, 1);
        } else if (prayerID == 1) {
            deactivatePrayer(player, 10);
            deactivatePrayer(player, 4);
        } else if (prayerID == 9) {
            deactivatePrayer(player, 3);
            deactivatePrayer(player, 0);
        } else if (prayerID == 3) {
            deactivatePrayer(player, 9);
            deactivatePrayer(player, 0);
        } else if (prayerID == 0) {
            deactivatePrayer(player, 9);
            deactivatePrayer(player, 3);
        } else if (prayerID == 6 || prayerID == 7) {
        // TODO:
        }
        player.getPrayers().setPrayer(prayerID, true);
        return true;
    }
    return false;
}

See More Examples