Guest User

Untitled

a guest
May 21st, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. #import "MCServer.h"
  2.  
  3.  
  4. @implementation MCServer
  5.  
  6. @synthesize name = _name;
  7. @synthesize greeting = _greeting;
  8. @synthesize port = _port;
  9. @synthesize max_players = _max_players;
  10. @synthesize protocol_version = _protocol_version;
  11.  
  12. -(MCServer*)initWithConfigFile:(NSString *)path{
  13. if (self = [super init]) {
  14. NSDictionary* config = [NSDictionary dictionaryWithContentsOfFile:@"config.plist"];
  15. if (config == nil) {
  16. return nil;
  17. }
  18.  
  19. [self setName:[config objectForKey:@"name"]];
  20. [self setGreeting:[config objectForKey:@"greeting"]];
  21. [self setPort:(NSInteger)[config objectForKey:@"port"]];
  22. [self setMax_players:(NSInteger)[config objectForKey:@"max_players"]];
  23. [self setProtocol_version:(NSInteger)[config objectForKey:@"protocol_version"]];
  24. }
  25. return self;
  26. }
  27.  
  28. @end
Add Comment
Please, Sign In to add comment