Skip to content

Commit 4e83ace

Browse files
committed
Rename methods
1 parent 9dd3f30 commit 4e83ace

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

bukkit/src/main/java/io/wdsj/asw/bukkit/util/context/ChatContext.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public static Deque<String> getHistory(Player player) {
3030
return tsHistory.stream()
3131
.filter(timedString -> (System.currentTimeMillis() - timedString.getTime()) / 1000 < settingsManager.getProperty(PluginSettings.CHAT_CONTEXT_TIME_LIMIT))
3232
.map(TimedString::getString)
33-
.collect(ArrayDeque::new, ArrayDeque::add, ArrayDeque::addAll);
33+
.collect(ArrayDeque::new, ArrayDeque::offerLast, ArrayDeque::addAll);
3434
}
3535

3636
public static void clearPlayerContext(Player player) {

bukkit/src/main/java/io/wdsj/asw/bukkit/util/context/SignContext.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public static Deque<String> getHistory(Player player) {
3030
return tsHistory.stream()
3131
.filter(timedString -> (System.currentTimeMillis() - timedString.getTime()) / 1000 < settingsManager.getProperty(PluginSettings.SIGN_CONTEXT_TIME_LIMIT))
3232
.map(TimedString::getString)
33-
.collect(ArrayDeque::new, ArrayDeque::add, ArrayDeque::addAll);
33+
.collect(ArrayDeque::new, ArrayDeque::offerLast, ArrayDeque::addAll);
3434
}
3535

3636
public static void clearPlayerContext(Player player) {

common/src/main/java/io/wdsj/asw/common/datatype/TimedString.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,39 @@ private TimedString(String str, long time) {
2626
this.time = time;
2727
}
2828

29+
/**
30+
* Returns the string.
31+
* @return the string
32+
*/
2933
public String getString() {
3034
return str;
3135
}
3236

37+
/**
38+
* Returns the timestamp.
39+
* @return the timestamp
40+
*/
3341
public long getTime() {
3442
return time;
3543
}
3644

45+
/**
46+
* Returns a new TimedString instance.
47+
* @param str the string
48+
* @param time the timestamp
49+
* @return a new TimedString instance
50+
*/
3751
public static TimedString of(String str, long time) {
3852
Objects.requireNonNull(str, "String cannot be null");
3953
if (time < 0) throw new IllegalArgumentException("Time cannot be negative");
4054
return new TimedString(str, time);
4155
}
4256

57+
/**
58+
* Returns a new TimedString instance with the current timestamp.
59+
* @param str the string
60+
* @return a new TimedString instance
61+
*/
4362
public static TimedString of(String str) {
4463
return of(str, System.currentTimeMillis());
4564
}

0 commit comments

Comments
 (0)