Start BasicShowMode
Dieser Commit ist enthalten in:
Ursprung
ba7888eb56
Commit
33584589a5
@ -1,19 +1,26 @@
|
||||
package de.steamwar.bausystem.tracer;
|
||||
|
||||
import net.minecraft.server.v1_12_R1.*;
|
||||
import net.minecraft.server.v1_12_R1.Blocks;
|
||||
import net.minecraft.server.v1_12_R1.EntityFallingBlock;
|
||||
import net.minecraft.server.v1_12_R1.EnumMoveType;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_12_R1.CraftWorld;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class TNTEntity_12 extends EntityFallingBlock {
|
||||
public class TNTEntity_12 extends EntityFallingBlock implements AbstractTNTEntity {
|
||||
|
||||
private TNTPosition position;
|
||||
|
||||
public TNTEntity_12(World world, TNTPosition position) {
|
||||
super(world, position.getLocation().getX(), position.getLocation().getY(), position.getLocation().getZ(), Blocks.TNT.getBlockData());
|
||||
public TNTEntity_12(World world, TNTPosition position, Player player) {
|
||||
super(((CraftWorld) world).getHandle(), position.getLocation().getX(), position.getLocation().getY(), position.getLocation().getZ(), Blocks.TNT.getBlockData());
|
||||
this.position = position;
|
||||
|
||||
this.setNoGravity(true);
|
||||
this.ticksLived = -12000;
|
||||
this.dropItem = false;
|
||||
this.setCustomNameVisible(true);
|
||||
|
||||
display(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -21,4 +28,18 @@ public class TNTEntity_12 extends EntityFallingBlock {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractTNTEntity display(Player player) {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractTNTEntity hide(Player player) {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
killEntity();
|
||||
}
|
||||
}
|
||||
|
@ -1,19 +1,27 @@
|
||||
package de.steamwar.bausystem.tracer;
|
||||
|
||||
import net.minecraft.server.v1_15_R1.*;
|
||||
import net.minecraft.server.v1_15_R1.Blocks;
|
||||
import net.minecraft.server.v1_15_R1.EntityFallingBlock;
|
||||
import net.minecraft.server.v1_15_R1.EnumMoveType;
|
||||
import net.minecraft.server.v1_15_R1.Vec3D;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.CraftWorld;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class TNTEntity_15 extends EntityFallingBlock {
|
||||
public class TNTEntity_15 extends EntityFallingBlock implements AbstractTNTEntity {
|
||||
|
||||
private TNTPosition position;
|
||||
|
||||
public TNTEntity_15(World world, TNTPosition position) {
|
||||
super(world, position.getLocation().getX(), position.getLocation().getY(), position.getLocation().getZ(), Blocks.TNT.getBlockData());
|
||||
public TNTEntity_15(World world, TNTPosition position, Player player) {
|
||||
super(((CraftWorld) world).getHandle(), position.getLocation().getX(), position.getLocation().getY(), position.getLocation().getZ(), Blocks.TNT.getBlockData());
|
||||
this.position = position;
|
||||
|
||||
this.setNoGravity(true);
|
||||
this.ticksLived = -12000;
|
||||
this.dropItem = false;
|
||||
this.setCustomNameVisible(true);
|
||||
|
||||
display(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -21,4 +29,18 @@ public class TNTEntity_15 extends EntityFallingBlock {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractTNTEntity display(Player player) {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractTNTEntity hide(Player player) {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
killEntity();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,13 @@
|
||||
package de.steamwar.bausystem.tracer;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public interface AbstractTNTEntity {
|
||||
|
||||
AbstractTNTEntity display(Player player);
|
||||
|
||||
AbstractTNTEntity hide(Player player);
|
||||
|
||||
void remove();
|
||||
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package de.steamwar.bausystem.tracer.show.mode;
|
||||
|
||||
import de.steamwar.bausystem.tracer.AbstractTNTEntity;
|
||||
import de.steamwar.bausystem.tracer.TNTEntity_12;
|
||||
import de.steamwar.bausystem.tracer.TNTEntity_15;
|
||||
import de.steamwar.bausystem.tracer.TNTPosition;
|
||||
import de.steamwar.bausystem.tracer.show.ShowMode;
|
||||
import de.steamwar.core.Core;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class BasicShowMode implements ShowMode {
|
||||
|
||||
private final Player player;
|
||||
|
||||
private Set<AbstractTNTEntity> tntEntitySet = new HashSet<>();
|
||||
|
||||
public BasicShowMode(Player player) {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show(TNTPosition position) {
|
||||
switch (Core.getVersion()) {
|
||||
case 12:
|
||||
tntEntitySet.add(new TNTEntity_12(player.getWorld(), position, player));
|
||||
break;
|
||||
default:
|
||||
tntEntitySet.add(new TNTEntity_15(player.getWorld(), position, player));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
tntEntitySet.forEach(abstractTNTEntity -> abstractTNTEntity.hide(player));
|
||||
}
|
||||
|
||||
}
|
In neuem Issue referenzieren
Einen Benutzer sperren