Skip to content

Commit

Permalink
Merge pull request #124 from Efnilite/dev
Browse files Browse the repository at this point in the history
Merge 5.2.4
  • Loading branch information
Efnilite committed May 16, 2024
2 parents 0768c65 + 57cb387 commit b720392
Show file tree
Hide file tree
Showing 18 changed files with 52 additions and 79 deletions.
7 changes: 2 additions & 5 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
**[Infinite Elytra Parkour](https://www.spigotmc.org/resources/115322/) | [Infinite Parkour+](https://www.spigotmc.org/resources/105019/)**

- Fixed <1.20.4 versions causing an error on load
- Fixed <1.19.4 versions causing an error on block generation
- Fixed trying to set previous health causing an error
- Fixed sometimes being able to spectate empty lobbies
- Fixed invalid schematic data causing an error
- Fixed first release of major versions not working
- Fixed spectator permission not working with /ip join
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>dev.efnilite</groupId>
<artifactId>IP</artifactId>
<version>5.2.3</version>
<version>5.2.4</version>

<properties>
<maven.compiler.source>17</maven.compiler.source>
Expand Down Expand Up @@ -102,7 +102,7 @@
<dependency>
<groupId>com.github.Efnilite</groupId>
<artifactId>vilib</artifactId>
<version>d262093968</version>
<version>e0352344d6</version>
<scope>compile</scope>
</dependency>

Expand Down
69 changes: 35 additions & 34 deletions src/main/java/dev/efnilite/ip/IP.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import dev.efnilite.vilib.bstats.charts.SingleLineChart;
import dev.efnilite.vilib.inventory.Menu;
import dev.efnilite.vilib.util.Logging;
import dev.efnilite.vilib.util.UpdateChecker;
import org.jetbrains.annotations.Nullable;

import java.io.File;
Expand All @@ -40,6 +41,39 @@ public final class IP extends ViPlugin {
@Nullable
private static PAPIHook placeholderHook;

public static void log(String message) {
if (Config.CONFIG.getBoolean("debug")) {
logging.info("[Debug] " + message);
}
}

/**
* @param child The file name.
* @return A file from within the plugin folder.
*/
public static File getInFolder(String child) {
return new File(instance.getDataFolder(), child);
}

/**
* @return This plugin's {@link Logging} instance.
*/
public static Logging logging() {
return logging;
}

/**
* @return The plugin instance.
*/
public static IP getPlugin() {
return instance;
}

@Nullable
public static PAPIHook getPlaceholderHook() {
return placeholderHook;
}

@Override
public void onLoad() {
instance = this;
Expand Down Expand Up @@ -101,7 +135,7 @@ public void enable() {
return joins;
}));

logging.info("Loaded IP!");
UpdateChecker.check(this, 87226);
}

@Override
Expand All @@ -120,37 +154,4 @@ public void disable() {

}
}

public static void log(String message) {
if (Config.CONFIG.getBoolean("debug")) {
logging.info("[Debug] " + message);
}
}

/**
* @param child The file name.
* @return A file from within the plugin folder.
*/
public static File getInFolder(String child) {
return new File(instance.getDataFolder(), child);
}

/**
* @return This plugin's {@link Logging} instance.
*/
public static Logging logging() {
return logging;
}

/**
* @return The plugin instance.
*/
public static IP getPlugin() {
return instance;
}

@Nullable
public static PAPIHook getPlaceholderHook() {
return placeholderHook;
}
}
6 changes: 1 addition & 5 deletions src/main/java/dev/efnilite/ip/menu/MainMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import dev.efnilite.ip.player.ParkourPlayer;
import dev.efnilite.ip.player.ParkourUser;
import dev.efnilite.vilib.inventory.Menu;
import dev.efnilite.vilib.inventory.animation.RandomAnimation;
import org.bukkit.Material;
import org.bukkit.entity.Player;

