mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-12 10:24:07 +01:00
resolves #100
This commit is contained in:
parent
59541f78da
commit
e50097a5da
@ -46,6 +46,7 @@ import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.events.PlayerEnterPlotEvent;
|
||||
import com.intellectualcrafters.plot.events.PlayerLeavePlotEvent;
|
||||
@ -186,16 +187,19 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
}
|
||||
if (booleanFlag(plot, "notify-enter", false)) {
|
||||
if (plot.hasOwner()) {
|
||||
|
||||
final Player player = UUIDHandler.uuidWrapper.getPlayer(plot.getOwner());
|
||||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
if (UUIDHandler.getUUID(player).equals(UUIDHandler.getUUID(event.getPlayer()))) {
|
||||
Player trespasser = event.getPlayer();
|
||||
if (UUIDHandler.getUUID(player).equals(UUIDHandler.getUUID(trespasser))) {
|
||||
return;
|
||||
}
|
||||
if (PlotMain.hasPermission(trespasser, "plots.flag.notify-enter.bypass")) {
|
||||
return;
|
||||
}
|
||||
if (player.isOnline()) {
|
||||
PlayerFunctions.sendMessage(player, C.NOTIFY_ENTER.s().replace("%player", event.getPlayer().getName()).replace("%plot", plot.getId().toString()));
|
||||
PlayerFunctions.sendMessage(player, C.NOTIFY_ENTER.s().replace("%player", trespasser.getName()).replace("%plot", plot.getId().toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -230,11 +234,15 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
if (UUIDHandler.getUUID(player).equals(UUIDHandler.getUUID(event.getPlayer()))) {
|
||||
Player trespasser = event.getPlayer();
|
||||
if (UUIDHandler.getUUID(player).equals(UUIDHandler.getUUID(trespasser))) {
|
||||
return;
|
||||
}
|
||||
if (PlotMain.hasPermission(trespasser, "plots.flag.notify-enter.bypass")) {
|
||||
return;
|
||||
}
|
||||
if (player.isOnline()) {
|
||||
PlayerFunctions.sendMessage(player, C.NOTIFY_LEAVE.s().replace("%player", event.getPlayer().getName()).replace("%plot", plot.getId().toString()));
|
||||
PlayerFunctions.sendMessage(player, C.NOTIFY_LEAVE.s().replace("%player", trespasser.getName()).replace("%plot", plot.getId().toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user