Added spectating flag for EntityTNTPrimed
This commit is contained in:
parent
9e8cd9db7d
commit
7885df35ae
@ -94,7 +94,7 @@ public class ServerStatus
|
||||
}
|
||||
}
|
||||
*/
|
||||
List<String> screenNames = getScreenNames();
|
||||
List<String> folderNames = getFolderNames();
|
||||
|
||||
//removeExcessFolders(screenNames);
|
||||
|
||||
@ -109,22 +109,8 @@ public class ServerStatus
|
||||
{
|
||||
try
|
||||
{
|
||||
process = new ProcessBuilder(new String[] { "cd", "/home/mineplex/servers/", "rm", "-Rf", screen }).start();
|
||||
process = new ProcessBuilder(new String[] { "rm", "-Rf", "/home/mineplex/servers/" + screen }).start();
|
||||
process.waitFor();
|
||||
BufferedReader reader=new BufferedReader(new InputStreamReader(process.getInputStream()));
|
||||
String line = reader.readLine();
|
||||
|
||||
while(line != null)
|
||||
{
|
||||
int stopIndex = line.contains("(Detached)") ? line.indexOf("(Detached)") : line.contains("(Detached)") ? line.indexOf("(Attached)") : -1;
|
||||
|
||||
if (stopIndex != -1)
|
||||
{
|
||||
//screens.add(line.substring(line.indexOf(".") + 1, stopIndex).trim());
|
||||
}
|
||||
|
||||
line=reader.readLine();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -204,14 +190,15 @@ public class ServerStatus
|
||||
*/
|
||||
}
|
||||
|
||||
private static List<String> getScreenNames()
|
||||
private static List<String> getFolderNames()
|
||||
{
|
||||
Process process = null;
|
||||
List<String> screens = new ArrayList<String>();
|
||||
List<String> folderNames = new ArrayList<String>();
|
||||
|
||||
try
|
||||
{
|
||||
process = new ProcessBuilder(new String[] { "cd", "/home/mineplex/servers/", "ls", "screen", "-list" }).start();
|
||||
process = new ProcessBuilder(new String[] { "screen", "-list" }).start();
|
||||
process.waitFor();
|
||||
BufferedReader reader=new BufferedReader(new InputStreamReader(process.getInputStream()));
|
||||
String line = reader.readLine();
|
||||
@ -240,6 +227,36 @@ public class ServerStatus
|
||||
}
|
||||
}
|
||||
|
||||
return screens;
|
||||
try
|
||||
{
|
||||
process = new ProcessBuilder(new String[] { "ls", "/home/mineplex/servers" }).start();
|
||||
process.waitFor();
|
||||
BufferedReader reader=new BufferedReader(new InputStreamReader(process.getInputStream()));
|
||||
String line = reader.readLine();
|
||||
|
||||
while(line != null)
|
||||
{
|
||||
for (String folderName : line.split(" "))
|
||||
{
|
||||
if (!screens.contains(folderName.trim()) && !folderName.equalsIgnoreCase("Arenas"))
|
||||
folderNames.add(folderName.trim());
|
||||
}
|
||||
|
||||
line=reader.readLine();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (process != null)
|
||||
{
|
||||
process.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
return folderNames;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,102 @@
|
||||
package net.minecraft.server.v1_6_R3;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
||||
import org.bukkit.entity.Explosive;
|
||||
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
||||
public class EntityTNTPrimed extends Entity
|
||||
{
|
||||
public int fuseTicks;
|
||||
private EntityLiving source;
|
||||
public float yield = 4.0F;
|
||||
public boolean isIncendiary = false;
|
||||
|
||||
public boolean spectating = false;
|
||||
|
||||
public EntityTNTPrimed(World world) {
|
||||
super(world);
|
||||
this.m = true;
|
||||
a(0.98F, 0.98F);
|
||||
this.height = (this.length / 2.0F);
|
||||
}
|
||||
|
||||
public EntityTNTPrimed(World world, double d0, double d1, double d2, EntityLiving entityliving) {
|
||||
this(world);
|
||||
setPosition(d0, d1, d2);
|
||||
float f = (float)(Math.random() * 3.141592741012573D * 2.0D);
|
||||
|
||||
this.motX = (-(float)Math.sin(f) * 0.02F);
|
||||
this.motY = 0.2000000029802322D;
|
||||
this.motZ = (-(float)Math.cos(f) * 0.02F);
|
||||
this.fuseTicks = 80;
|
||||
this.lastX = d0;
|
||||
this.lastY = d1;
|
||||
this.lastZ = d2;
|
||||
this.source = entityliving;
|
||||
}
|
||||
protected void a() {
|
||||
}
|
||||
|
||||
protected boolean e_() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean L() {
|
||||
return !this.dead && !spectating;
|
||||
}
|
||||
|
||||
public void l_() {
|
||||
this.lastX = this.locX;
|
||||
this.lastY = this.locY;
|
||||
this.lastZ = this.locZ;
|
||||
this.motY -= 0.03999999910593033D;
|
||||
move(this.motX, this.motY, this.motZ);
|
||||
this.motX *= 0.9800000190734863D;
|
||||
this.motY *= 0.9800000190734863D;
|
||||
this.motZ *= 0.9800000190734863D;
|
||||
if (this.onGround) {
|
||||
this.motX *= 0.699999988079071D;
|
||||
this.motZ *= 0.699999988079071D;
|
||||
this.motY *= -0.5D;
|
||||
}
|
||||
|
||||
if (this.fuseTicks-- <= 0)
|
||||
{
|
||||
if (!this.world.isStatic) {
|
||||
explode();
|
||||
}
|
||||
die();
|
||||
}
|
||||
else {
|
||||
this.world.addParticle("smoke", this.locX, this.locY + 0.5D, this.locZ, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
|
||||
private void explode()
|
||||
{
|
||||
CraftServer server = this.world.getServer();
|
||||
|
||||
ExplosionPrimeEvent event = new ExplosionPrimeEvent((Explosive)CraftEntity.getEntity(server, this));
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled())
|
||||
{
|
||||
this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), true);
|
||||
}
|
||||
}
|
||||
|
||||
protected void b(NBTTagCompound nbttagcompound)
|
||||
{
|
||||
nbttagcompound.setByte("Fuse", (byte)this.fuseTicks);
|
||||
}
|
||||
|
||||
protected void a(NBTTagCompound nbttagcompound) {
|
||||
this.fuseTicks = nbttagcompound.getByte("Fuse");
|
||||
}
|
||||
|
||||
public EntityLiving getSource() {
|
||||
return this.source;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user