public class MainMenu extends DynamicMenu {
Expand All @@ -21,8 +19,6 @@ public MainMenu() {

public void open(Player player) {
display(player, new Menu(3, Locales.getString(player, "main.name"))
.distributeRowsEvenly()
.fillBackground(ParkourUser.isBedrockPlayer(player) ? Material.AIR : Material.WHITE_STAINED_GLASS_PANE)
.animation(new RandomAnimation()));
.distributeRowsEvenly());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
import dev.efnilite.ip.menu.DynamicMenu;
import dev.efnilite.ip.menu.Menus;
import dev.efnilite.ip.menu.ParkourOption;
import dev.efnilite.ip.player.ParkourUser;
import dev.efnilite.vilib.inventory.Menu;
import dev.efnilite.vilib.inventory.animation.WaveWestAnimation;
import org.bukkit.Material;
import org.bukkit.entity.Player;

/**
Expand All @@ -22,8 +19,6 @@ public CommunityMenu() {

public void open(Player player) {
display(player, new Menu(3, Locales.getString(player, "community.name"))
.distributeRowsEvenly()
.animation(new WaveWestAnimation())
.fillBackground(ParkourUser.isBedrockPlayer(player) ? Material.AIR : Material.LIGHT_GRAY_STAINED_GLASS_PANE));
.distributeRowsEvenly());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public void open(Player player) {
.nextPage(26, new Item(Material.LIME_DYE, "<#0DCB07><bold>»").click(event -> menu.page(1)))
.prevPage(18, new Item(Material.RED_DYE, "<#DE1F1F><bold>«").click(event -> menu.page(-1)))
.item(22, Locales.getItem(player, "other.close").click(event -> Menus.COMMUNITY.open(event.getPlayer())))
.fillBackground(ParkourUser.isBedrockPlayer(player) ? Material.AIR : Material.WHITE_STAINED_GLASS_PANE)
.open(player);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ public void open(Player player, Mode mode, Sort sort) {

Menus.LEADERBOARDS.open(event.getPlayer());
}))
.fillBackground(ParkourUser.isBedrockPlayer(player) ? Material.AIR : Material.GRAY_STAINED_GLASS_PANE)
.open(player);
}

Expand Down
4 changes: 0 additions & 4 deletions src/main/java/dev/efnilite/ip/menu/lobby/LobbyMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
import dev.efnilite.ip.player.ParkourUser;
import dev.efnilite.ip.session.Session;
import dev.efnilite.vilib.inventory.Menu;
import dev.efnilite.vilib.inventory.animation.SplitMiddleInAnimation;
import dev.efnilite.vilib.inventory.item.SliderItem;
import org.bukkit.Material;
import org.bukkit.entity.Player;

import java.util.List;
Expand Down Expand Up @@ -76,8 +74,6 @@ public LobbyMenu() {
*/
public void open(Player player) {
display(player, new Menu(3, Locales.getString(player, "lobby.name"))
.fillBackground(ParkourUser.isBedrockPlayer(player) ? Material.AIR : Material.WHITE_STAINED_GLASS_PANE)
.animation(new SplitMiddleInAnimation())
.distributeRowsEvenly());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public void open(Player p) {
.prevPage(18, new Item(Material.RED_DYE, "<#DE1F1F><bold>«").click(event -> menu.page(-1)))
.nextPage(26, new Item(Material.LIME_DYE, "<#0DCB07><bold>»").click(event -> menu.page(1)))
.item(22, Locales.getItem(viewer.locale, "other.close").click(event -> Menus.LOBBY.open(event.getPlayer())))
.fillBackground(ParkourUser.isBedrockPlayer(p) ? Material.AIR : Material.LIGHT_GRAY_STAINED_GLASS_PANE)
.open(p);
}

Expand Down
5 changes: 0 additions & 5 deletions src/main/java/dev/efnilite/ip/menu/play/PlayMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@
import dev.efnilite.ip.menu.DynamicMenu;
import dev.efnilite.ip.menu.Menus;
import dev.efnilite.ip.menu.ParkourOption;
import dev.efnilite.ip.player.ParkourUser;
import dev.efnilite.vilib.inventory.Menu;
import dev.efnilite.vilib.inventory.animation.RandomAnimation;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;

/**
Expand Down Expand Up @@ -36,8 +33,6 @@ public PlayMenu() {

public void open(Player player) {
display(player, new Menu(3, Locales.getString(player, "play.name"))
.fillBackground(ParkourUser.isBedrockPlayer(player) ? Material.AIR : Material.GRAY_STAINED_GLASS_PANE)
.animation(new RandomAnimation())
.distributeRowsEvenly());
}
}
1 change: 0 additions & 1 deletion src/main/java/dev/efnilite/ip/menu/play/SingleMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ public void open(Player player) {
.nextPage(26, new Item(Material.LIME_DYE, "<#0DCB07><bold>»").click(event -> mode.page(1)))
.prevPage(18, new Item(Material.RED_DYE, "<#DE1F1F><bold>«").click(event -> mode.page(-1)))
.item(22, Locales.getItem(player, "other.close").click(event -> Menus.PLAY.open(event.getPlayer())))
.fillBackground(ParkourUser.isBedrockPlayer(player) ? Material.AIR : Material.GRAY_STAINED_GLASS_PANE)
.open(player);
}

Expand Down
1 change: 0 additions & 1 deletion src/main/java/dev/efnilite/ip/menu/play/SpectatorMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ public void open(Player player) {
.nextPage(26, new Item(Material.LIME_DYE, "<#0DCB07><bold>»").click(event -> spectator.page(1)))
.prevPage(18, new Item(Material.RED_DYE, "<#DE1F1F><bold>«").click(event -> spectator.page(-1)))
.item(22, Locales.getItem(player, "other.close").click(event -> Menus.PLAY.open(event.getPlayer())))
.fillBackground(ParkourUser.isBedrockPlayer(player) ? Material.AIR : Material.GRAY_STAINED_GLASS_PANE)
.open(player);

}
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/dev/efnilite/ip/menu/settings/LangMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import dev.efnilite.ip.config.Locales;
import dev.efnilite.ip.menu.Menus;
import dev.efnilite.ip.player.ParkourPlayer;
import dev.efnilite.ip.player.ParkourUser;
import dev.efnilite.vilib.inventory.PagedMenu;
import dev.efnilite.vilib.inventory.item.Item;
import dev.efnilite.vilib.inventory.item.MenuItem;
Expand Down Expand Up @@ -41,7 +40,6 @@ public void open(ParkourPlayer user) {
.nextPage(26, new Item(Material.LIME_DYE, "<#0DCB07><bold>»").click(event -> style.page(1)))
.prevPage(18, new Item(Material.RED_DYE, "<#DE1F1F><bold>«").click(event -> style.page(-1)))
.item(22, Locales.getItem(user.locale, "other.close").click(event -> Menus.SETTINGS.open(event.getPlayer())))
.fillBackground(ParkourUser.isBedrockPlayer(user.player) ? Material.AIR : Material.LIGHT_BLUE_STAINED_GLASS_PANE)
.open(user.player);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,7 @@ public ParkourSettingsMenu(ParkourOption... disabled) {
public void open(ParkourPlayer user) {
display(user.player, new Menu(4, Locales.getString(user.locale, "settings.name"))
.distributeRowEvenly(0, 1, 2, 3)
.item(27, Locales.getItem(user.locale, "other.close").click(event -> Menus.SETTINGS.open(event.getPlayer())))
.fillBackground(ParkourUser.isBedrockPlayer(user.player) ? Material.AIR : Material.GRAY_STAINED_GLASS_PANE));
.item(27, Locales.getItem(user.locale, "other.close").click(event -> Menus.SETTINGS.open(event.getPlayer()))));
}

/**
Expand Down Expand Up @@ -313,7 +312,7 @@ public void openStyleMenu(ParkourPlayer player) {
.nextPage(26, new Item(Material.LIME_DYE, "<#0DCB07><bold>»").click(event -> menu.page(1)))
.prevPage(18, new Item(Material.RED_DYE, "<#DE1F1F><bold>«").click(event -> menu.page(-1)))
.item(22, Locales.getItem(player.locale, "other.close").click(event -> open(player)))
.fillBackground(ParkourUser.isBedrockPlayer(player.player) ? Material.AIR : Material.GRAY_STAINED_GLASS_PANE).open(player.player);
.open(player.player);
}

private boolean handleSettingChange(ParkourPlayer player, Runnable onAllowed) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
import dev.efnilite.ip.player.ParkourUser;
import dev.efnilite.ip.session.Session;
import dev.efnilite.vilib.inventory.Menu;
import dev.efnilite.vilib.inventory.animation.SplitMiddleOutAnimation;
import dev.efnilite.vilib.inventory.item.SliderItem;
import org.bukkit.Material;
import org.bukkit.entity.Player;

import java.util.List;
Expand Down Expand Up @@ -72,9 +70,6 @@ public SettingsMenu() {
}

public void open(Player player) {
display(player, new Menu(3, Locales.getString(player, "settings.name"))
.fillBackground(ParkourUser.isBedrockPlayer(player) ? Material.AIR : Material.GRAY_STAINED_GLASS_PANE)
.animation(new SplitMiddleOutAnimation())
.distributeRowsEvenly());
display(player, new Menu(3, Locales.getString(player, "settings.name")).distributeRowsEvenly());
}
}
6 changes: 6 additions & 0 deletions src/main/java/dev/efnilite/ip/mode/SpectatorMode.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package dev.efnilite.ip.mode;

import dev.efnilite.ip.config.Config;
import dev.efnilite.ip.config.Locales;
import dev.efnilite.ip.leaderboard.Leaderboard;
import dev.efnilite.ip.menu.Menus;
import dev.efnilite.ip.menu.ParkourOption;
import dev.efnilite.ip.player.ParkourSpectator;
import dev.efnilite.ip.player.ParkourUser;
import dev.efnilite.ip.session.Session;
Expand Down Expand Up @@ -41,6 +43,10 @@ public void create(Player player, Session session) {
player.sendMessage(Strings.colour("<red><bold>Joining is currently disabled."));
return;
}
if (!ParkourOption.SPECTATOR.mayPerform(player)) {
player.sendMessage(Locales.getString(player, "other.no_do"));
return;
}

ParkourUser user = ParkourUser.getUser(player);
ParkourSpectator spectator;
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ options:

# -= Permissions options =-
# These permissions are used to determine which things the player can change.
# Find them at at https://efnilite.github.io/efnilite.dev/wiki/witp
# Find them at https://efnilite.dev/projects/ip/wiki
permissions:

# -= Permissions enabled =-
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: 'IP'
description: 'Infinitely automatically generating parkour plugin.'
author: Efnilite
version: 5.2.3
version: 5.2.4
api-version: 1.16
main: dev.efnilite.ip.IP
softdepend: [floodgate, Vault, PlaceholderAPI, Multiverse-Core, VoidGen]
Expand Down

0 comments on commit b720392

Please sign in to comment.