Skip to content

Commit

Permalink
allow reviewing of own plot when dev mode is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
LordTuxn committed Aug 13, 2022
1 parent 492064c commit ce23116
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@

package com.alpsbte.plotsystem.core.menus;

import com.alpsbte.plotsystem.PlotSystem;
import com.alpsbte.plotsystem.core.system.Builder;
import com.alpsbte.plotsystem.core.system.Country;
import com.alpsbte.plotsystem.core.system.plot.Plot;
import com.alpsbte.plotsystem.core.system.plot.PlotManager;
import com.alpsbte.plotsystem.utils.io.config.ConfigPaths;
import com.alpsbte.plotsystem.utils.io.language.LangPaths;
import com.alpsbte.plotsystem.utils.io.language.LangUtil;
import com.alpsbte.plotsystem.utils.items.builder.ItemBuilder;
Expand Down Expand Up @@ -116,7 +118,7 @@ protected void setPaginatedItemClickEventsAsync(List<?> source) {
getMenu().getSlot(i + 9).setClickHandler((player, info) -> {
try {
if (plot.getStatus() == Status.unreviewed) {
if (!plot.getPlotOwner().getUUID().toString().equals(getMenuPlayer().getUniqueId().toString())) {
if (!plot.getPlotOwner().getUUID().toString().equals(getMenuPlayer().getUniqueId().toString()) || PlotSystem.getPlugin().getConfigManager().getConfig().getBoolean(ConfigPaths.DEV_MODE)) {
Plot currentPlot = PlotManager.getCurrentPlot(Builder.byUUID(getMenuPlayer().getUniqueId()), Status.unreviewed);
if (currentPlot != null && currentPlot.getID() == plot.getID()) {
new ReviewPlotMenu(getMenuPlayer(), currentPlot);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,6 @@ public class ReviewPlotMenu extends AbstractMenu {
public ReviewPlotMenu(Player player, Plot plot) {
super(6, LangUtil.get(player, LangPaths.MenuTitle.REVIEW_PLOT, Integer.toString(plot.getID())), player);
this.plot = plot;

// Check if plot is from player
try {
if (plot.getPlotOwner().getUUID().equals(player.getUniqueId())){
player.sendMessage(Utils.getErrorMessageFormat(LangUtil.get(getMenuPlayer(), LangPaths.Message.Error.CANNOT_REVIEW_OWN_PLOT)));
}
} catch (SQLException ex) {
Bukkit.getLogger().log(Level.SEVERE, "A SQL error occurred!", ex);
}
}

@Override
Expand Down

0 comments on commit ce23116

Please sign in to comment.