mirror of
				https://github.com/IntellectualSites/PlotSquared.git
				synced 2025-11-04 03:03:43 +01:00 
			
		
		
		
	Fixes #430
This commit is contained in:
		@@ -84,9 +84,6 @@ public class Deny extends SubCommand {
 | 
			
		||||
        plot.addDenied(uuid);
 | 
			
		||||
        EventUtil.manager.callDenied(plr, plot, uuid, true);
 | 
			
		||||
        MainUtil.sendMessage(plr, C.DENIED_ADDED);
 | 
			
		||||
        // if (!uuid.equals(DBFunc.everyone)) {
 | 
			
		||||
        //    PS.get().IMP.handleKick(uuid, C.YOU_GOT_DENIED);
 | 
			
		||||
        //}
 | 
			
		||||
        if (!uuid.equals(DBFunc.everyone)) {
 | 
			
		||||
            handleKick(uuid, plot);
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -130,7 +130,6 @@ public class FlagCmd extends SubCommand {
 | 
			
		||||
                    return false;
 | 
			
		||||
                }
 | 
			
		||||
                MainUtil.sendMessage(player, C.FLAG_ADDED);
 | 
			
		||||
                APlotListener.manager.plotEntry(player, plot);
 | 
			
		||||
                return true;
 | 
			
		||||
            }
 | 
			
		||||
            case "remove": {
 | 
			
		||||
@@ -168,7 +167,6 @@ public class FlagCmd extends SubCommand {
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                MainUtil.sendMessage(player, C.FLAG_REMOVED);
 | 
			
		||||
                APlotListener.manager.plotEntry(player, plot);
 | 
			
		||||
                return true;
 | 
			
		||||
            }
 | 
			
		||||
            case "add": {
 | 
			
		||||
@@ -208,7 +206,6 @@ public class FlagCmd extends SubCommand {
 | 
			
		||||
                }
 | 
			
		||||
                DBFunc.setFlags(plot, plot.settings.flags.values());
 | 
			
		||||
                MainUtil.sendMessage(player, C.FLAG_ADDED);
 | 
			
		||||
                APlotListener.manager.plotEntry(player, plot);
 | 
			
		||||
                return true;
 | 
			
		||||
            }
 | 
			
		||||
            case "list": {
 | 
			
		||||
 
 | 
			
		||||
@@ -60,13 +60,6 @@ PlotInventory inv = new PlotInventory(player, 2, "Plot Jukebox") {
 | 
			
		||||
        else {
 | 
			
		||||
            FlagManager.addPlotFlag(plot, new Flag(FlagManager.getFlag("music"), id));
 | 
			
		||||
        }
 | 
			
		||||
        TaskManager.runTaskLater(new Runnable() {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void run() {
 | 
			
		||||
                 PlotListener.manager.plotEntry(player, plot);                        
 | 
			
		||||
            }
 | 
			
		||||
        }, 1);
 | 
			
		||||
        close();
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
@@ -31,6 +31,7 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotSettings;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotWorld;
 | 
			
		||||
import com.intellectualcrafters.plot.util.EventUtil;
 | 
			
		||||
import com.intellectualcrafters.plot.util.MainUtil;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Flag Manager Utility
 | 
			
		||||
@@ -203,6 +204,7 @@ public class FlagManager {
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        plot.settings.flags.put(flag.getKey(), flag);
 | 
			
		||||
        MainUtil.reEnterPlot(plot);
 | 
			
		||||
        DBFunc.setFlags(plot, plot.settings.flags.values());
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
@@ -267,6 +269,7 @@ public class FlagManager {
 | 
			
		||||
            plot.settings.flags.put(id, flag);
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        MainUtil.reEnterPlot(plot);
 | 
			
		||||
        DBFunc.setFlags(plot, plot.settings.flags.values());
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
@@ -298,6 +301,7 @@ public class FlagManager {
 | 
			
		||||
        else {
 | 
			
		||||
            plot.settings.flags.clear();
 | 
			
		||||
        }
 | 
			
		||||
        MainUtil.reEnterPlot(plot);
 | 
			
		||||
        DBFunc.setFlags(plot, plot.settings.flags.values());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -23,6 +23,7 @@ package com.intellectualcrafters.plot.util;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map.Entry;
 | 
			
		||||
import java.util.UUID;
 | 
			
		||||
 | 
			
		||||
@@ -30,6 +31,7 @@ import com.intellectualcrafters.plot.PS;
 | 
			
		||||
import com.intellectualcrafters.plot.config.C;
 | 
			
		||||
import com.intellectualcrafters.plot.config.Settings;
 | 
			
		||||
import com.intellectualcrafters.plot.database.DBFunc;
 | 
			
		||||
import com.intellectualcrafters.plot.listeners.PlotListener;
 | 
			
		||||
import com.intellectualcrafters.plot.object.BlockLoc;
 | 
			
		||||
import com.intellectualcrafters.plot.object.ChunkLoc;
 | 
			
		||||
import com.intellectualcrafters.plot.object.Location;
 | 
			
		||||
@@ -68,6 +70,28 @@ public class MainUtil {
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public static List<PlotPlayer> getPlayersInPlot(Plot plot) {
 | 
			
		||||
        ArrayList<PlotPlayer> players = new ArrayList<>();
 | 
			
		||||
        for (PlotPlayer pp : UUIDHandler.players.values()) {
 | 
			
		||||
            if (plot.equals(MainUtil.getPlot(pp.getLocation()))) {
 | 
			
		||||
                players.add(pp);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return players;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public static void reEnterPlot(final Plot plot) {
 | 
			
		||||
        TaskManager.runTaskLater(new Runnable() {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void run() {
 | 
			
		||||
                for (PlotPlayer pp : getPlayersInPlot(plot)) {
 | 
			
		||||
                    PlotListener.manager.plotExit(pp, plot);
 | 
			
		||||
                    PlotListener.manager.plotEntry(pp, plot);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }, 1);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public static Location getPlotCenter(Plot plot) {
 | 
			
		||||
        Location bot = getPlotBottomLoc(plot.world, plot.id);
 | 
			
		||||
        Location top = getPlotBottomLoc(plot.world, plot.id).add(1, 0, 1);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user