Merge branch 'content-api-news' into 'master'
Content API method for sending news See merge request 2009scape/2009scape!147
This commit is contained in:
@@ -1146,4 +1146,13 @@ object ContentAPI {
|
|||||||
fun addClimbDest(ladderLoc: Location, dest: Location){
|
fun addClimbDest(ladderLoc: Location, dest: Location){
|
||||||
SpecialLadders.add(ladderLoc,dest)
|
SpecialLadders.add(ladderLoc,dest)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends a news announcement in game chat.
|
||||||
|
* @param message the message to announce
|
||||||
|
*/
|
||||||
|
@JvmStatic
|
||||||
|
fun sendNews(message: String){
|
||||||
|
Repository.sendNews(message, 12, "CC6600")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -72,12 +72,12 @@ object Repository {
|
|||||||
* @param icon The icon.
|
* @param icon The icon.
|
||||||
*/
|
*/
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun sendNews(string: String, icon: Int = 12, color: String = "<col=CC6600>") {
|
fun sendNews(string: String, icon: Int = 12, color: String = "CC6600") {
|
||||||
val players: Array<Any> = playerNames.values.toTypedArray()
|
val players: Array<Any> = playerNames.values.toTypedArray()
|
||||||
val size = players.size
|
val size = players.size
|
||||||
for (i in 0 until size) {
|
for (i in 0 until size) {
|
||||||
val player = players[i] as Player ?: continue
|
val player = players[i] as Player ?: continue
|
||||||
player.sendMessage("<img=" + icon + ">" + color + "News: " + string)
|
player.sendMessage("<img=$icon><col=$color>News: $string")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,6 +87,7 @@ object Repository {
|
|||||||
* I fucking hate java.
|
* I fucking hate java.
|
||||||
*/
|
*/
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
@Deprecated("Old and bad",ReplaceWith("ContentAPI.sendNews()"),DeprecationLevel.WARNING)
|
||||||
fun sendNews(string: String){
|
fun sendNews(string: String){
|
||||||
sendNews(string,12)
|
sendNews(string,12)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user