Search the Community
Showing results for tags 'txt'.
Found 6 results
-
[B]What is this useful for?[/B] *Server *Client *Launchers Q: For what? A: For a example you could load your news message from a dropbox .txt file, giving you the ability to change your in-game news just by using mobile phone when you're away from computer. [code] /** * Loads a .txt file from URL and * returns to the text inside it. * [MENTION=75098]Para[/MENTION]m url_adress > [url]www.adress.com/myText.txt[/url] * [MENTION=184045]return[/MENTION] S * @throws java.io.IOException */ public static String getMessageFromURL(String url_adress) throws IOException { URL url = null; try { url = new URL(url_adress); } catch (MalformedURLException e) { System.out.println("There was an error loading the file / reading it." + " " + Arrays.toString(e.getStackTrace())); } return IOUtils.toString(url); }[/code] You need apache commons-io 2.4 which can be downloaded here. [url]http://commons.apache.org/proper/commons-io/[/url]
-
Useful for news and such, since it loads them from .txt it excludes live updating, meaning that if you would change news the server restart wouldn't be required. When you want to read a file you must input the class for an example this is how we would read a file: [CODE]ArgonFileReader.readAll("test", ReadType.WORLD_MESSAGE);[/CODE] the following code would read all the lines from test.txt file as a game message for every player in your server. [CODE]package com.argon.jpf.impl; import com.argon.jpf.Plugin; import com.argon.player.Client; import com.argon.player.PlayerUpdate; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; /** * @author Fuzen Seth */ public class ArgonFileReader { private static final String FOLDER_PATH = "Data/reader/"; public static void loadTest() { } /** The reader types. */ public enum ReadType { CHAT_MESSAGE, WORLD_MESSAGE, SYSTEM, FORCED_CHAT; } public static void readAll(String file, ReadType readingType) throws IOException { FileReader inputFile = new FileReader(FOLDER_PATH + file + ".txt"); String line; try (BufferedReader bufferReader = new BufferedReader(inputFile)) { while ((line = bufferReader.readLine()) != null) { switch (readingType) { case CHAT_MESSAGE: break; case WORLD_MESSAGE: for (int j = 0; j < PlayerUpdate.players.length; j++) { if (PlayerUpdate.players[j] != null) { Client world = (Client) PlayerUpdate.players[j]; world.sendMessage(line); } } break; case SYSTEM: System.out.print(line); break; case FORCED_CHAT: for (int j = 0; j < PlayerUpdate.players.length; j++) { if (PlayerUpdate.players[j] != null) { Client world = (Client) PlayerUpdate.players[j]; world.forcedChat(line); }} break; default: throw new AssertionError(readingType.name()); } } } } } [/CODE] [img]http://puu.sh/dJUMh/f39dd5e28c.png[/img] [img]http://puu.sh/dJVej/4361b7adec.png[/img]
-
[CODE]package com.rs.utility.object; import java.io.IOException; import java.util.ArrayList; import java.util.logging.Logger; import com.rs.game.World; import com.rs.game.WorldObject; import com.rs.utility.files.FileUtilities; /** * The class that handles deletion of World Objects in from JVM runtime. * * @author Tyluur <[email protected]> * @since 2012-07-27 */ public final class ObjectRemoval { /** The arraylist of the objects which will be removed from the world globally. */ private static final ArrayList<WorldObject> objects = new ArrayList<WorldObject>(); /** The location of the files to remove objects from. */ private static final String FILE_LOCATION = "./data/objectremoval.txt"; /** The instance of the logger in this class. */ private static final Logger logger = Logger.getLogger(ObjectRemoval.class.getCanonicalName()); public static void init() { try { for (String lines : FileUtilities.readFile(FILE_LOCATION)) { if (lines.startsWith("//")) continue; String[] data = lines.split(" "); int id = Integer.parseInt(data[0]), x = Integer .parseInt(data[1]), y = Integer.parseInt(data[2]), z = Integer .parseInt(data[3]), type = Integer.parseInt(data[4]), rotation = Integer .parseInt(data[5]); WorldObject worldObject = new WorldObject(id, type, rotation, x, y, z); objects.add(worldObject); } } catch (IOException e) { e.printStackTrace(); } for (WorldObject object : objects) { if (object == null) continue; World.removeObject(object, true); } logger.info("Removed " + objects.size() + " world objects."); } } [/CODE] usage: OBJECT ID - X, Y, Z, TYPE, ROTATION Get FileUtilities class from Dementhium or some shit.
-
Hey, i was wondering on how to turn a .txt file to a .php. I just finished coding my website and I was wondering how to turn .txt to a .php because i want to upload it to the internet
-
pls how can i change it in Overloadx 317 client??!coudlnt find it anywhere! [IMG]http://i41.tinypic.com/nco8kp.jpg[/IMG]
- 1 reply
-
- achivements
- change
-
(and 1 more)
Tagged with:
-
ok so this is my second post and yes we are making dementhium 634 load .dat and .txt mapdata yeah. ps may repost with pics dont know yet. ok so first go into src.org.dementhium.model.map than you want to open region find private void load, there should be somthing like this there File file = new File("data/objects/maps/", "m" + x + "_" + y + ".dat.gz"); copy and paste that 2 times underneath and than remove everything after maps/ in each one you pasted. than after one you put .dat should look like this File file2 = new File("data/objects/maps/.dat"); make it look like that. do the same accept put a 3 after the second file and put .txt, now save and compile if any erros post and ill hlep fix thnx for looking enjoy :)
-
- dat
- dementhium
-
(and 3 more)
Tagged with: