generated from ArtformGames/TemplateSinglePlugin
-
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.
- Loading branch information
Showing
7 changed files
with
112 additions
and
135 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
109 changes: 38 additions & 71 deletions
109
src/main/java/com/artformgames/plugin/tempflight/conf/PluginMessages.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 |
---|---|---|
@@ -1,102 +1,69 @@ | ||
package com.artformgames.plugin.tempflight.conf; | ||
|
||
import cc.carm.lib.configuration.core.Configuration; | ||
import cc.carm.lib.mineconfiguration.bukkit.builder.message.CraftMessageListBuilder; | ||
import cc.carm.lib.mineconfiguration.bukkit.builder.message.CraftMessageValueBuilder; | ||
import cc.carm.lib.mineconfiguration.bukkit.value.ConfiguredMessage; | ||
import cc.carm.lib.mineconfiguration.bukkit.value.ConfiguredMessageList; | ||
import de.themoep.minedown.MineDown; | ||
import me.clip.placeholderapi.PlaceholderAPI; | ||
import com.artformgames.core.conf.Messages; | ||
import net.md_5.bungee.api.chat.BaseComponent; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.entity.Player; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.util.function.BiFunction; | ||
public interface PluginMessages extends Messages { | ||
|
||
public interface PluginMessages extends Configuration { | ||
static @NotNull CraftMessageListBuilder<BaseComponent[]> list() { | ||
return ConfiguredMessageList.create(getParser()) | ||
.whenSend((sender, message) -> message.forEach(m -> sender.spigot().sendMessage(m))); | ||
} | ||
interface COMMANDS extends Messages { | ||
|
||
static @NotNull CraftMessageValueBuilder<BaseComponent[]> value() { | ||
return ConfiguredMessage.create(getParser()) | ||
.whenSend((sender, message) -> sender.spigot().sendMessage(message)); | ||
} | ||
ConfiguredMessageList<BaseComponent[]> WRONG_TIME_FORMAT = Messages.list() | ||
.defaults("&c&lWrong format! &fPlease use &e&o1h,2m,3s &f.") | ||
.build(); | ||
|
||
ConfiguredMessageList<BaseComponent[]> ALREADY_ENABLED = Messages.list() | ||
.defaults("&fThe player &6%(player) &fis already enabled flying.") | ||
.params("player") | ||
.build(); | ||
|
||
ConfiguredMessageList<BaseComponent[]> ALREADY_DISABLED = Messages.list() | ||
.defaults("&fThe player &6%(player) &fis not enabled flying.") | ||
.params("player") | ||
.build(); | ||
|
||
ConfiguredMessageList<BaseComponent[]> COOLING = Messages.list() | ||
.defaults( | ||
"&fThe player &6%(player) &fneed to wait for &e%(time) &fseconds before he can use the timed flight again." | ||
).params("player", "time").build(); | ||
|
||
ConfiguredMessageList<BaseComponent[]> ENABLED = Messages.list() | ||
.defaults("&fSuccessfully enabled temp flight for &6%(player) &fwith &e%(time) &fseconds.") | ||
.params("player", "time") | ||
.build(); | ||
ConfiguredMessageList<BaseComponent[]> DISABLED = Messages.list() | ||
.defaults("&fSuccessfully disabled temp flight for &6%(player) &f.") | ||
.params("player") | ||
.build(); | ||
|
||
private static @NotNull BiFunction<CommandSender, String, BaseComponent[]> getParser() { | ||
return (sender, message) -> { | ||
if (sender == null) return MineDown.parse(message); | ||
if (sender instanceof Player player) { | ||
return MineDown.parse(PlaceholderAPI.setPlaceholders(player, message)); | ||
} else { | ||
return MineDown.parse(message); | ||
} | ||
}; | ||
} | ||
|
||
ConfiguredMessageList<BaseComponent[]> COOLING = list() | ||
ConfiguredMessageList<BaseComponent[]> COOLING = Messages.list() | ||
.defaults("&fYou need to wait for &e%(time) &fseconds before you can use the timed flight again.") | ||
.params("time") | ||
.build(); | ||
|
||
ConfiguredMessageList<BaseComponent[]> FLYING = list() | ||
ConfiguredMessageList<BaseComponent[]> FLYING = Messages.list() | ||
.defaults("&fYou have enabled time-limited flying, and the remaining flight time is &e%(time) &fseconds.") | ||
.params("time") | ||
.build(); | ||
|
||
ConfiguredMessageList<BaseComponent[]> ENABLED = list() | ||
.defaults("&fYou &a&l&Enabled &f for timed flights, and from now on you can fly &e%(time) &fseconds.") | ||
ConfiguredMessageList<BaseComponent[]> ENABLED = Messages.list() | ||
.defaults("&fYou are &a&lEnabled &f for timed flights, and from now on you can fly &e%(time) &fseconds.") | ||
.params("time") | ||
.build(); | ||
|
||
ConfiguredMessageList<BaseComponent[]> DISABLED = list() | ||
ConfiguredMessageList<BaseComponent[]> DISABLED = Messages.list() | ||
.defaults("&fYour timed flight has ended and your flight status has been automatically turned off.") | ||
.build(); | ||
|
||
ConfiguredMessageList<BaseComponent[]> MODE_CHANGE = list() | ||
ConfiguredMessageList<BaseComponent[]> MODE_CHANGE = Messages.list() | ||
.defaults("&fYou've switched to &eCreative Mode&f, so there's no longer a time limit for flying.") | ||
.build(); | ||
|
||
ConfiguredMessageList<BaseComponent[]> WILL_BACK = list() | ||
.defaults("&7Note: Teleport back to your current location after the flight is over!") | ||
ConfiguredMessageList<BaseComponent[]> WILL_BACK = Messages.list() | ||
.defaults("&7Note: Will teleport back to your start location after the flight is over!") | ||
.build(); | ||
|
||
interface COMMANDS extends Configuration { | ||
|
||
ConfiguredMessageList<BaseComponent[]> NO_PERMISSION = list() | ||
.defaults("&cYou don't have permission to do this.") | ||
.build(); | ||
|
||
ConfiguredMessageList<BaseComponent[]> ALREADY_FLYING = list().defaults( | ||
"The player is already flying, and you can't do it again." | ||
).params("player").build(); | ||
|
||
ConfiguredMessageList<BaseComponent[]> NOT_FLYING = list().defaults( | ||
"The player is not flying, and you can't do it." | ||
).params("player").build(); | ||
|
||
ConfiguredMessageList<BaseComponent[]> FLY_DISABLED = list().defaults( | ||
"&fThe player &e%(player)&f is not flying, and you can't do it." | ||
).params("player").build(); | ||
|
||
|
||
ConfiguredMessageList<BaseComponent[]> FLY_ENABLED = list().defaults( | ||
"&fSuccessfully enabled temporary flight in %(time) seconds for the player &e%(player)&f." | ||
).params("player", "time").build(); | ||
|
||
ConfiguredMessageList<BaseComponent[]> COOLING = list().defaults( | ||
"&fThe player %(player) need to wait for &e%(time) &fseconds before flying again." | ||
).params("player", "time").build(); | ||
|
||
// TIME USAGE | ||
ConfiguredMessageList<BaseComponent[]> TIME_USAGE = list().defaults( | ||
"&fThe time format is incorrect, the format is &e1d2h3m4s&f." | ||
).build(); | ||
|
||
|
||
} | ||
|
||
|
||
} |
Oops, something went wrong.