Merge pull request #3783 from JurgenKuyper/v3.0

updated deprecated interfaces where possible
This commit is contained in:
mikeprimm 2022-07-22 20:59:02 -05:00 committed by GitHub
commit 2d6bcbbca2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 36 deletions

View File

@ -16,7 +16,7 @@ public class CustomBlockModel extends HDBlockModel {
super(bstate, databits, blockset);
try {
Class<?> cls = Class.forName(classname); /* Get class */
render = (CustomRenderer) cls.newInstance();
render = (CustomRenderer) cls.getDeclaredConstructor().newInstance();
if(render.initializeRenderer(HDBlockModels.pdf, bstate.blockName, databits, classparm) == false) {
Log.severe("Error loading custom renderer - " + classname);
render = null;

View File

@ -2097,7 +2097,7 @@ public class TexturePack {
else if(av[0].equals("custColorMult")) {
try {
Class<?> cls = Class.forName(av[1]);
custColorMult = (CustomColorMultiplier)cls.newInstance();
custColorMult = (CustomColorMultiplier)cls.getDeclaredConstructor().newInstance();
} catch (Exception x) {
Log.severe("Error loading custom color multiplier - " + av[1] + ": " + x.getMessage());
}
@ -2263,7 +2263,7 @@ public class TexturePack {
else if(av[0].equals("custColorMult")) {
try {
Class<?> cls = Class.forName(av[1]);
custColorMult = (CustomColorMultiplier)cls.newInstance();
custColorMult = (CustomColorMultiplier)cls.getDeclaredConstructor().newInstance();
} catch (Exception x) {
Log.severe("Error loading custom color multiplier - " + av[1] + ": " + x.getMessage());
}

View File

@ -397,7 +397,7 @@ public abstract class BukkitVersionHelperGeneric extends BukkitVersionHelper {
/**
* Get inhabited ticks count from chunk
*/
private static final Long zero = new Long(0);
private static final Long zero = Long.valueOf(0);
public long getInhabitedTicks(Chunk c) {
if (nmsc_inhabitedticks == null) {
return 0;
@ -557,25 +557,25 @@ public abstract class BukkitVersionHelperGeneric extends BukkitVersionHelper {
if (profile != null) {
Object propmap = callMethod(profile, cmaprofile_getproperties, nullargs, null);
if ((propmap != null) && (propmap instanceof ForwardingMultimap)) {
ForwardingMultimap<String, Object> fmm = (ForwardingMultimap<String, Object>) propmap;
Collection<Object> txt = fmm.get("textures");
Object textureProperty = Iterables.getFirst(fmm.get("textures"), null);
if (textureProperty != null) {
String val = (String) callMethod(textureProperty, cmaproperty_getvalue, nullargs, null);
if (val != null) {
TexturesPayload result = null;
try {
ForwardingMultimap<String, Object> fmm = (ForwardingMultimap<String, Object>) propmap;
Collection<Object> txt = fmm.get("textures");
Object textureProperty = Iterables.getFirst(fmm.get("textures"), null);
if (textureProperty != null) {
String val = (String) callMethod(textureProperty, cmaproperty_getvalue, nullargs, null);
if (val != null) {
TexturesPayload result = null;
try {
String json = new String(Base64.getDecoder().decode(val), StandardCharsets.UTF_8);
result = gson.fromJson(json, TexturesPayload.class);
} catch (JsonParseException e) {
} catch (IllegalArgumentException x) {
Log.warning("Malformed response from skin URL check: " + val);
}
if ((result != null) && (result.textures != null) && (result.textures.containsKey("SKIN"))) {
url = result.textures.get("SKIN").url;
}
}
}
result = gson.fromJson(json, TexturesPayload.class);
} catch (JsonParseException e) {
} catch (IllegalArgumentException x) {
Log.warning("Malformed response from skin URL check: " + val);
}
if ((result != null) && (result.textures != null) && (result.textures.containsKey("SKIN"))) {
url = result.textures.get("SKIN").url;
}
}
}
}
}

View File

@ -6,20 +6,8 @@ import java.lang.reflect.Field;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Base64;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.Map.Entry;
import java.util.Optional;
import java.util.PriorityQueue;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ConcurrentLinkedQueue;
@ -253,7 +241,10 @@ public class DynmapPlugin
if (statename.length() > 0) {
statename += ",";
}
statename += p.getName() + "=" + bs.get(p).toString();
try {
statename += p.getName() + "=" + bs.get(p).toString();
} catch (IllegalFormatConversionException e){
}
}
int lightAtten = bs.isOpaqueCube(EmptyBlockReader.INSTANCE, BlockPos.ZERO) ? 15 : (bs.propagatesSkylightDown(EmptyBlockReader.INSTANCE, BlockPos.ZERO) ? 0 : 1);
//Log.info("statename=" + bn + "[" + statename + "], lightAtten=" + lightAtten);