Advertisement
smbarbour

PackGuardian

Jun 19th, 2012
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.99 KB | None | 0 0
  1. import java.io.File;
  2. import java.lang.reflect.Method;
  3.  
  4. import forge.NetworkMod;
  5. import forge.Configuration;
  6.  
  7. public class mod_PackGuardian extends NetworkMod {
  8.     static Configuration config;
  9.     private String versionText = "";
  10.    
  11.     @Override
  12.     public String getVersion() {
  13.         return versionText;
  14.     }
  15.  
  16.     @Override
  17.     public void load() {
  18.         File root;
  19.         try {
  20.             Class<?> mcClient = Class.forName("net.minecraft.client.Minecraft");
  21.             Method getDirectory = mcClient.getMethod("a", (Class<?>)null);
  22.             root = (File) getDirectory.invoke(null, (Class<?>)null);
  23.         } catch (Exception e) {
  24.             root = new File(".");
  25.         }
  26.         File configFile = new File(root, "config/PackGuardian.cfg");
  27.         System.out.println(configFile.getAbsolutePath());
  28.         config = new Configuration(configFile);
  29.         versionText = config.getOrCreateProperty("versionText", Configuration.CATEGORY_GENERAL, "CHANGEME ServerPack version 1.0").value;
  30.         config.save();
  31.     }
  32.    
  33.     @Override
  34.     public boolean clientSideRequired() {
  35.         return true;
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement