More MCPE fixes

This commit is contained in:
Jesse Boyd 2016-09-05 23:53:50 +10:00
parent c9eabe04ec
commit 681eac9f33
3 changed files with 21 additions and 12 deletions

View File

@ -35,7 +35,6 @@ import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerChangedWorldEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import org.primesoft.blockshub.BlocksHubBukkit; import org.primesoft.blockshub.BlocksHubBukkit;
@ -299,12 +298,6 @@ public class FaweBukkit implements IFawe, Listener {
Fawe.get().unregister(event.getPlayer().getName()); Fawe.get().unregister(event.getPlayer().getName());
} }
@EventHandler
public void onPlayerChangedWorld(PlayerChangedWorldEvent event) {
Player player = event.getPlayer();
FawePlayer fp = FawePlayer.wrap(player);
}
@Override @Override
public String getPlatform() { public String getPlatform() {
return Bukkit.getVersion(); return Bukkit.getVersion();

View File

@ -195,14 +195,14 @@ public class NMSRelighter {
if (brightness > 1 && (brightness != 15 || opacity != 15)) { if (brightness > 1 && (brightness != 15 || opacity != 15)) {
lightBlock(bx + x, y, bz + z, brightness); lightBlock(bx + x, y, bz + z, brightness);
} }
if (opacity != 0 && opacity >= value) { if (opacity > 1 && opacity >= value) {
mask[j] = 0; mask[j] = 0;
queue.setSkyLight(section, x, y, z, 0); queue.setSkyLight(section, x, y, z, 0);
continue; continue;
} }
switch (value) { switch (value) {
case 0: case 0:
if (opacity != 0) { if (opacity > 1) {
queue.setSkyLight(section, x, y, z, 0); queue.setSkyLight(section, x, y, z, 0);
continue; continue;
} }
@ -274,7 +274,7 @@ public class NMSRelighter {
for (int j = 0; j < 256; j++) { for (int j = 0; j < 256; j++) {
int x = j & 15; int x = j & 15;
int z = j >> 4; int z = j >> 4;
if (mask[j] >= 14 || (mask[j] == 0 && queue.getOpacity(section, x, y, z) > 0)) { if (mask[j] >= 14 || (mask[j] == 0 && queue.getOpacity(section, x, y, z) > 1)) {
continue; continue;
} }
byte value = mask[j]; byte value = mask[j];
@ -286,7 +286,7 @@ public class NMSRelighter {
for (int j = 255; j >= 0; j--) { for (int j = 255; j >= 0; j--) {
int x = j & 15; int x = j & 15;
int z = j >> 4; int z = j >> 4;
if (mask[j] >= 14 || (mask[j] == 0 && queue.getOpacity(section, x, y, z) > 0)) { if (mask[j] >= 14 || (mask[j] == 0 && queue.getOpacity(section, x, y, z) > 1)) {
continue; continue;
} }
byte value = mask[j]; byte value = mask[j];

View File

@ -1,8 +1,12 @@
package com.boydti.fawe.nukkit.optimization; package com.boydti.fawe.nukkit.optimization;
import cn.nukkit.Player; import cn.nukkit.Player;
import cn.nukkit.event.EventHandler;
import cn.nukkit.event.Listener;
import cn.nukkit.event.player.PlayerQuitEvent;
import com.boydti.fawe.Fawe; import com.boydti.fawe.Fawe;
import com.boydti.fawe.IFawe; import com.boydti.fawe.IFawe;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.nukkit.core.NukkitTaskManager; import com.boydti.fawe.nukkit.core.NukkitTaskManager;
import com.boydti.fawe.nukkit.core.NukkitWorldEdit; import com.boydti.fawe.nukkit.core.NukkitWorldEdit;
import com.boydti.fawe.nukkit.optimization.queue.NukkitQueue; import com.boydti.fawe.nukkit.optimization.queue.NukkitQueue;
@ -19,13 +23,25 @@ import java.util.Collection;
import java.util.UUID; import java.util.UUID;
import java.util.logging.Level; import java.util.logging.Level;
public class FaweNukkit implements IFawe { public class FaweNukkit implements IFawe, Listener {
private final NukkitWorldEdit plugin; private final NukkitWorldEdit plugin;
public FaweNukkit(NukkitWorldEdit mod) { public FaweNukkit(NukkitWorldEdit mod) {
Settings.HISTORY.USE_DISK = true;
Settings.CLIPBOARD.USE_DISK = true;
Settings.HISTORY.COMPRESSION_LEVEL = 9;
this.plugin = mod; this.plugin = mod;
FaweChunk.HEIGHT = 128; FaweChunk.HEIGHT = 128;
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
Player player = event.getPlayer();
FawePlayer fp = FawePlayer.wrap(player);
fp.unregister();
Fawe.get().unregister(event.getPlayer().getName());
} }
@Override @Override