Skip to content

Instantly share code, notes, and snippets.

View Romain-P's full-sized avatar
🈴
/home

- Romain-P

🈴
/home
View GitHub Profile
@Override
public void start() {
this.future = manager.getWorker().submit(new Runnable() {
@Override
public void run() {
int serverRelease = FileUtils.getReleases(
FileUtils.path(Main.SERVER, "releases", "releases.dat")).lastRelease(AppUtils.OS);
int release = FileUtils.getLocalRelease("release.int");
int result = serverRelease - release;
package org.heat.world.commands;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import lombok.Getter;
import org.heat.shared.stream.ImmutableCollectors;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
package org.heat.world;
import org.heat.world.commands.impl.actions.AnnounceAction;
import org.heat.world.commands.impl.actions.HelpAction;
import org.heat.world.commands.impl.conditions.AnnouncerAccess;
/**
* Managed by romain on 08/03/2015.
*/
public class StdFrontendCommandsModule extends StdCommandsModule {
package org.heat.world;
import com.google.inject.AbstractModule;
import com.google.inject.multibindings.MapBinder;
import org.heat.world.commands.CommandCond;
import org.heat.world.commands.CommandManager;
import org.heat.world.commands.CommandTree;
import org.heat.world.commands.builder.CommandBuilder;
import org.heat.world.commands.builder.CommandProvider;
import org.heat.world.commands.impl.SimpleCommandManager;
package org.heat.world.commands.impl.actions;
import com.google.inject.Inject;
import org.heat.world.commands.*;
import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;
/**
@Romain-P
Romain-P / StdCommandsModule.java
Created March 16, 2015 17:55
ça reste correcte niveau verbose comme ça
package org.heat.world;
import com.google.inject.AbstractModule;
import com.google.inject.multibindings.MapBinder;
import org.heat.world.commands.CommandCond;
import org.heat.world.commands.CommandManager;
import org.heat.world.commands.CommandTree;
import org.heat.world.commands.builder.CommandBuilder;
import org.heat.world.commands.builder.CommandProvider;
import org.heat.world.commands.impl.SimpleCommandManager;
package org.heat.world;
import com.google.inject.AbstractModule;
import com.google.inject.multibindings.MapBinder;
import org.heat.world.commands.CommandCond;
import org.heat.world.commands.CommandManager;
import org.heat.world.commands.CommandTree;
import org.heat.world.commands.builder.CommandProvider;
import org.heat.world.commands.impl.SimpleCommandManager;
import org.heat.world.commands.impl.actions.HelloAction;
package org.heat.world.commands.impl;
import lombok.Getter;
import org.heat.world.commands.Command;
import org.heat.world.commands.CommandCond;
/**
* Managed by romain on 08/03/2015.
*/
public abstract class AbstractCommand implements Command {
@Romain-P
Romain-P / CommandDSL.java
Last active August 29, 2015 14:17
My command DSL
binder.put("character", Commands.new("character", (c) -> c
.withSub("customize", (sub) -> sub.to(CustomizeAction.class))
.withSub("remove", (sub) -> sub
.to(RemoveAction.class)
.withArg("definitly", "yes", "no")) //equals withRequiredArg("state" new String[] { "on", "off" })
.withSub("reload", (sub) -> sub.to(ReloadAction.class))
.iff(GmLevelCondition.class);
.withAliases("!personnage", "!joueur"));
//!character -customize
package org.heat.world.commands.implementations.created;
import org.heat.world.commands.Command;
import org.heat.world.commands.CommandAction;
import org.heat.world.commands.CommandManager;
import org.heat.world.commands.CommandSender;
import org.heat.world.commands.implementations.DefaultCommand;
import javax.inject.Inject;
import java.util.List;