This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public interface Connection<T> { | |
| void onDataReceived(Consumer<T> dataConsumer): | |
| void send(T data); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Client { | |
| public static void main(String[] args) { | |
| Socket socket = new Socket("localhost", 10000); | |
| DataInputStream in = new DataInputStream(socket.getInputStream()); | |
| String message = in.readUTF(); | |
| System.out.println(message); | |
| Scanner scanner = new Scanner(System.in); | |
| String reply = scanner.nextLine(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static void main(String[] args) { | |
| List<String> lines = Files.readAllLines("article.txt"); | |
| String firstWords = ""; | |
| for(String line : lines) { | |
| int end = line.indexOf(' '); | |
| String firstWord = line.substring(0, end); | |
| firstWords = firstWords + firstWord; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Player { | |
| private int str; | |
| private int def; | |
| public Player(int strength, int defense) { | |
| str = strength; | |
| def = defense; | |
| } | |
| public void attack(Player defender) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Dog { | |
| private String name; | |
| private int age; | |
| private Person walker; | |
| public Dog(String name, int age) { | |
| this.name = name; | |
| this.age = age; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public final class Connection implements Runnable { | |
| private final ObjectOutputStream out; | |
| private final ObjectInputStream in; | |
| private final Socket socket; | |
| private final List<Consumer<Message>> messageListeners = new ArrayList<>(); | |
| public Connection(Socket socket) { | |
| this.socket = socket; | |
| this.out = new ObjectOutputStream(socket.getOutputStream()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Background | |
| The release of Fluxious has been a controversial topic, with a lot of people concerned of their account progress, and whether playing the beta now is worth doing so. Sander, Dinh, and myself have talked between each other, as well as the players, to brainstorm ways to fix the current problems attached to releasing Fluxious. | |
| Release | |
| The team has agreed to hold off on releasing Fluxious until a defined list of content has been fixed and/or implemented. Once the list is close to an end, we will announce a finalized release date. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import api.Content; | |
| import api.entity.player.IPlayer; | |
| import api.handlers.ButtonHandler; | |
| import api.handlers.Handlers; | |
| import api.handlers.ItemOnObjectHandler; | |
| import api.item.IItem; | |
| import api.object.IObject; | |
| import api.util.APISkillConstants; | |
| import api.widget.IButton; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private static void serverArguments(String[] args) { | |
| String combinedArguments = ""; | |
| for (int index = 0; index < args.length; index++) { | |
| combinedArguments = combinedArguments + args[index]; // creates a new StringBuilder object each loop iteration | |
| } | |
| if (args.length > 0) { | |
| List<String> argumentsAsList = Arrays.asList(args); // should be used more, no need for combinedArguments | |
| int port = Integer.parseInt(args[0]); // will fail without telling user HOW they messed up args |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Demo { | |
| public static void main(String[] args) throws Exception { | |
| XPCounter counter = new XPCounter(); | |
| int actionTimer = 0; | |
| int xpGained = 0; | |
| while(true) { | |
| if(++actionTimer > 5) { | |
| actionTimer = 0; | |
| xpGained++; |