Skip to content

Instantly share code, notes, and snippets.

@tnoda
Created August 18, 2015 06:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tnoda/f53638d3ed52ee2049c8 to your computer and use it in GitHub Desktop.
Save tnoda/f53638d3ed52ee2049c8 to your computer and use it in GitHub Desktop.
Spigot サーバに Clojure の REPL を組み込んで立ち上げる
(ns tnoda.iwami
(:gen-class)
(:import (org.bukkit.craftbukkit Main))
(:require [clojure.tools.nrepl.server :as nrepl-server]))
(defonce server (atom nil))
(defn- nrepl-host
[]
(or (System/getenv "NREPL_HOST") "127.0.0.1"))
(defn- nrepl-port
[]
(if-let [env (System/getenv "NREPL_PORT")]
(Long/parseLong env)
7888))
(defn -main
[& args]
(reset! server (nrepl-server/start-server :bind (nrepl-host)
:port (nrepl-port)))
(Main/main (doto (make-array String 3)
(aset 0 "--noconsole")
(aset 1 "--host")
(aset 2 "127.0.0.1"))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment