-
Notifications
You must be signed in to change notification settings - Fork 0
O | Utility: GammaUtils
Sartaj Singh edited this page May 31, 2025
·
3 revisions
- 1. Overview
- 2. What is GammaUtils?
- 3. Basic Usage
- 4. API Reference
- 5. Advanced Patterns
- 6. Troubleshooting & Notes
- 7. See Also
GammaUtils is a utility class in FXItems for toggling night vision effects for players via commands.
It is designed to make it easy for players (with permission) to enable or disable night vision, with persistent effects and clear messaging.
- Lets players toggle night vision on or off with
/nvor/nightvisioncommands. - Uses metadata to track if a player has night vision active.
- Applies or removes the actual potion effect as needed.
- Provides user feedback via chat messages.
Players with the required permission can use:
/nv
or
/nightvision
- Enables night vision if not already active.
- Disables night vision if already active.
// Command handler (implements CommandExecutor)
public boolean onCommand(CommandSender sender, Command command, String label, String[] args);-
Enables Night Vision:
Adds NIGHT_VISION potion effect to player and sets metadata. -
Disables Night Vision:
Removes NIGHT_VISION effect and metadata.
-
Permission Control:
Only players with thesmp.nightvisionpermission can use the command. -
Persistent Effect:
Uses metadata to ensure the effect is not re-applied or removed incorrectly. -
Integration:
Can be hooked into other plugins by calling the same command handler.
- Only works for players (not console or command blocks).
- If a player does not have permission, they will receive a red error message.
- The night vision effect is set to last effectively forever (Integer.MAX_VALUE duration).
- Sends clear feedback when toggling on or off.
- Home
- A | Getting Started & Plugin Overview
- B | The Registry System: Items, Foods, Commands, Events
- C | Creating Custom Items
- D | Creating Custom Foods
- E | Advanced: Custom Effects in FXItems
- F | Creating Custom Commands
- G | Creating Custom Events & Behaviors
- H | Utility: CooldownUtils
- I | Utility: CustomItemUtils
- J | Utility: EffectUtils
- K | Utility: ManaUtils
- L | Utility: OneTimeCraftUtils
- M | Utility: TeleportUtils
- N | Utility: ProjectileUtils
- O | Utility: GammaUtils
- P | Utility: EntitySizeUtils
- Q | FXItems API (com.noctify.API) & Making Addons
- R | Advanced Techniques, Gotchas & FAQ
- S | Auto-Registration System
- T | Migration Guide (v1.1 → v1.2+)
- U | Changelog