O'Reilly logo

A Beginner’s Guide to Writing Minecraft Plugins in JavaScript by Walter Higgins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 14. Animal Sounds Revisited

In this chapter, you’ll revisit the Animal Sounds plugin from earlier, but this time, instead of using a switch statement, you’ll use a lookup table.

Objects

It’s time to take a closer look at objects. An object in JavaScript is something that can hold both data and functions. You’ve already been using objects throughout this book. You used the console object to log messages to the Minecraft server log and console window. You used the exports object to provide new properties and functions for others to use. You used array objects to sort arrays with sort(). Last but not least, you used some of Minecraft’s built-in objects such as Player and Event to respond to events that happen in the game.

Objects are useful ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required