mirror of
				https://github.com/IntellectualSites/PlotSquared.git
				synced 2025-11-04 03:03:43 +01:00 
			
		
		
		
	Fixes #518
This commit is contained in:
		@@ -39,6 +39,7 @@ import com.intellectualcrafters.plot.object.PlotInventory;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotItemStack;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import com.intellectualcrafters.plot.object.Rating;
 | 
			
		||||
import com.intellectualcrafters.plot.util.EventUtil;
 | 
			
		||||
import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
import com.intellectualcrafters.plot.util.MathMan;
 | 
			
		||||
import com.intellectualcrafters.plot.util.TaskManager;
 | 
			
		||||
@@ -121,14 +122,9 @@ public class Rate extends SubCommand {
 | 
			
		||||
                        index.increment();
 | 
			
		||||
                        if (index.intValue() >= Settings.RATING_CATEGORIES.size()) {
 | 
			
		||||
                            close();
 | 
			
		||||
                            // handle ratings
 | 
			
		||||
                            int rV = rating.intValue();
 | 
			
		||||
                            // CALL THE EVENT
 | 
			
		||||
                            PlotRateEvent rateEvent = new PlotRateEvent(player, new Rating(rV), plot);
 | 
			
		||||
                            Bukkit.getPluginManager().callEvent(rateEvent);
 | 
			
		||||
                            // DONE CALLING THE EVENT
 | 
			
		||||
                            // set rating
 | 
			
		||||
                            plot.getSettings().ratings.put(player.getUUID(), rateEvent.getRating().getAggregate());
 | 
			
		||||
                            Rating result = EventUtil.manager.callRating(player, plot, new Rating(rV));
 | 
			
		||||
                            plot.getSettings().ratings.put(player.getUUID(), result.getAggregate());
 | 
			
		||||
                            DBFunc.setRating(plot, player.getUUID(), rV);
 | 
			
		||||
                            sendMessage(player, C.RATING_APPLIED, plot.getId().toString());
 | 
			
		||||
                            sendMessage(player, C.RATING_APPLIED, plot.getId().toString());
 | 
			
		||||
@@ -192,8 +188,10 @@ public class Rate extends SubCommand {
 | 
			
		||||
                    sendMessage(player, C.RATING_ALREADY_EXISTS, plot.getId().toString());
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                plot.getSettings().ratings.put(uuid, rating);
 | 
			
		||||
                DBFunc.setRating(plot, uuid, rating);
 | 
			
		||||
                Rating result = EventUtil.manager.callRating(player, plot, new Rating(rating));
 | 
			
		||||
                int resultVal = result.getAggregate();
 | 
			
		||||
                plot.getSettings().ratings.put(uuid, resultVal);
 | 
			
		||||
                DBFunc.setRating(plot, uuid, resultVal);
 | 
			
		||||
                sendMessage(player, C.RATING_APPLIED, plot.getId().toString());
 | 
			
		||||
            }
 | 
			
		||||
        };
 | 
			
		||||
 
 | 
			
		||||
@@ -14,6 +14,7 @@ import com.intellectualcrafters.plot.object.PlotBlock;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotCluster;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotId;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import com.intellectualcrafters.plot.object.Rating;
 | 
			
		||||
import com.plotsquared.bukkit.listeners.PlayerBlockEventType;
 | 
			
		||||
 | 
			
		||||
public abstract class EventUtil {
 | 
			
		||||
@@ -29,6 +30,8 @@ public abstract class EventUtil {
 | 
			
		||||
        PS.get().IMP.unregister(player);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public abstract Rating callRating(final PlotPlayer player, final Plot plot, final Rating rating);
 | 
			
		||||
    
 | 
			
		||||
    public abstract boolean callClaim(final PlotPlayer player, final Plot plot, final boolean auto);
 | 
			
		||||
    
 | 
			
		||||
    public abstract boolean callTeleport(final PlotPlayer player, Location from, final Plot plot);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user