mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-29 20:24:43 +02:00
Fixes #430
This commit is contained in:
@ -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