Verified Commit f6c9780f authored by Marwolf's avatar Marwolf 💬

IDE suggested clean up and disables duel spam in activity feed

parent daf01603
......@@ -1071,7 +1071,7 @@ public final class Player extends Mob {
}
}
}
return points < 1 ? 1 : points;
return Math.max(points, 1);
}
public Menu getMenu() {
......@@ -1136,7 +1136,7 @@ public final class Player extends Mob {
}
}
return points < 1 ? 1 : points;
return Math.max(points, 1);
}
public int getQuestPoints() {
......@@ -1340,7 +1340,7 @@ public final class Player extends Mob {
points = getEquipment().getArmour();
}
return points < 1 ? 1 : points;
return Math.max(points, 1);
}
@Override
......@@ -1357,7 +1357,7 @@ public final class Player extends Mob {
}
return points < 1 ? 1 : points;
return Math.max(points, 1);
}
@Override
......@@ -1372,7 +1372,7 @@ public final class Player extends Mob {
} else {
points = this.getEquipment().getWeaponPower();
}
return points < 1 ? 1 : points;
return Math.max(points, 1);
}
public int[] getWornItems() {
......@@ -1731,10 +1731,10 @@ public final class Player extends Mob {
player.incKills();
this.incDeaths();
getWorld().getServer().getGameLogger().addQuery(new LiveFeedLog(player, "has PKed <strong>" + this.getUsername() + "</strong>"));
} else if (stake) {
}/* else if (stake) { // disables duel spam in activity feed
getWorld().getServer().getGameLogger().addQuery(new LiveFeedLog(player,
"has just won a stake against <strong>" + this.getUsername() + "</strong>"));
}
}*/
}
if (stake) {
getDuel().dropOnDeath();
......@@ -2088,7 +2088,7 @@ public final class Player extends Mob {
public void sendMiniGameComplete(int miniGameId, Optional<String> message) {
getWorld().getMiniGame(miniGameId).handleReward(this);
getWorld().getServer().getGameLogger().addQuery(new LiveFeedLog(this, "just completed <strong><font color=#00FF00>" + getWorld().getMiniGame(miniGameId).getMiniGameName()
+ "</font></strong> minigame! " + (message.isPresent() ? message.get() : "")));
+ "</font></strong> minigame! " + (message.orElse(""))));
}
public void setAccessingBank(boolean b) {
......@@ -2103,7 +2103,7 @@ public final class Player extends Mob {
}
public void setBatchEvent(BatchEvent batchEvent) {
if (batchEvent != null && batchEvent.getOwner() instanceof Player) {
if (batchEvent != null && batchEvent.getOwner() != null) {
Player player = (Player)batchEvent.getOwner();
player.checkAndInterruptBatchEvent();
this.batchEvent = batchEvent;
......@@ -2366,15 +2366,14 @@ public final class Player extends Mob {
if (getCache().hasKey("elixir_time")) {
int now = (int) (System.currentTimeMillis() / 1000);
int time = ((int) getCache().getLong("elixir_time") - now);
return (time < 0) ? 0 : time;
return Math.max(time, 0);
}
return 0;
}
public void addElixir(int seconds) {
long elixirTime = seconds;
long now = System.currentTimeMillis() / 1000;
long experience = (now + elixirTime);
long experience = (now + (long) seconds);
getCache().store("elixir_time", experience);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment