mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-01 05:47:45 +01:00
More work
This commit is contained in:
parent
8a34a6269c
commit
d937034264
@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity {
|
@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity {
|
||||||
ItemEntity entityitem = (ItemEntity) iterator.next();
|
ItemEntity entityitem = (ItemEntity) iterator.next();
|
||||||
|
|
||||||
if (!entityitem.removed && !entityitem.getItem().isEmpty() && !entityitem.hasPickUpDelay() && this.wantsToPickUp(entityitem.getItem())) {
|
if (!entityitem.isRemoved() && !entityitem.getItem().isEmpty() && !entityitem.hasPickUpDelay() && this.wantsToPickUp(entityitem.getItem())) {
|
||||||
+ // Paper Start
|
+ // Paper Start
|
||||||
+ if (!entityitem.canMobPickup) {
|
+ if (!entityitem.canMobPickup) {
|
||||||
+ continue;
|
+ continue;
|
||||||
@ -41,10 +41,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
}
|
}
|
||||||
|
|
||||||
+ // Paper Start
|
+ // Paper Start
|
||||||
|
+ @Override
|
||||||
+ public boolean canMobPickup() {
|
+ public boolean canMobPickup() {
|
||||||
+ return item.canMobPickup;
|
+ return item.canMobPickup;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
|
+ @Override
|
||||||
+ public void setCanMobPickup(boolean canMobPickup) {
|
+ public void setCanMobPickup(boolean canMobPickup) {
|
||||||
+ item.canMobPickup = canMobPickup;
|
+ item.canMobPickup = canMobPickup;
|
||||||
+ }
|
+ }
|
||||||
@ -52,4 +54,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+
|
+
|
||||||
@Override
|
@Override
|
||||||
public void setOwner(UUID uuid) {
|
public void setOwner(UUID uuid) {
|
||||||
item.setOwner(uuid);
|
this.item.setOwner(uuid);
|
@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||||
@@ -0,0 +0,0 @@ public class ItemEntity extends Entity {
|
@@ -0,0 +0,0 @@ public class ItemEntity extends Entity {
|
||||||
// CraftBukkit start - fire PlayerPickupItemEvent
|
// CraftBukkit start - fire PlayerPickupItemEvent
|
||||||
int canHold = player.inventory.canHold(itemstack);
|
int canHold = player.getInventory().canHold(itemstack);
|
||||||
int remaining = i - canHold;
|
int remaining = i - canHold;
|
||||||
+ boolean flyAtPlayer = false; // Paper
|
+ boolean flyAtPlayer = false; // Paper
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
itemstack.setCount(canHold);
|
itemstack.setCount(canHold);
|
||||||
@@ -0,0 +0,0 @@ public class ItemEntity extends Entity {
|
@@ -0,0 +0,0 @@ public class ItemEntity extends Entity {
|
||||||
PlayerPickupItemEvent playerEvent = new PlayerPickupItemEvent((org.bukkit.entity.Player) player.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining);
|
PlayerPickupItemEvent playerEvent = new PlayerPickupItemEvent((org.bukkit.entity.Player) player.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining);
|
||||||
playerEvent.setCancelled(!player.canPickUpLoot);
|
playerEvent.setCancelled(!playerEvent.getPlayer().getCanPickupItems());
|
||||||
this.level.getCraftServer().getPluginManager().callEvent(playerEvent);
|
this.level.getCraftServer().getPluginManager().callEvent(playerEvent);
|
||||||
+ flyAtPlayer = playerEvent.getFlyAtPlayer(); // Paper
|
+ flyAtPlayer = playerEvent.getFlyAtPlayer(); // Paper
|
||||||
if (playerEvent.isCancelled()) {
|
if (playerEvent.isCancelled()) {
|
||||||
@ -34,7 +34,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
@@ -0,0 +0,0 @@ public class ItemEntity extends Entity {
|
@@ -0,0 +0,0 @@ public class ItemEntity extends Entity {
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
if (this.pickupDelay == 0 && (this.owner == null || this.owner.equals(player.getUUID())) && player.inventory.add(itemstack)) {
|
if (this.pickupDelay == 0 && (this.owner == null || this.owner.equals(player.getUUID())) && player.getInventory().add(itemstack)) {
|
||||||
- player.take(this, i);
|
- player.take(this, i);
|
||||||
+ // Paper Start
|
+ // Paper Start
|
||||||
+ if (flyAtPlayer) {
|
+ if (flyAtPlayer) {
|
||||||
@ -42,5 +42,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ }
|
+ }
|
||||||
+ // Paper End
|
+ // Paper End
|
||||||
if (itemstack.isEmpty()) {
|
if (itemstack.isEmpty()) {
|
||||||
this.remove();
|
this.discard();
|
||||||
itemstack.setCount(i);
|
itemstack.setCount(i);
|
@ -18,60 +18,29 @@ Other changes:
|
|||||||
- Server starts 1-2 seconds faster thanks to optimizations in Log4j
|
- Server starts 1-2 seconds faster thanks to optimizations in Log4j
|
||||||
configuration
|
configuration
|
||||||
|
|
||||||
diff --git a/pom.xml b/pom.xml
|
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/pom.xml
|
--- a/build.gradle.kts
|
||||||
+++ b/pom.xml
|
+++ b/build.gradle.kts
|
||||||
@@ -0,0 +0,0 @@
|
@@ -0,0 +0,0 @@ repositories {
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
dependencies {
|
||||||
<dependency>
|
implementation(project(":Paper-API"))
|
||||||
- <groupId>jline</groupId>
|
- implementation("jline:jline:2.12.1")
|
||||||
- <artifactId>jline</artifactId>
|
+ // Paper start
|
||||||
- <version>2.12.1</version>
|
+ implementation("org.jline:jline-terminal-jansi:3.12.1")
|
||||||
- <scope>compile</scope>
|
+ implementation("net.minecrell:terminalconsoleappender:1.2.0")
|
||||||
+ <groupId>net.minecrell</groupId>
|
+ /*
|
||||||
+ <artifactId>terminalconsoleappender</artifactId>
|
|
||||||
+ <version>1.2.0</version>
|
|
||||||
+ </dependency>
|
|
||||||
+ <dependency>
|
|
||||||
+ <groupId>org.jline</groupId>
|
|
||||||
+ <artifactId>jline-terminal-jansi</artifactId>
|
|
||||||
+ <version>3.12.1</version>
|
|
||||||
+ <scope>runtime</scope>
|
|
||||||
+ </dependency>
|
|
||||||
+ <!--
|
|
||||||
+ Required to add the missing Log4j2Plugins.dat file from log4j-core
|
+ Required to add the missing Log4j2Plugins.dat file from log4j-core
|
||||||
+ which has been removed by Mojang. Without it, log4j has to classload
|
+ which has been removed by Mojang. Without it, log4j has to classload
|
||||||
+ all its classes to check if they are plugins.
|
+ all its classes to check if they are plugins.
|
||||||
+ Scanning takes about 1-2 seconds so adding this speeds up the server start.
|
+ Scanning takes about 1-2 seconds so adding this speeds up the server start.
|
||||||
+ -->
|
+ */
|
||||||
+ <dependency>
|
+ runtimeOnly("org.apache.logging.log4j:log4j-core:2.14.1")
|
||||||
+ <groupId>org.apache.logging.log4j</groupId>
|
+ // Paper end
|
||||||
+ <artifactId>log4j-core</artifactId>
|
implementation("org.apache.logging.log4j:log4j-iostreams:2.14.1") // Paper
|
||||||
+ <scope>runtime</scope>
|
implementation("org.apache.logging.log4j:log4j-api:2.14.1") // Paper
|
||||||
</dependency>
|
implementation("org.apache.logging.log4j:log4j-slf4j-impl:2.14.1") // Paper
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.logging.log4j</groupId>
|
|
||||||
@@ -0,0 +0,0 @@
|
|
||||||
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
|
|
||||||
<resource>META-INF/services/java.sql.Driver</resource>
|
|
||||||
</transformer>
|
|
||||||
+ <transformer implementation="com.github.edwgiz.maven_shade_plugin.log4j2_cache_transformer.PluginsCacheFileTransformer" />
|
|
||||||
</transformers>
|
|
||||||
</configuration>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
+ <dependencies>
|
|
||||||
+ <dependency>
|
|
||||||
+ <groupId>com.github.edwgiz</groupId>
|
|
||||||
+ <artifactId>maven-shade-plugin.log4j2-cachefile-transformer</artifactId>
|
|
||||||
+ <version>2.13.1</version>
|
|
||||||
+ </dependency>
|
|
||||||
+ </dependencies>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
|
diff --git a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||||
@ -152,8 +121,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
+import io.papermc.paper.adventure.PaperAdventure; // Paper
|
+import io.papermc.paper.adventure.PaperAdventure; // Paper
|
||||||
import it.unimi.dsi.fastutil.longs.LongIterator;
|
import it.unimi.dsi.fastutil.longs.LongIterator;
|
||||||
|
import java.awt.GraphicsEnvironment;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.BufferedWriter;
|
|
||||||
@@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger;
|
@@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger;
|
||||||
import com.mojang.serialization.DynamicOps;
|
import com.mojang.serialization.DynamicOps;
|
||||||
import com.mojang.serialization.Lifecycle;
|
import com.mojang.serialization.Lifecycle;
|
||||||
@ -183,7 +152,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
System.setProperty("jline.terminal", "jline.UnsupportedTerminal");
|
System.setProperty("jline.terminal", "jline.UnsupportedTerminal");
|
||||||
Main.useJline = false;
|
Main.useJline = false;
|
||||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
LOGGER.warn((String) null, ex);
|
MinecraftServer.LOGGER.warn((String) null, ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+ */
|
+ */
|
||||||
@ -195,7 +164,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
org.spigotmc.WatchdogThread.doStop(); // Spigot
|
org.spigotmc.WatchdogThread.doStop(); // Spigot
|
||||||
// CraftBukkit start - Restore terminal to original settings
|
// CraftBukkit start - Restore terminal to original settings
|
||||||
try {
|
try {
|
||||||
- reader.getTerminal().restore();
|
- this.reader.getTerminal().restore();
|
||||||
+ net.minecrell.terminalconsole.TerminalConsoleAppender.close(); // Paper - Use TerminalConsoleAppender
|
+ net.minecrell.terminalconsole.TerminalConsoleAppender.close(); // Paper - Use TerminalConsoleAppender
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
}
|
}
|
||||||
@ -203,7 +172,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendMessage(Component message, UUID senderUuid) {
|
public void sendMessage(Component message, UUID sender) {
|
||||||
- MinecraftServer.LOGGER.info(message.getString());
|
- MinecraftServer.LOGGER.info(message.getString());
|
||||||
+ MinecraftServer.LOGGER.info(PaperAdventure.LEGACY_SECTION_UXRC.serialize(PaperAdventure.asAdventure(message))); // Paper - Log message with colors
|
+ MinecraftServer.LOGGER.info(PaperAdventure.LEGACY_SECTION_UXRC.serialize(PaperAdventure.asAdventure(message))); // Paper - Log message with colors
|
||||||
}
|
}
|
||||||
@ -295,7 +264,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
import net.minecraft.server.bossevents.CustomBossEvent;
|
import net.minecraft.server.bossevents.CustomBossEvent;
|
||||||
import net.minecraft.server.commands.ReloadCommand;
|
import net.minecraft.server.commands.ReloadCommand;
|
||||||
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
|
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
|
||||||
return logger;
|
return this.logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Paper start - JLine update
|
+ // Paper start - JLine update
|
||||||
@ -343,12 +312,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ // Paper end
|
+ // Paper end
|
||||||
|
|
||||||
if (options.has("noconsole")) {
|
if (options.has("noconsole")) {
|
||||||
useConsole = false;
|
Main.useConsole = false;
|
||||||
+ useJline = false; // Paper
|
+ useJline = false; // Paper
|
||||||
+ System.setProperty(TerminalConsoleAppender.JLINE_OVERRIDE_PROPERTY, "false"); // Paper
|
+ System.setProperty(TerminalConsoleAppender.JLINE_OVERRIDE_PROPERTY, "false"); // Paper
|
||||||
}
|
}
|
||||||
|
|
||||||
if (false && Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) {
|
if (Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) {
|
||||||
@@ -0,0 +0,0 @@ public class Main {
|
@@ -0,0 +0,0 @@ public class Main {
|
||||||
System.out.println("Unable to read system info");
|
System.out.println("Unable to read system info");
|
||||||
}
|
}
|
||||||
@ -427,7 +396,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
Waitable<List<String>> waitable = new Waitable<List<String>>() {
|
Waitable<List<String>> waitable = new Waitable<List<String>>() {
|
||||||
@Override
|
@Override
|
||||||
protected List<String> evaluate() {
|
protected List<String> evaluate() {
|
||||||
@@ -0,0 +0,0 @@ public class ConsoleCommandCompleter implements Completer {
|
- List<String> offers = ConsoleCommandCompleter.this.server.getCommandMap().tabComplete(ConsoleCommandCompleter.this.server.getConsoleSender(), buffer);
|
||||||
|
+ List<String> offers = server.getCommandMap().tabComplete(server.getConsoleSender(), buffer); // Paper - fix remap
|
||||||
|
|
||||||
|
- TabCompleteEvent tabEvent = new TabCompleteEvent(ConsoleCommandCompleter.this.server.getConsoleSender(), buffer, (offers == null) ? Collections.EMPTY_LIST : offers);
|
||||||
|
- ConsoleCommandCompleter.this.server.getPluginManager().callEvent(tabEvent);
|
||||||
|
+ TabCompleteEvent tabEvent = new TabCompleteEvent(server.getConsoleSender(), buffer, (offers == null) ? Collections.EMPTY_LIST : offers); // Paper - fix remap
|
||||||
|
+ server.getPluginManager().callEvent(tabEvent); // Paper - fix remap
|
||||||
|
|
||||||
return tabEvent.isCancelled() ? Collections.EMPTY_LIST : tabEvent.getCompletions();
|
return tabEvent.isCancelled() ? Collections.EMPTY_LIST : tabEvent.getCompletions();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -475,7 +451,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
|
--- a/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
|
||||||
@@ -0,0 +0,0 @@ public class ServerShutdownThread extends Thread {
|
@@ -0,0 +0,0 @@ public class ServerShutdownThread extends Thread {
|
||||||
server.close();
|
this.server.close();
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
- server.reader.getTerminal().restore();
|
- server.reader.getTerminal().restore();
|
@ -24,7 +24,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/monster/Creeper.java b/src
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/monster/Creeper.java
|
--- a/src/main/java/net/minecraft/world/entity/monster/Creeper.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
|
+++ b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
|
||||||
@@ -0,0 +0,0 @@ public class Creeper extends Monster {
|
@@ -0,0 +0,0 @@ public class Creeper extends Monster implements PowerableMob {
|
||||||
private void spawnLingeringCloud() {
|
private void spawnLingeringCloud() {
|
||||||
Collection<MobEffectInstance> collection = this.getActiveEffects();
|
Collection<MobEffectInstance> collection = this.getActiveEffects();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user