File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
src/me/crafter/mc/lockettepro Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -99,8 +99,19 @@ public void onManualLock(SignChangeEvent event){
99
99
if (event .getBlock ().getType () != Material .WALL_SIGN ) return ;
100
100
String topline = event .getLine (0 );
101
101
Player player = event .getPlayer ();
102
+ /* Issue #46 - Old version of Minecraft trim signs in unexpected way.
103
+ * This is caused by Minecraft was doing: (unconfirmed but seemingly)
104
+ * Place Sign -> Event Fire -> Trim Sign
105
+ * The event.getLine() will be inaccurate if the line has white space to trim
106
+ *
107
+ * This will cause player without permission will be able to lock chests by
108
+ * adding a white space after the [private] word.
109
+ * Currently this is fixed by using trimmed line in checking permission. Trimmed
110
+ * line should not be used anywhere else.
111
+ */
102
112
if (!player .hasPermission ("lockettepro.lock" )){
103
- if (LocketteProAPI .isLockString (topline ) || LocketteProAPI .isAdditionalString (topline )){
113
+ String toplinetrimmed = topline .trim ();
114
+ if (LocketteProAPI .isLockString (toplinetrimmed ) || LocketteProAPI .isAdditionalString (toplinetrimmed )){
104
115
event .setLine (0 , Config .getLang ("sign-error" ));
105
116
Utils .sendMessages (player , Config .getLang ("cannot-lock-manual" ));
106
117
return ;
You can’t perform that action at this time.
0 commit comments