-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added "/perfectflight bypass" subcommand
- Loading branch information
Showing
5 changed files
with
71 additions
and
1 deletion.
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
58 changes: 58 additions & 0 deletions
58
src/main/java/me/stefan923/perfectflight/commands/type/CommandBypass.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,58 @@ | ||
package me.stefan923.perfectflight.commands.type; | ||
|
||
import me.stefan923.perfectflight.PerfectFlight; | ||
import me.stefan923.perfectflight.commands.AbstractCommand; | ||
import me.stefan923.perfectflight.language.LanguageManager; | ||
import me.stefan923.perfectflight.utils.MessageUtils; | ||
import me.stefan923.perfectflight.utils.User; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.configuration.file.FileConfiguration; | ||
import org.bukkit.entity.Player; | ||
|
||
import java.util.List; | ||
|
||
public class CommandBypass extends AbstractCommand implements MessageUtils { | ||
|
||
public CommandBypass(AbstractCommand abstractCommand) { | ||
super(abstractCommand, true, "bypass"); | ||
} | ||
|
||
@Override | ||
protected ReturnType runCommand(PerfectFlight instance, CommandSender sender, String... args) { | ||
FileConfiguration language = instance.getLanguageManager().getConfig(); | ||
User user = instance.getUser((Player) sender); | ||
|
||
if (user.isBypassing()) { | ||
user.setBypassing(false); | ||
sender.sendMessage(formatAll(language.getString("Command.Bypass.Enabled"))); | ||
|
||
return ReturnType.SUCCESS; | ||
} | ||
|
||
user.setBypassing(true); | ||
sender.sendMessage(formatAll(language.getString("Command.Bypass.Disabled"))); | ||
|
||
return ReturnType.SUCCESS; | ||
} | ||
|
||
@Override | ||
protected List<String> onTab(PerfectFlight instance, CommandSender sender, String... args) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public String getPermissionNode() { | ||
return "perfectflight.bypass"; | ||
} | ||
|
||
@Override | ||
public String getSyntax() { | ||
return "/perfectflight bypass"; | ||
} | ||
|
||
@Override | ||
public String getDescription() { | ||
return "Enables bypass mode for fly checker."; | ||
} | ||
|
||
} |
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