Results 1 to 2 of 2
  1. #1
    SandSpur is offline Member
    Join Date
    Jul 2011
    Posts
    1
    Rep Power
    0

    Default Sitelocking a game

    Hi everyone, I'm pretty new to both the forums and Java.
    I've been working on a code to sitelock a game to a website, but I'm getting way too many errors and they don't even make sense.
    Here's the code:
    Java Code:
    public void testlocation()
      {
        try
        {
          JSObject localJSObject = JSObject.getWindow(this);
          int j = 0;
          localJSObject.eval("var sti=''+top.location;");
          String str2 = String.valueOf(String.valueOf(localJSObject.getMember("sti")));
          int m = 0;
          if (str2.startsWith("http:/"))
            while (m < str2.length() - 1)
            {
              if (str2.startsWith("arcadeprehacks.com", m))
                j = 1;
              m++;
            }
          else
            j = 1;
          if (j == 0)
          {
            this.rd.setColor(new Color(0, 0, 0));
            this.rd.fillRect(0, 0, 550, 400);
            this.rd.setColor(new Color(255, 255, 255));
            this.rd.drawString("Access Denied !", 30, 50);
            this.rd.drawString("This game will not run under this loaction:", 30, 100);
            this.rd.drawString("" + str2, 30, 120);
            this.rd.drawString("Please contact ArcadePreHacks.com for details.", 30, 200);
            repaint();
            localJSObject.eval("window.open('http://www.arcadeprehacks/','olen','menubar=1,toolbar=1,location=1,resizable=1,status=1,scrollbars=1');");
            this.gamer.stop();
          }
        }
        catch (Exception localException1)
        {
          int i = 0;
          String str1 = "" + getDocumentBase();
          int k = 0;
          if (str1.startsWith("http:/"))
            while (k < str1.length() - 1)
            {
              if (str1.startsWith("arcadeprehacks.com", k))
                i = 1;
              k++;
            }
          else
            i = 1;
          if (i == 0)
          {
            this.rd.setColor(new Color(0, 0, 0));
            this.rd.fillRect(0, 0, 550, 400);
            this.rd.setColor(new Color(255, 255, 255));
            this.rd.drawString("Access Denied !", 30, 50);
            this.rd.drawString("This game will not run under this loaction:", 30, 100);
            this.rd.drawString("" + str1, 30, 120);
            this.rd.drawString("Please contact ArcadePreHacks.com for details.", 30, 200);
            repaint();
            try
            {
              URL localURL = new URL("http://www.arcadeprehacks.com/");
              getAppletContext().showDocument(localURL, "olen");
            }
            catch (Exception localException2)
            {
            }
            this.gamer.stop();
          }
        }
      }
    
      public void stop()
      {
        if ((this.exwist) && (this.gamer != null))
        {
          System.gc();
          this.gamer.stop();
          this.gamer = null;
        }
        this.exwist = true;
      }
    However, when I compile, I get 41 of the same error. It expects all of my voids, ifs, and even }'s to be a class, interface, or enum :\
    What am I doing wrong?


    Sample of the errors:
    Java Code:
    sitelock.java:1: class, interface, or enum expected
     public void testlocation()
            ^
    sitelock.java:6: class, interface, or enum expected
          int j = 0;
          ^
    sitelock.java:7: class, interface, or enum expected
          localJSObject.eval("var sti=''+top.location;");
          ^
    Last edited by SandSpur; 07-02-2011 at 05:47 PM.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

Similar Threads

  1. Replies: 1
    Last Post: 06-02-2011, 09:29 AM
  2. Replies: 2
    Last Post: 08-05-2010, 04:49 AM
  3. game code for any game
    By deathnote202 in forum Java Gaming
    Replies: 4
    Last Post: 06-10-2010, 08:06 AM
  4. Help with my game!
    By Manikyr in forum New To Java
    Replies: 6
    Last Post: 06-06-2009, 11:09 AM
  5. 2D strategy game or 2D war game
    By led1433 in forum Java 2D
    Replies: 5
    Last Post: 02-10-2009, 06:00 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •