Jump to content
Team Avolition

Search the Community

Showing results for tags 'java'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Site Information
    • Introductions
    • Technology
    • Random
  • Entertainment
    • Forum Games
    • Artwork
    • Music
    • TV/Films
  • Games
    • First Person Shooters
    • Real Time Strategy
    • Role Playing Games
    • MMORPGs
    • Sandbox
    • Other
  • Projects
    • Releases
    • Programming

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


Website URL


ICQ


Yahoo


Jabber/XMPP


Skype


Location


Interests

Found 44 results

  1. TheDandyLyinSquid

    Hack Client Source Code?

    Hey all, I'm new to these forums, and a very, very, very, VERY beginner java coder. I really want to make my own custom client, just for like practice, and so everything is where I want it to be, and also have a few hacks for the heck of it. This might make me sound like a skid, but can someone link me to a decent client's source code? Thanks! Please Note: I do not plan on copy/pasting the code, but I want to dissect it and learn like, what goes where, and how to format it, etc. Thanks again!
  2. erikster

    Recursive Backtracing with Sudoku

    So, do you hate solving Sudoku puzzles? Would you like something to solve them? Well, you have to make it yourself now, but I'll try to give you the tools you need. This thread will cover: - Recursion - Recursive Backtracing - Solving Sudoku puzzles Recursion: How do you make loops without using the while or for keywords? Those are Iterative loops. I'm going to teach you recursive looping. Recursion uses something called a "base case" to determine when you are done with looping. To help you understand this, think about a bunch of people sitting in a stadium. You sit in the middle of the stands, but you don't know about which row you're in. You ask the guy in front of you, "What row am I in?" The guy in front of you doesn't know, so he asks the person in front of him. This goes on until you get to the guy nearest the field. He doesn't have anybody in front of him, so he must be in the first row. He tells the guy behind him that he's in the second row. That guy tells the person behind him that he's in the third row. This goes on until the person you asked earlier tells you that you're in the forty-second row. The person closest to the field, in the first row, demonstrates the "base case." Since there was nobody in line in front of him, he knew he was in row one. The recursive method is simply asking the people the same question over and over again. Let's see some example code. This method checks an integer array, cell by cell, for a match to a given value. The basecase is that there are no more cells to check in the array. In that situation, the value is not in the array and the method returns false. If it's not that basecase, the method checks the current cell for a match. If that doesn't work out, it calls a new method to check the next cell. public static boolean checkArrayForValue(int value, int[] arr, int cell) { if (cell < arr.length) { if (arr[cell] == value) return true; else return checkArrayForValue(value, arr, cell + 1); } else { return false; } } Now, this method could be done SOOO much easier with a for loop, but we don't really care right now. Recursion and Iteration both accomplish the task of repetition. Recursion, however, is more powerful and more risky. Beware the StackOverflowException. Everytime your recursive method is called, it will add another method to the Call Stack. You can reach levels like this: with minimal effort. If your recursive method does NOT have a base case, or it cannot possibly reach the base case, you'll get StackOverflow. It's like an infinite loop in that you'll essentially break your program. The basic recursive method has this type of structure. public type recursiveMethod(parameters) { // if it's NOT the basecase if (!basecase) { return recursive(parameters and increment/decrement whatever you need to) } else { return the answer you want at the "end" of your recursive loop } } Next section, Recursive Backtracking.
  3. crazydude156

    Basic Java tutorial: Simple calculator

    Hello users, I know this is nothing to Minecraft related, but I am learning Java and I would like to teach others what I am learning so they can become better at the Java language like me. Today I learned how to use Scanners and Standard output streams to make a simple calculator. So we will focus on the main details to create one. What do you need? * Eclipse - It is what I use and it is very simple. * Basic Eclipse knowledge - How to open the program up and start a class in it. * Really basic Java - Know what a semicolon is and what the brackets are used for etc. * Eyes - I will go over almost every detail for better understanding so this tutorial is for beginners that are new to java. What to keep in mind This is my first tutorial on programming so I may not sound as clear. I am a beginner on the Java language so if I can do it you can do it. I also appreciate opinions from the experts who are good at the Java language to tell me what I can work on. This is really basic and I am pretty confident that I can help others struggling with this. Tutorial So let's open up Eclipse in whatever folder you have and create a class called, Calculator. At the top of "public class" we are going to import. Import all it does is it allows us to use certain things in our code like Scanners. So let's add 'import java.util.Scanner;' This will allow us to use Scanner. With this it will let us answer things to a question when the program tells us to. Remember also the semicolon is just a period in a sentence but in Java language! Now go into the brackets( { } ) of the class and insert 'public static void main(String args[])'. It is basically java's name and it tells the difference between other mains. 'String arg[]' are just more strings in the code. After that we are going to create the guts of the code that will make up the rest of the tutorial. Add some brackets under 'public static void main(String args[])'. Here we will put in 'Scanner Calc = new Scanner(System.in);'. What we are doing is creating a new scanner called Calc which is short for Calculator in the system input. Go down a line and we are going to add a Double. It changes a number to a string and changes a string to a number. So we got to name some strings we are going to use with Double. We are going to add three names which are going to be first for the first number choice and second for the second number choice and then answer for the sum up of the numbers. To do this do 'Double first, second, answer;' see how we did it in a single line instead of doing the code again and again? By adding a comma we can add more and more names but for now we are going to work with 3. So what we did so far is added Double and are now going to write something. We do this with Standard output streams 'System.out.print("Example");'. We output print on the screen with this code and add parentheses and quotation marks in it to add text. Create one under the naming Double code and make it say that the user can enter their first number. Now go down another line and we are going to let the user put the number they want. We want to call the Scanner so we can use it. So we put the code 'first = Calc.nextDouble();' With this we use the Double name (first) and our scanner name (Calc). the Double (First) is equal to the scanner (Calc) so whatever you put for the first number will be equal to (First) and then after that 'nextDouble()' is there so it moves to the next name we use which is (second) after we input our number. To this point it is just repeating the code for the (second) Double. So go ahead and add another Standard output stream but this time saying that the user can enter the second number. Under that call the Double and the scanner again but with (second) as the name this time. After this is math time! So go under the last code you written (which should be the calling Double and scanner code) and write some math. Whats good about Java is that it thinks for you, you just have to write the code down for it to think. For this tutorial we are going to have it be an addition calculator so what we do is just that, add the names up. For this one I am not giving code because it is self explanatory. Need help? Fine, think about this as you write, we want (answer) to equal the sum of (first) and (second). Remember to add a semicolon at the end! So we got the math done now is time to add our final line of code. Write another Standard output stream and in it we want it to display the answer, but we don't know the answer unless we guess, so what we do is add the answer in the sentence! In the sentence first put " The total is." and after that we (add) the answer by simply putting it in there in it just after the quotations. It will look kind of like this ("example" + answer); . Finally! Yes after this you just have to run the program and do as it says. This is how to make a simple calculator and this was just addition you can do subtraction, division, and multiplication etc. I first did this a while back and I learned the whys and hows of it and if I can do it so can you! If you got something wrong like an error or you are missing something then look back at this. If this tutorial was not clear to you then browse the internet for answers that is why it is there and well.. to do dumb stuff also. If you got it working but still don't know why this does that? Well just mess with it and see why you need it. Also mess around with it and see if you can add a third number in there or if you can add more text to make it more interesting. Play with it, play with it good and not in a sexy way. You will gain more knowledge like I am currently doing now and try out something more challenging to. Well I hope this was a good tutorial and feedback is always nice and tips are appreciated from the experts of Java. So yeah um bye :D. ~~Updated the text to make it more easier to navigate and Bolded important words.~~ - Czy
  4. HeyLookImOnAForums

    Nametags

    So I was going through minecrafts code and could not find where the nametags are rendered (in 1.7.10) if any of you know this will be great just need the class name
  5. Hello users, so I have finished editing Minecraft files in Eclipse and I want to compile certain files I have edited and put them in the minecraft jar, but the files are all in .java and I want to change them to .class even with errors. I know how to compile them with cmd and I have done it a few times with other files, but not with errors. I would just fix the errors but every file is 80% full of errors and even with the errors I am sure it will still work because Minecraft works fine and I have opened the jar itself with Eclipse lots of times and there are always errors with it but it never really affected the game. My question is, if there is a way to compile .java to .class even with errors? if not, then do I have to fix the errors? Any other ways? I'm new to compiling and java itself and I always appreciate help/tips that will get me on the right track. So thanks and um bye :D.
  6. Syphist

    Fibonacci Numbers help

    I'm attempting to learn Java again, and since I have nothing better to do at them moment I'd like to program something that will calculate numbers in the Fibonacci Sequence. I have absolutely no idea how I would write the mathematical formula for this though, so I am here requesting a few hints to push me in the right direction.
  7. amnicus

    my UI does not show up.

    Hey, as you all can see, I am new on this forum. anyways, I am experiencing some problems while making my client. This is my legit old UI import org.lwjgl.opengl.GL11; import net.minecraft.src.FontRenderer; import net.minecraft.src.GuiIngame; import net.minecraft.src.GuiNewChat; import net.minecraft.src.Minecraft; public class OSGuiIngame extends GuiIngame { protected final GuiNewChat persistantChatGUI; protected final Minecraft mc; public OSGuiIngame(Minecraft par1Minecraft) { super(par1Minecraft); this.mc = Minecraft.getMinecraft(); this.persistantChatGUI = new GuiNewChat(par1Minecraft); } @Override public void renderGameOverlay(float par1, boolean par2, int par3, int par4) { FontRenderer var8 = this.mc.fontRenderer; var8.drawStringWithShadow("[Habitex]", 2, 2, 0xFFFFFF); var8.drawStringWithShadow("---------", 2, 12, 0xFFFFFF); var8.drawStringWithShadow("[R] Fly", 2, 24, 0xFFFFFF); var8.drawStringWithShadow("[N] Nofall", 2, 36, 0xFFFFFF); var8.drawStringWithShadow("[X] X-Ray", 2, 48, 0xFFFFFF); var8.drawStringWithShadow("[Z] Sneak", 2, 60, 0xFFFFFF); var8.drawStringWithShadow("[K] Tracer", 2, 72, 0xFFFFFF); var8.drawStringWithShadow("[P] Player ESP", 2, 84, 0xFFFFFF); var8.drawStringWithShadow("[C] Chest ESP", 2, 96, 0xFFFFFF); var8.drawStringWithShadow("[M] Nuker", 2, 108, 0xFFFFFF); GL11.glPopMatrix(); } } This is in a separate file then the GuiIngame. when I try and run the client it does not show anything (Which I do not get) <--- and that is my problem
  8. So I've begun work on a little 2D LWJGL project a couple of days ago. Planning on it becoming a Real-Time-Stratagy game of sorts, eventually. ANYWAY, I'm building the basic systems, I already have a Modular map system build, thought it could probably be improved later on, a Render Manager and a WIP renderer (using OpenGL Intermediate rendering cause all other forms of OGL rendering either confuse me or just doesn't work do I mess their implementation up). So I added the ability to zoom into/out of maps and from that point the ability to 'Place' debug 'Units' (a grid position in the map) has fucked up, and my mathematically retarded brain is unable to comprehend what to do in order to correct this. At the moment the position in the map that will be changed through the placement of a new 'Unit' is offset slightly, i.e. when the mouse enters the bottom or right 1/8th of the Unit the to-be-affected area move over/down to the next unit the further away from the map's 'Unit' array origin, close to the origin once you travel half the width of a Unit with the mouse it move to the next Unit. Also, this is further fucked with when the map is zoomed into/out of, with the distance between the affected area and mouse getting greater. What also possibly makes this a bit more challenging is the function of 'moving' around the map/Click+Drag to navigate around the map, although I think that is handled alright at the moment. I'll just throw some numbers and variables at you then show you how I do the maths. Firstly, the texture of each 'Unit' is 64 by 64 pixels. All transformations in rendering are done in 2D, only on the x and y axis, mainly because I see 3D as a bit daunting and have yet to look into it. Thus scaling is down using a float, 1f = Default zoom/scale. Then we have the screen width and screen height, it doesn't matter what they are, I've made it so it is all done relative to such values. There is also the offset, describing how the user/player has offset the map to view specific areas. It is a Vector2f which is feed data from Mouse.getDX/getDY() calls. Now you can enjoy, scrutinise and criticise some code snippets. Here I get the mouseX and mouseY positions, nothing interesting, but I'll throw it in anyway in case anyone feels they must ask what the variables are equal to later on. mouseX = Mouse.getX(); mouseY = screenHeight - Mouse.getY() - 1; This is where I believe the problem lies, but like I said before my mathematically incompetent mind cannot comprehend what I need to change/take into account. The mappedXPosition/mappedYposition refers to a the X and Y position in the Map's 'Unit' array which will be affected by any placement. The first simple bit is just finding the difference between the mouseX/Y and the offset.x/.y, the next bit where I divide by 33 has no apparent relevance other than the fact that it brings the mouse's position and the mapped positions closer together. And finally I multiply it all by the zoom divided by 2, because that again brings the mouse and mapped positions closer. mappedXPosition = Math.round(((mouseX - offset.x) / 33) * (zoom / 2)); mappedYPosition = Math.round(((mouseY - offset.y) / 33) * (zoom / 2)); And here I'll through some screenshots of the problem, for those visual learners. Here I 'demonstrate' the offset at the Unit array's origin. And the offset furthest away from the Unit array's origin. And the severe offset when zoomed out. If anyone can help me out in away help it would be very much appreciated. If you want some more information or code snippets please feel free to ask me to add them. Cheers, Vall
  9. So I added all my commands for my client (.vclip .spam etc.) and I I am curios on how to make a drop hack that drop every id I set in so don't drop tools. If I could get some help that would be awesome! I can't show any code I have tried because I have not really tried any. My thoughts on this are that the client would loop through all the blocks or items I set in my hot bar and drop them in a certain interval of time (so nothing picks this up), if I could get any help on this would be great but if this is a unreasonable addition to my client than just tell me -dj_pupp3 Edit: if you nubs want I can post a tut on commands only if I can get a +4 rep off this post
  10. I am working on a project of sorts to load HTML files from a server and display them in swing. import java.io.*; import java.net.*; import java.util.regex.*; import javax.swing.*; public class webloader { public static void loadcode(){ URL url = null; try { url = new URL("web"+File.separator+web.url+File.separator+"index.html"); } catch (MalformedURLException e) { e.printStackTrace(); } URLConnection con = null; try { con = url.openConnection(); } catch (IOException e) { e.printStackTrace(); } Pattern p = Pattern.compile("text/html;\\s+charset=([^\\s]+)\\s*"); Matcher m = p.matcher(con.getContentType()); String charset = m.matches() ? m.group(1) : "ISO-8859-1"; Reader r = null; try { r = new InputStreamReader(con.getInputStream(), charset); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } StringBuilder buf = new StringBuilder(); while (true) { int ch = 0; try { ch = r.read(); } catch (IOException e) { e.printStackTrace(); } if (ch < 0) break; buf.append((char) ch); } String str = buf.toString(); JFrame mainframe = new JFrame(web.url); mainframe.setSize(800, 750); mainframe.setResizable(false); JPanel website = new JPanel(); JLabel webcontent = new JLabel(str); website.add(webcontent); mainframe.add(website); mainframe.setVisible(true); } } Error: http://pastie.org/5498427 PS. I am quite new to java, so if I seem to be stupid or not know what I am doing, that's because I am.
  11. I've got 99 problems and java is all of them. Here's my situation: I have a class in a package within a jar. Within that jar, I have another package with classes that I need to get an array of using a static method contained in the first class I mentioned. I've tried this many different ways but none seem to work. Suggestions?
  12. So, my summer placement project is kinda broken. I keep getting out of memory errors. This is partly due to the fact that my computer, despite having 8Gb RAM, only allocates 269Mb to Java, regardless of any runtime parameters I give it. But, when I run it on my colleague's computer, which has 24Gb RAM and allocates 6Gb of it to Java, the program uses all of the 6Gb of memory, then crashes with an out of memory exception. Obviously, this is less than ideal. Running a memory/heap-space trace program thing (this one) shows that nearly all of the memory (an order of magnitude greater than anything else) is taken up by some class called java.lang.ref.finalizer. a) I have no idea what that is - if someone could explain, that would be fantastic. b) a quick Google search and several Stack Overflow questions reveal that finalizer objects can cause massive memory leaks for two reasons - that they're being accessed too quickly, so they can't deal with the finalizable objects quickly enough and put them into a queue which rapidly builds in memory, or that its just plain not working properly, and objects aren't being finalized and disposed of properly by the garbage collector. Of the two reasons why its not working, I have a feeling that its the first (too many things too quickly). I'm adapting an open source project to use multiple threads/cores, and the problem barely exists (although I have replicated it) in the original program. In each thread, a PlanarImage is created, has some stuff done to it, then the result from each thread is put into the same BufferedImage in the main thread. Its the BufferedImage that causes the finalizer object to not work properly. So, I'm thinking that because the threads speed up the rate of access of the BufferedImage, its causes the finalizer to fail. On the other hand, each thread closes properly, and the memory usage goes up far quicker than it would do if it were the single BufferedImage, which is only cleared/disposed of every so often. Aaaaanyway - how can I check that this is the case, or, even better, how do I fix it? At the least - do you have any experience with finalizers, and can you explain to me how they work so that I may attempt to fix the memory leak myself? Its extremely frustrating, because this is essentially the difference between the program being usable or not. I mean, it works, but there is obviously a problem somewhere, and fixing that problem would make a massive difference. PS - do you have any idea why Java would only get allocated 269Mb of memory, rather than being allocated say, a gigabyte by using -Xmx1024m as a runtime parameter? Less important as the finalizer thing, but still quite irritating as it means I can't test it on my computer and keep having to use my colleague's. EDIT: Trying to manually dispose of the BufferedImage has no effect, either by setting it to null or by calling .flush(). Presumably because in the next loop round, it just calls 'BufferedImage bi = new BufferedImage()' again anyway. And the memory leak occurs during the loop anyway, between defining the BufferedImage and disposing of it.
  13. FlyingManiac

    Hack Managing Design

    Since you guys here do not like code, I will try to keep it at a minimum. I hope, that was atleast somehow understandable and you can learn something from it. In the end you will regret using the procedual approach, just saying
  14. This tutorial is going to explain how to authenticate users of your client with a license key / HWID with PHP instead of just a Dropbox text file... Step 1: The PHP Script The first thing you have to do is get a PHP/Apache server installed on your computer. You can do this for free with a program called XAMPP. After you get this installed open up your script editor (I use Notepad++ or Dreamweaver) and create a file called something along the lines of checkkey.php. In this file the first thing that you want to do is open and close the PHP tags. (<?php /* your 1337 script here */ ?>) Then what you want to do is check the get variables and see if the variable that you are passing in isset. (The get variables are in $_GET['name']) If it is not set simply exit with a reason like: stop trying to reverse engineer my authentication system. Since I like object oriented programming I created a class called User. In this class I made two variables $key and $name. Then in the constructor allow variables $k and $n to be passed in. Inside of it set the class vars to these. After the class you want to do something like $users = array(new User("1234-1234-1234","Sauce"), new User("1234-1234-1235", "Herpderp")); Iterate through each User in the array until you find one that has the same key that was passed in. When you do exit with a reason like OK:Sauce. This will come in handy later. Test your script with multiple values before using. Step 2: Client Side Integration First figure out how you want to store your key client side. If you want your users typing it in every time make a custom launcher. Or simple create a last login file for the key. I am not going to tell you how to read a file or get a parameter that has been passed to the Applet. However I am going to tell you how to connect to the website and check the key provided. What you want to do is create a URL. The URL that you initialize should already have the get variable in it that you are sending to the server. Next create a Connection to the URL. This can be retrieved from a completely in obvious function within URL. All I am going to say is BufferedReader(InputStreamReader(URLConnection.somethingObvious())) Get the response from the reader as a string split at : The first part of the string is your response. If it is OK then allow the user to start the program. The second part is the users name. I simply set this as a static variable in my Auth class. Now you should have a working PHP based authentication for your client. This is obviously useless unless you are worried about leaking. You should now see how HWID protection can be applied to this tutorial. If you have any problems with this you are probably using Java code in the PHP script. Read the PHP Documentation when troubleshooting errors in your program.
  15. So after me being extremely retarded about an opacity x-ray, and not taking the hint that everyone gives...the ice...oh god the ice...well anyways, I got the opacity x-ray working quite nicely. However one damn problem remains. The blocks have set up a "We don't want to be seen club" and now that I can see their outlines through walls, they cannot be lit. I honestly don't know what do to make them light. I've read all the tutorials for fullbright where they say "two functions, one returns an int and one returns a float" and I've got the one that returns a float, but I am unable to find a function that returns an int in Blocks.java that could possible relate to lighting beside one, which I tried. That was the getMixedBrightness something or another function. I tried forcing the return value to 15, 255 and 0xffffff to see if it would make the blocks light, but as I though from where I saw it being used (and the comment about sky light that MCP put in) I concluded that was just for the light colors. Is that wrong? What number should I be using? Should I be looking elsewhere? Also don't say "loadRenderers()" because I've got that covered. thanks, arjunyg
  16. The problem: My opacity hack as it is right now, only works on short and tiny render distances. It is coded by modifying RenderBlocks to use an Alpha color when drawing the textures. Also: I realize that ice is transparent through its alpha value in the PNG file. I've spent quite a bit of time puzzling over this one and I've boiled it down to a few simple questions: 1. What is/Is there is a fast way to dynamically adjust the alpha of a texture loaded in memory without reloading the PNG file? 2. Can I make the RenderBlocks modifications work on Normal/Far ? A hint would be appreciated (like how things are done differently between short and normal!) 3. A little outline of the texture loading process would help. The math in it confuses me a little. + I don't know too much about OpenGL texturing. 4. Can some calls be made to lwjgl to set an alpha value? (like glBlendFunc etc.) If so can someone send me a link to a page with some info on this (google wasn't extremely useful here) or just explain a little. FML I have just asked for more spoonfeeding than ever before...whatever. If you object, don't answer with spoonfeeding. PS: I REALLY don't want to see shit about ice being a transparent block on this thread : That is done through the terrain.png having an alpha value and I have other plans that make that impossible for the opacity hack. i.e: opacity slider that updates on real-time, where reloading the file would cause an insane performance hit.
  17. Puddleduck

    .NET Vs Java

    discuss
  18. Sparta

    [Help] Scripting

    So I'm having a little trouble using javax.scripting in my client. I got everything working, and wrote some scripts that run fine in eclipse (and through startclient.bat in MCP). However, once I reobfuscate and put the classes into minecraft.jar, the script can no longer find the classes I'm referencing with importClass. I thought this would be a problem because once the MC classes are reobfuscated they have different names, but I'm just trying to reference one of my own classes. This is the error I'm receiving: javax.script.ScriptException: sun.org.mozilla.javascript.internal.EvaluatorException: Function importClass must be called with a class; had "[JavaPackage net.Kanashimi.core.Config]" instead. ..so it obviously can't find my class file. My importClass statement just looks like this: importClass(Packages.net.Kanashimi.core.Config); and Config.class exists with the same name once added to minecraft.jar. Does anybody have any experience implementing this in your clients? I'm not really sure how to go about trying to fix this. Any help would be greatly appreciated.
  19. I really want to learn to program plugins and mods with Java. I have no idea where to start, though. I believe I'm competent enough to learn a simple programming language, and have way too much sufficient spare time to experiment. Would Java be sufficient, the best, or the only way to program in Minecraft? This may seem a stupid question, but I genuinely want to become a part of the modding community. If anyone could lead me to a website with tutorials, or any sort of idea of where to start, I would greatly appreciate it. I have zero programming experience, except for basic binary knowledge. Any help is appreciated, and I can guarantee I will make a flying dildo mod for Xero-Space if he helps. Sorry if this isn't the best place for this, but I've skimmed the subforums for a better location. I hope to get help from a member of this great community, and to see some support soon. Thanks to anyone for considering.
  20. Hellparty

    OpenGL GL_LINE_SMOOTH Problem

    So I've been working on a complete overhaul of my client, and so far it's 9001% better. But I ran into a problem. I happened to save my old tracer line rendering code, and so I've put it to use here. What's happening is that every time I enable the GL cap GL_LINE_SMOOTH, my lines from the crosshair to the player fade out when being directly looked at. I can see them fine if the lines are pointing behind me or to my left or right, but when I attempt to look directly toward where they are pointing, they simply disappear. Now this doesn't happen to ALL lines, as my ESP/tracer boxes are using the cap as well and they always show up. I'm thinking this could be a hardware compatibilty thing, but I'm not sure because it doesn't happen to all the lines. Any suggestions?
  21. Sauce

    NOdus Plugin

    Because of multiple things happening to the #Nodus channel of aVo's IRC (those changes making this plugin dysfunctional) I have decided to release the source code (for educational purposes) of my plugin. When this plugin worked, I only had released it to one server. I have to admit, I had some fun with this plugin while it was working. Anyway, I hope anyone who wants to create a plugin can learn something from the source. I put some time into rewriting and commenting it. http://pastebin.com/8d3NxGqA - NOdusPlugin.java http://pastebin.com/5CrkB82c - NOdusPlayerListener.java http://pastebin.com/hBPbXraG - NOdusIRCBot.java This plugin uses PircBot.
  22. Pandaz

    Will This Work?

    Here's the code I've got currently. I don't worry about people stealing it because nobody could use it probably (also, it references things outside of itself): public String getString(String field) { String result = null; try { BufferedReader br = new BufferedReader(new FileReader(configFile)); String line = null; while ((line = br.readLine()) != null) { if (line.startsWith(field)) { result = line.replaceAll(field + ": ", ""); return result; } } } catch (Exception ignore) {} return result; } public Integer getInt(String field) { Integer result = null; try { BufferedReader br = new BufferedReader(new FileReader(configFile)); String line = null; while ((line = br.readLine()) != null) { if (line.startsWith(field)) { try { result = Integer.parseInt(line.replaceAll(field + ": ", "")); br.close(); return result; } catch (NumberFormatException e) { br.close(); return null; } } } } catch (Exception ignore) {} return result; } public List<Integer> getIntList(String startFrom) { List<Integer> list = new ArrayList<Integer>(); try { BufferedReader br = new BufferedReader(new FileReader(configFile)); String line = null; while ((line = br.readLine()) != null) { if (line.startsWith(startFrom)) { for (String next = br.readLine(); next != null && !next.contains(": "); next = br.readLine()) { try { list.add(Integer.parseInt(next)); } catch (NumberFormatException e) { continue; } } return list; } } } catch (Exception ignore) {} return list; } public List<String> getStringList(String startFrom) { List<String> list = new ArrayList<String>(); try { BufferedReader br = new BufferedReader(new FileReader(configFile)); String line = null; while ((line = br.readLine()) != null) { if (line.startsWith(startFrom)) { for (String next = br.readLine(); next != null && !next.contains(": "); next = br.readLine()) { list.add(next); } return list; } } } catch (Exception ignore) {} return list; } Would this work?
  23. CowCancer

    I need some help with my Client.

    Hello. I am coding a Minecraft client in eclipse, and I'm having some recurring problems. I am trying to get a cape to render on the backs of all players with my client. I have tried everything, including uninstalling and reinstalling Eclipse, and MCO, but the cape itself never renders. I have looked through many tutorials, but I haven't been able to get it working. At first, I thought it was the other editing that I had done to the client, but I started over and only edited the part in EntityPlayer.java where it says: public void updateCloak() { playerCloakUrl = (new StringBuilder()).append("http://i.imgur.com/7R8Wh.png").append(username).append(".png").toString(); cloakUrl = playerCloakUrl; } I know that you all can't spoon feed me the information, but any help is truly appreciated. Thanks in advance, CowCancer
  24. Hello again people of the Team Avolition forums. As my Bukkit tutorial was quite popular, I have decided to create a Spout plugin tutorial. Feel free to skip the spoiler and get into some actual development, but I recommend reading it. So, if you read the spoiler, you now know at least the basics of Spout background. Now for the programming. If you read the spoiler you will know Spout isn't just Minecraft. This tutorial will focus on Minecraft Spout programming. You will want the required libraries: SpoutAPI: http://build.spout.org/job/SpoutAPI/922/artifact/target/spoutapi-dev-SNAPSHOT.jar'>http://build.spout.org/job/SpoutAPI/922/artifact/target/spoutapi-dev-SNAPSHOT.jar Vanilla: http://build.spout.org/job/Vanilla/1702/artifact/target/vanilla-1.2.5-SNAPSHOT.jar'>http://build.spout.org/job/Vanilla/1702/artifact/target/vanilla-1.2.5-SNAPSHOT.jar They are the latest at the time I posted this, for the jobs on Jenkins: http://build.spout.org/ The latest and greatest JavaDocs can be found at: http://jd.spout.org/server/ Similarly with Bukkit, your plugin must extend a class. The class name is CommonPlugin, so go ahead and create a package / class in your favourite IDE, and make it extend CommonPlugin. After you import CommonPlugin, your IDE should prompt you to add in some abstract inherited methods. Go ahead and do that. As with Bukkit, there are a lot of things you can do with Spout / Vanilla. Assuming you have extended CommonPlugin and implemented the methods, you need to start doing things. To begin with you need a properties.yml. Unlike in Bukkit, I will not go over the YAML. Here is a guide on the Spout Wiki: http://forums.spout.org/wiki/properties-yml/ Lets make a command. In Spout, commands are handled in a similar way to Bukkit. Make a class called <YourPlugin>CommandExecutor. First it should implement CommandExecutor. Go ahead and do that, then import it and add the unimplemented method. Inside this method you can do what you want, it has multiple params. These should be (not in the right order maybe) a CommandSource, a Command, and a CommandContext. With these you can do what you want. Have a play around with the methods available to you before continuing. Check if the Command's name list contains the command you want to use for this. Inside this if check, continue. I don't have a lot of time at the moment, so this is going to be simple, but it gives you an idea. This is going to be a player only command, so perform an if check to see if the CommandSource is an instanceof Player. Then put an else statement. In the else statement put CommandSourceVariable. then something to do with sending a message (ChatColor. A color + "Players only!") However, if the if check returns true, send the player a message (same as before), saying CommandSourceVariable.getName() + ": You are so clever you typed " and the name of the command. Or something like that. Anyway, I hope everyone learned something from here. For the Spout Development forum, look here: http://forums.spout.org JavaDocs: http://jd.spout.org/server/ Feel free to leave suggestions, I may make this better later, but I only had time to write something simple, mainly because I couldn't think of what to show you guys :/
  25. Hello everyone, When looking through the programming tutorials to enhance my skills, I see a lot of Minecraft tutorials, but I don't believe I've ever seen a Bukkit plugin tutorial on here. Bukkit is a great way to begin programming Java, and it is extremely simple to create plugins that can do simple things. I also haven't posted any tutorials yet, so I decided to post this, so people can learn Bukkit programming. I know a few people on these forums who have worked in the area of Bukkit plugins (rakiru), and it would be great if they could point out any errors I make in this, I often fall victim to calling methods from JavaPlugin in my variable statements and end up with Null Pointer Exceptions, but hopefully there will be none of that here :P First you need the JDK. It can be downloaded here. You then need to set up your PATH variable, but you can find out how to do that somewhere else otherwise this thread would get unnecessarily long. Try for a tutorial on how. Next you need the Bukkit API. It can be downloaded here. It provides access to the methods in Bukkit (as you would expect from an API, duh!). Please note that you MUST compile against the Bukkit API, NOT CraftBukkit (although you can use both for less restricted things, but expect your plugin to break in updates frequently if you use CraftBukkit). Then you need to create a project in your favourite Java IDE. If you don't have one, there are several good ones, I personally use Eclipse. After creating your IDE project, you need to add the Bukkit API to your build path. In Eclipse you right click the project in the Package Explorer, click Properties, go into Java Build Path on the side menu, click Libraries --> Add External Jars then find your Bukkit API Jar File to add. Then you can begin using the Bukkit API. But it is recommended to add the JavaDocs in first. If on Eclipse, open up the 'Referenced Libraries' in the Package Explorer, right click on the Bukkit API --> Properties --> JavaDoc location and type in http://jd.bukkit.org/apidocs/. Then you can get information on what you are using by holding your mouse over the name of a class you imported from Bukkit. So, now we can start the good stuff. In your source folder (in Eclipse 'src' by default), right click, hit new --> package and type in your domain name backwards. Subdomains of other people's websites that you own work as well. Mine is 'com.github.pandaznwafflez'. If you have neither a domain name or a subdomain, type in 'me.<your development name>.<your plugin name>', for me that would be 'me.pandaznwafflez.tutorial'. In packages capitalisation is completely optional. Then create a new Class, in the same way you made a new package, but selecting 'Class' rather than 'Package'. You should name this the name of your plugin. Mine will be 'Tutorial'. Your class should look like this (this is not spoonfeeding because it is so obvious and gives you a result that doesn't even do anything, it's even slightly wrong where the user needs to enter their package / class name): package <your package>; public class <your class name> { } Next you need to make your class extend JavaPlugin. This is relatively obvious, just put 'extends JavaPlugin' after the word that is the name of your class. Then import from org.bukkit.plugin.java.JavaPlugin. By extending JavaPlugin you have turned your plugin into a REAL Plugin. To make your plugin do something you need two methods. These are (don't just copy and paste, it won't work): public void onEnable() { public void onDisable() { Then insert a closing brace at the end of each and add @Override over the top of each one. These methods are automatically called whenever your plugin enables and disables. Technically if we had plugin.yml you could compile this and it would work, so we are going to quickly go over the plugin.yml before adding functionality. To create your plugin.yml, right click on the root of the project, new --> File and type in 'plugin.yml'. There must be no caps in plugin. Seeing as a plugin.yml is not code, I am going to go ahead and put it here (although you will have to edit it with your plugin's details). I am going to add every field possible, even though they are not all necessary. Remember that lines with # are comments. name: Tutorial # The name of your plugin version: 1.0.0 # The version of your plugin main: com.github.pandaznwafflez.tutorial.Tutorial # your package.your main class, for the JavaPluginLoader to load from description: A tutorial plugin for the Team Avolition forums. # The description of your plugin database: false # Whether your plugin uses a database depend: # The plugins that will cause an exception if they are not present. soft-depend: [Vault] # The plugins that will load before your plugin so it can use them but are not necessary for your plugin. load-before: [Essentials] # The plugins your plugin will load before. author: PandazNWafflez authors: [Team Avolition Forum Readers, Cock] commands: example: description: An example command. permission: tutorial.example permission-message: You don't have permission to do that! aliases: [ex, eg] usage: /<command> # In plugin.yml, wherever you type <command> inside a command body, it will substitute it for the actual command if you return false in your onCommand. permissions: tutorial.example: description: Allows a player to use /example children: tutorial.*: false # false means the mentioned node inherits from this node, true is the other way round! So, we now have our plugin.yml file. Bukkit will read it at runtime. There are many different things you can do with Bukkit. I'm going to tell you how to create a lightning command. It will strike the target block of the player. First we need to add this method to our main class: public boolean onCommand(CommandSender sendingDudeMbobbyGuyThatSentTehCommand, Command thecommandhesent, String thelabelheusedforthecommand, String[] arrayofargumentshesupplied) { I put the ridiculously long variable names to prevent copying and pasting. Rename them all you like. Add @Override to the top of the method and complete the braces. Import CommandSender from org.bukkit.command, same with command. Return true at the end of the method. Next create a variable of the type player, from now on I will be putting pseudocode. Player tehPlayer = // Cast the variable of CommandSender to Player here Next we need to check for the right command: if (thecommandhesent.getName() equals ignore case "example") open brace if (arrayofargumentshesupplied's length is greater than 0) open brace sendingDudeMbobbyGuy.sendMessage(you don't any additional arguments); return true; close brace close brace Inside it after the if check we need to strike some lightning, to get the block the player is staring at use this: # Import Block from org.bukkit not net.minecraft.server Block targetBlock2Strike = tehPlayer. // Look through the list to find the method. Parameters need to be (50, null). Bukkit has no obfuscation. For more info on the player class look [url="https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/entity/Player.java"]here[/url]. Yes it's an interface, it's implemented in CraftBukkit's CraftPlayer class. The reason we supply the parameters 50, null is a good one. 50 is the range in blocks. null is telling it to ignore air blocks. If we didn't supply null he would just strike the air block in front of him. Setting the int too high can crash servers. (hint for people that want to release a plugin that is corrupt but hard to notice) Now we need to strike it. World world = tehPlayer. // What do you think goes here? I'll hint that it starts with getW and ends with (); world.strikeLightning(your Block variable from before. // Well, it contains Location, starts with get and ends with ()); You are now done. All that's left is to add permissions. At the top of your if check to see if the command is example, add if (!sender. // something to do with having a permission("tutorial.example")) return true; And you have a plugin. If some of the respected forum members think I should cut down on / increase the levels of pseudo, go ahead and say so, it's hard to balance something like this. If you liked this, stay tuned to my posted topics and if this gets enough positive response I will post a tutorial on Spout Server plugins. I would not recommend starting large Bukkit projects now as it will probably be unmaintained after Minecraft 1.3 comes out, replaced by Spout and the Official API.
×