Skip to content

Commit

Permalink
Various major
Browse files Browse the repository at this point in the history
New building mode (using CFI):
- CFI world is generated around the player in realtime
- Use WorldEdit/VS brushes while editing
- This is still being optimized
- Use a 1K radius height brush with near instant results
- https://github.com/boy0001/FastAsyncWorldedit/wiki/CreateFromImage

Early example: https://www.youtube.com/watch?v=jp1SjanWN70
  • Loading branch information
boy0001 committed Dec 26, 2017
1 parent 0dbb617 commit 395b46c
Show file tree
Hide file tree
Showing 75 changed files with 4,771 additions and 1,352 deletions.
13 changes: 12 additions & 1 deletion bukkit/src/main/java/com/boydti/fawe/bukkit/FaweBukkit.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.boydti.fawe.IFawe;
import com.boydti.fawe.bukkit.chat.BukkitChatManager;
import com.boydti.fawe.bukkit.listener.BrushListener;
import com.boydti.fawe.bukkit.listener.CFIPacketListener;
import com.boydti.fawe.bukkit.listener.RenderListener;
import com.boydti.fawe.bukkit.regions.FactionsFeature;
import com.boydti.fawe.bukkit.regions.FactionsOneFeature;
Expand All @@ -19,7 +20,7 @@
import com.boydti.fawe.bukkit.util.VaultUtil;
import com.boydti.fawe.bukkit.util.cui.CUIListener;
import com.boydti.fawe.bukkit.util.cui.StructureCUI;
import com.boydti.fawe.bukkit.util.image.BukkitImageListener;
import com.boydti.fawe.bukkit.listener.BukkitImageListener;
import com.boydti.fawe.bukkit.util.image.BukkitImageViewer;
import com.boydti.fawe.bukkit.v0.BukkitQueue_0;
import com.boydti.fawe.bukkit.v0.BukkitQueue_All;
Expand Down Expand Up @@ -80,6 +81,7 @@ public class FaweBukkit implements IFawe, Listener {

private boolean listeningImages;
private BukkitImageListener imageListener;
private CFIPacketListener packetListener;

private boolean listeningCui;
private CUIListener cuiListener;
Expand Down Expand Up @@ -136,10 +138,15 @@ public FaweBukkit(BukkitMain plugin) {
MainUtil.handleError(e);
Bukkit.getServer().shutdown();
}

// Registered delayed Event Listeners
TaskManager.IMP.task(new Runnable() {
@Override
public void run() {
// This class
Bukkit.getPluginManager().registerEvents(FaweBukkit.this, FaweBukkit.this.plugin);

// The tick limiter
new ChunkListener();
}
});
Expand Down Expand Up @@ -169,6 +176,10 @@ public synchronized ImageViewer getImageViewer(FawePlayer fp) {
try {
listeningImages = true;
PluginManager manager = Bukkit.getPluginManager();
if (manager.getPlugin("ProtocolLib") != null) {
packetListener = new CFIPacketListener(plugin);
}

if (manager.getPlugin("PacketListenerApi") == null) {
File output = new File(plugin.getDataFolder().getParentFile(), "PacketListenerAPI_v3.6.0-SNAPSHOT.jar");
byte[] jarData = Jars.PL_v3_6_0.download();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.boydti.fawe.bukkit.util.image;
package com.boydti.fawe.bukkit.listener;

import com.boydti.fawe.bukkit.util.image.BukkitImageViewer;
import com.boydti.fawe.command.CFICommands;
import com.boydti.fawe.jnbt.anvil.HeightMapMCAGenerator;
import com.boydti.fawe.object.FawePlayer;
Expand Down Expand Up @@ -60,17 +61,21 @@ public void onPlayerInteractEntity(AsyncPlayerChatEvent event) {
Iterator<Player> iter = recipients.iterator();
while (iter.hasNext()) {
Player player = iter.next();
if (player.equals(event.getPlayer())) continue;

FawePlayer<Object> fp = FawePlayer.wrap(player);
if (!fp.hasMeta()) continue;

CFICommands.CFISettings settings = fp.getMeta("CFISettings");
if (settings != null && settings.hasGenerator()) {
String name = player.getName().toLowerCase();
if (!event.getMessage().toLowerCase().contains(name)) {
ArrayDeque<String> buffered = fp.getMeta("CFIBufferedMessages");
if (buffered == null) fp.setMeta("CFIBufferedMessaged", buffered = new ArrayDeque<String>());
String full = String.format(event.getFormat(), event.getPlayer().getDisplayName(), event.getMessage());
buffered.add(full);
iter.remove();
}
if (settings == null || !settings.hasGenerator()) continue;

String name = player.getName().toLowerCase();
if (!event.getMessage().toLowerCase().contains(name)) {
ArrayDeque<String> buffered = fp.getMeta("CFIBufferedMessages");
if (buffered == null) fp.setMeta("CFIBufferedMessaged", buffered = new ArrayDeque<String>());
String full = String.format(event.getFormat(), event.getPlayer().getDisplayName(), event.getMessage());
buffered.add(full);
iter.remove();
}
}
}
Expand Down Expand Up @@ -183,7 +188,7 @@ private void handleInteract(Event event, Player player, Entity entity, boolean p
TaskManager.IMP.laterAsync(new Runnable() {
@Override
public void run() {
viewer.view(generator.draw());
viewer.view(generator);
}
}, 1);
return;
Expand Down Expand Up @@ -263,7 +268,7 @@ public void run() {
e.printStackTrace();
}
es.flushQueue();
viewer.view(generator.draw());
viewer.view(generator);
}
}, true, true);

Expand All @@ -274,11 +279,5 @@ public void run() {
}
}
}






}
}
Loading

0 comments on commit 395b46c

Please sign in to comment.