Skip to content

Commit

Permalink
General Code Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmadk953 committed Jun 15, 2024
1 parent 68a5944 commit a38f5b5
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=ahmadk953_Poixpixel-Custom
- name: Generate JavaDoc
run: mvn -B javadoc:javadoc
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,8 @@ Simply just drag the plugin file over to the plugin folder of your server
## Documentation

Check out the [project wiki](https://github.com/ahmadk953/Poixpixel-Custom/wiki) for documentation.

## Current Bugs

- Laser Pointer does not work
- Explosion Power Config Value does Not Work
4 changes: 4 additions & 0 deletions src/main/java/com/poixpixelcustom/constants/Keys.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@

public class Keys {

private Keys() {
throw new IllegalStateException("Utility class");
}

public static final NamespacedKey CUSTOM_ENTITY = new NamespacedKey(PoixpixelCustom.getInstance(), "CustomEntity");
public static final NamespacedKey CUSTOM_BUCKET = new NamespacedKey(PoixpixelCustom.getInstance(), "CustomBucket");
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
Expand Down Expand Up @@ -41,7 +40,7 @@ public void onClick(final PlayerInteractEvent event) {
return;
}

if (hand.hasItemMeta() && hand.getItemMeta().getDisplayName().equals(ChatColor.WHITE + "Laser Pointer")) {
if (hand.hasItemMeta() && hand.getItemMeta().displayName().equals(NamedTextColor.WHITE + "Laser Pointer")) {
RayTraceResult result = player.rayTraceBlocks(distance);

if (result != null && result.getHitBlock() != null && result.getHitBlock().isSolid())
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/poixpixelcustom/tasks/Board.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ private void updateScoreboard(Player player) {
Scoreboard scoreboard = player.getScoreboard();
Team team = scoreboard.getTeam("walk_distance");

assert team != null;
team.suffix(Component.text((player.getStatistic(Statistic.WALK_ONE_CM) + player.getStatistic(Statistic.SPRINT_ONE_CM)) + "cm").color(NamedTextColor.YELLOW));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public void run() {
double particleDistance = 0.5;

for (Player online : Bukkit.getOnlinePlayers()) {
ItemStack hand = online.getItemInHand();
ItemStack hand = online.getInventory().getItemInMainHand();

if (hand.hasItemMeta() && hand.getItemMeta().displayName().equals(Component.text("Laser Pointer").color(NamedTextColor.WHITE))) {
Location location = online.getLocation().add(0, 1, 0);
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/com/poixpixelcustom/utils/CustomRecipes.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,20 @@

public final class CustomRecipes {

private CustomRecipes() {
throw new IllegalStateException("Utility class");
}

/**
* Registers custom recipes for the game.
*
* This function creates and adds custom recipes to the game's recipe manager.
* It creates a recipe for "Super Paper" using the ShapelessRecipe class,
* and a recipe for "Super Sword" using the FurnaceRecipe class.
* It also creates a recipe for "Laser Pointer" using the ShapedRecipe class.
* The recipes are added to the Bukkit recipe manager using the addRecipe method.
*
*/
public static void register() {
ItemStack superPaper = new ItemStack(org.bukkit.Material.PAPER);
ItemMeta superPaperMeta = superPaper.getItemMeta();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ public class ExceptionHandeler {
private static final Logger log = Logger.getLogger("Minecraft");
private static final Plugin plugin = PoixpixelCustom.getInstance();

private ExceptionHandeler() {
throw new IllegalStateException("Utility class");
}

/**
* Handles an exception, logging an error message and potentially disabling a plugin.
*
Expand Down

0 comments on commit a38f5b5

Please sign in to comment.