Spigot API
LadyCailinBot opened this issue ยท 5 comments
CMDHELPER-3126 - Reported by PseudoKnight
Currently the Spigot API expands the Bukkit API. However, after 1.8 the Spigot team is the only one updating the Bukkit API, there's an argument to be made that we could use some of the Spigot methods in CH. Some people still use CraftBukkit, though, so it'd still have to use reflection to see if those methods exist.
Available methods/events:
- Arrow get|set damage (CHSpigot)
- Entity.isInvulnerable()
- ItemStack get|set item unbreakable
- LightningStrike.isSilent()
- Player get|set collides with entities (CHSpigot)
- Player get hidden players (CHSpigot)
- Player get locale (CHSpigot)
- Player play effect (CHSpigot -- though this one we probably wouldn't add since we have a new particle system)
- Player respawn (CHSpigot)
- Player get raw address
- Player sendmessage (I believe this is like /tellraw)
- Server broadcast (also like /tellraw)
- Server getConfig()
- Server restart()
- Score isScoreSet()
- World play effect (similar to the Player one, and replaced by the particle system I think)
- World strike lightning (can specify silent strike)
- Mount/dismount events (CHSpigot)
- PlayerSpawnLocationEvent (just after joining a server)
- PlayerItemDamageEvent (CHSpigot)
- EntitySpawnEvent
- SpawnerSpawnEvent
- InventoryClickEvent getClickedInventory()
Not all of those are useful or would be added. Some are already in CHSpigot, but others cannot be added. (like item unbreakable)
I'm not sure what the Spigot team's plans are with these. I'm not sure if we should use them or not. This issue is to discuss whether they should be.
Comment by LadyCailin
What's the advantage/disadvantage of putting the spigot specific things in an extension, and leaving the core as Bukkit only?
Comment by PseudoKnight
Well, some of it is already in an extension, but some things are difficult if not impossible or impractical to do in an extension. Consider item setUnbreakable, which is only really practical in item or meta array. We could only add (with reflection) the ones that are impractical to add in an extension, and leave the rest to CHSpigot.
Some servers still use CraftBukkit (~18% vs ~61% using Spigot), so they would not be able to use these functions, events or item meta. This is already common in version differences (1.9 methods are not available on 1.8 servers) and can be handled with reflection. But it does add an extra bit of confusion in the documentation.
We're already using some effect ENUM only found in Spigot, because it's impractical to do otherwise. (Not sure how that's going to play out with the new 1.9 particle API.)
Comment by PseudoKnight
I'm not even sure what I think, but this came up again and I thought it might be helpful to write this down somewhere for people to think/talk about. I created the extension for a reason. I guess the questions are "how far should we go, what parts, and how do we want to do it".
Comment by LadyCailin
Well, craftbukkit is basically dead. So I'd be ok with switching over to supporting spigot, so long as we ensure that features that aren't supported by bukkit still work as best they can. (I.e. use reflection or general feature detection to gracefully fall back).