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