RuneHive-Game
Loading...
Searching...
No Matches
LMSCrate.java
Go to the documentation of this file.
1package com.runehive.content.lms.crate;
2
3import com.runehive.content.lms.LMSGame;
4import com.runehive.game.world.object.CustomGameObject;
5import com.runehive.game.world.position.Position;
6import com.runehive.net.packet.out.SendHintArrow;
7import com.runehive.util.Utility;
8
9import java.util.Objects;
10
11public class LMSCrate {
12
14
16
17 public LMSCrate() {
18 spawn();
19 }
20
21 public void spawn() {
22 LMSCrateLocation loc = LMSCrateLocation.values()[Utility.random(LMSCrateLocation.values().length - 1)];
23 System.out.println("spawned at: "+loc.tip+" x="+loc.location.getX()+" y="+loc.location.getY());
24 lootCrate = new CustomGameObject(29081, loc.location);
25 lootCrate.register();
26
27 LMSGame.gamePlayers.stream().filter(Objects::nonNull).forEach(player -> {
28 player.message("@red@A loot crate has just appeared " + loc.tip + "!");
29 if(player.getUsername().equalsIgnoreCase("Nighel")) player.move(getLocation());
30 });
31
32 /*LMSGame.gamePlayers.stream().forEach(player -> {
33 player.message("@red@A loot crate has just appeared " + loc.tip + "!");
34 }
35 });*/
36 }
37
39 return lootCrate.getPosition();
40 }
41
42 public void destroy() {
43 lootCrate.unregister();
44 }
45}
static List< Player > gamePlayers
All the players within the LMS game.
Definition LMSGame.java:43
Represents a static game object loaded from the map fs.
Represents a single tile on the game world.
Definition Position.java:14
int getY()
Gets the absolute y coordinate.
Definition Position.java:46
int getX()
Gets the absolute x coordinate.
Definition Position.java:41
Handles miscellaneous methods.
Definition Utility.java:27
static int random(int bound)
Definition Utility.java:239