Remove some unused code

This commit is contained in:
filoghost 2020-04-11 19:37:44 +02:00
parent a41be09ef3
commit bef2ed58a6
6 changed files with 43 additions and 144 deletions

View File

@ -28,15 +28,4 @@ public class StringConverter {
return input; return input;
} }
public static String toSaveableFormat(String input) {
if (input == null) {
return null;
}
input = UnicodeSymbols.symbolsToPlaceholders(input);
input = input.replace("§", "&");
return input;
}
} }

View File

@ -92,14 +92,6 @@ public class UnicodeSymbols {
} }
protected static String symbolsToPlaceholders(String input) {
for (Entry<String, String> entry : placeholders.entrySet()) {
input = input.replace(entry.getValue(), entry.getKey());
}
return input;
}
private static String unquote(String input) { private static String unquote(String input) {
if (input.length() < 2) { if (input.length() < 2) {
// Cannot be quoted. // Cannot be quoted.

View File

@ -18,64 +18,52 @@ import java.lang.RuntimeException;
import java.io.Closeable; import java.io.Closeable;
import java.io.DataInputStream; import java.io.DataInputStream;
import java.io.IOException; import java.io.IOException;
import java.lang.Character;
import java.lang.String; import java.lang.String;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.nio.charset.Charset; import java.nio.charset.Charset;
class PacketUtils class PacketUtils {
{
public static final Charset UTF16BE = Charset.forName("UTF-16BE");; public static final Charset UTF8 = Charset.forName("UTF-8");
public static final Charset UTF8 = Charset.forName("UTF-8");
public static void writeString(final DataOutputStream out, final String s, final Charset charset) throws IOException {
public static void a(final DataOutputStream out, final String s) throws IOException { if (charset == PacketUtils.UTF8) {
final int len = s.length(); writeVarInt(out, s.length());
final byte[] data = new byte[len / 2]; } else {
for (int i = 0; i < len; i += 2) { out.writeShort(s.length());
data[i / 2] = (byte)((Character.digit(s.charAt(i), 16) << 4) + Character.digit(s.charAt(i + 1), 16)); }
} out.write(s.getBytes(charset));
out.write(data); }
}
public static int readVarInt(final DataInputStream in) throws IOException {
public static void writeString(final DataOutputStream out, final String s, final Charset charset) throws IOException { int i = 0;
if (charset == PacketUtils.UTF8) { int j = 0;
writeVarInt(out, s.length()); while (true) {
} final int k = in.readByte();
else { i |= (k & 0x7F) << j++ * 7;
out.writeShort(s.length()); if (j > 5) {
} throw new RuntimeException("VarInt too big");
out.write(s.getBytes(charset)); }
} if ((k & 0x80) != 0x80) {
return i;
public static int readVarInt(final DataInputStream in) throws IOException { }
int i = 0; }
int j = 0; }
while (true) {
final int k = in.readByte(); public static void writeVarInt(final DataOutputStream out, int paramInt) throws IOException {
i |= (k & 0x7F) << j++ * 7; while ((paramInt & 0xFFFFFF80) != 0x0) {
if (j > 5) { out.write((paramInt & 0x7F) | 0x80);
throw new RuntimeException("VarInt too big"); paramInt >>>= 7;
} }
if ((k & 0x80) != 0x80) { out.write(paramInt);
return i; }
}
} public static void closeQuietly(Closeable closeable) {
} try {
if (closeable != null) {
public static void writeVarInt(final DataOutputStream out, int paramInt) throws IOException { closeable.close();
while ((paramInt & 0xFFFFFF80) != 0x0) { }
out.write((paramInt & 0x7F) | 0x80); } catch (IOException e) {}
paramInt >>>= 7; }
}
out.write(paramInt);
}
public static void closeQuietly(Closeable closeable) {
try {
if (closeable != null) {
closeable.close();
}
} catch (IOException e) { }
}
} }

View File

@ -1,24 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.gmail.filoghost.holographicdisplays.exception;
public class InvalidCharactersException extends Exception {
private static final long serialVersionUID = 1L;
public InvalidCharactersException(String message) {
super(message);
}
}

View File

@ -1,25 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.gmail.filoghost.holographicdisplays.exception;
public class InvalidMaterialException extends Exception {
private static final long serialVersionUID = 1L;
public InvalidMaterialException(String message) {
super(message);
}
}

View File

@ -1,21 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.gmail.filoghost.holographicdisplays.exception;
public class SpawnFailedException extends Exception {
private static final long serialVersionUID = 1L;
}