13
0
geforkt von Mirrors/Paper

Implemented TeleportCause enums. Addresses BUKKIT-265

Dieser Commit ist enthalten in:
James Clarke 2012-02-15 19:59:17 +00:00 committet von EvilSeph
Ursprung 53e4a034f4
Commit cd90cec48c

Datei anzeigen

@ -23,6 +23,7 @@ import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
// CraftBukkit end // CraftBukkit end
@ -351,8 +352,27 @@ public class ServerConfigurationManager {
} }
} }
TeleportCause cause = TeleportCause.UNKNOWN;
int playerEnvironmentId = entityplayer.getBukkitEntity().getWorld().getEnvironment().getId();
switch (dimension) {
case -1:
cause = TeleportCause.NETHER_PORTAL;
break;
case 0:
if (playerEnvironmentId == -1) {
cause = TeleportCause.NETHER_PORTAL;
} else if (playerEnvironmentId == 1) {
cause = TeleportCause.END_PORTAL;
}
break;
case 1:
cause = TeleportCause.END_PORTAL;
break;
}
org.bukkit.craftbukkit.PortalTravelAgent pta = new org.bukkit.craftbukkit.PortalTravelAgent(); org.bukkit.craftbukkit.PortalTravelAgent pta = new org.bukkit.craftbukkit.PortalTravelAgent();
PlayerPortalEvent event = new PlayerPortalEvent((Player) entityplayer.getBukkitEntity(), fromLocation, toLocation, pta); PlayerPortalEvent event = new PlayerPortalEvent((Player) entityplayer.getBukkitEntity(), fromLocation, toLocation, pta, cause);
if (entityplayer.dimension == 1) { if (entityplayer.dimension == 1) {
event.useTravelAgent(false); event.useTravelAgent(false);