Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gt1.2 #47

Open
wants to merge 210 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
210 commits
Select commit Hold shift + click to select a range
ceaa525
Merge pull request #1 from Nukkit/master
Creeperface01 Mar 31, 2017
181e32a
Merge pull request #2 from Nukkit/master
Creeperface01 Apr 9, 2017
be50287
Merge pull request #4 from Nukkit/master
Creeperface01 May 8, 2017
ffb413c
Added tripwire hook, hopper, redstone mechanics saving, various impro…
Creeperface01 May 15, 2017
8aa47a7
recipes
Creeperface01 May 15, 2017
c80fc3f
its not necessary
Creeperface01 May 15, 2017
1bf48db
Fixed cocoa beans
Creeperface01 May 15, 2017
7a5ceac
Fixed growing
Creeperface01 May 15, 2017
8ca77b5
blame refactor
Creeperface01 May 15, 2017
96e1a69
Ops
Creeperface01 May 16, 2017
21b5de7
Fixed some player IDs
Creeperface01 May 16, 2017
1939ca9
Fixed chunk loading, getSafeSpawn()
Creeperface01 May 17, 2017
9dcc443
Players shouldn't pass through carpets
Creeperface01 May 19, 2017
c4c8c8c
remove debug
Creeperface01 May 20, 2017
637fb3b
Merge remote-tracking branch 'origin/master'
Creeperface01 Jun 4, 2017
11e19f1
Merge branch 'master' of https://github.com/Creeperface01/Nukkit
Creeperface01 Jul 10, 2017
18221f7
Reduce memory usage, phase 2 (Zlib) (#1790)
Snake1999 Jul 11, 2017
611f3ae
Some vanilla features (eating, breaking sounds)
Creeperface01 Jul 12, 2017
1e89587
Fix Bug HostName Transfer
tigerza117 Jul 12, 2017
fa0573a
add Event for pressureplates
Creeperface01 Jul 14, 2017
f11ebc0
Bug Report Feature
NuclearSteven Jul 16, 2017
4eb85cb
add chest sounds
Creeperface01 Jul 21, 2017
d028383
Add the support to change Apply Effect in PotionApplyEvent (#1811)
boybook Jul 23, 2017
be2f3cb
Merge pull request #1800 from tigerza117/patch-8
NuclearSteven Jul 26, 2017
0aa7586
Fix for Issue #1795, non-arrow projectiles should not cause damage.
ScraM-Team Jul 27, 2017
96a0d97
Fix for Issue #1795: Non-arrow projectiles should not cause damage.
ScraM-Team Jul 27, 2017
80696be
Fixed mmethod access and annotation.
ScraM-Team Jul 27, 2017
328fa90
Merge pull request #1820 from ScraM-Team/fix-1795-projectile-damage
Angelic47 Jul 27, 2017
ca9c6c0
Fix for issue #1817 -- main thread stuck (rollback Zlib)
ScraM-Team Jul 30, 2017
4f6f586
Merge pull request #1826 from ScraM-Team/freeze-fix
Angelic47 Jul 30, 2017
81eb29d
MINECARTS available. Enjoy riding minecarts! (#1763)
larryTheCoder Jul 31, 2017
b190802
Fixed typo, nonstandard naming, removed redundant codes in Minecart U…
yescallop Aug 1, 2017
e71ae76
Fix crash
Creeperface01 Aug 1, 2017
a29bb11
Merge pull request #3 from Nukkit/master
Creeperface01 Aug 2, 2017
03b0487
Merge branch 'master' into eating
Creeperface01 Aug 2, 2017
4657ff1
improvements
Creeperface01 Aug 2, 2017
84eff1f
update
Creeperface01 Aug 2, 2017
d6c039f
update
Creeperface01 Aug 2, 2017
a3cfcba
update
Creeperface01 Aug 2, 2017
8f537e3
update
Creeperface01 Aug 2, 2017
8184186
add returns to setters, stairs collision
Creeperface01 Aug 2, 2017
52a53a7
Merge branch 'fixes' of https://github.com/Creeperface01/Nukkit into gt
Creeperface01 Aug 2, 2017
fc5b43a
Update to 1.2 (Part 1)
yescallop Aug 2, 2017
b3b90a5
Clean up byte castings in inventory packets
yescallop Aug 3, 2017
4b5d929
Join crash fixed. Chunks still corrupted (#44)
kvetinac97 Aug 3, 2017
498db2d
Packets cleanup and fix
yescallop Aug 5, 2017
cea3860
Revert local world breaking changes
yescallop Aug 6, 2017
b6354ad
Fix corrupted chunks
yescallop Aug 6, 2017
4fc794e
Bump protocol version to 131
yescallop Aug 6, 2017
204d68e
Some protocol changes
yescallop Aug 6, 2017
cd429b9
Fix player's no gravity
boybook Aug 7, 2017
eb9c726
hm hm hm
Creeperface01 Aug 7, 2017
e282fcc
Fix being unable to show ModalForms (#49)
kvetinac97 Aug 8, 2017
4fd31a7
new blocks, fixed boat (#48)
Creeperface01 Aug 8, 2017
cdb8111
Fix stained glass pane (#51)
Creeperface01 Aug 8, 2017
f9bb327
Small block fix (#53)
PikyXoS Aug 8, 2017
fd33a19
New Updates from pmmp (#52)
PikyXoS Aug 8, 2017
8334fe4
ModalForms API (#54)
kvetinac97 Aug 8, 2017
e33947d
It should return windows id (#55)
Creeperface01 Aug 9, 2017
b7f73ab
Add a construct override for Config (#1860)
fengberd Aug 11, 2017
20409c5
Opraven crafting atd..
Creeperface01 Aug 16, 2017
70a7b5c
Fixed PlayerInventory#setArmorContents (#1862)
Him188 Aug 19, 2017
aef45f8
Added capability to unblock addresses without a restart (#1863)
Aug 20, 2017
366b593
Fix motion leak (#1855)
larryTheCoder Aug 20, 2017
d37c51a
Fix #1802 (#1804)
vzlomka76 Aug 22, 2017
2abb0ee
Fixed duplicate dropped item (#1823)
test-compte Aug 22, 2017
4c78e69
repair the problem that command.isRegistered always false (#1832)
KyoMiko Aug 23, 2017
8dd43f4
Fix #57 - Commands show now (#63)
kvetinac97 Aug 24, 2017
9709878
Fix Interact/BlockPlace/Break Events not being called (#64)
kvetinac97 Aug 24, 2017
9f4a86d
Merge pull request #7 from yescallop/1.2
Creeperface01 Aug 25, 2017
2f7ff28
Merge remote-tracking branch 'origin/1.2' into GT1.2
Creeperface01 Aug 25, 2017
0153849
ops
Creeperface01 Aug 25, 2017
5b04671
Add Yivesmirror to README.md. Close #1876
PeratX Aug 25, 2017
9997eca
improvements (#1834)
Creeperface01 Aug 26, 2017
272e5db
inventory size
Creeperface01 Aug 26, 2017
9172b11
fast fix for crafting (#1882)
Creeperface01 Aug 27, 2017
283abaa
fixed form windows a bit
Creeperface01 Aug 27, 2017
2edcd53
let's make it protected
Creeperface01 Aug 27, 2017
8ea0a44
Use Gson parsing
Creeperface01 Aug 27, 2017
6030b30
crafting fix
Creeperface01 Aug 28, 2017
a1c43f6
ops
Creeperface01 Aug 28, 2017
56d553a
final fix for crafting (#1884)
Creeperface01 Aug 30, 2017
cb574b7
Fixed entities a bit (#1892)
Creeperface01 Sep 5, 2017
1aeacf4
fixed update block packet
Creeperface01 Sep 10, 2017
382c908
wtf
Creeperface01 Sep 10, 2017
2ccf041
some fixes
Creeperface01 Sep 16, 2017
39de211
Fix issue when attempt to register block entity by plugin (#1897)
larryTheCoder Sep 17, 2017
235dd43
Make Angle region independent (#1896)
leNicDev Sep 17, 2017
e901051
rewrote transaction packet handling (from PMMP)
Creeperface01 Sep 17, 2017
a63ba39
Fixed inventory
Creeperface01 Sep 19, 2017
81cfc37
fixed update block packet! (idk how :D )
Creeperface01 Sep 19, 2017
d7ee38b
fixed buttons image, formatting
Creeperface01 Sep 19, 2017
cc29bc0
fix example config
Creeperface01 Sep 19, 2017
860315a
fix example config
Creeperface01 Sep 20, 2017
fb912ac
fix item dropping
Creeperface01 Sep 20, 2017
c818d6a
some improvements from PMMP
Creeperface01 Sep 20, 2017
ba62ada
fixed entity IDs
Creeperface01 Sep 21, 2017
3d4e6c6
more adventure settings
Creeperface01 Sep 21, 2017
1acf687
Merge pull request #13 from Nukkit/master
Creeperface01 Sep 22, 2017
a67d007
Merge remote-tracking branch 'remotes/origin/master1.2' into GT1.2
Creeperface01 Sep 22, 2017
5b96f59
Merge remote-tracking branch 'remotes/origin/master1.2' into GT1.2
Creeperface01 Sep 22, 2017
8b5f54c
Fix Floating Text Particle
Goodstuff4UonYT Sep 22, 2017
72ab7f9
Merge pull request #14 from Goodstuff4UonYT/GT1.2
Creeperface01 Sep 23, 2017
7ea255d
still crashes
Creeperface01 Sep 23, 2017
731b882
random fixes and additions from PMMP
Creeperface01 Sep 23, 2017
c967d7f
Small fix of String.equals in ElementButtonImageData.
boybook Sep 24, 2017
1517012
Merge pull request #18 from boybook/GT1.2
Creeperface01 Sep 24, 2017
c4dbe97
Maybe fix Joining server crashed and "Disconnecting from Server"
boybook Sep 24, 2017
27797dc
Oops..
boybook Sep 24, 2017
a73e671
Improved brewing and added fuel
Creeperface01 Sep 24, 2017
be0ee5b
Ops
Creeperface01 Sep 24, 2017
e76717a
Add fuel to spawn nbt
Creeperface01 Sep 24, 2017
cd3ae72
Support PlayerSettings FormWindow
boybook Sep 24, 2017
5f10e48
Merge remote-tracking branch 'origin/GT1.2' into GT1.2
boybook Sep 24, 2017
8b11813
Fix Projectile Items.
boybook Sep 25, 2017
164b57e
Broadcast LevelSoundEventPacket, More sounds!
boybook Sep 25, 2017
5da1e71
Add PlayerBlockPickEvent + eating sounds
Creeperface01 Sep 25, 2017
09208d3
Merge remote-tracking branch 'origin/GT1.2' into GT1.2
Creeperface01 Sep 25, 2017
28db22d
Fix splash potion type
Creeperface01 Sep 25, 2017
0c39fe6
Better method
Creeperface01 Sep 25, 2017
5e5f6ce
Repair BossBar, add old title methods for better compatibility (#19)
kvetinac97 Sep 26, 2017
9404211
add fortune
Creeperface01 Sep 26, 2017
30d16fa
Merge remote-tracking branch 'origin/GT1.2' into GT1.2
Creeperface01 Sep 26, 2017
cc7a520
Fixed sounds, signs, block picking
Creeperface01 Sep 26, 2017
46bca0d
New DummyBossBar API! And it's compatible with the old API.
boybook Sep 27, 2017
af4f311
Oops...
boybook Sep 27, 2017
68586dc
fixed items with compound tag, added client side anvil support
Creeperface01 Sep 28, 2017
3c4337d
Merge remote-tracking branch 'origin/GT1.2' into GT1.2
Creeperface01 Sep 28, 2017
777a5d6
Client-side enchant support, need add some API
Creeperface01 Sep 29, 2017
5ccf768
maybe better than nothing
Creeperface01 Sep 29, 2017
f57399c
Fixed upload/download updating
Creeperface01 Sep 29, 2017
23c3253
Default no cape in a new Skin, fix NPE in PlayerListPacket (NPC).
boybook Sep 29, 2017
49983d0
Fix Crafting, ArgTypes + ProtocolVersion (#24)
kvetinac97 Sep 30, 2017
3f9bb06
set chunk changed
Creeperface01 Sep 30, 2017
6af5254
Merge remote-tracking branch 'origin/GT1.2' into GT1.2
Creeperface01 Sep 30, 2017
dfc1275
small changes
Creeperface01 Sep 30, 2017
6d669fb
Big crafting is still buggy,
Creeperface01 Sep 30, 2017
e4fb61b
add Server settings request event
Creeperface01 Sep 30, 2017
ec4b58d
ops
Creeperface01 Sep 30, 2017
32e4e4d
Fix Nukkit sometimes getting wrong Recipe ID (#28)
kvetinac97 Sep 30, 2017
0818402
Add possibility to write books (#29)
kvetinac97 Oct 1, 2017
354894a
Load creative items from json
Creeperface01 Oct 1, 2017
75ce3d3
fix
Creeperface01 Oct 1, 2017
eb2687f
Fixed client-side item movement handling
Creeperface01 Oct 1, 2017
9d2e220
EaseCation.net
boybook Oct 1, 2017
1b78b3b
Careless? Multiple equipItem and call event two times.
boybook Oct 1, 2017
9bb3fc5
Allows for the log level to be changed (#1908) Close #1869
dignissimus Oct 2, 2017
99a9e68
Fix AdventureSettings not works! WFT we forgot reset() (put packet ID…
boybook Oct 2, 2017
2c239c7
Remove old messageQueue, add player.sendChat()
boybook Oct 2, 2017
5b8f6a0
Changed ArrayList to List
Creeperface01 Oct 5, 2017
eb7d3a5
Allow plugins to change players view distance
Creeperface01 Oct 5, 2017
028d460
Fixed stained glass pane
Creeperface01 Oct 5, 2017
df1e8af
Fixed teleport during process movement
Creeperface01 Oct 5, 2017
66ff1ef
Fixed double chest inventory
Creeperface01 Oct 5, 2017
a235017
Update version
Creeperface01 Oct 5, 2017
42f5751
don't pickup items in spectator mode
Creeperface01 Oct 5, 2017
36a6902
reverted eating sounds
Creeperface01 Oct 5, 2017
6941eb2
Support Damage Absorption!
boybook Oct 5, 2017
14b7e11
Merge remote-tracking branch 'origin/GT1.2' into GT1.2
boybook Oct 5, 2017
5136393
Funny😂, add Player.showXboxProfile
boybook Oct 5, 2017
edf1bc0
Fixed flowerpot item conversion
Creeperface01 Oct 8, 2017
2e033f5
Merge remote-tracking branch 'origin/GT1.2' into GT1.2
Creeperface01 Oct 8, 2017
96fe5d9
Fix some logical error in ElementSlider.
boybook Oct 9, 2017
5737fce
Fix no sound when opening ender chest.
boybook Oct 11, 2017
fb686af
Fix no any sounds when closing an ender chest.
boybook Oct 12, 2017
0ad523a
Daily enhancement on form (GUI) system 2017/10/13
boybook Oct 13, 2017
1ce8a03
FormWindow interpret: This variable is used for JSON import operation…
boybook Oct 13, 2017
99d4421
Don't forget reset() in DataPacket#encode
boybook Oct 14, 2017
be944b2
Change EntityInteractable from extends to interface.
boybook Oct 14, 2017
e605fa5
Move EntityVehicle#collidingWith to interface to solve the problem of…
boybook Oct 16, 2017
c33e3ef
AdventureSettingsPacket show broadcast, fix setAllowModifyWorld.
boybook Oct 17, 2017
572eca5
Fix Take Item animation
boybook Oct 17, 2017
4a31ff5
Update README.md
NuclearSteven Oct 18, 2017
39a2f08
Update CONTRIBUTING.md
NuclearSteven Oct 18, 2017
d7816d0
Update CONTRIBUTING.md
NuclearSteven Oct 18, 2017
02b2f65
Fix title upgrade of Dummy boss bar
boybook Oct 18, 2017
3bf4aa7
Use method for entity IDs
Creeperface01 Oct 18, 2017
980670e
Fixed sleeping bugs and optimized the bed's notices.
boybook Oct 19, 2017
2861422
Restoring the DummyBossBar Entity is visible
boybook Oct 19, 2017
57be4e3
use String::isEmpty()
Creeperface01 Oct 20, 2017
d617a8b
Merge remote-tracking branch 'origin/GT1.2' into GT1.2
Creeperface01 Oct 20, 2017
82cf2fe
Fixed item sending in in double chest inventory
Creeperface01 Oct 20, 2017
7970855
Add serverId in UnconnectedPong Packet
boybook Oct 20, 2017
b919e6c
Merge remote-tracking branch 'origin/GT1.2' into GT1.2
boybook Oct 20, 2017
1ad08c7
Added jukebox
Creeperface01 Oct 21, 2017
3dcaa01
Merge remote-tracking branch 'origin/GT1.2' into GT1.2
Creeperface01 Oct 21, 2017
83060d6
Make it public
Creeperface01 Oct 22, 2017
21718db
Full Pong result information: MOTD, Sub MOTD and default gamemode.
boybook Oct 25, 2017
ae76c44
Fixed PlaySoundPacket, temporarily removed music discs
Creeperface01 Oct 25, 2017
872ce2e
Merge remote-tracking branch 'origin/GT1.2' into GT1.2
Creeperface01 Oct 25, 2017
830091c
Strange careless of showXboxProfile
boybook Oct 26, 2017
a8adf3a
Merge remote-tracking branch 'origin/GT1.2' into GT1.2
boybook Oct 26, 2017
29d35eb
Revert "Fix for issue #1817 -- main thread stuck (rollback Zlib)" (#1…
Oct 26, 2017
76d1fd7
Teleport with pitch.
boybook Oct 26, 2017
5d010ad
Support fast equip armor by right click on hand
boybook Oct 26, 2017
90edc06
Improved ClientChainData
Creeperface01 Oct 26, 2017
f633cc7
Merge branch 'master' into GT1.2
Creeperface01 Oct 26, 2017
3cba504
Fixed armor equip
Creeperface01 Oct 26, 2017
dc68af8
Merge remote-tracking branch 'origin/GT1.2' into GT1.2
Creeperface01 Oct 26, 2017
a093744
The xbox info will be show in the player list.
boybook Oct 27, 2017
f94a12b
Merge remote-tracking branch 'origin/GT1.2' into GT1.2
boybook Oct 27, 2017
1ed85d4
Fixed some incorrect command messages.
boybook Oct 27, 2017
eed04a5
Fixed mistake made in commit 410e127 (#1923)
dignissimus Oct 29, 2017
d8e2fe0
A hack to solve the client-side teleporting bug! (inside into the block)
boybook Oct 29, 2017
e8a2207
Init the server sub-motd.
boybook Oct 29, 2017
4c6c078
If the player is a spectator, when received InventoryTransferPacket, …
boybook Oct 29, 2017
b7aae63
Fix Logging (#45)
kvetinac97 Oct 29, 2017
8f1f756
Merge branch 'master' into GT1.2
Snake1999 Oct 30, 2017
6e2e256
Remove it in future! Compatible with 1.1.x, then we can do something …
boybook Oct 31, 2017
8816f4f
Merge remote-tracking branch 'origin/GT1.2' into GT1.2
boybook Oct 31, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
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