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;
}
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) {
if (input.length() < 2) {
// Cannot be quoted.

View File

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