Clean vehicle code.
Dieser Commit ist enthalten in:
Ursprung
1dac92a766
Commit
001a45804e
@ -4,8 +4,6 @@ import java.util.List;
|
|||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.craftbukkit.entity.CraftBoat;
|
|
||||||
import org.bukkit.craftbukkit.entity.CraftEntity;
|
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
import org.bukkit.craftbukkit.CraftServer;
|
||||||
import org.bukkit.craftbukkit.CraftWorld;
|
import org.bukkit.craftbukkit.CraftWorld;
|
||||||
import org.bukkit.entity.Vehicle;
|
import org.bukkit.entity.Vehicle;
|
||||||
@ -31,14 +29,6 @@ public class EntityBoat extends Entity {
|
|||||||
private double am;
|
private double am;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
private void handleCreation(World world) {
|
|
||||||
CraftServer server = ((WorldServer) world).getServer();
|
|
||||||
Type eventType = Type.VEHICLE_CREATE;
|
|
||||||
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
|
||||||
VehicleCreateEvent event = new VehicleCreateEvent(eventType, vehicle);
|
|
||||||
server.getPluginManager().callEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void c(Entity entity) {
|
public void c(Entity entity) {
|
||||||
CraftServer server = ((WorldServer) this.world).getServer();
|
CraftServer server = ((WorldServer) this.world).getServer();
|
||||||
Type eventType = Type.VEHICLE_COLLISION_ENTITY;
|
Type eventType = Type.VEHICLE_COLLISION_ENTITY;
|
||||||
@ -91,7 +81,13 @@ public class EntityBoat extends Entity {
|
|||||||
this.lastY = d1;
|
this.lastY = d1;
|
||||||
this.lastZ = d2;
|
this.lastZ = d2;
|
||||||
|
|
||||||
handleCreation(world); // CraftBukkit
|
// CraftBukkit start
|
||||||
|
CraftServer server = ((WorldServer) world).getServer();
|
||||||
|
Type eventType = Type.VEHICLE_CREATE;
|
||||||
|
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
||||||
|
VehicleCreateEvent event = new VehicleCreateEvent(eventType, vehicle);
|
||||||
|
server.getPluginManager().callEvent(event);
|
||||||
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
|
|
||||||
public double k() {
|
public double k() {
|
||||||
|
@ -4,12 +4,7 @@ import java.util.List;
|
|||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.craftbukkit.entity.CraftEntity;
|
|
||||||
import org.bukkit.craftbukkit.entity.CraftPoweredMinecart;
|
|
||||||
import org.bukkit.craftbukkit.entity.CraftStorageMinecart;
|
|
||||||
import org.bukkit.craftbukkit.CraftMappable;
|
|
||||||
import org.bukkit.craftbukkit.CraftWorld;
|
import org.bukkit.craftbukkit.CraftWorld;
|
||||||
import org.bukkit.craftbukkit.entity.CraftMinecart;
|
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
import org.bukkit.craftbukkit.CraftServer;
|
||||||
import org.bukkit.entity.Vehicle;
|
import org.bukkit.entity.Vehicle;
|
||||||
import org.bukkit.event.Event.Type;
|
import org.bukkit.event.Event.Type;
|
||||||
@ -50,26 +45,6 @@ public class EntityMinecart extends Entity implements IInventory {
|
|||||||
public ItemStack[] getContents() {
|
public ItemStack[] getContents() {
|
||||||
return this.al;
|
return this.al;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleCreation(World world) {
|
|
||||||
CraftServer server = ((WorldServer) world).getServer();
|
|
||||||
Type eventType = Type.VEHICLE_CREATE;
|
|
||||||
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
|
||||||
|
|
||||||
VehicleCreateEvent event = new VehicleCreateEvent(eventType, vehicle);
|
|
||||||
server.getPluginManager().callEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public org.bukkit.entity.Entity getBukkitEntity(){
|
|
||||||
if (this.d == CraftMinecart.Type.StorageMinecart.getId()) {
|
|
||||||
return this.bukkitStorageMinecart;
|
|
||||||
} else if (this.d == CraftMinecart.Type.PoweredMinecart.getId()) {
|
|
||||||
return this.bukkitPoweredMinecart;
|
|
||||||
} else {
|
|
||||||
return this.bukkitEntity;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
public EntityMinecart(World world) {
|
public EntityMinecart(World world) {
|
||||||
@ -86,10 +61,11 @@ public class EntityMinecart extends Entity implements IInventory {
|
|||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
CraftServer server = ((WorldServer) this.world).getServer();
|
CraftServer server = ((WorldServer) this.world).getServer();
|
||||||
this.bukkitEntity = new CraftMinecart(server, this);
|
Type eventType = Type.VEHICLE_CREATE;
|
||||||
this.bukkitPoweredMinecart = new CraftPoweredMinecart(server, this);
|
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
||||||
this.bukkitStorageMinecart = new CraftStorageMinecart(server, this);
|
|
||||||
handleCreation(world);
|
VehicleCreateEvent event = new VehicleCreateEvent(eventType, vehicle);
|
||||||
|
server.getPluginManager().callEvent(event);
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
package org.bukkit.craftbukkit;
|
|
||||||
|
|
||||||
import org.bukkit.craftbukkit.entity.CraftEntity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Indicates that an object has a method to get its CraftBukkit-equivalent
|
|
||||||
* CraftEntity object from its Minecraft net.minecraft.server.Entity object.
|
|
||||||
*
|
|
||||||
* @author sk89q
|
|
||||||
*/
|
|
||||||
/**@deprecated*/
|
|
||||||
public interface CraftMappable {
|
|
||||||
/**
|
|
||||||
* Gets the CraftEntity version.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public CraftEntity getCraftEntity();
|
|
||||||
}
|
|
@ -45,27 +45,6 @@ public class CraftMinecart extends CraftVehicle implements Minecart {
|
|||||||
return minecart.a;
|
return minecart.a;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Internal function to convert an MC entity to an appropriate CraftBukkit
|
|
||||||
* entity.
|
|
||||||
*
|
|
||||||
* @param server
|
|
||||||
* @param minecart
|
|
||||||
* @return
|
|
||||||
*
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
public static CraftMinecart getCraftMinecart(CraftServer server,
|
|
||||||
EntityMinecart minecart) {
|
|
||||||
if (minecart.d == Type.StorageMinecart.getId()) {
|
|
||||||
return new CraftStorageMinecart(server, minecart);
|
|
||||||
} else if (minecart.d == Type.PoweredMinecart.getId()) {
|
|
||||||
return new CraftPoweredMinecart(server, minecart);
|
|
||||||
} else {
|
|
||||||
return new CraftMinecart(server, minecart);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "CraftMinecart";
|
return "CraftMinecart";
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren