Permalink
Browse files

Would help to actually.. you know… test it at least once before pushi…

…ng :)
  • Loading branch information...
1 parent f81ef89 commit 43d47b254611f9f46ff176680347799528ac436c @CmdrDats committed Dec 14, 2012
View
@@ -24,6 +24,7 @@ understand what changes are made and adjust your plugins accordingly.
Changelog:
14 December 2012:
+ - API Breaking Change: ev/event needs to now reference eventname as "player.player-interact" string instead of symbol.
- Implement material handling types properly
- You can now specify [:wood :jungle :north] as a material key for (get-material)
- Supports everything down to [:mushroom false :north] for a non-stem north-painted mushroom block
@@ -5,6 +5,7 @@
[cljminecraft.player :as plr]
[cljminecraft.events :as ev]
[cljminecraft.entity :as ent]
+ [cljminecraft.items :as items]
)
(:import [org.bukkit.command TabExecutor]))
@@ -27,7 +28,7 @@
result)))
(defmethod convert-type :material [sender type arg]
- (let [result (get plr/materials (keyword arg))]
+ (let [result (items/get-material (:keyword arg))]
(if (nil? result) (util/throw-runtime "Invalid material: %s" arg)
result)))
@@ -63,7 +64,7 @@
(defmethod param-type-tabcomplete :material [sender type arg]
(let [lower (.toLowerCase arg)]
- (filter #(.startsWith % lower) (map name (keys plr/materials)))))
+ (filter #(.startsWith % lower) (map name (keys items/materials)))))
(defmethod param-type-tabcomplete :event [sender type arg]
(ev/find-event arg))
@@ -8,6 +8,7 @@
[cljminecraft.config :as cfg]
[cljminecraft.commands :as cmd]
[cljminecraft.recipes :as r]
+ [cljminecraft.items :as i]
[cljminecraft.files]
[clojure.tools.nrepl.server :refer (start-server stop-server)]))
@@ -8,6 +8,7 @@
(defn register-event [plugin eventname f & [priority-key]]
(let [eventclass (resolve (symbol (util/package-classname "org.bukkit.event" (str eventname "-event"))))]
+ (log/info "Registering event %s for plugin %s" eventname (.getName plugin))
(.registerEvent
(bk/plugin-manager)
eventclass
@@ -24,7 +25,7 @@
(doseq [ev events]
(when-not (@registered-events ev)
(swap! registered-events conj ev)
- (register-event plugin (:classname ev) (:event-fn ev) (:priority ev))
+ (register-event plugin (:eventname ev) (:event-fn ev) (:priority ev))
)))
(defn event
View
@@ -36,7 +36,7 @@
`(defmethod get-new-data ~type
[~(symbol "type") ~(symbol "material") [~@args]]
(let [~@spec-let
- ~(symbol "result") (~(symbol (str type ".")))]
+ ~(symbol "result") (~(symbol (str type ".")) ~(symbol "material"))]
~@spec-set
~(symbol "result"))
)))
@@ -46,8 +46,8 @@
[type]
`(defmat ~type [.setFacingDirection ~(symbol "direction") blockfaces]))
-(defmethod get-new-data _ [type material values]
- (let []))
+(defmat MaterialData
+ [.setData data])
(defmat Tree
[.setSpecies species treespecies]
@@ -80,7 +80,7 @@
result))
(defmethod get-new-data Rails [type material [direction onslope?]]
- (let [result (Rail. material)
+ (let [result (Rails. material)
dir (get blockfaces direction)]
(if dir (.setDirection result dir (if onslope? true false)))
result))
@@ -165,6 +165,8 @@
(defmat SmoothBrick
[.setMaterial texture materials])
+
+
(defmethod get-new-data Mushroom [type material [stem? & pntdirs]]
(let [result (Mushroom. material)]
(if stem? (.setStem true))
@@ -173,7 +175,7 @@
(.setPaintedFace result dir)))
result))
-(defmethod get-new-data Vine [type material [stem? pntwest? pnteast? pntnorth? pntsouth? pntup?]]
+(defmethod get-new-data Vine [type material [& pntdirs]]
(let [result (Vine. material)]
(doseq [d pntdirs]
(let [dir (get blockfaces d)]
@@ -5,13 +5,13 @@
(:import [org.bukkit.inventory ShapedRecipe ShapelessRecipe ItemStack]))
(defn shapeless [material-map result ingredients qty]
- (let [result (ShapelessRecipe. (item-stack result qty))]
+ (let [result (ShapelessRecipe. (items/item-stack result qty))]
(doseq [c ingredients]
(.addIngredient result (items/get-material (get material-map c))))
result))
(defn shaped [material-map result ingredients qty]
- (let [result (ShapedRecipe. (item-stack result qty))]
+ (let [result (ShapedRecipe. (items/item-stack result qty))]
(.shape result (into-array String ingredients))
(doseq [[c mkey] material-map]
(try

0 comments on commit 43d47b2

Please sign in to comment.