Skip to content

Instantly share code, notes, and snippets.

View Limeth's full-sized avatar
🦀

Jakub Hlusička Limeth

🦀
View GitHub Profile
@Limeth
Limeth / designer.html
Created October 20, 2014 20:09
designer
<link rel="import" href="../paper-toast/paper-toast.html">
<link rel="import" href="../paper-button/paper-button.html">
<link rel="import" href="../paper-tabs/paper-tab.html">
<link rel="import" href="../paper-ripple/paper-ripple.html">
<link rel="import" href="../topeka-elements/avatars.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../topeka-elements/theme.html">
<link rel="import" href="../topeka-elements/topeka-resources.html">
<link rel="import" href="../topeka-elements/topeka-categories.html">
@Limeth
Limeth / designer.html
Last active August 29, 2015 14:09
designer
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu/core-submenu.html">
<polymer-element name="my-element">
@Limeth
Limeth / gist:d95345c5f9ab21c2edbf
Created December 10, 2014 21:17
Command varargs test
import com.sun.xml.internal.ws.util.StringUtils;
import org.terasology.entitySystem.entity.EntityRef;
import org.terasology.entitySystem.systems.BaseComponentSystem;
import org.terasology.entitySystem.systems.RegisterSystem;
import org.terasology.logic.console.Command;
import org.terasology.logic.console.CommandParam;
import java.lang.reflect.Constructor;
/**
/*
* Copyright 2014 MovingBlocks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@Limeth
Limeth / gist:684852a72d53090604a7
Created December 20, 2014 14:23
Command parameter completion
We have two options for implementing the command parameter suggestion:
A)
The CommandParameterAdapter (https://github.com/Limeth/Terasology/blob/develop/engine/src/main/java/org/terasology/logic/console/internal/adapter/CommandParameterAdapter.java) would have a method returning all possible cases, while a CommandParam would accept a Predicate-like object filtering those cases. The filtered cases would then be suggested after being composed to Strings by the corresponding CommandParameterAdapter.
B)
The CommandParam would accept a 'suggestion' parameter of a class implementing an interface with a return type of Object[] or Collection<Object>. The returned values would then be suggested after being composed to Strings by the corresponding CommandParameterAdapter.
@Command
public String tell(EntityRef sender, @CommandParam(value = "target", suggester = SUGGESTER_PLAYER) EntityRef target, String message) {
return "sent.";
}
private final Suggester SUGGESTER_PLAYER = new Suggester() {
public List<EntityRef> suggest() {
return /*all entityrefs of players*/;
}
}
@Command
public String tell(EntityRef sender, @CommandParam(value = "target", suggester = SUGGESTER_PLAYER) EntityRef target, String message) {
return "sent.";
}
private class PlayerSuggester extends Suggester {
@Override
public List<EntityRef> suggest() {
return /*all entityrefs of players*/;
}
@Limeth
Limeth / gist:2d649055bc597aa8b21e
Created January 1, 2015 19:23
SoundManager.java
package cz.minestrike.me.limeth.minestrike.util;
import java.io.File;
import java.io.IOException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.minecraft.server.v1_7_R4.EntityPlayer;
import net.minecraft.server.v1_7_R4.PacketPlayOutNamedSoundEffect;
import net.minecraft.server.v1_7_R4.PlayerConnection;
@Limeth
Limeth / gist:5e0d766ab9e2569265c5
Last active August 29, 2015 14:13
Is this correct?
package cz.projectsurvive.limeth.hitboxbind.frames;
import cz.projectsurvive.limeth.hitboxbind.HitboxFrameParseException;
import cz.projectsurvive.limeth.hitboxbind.HitboxMedia;
import cz.projectsurvive.limeth.hitboxbind.util.ReadOnlyBinding;
import de.howaner.FramePicture.util.Frame;
import org.bukkit.Location;
import org.bukkit.block.BlockFace;
import java.awt.*;
package cz.minestrike.me.limeth.minestrike;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Properties;
import org.bukkit.Bukkit;
import org.bukkit.Location;