-
-
Notifications
You must be signed in to change notification settings - Fork 358
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Resident Modes system. (#7646)
* Update Resident Modes system. Adds the ability to assign a permission node to a mode, and when present, will require the player to have the permission node to toggle a node. This permission node is not required if the mode is part of a player's default modes set via the permission plugin. Additionally, the ability to clear a residents modes via command now requires a permission node. All together this makes it possible for admins to set modes that players cannot remove. Adds a ResidentModesInitializeEvent with which plugins can add Resident Modes. Uses a AbstractResidentMode class to allow for different types of Modes to be made, which makes it possible for Modes to be exclusive of each other: ie: you can no longer have townclaim and townunclaim modes active at the same time. New Permissions: - towny.command.resident.set.mode.clear - towny.command.resident.toggle.bedspawn - towny.command.resident.toggle.bordertitles - towny.command.resident.toggle.ignoreotherchannels - towny.command.resident.toggle.infotool - towny.command.resident.toggle.plotgroup - towny.command.resident.toggle.townborder - towny.command.resident.toggle.townunclaim Additionally, the tab completer for toggling and setting modes should no longer fall out of date, as ResidentModes will automatically get added to the ResidentCommand tabcompleters. * Cleaning up: Removes the un-needed SetDefaultModes task. Fix an errant ! in toggleMode that kept permissions from working right. Unneeded diffs. * Make townborder mode not a BorderResidentMode, so that it can be active while other plot border modes are enabled. * Prevent clearing being able to be done via /res set mode {modename}
- Loading branch information
Showing
18 changed files
with
573 additions
and
254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
Towny/src/main/java/com/palmergames/bukkit/towny/event/ResidentModesInitializeEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.palmergames.bukkit.towny.event; | ||
|
||
import org.bukkit.Bukkit; | ||
import org.bukkit.event.Event; | ||
import org.bukkit.event.HandlerList; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import com.palmergames.bukkit.towny.exceptions.TownyException; | ||
import com.palmergames.bukkit.towny.object.resident.mode.AbstractResidentMode; | ||
import com.palmergames.bukkit.towny.object.resident.mode.ResidentModeHandler; | ||
|
||
public class ResidentModesInitializeEvent extends Event { | ||
private static final HandlerList handlers = new HandlerList(); | ||
|
||
public ResidentModesInitializeEvent() { | ||
super(!Bukkit.isPrimaryThread()); | ||
} | ||
|
||
/** | ||
* Registers a new ResidentMode. | ||
* @param mode The ResidentMode you want to register. | ||
* @throws TownyException - If a mode with this name is already registered. | ||
*/ | ||
public void registerMode(@NotNull AbstractResidentMode mode) throws TownyException { | ||
ResidentModeHandler.registerMode(mode); | ||
} | ||
|
||
@Override | ||
public @NotNull HandlerList getHandlers() { | ||
return handlers; | ||
} | ||
|
||
public static HandlerList getHandlerList() { | ||
return handlers; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.