mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
Fix forcefield flag
This commit is contained in:
parent
85055320c2
commit
9ae4f02205
@ -5,15 +5,14 @@ import com.intellectualcrafters.plot.flag.Flags;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.plotsquared.bukkit.events.PlayerEnterPlotEvent;
|
||||
import com.plotsquared.bukkit.object.BukkitPlayer;
|
||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
@ -53,7 +52,7 @@ public class ForceFieldListener implements Listener {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Vector calculateVelocity(PlotPlayer pp, PlotPlayer e) {
|
||||
private Vector calculateVelocity(PlotPlayer pp, PlotPlayer e) {
|
||||
Location playerLocation = pp.getLocationFull();
|
||||
Location oPlayerLocation = e.getLocation();
|
||||
double playerX = playerLocation.getX();
|
||||
@ -84,16 +83,15 @@ public class ForceFieldListener implements Listener {
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlotEntry(PlayerEnterPlotEvent event) {
|
||||
public void onPlotEntry(PlayerMoveEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
Plot plot = event.getPlot();
|
||||
Plot plot = pp.getCurrentPlot();
|
||||
if (plot == null) {
|
||||
return;
|
||||
}
|
||||
Optional<Boolean> forcefield = plot.getFlag(Flags.FORCEFIELD);
|
||||
if (forcefield.isPresent() && forcefield.get()) {
|
||||
if (!plot.getFlag(Flags.FORCEFIELD).or(false)) {
|
||||
UUID uuid = pp.getUUID();
|
||||
if (plot.isAdded(uuid)) {
|
||||
Set<PlotPlayer> players = getNearbyPlayers(player, plot);
|
||||
@ -110,4 +108,3 @@ public class ForceFieldListener implements Listener {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user