reduce java warnings

This commit is contained in:
bixilon 2020-06-05 20:59:30 +02:00
parent 809c1c4236
commit 841d3bc624
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
26 changed files with 62 additions and 45 deletions

17
.idea/dictionaries/moritz.xml generated Normal file
View File

@ -0,0 +1,17 @@
<component name="ProjectDictionaryState">
<dictionary name="moritz">
<words>
<w>clientbound</w>
<w>cooldown</w>
<w>gamemode</w>
<w>minosoft</w>
<w>mojang</w>
<w>motd</w>
<w>multiblock</w>
<w>notchian</w>
<w>overworld</w>
<w>serverbound</w>
<w>singleplayer</w>
</words>
</dictionary>
</component>

6
.idea/vcs.xml generated Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@ -9,7 +9,7 @@ Multithreaded
Mostly GPU based, not cpu
Aimed for performance (goal: reach v-sync framerate, dynamically disable effects, ...)
Server support
No original Minecraft workarounds (API: plugin channel): No invisible entities to show holograms, No Scoreboard workarounds, ... (Scoreboard still must be implemented to avoid compatiblity issues)
No original Minecraft workarounds (API: plugin channel): No invisible entities to show holograms, No Scoreboard workarounds, ... (Scoreboard still must be implemented to avoid compatibility issues)
Debug settings (stop entity updates, entity limiter, ...)
No cheat client (only per modding api)
Server GUI API (server can send custom GUIs to client)

View File

@ -1,5 +1,5 @@
package de.bixilon.minosoft.config;
public interface ConfigEnum {
public String getPath();
String getPath();
}

View File

