Skip to content

Commit

Permalink
update (#51)
Browse files Browse the repository at this point in the history
* Reduce memory usage, phase 2 (Zlib) (Nukkit#1790)

* Small improvement for Zlib

* Rearrange

* Test class for Zlib

* Fix Bug HostName Transfer 

 logged out due to Transferred to 43.xxx.xx.xx/43.xx.xx.xx:12345:12345

-.-

* Bug Report Feature

* Add the support to change Apply Effect in PotionApplyEvent (Nukkit#1811)

* Fixed furnaces crafting bug and more stoneware. Fixed Nukkit#1770

* Add the support to change Apply Effect in PotionApplyEvent.

* Fix for Issue Nukkit#1795, non-arrow projectiles should not cause damage.

* Fix for Issue Nukkit#1795: Non-arrow projectiles should not cause damage.

* Fixed mmethod access and annotation.

* Fix for issue Nukkit#1817 -- main thread stuck (rollback Zlib)

* MINECARTS available. Enjoy riding minecarts! (Nukkit#1763)

* Minecart can move!

* Minecart friendly clazz

* Removed unused SetEntityLink....

* Some missing pieces

* Add files via upload

* Small piece to move vehicle

Buggy but works

* Fix player position.

Thank you @Snake1999 for new Entity Data from 1.0 branch
(DATA_RIDER_SEAT_POSITION)

* Add minecart movement on move packet

* Some fix when colliding minecart

Still buggy but player wont bounced away
Track logic for buggy rails
new API on Entity

* Woops

* Fix entity data

Wrong entity data riding seat position :P.
New Rail Abstract
Mobs will dismount vehicle if vehicle is dead

* Time to go rouge

Fix MinecartTNT (exploded non stop)
Minecart can now have new display block!
New packet from @Creeperface01

* FIX

* Minecart collides better than before!

Huge minstake! Problem solved
Minecart moves -1 when not on rail not solved yet. todo
:+1:

* Minecart are now Stable!

Fixed minecart yaw
Fix glitch on minecart
Minecart will be on the ground when off rail!
Who made the wrong Network Id? (TNT)
Implements @yescallop rails

* Rearrange

* Revert

* Removed boolean that i forget to remove

* Working on Powered Rails

Detector rail should detect minecarts.
Code format.
Events for Vehicle
Fixed weird riding?
Still WIP

* Some addons

Minecart will fall down
Fixed Minecart items drops
Powered rail might fixed

* Unique update!

Added Interaction features
Added flying features
A permanent fix for glitch minecarts
Block powered rail can flow
Enum class for Minecart variants
Fix weird riding experience
Fix minecart placement
Fix Mine-TNT not exploding after load world
Now you can play with events
Rewrite Entity class
Renamed fields to suitable name
Rewrite Minecart movement code

* Rewrite riding position

The last events in this class

* Powered Rails now works very well

Fixed rolling amplitude
Riding position rewrite (Not tested yet)
Interaction will interact much better

* Fixes rider position, and minecart hit

* Final upload

Fix false rail orientation
Fix minecart yaw
Moved mount entity into vehicle
Boats now working 👍

* Fix powered rail

* Update BlockRailActivator.java

* Fixed typo, nonstandard naming, removed redundant codes in Minecart Update (Nukkit#1829)

* Fixed typo, nonstandard naming, removed redundant codes

* Revert: A couple of vehicle events

* Add a construct override for Config (Nukkit#1860)

* Fixed PlayerInventory#setArmorContents (Nukkit#1862)

* Added capability to unblock addresses without a restart (Nukkit#1863)

* Update PardonIpCommand.java

* Final, need testing

* Update SessionManager.java

* Fix motion leak (Nukkit#1855)

* Fix motion leak

* hmm

* huh

* Okay last piece

* Making this thing more sense

* Fix Nukkit#1802 (Nukkit#1804)

* Fixed duplicate dropped item (Nukkit#1823)

It's useless to send 2 times the TakeItemEntityPacket, because it is already sending it to every viewers of the entity which is the dropped item.

* repair the problem that command.isRegistered always false (Nukkit#1832)

* Add Yivesmirror to README.md. Close Nukkit#1876

* improvements (Nukkit#1834)

* improvements

* add returns to setters, stairs collision

* fast fix for crafting (Nukkit#1882)

* final fix for crafting (Nukkit#1884)

* fixed crafting with classic UI

* Final fix

* Fixed entities a bit (Nukkit#1892)

* Fix issue when attempt to register block entity by plugin (Nukkit#1897)

* Make Angle region independent (Nukkit#1896)

* Allows for the log level to be changed (Nukkit#1908) Close Nukkit#1869

* Update README.md

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

* Revert "Fix for issue Nukkit#1817 -- main thread stuck (rollback Zlib)" (Nukkit#1851)

* Fixed mistake made in commit 410e127 (Nukkit#1923)

* Update to version 1.2 (Nukkit#1912)

* Added tripwire hook, hopper, redstone mechanics saving, various improvements

* recipes

* its not necessary

* Fixed cocoa beans

* Fixed growing

* blame refactor

* Ops

* Fixed some player IDs

* Fixed chunk loading, getSafeSpawn()

* Players shouldn't pass through carpets

* remove debug

* Some vanilla features (eating, breaking sounds)

* add Event for pressureplates

* add chest sounds

* Fix crash

* improvements

* update

* update

* update

* add returns to setters, stairs collision

* Update to 1.2 (Part 1)

* Clean up byte castings in inventory packets

* Join crash fixed. Chunks still corrupted (#44)

* Some new StartGamePacket fields

* Some new packets

ModalForm is the coolest one, I think :D

* It seems that chunk light should not send

* Do not send BlockLight

* Do not send blockLight

* Do not send light

* Packets cleanup and fix

* Revert local world breaking changes

* Fix corrupted chunks

* Bump protocol version to 131

* Some protocol changes

* Fix player's no gravity

* hm hm hm

* Fix being unable to show ModalForms (#49)

* new blocks, fixed boat (#48)

* Fix stained glass pane (#51)

* Small block fix (#53)

* New Updates from pmmp (#52)

* New Updates from pmmp

pmmp/PocketMine-MP@3ad1b1b

* packets

* blockentity

* invetory

* ModalForms API (#54)

Create them with player.showFormWindow, and then listen to the result with PlayerFormRespondedEvent

* It should return windows id (#55)

* Opraven crafting atd..

* Fix #57 - Commands show now (Nukkit#63)

* Fix #57 - Commands show now

* Fix build

* Fix Interact/BlockPlace/Break Events not being called (Nukkit#64)

* Fix #59 - InteractEvent now working

(BlockBreak and BlockPlace still work for me even without changes)

* Fix build

* Fix wrong values

* There was not any error

* ops

* inventory size

* fixed form windows a bit

* let's make it protected

* Use Gson parsing

* crafting fix

* ops

* fixed update block packet

* wtf

* some fixes

* rewrote transaction packet handling (from PMMP)

* Fixed inventory

* fixed update block packet! (idk how :D )

* fixed buttons image, formatting

* fix example config

* fix example config

* fix item dropping

* some improvements from PMMP

* fixed entity IDs

* more adventure settings

* Merge remote-tracking branch 'remotes/origin/master1.2' into GT1.2

# Conflicts:
#	src/main/java/cn/nukkit/Player.java
#	src/main/java/cn/nukkit/inventory/CraftingManager.java
#	src/main/java/cn/nukkit/inventory/PlayerInventory.java
#	src/main/java/cn/nukkit/math/Angle.java
#	src/main/java/cn/nukkit/network/protocol/ProtocolInfo.java
#	src/main/java/cn/nukkit/utils/Utils.java

* Fix Floating Text Particle

* still crashes

* random fixes and additions from PMMP

* Small fix of String.equals in ElementButtonImageData.

* Maybe fix Joining server crashed and "Disconnecting from Server"

* Oops..

* Improved brewing and added fuel

* Ops

* Add fuel to spawn nbt

* Support PlayerSettings FormWindow

* Fix Projectile Items.

* Broadcast LevelSoundEventPacket, More sounds!

* Add PlayerBlockPickEvent + eating sounds

* Fix splash potion type

* Better method

* Repair BossBar, add old title methods for better compatibility (#19)

* Make old plugins working on this Nukkit

* Forgot these imports

* Who did invent this?

* Back to how this should be

* Forgot this

* add fortune

* Fixed sounds, signs, block picking

* New DummyBossBar API! And it's compatible with the old API.

* Oops...

* fixed items with compound tag, added client side anvil support

* Client-side enchant support, need add some API

* maybe better than nothing

* Fixed upload/download updating

* Default no cape in a new Skin, fix NPE in PlayerListPacket (NPC).

* Fix Crafting, ArgTypes + ProtocolVersion (#24)

* Fix NPE

* Fix Arg types

* Change byte to int type

Because byte can handle values from -127 to 127, so we need now something bigger.

* Update it for MCPE 1.2.1

* Debug crafting

* Revert Debug

* Hmm

* Ignore check for Crafting

* Fix build

* Arrrrrgh

* Do pr... se mnou

* Step forward

* Do not check items

* Remove items from where they are

* Remove this debug

* set chunk changed

* small changes

* Big crafting is still buggy,

* add Server settings request event

* ops

* Fix Nukkit sometimes getting wrong Recipe ID (#28)

* Make getResultByOutput working

* Ban this from happening

* Kind of backup here

* Fix

* Debug

* Hm

* Remove it

* Add possibility to write books (#29)

* Add Book & Quill + WrittenBook

Book & Quill and the whole writing of books are TODO

* Create ItemBookWritten.java

* Better have ItemBookWritten than ItemWrittenBook

* More constructors

* Add getPages method

* Load creative items from json

* fix

* Fixed client-side item movement handling

* EaseCation.net

* Careless? Multiple equipItem and call event two times.

* Fix AdventureSettings not works! WFT we forgot reset() (put packet ID!!!!!!)

* Remove old messageQueue, add player.sendChat()

* Changed ArrayList to List

* Allow plugins to change players view distance

* Fixed stained glass pane

* Fixed teleport during process movement

* Fixed double chest inventory

* Update version

* don't pickup items in spectator mode

* reverted eating sounds

* Support Damage Absorption!

* Funny😂, add Player.showXboxProfile

* Fixed flowerpot item conversion

* Fix some logical error in ElementSlider.

* Fix no sound when opening ender chest.

* Fix no any sounds when closing an ender chest.

* Daily enhancement on form (GUI) system 2017/10/13

* FormWindow interpret: This variable is used for JSON import operations. Do NOT delete :) -- @Snake1999

* Don't forget reset() in DataPacket#encode

* Change EntityInteractable from extends to interface.

* Move EntityVehicle#collidingWith to interface to solve the problem of some custom entities.

* AdventureSettingsPacket show broadcast, fix setAllowModifyWorld.

* Fix Take Item animation

* Fix title upgrade of Dummy boss bar

* Use method for entity IDs

* Fixed sleeping bugs and optimized the bed's notices.

* Restoring the DummyBossBar Entity is visible

* use String::isEmpty()

* Fixed item sending in in double chest inventory

* Add serverId in UnconnectedPong Packet

* Added jukebox

* Make it public

* Full Pong result information: MOTD, Sub MOTD and default gamemode.
But... But they do not seem to work... Let it go :D

* Fixed PlaySoundPacket, temporarily removed music discs

* Strange careless of showXboxProfile

* Teleport with pitch.

* Support fast equip armor by right click on hand

* Improved ClientChainData

* Fixed armor equip

* The xbox info will be show in the player list.

* Fixed some incorrect command messages.

* A hack to solve the client-side teleporting bug! (inside into the block)

* Init the server sub-motd.

* If the player is a spectator, when received InventoryTransferPacket, we need calling events with canceled instead of breaking;

* Fix Logging (#45)
  • Loading branch information
Creeperface01 authored Nov 13, 2017
1 parent 959af73 commit 3af3eba
Show file tree
Hide file tree
Showing 350 changed files with 14,523 additions and 6,223 deletions.
6 changes: 5 additions & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ Nukkit will create a bug report for EVERY exception and error detected, and ther

In the report, you can see if the error is caused by Nukkit or a plugin. However, when "PLUGIN ERROR" is "false" and there are plugins running, it does not necessarily indicates that the error is caused by Nukkit.

While sending issues, please provide **as much information as you could**, or our developers might got stuck or confused when looking into your issue.
To sumbit bugs and problems, please upload the automaticly generated report. Make sure you have filled in all blanks in the template. Please provide **as much information as you could**, or our developers might got stuck or confused when looking into your issue.

To submit feature requests and suggestions, please explicitly describe the feature you want or your suggestion.

**Note that the Issues section on GitHub is not for contents that are not related to the two categories listed above. Irrelevant issues will be closed. Please visit our forums for other kinds of discussions.**

Example
---
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ It has a few key advantages over other server software:

Nukkit is **under improvement** yet, we welcome contributions.

Example servers running Nukkit
--------------------
- **play.EaseCation.net**
- **play.GameTeam.cz**
- **MultiLabs.net**

Get Nukkit & Plugins
--------------------

Expand All @@ -49,6 +55,7 @@ Get Nukkit & Plugins
*These sites are provided by our users, Nukkit staff are not responsible for the reliability of these sites. Jar files downloaded here are only for reference - to try the latest update or for commercial uses, compile by yourself.*

* __[Jenkins by MengCraft](http://ci.mengcraft.com:8080/job/Nukkit/lastSuccessfulBuild/)__ (**UNOFFICIAL**)
* __[Yivesmirror](https://yivesmirror.com/downloads/nukkit)__ (**UNOFFICIAL**)

Build JAR file
-------------
Expand All @@ -74,6 +81,10 @@ There're some tools for Nukkit developers.
* __[FDevTools](https://github.com/fengberd/FDevTools)__ (**Load source and pack them easily**)
* __[PocketServer](https://github.com/fengberd/MinecraftPEServer)__ (**Run Nukkit on android devices**)

Contributing
------------
Please read the [CONTRIBUTING](https://github.com/Nukkit/Nukkit/blob/master/.github/CONTRIBUTING.md) guide before submitting any issue. Issues with insufficient information or in the wrong format will be closed and will not be reviewed.

Discussion
-------------
* __[Forums](https://forums.nukkit.io)__
Expand Down
48 changes: 48 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,54 @@
<dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation>
</configuration>
</plugin>
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>get-the-git-infos</id>
<goals>
<goal>revision</goal>
</goals>
</execution>
</executions>

<configuration>
<dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
<prefix>git</prefix>
<dateFormat>dd.MM.yyyy '@' HH:mm:ss z</dateFormat>
<dateFormatTimeZone>${user.timezone}</dateFormatTimeZone>
<verbose>true</verbose>
<generateGitPropertiesFile>true</generateGitPropertiesFile>
<generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties
</generateGitPropertiesFilename>
<format>properties</format>
<skipPoms>true</skipPoms>
<injectAllReactorProjects>false</injectAllReactorProjects>
<failOnNoGitDirectory>false</failOnNoGitDirectory>
<failOnUnableToExtractRepoInfo>false</failOnUnableToExtractRepoInfo>
<skip>false</skip>
<runOnlyOnce>true</runOnlyOnce>
<excludeProperties>
<excludeProperty>git.user.*</excludeProperty>
</excludeProperties>
<includeOnlyProperties>
</includeOnlyProperties>
<useNativeGit>false</useNativeGit>
<abbrevLength>7</abbrevLength>
<commitIdGenerationMode>flat</commitIdGenerationMode>
<gitDescribe>
<skip>false</skip>
<always>false</always>
<abbrev>7</abbrev>
<dirty>-dirty</dirty>
<match>*</match>
<tags>false</tags>
<forceLongFormat>false</forceLongFormat>
</gitDescribe>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
173 changes: 47 additions & 126 deletions src/main/java/cn/nukkit/AdventureSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

import cn.nukkit.network.protocol.AdventureSettingsPacket;

import java.util.EnumMap;
import java.util.Map;

/**
* Nukkit Project
* Author: MagicDroidX
Expand All @@ -14,27 +17,12 @@ public class AdventureSettings implements Cloneable {
public static final int PERMISSION_AUTOMATION = 3;
public static final int PERMISSION_ADMIN = 4;

private boolean canDestroyBlock = true;

private boolean autoJump = true;

private boolean canFly = false;

private boolean flying = false;

private boolean noclip = false;

private boolean noPvp = false;

private boolean noPvm = false;

private boolean noMvp = false;

private boolean muted = false;
private Map<Type, Boolean> values = new EnumMap<>(Type.class);

private Player player;

private AdventureSettings() {
public AdventureSettings(Player player) {
this.player = player;
}

public AdventureSettings clone(Player newPlayer) {
Expand All @@ -47,129 +35,62 @@ public AdventureSettings clone(Player newPlayer) {
}
}

public void setCanDestroyBlock(boolean canDestroyBlock) {
this.canDestroyBlock = canDestroyBlock;
}

public void setAutoJump(boolean autoJump) {
this.autoJump = autoJump;
}

public void setCanFly(boolean canFly) {
this.canFly = canFly;
public AdventureSettings set(Type type, boolean value) {
this.values.put(type, value);
return this;
}

public void setFlying(boolean flying) {
this.flying = flying;
}

public void setNoclip(boolean noclip) {
this.noclip = noclip;
}

public void setNoPvp(boolean noPvp) {
this.noPvp = noPvp;
}

public void setNoPvm(boolean noPvm) {
this.noPvm = noPvm;
}

public void setNoMvp(boolean noMvp) {
this.noMvp = noMvp;
}

public void setMuted(boolean muted) {
this.muted = muted;
}

public boolean canDestroyBlock() {
return canDestroyBlock;
}
public boolean get(Type type) {
Boolean value = this.values.get(type);

public boolean isAutoJumpEnabled() {
return autoJump;
}

public boolean canFly() {
return canFly;
}

public boolean isFlying() {
return flying;
}

public boolean isNoclipEnabled() {
return noclip;
}

public boolean isNoPvp() {
return noPvp;
}

public boolean isNoPvm() {
return noPvm;
}

public boolean isNoMvp() {
return noMvp;
}

public boolean isMuted() {
return muted;
return value == null ? type.getDefaultValue() : value;
}

public void update() {
AdventureSettingsPacket pk = new AdventureSettingsPacket();
pk.flags = 0;
pk.worldImmutable = !canDestroyBlock;
pk.autoJump = autoJump;
pk.allowFlight = canFly;
pk.noClip = noclip;
pk.isFlying = flying;
pk.noPvp = noPvp;
pk.noPvm = noPvm;
pk.noMvp = noMvp;
pk.muted = muted;
pk.userPermission = (this.player.isOp() ? PERMISSION_OPERATOR : PERMISSION_NORMAL);
player.dataPacket(pk);

player.resetInAirTicks();
}

public static class Builder {
private final AdventureSettings settings = new AdventureSettings();

public Builder(Player player) {
if (player == null) {
throw new IllegalArgumentException("Player can not be null.");
}

settings.player = player;
for (Type t : Type.values()) {
pk.setFlag(t.getId(), get(t));
}

public Builder canFly(boolean can) {
settings.canFly = can;
return this;
}
pk.commandPermission = (player.isOp() ? AdventureSettingsPacket.PERMISSION_OPERATOR : AdventureSettingsPacket.PERMISSION_NORMAL);
pk.playerPermission = (player.isOp() ? Player.PERMISSION_OPERATOR : Player.PERMISSION_MEMBER);
pk.entityUniqueId = player.getId();

public Builder noclip(boolean noclip) {
settings.noclip = noclip;
return this;
}
Server.broadcastPacket(Server.getInstance().getOnlinePlayers().values(), pk);

player.resetInAirTicks();
}

public Builder canDestroyBlock(boolean can) {
settings.canDestroyBlock = can;
return this;
public enum Type {
WORLD_IMMUTABLE(AdventureSettingsPacket.WORLD_IMMUTABLE, false),
AUTO_JUMP(AdventureSettingsPacket.AUTO_JUMP, true),
ALLOW_FLIGHT(AdventureSettingsPacket.ALLOW_FLIGHT, false),
NO_CLIP(AdventureSettingsPacket.NO_CLIP, false),
WORLD_BUILDER(AdventureSettingsPacket.WORLD_BUILDER, true),
FLYING(AdventureSettingsPacket.FLYING, false),
MUTED(AdventureSettingsPacket.MUTED, false),
BUILD_AND_MINE(AdventureSettingsPacket.BUILD_AND_MINE, true),
DOORS_AND_SWITCHED(AdventureSettingsPacket.DOORS_AND_SWITCHES, true),
OPEN_CONTAINERS(AdventureSettingsPacket.OPEN_CONTAINERS, true),
ATTACK_PLAYERS(AdventureSettingsPacket.ATTACK_PLAYERS, true),
ATTACK_MOBS(AdventureSettingsPacket.ATTACK_MOBS, true),
OPERATOR(AdventureSettingsPacket.OPERATOR, false),
TELEPORT(AdventureSettingsPacket.TELEPORT, false);

private final int id;
private final boolean defaultValue;

Type(int id, boolean defaultValue) {
this.id = id;
this.defaultValue = defaultValue;
}

public Builder autoJump(boolean autoJump) {
settings.autoJump = autoJump;
return this;
public int getId() {
return id;
}

public AdventureSettings build() {
return this.settings;
public boolean getDefaultValue() {
return this.defaultValue;
}
}
}
33 changes: 32 additions & 1 deletion src/main/java/cn/nukkit/Nukkit.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@

import cn.nukkit.command.CommandReader;
import cn.nukkit.network.protocol.ProtocolInfo;
import cn.nukkit.utils.LogLevel;
import cn.nukkit.utils.MainLogger;
import cn.nukkit.utils.ServerKiller;

import java.util.Arrays;
import java.util.Set;
import java.util.stream.Collectors;

/**
* `_ _ _ _ _ _
* | \ | | | | | | (_) |
Expand Down Expand Up @@ -50,16 +55,42 @@ public static void main(String[] args) {
}
}

LogLevel logLevel = LogLevel.DEFAULT_LEVEL;
int index = -1;
boolean skip = false;
//启动参数
for (String arg : args) {
index++;
if (skip) {
skip = false;
continue;
}

switch (arg) {
case "disable-ansi":
ANSI = false;
break;

case "--verbosity":
case "-v":
skip = true;
try {
String levelName = args[index + 1];
Set<String> levelNames = Arrays.stream(LogLevel.values()).map(level -> level.name().toLowerCase()).collect(Collectors.toSet());
if (!levelNames.contains(levelName.toLowerCase())) {
System.out.printf("'%s' is not a valid log level, using the default\n", levelName);
continue;
}
logLevel = Arrays.stream(LogLevel.values()).filter(level -> level.name().equalsIgnoreCase(levelName)).findAny().orElse(LogLevel.DEFAULT_LEVEL);
} catch (ArrayIndexOutOfBoundsException e) {
System.out.println("You must enter the requested log level, using the default\n");
}

}
}

MainLogger logger = new MainLogger(DATA_PATH + "server.log");
MainLogger logger = new MainLogger(DATA_PATH + "server.log", logLevel);
System.out.printf("Using log level '%s'\n", logLevel);

try {
if (ANSI) {
Expand Down
Loading

0 comments on commit 3af3eba

Please sign in to comment.