Comments (2)
That's an easy one... in MobPlugin.onCommand() method under case "spawn"
the first line is String mob = args[1];
But nothing in the previous code ever verified there actually is an args[1] - only args[0] is checked.
from mobplugin.
Super simple fix would be to add:
if (args.length == 1) { commandSender.sendMessage("/mob spawn <mob> <opt:player> - Spawn a mob"); break; }
right at the beginning of case "spawn"
to give them a syntax hint and avoid the outofbounds error.
But that fix ignores all the other potential failure cases when a user enters a /mob command. And speaking in more general terms, it's going to be a difficult to read switch case as you add more commands later.
It may be better to move the code block that gives the player the proper syntax for /mob commands into it's own method. Then have the various cases in MobPlugin.onCommand(), including default, call that method if they run into cases where args[0] is not a valid command or args.length is not the correct size for the command.
And you may even consider moving the code for each switch case into their own methods for readability reasons.
from mobplugin.
Related Issues (20)
- Feature Request (Allay) HOT 1
- mobs from nether die in lava HOT 1
- Mobs Despawn Quickly HOT 2
- PowerNukkitX crashes on login with V1.22.1 HOT 2
- the horse jumps on the water, although this should not be
- watcher and zoglin die in lava
- the lava cube does not change in size correctly after splitting
- Return To Sender
- the saddle does not fall off the ground after death
- No Trading
- Error Log - Unknown Issue HOT 3
- Mobs jumping / Creeper moving when it can't HOT 2
- Some Kind Of Error HOT 1
- VILLAGERS AI AND SPAWN
- MobPlugin 1.25.2 Bug the skeleton does not shoot with bow the file would be blocked and the skeleton shoots too fast and the chicken flaps its wings on the ground when it runs HOT 1
- sometimes all hostile mobs ai does not target the player and ignores them
- MobPlugin Cannot Be Moved To "plugins" Folder HOT 1
- Mob Jumping HOT 1
- Hostile Mob Tracking
- Monsters Running Away HOT 1
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 mobplugin.