Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
dependencies {
compileOnly project(":api")
compileOnly project(":common")
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@
import at.helpch.placeholderapi.api.expansion.Expansion;
import at.helpch.placeholderapi.api.expansion.ExpansionDescription;
import at.helpch.placeholderapi.api.expansion.Platform;
import at.helpch.placeholderapi.api.expansion.placeholder.Placeholder;
import at.helpch.placeholderapi.api.expansion.placeholder.PlaceholderContext;
import at.helpch.placeholderapi.api.player.Player;
import at.helpch.placeholderapi.api.player.keyable.key.PlayerKeys;
import at.helpch.placeholderapi.api.server.Server;
import at.helpch.placeholderapi.expansion.time.TimeFormatter;
import at.helpch.placeholderapi.expansion.time.file.Config;
import com.google.inject.Inject;
import org.jetbrains.annotations.NotNull;

import java.sql.Time;
import java.util.function.Function;

@ExpansionDescription(
name = "Player",
Expand All @@ -12,19 +24,26 @@
platforms = {Platform.BUKKIT, Platform.SPONGE, Platform.NUKKIT}
)
public final class PlayerExpansion extends Expansion {
// @Override
// public void enable() {
// register();
// }
//
// private void register() {
// player("name", player -> player.getNullable(PlayerKeys.NAME));
// player("uuid", player -> player.getNullable(PlayerKeys.UUID));
// player("has_played_before", player -> player.getNullable(PlayerKeys.HAS_PLAYED_BEFORE));
// player("is_whitelisted", player -> player.getNullable());
// }
//
// private void player(@NotNull final String name, @NotNull final Function<Player<?>, Object> function) {
// registerPlaceholder(name, context -> function.apply(context.getPlayer()));
// }

private final TimeFormatter timeFormatter;
private final Config config;

@Inject
public PlayerExpansion(@NotNull final Config config) {
this.config = config;

// TODO: instantiate a single TimeFormatted through out the project, with a main config
this.timeFormatter = new TimeFormatter(config);
}

@Override
public void enable() {

}

@Placeholder("name")
private String name(final PlaceholderContext context) {
return context.getPlayer().get(PlayerKeys.NAME).orElse("");
}

}