Some fixes

It's really slow now and I don't know why
This commit is contained in:
Norbi Peti 2020-11-28 01:17:22 +01:00
parent 2c6eb3a610
commit fd9803c6f1
No known key found for this signature in database
GPG key ID: DBA4C4549A927E56
3 changed files with 6 additions and 4 deletions

View file

@ -65,6 +65,7 @@ public class PluginMain extends ButtonPlugin {
@Override
public void pluginEnable() {
registerCommand(new ComputerCommand());
Instance = this;
if (autoEnable.get())
pluginEnableInternal();
else
@ -75,7 +76,6 @@ public class PluginMain extends ButtonPlugin {
if (pluginEnabled)
return;
pluginEnabled = true;
Instance = this;
try {
ConsoleCommandSender ccs = getServer().getConsoleSender();
sendAll = getConfig().getBoolean("sendAll", true);
@ -149,7 +149,7 @@ public class PluginMain extends ButtonPlugin {
for (short i = 0; i < MCX * MCY; i++)
renderers.add(new BukkitRenderer((short) (startID.get() + i), Bukkit.getWorlds().get(0), i * 128 * 128 * 4));
direct = false;
ccs.sendMessage("§6Compatibility error, using slower renderer");
ccs.sendMessage("§6Using Bukkit renderer");
}
private void error(String message) {

View file

@ -27,7 +27,7 @@ public class GPURenderer extends MapRenderer implements IRenderer {
private static int[] colors_;
private int changedX = 0, changedY = 0, changedWidth = 640, changedHeight = 480;
private BiConsumer<Integer, Integer> flagDirty; //This way it's version independent, as long as it's named the same
private static ArrayList<GPURenderer> renderers = new ArrayList<>();
private static final ArrayList<GPURenderer> renderers = new ArrayList<>();
private static Method flagDirtyMethod;
private static boolean enabled = true;
private static boolean warned = false;

View file

@ -76,7 +76,7 @@ public class MCFrameBuffer implements IMCFrameBuffer {
public void notifyUpdate(long x, long y, long width, long height) {
/*if (this.width > 1024 || this.height > 768)
return;*/
if(shouldUpdate.get())
if (!PluginMain.direct || shouldUpdate.get())
return; //Don't wait for lock, ignore update since we're updating everything anyway - TODO: Not always
synchronized (this) {
shouldUpdate.set(true);
@ -90,6 +90,8 @@ public class MCFrameBuffer implements IMCFrameBuffer {
}
public void start() {
if (!PluginMain.direct)
return;
running = true;
Bukkit.getScheduler().runTaskAsynchronously(PluginMain.Instance, () -> {
try {