Guest User

Untitled

a guest
Jan 23rd, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.02 KB | None | 0 0
  1. if(commandSplit[1].equals("set"))
  2.     {
  3.         p = 1;
  4.         try
  5.         {
  6.             writer = new BufferedWriter(new FileWriter(new File("/SMP-home"+".txt")));
  7.             writer.write("#This are the homes, which were already set. (f.e. 'Feanturi3:x/y/z')");
  8.         }
  9.         catch (IOException f)
  10.         {
  11.                 System.out.println(f);
  12.         }
  13.         boolean user = false;
  14.                
  15.         for(int x = 0; x < arrayHomeTp.size() ; x++)
  16.         {
  17.             MSC_homeTP homeTp = arrayHomeTp.get(x);
  18.             if(homeTp.username.equalsIgnoreCase(username))
  19.             {
  20.                 user = true;
  21.                 World world = ModLoader.getMinecraftServerInstance().getWorldManager(1).worldProvider.worldObj;
  22.                 EntityPlayer entityplayermp = world.getPlayerEntityByName(username);
  23.                 arrayHomeTp.remove(x);
  24.                 arrayHomeTp.add(new MSC_homeTP(username, (int)entityplayermp.posX, (int)entityplayermp.posY, (int)entityplayermp.posZ));
  25.                 icommandlistener.info(username+":"+(int)entityplayermp.posX+"/"+(int)entityplayermp.posY+"/"+(int)entityplayermp.posZ);
  26.             }
  27.             if(!user)
  28.             {
  29.                 try
  30.                 {
  31.                     icommandlistener.info(homeTp.username+":"+homeTp.i+"/"+homeTp.j+"/"+homeTp.k);
  32.                     writer.newLine();
  33.                     writer.write(homeTp.username+":"+homeTp.i+"/"+homeTp.j+"/"+homeTp.k);
  34.                 }
  35.                 catch (IOException e)
  36.                 {
  37.                     System.out.println(e);
  38.                 }
  39.             }
  40.         }
  41.         if(!user)
  42.         {
  43.             World world = ModLoader.getMinecraftServerInstance().getWorldManager(1).worldProvider.worldObj;
  44.             EntityPlayer entityplayermp = world.getPlayerEntityByName(username);
  45.             arrayHomeTp.add(new MSC_homeTP(username, (int)entityplayermp.posX, (int)entityplayermp.posY, (int)entityplayermp.posZ));
  46.             try
  47.             {
  48.                 icommandlistener.info(username+":"+(int)entityplayermp.posX+"/"+(int)entityplayermp.posY+"/"+(int)entityplayermp.posZ);
  49.                 writer.newLine();
  50.                 writer.write(username+":"+(int)entityplayermp.posX+"/"+(int)entityplayermp.posY+"/"+(int)entityplayermp.posZ);
  51.             }
  52.             catch (IOException e)
  53.                 {
  54.                 System.out.println(e);
  55.                 }
  56.         }
  57.         try
  58.         {
  59.             writer.flush();
  60.             writer.close();
  61.         }
  62.         catch (IOException e)
  63.             {
  64.             System.out.println(e);
  65.             }
  66.     }
Add Comment
Please, Sign In to add comment