Skip to content
This repository has been archived by the owner on May 29, 2022. It is now read-only.

Few little optimisations #365

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
2c2e703
remove unneeded boat interaction event
crafter23456 Feb 27, 2022
36fb0ae
Use Vanilla Minecart Speeds + comment fixes
crafter23456 Feb 28, 2022
beb221c
few things
crafter23456 Feb 28, 2022
c6d2600
Update NachoSpigot-Server/src/main/java/net/minecraft/server/Minecraf…
crafter23456 Feb 28, 2022
636e7b6
Update NachoSpigot-Server/pom.xml
crafter23456 Feb 28, 2022
dc6731b
Update NachoSpigot-Server/src/main/java/net/minecraft/server/ChunkPro…
crafter23456 Feb 28, 2022
4ff4644
Update NachoSpigot-Server/src/main/java/net/minecraft/server/TileEnti…
crafter23456 Feb 28, 2022
4f0f4af
Update pom.xml
crafter23456 Feb 28, 2022
961820d
Update pom.xml
crafter23456 Feb 28, 2022
38cbe6e
Update NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/block/…
crafter23456 Feb 28, 2022
e2cda97
Update NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/block/…
crafter23456 Feb 28, 2022
392058d
Update NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/block/…
crafter23456 Feb 28, 2022
c58cf15
Update NachoSpigot-Server/src/main/java/org/bukkit/craftbukkit/block/…
crafter23456 Mar 1, 2022
7c8bf14
fix compiling
crafter23456 Mar 1, 2022
23c4925
Update pom.xml
Mar 2, 2022
ef37ae2
Merge branch 'CobbleSword:master' into patch-1
Mar 2, 2022
c97f630
Merge pull request #2 from Elierrr/patch-1
crafter23456 Mar 2, 2022
7864b34
Update pom.xml
Mar 2, 2022
1e23b17
Update pom.xml
Mar 2, 2022
25937e7
Merge pull request #3 from Elierrr/patch-1
crafter23456 Mar 2, 2022
85145b4
revert "unneeded boat event trigger"
crafter23456 Mar 2, 2022
41fdd06
missed that
crafter23456 Mar 2, 2022
209f4fd
Update README.md
crafter23456 Mar 2, 2022
b1f7f2a
revert things, update things
crafter23456 Mar 26, 2022
3b418fc
update paper repository link
crafter23456 Apr 19, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions NachoSpigot-API/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<!-- Update modified guava classes when updating -->
<version>31.0.1-jre</version>
<version>31.1-jre</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.9</version>
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>org.avaje</groupId>
Expand Down Expand Up @@ -83,16 +83,15 @@
<dependency>
<groupId>org.checkerframework</groupId>
<artifactId>checker-qual</artifactId>
<version>3.21.0</version>
<version>3.21.2</version>
</dependency>
<!-- Kyori api -->
<!-- https://mvnrepository.com/artifact/net.kyori/adventure-api -->
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-key</artifactId>
<version>4.9.3</version>
<version>4.10.1</version>
</dependency>

<!-- testing -->
crafter23456 marked this conversation as resolved.
Show resolved Hide resolved
<dependency>
<groupId>junit</groupId>
Expand All @@ -108,13 +107,20 @@
</dependency>
</dependencies>

<repositories>
<repository>
<id>spigotmc-public</id>
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
</repository>
</repositories>

<build>
<finalName>NachoSpigot-API</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<version>3.10.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
46 changes: 14 additions & 32 deletions NachoSpigot-Server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<dependency>
<groupId>it.unimi.dsi</groupId>
<artifactId>fastutil</artifactId>
<version>8.5.6</version>
<version>8.5.8</version>
</dependency>
<dependency>
<groupId>net.jafama</groupId>
Expand All @@ -69,14 +69,14 @@
<dependency>
<groupId>net.sf.jopt-simple</groupId>
<artifactId>jopt-simple</artifactId>
<version>3.2</version>
<version>5.0.4</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>jline</groupId>
<artifactId>jline</artifactId>
<version>2.12.1</version>
<version>2.14.6</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
Expand All @@ -90,7 +90,7 @@
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.14</version>
<version>5.1.49</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
Expand All @@ -100,28 +100,11 @@
<artifactId>log4j-core</artifactId>
<version>2.17.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.17.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.17.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-iostreams</artifactId>
<version>2.17.1</version>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it safe to remove these?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say. Paper only use the log4j core and the other thing I don't remember currently but we have that too. And my anticheat has a fix for log4j which only activates if the server didn't done it before. Isn't a 100% trust but if paper do it, I guess

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though it would be safe, I don't think it's recommended to combine multiple versions of a library.
IMO, this should be reverted. There's no reason for this.

</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.32</version>
<version>1.7.36</version>
<scope>compile</scope>
</dependency>

Expand Down Expand Up @@ -169,8 +152,8 @@
<url>https://maven.elmakers.com/repository/</url>
</repository>
<repository>
<id>velocity-repo</id>
<url>https://repo.velocitypowered.com/snapshots/</url>
<id>papermc</id>
<url>https://papermc.io/repo/repository/maven-public/</url>
</repository>
</repositories>

Expand All @@ -180,26 +163,25 @@
<defaultGoal>install</defaultGoal>
<plugins>
<plugin>
<groupId>com.lukegb.mojo</groupId>
<artifactId>gitdescribe-maven-plugin</artifactId>
<version>1.3</version>
<groupId>net.md-5</groupId>
<artifactId>scriptus</artifactId>
<version>0.4</version>
<configuration>
<outputPrefix>git-NachoSpigot-</outputPrefix>
<scmDirectory>..</scmDirectory>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<phase>initialize</phase>
<goals>
<goal>gitdescribe</goal>
<goal>describe</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.5</version>
<version>3.2.2</version>
<configuration>
<finalName>NachoSpigot</finalName>
<forceCreation>true</forceCreation> <!-- Required to prevent shading the jar multiple times -->
Expand Down Expand Up @@ -312,7 +294,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<version>3.10.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ public String a(T t0) {

// TacoSpigot start
@Override
public int
getValueId(T value) {
public int getValueId(T value) {
return value.ordinal();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class DataWatcher {
// TacoSpigot end
// Spigot End
private boolean e;
// private ReadWriteLock f = new ReentrantReadWriteLock(); // Spigot - Remove DataWatcher Locking
//private ReadWriteLock f = new ReentrantReadWriteLock(); // Spigot - Remove DataWatcher Locking
boolean registrationLocked; // Spigot

public DataWatcher(Entity entity) {
Expand All @@ -50,9 +50,9 @@ public <T> void a(int i, T t0) {
} else {
DataWatcher.WatchableObject datawatcher_watchableobject = new DataWatcher.WatchableObject(integer, i, t0); // Spigot

// this.f.writeLock().lock(); // Spigot - not required
//this.f.writeLock().lock(); // Spigot - not required
this.dataValues.put(i, datawatcher_watchableobject); // Spigot
// this.f.writeLock().unlock(); // Spigot - not required
//this.f.writeLock().unlock(); // Spigot - not required
this.b = false;
}
}
Expand Down Expand Up @@ -109,8 +109,8 @@ private DataWatcher.WatchableObject j(int i) {

this.f.readLock().unlock();
return datawatcher_watchableobject;
*/

*/
return (WatchableObject) this.dataValues.get(i);
}

Expand Down Expand Up @@ -157,7 +157,7 @@ public List<DataWatcher.WatchableObject> b() {
ArrayList arraylist = null;

if (this.e) {
// this.f.readLock().lock(); // Spigot - not required
//this.f.readLock().lock(); // Spigot - not required
Iterator iterator = this.dataValues.values().iterator(); // Spigot // TacoSpigot

while (iterator.hasNext()) {
Expand All @@ -169,7 +169,7 @@ public List<DataWatcher.WatchableObject> b() {
arraylist = Lists.newArrayList();
}

// Spigot start - copy ItemStacks to prevent ConcurrentModificationExceptions
// Spigot start - copy ItemStacks to prevent ConcurrentModificationExceptions
if ( datawatcher_watchableobject.b() instanceof ItemStack )
{
datawatcher_watchableobject = new WatchableObject(
Expand All @@ -184,15 +184,15 @@ public List<DataWatcher.WatchableObject> b() {
}
}

// this.f.readLock().unlock(); // Spigot - not required
//this.f.readLock().unlock(); // Spigot - not required
}

this.e = false;
return arraylist;
}

public void a(PacketDataSerializer serializer) throws IOException {
// this.f.readLock().lock(); // Spigot - not required
//this.f.readLock().lock(); // Spigot - not required
Iterator iterator = this.dataValues.values().iterator(); // Spigot // TacoSpigot

while (iterator.hasNext()) {
Expand All @@ -201,14 +201,14 @@ public void a(PacketDataSerializer serializer) throws IOException {
a(serializer, datawatcher_watchableobject);
}

// this.f.readLock().unlock(); // Spigot - not required
//this.f.readLock().unlock(); // Spigot - not required
serializer.writeByte(127);
}

public List<DataWatcher.WatchableObject> c() {
ArrayList arraylist = Lists.newArrayList(); // Spigot

// this.f.readLock().lock(); // Spigot - not required
//this.f.readLock().lock(); // Spigot - not required

arraylist.addAll(this.dataValues.values()); // Spigot // TacoSpigot
// Spigot start - copy ItemStacks to prevent ConcurrentModificationExceptions
Expand All @@ -227,7 +227,7 @@ public List<DataWatcher.WatchableObject> c() {
}
// Spigot end

// this.f.readLock().unlock(); // Spigot - not required
//this.f.readLock().unlock(); // Spigot - not required
return arraylist;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ public abstract class EntityMinecartAbstract extends Entity implements INamableT
private double derailedX = 0.5;
private double derailedY = 0.5;
private double derailedZ = 0.5;
private double flyingX = 0.95;
private double flyingY = 0.95;
private double flyingZ = 0.95;
private double flyingX = 0.949999988079071D; // Paper - restore vanilla precision
private double flyingY = 0.949999988079071D; // Paper - restore vanilla precision
private double flyingZ = 0.949999988079071D; // Paper - restore vanilla precision
crafter23456 marked this conversation as resolved.
Show resolved Hide resolved
public double maxSpeed = 0.4D;
// CraftBukkit end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) {
return itemstack;
} else {
if (movingobjectposition.type == MovingObjectPosition.EnumMovingObjectType.BLOCK) {
BlockPosition blockposition = movingobjectposition.a();

BlockPosition blockposition = movingobjectposition.a();
// CraftBukkit start - Boat placement
org.bukkit.event.player.PlayerInteractEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent(entityhuman, org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK, blockposition, movingobjectposition.direction, itemstack);

Expand All @@ -67,7 +67,6 @@ public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) {
}

EntityBoat entityboat = new EntityBoat(world, (double) ((float) blockposition.getX() + 0.5F), (double) ((float) blockposition.getY() + 1.0F), (double) ((float) blockposition.getZ() + 0.5F));

entityboat.yaw = (float) (((MathHelper.floor((double) (entityhuman.yaw * 4.0F / 360.0F) + 0.5D) & 3) - 1) * 90);
if (!world.getCubes(entityboat, entityboat.getBoundingBox().grow(-0.1D, -0.1D, -0.1D)).isEmpty()) {
return itemstack;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ private static ItemStack c(IInventory iinventory, ItemStack itemstack, int i, En
tileentityhopper.d(tileentityhopper.world.spigotConfig.hopperTransfer); // Spigot
}

// iinventory.update(); // Paper
//iinventory.update(); // Paper
}

iinventory.update();
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ See: [Contributors Page](https://github.com/CobbleSword/NachoSpigot/graphs/contr
[Paper-0352] Optimize BlockPosition helper methods by Spottedleaf
[Paper-0353] Send nearby packets from world player list not server list by Mystiflow
[Paper-0389] performance improvement for Chunk.getEntities by wea_ondara
[Paper-0539] Optimize NetworkManager Exception Handling by Andrew Steinborn
[Paper-0451] Reduce memory footprint of NBTTagCompound by spottedleaf
[Paper-0539] Optimize NetworkManager Exception Handling by Andrew Steinborn
[Paper-0797] Use Velocity compression and cipher natives
[Paper-????] Cleanup allocated favicon ByteBuf by Shane Freeder

Expand Down
6 changes: 0 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>7</version>
</parent>

<groupId>dev.cobblesword.nachospigot</groupId>
<artifactId>parent</artifactId>
<version>dev-SNAPSHOT</version>
Expand Down