mirror of
				https://github.com/IntellectualSites/PlotSquared.git
				synced 2025-11-03 18:53:43 +01:00 
			
		
		
		
	Fixes #1131
This commit is contained in:
		@@ -0,0 +1,38 @@
 | 
				
			|||||||
 | 
					package com.intellectualcrafters.plot.object.stream;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.io.IOException;
 | 
				
			||||||
 | 
					import java.io.OutputStream;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class AbstractDelegateOutputStream extends OutputStream {
 | 
				
			||||||
 | 
					    private final OutputStream parent;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public void write(int b) throws IOException {
 | 
				
			||||||
 | 
					        parent.write(b);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public void write(byte[] b) throws IOException {
 | 
				
			||||||
 | 
					        parent.write(b);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public void write(byte[] b, int off, int len) throws IOException {
 | 
				
			||||||
 | 
					        parent.write(b, off, len);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public void flush() throws IOException {
 | 
				
			||||||
 | 
					        parent.flush();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public void close() throws IOException {
 | 
				
			||||||
 | 
					        parent.close();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public AbstractDelegateOutputStream(OutputStream os) {
 | 
				
			||||||
 | 
					        this.parent = os;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -16,6 +16,7 @@ import com.intellectualcrafters.plot.object.PlotId;
 | 
				
			|||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
					import com.intellectualcrafters.plot.object.PlotPlayer;
 | 
				
			||||||
import com.intellectualcrafters.plot.object.RegionWrapper;
 | 
					import com.intellectualcrafters.plot.object.RegionWrapper;
 | 
				
			||||||
import com.intellectualcrafters.plot.object.RunnableVal;
 | 
					import com.intellectualcrafters.plot.object.RunnableVal;
 | 
				
			||||||
 | 
					import com.intellectualcrafters.plot.object.stream.AbstractDelegateOutputStream;
 | 
				
			||||||
import com.intellectualcrafters.plot.util.expiry.ExpireManager;
 | 
					import com.intellectualcrafters.plot.util.expiry.ExpireManager;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.io.File;
 | 
					import java.io.File;
 | 
				
			||||||
@@ -156,7 +157,11 @@ public class MainUtil {
 | 
				
			|||||||
                        writer.append("Content-Type: " + URLConnection.guessContentTypeFromName(filename)).append(CRLF);
 | 
					                        writer.append("Content-Type: " + URLConnection.guessContentTypeFromName(filename)).append(CRLF);
 | 
				
			||||||
                        writer.append("Content-Transfer-Encoding: binary").append(CRLF);
 | 
					                        writer.append("Content-Transfer-Encoding: binary").append(CRLF);
 | 
				
			||||||
                        writer.append(CRLF).flush();
 | 
					                        writer.append(CRLF).flush();
 | 
				
			||||||
                        writeTask.value = output;
 | 
					                        OutputStream nonClosable = new AbstractDelegateOutputStream(output) {
 | 
				
			||||||
 | 
					                            @Override
 | 
				
			||||||
 | 
					                            public void close() throws IOException {  } // Don't close
 | 
				
			||||||
 | 
					                        };
 | 
				
			||||||
 | 
					                        writeTask.value = nonClosable;
 | 
				
			||||||
                        writeTask.run();
 | 
					                        writeTask.run();
 | 
				
			||||||
                        output.flush();
 | 
					                        output.flush();
 | 
				
			||||||
                        writer.append(CRLF).flush();
 | 
					                        writer.append(CRLF).flush();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -527,11 +527,11 @@ public abstract class SchematicHandler {
 | 
				
			|||||||
            @Override
 | 
					            @Override
 | 
				
			||||||
            public void run(OutputStream output) {
 | 
					            public void run(OutputStream output) {
 | 
				
			||||||
                try {
 | 
					                try {
 | 
				
			||||||
                    GZIPOutputStream gzip = new GZIPOutputStream(output, true);
 | 
					                    try (GZIPOutputStream gzip = new GZIPOutputStream(output, true)) {
 | 
				
			||||||
                    NBTOutputStream nos = new NBTOutputStream(gzip);
 | 
					                        try (NBTOutputStream nos = new NBTOutputStream(gzip)) {
 | 
				
			||||||
                            nos.writeTag(tag);
 | 
					                            nos.writeTag(tag);
 | 
				
			||||||
                    nos.flush();
 | 
					                        }
 | 
				
			||||||
                    gzip.flush();
 | 
					                    }
 | 
				
			||||||
                } catch (IOException e) {
 | 
					                } catch (IOException e) {
 | 
				
			||||||
                    e.printStackTrace();
 | 
					                    e.printStackTrace();
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -29,6 +29,7 @@ import cn.nukkit.event.block.BlockSpreadEvent;
 | 
				
			|||||||
import cn.nukkit.event.block.BlockUpdateEvent;
 | 
					import cn.nukkit.event.block.BlockUpdateEvent;
 | 
				
			||||||
import cn.nukkit.event.entity.EntityBlockChangeEvent;
 | 
					import cn.nukkit.event.entity.EntityBlockChangeEvent;
 | 
				
			||||||
import cn.nukkit.event.entity.EntityCombustByEntityEvent;
 | 
					import cn.nukkit.event.entity.EntityCombustByEntityEvent;
 | 
				
			||||||
 | 
					import cn.nukkit.event.entity.EntityCombustEvent;
 | 
				
			||||||
import cn.nukkit.event.entity.EntityDamageByEntityEvent;
 | 
					import cn.nukkit.event.entity.EntityDamageByEntityEvent;
 | 
				
			||||||
import cn.nukkit.event.entity.EntityDamageEvent;
 | 
					import cn.nukkit.event.entity.EntityDamageEvent;
 | 
				
			||||||
import cn.nukkit.event.entity.EntityExplodeEvent;
 | 
					import cn.nukkit.event.entity.EntityExplodeEvent;
 | 
				
			||||||
@@ -148,10 +149,12 @@ public class PlayerEvents extends PlotListener implements Listener {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @EventHandler(priority = EventPriority.HIGHEST)
 | 
					    @EventHandler(priority = EventPriority.HIGHEST)
 | 
				
			||||||
    public void onEntityCombustByEntity(EntityCombustByEntityEvent event) {
 | 
					    public void onEntityCombustByEntity(EntityCombustEvent event) {
 | 
				
			||||||
        EntityDamageByEntityEvent eventChange = new EntityDamageByEntityEvent(event.getCombuster(), event.getEntity(), EntityDamageEvent.CAUSE_FIRE_TICK, event.getDuration());
 | 
					        if (event instanceof EntityCombustByEntityEvent) {
 | 
				
			||||||
 | 
					            EntityDamageByEntityEvent eventChange = new EntityDamageByEntityEvent(((EntityCombustByEntityEvent) event).getCombuster(), event.getEntity(), EntityDamageEvent.CAUSE_FIRE_TICK, event.getDuration());
 | 
				
			||||||
            onEntityDamageByEntityEvent(eventChange);
 | 
					            onEntityDamageByEntityEvent(eventChange);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @EventHandler(priority = EventPriority.HIGHEST)
 | 
					    @EventHandler(priority = EventPriority.HIGHEST)
 | 
				
			||||||
    public void onEntityDamageByEntityEvent(EntityDamageEvent event) {
 | 
					    public void onEntityDamageByEntityEvent(EntityDamageEvent event) {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user