Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
6e30644
Implement [FlamePaper-0003] Fix chunk memory leak
iamnoksio Dec 2, 2022
9c30288
Remove unused variable from CraftObjective + CraftTeam
iamnoksio Dec 7, 2022
462145f
meaningless commit
iamnoksio Dec 7, 2022
c8f8b8b
fix commands memory leak
iamnoksio Dec 8, 2022
7f8857e
0088 book exploit patch
iamnoksio Dec 14, 2022
715ea1f
Dont do useless action + more readable useless thing
iamnoksio Dec 14, 2022
98e2cc7
pull https://github.com/PaperMC/Paper-1.7/pull/48
iamnoksio Dec 19, 2022
63b970a
Pull https://github.com/PaperMC/Paper/blob/ver/1.12.2/Spigot-Server-P…
iamnoksio Dec 19, 2022
a5ef92f
OOPS https://github.com/PaperMC/Paper/blob/ver/1.12.2/Spigot-Server-P…
iamnoksio Dec 19, 2022
39ee394
optmize World::rayTrace
iamnoksio Dec 30, 2022
3a4114d
Modernize CraftChunk
iamnoksio Jan 10, 2023
8095524
d*mba** that I am ^^'
iamnoksio Jan 10, 2023
0d59867
lil cleanup + dont use bytebuf for the server image
iamnoksio Jan 22, 2023
8d385b0
Improved RollingAverage
iamnoksio Jan 23, 2023
fb6d558
lil cleanup/improvement
iamnoksio Jan 23, 2023
1bffbd4
Use less memory for clearing Conversation
iamnoksio Jan 25, 2023
a7ac449
Reworked IntCache
iamnoksio Jan 25, 2023
f9c572f
Apply https://github.com/moom0o/Papaya/blob/77cce8236ff09d52730b66c7a…
iamnoksio Jan 26, 2023
e96276c
Backport IntCache due to NPE
iamnoksio Jan 28, 2023
40c4353
Fixed IntCache
iamnoksio Jan 28, 2023
a5f041e
better now ^^
iamnoksio Jan 28, 2023
a0a7e9b
Update dependencies and add GH actions
Obydux Jan 29, 2023
fc1fe08
Update .gitignore which should now ignore maven made directories
Obydux Jan 29, 2023
23d15c8
Update guava
Obydux Jan 29, 2023
04cf8e1
Merge pull request #1 from Obydux/master
iamnoksio Jan 30, 2023
920e073
add Player#sendActionBar from higher version
iamnoksio Jan 30, 2023
e32b6e8
lil commands tweaking
iamnoksio Jan 31, 2023
9a7436e
sync MetadataStoreBase & PermissibleBase
iamnoksio Jan 31, 2023
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
24 changes: 24 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Build nPaper

on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'temurin'
cache: maven
- name: Build nPaper
run: mvn clean install
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: nPaper
path: ./nPaper-Server/target/npaper-1.7.10-R0.1-SNAPSHOT.jar
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ nbproject/
nbactions.xml

# we use maven!
build.xml
pom.xml

# maven
target/
Expand Down Expand Up @@ -37,4 +37,8 @@ manifest.mf

# other stuff
nPaper-Server/target
nPaper-Server/dependency-reduced-pom.xml
nPaper-API/target
nPaper-API/dependency-reduced-pom.xml
MinecraftServer/target
MinecraftServer/dependency-reduced-pom.xml
2 changes: 1 addition & 1 deletion MinecraftServer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<version>3.4.1</version>
<executions>
<execution>
<phase>package</phase>
Expand Down
20 changes: 10 additions & 10 deletions nPaper-API/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>16.0.2</version>
<version>24.0.0</version>
</dependency>
<dependency>
<groupId>net.md-5</groupId>
Expand All @@ -49,7 +49,7 @@
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.12</version>
<version>1.33</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
Expand All @@ -70,7 +70,7 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>10.0.1</version>
<version>31.1-jre</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
Expand All @@ -83,7 +83,7 @@
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
<version>2.8.5</version>
<version>2.9.3</version>
</dependency>


