1 package org.bukkit.map;
3 import java.util.HashMap;
10 private final HashMap<Character, CharacterSprite> chars =
new HashMap<Character, CharacterSprite>();
11 private int height = 0;
23 throw new IllegalStateException(
"this font is not malleable");
26 chars.put(ch, sprite);
50 throw new IllegalArgumentException(
"text contains invalid characters");
54 for (
int i = 0; i < text.length(); ++i) {
55 result += chars.get(text.charAt(i)).
getWidth();
76 for (
int i = 0; i < text.length(); ++i) {
77 char ch = text.charAt(i);
78 if (ch ==
'\u00A7' || ch ==
'\n')
continue;
79 if (chars.get(ch) == null)
return false;
89 private final int width;
90 private final int height;
91 private final boolean[] data;
98 if (data.length != width * height) {
99 throw new IllegalArgumentException(
"size of data does not match dimensions");
110 public boolean get(
int row,
int col) {
111 if (row < 0 || col < 0 || row >= height || col >= width)
return false;
112 return data[row * width + col];