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

update #54

Merged
merged 34 commits into from
Nov 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
18221f7
Reduce memory usage, phase 2 (Zlib) (#1790)
Snake1999 Jul 11, 2017
1e89587
Fix Bug HostName Transfer
tigerza117 Jul 12, 2017
f11ebc0
Bug Report Feature
NuclearSteven Jul 16, 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
b7f73ab
Add a construct override for Config (#1860)
fengberd Aug 11, 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
5b04671
Add Yivesmirror to README.md. Close #1876
PeratX Aug 25, 2017
9997eca
improvements (#1834)
Creeperface01 Aug 26, 2017
9172b11
fast fix for crafting (#1882)
Creeperface01 Aug 27, 2017
56d553a
final fix for crafting (#1884)
Creeperface01 Aug 30, 2017
cb574b7
Fixed entities a bit (#1892)
Creeperface01 Sep 5, 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
9bb3fc5
Allows for the log level to be changed (#1908) Close #1869
dignissimus Oct 2, 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
29d35eb
Revert "Fix for issue #1817 -- main thread stuck (rollback Zlib)" (#1…
Oct 26, 2017
eed04a5
Fixed mistake made in commit 410e127 (#1923)
dignissimus Oct 29, 2017
b04061b
Update to version 1.2 (#1912)
Creeperface01 Oct 30, 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