Expand All @@ -92,13 +92,13 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>1.3</version>
<version>2.2</version>
<scope>test</scope>
</dependency>
-->
Expand All @@ -109,7 +109,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<version>3.10.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
Expand All @@ -118,7 +118,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.4</version>
<version>3.4.1</version>
<executions>
<execution>
<phase>package</phase>
Expand All @@ -131,7 +131,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.0-beta-3</version>
<version>4.0.0-M4</version>
<configuration>
<reportPlugins>
<plugin>
Expand All @@ -142,7 +142,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
<version>3.4.1</version>
<configuration>
<linksource>true</linksource>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ public boolean execute(CommandSender sender, String currentAlias, String[] args)
}

OfflinePlayer player = Bukkit.getOfflinePlayer(args[0]);
if (!player.isOp()) {
sender.sendMessage("Player's not opped!");
return false;
}
player.setOp(false);

if (player instanceof Player) {
Expand All @@ -51,7 +55,7 @@ public List<String> tabComplete(CommandSender sender, String alias, String[] arg
List<String> completions = new ArrayList<String>();
for (OfflinePlayer player : Bukkit.getOperators()) {
String playerName = player.getName();
if (StringUtil.startsWithIgnoreCase(playerName, args[0])) {
if (StringUtil.startsWithIgnoreCase(playerName, args[0]) && player.isOp()) {
completions.add(playerName);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,10 @@ public List<String> tabComplete(CommandSender sender, String alias, String[] arg
return ImmutableList.of();
}

Player senderPlayer = (Player) sender;

ArrayList<String> matchedPlayers = new ArrayList<String>();
for (Player player : sender.getServer().getOnlinePlayers()) {
String name = player.getName();
if (!senderPlayer.canSee(player) || player.isOp()) {
if (player.isOp()) {
continue;
}
if (StringUtil.startsWithIgnoreCase(name, lastWord)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ public boolean execute(CommandSender sender, String currentAlias, String[] args)
return false;
}

if (!Bukkit.getBanList(BanList.Type.NAME).isBanned(args[0])) {
sender.sendMessage("Player's not banned!");
return false;
}
Bukkit.getBanList(BanList.Type.NAME).pardon(args[0]);
Command.broadcastCommandMessage(sender, "Unbanned " + args[0]);
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,21 +122,13 @@ public List<String> tabComplete(CommandSender sender, String alias, String[] arg

if (args.length == 1) {
return StringUtil.copyPartialMatches(args[0], WHITELIST_SUBCOMMANDS, new ArrayList<String>(WHITELIST_SUBCOMMANDS.size()));
} else if (args.length == 2) {
if (args[0].equalsIgnoreCase("add")) {
List<String> completions = new ArrayList<String>();
}
if (args.length == 2) {
if (args[0].equalsIgnoreCase("add") || args[0].equalsIgnoreCase("remove")) {
final List<String> completions = new ArrayList<String>();
for (OfflinePlayer player : Bukkit.getOnlinePlayers()) { // Spigot - well maybe sometimes you haven't turned the whitelist on just yet.
String name = player.getName();
if (StringUtil.startsWithIgnoreCase(name, args[1]) && !player.isWhitelisted()) {
completions.add(name);
}
}
return completions;
} else if (args[0].equalsIgnoreCase("remove")) {
List<String> completions = new ArrayList<String>();
for (OfflinePlayer player : Bukkit.getWhitelistedPlayers()) {
String name = player.getName();
if (StringUtil.startsWithIgnoreCase(name, args[1])) {
final String name = player.getName();
if (StringUtil.startsWithIgnoreCase(name, args[1]) && (args[0].equalsIgnoreCase("add") ? !player.isWhitelisted() : player.isWhitelisted())) {
completions.add(name);
}
}
Expand Down
25 changes: 25 additions & 0 deletions nPaper-API/src/main/java/org/bukkit/entity/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@

import com.sathonay.npaper.Title;

import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.TextComponent;

/**
* Represents a player, connected or not
*/
Expand Down Expand Up @@ -901,6 +904,28 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
* Hide any title that is currently visible to the player
*/
public void hideTitle();

/**
* Sends an Action Bar message to the client.
*
* @param message message to display
*/
default void sendActionBar(String... message) {
BaseComponent[] messageComponents = new BaseComponent[message.length];
int i = 0;
for (String messageLine : message) {
messageComponents[i] = new TextComponent(messageLine);
i++;
}
sendActionBar(messageComponents);
}

/**
* Sends an Action Bar message to the client.
*
* @param message message to display
*/
void sendActionBar(BaseComponent... message);

/**
* Gets the Location where the player will spawn at their bed, null if
Expand Down
40 changes: 25 additions & 15 deletions nPaper-API/src/main/java/org/bukkit/metadata/MetadataStoreBase.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
package org.bukkit.metadata;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.WeakHashMap;
import java.util.concurrent.ConcurrentHashMap;

import org.apache.commons.lang.Validate;
import org.bukkit.plugin.Plugin;

import java.util.*;

public abstract class MetadataStoreBase<T> {
private Map<String, Map<Plugin, MetadataValue>> metadataMap = new HashMap<String, Map<Plugin, MetadataValue>>();
private Map<String, Map<Plugin, MetadataValue>> metadataMap = new ConcurrentHashMap<String, Map<Plugin, MetadataValue>>();

/**
* Adds a metadata value to an object. Each metadata value is owned by a
Expand Down Expand Up @@ -40,7 +46,9 @@ public synchronized void setMetadata(T subject, String metadataKey, MetadataValu
entry = new WeakHashMap<Plugin, MetadataValue>(1);
metadataMap.put(key, entry);
}
entry.put(owningPlugin, newMetadataValue);
synchronized (entry) {
entry.put(owningPlugin, newMetadataValue);
}
}

/**
Expand All @@ -53,14 +61,14 @@ public synchronized void setMetadata(T subject, String metadataKey, MetadataValu
* requested value.
* @see MetadataStore#getMetadata(Object, String)
*/
public synchronized List<MetadataValue> getMetadata(T subject, String metadataKey) {
public List<MetadataValue> getMetadata(T subject, String metadataKey) {
String key = disambiguate(subject, metadataKey);
if (metadataMap.containsKey(key)) {
Collection<MetadataValue> values = metadataMap.get(key).values();
Map<Plugin, MetadataValue> entry = metadataMap.get(key);
if (entry != null) {
Collection<MetadataValue> values = entry.values();
return Collections.unmodifiableList(new ArrayList<MetadataValue>(values));
} else {
return Collections.emptyList();
}
return Collections.emptyList();
}

/**
Expand All @@ -71,7 +79,7 @@ public synchronized List<MetadataValue> getMetadata(T subject, String metadataKe
* @param metadataKey the unique metadata key being queried.
* @return the existence of the metadataKey within subject.
*/
public synchronized boolean hasMetadata(T subject, String metadataKey) {
public boolean hasMetadata(T subject, String metadataKey) {
String key = disambiguate(subject, metadataKey);
return metadataMap.containsKey(key);
}
Expand All @@ -87,17 +95,19 @@ public synchronized boolean hasMetadata(T subject, String metadataKey) {
* org.bukkit.plugin.Plugin)
* @throws IllegalArgumentException If plugin is null
*/
public synchronized void removeMetadata(T subject, String metadataKey, Plugin owningPlugin) {
public void removeMetadata(T subject, String metadataKey, Plugin owningPlugin) {
Validate.notNull(owningPlugin, "Plugin cannot be null");
String key = disambiguate(subject, metadataKey);
Map<Plugin, MetadataValue> entry = metadataMap.get(key);
if (entry == null) {
return;
}

entry.remove(owningPlugin);
if (entry.isEmpty()) {
metadataMap.remove(key);
synchronized (entry) {
entry.remove(owningPlugin);
if (entry.isEmpty()) {
metadataMap.remove(key);
}
}
}

Expand All @@ -110,7 +120,7 @@ public synchronized void removeMetadata(T subject, String metadataKey, Plugin ow
* @see MetadataStore#invalidateAll(org.bukkit.plugin.Plugin)
* @throws IllegalArgumentException If plugin is null
*/
public synchronized void invalidateAll(Plugin owningPlugin) {
public void invalidateAll(Plugin owningPlugin) {
Validate.notNull(owningPlugin, "Plugin cannot be null");
for (Map<Plugin, MetadataValue> values : metadataMap.values()) {
if (values.containsKey(owningPlugin)) {
Expand Down
Loading