-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Citizens Integration #17
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good, just want a few things added. Thanks for working on this!
super(plugin, baseCommand, subCommand); | ||
super.description("Toggles Citizens NPCs' ability to travel through the portal."); | ||
super.arguments("portal"); | ||
super.requiresPlayer(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't look this command requires the sender to be a player
|
||
@Override | ||
protected boolean onCommand(CommandSender sender, String[] args) { | ||
Player player = (Player) sender; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused
* | ||
* @param event The Citizens NavigationCompleteEvent | ||
*/ | ||
@EventHandler(priority = EventPriority.NORMAL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick but you don't need to specify the priority here; it'll default to NORMAL
. Unless you were having issues without the priority then it's ok
@Override | ||
protected boolean onCommand(CommandSender sender, String[] args) { | ||
Player player = (Player) sender; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If Citizens isn't loaded you should send a message to the user and return early.
Messenger.msg(sender, Messenger.ReplaceMessage.SUGGEST_DELETE, "/portal remove " + portal.getName()); | ||
return true; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the portal's filler is water or lava I'd send a message to the user telling them about the consequences as noted in the README. I'd do the same thing in the setfiller sub-command if the portal allows citizens and the new fill type is water/lava.
@@ -69,6 +67,11 @@ private void registerStuff() { | |||
pm.registerEvents(new PortalBlockChangeListener(), this); | |||
pm.registerEvents(new PortalDamageListener(), this); | |||
|
|||
// check if Citizens is enabled | |||
if (pm.isPluginEnabled("Citizens")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a few comments later about conditionally doing stuff in commands if Citizens is enabled so I'd store pm.isPluginEnabled("Citizens")
as an instance variable in here for use across the plugin.
Co-authored-by: Jack Henhapl <[email protected]>
Portals now supports Citizens!
New Features:
/portal allowcitizens <portal_name>
allows Citizens NPCs to use the specified portalallowcitizens
status saves in configNotes:
WATER
fillerLAVA
fillerresolves #15