@ -62,6 +62,7 @@ public class Configuration {
String[] spilt = path.split("\\.");
LinkedHashMap<String, Object> temp = config;
for (int i = 0; i < spilt.length - 1; i++) {
//noinspection unchecked
temp = (LinkedHashMap<String, Object>) temp.get(spilt[i]);
}
return temp.get(spilt[spilt.length - 1]);

View File

@ -1,9 +1,9 @@
package de.bixilon.minosoft.game.datatypes;
public class BlockPosition {
int x;
int y;
int z;
final int x;
final int y;
final int z;
public BlockPosition(int x, short y, int z) {
// y min -2048, max 2047

View File

@ -27,12 +27,15 @@ public class ChatComponent {
return json.getString("text");
}
StringBuilder buffer = new StringBuilder();
if (json.has("extra")) {
JSONArray arr = json.getJSONArray("extra");
for (int i = 0; i < arr.length(); i++) {
buffer.append(arr.getJSONObject(i).getString("text"));
}
return buffer.toString();
}
return "";
}
public JSONObject getRaw() {
return this.json;

View File

@ -4,8 +4,8 @@ package de.bixilon.minosoft.game.datatypes;
* Chunk X and Z location (block position / 16, rounded down)
*/
public class ChunkLocation {
int x;
int z;
final int x;
final int z;
public ChunkLocation(int x, int z) {
this.x = x;

View File

@ -4,9 +4,9 @@ package de.bixilon.minosoft.game.datatypes;
* Chunk X, Y and Z location (max 16x16x16)
*/
public class ChunkNibbleLocation {
int x;
int y;
int z;
final int x;
final int y;
final int z;
public ChunkNibbleLocation(int x, int y, int z) {
this.x = x;

View File

@ -6,7 +6,7 @@ public enum Difficulty {
NORMAL(2),
HARD(3);
int id;
final int id;
Difficulty(int id) {
this.id = id;

View File

@ -5,7 +5,7 @@ public enum Dimension {
OVERWORLD(0),
END(1);
int id;
final int id;
Dimension(int id) {
this.id = id;

View File

@ -6,7 +6,7 @@ public enum GameMode {
ADVENTURE(2),
SPECTATOR(3);
int id;
final int id;
GameMode(int id) {
this.id = id;

View File

@ -9,7 +9,7 @@ public enum LevelType {
CUSTOMIZED("customized"),
BUFFET("buffet");
String type;
final String type;
LevelType(String type) {
this.type = type;

View File

@ -5,7 +5,7 @@ public enum Locale {
EN_GB("en_gb"),
DE_DE("de_DE");
String name;
final String name;
Locale(String name) {
this.name = name;

View File

@ -39,10 +39,8 @@ public class World {
public void setBlock(BlockPosition pos, Block block) {
if (getChunk(pos.getChunkLocation()) != null) {
getChunk(pos.getChunkLocation()).setBlock(pos.getX() % 16, pos.getX(), pos.getZ() % 16, block);
} else {
//throw new IllegalAccessException("Chunk is not loaded!");
// ToDo
}
// do nothing if chunk is unloaded
}
public void unloadChunk(ChunkLocation location) {

View File

@ -48,8 +48,8 @@ public enum Block {
//ToDo all blocks
//ToDo post water update block states
Identifier identifier;
int legacyId;
final Identifier identifier;
final int legacyId;
int legacyData;
Block(Identifier identifier, int legacyId, int legacyData) {

View File

@ -4,7 +4,7 @@ import java.text.SimpleDateFormat;
public class Log {
static LogLevel level = LogLevel.PROTOCOL;
static SimpleDateFormat timeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
final static SimpleDateFormat timeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
public static void log(LogLevel l, String message) {
if (l.getId() > level.getId()) {

View File

@ -10,8 +10,8 @@ import java.util.UUID;
public class Account {
String username;
String password;
final String username;
final String password;
String playerName;
String token;

View File

@ -7,7 +7,7 @@ import de.bixilon.minosoft.game.datatypes.player.Location;
import java.util.UUID;
public class Player {
Account acc;
final Account acc;
float health;
short food;
float saturation;

View File

@ -3,7 +3,7 @@ package de.bixilon.minosoft.objects;
import org.json.JSONObject;
public class ServerListPing {
JSONObject raw;
final JSONObject raw;
public ServerListPing(JSONObject json) {
this.raw = json;

View File

@ -64,7 +64,7 @@ public class PacketChangeGameState implements ClientboundPacket {
FADE_VALUE(7),
FADE_TIME(8);
byte id;
final byte id;
Reason(byte id) {
this.id = id;

View File

@ -17,7 +17,7 @@ import de.bixilon.minosoft.util.Util;
import java.util.HashMap;
public class PacketChunkBulk implements ClientboundPacket {
HashMap<ChunkLocation, Chunk> chunkMap = new HashMap<>();
final HashMap<ChunkLocation, Chunk> chunkMap = new HashMap<>();
@Override

View File

@ -12,9 +12,9 @@ import java.security.PublicKey;
public class PacketEncryptionResponse implements ServerboundPacket {
byte[] secret;
byte[] token;
SecretKey secretKey;
final byte[] secret;
final byte[] token;
final SecretKey secretKey;
public PacketEncryptionResponse(SecretKey secret, byte[] token, PublicKey key) {

View File

@ -20,7 +20,7 @@ import java.math.BigInteger;
import java.security.PublicKey;
public class PacketHandler {
Connection connection;
final Connection connection;
public PacketHandler(Connection connection) {
this.connection = connection;

View File

@ -6,8 +6,8 @@ import java.util.Map;
public class Protocol_1_7_10 implements Protocol {
public HashMap<Packets.Serverbound, Integer> serverboundPacketMapping;
public HashMap<Packets.Clientbound, Integer> clientboundPacketMapping;
public final HashMap<Packets.Serverbound, Integer> serverboundPacketMapping;
public final HashMap<Packets.Clientbound, Integer> clientboundPacketMapping;
Protocol_1_7_10() {
// serverbound

View File

@ -8,14 +8,6 @@ public class BitByte {
return bitSet;
}
public static short[] byteArrayToShortArray(byte[] readBytes) {
short[] ret = new short[readBytes.length];
for (int i = 0; i < readBytes.length; i++) {
ret[0] = readBytes[0];
}
return ret;
}
public static byte getLow4Bits(byte input) {
return (byte) (input & 0xF);
}