Skip to content

Instantly share code, notes, and snippets.

View SocraticPhoenix's full-sized avatar

John-Ryan Dunn SocraticPhoenix

  • U.S.
View GitHub Profile
/*
* The MIT License (MIT)
*
* Copyright (c) 2015 socraticphoenix@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
import java.util.Arrays;
public class Test {
public static void main(String... args) {
Test.testArray(p(""), "");
Test.testArray(p("h"), "h");
Test.testArray(p("hi"), "hi");
Test.testArray(p("fun"), "fun");
Test.testArray(p("bye"), "bye");
Introduction
This document is intended to aid users of the JLSC configuration format.
Preliminary
Background
JLSC stands for JSON-Like Structured Configuration. JSON stands for JavaScript Object Notation, and information about it can be found at json.org. JLSC is partially based off of JSON, as well as HOCON and YAML, two other
configuration formats. The goal of the JLSC project is to simultaneously provide the best experience for the user, and the easiest development for the coder. JLSC has the same data structure of JSON, but it has more advanced
parsing and programitic interaction.
Java Basics
@SocraticPhoenix
SocraticPhoenix / TrackerTest.java
Created January 6, 2016 02:42
Testing block tracking in star API
/*
* The MIT License (MIT)
*
* Copyright (c) 2015 socraticphoenix@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
class TestSink extends MessageSink {
private MessageSink parent;
public TestSink(MessageSink parent) {
super();
this.parent = parent;
}
@Override
public Text transformMessage(CommandSource target, Text text) {
game= @serialized:{
serializer= "com.gmail.socraticphoenix.plasma.file.jlsc.serialization.JLSCAnnotatedSerializer"
type= "com.gmail.socraticphoenix.textchamber.Game"
values= {
startingDimension= "spawn"
playerDimension= "spawn"
playerRoom= com.gmail.socraticphoenix.plasma.math.matrix.Position(@integer:0, @integer:0)
dimension= @serialized:{
serializer= "com.gmail.socraticphoenix.plasma.file.jlsc.serialization.JLSCMapSerializer"
type= "java.util.HashMap"
package com.gmail.socraticphoenix.sponge.star.data;
import com.gmail.socraticphoenix.plasma.file.cif.cifc.CIFCConfiguration;
import com.gmail.socraticphoenix.plasma.file.cif.cifc.io.CIFCReader;
import com.gmail.socraticphoenix.plasma.file.cif.io.CIFException;
import org.spongepowered.api.data.DataHolder;
import org.spongepowered.api.data.DataView;
import org.spongepowered.api.data.manipulator.DataManipulatorBuilder;
import org.spongepowered.api.service.persistence.InvalidDataException;
@Listener
public void onDamage(DamageEntityEvent event) {
if(this.lobby.is(event.getTargetEntity().getWorld())) {
event.setCancelled(true);
if (event.getCause().any(DamageSource.class) && event.getCause().first(DamageSource.class).get() == DamageSources.VOID && event.getTargetEntity() instanceof Player) {
event.getTargetEntity().setLocation(this.lobby.getSpawn());
}
}
}
package com.gmail.socraticphoenix.teamfight.weapon.ability;
import com.flowpowered.math.vector.Vector3d;
import com.gmail.socraticphoenix.sponge.star.scheduler.SpongeRunnable;
import java.util.Collection;
import org.spongepowered.api.data.key.Keys;
import org.spongepowered.api.entity.Entity;
import org.spongepowered.api.entity.Item;
import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.world.Location;
Could not pass DisplaceEntityEvent$Move$TargetPlayer$Impl to SpongePlugin:Split Inventories{unknown}
java.lang.AbstractMethodError: Method net/minecraft/entity/player/EntityPlayerMP.getInventory()Lorg/spongepowered/api/item/inventory/type/CarriedInventory; is abstract
at net.minecraft.entity.player.EntityPlayerMP.getInventory(EntityPlayerMP.java) ~[qw.class:?]
at com.gmail.socraticphoenix.sponge.splitinventories.SplitInventories.exactInventorySave(SplitInventories.java:156) ~[SplitInventories.class:?]
at com.gmail.socraticphoenix.sponge.splitinventories.SplitInventories.saveInventory(SplitInventories.java:141) ~[SplitInventories.class:?]
at com.gmail.socraticphoenix.sponge.splitinventories.SplitInventories.onWorldChange(SplitInventories.java:117) ~[SplitInventories.class:?]
at org.spongepowered.common.event.listener.MoveListener_SplitInventories_onWorldChange10.handle(Unknown Source) ~[?:?]
at org.spongepowered.common.event.RegisteredListener.handle(RegisteredListener.java:92) ~[RegisteredListener.class