Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
mcchampions committed Jul 4, 2024
1 parent b16c4b7 commit b9fd62a
Show file tree
Hide file tree
Showing 53 changed files with 301 additions and 699 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import java.util.logging.Level;
import java.util.stream.IntStream;
import javax.annotation.ParametersAreNonnullByDefault;

import lombok.Getter;
import me.mrCookieSlime.Slimefun.Objects.handlers.BlockTicker;
import org.bukkit.Bukkit;
import org.bukkit.Location;
Expand All @@ -44,6 +46,7 @@ public class ErrorReport<T extends Throwable> {
private final SlimefunAddon addon;
private final T throwable;

@Getter
private File file;

/**
Expand Down Expand Up @@ -138,15 +141,6 @@ public ErrorReport(T throwable, SlimefunItem item) {
});
}

/**
* This method returns the {@link File} this {@link ErrorReport} has been written to.
*
* @return The {@link File} for this {@link ErrorReport}
*/
public File getFile() {
return file;
}

/**
* This returns the {@link Throwable} that was thrown.
*
Expand All @@ -169,7 +163,7 @@ private void print(Consumer<PrintStream> printer) {
this.file = getNewFile();
count.incrementAndGet();

try (PrintStream stream = new PrintStream(file, StandardCharsets.UTF_8.name())) {
try (PrintStream stream = new PrintStream(file, StandardCharsets.UTF_8)) {
stream.println();

stream.println("Error Generated: " + dateFormat.format(LocalDateTime.now()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.papermc.lib.PaperLib;
import lombok.Getter;
import org.apache.commons.lang.Validate;
import org.bukkit.Server;

Expand Down Expand Up @@ -52,7 +53,9 @@ public enum MinecraftVersion {
*/
UNKNOWN("Unknown", true);

@Getter
private final String name;
@Getter
private final boolean virtual;
private final int majorVersion;

Expand Down Expand Up @@ -88,28 +91,6 @@ public enum MinecraftVersion {
this.virtual = virtual;
}

/**
* This returns the name of this {@link MinecraftVersion} in a readable format.
*
* @return The name of this {@link MinecraftVersion}
*/
public String getName() {
return name;
}

/**
* This returns whether this {@link MinecraftVersion} is virtual or not.
* A virtual {@link MinecraftVersion} does not actually exist but is rather
* a state of the {@link Server} software used.
* Virtual {@link MinecraftVersion MinecraftVersions} include "UNKNOWN" and
* "UNIT TEST".
*
* @return Whether this {@link MinecraftVersion} is virtual or not
*/
public boolean isVirtual() {
return virtual;
}

/**
* This tests if the given minecraft version number matches with this
* {@link MinecraftVersion}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import java.util.Objects;
import java.util.UUID;
import javax.annotation.ParametersAreNonnullByDefault;

import lombok.Getter;
import org.apache.commons.lang.Validate;
import org.bukkit.Bukkit;
import org.bukkit.Location;
Expand All @@ -26,11 +28,37 @@
* @see Teleporter
*
*/
@Getter
public class Waypoint {

/**
* -- GETTER --
* This returns the owner's
* of the
* .
*
*/
private final UUID ownerId;
/**
* -- GETTER --
* This method returns the unique identifier for this
* .
*
*/
private final String id;
/**
* -- GETTER --
* This returns the name of this
* .
*
*/
private final String name;
/**
* -- GETTER --
* This returns the
* of this
*
*/
private final Location location;

/**
Expand Down Expand Up @@ -78,16 +106,6 @@ public Waypoint(UUID ownerId, String id, Location loc, String name) {
this.name = name;
}

/**
* This returns the owner's {@link UUID} of the {@link Waypoint}.
*
* @return The corresponding owner's {@link UUID}
*/

public UUID getOwnerId() {
return this.ownerId;
}

/**
* This returns the owner of the {@link Waypoint}.
*
Expand All @@ -102,36 +120,6 @@ public PlayerProfile getOwner() {
return PlayerProfile.find(Bukkit.getOfflinePlayer(ownerId)).orElse(null);
}

/**
* This method returns the unique identifier for this {@link Waypoint}.
*
* @return The {@link Waypoint} id
*/

public String getId() {
return id;
}

/**
* This returns the name of this {@link Waypoint}.
*
* @return The name of this {@link Waypoint}
*/

public String getName() {
return name;
}

/**
* This returns the {@link Location} of this {@link Waypoint}
*
* @return The {@link Waypoint} {@link Location}
*/

public Location getLocation() {
return location;
}

/**
* This method returns whether this {@link Waypoint} is a Deathpoint.
*
Expand Down Expand Up @@ -166,11 +154,10 @@ public int hashCode() {
*/
@Override
public boolean equals(Object obj) {
if (!(obj instanceof Waypoint)) {
if (!(obj instanceof Waypoint waypoint)) {
return false;
}

Waypoint waypoint = (Waypoint) obj;
return this.ownerId.equals(waypoint.getOwnerId())
&& id.equals(waypoint.getId())
&& location.equals(waypoint.getLocation())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import io.github.thebusybiscuit.slimefun4.implementation.tasks.armor.SlimefunArmorTask;
import java.util.Optional;
import javax.annotation.Nullable;

import lombok.Getter;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
Expand All @@ -26,6 +28,7 @@
public final class HashedArmorpiece {

private int hash;
@Getter
private Optional<SlimefunArmorPiece> item;

/**
Expand Down Expand Up @@ -84,16 +87,6 @@ public boolean hasDiverged(@Nullable ItemStack stack) {
}
}

/**
* Returns the {@link SlimefunArmorPiece} that corresponds to this {@link HashedArmorpiece},
* or an empty {@link Optional}
*
* @return An {@link Optional} describing the result
*/
public Optional<SlimefunArmorPiece> getItem() {
return item;
}

@Override
public String toString() {
return "HashedArmorpiece {hash="
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import java.util.List;
import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;

import lombok.Getter;
import org.apache.commons.lang.Validate;
import org.bukkit.ChatColor;
import org.bukkit.Keyed;
Expand All @@ -36,10 +38,13 @@ public class ItemGroup implements Keyed {

private SlimefunAddon addon;

@Getter
protected final List<SlimefunItem> items = new ArrayList<>();
protected final NamespacedKey key;
protected final ItemStack item;
@Getter
protected int tier;
@Getter
protected boolean crossAddonItemGroup = false;

/**
Expand Down Expand Up @@ -123,16 +128,6 @@ public boolean isRegistered() {
return this.addon != null && Slimefun.getRegistry().getAllItemGroups().contains(this);
}

/**
* Returns the tier of this {@link ItemGroup}.
* The tier determines the position of this {@link ItemGroup} in the {@link SlimefunGuide}.
*
* @return the tier of this {@link ItemGroup}
*/
public int getTier() {
return tier;
}

/**
* This sets the tier of this {@link ItemGroup}.
* The tier determines the position of this {@link ItemGroup} in the {@link SlimefunGuide}.
Expand All @@ -154,7 +149,7 @@ public void setTier(int tier) {
*/
private void sortCategoriesByTier() {
List<ItemGroup> categories = Slimefun.getRegistry().getAllItemGroups();
Collections.sort(categories, Comparator.comparingInt(ItemGroup::getTier));
categories.sort(Comparator.comparingInt(ItemGroup::getTier));
}

/**
Expand Down Expand Up @@ -265,15 +260,6 @@ public String getDisplayName(Player p) {
}
}

/**
* Returns all instances of {@link SlimefunItem} bound to this {@link ItemGroup}.
*
* @return the list of SlimefunItems bound to this {@link ItemGroup}
*/
public List<SlimefunItem> getItems() {
return items;
}

/**
* This method returns whether a given {@link SlimefunItem} exists in this {@link ItemGroup}.
*
Expand Down Expand Up @@ -332,16 +318,6 @@ public boolean isVisible(Player p) {
return false;
}

/**
* Returns if items from other addons are allowed to be
* added to this {@link ItemGroup}.
*
* @return true if items from other addons are allowed to be added to this {@link ItemGroup}.
*/
public boolean isCrossAddonItemGroup() {
return crossAddonItemGroup;
}

/**
* This method will set if this {@link ItemGroup} will
* allow {@link SlimefunItem}s from other addons to
Expand Down
Loading

0 comments on commit b9fd62a

Please sign in to comment.