Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expanded Javadocs #328

Merged
merged 4 commits into from
Oct 22, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,32 @@ public ParticleWrapper(@NotNull ParticleData data) {
this.data = Objects.requireNonNull(data);
}

/**
* Gets the ParticleData for the particle effect
*
* @return the ParticleData object
*/
public ParticleData getData() {
return this.data;
}

/**
* Spawns the particle effect for the player
*
* @param player the player to spawn the effect for
*/
public void spawnEffect(@NotNull PlayerWrapper<?> player) {
Objects.requireNonNull(player);
player.playEffect(this.data);
}

public static class ParticleData {

/**
* Creates a ParticleData object from a string
* @param str the string to create the ParticleData object from
* @return ParticleData object from the given string
*/
public static ParticleData fromString(@NotNull String str) {
Objects.requireNonNull(str);
if (str.contains(",")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,32 @@ public SoundWrapper(@NotNull SoundData data) {
this.data = Objects.requireNonNull(data);
}

/**
* Gets the SoundData for the sound effect
*
* @return the SoundData object
*/
public SoundData getData() {
return this.data;
}

/**
* Plays the sound to the player
*
* @param player the player to play the sound to
*/
public void playSoundToPlayer(@NotNull PlayerWrapper<?> player) {
Objects.requireNonNull(player);
player.playSound(this.data);
}

public static class SoundData {

/**
* Creates a SoundData object from a string
* @param str The string to create the SoundData object from
* @return SoundData object from the string
*/
public static SoundData fromString(@NotNull String str) {
Objects.requireNonNull(str);
if (str.contains(",")) {
Expand Down Expand Up @@ -82,15 +97,29 @@ private SoundData(@NotNull String sound, float volume, float pitch) {
this.volume = volume;
this.pitch = pitch;
}

/**
* Gets the sound name
*
* @return the sound name
*/
public String getSound() {
return this.sound;
}

/**
* Gets the volume of the sound
*
* @return the volume of the sound
*/
public float getVolume() {
return this.volume;
}

/**
* Gets the pitch of the sound
*
* @return the pitch of the sound
*/
public float getPitch() {
return this.pitch;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,25 @@ public EnchantmentWrapper(@NotNull String enchant, int level) {
this.level = level;
}

/**
* Gets the enchantment
* @return String enchantment
*/
public String getEnchant() {
return this.enchant;
}

/**
* Gets the level of the enchantment
* @return int level of the enchantment
*/
public int getLevel() {
return this.level;
}

/**
* Static builder for the enchantment wrapper
*/
public static class Builder {

private transient String enchantment;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ public EntityWrapper(@NotNull T entity) {
this.entity = Objects.requireNonNull(entity);
}

/**
* Get the UUID of the entity
* @return the UUID of the entity
*/
public abstract UUID getUniqueId();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,23 @@ default Permission getPermission() {

File getDataFolder();

/**
* @return the DynamicGUI config file
*/
default File getConfigFile() {
return new File(this.getDataFolder(), "config.yml");
}

/**
* @return the default gui folder
*/
default File getGuiFolder() {
return new File(this.getDataFolder(), "guis");
}

/**
* @return the default macro folder
*/
default File getMacroFolder() {
return new File(this.getDataFolder(), "macros");
}
Expand Down
13 changes: 13 additions & 0 deletions api/src/main/java/com/clubobsidian/dynamicgui/api/proxy/Proxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ public enum Proxy {
this.aliases = aliases;
}

/**
* Returns a proxy from its string alias
* @param proxyStr
* @return
*/
public static Proxy fromString(final String proxyStr) {
String localeStr = proxyStr.toLowerCase(Locale.ROOT);
for (Proxy proxy : Proxy.values()) {
Expand All @@ -49,11 +54,19 @@ public static Proxy fromString(final String proxyStr) {
return Proxy.NONE;
}

/**
* Gets the aliases of a proxy
* @return The aliases of the proxy
*/
public String[] getAliases() {
return this.aliases;
}


/**
* Gets the protocol of the proxy
* @return The protocol of the proxy
*/
public Protocol getProtocol() {
return this.protocol;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,28 @@ public Replacer(String toReplace, boolean listener) {
this.listener = listener;
}

/**
* Gets the string to replace
*
* @return The string to replace
*/
public String getToReplace() {
return this.toReplace;
}

/**
* Replaces the toReplace string with the replacement
* @param text
* @param playerWrapper
* @return
*/
public abstract String replacement(String text, PlayerWrapper<?> playerWrapper);

/**
* Gets if the replacer has a listener
*
* @return If the replacer has a listener
*/
public boolean hasListener() {
return this.listener;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,38 @@ public LocationWrapper(int x, int y, int z, WorldWrapper world) {
this.world = world;
}

/**
* Gets the x coordinate of the location
*
* @return x coordinate of the location
*/
public int getX() {
return this.x;
}

/**
* Gets the y coordinate of the location
*
* @return y coordinate of the location
*/
public int getY() {
return this.y;
}

/**
* Gets the z coordinate of the location
*
* @return z coordinate of the location
*/
public int getZ() {
return this.z;
}

/**
* Gets the WorldWrapper for the location
*
* @return world of the location
*/
public WorldWrapper<T> getWorld() {
return this.world;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,29 @@ public WorldWrapper(String name) {
this.name = name;
}

/**
* Gets the name of the world
*
* @return The name of the world
*/
public String getName() {
return this.name;
}

public abstract T getWorld();

/**
* Sets the gamerule key of the world to the specified gamerule value
* @param key
virustotalop marked this conversation as resolved.
Show resolved Hide resolved
* @param value
virustotalop marked this conversation as resolved.
Show resolved Hide resolved
*/
public abstract void setGameRule(String key, String value);

/**
* Gets value of the gamerule for the world
* @param rule
* @return gamerule value
*/
public abstract String getGameRule(String rule);

@Override
Expand Down