Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Print exception if problems with command

Use plugin directly on file handling
Convert key values to clojure keys. Makes for more sane structures.
  • Loading branch information...
1 parent 0d75a1a commit af4a11fb94c6e8414ebf8b03e5385cceec5e025f @CmdrDats committed
Showing with 9 additions and 7 deletions.
  1. +2 −1  src/cljminecraft/commands.clj
  2. +7 −6 src/cljminecraft/files.clj
3  src/cljminecraft/commands.clj
@@ -66,8 +66,9 @@
(let [converted (map (partial convert-type sender) param-types args)
{:keys [msg] :as response} (apply f sender converted)]
+ (log/info "Responding with %s" response)
(if msg (respond sender msg))))
- (catch RuntimeException e (respond sender (.getMessage e))))
+ (catch RuntimeException e (.printStackTrace e) (respond sender "An error occurred with this command")))
(defmulti param-type-tabcomplete (fn [_ x _] x))
13 src/cljminecraft/files.clj
@@ -2,15 +2,16 @@
(:require [cheshire.core :as json])
(:require [ :as io]))
-(defn data-folder [{:keys [server]}]
- (.getDataFolder server))
+(defn data-folder [plugin]
+ (.getDataFolder plugin))
-(defn read-json-file [{:keys [server] :as env} filename]
+(defn read-json-file [plugin filename]
- (json/decode (slurp (io/file (data-folder env) filename)))
+ (json/decode (slurp (io/file (data-folder plugin) filename)) true)
+ (catch e {})
(catch Exception e (.printStackTrace e) {})))
-(defn write-json-file [{:keys [server] :as env} filename data]
- (let [file (io/file (data-folder) filename)]
+(defn write-json-file [plugin filename data]
+ (let [file (io/file (data-folder plugin) filename)]
(io/make-parents file)
(spit file (json/encode data))))

0 comments on commit af4a11f

Please sign in to comment.
Something went wrong with that request. Please try again.