Comments (1)
After a hour puzzling, I puzzled it out.
At line 2372 of source/World.cpp:
if (NoCaseCompare((*itr)->GetName().substr(0, a_Text.length()), a_Text) != 0)
Say, GetName() returns cheesedummy10 and a_Text was che (2 chars) [0,1,2]
The comparison returns true as - in a_Text, the length 0 to 3 (substr(0, a_Text.length()) which is che is in cheesedummy10. Hooray.
However. If a_Text was hello che (8 chars) [0,1,2,3,4,5,6,7,8]
The comparison returns false as - substring 0 - 9 is hello che which is not in cheesedummy10
How to fix. Iterate the start position of the substring search, so:
if substr(0, a_Text.length()) is false do //hello che
if substr(1, a_Text.length()) //ello che
...
if substr(6, a_Text.length()) //che - yay!
Yay, the substring matches the original. Not sure how the code looks for multiple matches (che will appear in both cheesedummy10 and cheese) but don't forget to replace che in the original string with the full player name.
Presumably this is the same for Plugin Commands matches at line 1342 of source/PluginManager.cpp.
Evidently, I don't want to try my hand at iterators so I hope this info will motivate someone with moar coding XPs to do it. :P
from cuberite.
Related Issues (20)
- 内存回收的问题
- 是否有计划的添加基岩版协议的支持?【Are there plans to add support for the Bedrock Edition protocol?】 HOT 4
- Shift-clicking within a cLuaWindow does not resend player inventory if the OnClicked callback calls CloseWindow HOT 1
- If the player picks up armor while within a chest GUI, the armor won't be rendered
- Feature request: Lua hooks for clicks in the player inventory
- Can't craft a boat in client 1.8.9
- 无法下载服务端 HOT 1
- Players Become Invisible after Teleportation
- Add ARMel builds
- [Building] What's the first GCC version which supports C++17? HOT 1
- Mining bedrock with packetmine drops bedrock. HOT 4
- How offline players join the server HOT 1
- cRoot:ForEachPlayer does not report players that haven't been spawned yet HOT 2
- tnt无法设置为none
- Crash on startup (Segmentation fault) on OpenWRT mips HOT 7
- PPC64 server seems to be unable to handle player XYZ? HOT 2
- Website download page windows does not work HOT 2
- Taking damage on TP HOT 4
- Download Is Unavailable
- One question
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cuberite.