Skip to content

Commit

Permalink
Update to version 1.2 (Nukkit#1912)
Browse files Browse the repository at this point in the history
* 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 and Snake1999 committed Oct 30, 2017
1 parent eed04a5 commit b04061b
Show file tree
Hide file tree
Showing 290 changed files with 11,575 additions and 4,566 deletions.
6 changes: 6 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 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;
}
}
}
Loading

0 comments on commit b04061b

Please sign in to comment.