Fix plot entry/leave for sponge.

This commit is contained in:
boy0001 2015-09-06 11:53:56 +10:00
parent ea146dcf91
commit 2b3b947143
20 changed files with 102 additions and 95 deletions

View File

@ -146,11 +146,13 @@
<artifactId>javax.websocket-api</artifactId> <artifactId>javax.websocket-api</artifactId>
<version>1.1</version> <version>1.1</version>
</dependency> </dependency>
<!--
<dependency> <dependency>
<groupId>org.spongepowered</groupId> <groupId>org.spongepowered</groupId>
<artifactId>spongeapi</artifactId> <artifactId>spongeapi</artifactId>
<version>2.1-SNAPSHOT</version> <version>2.1-SNAPSHOT</version>
</dependency> </dependency>
-->
<dependency> <dependency>
<groupId>org.bukkit</groupId> <groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId> <artifactId>bukkit</artifactId>

View File

@ -171,10 +171,6 @@ public class PlotPlusListener extends PlotListener implements Listener {
public void onPlotEnter(final PlayerEnterPlotEvent event) { public void onPlotEnter(final PlayerEnterPlotEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
final Plot plot = event.getPlot(); final Plot plot = event.getPlot();
Flag greeting = FlagManager.getPlotFlag(plot, "greeting");
if (greeting != null) {
event.getPlayer().sendMessage(ChatColor.translateAlternateColorCodes('&', C.PREFIX_GREETING.s().replaceAll("%id%", plot.id + "") + greeting.getValueString()));
}
Flag feed = FlagManager.getPlotFlag(plot, "feed"); Flag feed = FlagManager.getPlotFlag(plot, "feed");
if (feed != null) { if (feed != null) {
Integer[] value = (Integer[]) feed.getValue(); Integer[] value = (Integer[]) feed.getValue();
@ -185,27 +181,6 @@ public class PlotPlusListener extends PlotListener implements Listener {
Integer[] value = (Integer[]) heal.getValue(); Integer[] value = (Integer[]) heal.getValue();
healRunnable.put(player.getName(), new Interval(value[0], value[1], 20)); healRunnable.put(player.getName(), new Interval(value[0], value[1], 20));
} }
if (FlagManager.isBooleanFlag(plot, "notify-enter", false)) {
final Player trespasser = event.getPlayer();
final PlotPlayer pt = BukkitUtil.getPlayer(trespasser);
if (Permissions.hasPermission(pt, "plots.flag.notify-enter.bypass")) {
return;
}
if (plot.hasOwner()) {
for (UUID owner : PlotHandler.getOwners(plot)) {
final PlotPlayer pp = UUIDHandler.getPlayer(owner);
if (pp == null) {
return;
}
if (pp.getUUID().equals(pt.getUUID())) {
return;
}
if (pp.isOnline()) {
MainUtil.sendMessage(pp, C.NOTIFY_ENTER.s().replace("%player", trespasser.getName()).replace("%plot", plot.getId().toString()));
}
}
}
}
} }
@EventHandler @EventHandler
@ -223,33 +198,10 @@ public class PlotPlusListener extends PlotListener implements Listener {
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
return; return;
} }
Flag farewell = FlagManager.getPlotFlag(plot, "farewell");
if (farewell != null) {
event.getPlayer().sendMessage(ChatColor.translateAlternateColorCodes('&', C.PREFIX_FAREWELL.s().replaceAll("%id%", plot.id + "") + farewell.getValueString()));
}
final PlotPlayer pl = BukkitUtil.getPlayer(leaver); final PlotPlayer pl = BukkitUtil.getPlayer(leaver);
String name = leaver.getName(); String name = leaver.getName();
feedRunnable.remove(name); feedRunnable.remove(name);
healRunnable.remove(name); healRunnable.remove(name);
if (FlagManager.isBooleanFlag(plot, "notify-leave", false)) {
if (Permissions.hasPermission(pl, "plots.flag.notify-leave.bypass")) {
return;
}
if (plot.hasOwner()) {
for (UUID owner : PlotHandler.getOwners(plot)) {
final PlotPlayer pp = UUIDHandler.getPlayer(owner);
if (pp == null) {
return;
}
if (pp.getUUID().equals(pl.getUUID())) {
return;
}
if (pp.isOnline()) {
MainUtil.sendMessage(pp, C.NOTIFY_LEAVE.s().replace("%player", leaver.getName()).replace("%plot", plot.getId().toString()));
}
}
}
}
} }
public static class Interval { public static class Interval {

View File

@ -23,6 +23,10 @@ package com.plotsquared.listener;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.UUID;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
@ -31,6 +35,7 @@ import com.intellectualcrafters.plot.flag.Flag;
import com.intellectualcrafters.plot.flag.FlagManager; import com.intellectualcrafters.plot.flag.FlagManager;
import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotHandler;
import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.PlotWorld; import com.intellectualcrafters.plot.object.PlotWorld;
import com.intellectualcrafters.plot.util.AbstractTitle; import com.intellectualcrafters.plot.util.AbstractTitle;
@ -42,6 +47,8 @@ import com.intellectualcrafters.plot.util.PlotGamemode;
import com.intellectualcrafters.plot.util.PlotWeather; import com.intellectualcrafters.plot.util.PlotWeather;
import com.intellectualcrafters.plot.util.StringMan; import com.intellectualcrafters.plot.util.StringMan;
import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.TaskManager;
import com.intellectualcrafters.plot.util.UUIDHandler;
import com.plotsquared.bukkit.util.BukkitUtil;
/** /**
* @author Citymonstret * @author Citymonstret
@ -73,11 +80,25 @@ public class PlotListener {
Flag greetingFlag = flags.get("greeting"); Flag greetingFlag = flags.get("greeting");
if (greetingFlag != null) { if (greetingFlag != null) {
greeting = (String) greetingFlag.getValue(); greeting = (String) greetingFlag.getValue();
pp.sendMessage(ChatColor.translateAlternateColorCodes('&', C.PREFIX_GREETING.s().replaceAll("%id%", plot.id + "") + greeting));
} }
else { else {
greeting = ""; greeting = "";
} }
if (greeting != null) {
}
Flag enter = flags.get("notify-enter");
if (enter != null && ((Boolean) enter.getValue())) {
if (!Permissions.hasPermission(pp, "plots.flag.notify-enter.bypass")) {
for (UUID uuid : PlotHandler.getOwners(plot)) {
final PlotPlayer owner = UUIDHandler.getPlayer(uuid);
if (owner != null && !owner.getUUID().equals(pp.getUUID())) {
MainUtil.sendMessage(pp, C.NOTIFY_ENTER.s().replace("%player", pp.getName()).replace("%plot", plot.getId().toString()));
}
}
}
}
final Flag gamemodeFlag = flags.get("gamemode"); final Flag gamemodeFlag = flags.get("gamemode");
if (gamemodeFlag != null) { if (gamemodeFlag != null) {
if (pp.getGamemode() != gamemodeFlag.getValue()) { if (pp.getGamemode() != gamemodeFlag.getValue()) {
@ -188,6 +209,21 @@ public class PlotListener {
} }
} }
} }
Flag farewell = FlagManager.getPlotFlag(plot, "farewell");
if (farewell != null) {
pp.sendMessage(ChatColor.translateAlternateColorCodes('&', C.PREFIX_FAREWELL.s().replaceAll("%id%", plot.id + "") + farewell.getValueString()));
}
Flag leave = FlagManager.getPlotFlag(plot, "notify-leave");
if (leave != null && ((Boolean) leave.getValue())) {
if (!Permissions.hasPermission(pp, "plots.flag.notify-enter.bypass")) {
for (UUID uuid : PlotHandler.getOwners(plot)) {
final PlotPlayer owner = UUIDHandler.getPlayer(uuid);
if (owner != null && !owner.getUUID().equals(pp.getUUID())) {
MainUtil.sendMessage(pp, C.NOTIFY_LEAVE.s().replace("%player", pp.getName()).replace("%plot", plot.getId().toString()));
}
}
}
}
if (FlagManager.getPlotFlag(plot, "fly") != null) { if (FlagManager.getPlotFlag(plot, "fly") != null) {
PlotGamemode gamemode = pp.getGamemode(); PlotGamemode gamemode = pp.getGamemode();
if (gamemode == PlotGamemode.SURVIVAL || gamemode == PlotGamemode.ADVENTURE) { if (gamemode == PlotGamemode.SURVIVAL || gamemode == PlotGamemode.ADVENTURE) {

View File

@ -20,8 +20,10 @@ import org.spongepowered.api.Server;
import org.spongepowered.api.block.BlockState; import org.spongepowered.api.block.BlockState;
import org.spongepowered.api.block.BlockType; import org.spongepowered.api.block.BlockType;
import org.spongepowered.api.block.BlockTypes; import org.spongepowered.api.block.BlockTypes;
import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.entity.player.Player;
import org.spongepowered.api.event.entity.living.player.PlayerChatEvent; import org.spongepowered.api.event.entity.player.PlayerChatEvent;
import org.spongepowered.api.event.state.PreInitializationEvent;
import org.spongepowered.api.event.state.ServerAboutToStartEvent;
import org.spongepowered.api.plugin.Plugin; import org.spongepowered.api.plugin.Plugin;
import org.spongepowered.api.plugin.PluginContainer; import org.spongepowered.api.plugin.PluginContainer;
import org.spongepowered.api.service.profile.GameProfileResolver; import org.spongepowered.api.service.profile.GameProfileResolver;

View File

@ -1,6 +1,6 @@
package com.plotsquared.sponge.events; package com.plotsquared.sponge.events;
import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.entity.player.Player;
import org.spongepowered.api.event.Cancellable; import org.spongepowered.api.event.Cancellable;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;

View File

@ -1,6 +1,6 @@
package com.plotsquared.sponge.events; package com.plotsquared.sponge.events;
import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.entity.player.Player;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;

View File

@ -1,6 +1,6 @@
package com.plotsquared.sponge.events; package com.plotsquared.sponge.events;
import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.entity.player.Player;
import org.spongepowered.api.event.AbstractEvent; import org.spongepowered.api.event.AbstractEvent;
public abstract class PlayerEvent extends AbstractEvent { public abstract class PlayerEvent extends AbstractEvent {

View File

@ -1,6 +1,6 @@
package com.plotsquared.sponge.events; package com.plotsquared.sponge.events;
import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.entity.player.Player;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;

View File

@ -2,7 +2,7 @@ package com.plotsquared.sponge.events;
import java.util.UUID; import java.util.UUID;
import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.entity.player.Player;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;

View File

@ -2,7 +2,7 @@ package com.plotsquared.sponge.events;
import java.util.UUID; import java.util.UUID;
import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.entity.player.Player;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;

View File

@ -2,7 +2,7 @@ package com.plotsquared.sponge.events;
import java.util.UUID; import java.util.UUID;
import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.entity.player.Player;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;

View File

@ -1,6 +1,6 @@
package com.plotsquared.sponge.events; package com.plotsquared.sponge.events;
import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.entity.player.Player;
import org.spongepowered.api.event.Cancellable; import org.spongepowered.api.event.Cancellable;
import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Location;

View File

@ -12,13 +12,28 @@ import org.spongepowered.api.entity.living.Ambient;
import org.spongepowered.api.entity.living.Living; import org.spongepowered.api.entity.living.Living;
import org.spongepowered.api.entity.living.animal.Animal; import org.spongepowered.api.entity.living.animal.Animal;
import org.spongepowered.api.entity.living.monster.Monster; import org.spongepowered.api.entity.living.monster.Monster;
import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.entity.player.Player;
import org.spongepowered.api.entity.vehicle.Boat; import org.spongepowered.api.entity.vehicle.Boat;
import org.spongepowered.api.entity.vehicle.minecart.Minecart; import org.spongepowered.api.entity.vehicle.minecart.Minecart;
import org.spongepowered.api.event.entity.living.player.PlayerChatEvent; import org.spongepowered.api.event.block.BlockMoveEvent;
import org.spongepowered.api.event.entity.living.player.PlayerConnectionEvent; import org.spongepowered.api.event.block.BlockRedstoneUpdateEvent;
import org.spongepowered.api.event.entity.living.player.PlayerJoinEvent; import org.spongepowered.api.event.block.FloraGrowEvent;
import org.spongepowered.api.event.entity.living.player.PlayerQuitEvent; import org.spongepowered.api.event.block.FluidSpreadEvent;
import org.spongepowered.api.event.entity.EntityChangeBlockEvent;
import org.spongepowered.api.event.entity.EntitySpawnEvent;
import org.spongepowered.api.event.entity.EntityTeleportEvent;
import org.spongepowered.api.event.entity.player.PlayerBreakBlockEvent;
import org.spongepowered.api.event.entity.player.PlayerChangeWorldEvent;
import org.spongepowered.api.event.entity.player.PlayerChatEvent;
import org.spongepowered.api.event.entity.player.PlayerInteractBlockEvent;
import org.spongepowered.api.event.entity.player.PlayerJoinEvent;
import org.spongepowered.api.event.entity.player.PlayerMoveEvent;
import org.spongepowered.api.event.entity.player.PlayerPlaceBlockEvent;
import org.spongepowered.api.event.entity.player.PlayerQuitEvent;
import org.spongepowered.api.event.message.CommandEvent;
import org.spongepowered.api.event.network.PlayerConnectionEvent;
import org.spongepowered.api.event.world.ChunkPreGenerateEvent;
import org.spongepowered.api.event.world.WorldOnExplosionEvent;
import org.spongepowered.api.network.PlayerConnection; import org.spongepowered.api.network.PlayerConnection;
import org.spongepowered.api.text.Text; import org.spongepowered.api.text.Text;
import org.spongepowered.api.text.Texts; import org.spongepowered.api.text.Texts;
@ -711,10 +726,10 @@ public class MainListener {
if (!PlotListener.plotExit(pp, lastPlot)) { if (!PlotListener.plotExit(pp, lastPlot)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED); MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED);
if (lastPlot.equals(MainUtil.getPlot(SpongeUtil.getLocation(worldname, from)))) { if (lastPlot.equals(MainUtil.getPlot(SpongeUtil.getLocation(worldname, from)))) {
event.setTo(from); event.setNewLocation(from);
} }
else { else {
event.setTo(world.getSpawnLocation()); event.setNewLocation(world.getSpawnLocation());
} }
return; return;
} }
@ -727,10 +742,10 @@ public class MainListener {
if (!PlotListener.plotEntry(pp, plot)) { if (!PlotListener.plotEntry(pp, plot)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_ENTRY_DENIED); MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_ENTRY_DENIED);
if (!plot.equals(MainUtil.getPlot(SpongeUtil.getLocation(worldname, from)))) { if (!plot.equals(MainUtil.getPlot(SpongeUtil.getLocation(worldname, from)))) {
event.setTo(from); event.setNewLocation(from);
} }
else { else {
event.setTo(world.getSpawnLocation()); event.setNewLocation(world.getSpawnLocation());
} }
return; return;
} }
@ -740,13 +755,13 @@ public class MainListener {
if (x2 > border) { if (x2 > border) {
Vector3d pos = to.getPosition(); Vector3d pos = to.getPosition();
to = to.setPosition(new Vector3d(border - 4, pos.getY(), pos.getZ())); to = to.setPosition(new Vector3d(border - 4, pos.getY(), pos.getZ()));
event.setTo(to); event.setNewLocation(to);
MainUtil.sendMessage(pp, C.BORDER); MainUtil.sendMessage(pp, C.BORDER);
} }
else if (x2 < -border) { else if (x2 < -border) {
Vector3d pos = to.getPosition(); Vector3d pos = to.getPosition();
to = to.setPosition(new Vector3d(-border + 4, pos.getY(), pos.getZ())); to = to.setPosition(new Vector3d(-border + 4, pos.getY(), pos.getZ()));
event.setTo(to); event.setNewLocation(to);
MainUtil.sendMessage(pp, C.BORDER); MainUtil.sendMessage(pp, C.BORDER);
} }
} }
@ -778,10 +793,10 @@ public class MainListener {
if (!PlotListener.plotExit(pp, lastPlot)) { if (!PlotListener.plotExit(pp, lastPlot)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED); MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED);
if (lastPlot.equals(MainUtil.getPlot(SpongeUtil.getLocation(worldname, from)))) { if (lastPlot.equals(MainUtil.getPlot(SpongeUtil.getLocation(worldname, from)))) {
event.setTo(from); event.setNewLocation(from);
} }
else { else {
event.setTo(world.getSpawnLocation()); event.setNewLocation(world.getSpawnLocation());
} }
return; return;
} }
@ -794,10 +809,10 @@ public class MainListener {
if (!PlotListener.plotEntry(pp, plot)) { if (!PlotListener.plotEntry(pp, plot)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_ENTRY_DENIED); MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_ENTRY_DENIED);
if (!plot.equals(MainUtil.getPlot(SpongeUtil.getLocation(worldname, from)))) { if (!plot.equals(MainUtil.getPlot(SpongeUtil.getLocation(worldname, from)))) {
event.setTo(from); event.setNewLocation(from);
} }
else { else {
event.setTo(world.getSpawnLocation()); event.setNewLocation(world.getSpawnLocation());
} }
return; return;
} }
@ -807,13 +822,13 @@ public class MainListener {
if (z2 > border) { if (z2 > border) {
Vector3d pos = to.getPosition(); Vector3d pos = to.getPosition();
to = to.setPosition(new Vector3d(pos.getX(), pos.getY(), border - 4)); to = to.setPosition(new Vector3d(pos.getX(), pos.getY(), border - 4));
event.setTo(to); event.setNewLocation(to);
MainUtil.sendMessage(pp, C.BORDER); MainUtil.sendMessage(pp, C.BORDER);
} }
else if (z2 < -border) { else if (z2 < -border) {
Vector3d pos = to.getPosition(); Vector3d pos = to.getPosition();
to = to.setPosition(new Vector3d(pos.getX(), pos.getY(), -border + 4)); to = to.setPosition(new Vector3d(pos.getX(), pos.getY(), -border + 4));
event.setTo(to); event.setNewLocation(to);
MainUtil.sendMessage(pp, C.BORDER); MainUtil.sendMessage(pp, C.BORDER);
} }
} }
@ -852,10 +867,10 @@ public class MainListener {
if (!PlotListener.plotExit(pp, lastPlot)) { if (!PlotListener.plotExit(pp, lastPlot)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED); MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED);
if (lastPlot.equals(MainUtil.getPlot(SpongeUtil.getLocation(worldname, from)))) { if (lastPlot.equals(MainUtil.getPlot(SpongeUtil.getLocation(worldname, from)))) {
event.setTo(from); event.setNewLocation(from);
} }
else { else {
event.setTo(world.getSpawnLocation()); event.setNewLocation(world.getSpawnLocation());
} }
return; return;
} }
@ -868,10 +883,10 @@ public class MainListener {
if (!PlotListener.plotEntry(pp, plot)) { if (!PlotListener.plotEntry(pp, plot)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_ENTRY_DENIED); MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_ENTRY_DENIED);
if (!plot.equals(MainUtil.getPlot(SpongeUtil.getLocation(worldname, from)))) { if (!plot.equals(MainUtil.getPlot(SpongeUtil.getLocation(worldname, from)))) {
event.setTo(from); event.setNewLocation(from);
} }
else { else {
event.setTo(world.getSpawnLocation()); event.setNewLocation(world.getSpawnLocation());
} }
return; return;
} }
@ -881,13 +896,13 @@ public class MainListener {
if (x2 > border) { if (x2 > border) {
Vector3d pos = to.getPosition(); Vector3d pos = to.getPosition();
to = to.setPosition(new Vector3d(border - 4, pos.getY(), pos.getZ())); to = to.setPosition(new Vector3d(border - 4, pos.getY(), pos.getZ()));
event.setTo(to); event.setNewLocation(to);
MainUtil.sendMessage(pp, C.BORDER); MainUtil.sendMessage(pp, C.BORDER);
} }
else if (x2 < -border) { else if (x2 < -border) {
Vector3d pos = to.getPosition(); Vector3d pos = to.getPosition();
to = to.setPosition(new Vector3d(-border + 4, pos.getY(), pos.getZ())); to = to.setPosition(new Vector3d(-border + 4, pos.getY(), pos.getZ()));
event.setTo(to); event.setNewLocation(to);
MainUtil.sendMessage(pp, C.BORDER); MainUtil.sendMessage(pp, C.BORDER);
} }
} }
@ -919,10 +934,10 @@ public class MainListener {
if (!PlotListener.plotExit(pp, lastPlot)) { if (!PlotListener.plotExit(pp, lastPlot)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED); MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_EXIT_DENIED);
if (lastPlot.equals(MainUtil.getPlot(SpongeUtil.getLocation(worldname, from)))) { if (lastPlot.equals(MainUtil.getPlot(SpongeUtil.getLocation(worldname, from)))) {
event.setTo(from); event.setNewLocation(from);
} }
else { else {
event.setTo(player.getWorld().getSpawnLocation()); event.setNewLocation(player.getWorld().getSpawnLocation());
} }
return; return;
} }
@ -935,10 +950,10 @@ public class MainListener {
if (!PlotListener.plotEntry(pp, plot)) { if (!PlotListener.plotEntry(pp, plot)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_ENTRY_DENIED); MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_ENTRY_DENIED);
if (!plot.equals(MainUtil.getPlot(SpongeUtil.getLocation(worldname, from)))) { if (!plot.equals(MainUtil.getPlot(SpongeUtil.getLocation(worldname, from)))) {
event.setTo(from); event.setNewLocation(from);
} }
else { else {
event.setTo(player.getWorld().getSpawnLocation()); event.setNewLocation(player.getWorld().getSpawnLocation());
} }
return; return;
} }
@ -948,13 +963,13 @@ public class MainListener {
if (z2 > border) { if (z2 > border) {
Vector3d pos = to.getPosition(); Vector3d pos = to.getPosition();
to = to.setPosition(new Vector3d(pos.getX(), pos.getY(), border - 4)); to = to.setPosition(new Vector3d(pos.getX(), pos.getY(), border - 4));
event.setTo(to); event.setNewLocation(to);
MainUtil.sendMessage(pp, C.BORDER); MainUtil.sendMessage(pp, C.BORDER);
} }
else if (z2 < -border) { else if (z2 < -border) {
Vector3d pos = to.getPosition(); Vector3d pos = to.getPosition();
to = to.setPosition(new Vector3d(pos.getX(), pos.getY(), -border + 4)); to = to.setPosition(new Vector3d(pos.getX(), pos.getY(), -border + 4));
event.setTo(to); event.setNewLocation(to);
MainUtil.sendMessage(pp, C.BORDER); MainUtil.sendMessage(pp, C.BORDER);
} }
} }

View File

@ -7,9 +7,9 @@ import java.util.UUID;
import org.spongepowered.api.data.key.Keys; import org.spongepowered.api.data.key.Keys;
import org.spongepowered.api.data.manipulator.mutable.TargetedLocationData; import org.spongepowered.api.data.manipulator.mutable.TargetedLocationData;
import org.spongepowered.api.data.value.mutable.Value; import org.spongepowered.api.data.value.mutable.Value;
import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.entity.player.Player;
import org.spongepowered.api.entity.living.player.gamemode.GameMode; import org.spongepowered.api.entity.player.gamemode.GameMode;
import org.spongepowered.api.entity.living.player.gamemode.GameModes; import org.spongepowered.api.entity.player.gamemode.GameModes;
import org.spongepowered.api.text.TextBuilder; import org.spongepowered.api.text.TextBuilder;
import org.spongepowered.api.text.Texts; import org.spongepowered.api.text.Texts;
import org.spongepowered.api.text.action.HoverAction; import org.spongepowered.api.text.action.HoverAction;

View File

@ -5,7 +5,7 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.entity.player.Player;
import org.spongepowered.api.text.Text; import org.spongepowered.api.text.Text;
import org.spongepowered.api.text.Texts; import org.spongepowered.api.text.Texts;
import org.spongepowered.api.util.command.CommandCallable; import org.spongepowered.api.util.command.CommandCallable;

View File

@ -3,7 +3,7 @@ package com.plotsquared.sponge.util;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Locale; import java.util.Locale;
import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.entity.player.Player;
import org.spongepowered.api.item.ItemType; import org.spongepowered.api.item.ItemType;
import org.spongepowered.api.item.ItemTypes; import org.spongepowered.api.item.ItemTypes;
import org.spongepowered.api.item.inventory.Carrier; import org.spongepowered.api.item.inventory.Carrier;

View File

@ -1,7 +1,7 @@
package com.plotsquared.sponge.util; package com.plotsquared.sponge.util;
import org.spongepowered.api.entity.Entity; import org.spongepowered.api.entity.Entity;
import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.entity.player.Player;
import org.spongepowered.api.world.World; import org.spongepowered.api.world.World;
import org.spongepowered.api.world.extent.Extent; import org.spongepowered.api.world.extent.Extent;

View File

@ -3,7 +3,7 @@ package com.plotsquared.sponge.uuid;
import java.util.UUID; import java.util.UUID;
import org.spongepowered.api.GameProfile; import org.spongepowered.api.GameProfile;
import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.entity.player.Player;
import com.google.common.base.Charsets; import com.google.common.base.Charsets;
import com.intellectualcrafters.plot.object.OfflinePlotPlayer; import com.intellectualcrafters.plot.object.OfflinePlotPlayer;

Binary file not shown.

Binary file not shown.