Skip to content

Commit

Permalink
Version 2.4.0 Release Candidate 1
Browse files Browse the repository at this point in the history
Closes #1
  • Loading branch information
JustBru00 committed Jan 7, 2024
1 parent 76be2cd commit c3d41dc
Show file tree
Hide file tree
Showing 11 changed files with 56 additions and 29 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,5 @@ buildNumber.properties

# Common working directory
run/
/.classpath
/.project
3 changes: 3 additions & 0 deletions .settings/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/org.eclipse.core.resources.prefs
/org.eclipse.jdt.core.prefs
/org.eclipse.m2e.core.prefs
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
> [!IMPORTANT]
> pigstops
### PigStops

This plugin adds a simple inventory game to pit stops in [TimingSystem](https://github.com/Makkuusen/TimingSystem) races.

PigStops was created by @Pigalala. It is now maintained by @JustBru00 on this repository.
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>me.pigalala</groupId>
<artifactId>PigStops</artifactId>
<version>2.3.0</version>
<version>2.4.0-RC1</version>
<packaging>jar</packaging>

<name>PigStops</name>
Expand Down Expand Up @@ -83,13 +83,13 @@
<dependency>
<groupId>com.github.Makkuusen</groupId>
<artifactId>TimingSystem</artifactId>
<version>1.6</version>
<version>2.0.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.20-R0.1-SNAPSHOT</version>
<version>1.20.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/me/pigalala/pigstops/OinkCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import co.aikar.commands.InvalidCommandArgument;
import co.aikar.commands.annotation.*;
import co.aikar.commands.contexts.ContextResolver;
import me.makkuusen.timing.system.TPlayer;
import me.makkuusen.timing.system.api.TimingSystemAPI;
import me.makkuusen.timing.system.tplayer.TPlayer;
import me.pigalala.pigstops.pit.management.pitmodes.Pit;
import me.pigalala.pigstops.pit.management.*;
import org.bukkit.Material;
Expand Down Expand Up @@ -86,7 +86,7 @@ public static void togglePracticeMode(Player player) {
pp.practiceModeStart.setPitch(pp.getPlayer().getLocation().getPitch());
TPlayer tPlayer = TimingSystemAPI.getTPlayer(pp.getPlayer().getUniqueId());
if(!isInBoat(player)) {
Boat boat = spawnBoat(pp.practiceModeStart, tPlayer.getBoat(), tPlayer.isChestBoat());
Boat boat = spawnBoat(pp.practiceModeStart, tPlayer.getSettings().getBoat(), tPlayer.getSettings().isChestBoat());
boat.addPassenger(pp.getPlayer());
}
}
Expand Down
11 changes: 5 additions & 6 deletions src/main/java/me/pigalala/pigstops/OinkConfig.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package me.pigalala.pigstops;

import me.pigalala.pigstops.pit.management.PitGame;
import org.bukkit.Material;
import org.bukkit.configuration.file.FileConfiguration;
import static me.pigalala.pigstops.PigStops.defaultPitGame;

import java.io.File;
import java.util.Arrays;
import java.util.List;
import java.util.logging.Level;

import static me.pigalala.pigstops.PigStops.defaultPitGame;
import static me.pigalala.pigstops.PigStops.pitGames;
import org.bukkit.Material;
import org.bukkit.configuration.file.FileConfiguration;

import me.pigalala.pigstops.pit.management.PitGame;

public abstract class OinkConfig {

Expand Down
14 changes: 12 additions & 2 deletions src/main/java/me/pigalala/pigstops/OinkListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
import me.makkuusen.timing.system.api.TimingSystemAPI;
import me.pigalala.pigstops.pit.management.pitmodes.Pit;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.format.TextColor;

import java.util.logging.Level;

import org.bukkit.entity.Boat;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
Expand Down Expand Up @@ -46,8 +50,14 @@ public void onMove(PlayerMoveEvent e) {
} else {
if(pp.isInPracticeMode()) pp.togglePracticeMode();
}

if(driver.get().getHeat().isActive() && driver.get().getCurrentLap() != null && !driver.get().getCurrentLap().isPitted()) pp.newPit(Pit.Type.REAL);

// Prevent NullPointerException if no default pit game has been selected.
if (PigStops.defaultPitGame == null) {
PigStops.getPlugin().getLogger().log(Level.SEVERE, "The default pit game has not been set. PigStops will not work correctly until a default pit game is set.");
e.getPlayer().sendMessage(Component.text().append(Component.text("The PigStop did not work as the default pit game is not set. Please ask an administrator to set the default pit game.", NamedTextColor.RED)));
} else {
if(driver.get().getHeat().isActive() && driver.get().getCurrentLap() != null && !driver.get().getCurrentLap().isPitted()) pp.newPit(Pit.Type.REAL);
}
}

@EventHandler
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/me/pigalala/pigstops/OinkMessages.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package me.pigalala.pigstops;

import me.makkuusen.timing.system.TPlayer;
import me.makkuusen.timing.system.tplayer.TPlayer;
import me.pigalala.pigstops.pit.management.PitGame;
import me.pigalala.pigstops.pit.management.pitmodes.Pit;
import net.kyori.adventure.text.Component;
Expand Down Expand Up @@ -31,15 +31,15 @@ public static TextComponent getSoloFinishText(String time, int accuracy, int mis

public static TextComponent getRaceFinishText(TPlayer player, String pitName, int pit, String time, int accuracy, int misclicks, Pit.PitMode pm) {
return Component.text().content("").color(NamedTextColor.GREEN)
.append(Component.text("|| ", player.getTextColor(), TextDecoration.BOLD, TextDecoration.ITALIC))
.append(Component.text("|| ", player.getSettings().getTextColor(), TextDecoration.BOLD, TextDecoration.ITALIC))
.append(Component.text(player.getName(), NamedTextColor.WHITE))
.append(Component.text(" has completed PigStop "))
.append(Component.text(pit).color(NamedTextColor.GOLD))
.append(Component.text(" in "))
.append(Component.text(time).color(NamedTextColor.GOLD))
.hoverEvent(
Component.text().content("").color(TextColor.color(0xF38AFF))
.append(Component.text("|| ", player.getTextColor(), TextDecoration.BOLD, TextDecoration.ITALIC))
.append(Component.text("|| ", player.getSettings().getTextColor(), TextDecoration.BOLD, TextDecoration.ITALIC))
.append(Component.text(player.getName(), NamedTextColor.WHITE))
.appendNewline().append(Component.text("----------").color(NamedTextColor.GRAY))
.appendNewline().append(Component.text(pitName)).append(Component.text(".pigstop").color(NamedTextColor.GRAY))
Expand Down
18 changes: 13 additions & 5 deletions src/main/java/me/pigalala/pigstops/PigStops.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
package me.pigalala.pigstops;

import co.aikar.commands.PaperCommandManager;
import com.google.common.collect.ImmutableList;
import me.pigalala.pigstops.pit.management.PitGame;
import me.pigalala.pigstops.pit.management.pitmodes.Pit;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.logging.Level;

import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.*;
import com.google.common.collect.ImmutableList;

import co.aikar.commands.PaperCommandManager;
import me.pigalala.pigstops.pit.management.PitGame;
import me.pigalala.pigstops.pit.management.pitmodes.Pit;

public final class PigStops extends JavaPlugin {

Expand All @@ -27,6 +33,8 @@ public void onEnable() {
new OinkListener();
OinkConfig.onStartup();
setupCommands();
getLogger().log(Level.INFO, "Enabled PigStops v" + getPluginMeta().getVersion() + " created by Pigalala.");
getLogger().log(Level.INFO, "PigStops is now maintained by JustBru00. For bug reports and the latest releases, please check out the GitHub page at: https://github.com/JustBru00/PigStops");
}

private void setupCommands() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import co.aikar.commands.BukkitCommandExecutionContext;
import co.aikar.commands.InvalidCommandArgument;
import co.aikar.commands.contexts.ContextResolver;
import me.makkuusen.timing.system.TPlayer;
import me.makkuusen.timing.system.api.TimingSystemAPI;
import me.makkuusen.timing.system.event.EventDatabase;
import me.makkuusen.timing.system.database.EventDatabase;
import me.makkuusen.timing.system.heat.Heat;
import me.makkuusen.timing.system.participant.Driver;
import me.makkuusen.timing.system.tplayer.TPlayer;
import me.pigalala.pigstops.OinkMessages;
import me.pigalala.pigstops.PigStops;
import me.pigalala.pigstops.PitPlayer;
Expand Down Expand Up @@ -131,7 +131,8 @@ private void registerSpectators() {
spectators.forEach(p -> p.pit = this);
}

private void setItemMetas() {
@SuppressWarnings("deprecation")
private void setItemMetas() {
ItemMeta backgroundMeta = defaultBackground.getItemMeta();
backgroundMeta.setDisplayName(" ");
defaultBackground.setItemMeta(backgroundMeta);
Expand Down Expand Up @@ -170,7 +171,8 @@ public void finishPit() {
}
}

@EventHandler
@SuppressWarnings("deprecation")
@EventHandler
public void itemClickedEvent(InventoryClickEvent e) {
if(e.getWhoClicked() != pp.getPlayer() || !e.getView().getTitle().startsWith("§dPigStops")) return;
e.setCancelled(true);
Expand Down Expand Up @@ -223,7 +225,7 @@ private void end() {
if(pp.getPlayer().getVehicle() instanceof Boat b) b.remove();
pp.practiceModeStart.setPitch(pp.getPlayer().getLocation().getPitch());
TPlayer tPlayer = TimingSystemAPI.getTPlayer(pp.getPlayer().getUniqueId());
Boat boat = spawnBoat(pp.practiceModeStart, tPlayer.getBoat(), tPlayer.isChestBoat());
Boat boat = spawnBoat(pp.practiceModeStart, tPlayer.getSettings().getBoat(), tPlayer.getSettings().isChestBoat());
boat.addPassenger(pp.getPlayer());
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: '${project.version}'
main: me.pigalala.pigstops.PigStops
api-version: '1.20'
prefix: PigStops
authors: [ Pigalala ]
authors: [Pigalala, JustBru00]
depend: [ TimingSystem ]

commands:
Expand Down

0 comments on commit c3d41dc

Please sign in to comment.