Skip to content

Instantly share code, notes, and snippets.

public interface Connection<T> {
void onDataReceived(Consumer<T> dataConsumer):
void send(T data);
}
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();
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;
}
public class Player {
private int str;
private int def;
public Player(int strength, int defense) {
str = strength;
def = defense;
}
public void attack(Player defender) {
public class Dog {
private String name;
private int age;
private Person walker;
public Dog(String name, int age) {
this.name = name;
this.age = age;
}
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());
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.
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;
@riftrsps
riftrsps / .java
Last active September 11, 2019 03:53
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
@riftrsps
riftrsps / Main.java
Last active September 5, 2019 12:41
XP Per Hour/Minute/Second
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++;