Skip to content

Commit 7477b9b

Browse files
committed
Revert "feat(sdk): limit nickname length automatically"
This reverts commit dfbdc24.
1 parent 2a9186f commit 7477b9b

File tree

3 files changed

+2
-29
lines changed

3 files changed

+2
-29
lines changed

engine/core/src/main/java/com/codingame/gameengine/core/AbstractPlayer.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,6 @@ public final String getNicknameToken() {
4141
return "$" + this.index;
4242
}
4343

44-
/**
45-
* Returns a string that will be converted into the real nickname by the viewer.
46-
*
47-
* @param maxLength the maximum amount of characters of the nickname to display.
48-
* If it is longer, an ellipsis will be appended ("...")
49-
*
50-
* @return the player's nickname token.
51-
*/
52-
public final String getNicknameToken(int maxLength) {
53-
if (maxLength <= 0) {
54-
throw new IllegalArgumentException("Invalid width: " + maxLength);
55-
}
56-
return "$" + this.index + "ε" + maxLength;
57-
}
58-
5944
/**
6045
* Returns a string that will be converted into the real avatar by the viewer, if it exists.
6146
*

engine/modules/entities/src/main/resources/view/entity-module/properties.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -99,21 +99,13 @@ export const PROPERTIES = {
9999
...stringOpts,
100100
convert (value, globalData) {
101101
value = unescape(value)
102-
const regexp = /\$(\d)(?:ε(\d+))?/g
102+
const regexp = /\$(\d)/g
103103
let match = regexp.exec(value)
104104
let res = ''
105105
let prevIdx = 0
106106
while (match) {
107107
res += value.substring(prevIdx, match.index)
108-
let name = globalData.players[+match[1]].name
109-
110-
if (match[2] != null) {
111-
const maxChars = +match[2]
112-
if (name.length > maxChars) {
113-
name = name.substring(0, maxChars) + '...'
114-
}
115-
}
116-
res += name
108+
res += globalData.players[+match[1]].name
117109
prevIdx = match.index + match[0].length
118110
match = regexp.exec(value)
119111
}

playground/misc/misc-3-release-notes.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ The CodinGame SDK is regularly updated and improved. This document lets you know
44

55
## Next Release
66

7-
### 🎁 Features
8-
9-
- It is now possible to limit the number of characters display given by `getNicknameToken`.
10-
117
### 🐞 Bug fix
128

139
- Fixed an issue where games with a `stepByStepAnimateSpeed` would sometimes try to animate frame 0, causing a black screen.

0 commit comments

Comments
 (0)