Minecraft BE server development from PHP to Java

Introduction

This is an article about server development for Minecraft BE (formerly PE). When we move development from PocketMine to Nukkit, the programming language changes from PHP to Java. I tried to summarize the differences between PHP and Java with a grammar that I often use personally so that I can develop it as soon as possible even if the programming language changes.

variable

It is a variable that is often used, but in Java, ** type ** is written before the variable name. In PHP, you may have written it in the argument etc.

variable


//Type name Variable name
int number = 334;

For the type, you can write the name of the class that implements the value (334 in this case) and the name of the class that the class inherits or implements. So when it comes to creating a class and assigning that object to a variable

class Player{
}
Player player = new Player();

It will be written like this.

Array

Java arrays are not as flexible as php. Put the determined number and put the objects of the same type.

Array


int[] array = new int[3];
array[0] = 0;
array[1] = 1;
array[2] = 2;
System.out.println(array[1]); // 1

The above can be shortened.

int[] array = new int[3]{1,2,3};
System.out.println(array[1]); // 1

List,Map In php I was able to assign a lot of objects to an array. In Java you can do the same with Lists and Maps.

ArrayList,Map


ArrayList<Integer> list = new ArrayList<Integer>(); // List
HashMap<Integer,Integer> map = new HashMap<Integer,Integer>(); // Map

In List and Map, a type called reference type is assigned. Most reference types start with an uppercase letter.

Summary

It looks like only the words are lined up, but I'd be happy if you could think that there is something like this. You will be happy to know the reference types and primitive types!

Recommended Posts

Minecraft BE server development from PHP to Java
Java to be involved from today
From installing Eclipse to executing Java (PHP)
Changes from Java 8 to Java 11
Sum from Java_1 to 100
Migrate from Java to Server Side Kotlin + Spring-boot
From Java to Ruby !!
Java development for beginners to start from 1-Vol.1-eclipse setup
Generate models from JSON to Swift, PHP, C #, JAVA
[Java] Platforms to choose from for Java development starting now (2020)
Migration from Cobol to JAVA
New features from Java7 to Java8
Connect from Java to PostgreSQL
From Ineffective Java to Effective Java
From Java to VB.NET-Writing Contrast Memo-
Java, interface to start from beginner
The road from JavaScript to Java
[Java] Conversion from array to List
Notes on building Kotlin development environment and migrating from Java to Kotlin
[Java] How to retrieve the parameters passed from html on the server side
Convert from java UTC time to JST time
Connect from Java to MySQL using Eclipse
Post to Slack from Play Framework 2.8 (Java)
Java: How to send values from Servlet to Servlet
[Java] Flow from source code to execution
Get history from Zabbix server in Java
Introduction to monitoring from Java Touching Prometheus
Precautions when migrating from VB6.0 to JAVA
Memo for migration from java to kotlin
Type conversion from java BigDecimal type to String type
Access protected fields from grandchildren (Java / PHP)
If a person from Java learns PHP
Summarize the life cycle of Java objects to be aware of in Android development
Learn while making a WEB server Introduction to WEB application development from the basics
[Java] From two Lists to one array list
Upsert from Java SDK to Azure Cosmos DB
Run R from Java I want to run rJava
Things to be aware of when writing Java
POST images from Android to PHP using Retrofit
Java Development Basics ~ How to Write Programs * Exercise 1 ~
Connect to Aurora (MySQL) from a Java application
To become a VB.net programmer from a Java shop
CORBA seems to be removed in Java SE 11. .. ..
How to get Class from Element in Java
Migrating from Eclipse server function (Tomcat) to Embed Tomcat
[Java] How to switch from open jdk to oracle jdk
Ubuntu18.04 LTS minecraft server java edition construction memorandum
I want to write quickly from java to sqlite
Site summary to be helpful in Minecraft modding 1.12.2
[Java] char type can be cast to int type
Kotlin's reified function cannot be called from java.
Select * from Java SDK to Azure Cosmos DB
Java development training
[Android development] Get an image from the server in Java and set it in ImageView! !!
[Java development] Java memory
Java development environment
[Java] Introduction to Java
Introduction to java
[Java] [SQL Server] Connect to local SQL Server 2017 using JDBC for SQL Server
Minecraft BE Tap with a wooden sword to jump
Tomcat cannot be started due to java version change