Update to teleport method

Update spawn minecart method
This commit is contained in:
Drakia 2011-06-22 22:26:37 -07:00
parent 85a98d87ef
commit 3d898ba2b5
4 changed files with 6 additions and 11 deletions

2
README
View File

@ -130,6 +130,8 @@ maxgates - If non-zero, will define the maximum amount of gates allowed on a net
============= =============
Changes Changes
============= =============
[Version 0.5.0b]
- Updated the teleport method
[Version 0.4.9] [Version 0.4.9]
- Left-click to scroll signs up - Left-click to scroll signs up
- Show "(Not Connected)" on fixed-gates with a non-existant destination - Show "(Not Connected)" on fixed-gates with a non-existant destination

View File

@ -217,10 +217,8 @@ public class Portal {
exit.setYaw(origin.getRotation() - traveller.getYaw() + this.getRotation() + 180); exit.setYaw(origin.getRotation() - traveller.getYaw() + this.getRotation() + 180);
// Change "from" so we don't get hack warnings. Cancel player move event. // The new method to teleport in a move event is set the "to" field.
event.setFrom(exit); event.setTo(exit);
player.teleport(exit);
event.setCancelled(true);
} }
public void teleport(final Vehicle vehicle) { public void teleport(final Vehicle vehicle) {
@ -254,7 +252,7 @@ public class Portal {
if (passenger != null) { if (passenger != null) {
vehicle.eject(); vehicle.eject();
vehicle.remove(); vehicle.remove();
final Minecart mc = exit.getWorld().spawnMinecart(exit); final Minecart mc = exit.getWorld().spawn(exit, Minecart.class);
passenger.teleport(exit); passenger.teleport(exit);
Stargate.server.getScheduler().scheduleSyncDelayedTask(Stargate.stargate, new Runnable() { Stargate.server.getScheduler().scheduleSyncDelayedTask(Stargate.stargate, new Runnable() {
public void run() { public void run() {

View File

@ -25,9 +25,6 @@ import org.bukkit.event.block.BlockFromToEvent;
import org.bukkit.event.block.BlockListener; import org.bukkit.event.block.BlockListener;
import org.bukkit.event.block.BlockPhysicsEvent; import org.bukkit.event.block.BlockPhysicsEvent;
import org.bukkit.event.block.SignChangeEvent; import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.entity.EntityDamageByBlockEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntityListener; import org.bukkit.event.entity.EntityListener;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
@ -382,7 +379,6 @@ public class Stargate extends JavaPlugin {
player.sendMessage(ChatColor.RED + denyMsg); player.sendMessage(ChatColor.RED + denyMsg);
} }
portal.teleport(player, portal, event); portal.teleport(player, portal, event);
event.setCancelled(true);
return; return;
} }
@ -395,7 +391,6 @@ public class Stargate extends JavaPlugin {
player.sendMessage(ChatColor.RED + denyMsg); player.sendMessage(ChatColor.RED + denyMsg);
} }
portal.teleport(player, portal, event); portal.teleport(player, portal, event);
event.setCancelled(true);
portal.close(false); portal.close(false);
return; return;
} }

View File

@ -1,6 +1,6 @@
name: Stargate name: Stargate
main: net.TheDgtl.Stargate.Stargate main: net.TheDgtl.Stargate.Stargate
version: 0.4.9 version: 0.5.0b
description: Stargate mod for Bukkit description: Stargate mod for Bukkit
author: Drakia author: Drakia
website: http://www.thedgtl.net website: http://www.thedgtl.net