Commits
md_5 authored bdd0eda71f8
61 61 | * @param key the key to create |
62 62 | */ |
63 63 | public NamespacedKey(Plugin plugin, String key) { |
64 64 | Preconditions.checkArgument(plugin != null, "plugin"); |
65 65 | Preconditions.checkArgument(key != null, "key"); |
66 66 | |
67 67 | this.namespace = plugin.getName().toLowerCase(Locale.ROOT); |
68 68 | this.key = key.toLowerCase().toLowerCase(Locale.ROOT); |
69 69 | |
70 70 | // Check validity after normalization |
71 - | Preconditions.checkArgument(VALID_NAMESPACE.matcher(namespace).matches(), "namespace"); |
72 - | Preconditions.checkArgument(VALID_KEY.matcher(key).matches(), "key"); |
71 + | Preconditions.checkArgument(VALID_NAMESPACE.matcher(this.namespace).matches(), "namespace"); |
72 + | Preconditions.checkArgument(VALID_KEY.matcher(this.key).matches(), "key"); |
73 73 | |
74 74 | String string = toString(); |
75 75 | Preconditions.checkArgument(string.length() < 256, "NamespacedKey must be less than 256 characters (%s)", string); |
76 76 | } |
77 77 | |
78 78 | public String getNamespace() { |
79 79 | return namespace; |
80 80 | } |
81 81 | |
82 82 | public String getKey() { |