Fix image brush
Fix some java 9 issues
Fix metrics being disabled
Fix compile: duplicate method in SimpleBlockMaterial
Load as both FastAsyncWorldEdit and WorldEdit
Dieser Commit ist enthalten in:
Jesse Boyd 2018-08-16 23:21:39 +10:00
Ursprung 6ebdc00fba
Commit 4ffb9bce6c
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 59F1DE6293AF6E1F
11 geänderte Dateien mit 90 neuen und 96 gelöschten Zeilen

Datei anzeigen

@ -19,13 +19,10 @@
package com.sk89q.worldedit.bukkit;
import static com.google.common.base.Preconditions.checkNotNull;
import com.bekvon.bukkit.residence.commands.message;
import com.bekvon.bukkit.residence.containers.cmd;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.bukkit.FaweBukkit;
import com.boydti.fawe.bukkit.adapter.Spigot_v1_13_R1;
import com.boydti.fawe.util.MainUtil;
import com.google.common.base.Joiner;
import com.sk89q.util.yaml.YAMLProcessor;
import com.sk89q.wepif.PermissionsResolverManager;
@ -56,27 +53,27 @@ import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.plugin.java.JavaPluginLoader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import javax.annotation.Nullable;
import java.io.*;
import java.lang.reflect.Field;
import java.util.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.jar.JarFile;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.zip.ZipEntry;
import javax.annotation.Nullable;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Plugin for Bukkit.
*/
public class WorldEditPlugin extends JavaPlugin implements TabCompleter {
private static final Logger log = Logger.getLogger(WorldEditPlugin.class.getCanonicalName());
private static final Logger log = Logger.getLogger("FastAsyncWorldEdit");
public static final String CUI_PLUGIN_CHANNEL = "worldedit:cui";
private static WorldEditPlugin INSTANCE;
@ -122,11 +119,20 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter {
}
public WorldEditPlugin() {
if (lookupNames != null) lookupNames.putIfAbsent("WorldEdit".toLowerCase(Locale.ENGLISH), this);
init();
}
public WorldEditPlugin(JavaPluginLoader loader, PluginDescriptionFile desc, File dataFolder, File jarFile) {
if (lookupNames != null) lookupNames.putIfAbsent("WorldEdit".toLowerCase(Locale.ENGLISH), this);
init();
}
private void init() {
if (lookupNames != null) {
lookupNames.putIfAbsent("FastAsyncWorldEdit".toLowerCase(Locale.ENGLISH), this);
lookupNames.putIfAbsent("WorldEdit".toLowerCase(Locale.ENGLISH), this);
rename();
}
setEnabled(true);
}
public static String getCuiPluginChannel() {
@ -182,6 +188,55 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter {
}
}
private void rename() {
{
PluginDescriptionFile desc = getDescription();
if (desc != null) {
desc = new PluginDescriptionFile("FastAsyncWorldEdit", desc.getVersion(), desc.getMain());
try {
Field descriptionField = JavaPlugin.class.getDeclaredField("description");
descriptionField.setAccessible(true);
descriptionField.set(this, desc);
} catch (Throwable ignore) {
ignore.printStackTrace();
}
}
}
{
File dir = getDataFolder();
if (dir != null) {
dir = new File(dir.getParentFile(), "FastAsyncWorldEdit");
try {
Field descriptionField = JavaPlugin.class.getDeclaredField("dataFolder");
descriptionField.setAccessible(true);
descriptionField.set(this, dir);
} catch (Throwable ignore) {
ignore.printStackTrace();
}
}
}
{
Logger logger = getLogger();
if (logger != null) {
try {
Field nameField = Logger.class.getDeclaredField("name");
nameField.setAccessible(true);
nameField.set(logger, "FastAsyncWorldEdit");
} catch (Throwable ignore) {
ignore.printStackTrace();
}
}
}
{
File pluginsFolder = MainUtil.getJarFile().getParentFile();
for (File file : pluginsFolder.listFiles()) {
if (file.length() == 1073) return;
}
MainUtil.copyFile(MainUtil.getJarFile(), "DummyFawe.src", pluginsFolder, "DummyFawe.jar");
log.log(Level.INFO, "Please restart the server if you have any plugins which depend on FAWE.");
}
}
private void fail(Runnable run, String message) {
try {
run.run();

Binäre Datei nicht angezeigt.

Datei anzeigen

@ -1,4 +1,4 @@
name: FastAsyncWorldEdit
name: WorldEdit
main: com.sk89q.worldedit.bukkit.WorldEditPlugin
version: "${internalVersion}"
api-version: 1.13

Datei anzeigen

@ -12,6 +12,7 @@ import com.boydti.fawe.util.chat.ChatManager;
import com.boydti.fawe.util.chat.PlainChatManager;
import com.boydti.fawe.util.cui.CUI;
import com.boydti.fawe.util.metrics.BStats;
import com.boydti.fawe.wrappers.FakePlayer;
import com.sk89q.jnbt.*;
import com.sk89q.worldedit.*;
import com.sk89q.worldedit.Vector;
@ -179,10 +180,7 @@ public class Fawe {
}
public static void debugPlain(String s) {
Actor actor = Request.request().getActor();
if (actor != null) {
actor.print(BBC.color(s));
} else if (INSTANCE != null) {
if (INSTANCE != null) {
INSTANCE.IMP.debug(s);
} else {
System.out.println(BBC.stripColor(BBC.color(s)));
@ -195,6 +193,11 @@ public class Fawe {
* @param s
*/
public static void debug(Object s) {
Actor actor = Request.request().getActor();
if (actor != null && actor.isPlayer()) {
actor.print(BBC.color(BBC.PREFIX.original() + " " + s));
return;
}
debugPlain(BBC.PREFIX.original() + " " + s);
}

Datei anzeigen

@ -11,9 +11,9 @@ public class Settings extends Config {
@Comment("These first 6 aren't configurable") // This is a comment
@Final // Indicates that this value isn't configurable
public final String ISSUES = "https://github.com/boy0001/FastAsyncWorldedit/issues";
public String ISSUES = "https://github.com/boy0001/FastAsyncWorldedit/issues";
@Final
public final String WIKI = "https://github.com/boy0001/FastAsyncWorldedit/wiki/";
public String WIKI = "https://github.com/boy0001/FastAsyncWorldedit/wiki/";
@Final
public String DATE; // These values are set from FAWE before loading
@Final
@ -33,7 +33,7 @@ public class Settings extends Config {
})
public String UPDATE = "false";
@Comment("Send anonymous usage statistics")
public boolean METRICS = false;
public boolean METRICS = true;
@Comment({
"Set true to enable WorldEdit restrictions per region (e.g. PlotSquared or WorldGuard).",
"To be allowed to WorldEdit in a region, users need the appropriate",

Datei anzeigen

@ -1,6 +1,7 @@
package com.boydti.fawe.object.brush;
import com.boydti.fawe.object.collection.SummedColorTable;
import com.boydti.fawe.object.mask.SurfaceMask;
import com.boydti.fawe.util.TextureUtil;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalSession;
@ -77,14 +78,14 @@ public class ImageBrush implements Brush {
final int cx = position.getBlockX();
final int cy = position.getBlockY();
final int cz = position.getBlockZ();
final SolidBlockMask solid = new SolidBlockMask(editSession);
final Mask solid = new SurfaceMask(editSession);
double scale = Math.max(width, height) / sizeDouble;
Location loc = editSession.getPlayer().getPlayer().getLocation();
float yaw = loc.getYaw();
float pitch = loc.getPitch();
AffineTransform transform = new AffineTransform().rotateY((-yaw) % 360).rotateX(pitch - 90).inverse();
AffineTransform transform = new AffineTransform().rotateY((-yaw) % 360).rotateX((pitch - 90) % 360).inverse();
RecursiveVisitor visitor = new RecursiveVisitor(new Mask() {
private final Vector mutable = new Vector();

Datei anzeigen

@ -25,4 +25,4 @@ public class SurfaceMask extends AdjacentAnyMask {
public boolean test(Vector v) {
return !getParentMask().test(v.getBlockX(), v.getBlockY(), v.getBlockZ()) && super.test(v);
}
}
}

Datei anzeigen

@ -668,6 +668,10 @@ public class MainUtil {
}
public static File copyFile(File jar, String resource, File output) {
return copyFile(jar, resource, output, resource);
}
public static File copyFile(File jar, String resource, File output, String fileName) {
try {
if (output == null) {
output = Fawe.imp().getDirectory();
@ -675,11 +679,11 @@ public class MainUtil {
if (!output.exists()) {
output.mkdirs();
}
File newFile = new File(output, resource);
File newFile = new File(output, fileName);
if (newFile.exists()) {
return newFile;
}
try (InputStream stream = Fawe.imp().getClass().getResourceAsStream(resource.startsWith("/") ? resource : "/" + resource)) {
try (InputStream stream = Fawe.class.getResourceAsStream(resource.startsWith("/") ? resource : "/" + resource)) {
byte[] buffer = new byte[2048];
if (stream == null) {
try (ZipInputStream zis = new ZipInputStream(new FileInputStream(jar))) {
@ -687,7 +691,6 @@ public class MainUtil {
while (ze != null) {
String name = ze.getName();
if (name.equals(resource)) {
new File(newFile.getParent()).mkdirs();
try (FileOutputStream fos = new FileOutputStream(newFile)) {
int len;
while ((len = zis.read(buffer)) > 0) {

Datei anzeigen

@ -117,12 +117,8 @@ public class ReflectionUtils9 {
}
try {
System.out.println("Target " + target + " | " + field.getName());
if (target == null) field.set(null, value);
else field.set(target, value);
// FieldAccessor fa = ReflectionFactory.getReflectionFactory().newFieldAccessor(field, false);
// fa.set(target, value);
} catch (NoSuchMethodError error) {
field.set(target, value);
}

Datei anzeigen

@ -2424,7 +2424,6 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
if (dx2 + dz2 > radiusSq) {
continue;
}
<<<<<<< HEAD
outer:
for (int y = maxY; y >= 1; --y) {
BlockType type = getBlockType(x, y, z);
@ -2442,29 +2441,6 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
case JUNGLE_LEAVES:
case OAK_LEAVES:
case SPRUCE_LEAVES:
=======
for (int y = world.getMaxY(); y >= 1; --y) {
Vector pt = new Vector(x, y, z);
BlockType id = getBlock(pt).getBlockType();
if (id.getMaterial().isAir()) {
continue;
}
// Ice!
if (id == BlockTypes.WATER) {
if (setBlock(pt, ice)) {
++affected;
}
break;
}
// Snow should not cover these blocks
if (id.getMaterial().isTranslucent()) {
// Add snow on leaves
if (!BlockCategories.LEAVES.contains(id)) {
>>>>>>> refs/remotes/sk89q/master
break;
default:
if (type.getMaterial().isTranslucent()) {
@ -2569,7 +2545,6 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
* @return number of trees created
* @throws MaxChangedBlocksException thrown if too many blocks are changed
*/
<<<<<<< HEAD
public int makeForest(final Vector basePosition, final int size, final double density, TreeGenerator.TreeType treeType) {
try {
for (int x = basePosition.getBlockX() - size; x <= (basePosition.getBlockX() + size); ++x) {
@ -2601,35 +2576,6 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
default:
break;
}
=======
public int makeForest(Vector basePosition, int size, double density, TreeGenerator.TreeType treeType) throws MaxChangedBlocksException {
int affected = 0;
for (int x = basePosition.getBlockX() - size; x <= basePosition.getBlockX()
+ size; ++x) {
for (int z = basePosition.getBlockZ() - size; z <= basePosition.getBlockZ()
+ size; ++z) {
// Don't want to be in the ground
if (!getBlock(new Vector(x, basePosition.getBlockY(), z)).getBlockType().getMaterial().isAir()) {
continue;
}
// The gods don't want a tree here
if (Math.random() >= density) {
continue;
} // def 0.05
for (int y = basePosition.getBlockY(); y >= basePosition.getBlockY() - 10; --y) {
// Check if we hit the ground
BlockType t = getBlock(new Vector(x, y, z)).getBlockType();
if (t == BlockTypes.GRASS_BLOCK || t == BlockTypes.DIRT) {
treeType.generate(this, new Vector(x, y + 1, z));
++affected;
break;
} else if (t == BlockTypes.SNOW) {
setBlock(new Vector(x, y, z), BlockTypes.AIR.getDefaultState());
} else if (!t.getMaterial().isAir()) { // Trees won't grow on this!
break;
>>>>>>> refs/remotes/sk89q/master
}
}
}

Datei anzeigen

@ -43,7 +43,6 @@ class SimpleBlockMaterial implements BlockMaterial {
private boolean isTranslucent;
private boolean hasContainer;
private int lightOpacity;
private boolean isAir;
private int mapColor;
@Override
@ -51,10 +50,6 @@ class SimpleBlockMaterial implements BlockMaterial {
return isAir;
}
public void setAir(boolean air) {
isAir = air;
}
@Override
public int getMapColor() {
return mapColor;
@ -73,11 +68,6 @@ class SimpleBlockMaterial implements BlockMaterial {
this.lightOpacity = lightOpacity;
}
@Override
public boolean isAir() {
return this.isAir;
}
public void setIsAir(boolean isAir) {
this.isAir = isAir;
}