mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-10 10:20:41 -07:00
Merge branch 'sendnews' into 'master'
Small global announcement fixes See merge request 2009scape/2009scape!2167
This commit is contained in:
commit
965aebae4a
2 changed files with 8 additions and 17 deletions
|
|
@ -108,7 +108,8 @@ public final class WildernessZone extends MapZone {
|
|||
byte glove = (byte) RandomFunction.random(1, 14);
|
||||
Item reward = new Item(BrawlingGloves.forIndicator(glove).getId());
|
||||
GroundItemManager.create(reward, e.asNpc().getDropLocation(), killer.asPlayer());
|
||||
Repository.sendNews(killer.getUsername() + " has received " + reward.getName().toLowerCase() + " from a " + e.asNpc().getName() + "!");
|
||||
String npcString = e.getId() == NPCs.CHAOS_ELEMENTAL_3200 ? "the Chaos Elemental" : ("a " + e.asNpc().getName().toLowerCase());
|
||||
Repository.sendNews(killer.getUsername() + " has received " + reward.getName().toLowerCase() + " from " + npcString + "!");
|
||||
}
|
||||
for (int j : PVP_GEAR) {
|
||||
boolean chance = RandomFunction.roll(pvpGearRate);
|
||||
|
|
@ -120,7 +121,8 @@ public final class WildernessZone extends MapZone {
|
|||
reward = new Item(j);
|
||||
}
|
||||
GroundItemManager.create(reward, ((NPC) e).getDropLocation(), killer.asPlayer());
|
||||
Repository.sendNews(killer.asPlayer().getUsername() + " has received a " + reward.getName() + " from a " + e.asNpc().getName() + "!");
|
||||
String npcString = e.getId() == NPCs.CHAOS_ELEMENTAL_3200 ? "the Chaos Elemental" : ("a " + e.asNpc().getName().toLowerCase());
|
||||
Repository.sendNews(killer.asPlayer().getUsername() + " has received a " + reward.getName() + " from " + npcString + "!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import core.game.node.entity.player.Player
|
|||
import core.game.world.map.Location
|
||||
import core.game.world.map.RegionManager
|
||||
import core.ServerConstants
|
||||
import core.api.sendMessage
|
||||
import core.game.world.update.UpdateSequence
|
||||
import java.util.*
|
||||
import java.util.concurrent.CopyOnWriteArrayList
|
||||
|
|
@ -55,20 +56,7 @@ object Repository {
|
|||
*/
|
||||
@JvmStatic
|
||||
val disconnectionQueue = DisconnectionQueue()
|
||||
/**
|
||||
* Sends a market update message to all players.
|
||||
* @param string The string.
|
||||
* @param color The color.
|
||||
*/
|
||||
@JvmOverloads
|
||||
fun sendMarketUpdate(string: String, icon: Int = 12, color: String = "<col=CC6600>") {
|
||||
val players: Array<Any> = playerNames.values.toTypedArray()
|
||||
val size = players.size
|
||||
for (i in 0 until size) {
|
||||
val player = players[i] as Player ?: continue
|
||||
player.sendMessage("<img=" + icon + ">" + color + "Market Update: " + string)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a news message to all players.
|
||||
* @param string The string.
|
||||
|
|
@ -76,11 +64,12 @@ object Repository {
|
|||
*/
|
||||
@JvmStatic
|
||||
fun sendNews(string: String, icon: Int = 12, color: String = "CC6600") {
|
||||
if (!ServerConstants.ENABLE_GLOBAL_CHAT) return
|
||||
val players: Array<Any> = playerNames.values.toTypedArray()
|
||||
val size = players.size
|
||||
for (i in 0 until size) {
|
||||
val player = players[i] as Player ?: continue
|
||||
player.sendMessage("<img=$icon><col=$color>News: $string")
|
||||
sendMessage(player, "<img=$icon><col=$color>News: $string")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue