Skip to content

Commit a49bfd9

Browse files
committed
Ok, should work now (?)
1 parent 97a4d74 commit a49bfd9

File tree

12 files changed

+32
-16
lines changed

12 files changed

+32
-16
lines changed

src/main/java/ch/njol/skript/ScriptLoader.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -617,10 +617,11 @@ private static NonNullPair<Script, List<Structure>> loadScript(Config config) {
617617

618618
try (CountingLogHandler ignored = new CountingLogHandler(SkriptLogger.FATAL).start()) {
619619
for (Node cnode : config.getMainNode()) {
620-
if (!(cnode instanceof SectionNode node)) {
620+
if (!(cnode instanceof SectionNode)) {
621621
Skript.error("invalid line - all code has to be put into triggers");
622622
continue;
623623
}
624+
SectionNode node = (SectionNode) cnode;
624625

625626
String line = node.getKey();
626627
if (line == null)

src/main/java/ch/njol/skript/lang/function/Namespace.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,9 @@ public int hashCode() {
131131
public boolean equals(Object o) {
132132
if (this == o)
133133
return true;
134-
if (!(o instanceof Info info))
134+
if (!(o instanceof Info))
135135
return false;
136+
Info info = (Info) o;
136137

137138
if (isLocal() != info.isLocal())
138139
return false;

src/main/java/ch/njol/skript/sections/SecConditional.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,8 @@ private static SecConditional getPrecedingConditional(List<TriggerItem> triggerI
338338
// loop through the triggerItems in reverse order so that we find the most recent items first
339339
for (int i = triggerItems.size() - 1; i >= 0; i--) {
340340
TriggerItem triggerItem = triggerItems.get(i);
341-
if (triggerItem instanceof SecConditional conditionalSection) {
341+
if (triggerItem instanceof SecConditional) {
342+
SecConditional conditionalSection = (SecConditional) triggerItem;
342343

343344
if (conditionalSection.type == ConditionalType.ELSE) {
344345
// if the conditional is an else, return null because it belongs to a different condition and ends
@@ -359,7 +360,8 @@ private static List<SecConditional> getElseIfs(List<TriggerItem> triggerItems) {
359360
List<SecConditional> list = new ArrayList<SecConditional>();
360361
for (int i = triggerItems.size() - 1; i >= 0; i--) {
361362
TriggerItem triggerItem = triggerItems.get(i);
362-
if (triggerItem instanceof SecConditional secConditional) {
363+
if (triggerItem instanceof SecConditional) {
364+
SecConditional secConditional = (SecConditional) triggerItem;
363365

364366
if (secConditional.type == ConditionalType.ELSE_IF)
365367
list.add(secConditional);

src/main/java/ch/njol/skript/util/Date.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,9 @@ public boolean equals(final @Nullable Object obj) {
132132
return true;
133133
if (obj == null)
134134
return false;
135-
if (!(obj instanceof Date other))
135+
if (!(obj instanceof Date))
136136
return false;
137+
Date other = (Date) obj;
137138
return timestamp == other.timestamp;
138139
}
139140

src/main/java/ch/njol/skript/util/Time.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,9 @@ public boolean equals(final @Nullable Object obj) {
149149
return true;
150150
if (obj == null)
151151
return false;
152-
if (!(obj instanceof Time other))
152+
if (!(obj instanceof Time))
153153
return false;
154+
Time other = (Time) obj;
154155
return time == other.time;
155156
}
156157

src/main/java/ch/njol/skript/util/Timeperiod.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@ public int hashCode() {
6666
public boolean equals(final @Nullable Object obj) {
6767
if (obj == this)
6868
return true;
69-
if (!(obj instanceof Timeperiod other))
69+
if (!(obj instanceof Timeperiod))
7070
return false;
71+
Timeperiod other = (Timeperiod) obj;
7172
return (end == other.end && start == other.start);
7273
}
7374

src/main/java/ch/njol/skript/util/Timespan.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,9 @@ public boolean equals(final @Nullable Object obj) {
236236
return true;
237237
if (obj == null)
238238
return false;
239-
if (!(obj instanceof Timespan other))
239+
if (!(obj instanceof Timespan))
240240
return false;
241+
Timespan other = (Timespan) obj;
241242
return millis == other.millis;
242243
}
243244

src/main/java/ch/njol/skript/variables/Variables.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ public static boolean load() {
182182
boolean successful = true;
183183

184184
for (Node node : (SectionNode) databases) {
185-
if (node instanceof SectionNode sectionNode) {
185+
if (node instanceof SectionNode) {
186+
SectionNode sectionNode = (SectionNode) node;
186187

187188
String type = sectionNode.getValue("type");
188189
if (type == null) {

src/main/java/ch/njol/util/Pair.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,9 @@ public String toString() {
8585
public final boolean equals(final @Nullable Object obj) {
8686
if (obj == this)
8787
return true;
88-
if (!(obj instanceof Entry<?, ?> other))
88+
if (!(obj instanceof Entry<?, ?>))
8989
return false;
90+
Entry<?, ?> other = (Entry<?, ?>) obj;
9091
final T1 first = this.first;
9192
final T2 second = this.second;
9293
return (first == null ? other.getKey() == null : first.equals(other.getKey())) &&

src/main/java/ch/njol/util/coll/ReversedListView.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,9 @@ public int hashCode() {
194194
public boolean equals(final @Nullable Object obj) {
195195
if (obj == this)
196196
return true;
197-
if (!(obj instanceof List<?> other))
197+
if (!(obj instanceof List<?>))
198198
return false;
199+
List<?> other = (List<?>) obj;
199200
if (other.size() != this.size())
200201
return false;
201202
final Iterator<?> os = other.iterator();

src/main/java/ch/njol/yggdrasil/Fields.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,9 @@ public boolean equals(@Nullable Object object) {
151151
return true;
152152
if (object == null)
153153
return false;
154-
if (!(object instanceof FieldContext other))
154+
if (!(object instanceof FieldContext))
155155
return false;
156+
FieldContext other = (FieldContext) object;
156157
return id.equals(other.id);
157158
}
158159

src/main/java/ch/njol/yggdrasil/JRESerializer.java

+8-4
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,11 @@ public Fields serialize(Object object) {
5252
if (!SUPPORTED_CLASSES.contains(object.getClass()))
5353
throw new IllegalArgumentException();
5454
Fields fields = new Fields();
55-
if (object instanceof Collection<?> collection) {
55+
if (object instanceof Collection<?>) {
56+
Collection<?> collection = (Collection<?>) object;
5657
fields.putObject("values", collection.toArray());
57-
} else if (object instanceof Map<?, ?> map) {
58+
} else if (object instanceof Map<?, ?>) {
59+
Map<?, ?> map = (Map<?, ?>) object;
5860
fields.putObject("keys", map.keySet().toArray());
5961
fields.putObject("values", map.values().toArray());
6062
} else if (object instanceof UUID) {
@@ -91,13 +93,15 @@ public <T> T newInstance(Class<T> type) {
9193
@Override
9294
public void deserialize(Object object, Fields fields) throws StreamCorruptedException {
9395
try {
94-
if (object instanceof Collection<?> collection) {
96+
if (object instanceof Collection<?>) {
97+
Collection<?> collection = (Collection<?>) object;
9598
Object[] values = fields.getObject("values", Object[].class);
9699
if (values == null)
97100
throw new StreamCorruptedException();
98101
collection.addAll((Collection) Arrays.asList(values));
99102
return;
100-
} else if (object instanceof Map<?, ?> map) {
103+
} else if (object instanceof Map<?, ?>) {
104+
Map<?, ?> map = (Map<?, ?>) object;
101105
Object[] keys = fields.getObject("keys", Object[].class), values = fields.getObject("values", Object[].class);
102106
if (keys == null || values == null || keys.length != values.length)
103107
throw new StreamCorruptedException();

0 commit comments

Comments
 (0)