Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.rs31se7en.server.cache.loaders;
- import java.io.IOException;
- import java.nio.ByteBuffer;
- import java.util.Arrays;
- import com.rs31se7en.server.cache.Archive;
- import com.rs31se7en.server.cache.Cache;
- public class ChatSensorLoader {
- private Cache cache;
- private Archive sensorsArchive = null;
- private ByteBuffer badWordsBuffer = null;
- private String[] badwords = null;
- public ChatSensorLoader(Cache cache) throws Exception {
- this.cache = cache;
- sensorsArchive = new Archive(cache.getFile(0, 7));
- badWordsBuffer = sensorsArchive.getFileAsByteBuffer("badenc.txt");
- }
- public void loadBadWords() throws IOException {
- badwords = new String[badWordsBuffer.getInt()];
- System.out.println("Loading bad words. ");
- for (int wordIndex = 0; wordIndex < badwords.length; wordIndex++) {
- int wordLength = badWordsBuffer.get();
- char[] chars = new char[wordLength];
- for (int letter=0; letter<wordLength; letter++)
- chars[letter] = (char)(badWordsBuffer.get());
- badwords[wordIndex] = new String(chars);
- /*
- * TODO: Identify this
- */
- int len = badWordsBuffer.get();
- for (int i = 0; i < len; i++) {
- badWordsBuffer.get();
- badWordsBuffer.get();
- }
- }
- System.out.println("Loaded "+badwords.length+" bad words.");
- }
- }
Add Comment
Please, Sign In to add comment