Git Product home page Git Product logo

Comments (1)

tigerw avatar tigerw commented on May 5, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.