PDA

View Full Version : npcreset?



Jess
October 12th, 2010, 20:16
On ISiotic i noticed there server has npcreset, and i quite like it, so can someone giveme the code to do it, and tell me where to put?

Thank you! :)


~ Jess ~

Jon
October 12th, 2010, 20:18
for(NPC n : World.getInstance().getNpcList()) {
World.getInstance().unregister(n);
}
List<NPC> spawns = (List<NPC>) XStreamUtil.getXStream().fromXML(new FileInputStream("data/npcs.xml"));
for(NPC n : spawns) {
World.getInstance().register(n);
}

Network
October 12th, 2010, 20:22
Wrong section, should be in 525+ help.

crowd1
October 19th, 2010, 04:41
hi
in commandpacket..... put

if(cmd[0].equals("npcreset")) {
for(NPC n : World.getInstance().getNpcList()) {
World.getInstance().unregister(n);
n.setLocation(Location.location(0, 0, 0));
}
List<NPC> spawns = (List<NPC>) XStreamUtil.getXStream().fromXML(new FileInputStream("data/npcs.xml"));
for(NPC n : spawns) {
World.getInstance().register(n);
}
for(Player p : World.getInstance().getPlayerList()) {
p.sm("NPC's Have been Reset by - "+player.getUsername()+".");
}