Fix hooking metrics with obfuscated plugins
This commit is contained in:
parent
2ccf2eb86d
commit
b979db514e
@ -210,10 +210,12 @@ public class FaweBukkit implements IFawe, Listener {
|
||||
Bukkit.getServicesManager().unregister(service, instance);
|
||||
try {
|
||||
Class<? extends Object> clazz = instance.getClass();
|
||||
Field logFailedRequests = ReflectionUtils.setAccessible(clazz.getDeclaredField("logFailedRequests"));
|
||||
Field logFailedRequests = ReflectionUtils.findField(clazz, boolean.class);
|
||||
logFailedRequests.set(null, false);
|
||||
Field url = null;
|
||||
try { url = clazz.getDeclaredField("URL"); } catch (NoSuchFieldException ignore) { url = clazz.getDeclaredField("bStatsUrl"); }
|
||||
try { url = clazz.getDeclaredField("URL"); } catch (NoSuchFieldException ignore) {
|
||||
for (Field field : clazz.getDeclaredFields()) if (ReflectionUtils.setAccessible(field).get(null).toString().startsWith("http")) { url = field; break; }
|
||||
}
|
||||
if (url != null) ReflectionUtils.setFailsafeFieldValue(url, null, null);
|
||||
} catch (NoSuchFieldError | IllegalAccessException ignore) {}
|
||||
catch (Throwable e) {
|
||||
|
@ -7,6 +7,7 @@ import com.boydti.fawe.object.extent.ResettableExtent;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
@ -216,6 +217,38 @@ public class FawePrimitiveBinding extends BindingHelper {
|
||||
return new Vector(radiusX, radiusY, radiusZ);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets a type from a {@link ArgumentStack}.
|
||||
*
|
||||
* @param context the context
|
||||
* @return the requested type
|
||||
* @throws ParameterException on error
|
||||
*/
|
||||
@BindingMatch(type = Vector2D.class,
|
||||
behavior = BindingBehavior.CONSUMES,
|
||||
consumedCount = 1,
|
||||
provideModifiers = true)
|
||||
public Vector2D getVector2D(ArgumentStack context, Annotation[] modifiers) throws ParameterException {
|
||||
String radiusString = context.next();
|
||||
String[] radii = radiusString.split(",");
|
||||
final double radiusX, radiusZ;
|
||||
switch (radii.length) {
|
||||
case 1:
|
||||
radiusX = radiusZ = Math.max(1, FawePrimitiveBinding.parseNumericInput(radii[0]));
|
||||
break;
|
||||
|
||||
case 2:
|
||||
radiusX = Math.max(1, FawePrimitiveBinding.parseNumericInput(radii[0]));
|
||||
radiusZ = Math.max(1, FawePrimitiveBinding.parseNumericInput(radii[2]));
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new ParameterException("You must either specify 1 or 2 radius values.");
|
||||
}
|
||||
return new Vector2D(radiusX, radiusZ);
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to parse numeric input as either a number or a mathematical expression.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user