Compare commits
66 Commits
ver/1.13.2
...
1.14.4-R0.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3fb74607bd | ||
|
|
fa135a1a22 | ||
|
|
0822c65af8 | ||
|
|
740e47df67 | ||
|
|
4e6d4be087 | ||
|
|
5aaa3815fd | ||
|
|
3ffb622a36 | ||
|
|
7f0d3d441c | ||
|
|
818ec7912c | ||
|
|
8c4adc5eb5 | ||
|
|
7be85efd51 | ||
|
|
9313f9d557 | ||
|
|
aeec043ef1 | ||
|
|
86631090a7 | ||
|
|
4c6947d949 | ||
|
|
82d21e2156 | ||
|
|
bd6a6a4af2 | ||
|
|
f95d397ee1 | ||
|
|
c47fa0e78c | ||
|
|
a70eb4415c | ||
|
|
21713af0a0 | ||
|
|
5bb3faf096 | ||
|
|
b8e12697cc | ||
|
|
0917583727 | ||
|
|
74d7463012 | ||
|
|
c50dd7660f | ||
|
|
2e6ed47fc3 | ||
|
|
ff11917fde | ||
|
|
fb0fb08ca9 | ||
|
|
d996e03194 | ||
|
|
0fc67cb84b | ||
|
|
d9c7c27de2 | ||
|
|
d21f1ae0f7 | ||
|
|
cfedff9496 | ||
|
|
8ee8f1125a | ||
|
|
77f5c39f45 | ||
|
|
dcda956eb9 | ||
|
|
3eae763c37 | ||
|
|
673af6e6ce | ||
|
|
1773ae99c0 | ||
|
|
eedfeffb32 | ||
|
|
9b0e0440fa | ||
|
|
c462bfc444 | ||
|
|
a3e57ec664 | ||
|
|
f303f0429a | ||
|
|
9001462a77 | ||
|
|
603e6030f5 | ||
|
|
1a5e7ff422 | ||
|
|
1e5930ff4f | ||
|
|
89d7ca75b2 | ||
|
|
0c27784fc2 | ||
|
|
0f4d9dbcc6 | ||
|
|
cf9ddb81d4 | ||
|
|
51703b3300 | ||
|
|
5c9567e797 | ||
|
|
e75ae756d7 | ||
|
|
d1569d7502 | ||
|
|
e39a36bd42 | ||
|
|
f726349f27 | ||
|
|
f13789ac6a | ||
|
|
80713fe0ac | ||
|
|
e24a0066a3 | ||
|
|
c08e6988a0 | ||
|
|
e08e69fba1 | ||
|
|
e7bd70d7cf | ||
|
|
dc96116b8e |
49
.circleci/config.yml
Normal file
49
.circleci/config.yml
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
version: 2
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
working_directory: ~/Akarin-project/Akarin
|
||||||
|
parallelism: 1
|
||||||
|
shell: /bin/bash --login
|
||||||
|
environment:
|
||||||
|
CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
|
||||||
|
CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
|
||||||
|
docker:
|
||||||
|
- image: circleci/build-image:ubuntu-14.04-XXL-upstart-1189-5614f37
|
||||||
|
run: sudo service postgresql start
|
||||||
|
steps:
|
||||||
|
# Machine Setup
|
||||||
|
- checkout
|
||||||
|
# Prepare for artifact
|
||||||
|
- run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS
|
||||||
|
- run:
|
||||||
|
working_directory: ~/Akarin-project/Akarin
|
||||||
|
command: sudo update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java; sudo update-alternatives --set javac /usr/lib/jvm/java-8-openjdk-amd64/bin/javac; echo -e "export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64" >> $BASH_ENV
|
||||||
|
# Dependencies
|
||||||
|
# Restore the dependency cache
|
||||||
|
- restore_cache:
|
||||||
|
keys:
|
||||||
|
# This branch if available
|
||||||
|
- v1-dep-{{ .Branch }}-
|
||||||
|
# Any branch if there are none on the default branch - this should be unnecessary if you have your default branch configured correctly
|
||||||
|
- v1-dep-
|
||||||
|
- run: git config --global user.email "circle@circleci.com"
|
||||||
|
- run: git config --global user.name "CircleCI"
|
||||||
|
- run: chmod -Rv +x scripts/
|
||||||
|
- run: ./scripts/build.sh
|
||||||
|
- run: ./scripts/inst.sh --setup --remote
|
||||||
|
# Save dependency cache
|
||||||
|
- save_cache:
|
||||||
|
key: v1-dep-{{ .Branch }}-{{ epoch }}
|
||||||
|
paths:
|
||||||
|
- ~/.m2
|
||||||
|
# Test
|
||||||
|
- run: yes|cp -rf ./akarin-*.jar $CIRCLE_ARTIFACTS
|
||||||
|
# Teardown
|
||||||
|
# Save test results
|
||||||
|
- store_test_results:
|
||||||
|
path: /tmp/circleci-test-results
|
||||||
|
# Save artifacts
|
||||||
|
- store_artifacts:
|
||||||
|
path: /tmp/circleci-artifacts
|
||||||
|
- store_artifacts:
|
||||||
|
path: /tmp/circleci-test-results
|
||||||
2
.gitmodules
vendored
2
.gitmodules
vendored
@@ -1,4 +1,4 @@
|
|||||||
[submodule "work/Paper"]
|
[submodule "work/Paper"]
|
||||||
path = work/Paper
|
path = work/Paper
|
||||||
url = https://github.com/PaperMC/Paper.git
|
url = https://github.com/PaperMC/Paper.git
|
||||||
branch = master
|
branch = ver/1.14
|
||||||
|
|||||||
BIN
.gradle/6.2.2/executionHistory/executionHistory.bin
Normal file
BIN
.gradle/6.2.2/executionHistory/executionHistory.bin
Normal file
Binary file not shown.
BIN
.gradle/6.2.2/executionHistory/executionHistory.lock
Normal file
BIN
.gradle/6.2.2/executionHistory/executionHistory.lock
Normal file
Binary file not shown.
BIN
.gradle/6.2.2/fileChanges/last-build.bin
Normal file
BIN
.gradle/6.2.2/fileChanges/last-build.bin
Normal file
Binary file not shown.
BIN
.gradle/6.2.2/fileContent/fileContent.lock
Normal file
BIN
.gradle/6.2.2/fileContent/fileContent.lock
Normal file
Binary file not shown.
BIN
.gradle/6.2.2/fileHashes/fileHashes.lock
Normal file
BIN
.gradle/6.2.2/fileHashes/fileHashes.lock
Normal file
Binary file not shown.
0
.gradle/6.2.2/gc.properties
Normal file
0
.gradle/6.2.2/gc.properties
Normal file
BIN
.gradle/buildOutputCleanup/buildOutputCleanup.lock
Normal file
BIN
.gradle/buildOutputCleanup/buildOutputCleanup.lock
Normal file
Binary file not shown.
2
.gradle/buildOutputCleanup/cache.properties
Normal file
2
.gradle/buildOutputCleanup/cache.properties
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
#Sat Mar 28 16:11:26 MST 2020
|
||||||
|
gradle.version=6.2.2
|
||||||
BIN
.gradle/buildOutputCleanup/outputFiles.bin
Normal file
BIN
.gradle/buildOutputCleanup/outputFiles.bin
Normal file
Binary file not shown.
BIN
.gradle/checksums/checksums.lock
Normal file
BIN
.gradle/checksums/checksums.lock
Normal file
Binary file not shown.
BIN
.gradle/checksums/md5-checksums.bin
Normal file
BIN
.gradle/checksums/md5-checksums.bin
Normal file
Binary file not shown.
BIN
.gradle/checksums/sha1-checksums.bin
Normal file
BIN
.gradle/checksums/sha1-checksums.bin
Normal file
Binary file not shown.
0
.gradle/vcs-1/gc.properties
Normal file
0
.gradle/vcs-1/gc.properties
Normal file
25
.travis.yml
Normal file
25
.travis.yml
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
language: java
|
||||||
|
dist: trusty
|
||||||
|
jdk:
|
||||||
|
- oraclejdk8
|
||||||
|
install: true
|
||||||
|
script:
|
||||||
|
- git config --global user.email "circle@circleci.com"
|
||||||
|
- git config --global user.name "CircleCI"
|
||||||
|
- chmod -Rv +x scripts/
|
||||||
|
- ./scripts/build.sh
|
||||||
|
- ./scripts/inst.sh --setup --remote
|
||||||
|
after_success:
|
||||||
|
- rm -rf push
|
||||||
|
- mkdir push
|
||||||
|
- cp ./target/*.jar ./push/
|
||||||
|
deploy:
|
||||||
|
skip_cleanup: true
|
||||||
|
provider: releases
|
||||||
|
api_key:
|
||||||
|
secure: $Github_token
|
||||||
|
file:
|
||||||
|
- ./push/*
|
||||||
|
file_glob: true
|
||||||
|
on:
|
||||||
|
tags: true
|
||||||
24
Jenkinsfile
vendored
24
Jenkinsfile
vendored
@@ -1,24 +0,0 @@
|
|||||||
pipeline {
|
|
||||||
agent any
|
|
||||||
stages {
|
|
||||||
stage('Init Submodules') {
|
|
||||||
steps {
|
|
||||||
sh 'git submodule update --init --recursive'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Build') {
|
|
||||||
steps {
|
|
||||||
sh 'bash ./scripts/build.sh'
|
|
||||||
sh 'bash ./scripts/inst.sh --setup --fast'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Archive') {
|
|
||||||
steps {
|
|
||||||
archiveArtifacts(artifacts: '*.jar', fingerprint: true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
26
README.md
26
README.md
@@ -1,14 +1,17 @@
|
|||||||
# <img src="https://i.loli.net/2018/05/17/5afd869c443ef.png" alt="Akarin Face" align="right">Akarin
|
# <img src="https://i.loli.net/2018/05/17/5afd869c443ef.png" alt="Akarin Face" align="right">Akarin
|
||||||
[](https://akarin.io)
|
|
||||||
|
[](https://akarin.app/)
|
||||||
[](https://discord.gg/fw2pJAj)
|
[](https://discord.gg/fw2pJAj)
|
||||||
[](https://bstats.org/plugin/bukkit/Torch)
|
[](https://bstats.org/plugin/bukkit/Torch)
|
||||||

|
[](http://josephworks.ddns.net:8080/job/Akarin-project/job/Akarin/)
|
||||||
[](https://www.patreon.com/akarinproject)
|
[](https://www.patreon.com/akarinproject)
|
||||||
|
[](https://circleci.com/gh/Akarin-project/Akarin)
|
||||||
|
|
||||||
Akarin is currently **under heavy development** and contributions are welcome!
|
Akarin is currently **under heavy development** and contributions are welcome!
|
||||||
|
|
||||||
Introduction
|
Introduction
|
||||||
---
|
---
|
||||||
|
|
||||||
> Akarin is a powerful server software from the 'new dimension', formerly known as Torch.
|
> Akarin is a powerful server software from the 'new dimension', formerly known as Torch.
|
||||||
|
|
||||||
As a [Paper](https://github.com/PaperMC/Paper) fork, it should support almost all plugins that work on [Spigot](https://hub.spigotmc.org/stash/projects/SPIGOT/repos/spigot/browse).
|
As a [Paper](https://github.com/PaperMC/Paper) fork, it should support almost all plugins that work on [Spigot](https://hub.spigotmc.org/stash/projects/SPIGOT/repos/spigot/browse).
|
||||||
@@ -23,37 +26,50 @@ Our project has a few key goals:
|
|||||||
|
|
||||||
Get Akarin
|
Get Akarin
|
||||||
---
|
---
|
||||||
|
|
||||||
### Download
|
### Download
|
||||||
|
|
||||||
#### Recommended
|
#### Recommended
|
||||||
+ [**JosephWorks Jenkins**](http://ci.josephworks.net/job/Akarin)
|
|
||||||
|
+ [**Circle CI**](https://circleci.com/gh/Akarin-project/Akarin/tree/ver/master) - Checkout the 'Artifacts' tab of the latest build *Login required*
|
||||||
|
+ [**JosephWorks Jenkins**](http://josephworks.ddns.net:8080/job/Akarin-project/job/Akarin/)
|
||||||
|
+ [**Melon Jenkins**](https://ci.melon.cat/job/Akarin/) - Offline
|
||||||
|
|
||||||
*Open an [Issue](https://github.com/Akarin-project/Akarin/issues) or a [Pull Request](https://github.com/Akarin-project/Akarin/pulls) if you want to add your website here*
|
*Open an [Issue](https://github.com/Akarin-project/Akarin/issues) or a [Pull Request](https://github.com/Akarin-project/Akarin/pulls) if you want to add your website here*
|
||||||
|
|
||||||
### Build
|
### Build
|
||||||
|
|
||||||
#### Requirements
|
#### Requirements
|
||||||
|
|
||||||
* Java (JDK) 8 or above
|
* Java (JDK) 8 or above
|
||||||
* Maven
|
* Maven
|
||||||
|
|
||||||
#### Compile
|
#### Compile
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
chmod -Rv a+x scripts/
|
||||||
|
./scripts/build.sh
|
||||||
./scripts/inst.sh --setup --fast
|
./scripts/inst.sh --setup --fast
|
||||||
```
|
```
|
||||||
|
|
||||||
**Notes**
|
**Notes**
|
||||||
|
|
||||||
* You must use `--setup` at least once to deploy necessary dependencies otherwise some imports cannot be organized.
|
* You must use `--setup` at least once to deploy necessary dependencies otherwise some imports cannot be organized.
|
||||||
* For non-modified projects, it is recommended to add the `--fast` option to skip any tests.
|
* For non-modified projects, it is recommended to add the `--fast` option to skip any tests.
|
||||||
* If your machine has insufficient memory, you may want to add the `--remote` option to avoid decompiling locally.
|
* If your machine has insufficient memory, you may want to add the `--remote` option to avoid decompiling locally.
|
||||||
|
|
||||||
Demo Servers
|
Demo Servers
|
||||||
---
|
---
|
||||||
|
|
||||||
* [Fair Server](https://fairserver.ru)
|
* [Fair Server](https://fairserver.ru)
|
||||||
* [LoyaltyMC](https://minecraft-mp.com/server-s212077)
|
* [LoyaltyMC](https://www.loyaltymc.net/)
|
||||||
* ~~`demo.akarin.io` (official)~~
|
* ~~`demo.akarin.io` (official)~~
|
||||||
|
|
||||||
*Open an [Issue](https://github.com/Akarin-project/Akarin/issues) or a [Pull Request](https://github.com/Akarin-project/Akarin/pulls) if you want to add your website here*
|
*Open an [Issue](https://github.com/Akarin-project/Akarin/issues) or a [Pull Request](https://github.com/Akarin-project/Akarin/pulls) if you want to add your website here*
|
||||||
|
|
||||||
Contributing
|
Contributing
|
||||||
---
|
---
|
||||||
|
|
||||||
* You can checkout the `src` folder to see more. Please follow the patch style to do any change, so we are able to update between different Minecraft versions.
|
* You can checkout the `src` folder to see more. Please follow the patch style to do any change, so we are able to update between different Minecraft versions.
|
||||||
* Add your name to the [LICENSE](https://github.com/Akarin-project/Akarin/blob/master/LICENSE.md) if you want to publish your code under the [MIT License](https://github.com/Akarin-project/Akarin/blob/master/licenses/MIT.md).
|
* Add your name to the [LICENSE](https://github.com/Akarin-project/Akarin/blob/master/LICENSE.md) if you want to publish your code under the [MIT License](https://github.com/Akarin-project/Akarin/blob/master/licenses/MIT.md).
|
||||||
* If you want to join the [Akarin-project](https://github.com/Akarin-project) team, you can [send](mailto://kira@kira.moe) us an email with your experience and necessary information.
|
* If you want to join the [Akarin-project](https://github.com/Akarin-project) team, you can [send](mailto://kira@kira.moe) us an email with your experience and necessary information.
|
||||||
|
|||||||
22
SECURITY.md
Normal file
22
SECURITY.md
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# Security Policy
|
||||||
|
|
||||||
|
## Supported Versions
|
||||||
|
|
||||||
|
The checked versions below are supported by us.
|
||||||
|
|
||||||
|
| Version | Supported | Notes |
|
||||||
|
| ------- | ------------------ | -------------- |
|
||||||
|
| 1.15.2 | :white_check_mark: | Latest Build |
|
||||||
|
| 1.14.4 | :white_check_mark: | Newer Build* |
|
||||||
|
| 1.13.2 | :x: | No Support |
|
||||||
|
| 1.12.2 | :white_check_mark: | LTS Build only |
|
||||||
|
|
||||||
|
Newer Build - Up to 20 commits behind or 5 jenkins builds.
|
||||||
|
|
||||||
|
No Support - You will be prompted to upgrade to 1.14.4.
|
||||||
|
|
||||||
|
LTS Build only - Provided in the releases tab on GitHub.
|
||||||
|
|
||||||
|
## Reporting an Issue
|
||||||
|
|
||||||
|
Have a problem, feel free to [create an issue](https://github.com/Akarin-project/Akarin/issues) or [ask us on discord](https://discord.gg/dX8MMvP)!
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<artifactId>akarin-api</artifactId>
|
<artifactId>akarin-api</artifactId>
|
||||||
<version>1.13.2-R0.1-SNAPSHOT</version>
|
<version>1.14.4-R0.1-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
package co.aikar.timings;
|
|
||||||
|
|
||||||
public class ThreadAssertion {
|
|
||||||
private static boolean mainThread;
|
|
||||||
|
|
||||||
public static boolean is() {
|
|
||||||
return mainThread;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void start() {
|
|
||||||
mainThread = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void close() {
|
|
||||||
mainThread = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -23,8 +23,8 @@
|
|||||||
*/
|
*/
|
||||||
package co.aikar.timings;
|
package co.aikar.timings;
|
||||||
|
|
||||||
import javax.annotation.Nonnull; // Akarin - javax.annotation
|
import org.jetbrains.annotations.NotNull;
|
||||||
import javax.annotation.Nullable; // Akarin - javax.annotation
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides an ability to time sections of code within the Minecraft Server
|
* Provides an ability to time sections of code within the Minecraft Server
|
||||||
@@ -35,10 +35,8 @@ public interface Timing extends AutoCloseable {
|
|||||||
*
|
*
|
||||||
* @return Timing
|
* @return Timing
|
||||||
*/
|
*/
|
||||||
@Nonnull // Akarin - javax.annotation
|
@NotNull
|
||||||
Timing startTiming();
|
Timing startTiming();
|
||||||
default Timing startTiming(boolean assertThread) { return startTiming(); }; // Akarin
|
|
||||||
default Timing startTimingUnsafe() { return startTiming(); }; // Akarin
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Stops timing and records the data. Propagates the data up to group handlers.</p>
|
* <p>Stops timing and records the data. Propagates the data up to group handlers.</p>
|
||||||
@@ -46,7 +44,6 @@ public interface Timing extends AutoCloseable {
|
|||||||
* Will automatically be called when this Timing is used with try-with-resources
|
* Will automatically be called when this Timing is used with try-with-resources
|
||||||
*/
|
*/
|
||||||
void stopTiming();
|
void stopTiming();
|
||||||
default void stopTimingUnsafe() { stopTiming(); }; // Akarin
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts timing the execution until {@link #stopTiming()} is called.
|
* Starts timing the execution until {@link #stopTiming()} is called.
|
||||||
@@ -55,9 +52,8 @@ public interface Timing extends AutoCloseable {
|
|||||||
*
|
*
|
||||||
* @return Timing
|
* @return Timing
|
||||||
*/
|
*/
|
||||||
@Nonnull // Akarin - javax.annotation
|
@NotNull
|
||||||
Timing startTimingIfSync();
|
Timing startTimingIfSync();
|
||||||
default Timing startTimingIfSync(boolean assertThread) { return startTimingIfSync(); }; // Akarin
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Stops timing and records the data. Propagates the data up to group handlers.</p>
|
* <p>Stops timing and records the data. Propagates the data up to group handlers.</p>
|
||||||
|
|||||||
@@ -24,7 +24,6 @@
|
|||||||
package co.aikar.timings;
|
package co.aikar.timings;
|
||||||
|
|
||||||
import co.aikar.util.LoadingIntMap;
|
import co.aikar.util.LoadingIntMap;
|
||||||
import io.akarin.server.core.AkarinGlobalConfig;
|
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||||
|
|
||||||
import java.util.ArrayDeque;
|
import java.util.ArrayDeque;
|
||||||
@@ -33,10 +32,9 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import javax.annotation.Nonnull; // Akarin - javax.annotation
|
|
||||||
import javax.annotation.Nullable; // Akarin - javax.annotation
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
class TimingHandler implements Timing {
|
class TimingHandler implements Timing {
|
||||||
|
|
||||||
@@ -50,6 +48,7 @@ class TimingHandler implements Timing {
|
|||||||
private final Int2ObjectOpenHashMap<TimingData> children = new LoadingIntMap<>(TimingData::new);
|
private final Int2ObjectOpenHashMap<TimingData> children = new LoadingIntMap<>(TimingData::new);
|
||||||
|
|
||||||
final TimingData record;
|
final TimingData record;
|
||||||
|
private TimingHandler startParent;
|
||||||
private final TimingHandler groupHandler;
|
private final TimingHandler groupHandler;
|
||||||
|
|
||||||
private long start = 0;
|
private long start = 0;
|
||||||
@@ -58,7 +57,7 @@ class TimingHandler implements Timing {
|
|||||||
private boolean timed;
|
private boolean timed;
|
||||||
private boolean enabled;
|
private boolean enabled;
|
||||||
|
|
||||||
TimingHandler(@Nonnull TimingIdentifier id) { // Akarin - javax.annotation
|
TimingHandler(@NotNull TimingIdentifier id) {
|
||||||
this.identifier = id;
|
this.identifier = id;
|
||||||
this.verbose = id.name.startsWith("##");
|
this.verbose = id.name.startsWith("##");
|
||||||
this.record = new TimingData(this.id);
|
this.record = new TimingData(this.id);
|
||||||
@@ -85,17 +84,10 @@ class TimingHandler implements Timing {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull // Akarin - javax.annotation
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Timing startTimingIfSync() {
|
public Timing startTimingIfSync() {
|
||||||
// Akarin start
|
startTiming();
|
||||||
return startTiming(false);
|
|
||||||
}
|
|
||||||
@Nonnull // Akarin - javax.annotation
|
|
||||||
@Override
|
|
||||||
public Timing startTimingIfSync(boolean assertThread) {
|
|
||||||
startTiming(assertThread);
|
|
||||||
// Akarin end
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,70 +96,49 @@ class TimingHandler implements Timing {
|
|||||||
stopTiming();
|
stopTiming();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull // Akarin - javax.annotation
|
@NotNull
|
||||||
public Timing startTiming() {
|
public Timing startTiming() {
|
||||||
// Akarin start
|
if (!enabled || !Bukkit.isPrimaryThread()) {
|
||||||
return startTiming(false);
|
return this;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Timing startTimingUnsafe() {
|
|
||||||
if (enabled && ++timingDepth == 1) {
|
|
||||||
ThreadAssertion.close();
|
|
||||||
// Akarin end
|
|
||||||
start = System.nanoTime();
|
|
||||||
TIMING_STACK.addLast(this);
|
|
||||||
}
|
}
|
||||||
|
if (++timingDepth == 1) {
|
||||||
|
startParent = TIMING_STACK.peekLast();
|
||||||
|
start = System.nanoTime();
|
||||||
|
}
|
||||||
|
TIMING_STACK.addLast(this);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
// Akarin start
|
|
||||||
@Override
|
|
||||||
public Timing startTiming(boolean assertThread) {
|
|
||||||
if (enabled && (ThreadAssertion.is() || Bukkit.isPrimaryThread()) && ++timingDepth == 1) {
|
|
||||||
start = System.nanoTime();
|
|
||||||
TIMING_STACK.addLast(this);
|
|
||||||
if (assertThread && AkarinGlobalConfig.lazyThreadAssertion)
|
|
||||||
ThreadAssertion.start();
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void stopTimingUnsafe() {
|
|
||||||
if (enabled && timingDepth > 0 && --timingDepth == 0 && start != 0) {
|
|
||||||
TimingHandler last = TIMING_STACK.removeLast();
|
|
||||||
if (last != this) {
|
|
||||||
Logger.getGlobal().log(Level.SEVERE, "TIMING_STACK_CORRUPTION - Report this to Paper! ( " + this.identifier + ":" + last +")", new Throwable());
|
|
||||||
TIMING_STACK.addLast(last); // Add it back
|
|
||||||
}
|
|
||||||
addDiff(System.nanoTime() - start, TIMING_STACK.peekLast());
|
|
||||||
|
|
||||||
start = 0;
|
|
||||||
ThreadAssertion.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Akarin end
|
|
||||||
|
|
||||||
public void stopTiming() {
|
public void stopTiming() {
|
||||||
if (enabled && timingDepth > 0 && (ThreadAssertion.is() || Bukkit.isPrimaryThread()) && --timingDepth == 0 && start != 0) { // Akarin
|
if (!enabled || timingDepth <= 0 || start == 0 || !Bukkit.isPrimaryThread()) {
|
||||||
TimingHandler last;
|
return;
|
||||||
while ((last = TIMING_STACK.removeLast()) != this) {
|
}
|
||||||
last.timingDepth = 0;
|
|
||||||
String reportTo;
|
|
||||||
if ("minecraft".equals(last.identifier.group)) {
|
|
||||||
reportTo = "Paper! This is a potential bug in Paper";
|
|
||||||
} else {
|
|
||||||
reportTo = "the plugin " + last.identifier.group + "(Look for errors above this in the logs)";
|
|
||||||
}
|
|
||||||
Logger.getGlobal().log(Level.SEVERE, "TIMING_STACK_CORRUPTION - Report this to " + reportTo + " (" + last.identifier +" did not stopTiming)", new Throwable());
|
|
||||||
}
|
|
||||||
addDiff(System.nanoTime() - start, TIMING_STACK.peekLast());
|
|
||||||
|
|
||||||
|
popTimingStack();
|
||||||
|
if (--timingDepth == 0) {
|
||||||
|
addDiff(System.nanoTime() - start, startParent);
|
||||||
|
startParent = null;
|
||||||
start = 0;
|
start = 0;
|
||||||
// Akarin start
|
}
|
||||||
if (AkarinGlobalConfig.lazyThreadAssertion)
|
}
|
||||||
ThreadAssertion.close();
|
|
||||||
// Akarin end
|
private void popTimingStack() {
|
||||||
|
TimingHandler last;
|
||||||
|
while ((last = TIMING_STACK.removeLast()) != this) {
|
||||||
|
last.timingDepth = 0;
|
||||||
|
String reportTo;
|
||||||
|
if ("Minecraft".equalsIgnoreCase(last.identifier.group)) {
|
||||||
|
reportTo = "Paper! This is a potential bug in Paper";
|
||||||
|
} else {
|
||||||
|
reportTo = "the plugin " + last.identifier.group + "(Look for errors above this in the logs)";
|
||||||
|
}
|
||||||
|
Logger.getGlobal().log(Level.SEVERE, "TIMING_STACK_CORRUPTION - Report this to " + reportTo + " (" + last.identifier + " did not stopTiming)", new Throwable());
|
||||||
|
boolean found = TIMING_STACK.contains(this);
|
||||||
|
if (!found) {
|
||||||
|
// We aren't even in the stack... Don't pop everything
|
||||||
|
TIMING_STACK.addLast(last);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,7 +179,7 @@ class TimingHandler implements Timing {
|
|||||||
checkEnabled();
|
checkEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull // Akarin - javax.annotation
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public TimingHandler getTimingHandler() {
|
public TimingHandler getTimingHandler() {
|
||||||
return this;
|
return this;
|
||||||
@@ -229,7 +200,7 @@ class TimingHandler implements Timing {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
if (ThreadAssertion.is()) stopTimingUnsafe(); else stopTimingIfSync(); // Akarin
|
stopTimingIfSync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSpecial() {
|
public boolean isSpecial() {
|
||||||
@@ -244,7 +215,7 @@ class TimingHandler implements Timing {
|
|||||||
return enabled;
|
return enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull // Akarin - javax.annotation
|
@NotNull
|
||||||
TimingData[] cloneChildren() {
|
TimingData[] cloneChildren() {
|
||||||
final TimingData[] clonedChildren = new TimingData[children.size()];
|
final TimingData[] clonedChildren = new TimingData[children.size()];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ public class TimingHistory {
|
|||||||
public JSONPair apply(Map.Entry<EntityType, Counter> entry) {
|
public JSONPair apply(Map.Entry<EntityType, Counter> entry) {
|
||||||
entityTypeSet.add(entry.getKey());
|
entityTypeSet.add(entry.getKey());
|
||||||
return pair(
|
return pair(
|
||||||
String.valueOf(entry.getKey().getTypeId()),
|
String.valueOf(entry.getKey().ordinal()),
|
||||||
entry.getValue().count()
|
entry.getValue().count()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -157,7 +157,7 @@ public class TimingHistory {
|
|||||||
public JSONPair apply(Map.Entry<Material, Counter> entry) {
|
public JSONPair apply(Map.Entry<Material, Counter> entry) {
|
||||||
tileEntityTypeSet.add(entry.getKey());
|
tileEntityTypeSet.add(entry.getKey());
|
||||||
return pair(
|
return pair(
|
||||||
String.valueOf(entry.getKey().getId()),
|
String.valueOf(entry.getKey().ordinal()),
|
||||||
entry.getValue().count()
|
entry.getValue().count()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ class TimingsExport extends Thread {
|
|||||||
);
|
);
|
||||||
if (!TimingsManager.privacy) {
|
if (!TimingsManager.privacy) {
|
||||||
appendObjectData(parent,
|
appendObjectData(parent,
|
||||||
pair("server", Bukkit.getServerName()),
|
pair("server", Bukkit.getUnsafe().getTimingsServerName()),
|
||||||
pair("motd", Bukkit.getServer().getMotd()),
|
pair("motd", Bukkit.getServer().getMotd()),
|
||||||
pair("online-mode", Bukkit.getServer().getOnlineMode()),
|
pair("online-mode", Bukkit.getServer().getOnlineMode()),
|
||||||
pair("icon", Bukkit.getServer().getServerIcon().getData())
|
pair("icon", Bukkit.getServer().getServerIcon().getData())
|
||||||
@@ -184,9 +184,9 @@ class TimingsExport extends Thread {
|
|||||||
pair("handlers", handlers),
|
pair("handlers", handlers),
|
||||||
pair("worlds", toObjectMapper(TimingHistory.worldMap.entrySet(), input -> pair(input.getValue(), input.getKey()))),
|
pair("worlds", toObjectMapper(TimingHistory.worldMap.entrySet(), input -> pair(input.getValue(), input.getKey()))),
|
||||||
pair("tileentity",
|
pair("tileentity",
|
||||||
toObjectMapper(tileEntityTypeSet, input -> pair(input.getId(), input.name()))),
|
toObjectMapper(tileEntityTypeSet, input -> pair(input.ordinal(), input.name()))),
|
||||||
pair("entity",
|
pair("entity",
|
||||||
toObjectMapper(entityTypeSet, input -> pair(input.getTypeId(), input.name())))
|
toObjectMapper(entityTypeSet, input -> pair(input.ordinal(), input.name())))
|
||||||
));
|
));
|
||||||
|
|
||||||
// Information about loaded plugins
|
// Information about loaded plugins
|
||||||
@@ -288,8 +288,8 @@ class TimingsExport extends Thread {
|
|||||||
String hostName = "BrokenHost";
|
String hostName = "BrokenHost";
|
||||||
try {
|
try {
|
||||||
hostName = InetAddress.getLocalHost().getHostName();
|
hostName = InetAddress.getLocalHost().getHostName();
|
||||||
} catch(Exception ignored) {}
|
} catch (Exception ignored) {}
|
||||||
con.setRequestProperty("User-Agent", "Paper/" + Bukkit.getServerName() + "/" + hostName);
|
con.setRequestProperty("User-Agent", "Paper/" + Bukkit.getUnsafe().getTimingsServerName() + "/" + hostName);
|
||||||
con.setRequestMethod("POST");
|
con.setRequestMethod("POST");
|
||||||
con.setInstanceFollowRedirects(false);
|
con.setInstanceFollowRedirects(false);
|
||||||
|
|
||||||
|
|||||||
35
api/src/main/java/com/destroystokyo/paper/HeightmapType.java
Normal file
35
api/src/main/java/com/destroystokyo/paper/HeightmapType.java
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
package com.destroystokyo.paper;
|
||||||
|
|
||||||
|
import org.bukkit.World;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enumeration of different heightmap types maintained by the server. Generally using these maps is much faster
|
||||||
|
* than using an iterative search for a block in a given x, z coordinate.
|
||||||
|
*/
|
||||||
|
public enum HeightmapType {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The highest block used for lighting in the world. Also the block returned by {@link World#getHighestBlockYAt(int, int)}}
|
||||||
|
*/
|
||||||
|
LIGHT_BLOCKING,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* References the highest block in the world.
|
||||||
|
*/
|
||||||
|
ANY,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* References the highest solid block in a world.
|
||||||
|
*/
|
||||||
|
SOLID,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* References the highest solid or liquid block in a world.
|
||||||
|
*/
|
||||||
|
SOLID_OR_LIQUID,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* References the highest solid or liquid block in a world, excluding leaves.
|
||||||
|
*/
|
||||||
|
SOLID_OR_LIQUID_NO_LEAVES;
|
||||||
|
}
|
||||||
@@ -100,14 +100,6 @@ public class MaterialTags {
|
|||||||
*/
|
*/
|
||||||
public static final MaterialSetTag DYES = new MaterialSetTag(keyFor("dyes"))
|
public static final MaterialSetTag DYES = new MaterialSetTag(keyFor("dyes"))
|
||||||
.endsWith("_DYE")
|
.endsWith("_DYE")
|
||||||
.add(Material.BONE_MEAL,
|
|
||||||
Material.CACTUS_GREEN,
|
|
||||||
Material.COCOA_BEANS,
|
|
||||||
Material.DANDELION_YELLOW,
|
|
||||||
Material.INK_SAC,
|
|
||||||
Material.LAPIS_LAZULI,
|
|
||||||
Material.ROSE_RED
|
|
||||||
)
|
|
||||||
.ensureSize("DYES", 16);
|
.ensureSize("DYES", 16);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -181,7 +173,7 @@ public class MaterialTags {
|
|||||||
*/
|
*/
|
||||||
public static final MaterialSetTag HORSE_ARMORS = new MaterialSetTag(keyFor("horse_armors"))
|
public static final MaterialSetTag HORSE_ARMORS = new MaterialSetTag(keyFor("horse_armors"))
|
||||||
.endsWith("_HORSE_ARMOR")
|
.endsWith("_HORSE_ARMOR")
|
||||||
.ensureSize("HORSE_ARMORS", 3);
|
.ensureSize("HORSE_ARMORS", 4);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Covers the 6 variants of infested blocks.
|
* Covers the 6 variants of infested blocks.
|
||||||
@@ -316,7 +308,7 @@ public class MaterialTags {
|
|||||||
*/
|
*/
|
||||||
public static final MaterialSetTag SPAWN_EGGS = new MaterialSetTag(keyFor("spawn_eggs"))
|
public static final MaterialSetTag SPAWN_EGGS = new MaterialSetTag(keyFor("spawn_eggs"))
|
||||||
.endsWith("_SPAWN_EGG")
|
.endsWith("_SPAWN_EGG")
|
||||||
.ensureSize("SPAWN_EGGS", 51);
|
.ensureSize("SPAWN_EGGS", 58);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Covers all 16 colors of stained glass.
|
* Covers all 16 colors of stained glass.
|
||||||
@@ -364,8 +356,8 @@ public class MaterialTags {
|
|||||||
.ensureSize("PURPUR", 4);
|
.ensureSize("PURPUR", 4);
|
||||||
|
|
||||||
public static final MaterialSetTag SIGNS = new MaterialSetTag(keyFor("signs"))
|
public static final MaterialSetTag SIGNS = new MaterialSetTag(keyFor("signs"))
|
||||||
.add(Material.SIGN, Material.WALL_SIGN)
|
.endsWith("_SIGN")
|
||||||
.ensureSize("SIGNS", 2);
|
.ensureSize("SIGNS", 12);
|
||||||
|
|
||||||
public static final MaterialSetTag TORCH = new MaterialSetTag(keyFor("torch"))
|
public static final MaterialSetTag TORCH = new MaterialSetTag(keyFor("torch"))
|
||||||
.add(Material.TORCH, Material.WALL_TORCH)
|
.add(Material.TORCH, Material.WALL_TORCH)
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
package com.destroystokyo.paper.block;
|
||||||
|
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents the sounds that a {@link Block} makes in certain situations
|
||||||
|
* <p>
|
||||||
|
* The sound group includes break, step, place, hit, and fall sounds.
|
||||||
|
*/
|
||||||
|
public interface BlockSoundGroup {
|
||||||
|
/**
|
||||||
|
* Gets the sound that plays when breaking this block
|
||||||
|
*
|
||||||
|
* @return The break sound
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
Sound getBreakSound();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the sound that plays when stepping on this block
|
||||||
|
*
|
||||||
|
* @return The step sound
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
Sound getStepSound();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the sound that plays when placing this block
|
||||||
|
*
|
||||||
|
* @return The place sound
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
Sound getPlaceSound();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the sound that plays when hitting this block
|
||||||
|
*
|
||||||
|
* @return The hit sound
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
Sound getHitSound();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the sound that plays when this block falls
|
||||||
|
*
|
||||||
|
* @return The fall sound
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
Sound getFallSound();
|
||||||
|
}
|
||||||
@@ -36,6 +36,7 @@ public class PlayerHandshakeEvent extends Event implements Cancellable {
|
|||||||
* @param cancelled if this event is enabled
|
* @param cancelled if this event is enabled
|
||||||
*/
|
*/
|
||||||
public PlayerHandshakeEvent(@NotNull String originalHandshake, boolean cancelled) {
|
public PlayerHandshakeEvent(@NotNull String originalHandshake, boolean cancelled) {
|
||||||
|
super(true);
|
||||||
this.originalHandshake = originalHandshake;
|
this.originalHandshake = originalHandshake;
|
||||||
this.cancelled = cancelled;
|
this.cancelled = cancelled;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ public final class GS4QueryEvent extends Event {
|
|||||||
private QueryResponse response;
|
private QueryResponse response;
|
||||||
|
|
||||||
public GS4QueryEvent(@NotNull QueryType queryType, @NotNull InetAddress querierAddress, @NotNull QueryResponse response) {
|
public GS4QueryEvent(@NotNull QueryType queryType, @NotNull InetAddress querierAddress, @NotNull QueryResponse response) {
|
||||||
|
super(true); // should always be called async
|
||||||
this.queryType = Preconditions.checkNotNull(queryType, "queryType");
|
this.queryType = Preconditions.checkNotNull(queryType, "queryType");
|
||||||
this.querierAddress = Preconditions.checkNotNull(querierAddress, "querierAddress");
|
this.querierAddress = Preconditions.checkNotNull(querierAddress, "querierAddress");
|
||||||
this.response = Preconditions.checkNotNull(response, "response");
|
this.response = Preconditions.checkNotNull(response, "response");
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.destroystokyo.paper.event.server;
|
|||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import org.apache.commons.lang.Validate;
|
import org.apache.commons.lang.Validate;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
import com.destroystokyo.paper.exception.ServerException;
|
import com.destroystokyo.paper.exception.ServerException;
|
||||||
@@ -15,6 +16,7 @@ public class ServerExceptionEvent extends Event {
|
|||||||
@NotNull private ServerException exception;
|
@NotNull private ServerException exception;
|
||||||
|
|
||||||
public ServerExceptionEvent(@NotNull ServerException exception) {
|
public ServerExceptionEvent(@NotNull ServerException exception) {
|
||||||
|
super(!Bukkit.isPrimaryThread());
|
||||||
this.exception = Preconditions.checkNotNull(exception, "exception");
|
this.exception = Preconditions.checkNotNull(exception, "exception");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package com.destroystokyo.paper.util;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
public interface VersionFetcher {
|
||||||
|
/**
|
||||||
|
* Amount of time to cache results for in milliseconds
|
||||||
|
* <p>
|
||||||
|
* Negative values will never cache.
|
||||||
|
*
|
||||||
|
* @return cache time
|
||||||
|
*/
|
||||||
|
long getCacheTime();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the version message to cache and show to command senders. Multiple messages can be sent using newlines (\n)
|
||||||
|
* in the string. The string will be split on these newlines and sent as individual messages.
|
||||||
|
* <p>
|
||||||
|
* NOTE: This is run in a new thread separate from that of the command processing thread
|
||||||
|
*
|
||||||
|
* @param serverVersion the current version of the server (will match {@link Bukkit#getVersion()})
|
||||||
|
* @return the message to show when requesting a version
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
String getVersionMessage(@NotNull String serverVersion);
|
||||||
|
|
||||||
|
class DummyVersionFetcher implements VersionFetcher {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getCacheTime() {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public String getVersionMessage(@NotNull String serverVersion) {
|
||||||
|
Bukkit.getLogger().warning("Version provider has not been set, cannot check for updates!");
|
||||||
|
Bukkit.getLogger().info("Override the default implementation of org.bukkit.UnsafeValues#getVersionFetcher()");
|
||||||
|
new Throwable().printStackTrace();
|
||||||
|
return "Unable to check for updates. No version provider set.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
package io.akarin.server.api.event;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents event with a player attached
|
|
||||||
*/
|
|
||||||
public interface PlayerAttachedEvent {
|
|
||||||
public Player getPlayer();
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
package io.akarin.server.api.event;
|
|
||||||
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents event with a world attached
|
|
||||||
*/
|
|
||||||
public interface WorldAttachedEvent {
|
|
||||||
public World getWorld();
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
package io.akarin.server.api.structure;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents a village structure
|
|
||||||
*/
|
|
||||||
public interface Village {
|
|
||||||
}
|
|
||||||
@@ -1,227 +0,0 @@
|
|||||||
package io.akarin.server.core;
|
|
||||||
|
|
||||||
import com.google.common.base.Throwables;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.lang.reflect.Modifier;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.LogManager;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
|
||||||
|
|
||||||
@SuppressWarnings({"UnusedIsStillUsed", "unused"})
|
|
||||||
public class AkarinGlobalConfig {
|
|
||||||
private final static Logger LOGGER = Logger.getLogger("Akarin");
|
|
||||||
|
|
||||||
private static File CONFIG_FILE;
|
|
||||||
private static final String HEADER = "This is the global configuration file for Akarin.\n"
|
|
||||||
+ "Some options may impact gameplay, so use with caution,\n"
|
|
||||||
+ "and make sure you know what each option does before configuring.\n"
|
|
||||||
+ "\n"
|
|
||||||
+ "Akarin website: https://akarin.io/ \n";
|
|
||||||
/*========================================================================*/
|
|
||||||
public static YamlConfiguration config;
|
|
||||||
static int version;
|
|
||||||
/*========================================================================*/
|
|
||||||
public static void init(File configFile) {
|
|
||||||
CONFIG_FILE = configFile;
|
|
||||||
config = new YamlConfiguration();
|
|
||||||
try {
|
|
||||||
config.load(CONFIG_FILE);
|
|
||||||
} catch (IOException ex) {
|
|
||||||
} catch (InvalidConfigurationException ex) {
|
|
||||||
LOGGER.log(Level.SEVERE, "Could not load akarin.yml, please correct your syntax errors");
|
|
||||||
ex.printStackTrace();
|
|
||||||
throw Throwables.propagate(ex);
|
|
||||||
}
|
|
||||||
config.options().header(HEADER);
|
|
||||||
config.options().copyDefaults(true);
|
|
||||||
|
|
||||||
version = getInt("config-version", 3);
|
|
||||||
set("config-version", 3);
|
|
||||||
readConfig(AkarinGlobalConfig.class, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void readConfig(Class<?> clazz, Object instance) {
|
|
||||||
for (Method method : clazz.getDeclaredMethods()) {
|
|
||||||
if (Modifier.isPrivate(method.getModifiers())) {
|
|
||||||
if (method.getParameterTypes().length == 0 && method.getReturnType() == Void.TYPE) {
|
|
||||||
try {
|
|
||||||
method.setAccessible(true);
|
|
||||||
method.invoke(instance);
|
|
||||||
} catch (InvocationTargetException ex) {
|
|
||||||
throw Throwables.propagate(ex.getCause());
|
|
||||||
} catch (Exception ex) {
|
|
||||||
LOGGER.log(Level.SEVERE, "Error invoking " + method);
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
config.save(CONFIG_FILE);
|
|
||||||
} catch (IOException ex) {
|
|
||||||
LOGGER.log(Level.SEVERE, "Could not save " + CONFIG_FILE);
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final Pattern SPACE = Pattern.compile(" ");
|
|
||||||
private static final Pattern NOT_NUMERIC = Pattern.compile("[^-\\d.]");
|
|
||||||
public static int getSeconds(String str) {
|
|
||||||
str = SPACE.matcher(str).replaceAll("");
|
|
||||||
final char unit = str.charAt(str.length() - 1);
|
|
||||||
str = NOT_NUMERIC.matcher(str).replaceAll("");
|
|
||||||
double num;
|
|
||||||
try {
|
|
||||||
num = Double.parseDouble(str);
|
|
||||||
} catch (Exception e) {
|
|
||||||
num = 0D;
|
|
||||||
}
|
|
||||||
switch (unit) {
|
|
||||||
case 'd': num *= (double) 60*60*24; break;
|
|
||||||
case 'h': num *= (double) 60*60; break;
|
|
||||||
case 'm': num *= 60; break;
|
|
||||||
default: case 's': break;
|
|
||||||
}
|
|
||||||
return (int) num;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static String timeSummary(int seconds) {
|
|
||||||
String time = "";
|
|
||||||
|
|
||||||
if (seconds > 60 * 60 * 24) {
|
|
||||||
time += TimeUnit.SECONDS.toDays(seconds) + "d";
|
|
||||||
seconds %= 60 * 60 * 24;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (seconds > 60 * 60) {
|
|
||||||
time += TimeUnit.SECONDS.toHours(seconds) + "h";
|
|
||||||
seconds %= 60 * 60;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (seconds > 0) {
|
|
||||||
time += TimeUnit.SECONDS.toMinutes(seconds) + "m";
|
|
||||||
}
|
|
||||||
return time;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void set(String path, Object val) {
|
|
||||||
config.set(path, val);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean getBoolean(String path, boolean def) {
|
|
||||||
config.addDefault(path, def);
|
|
||||||
return config.getBoolean(path, config.getBoolean(path));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static double getDouble(String path, double def) {
|
|
||||||
config.addDefault(path, def);
|
|
||||||
return config.getDouble(path, config.getDouble(path));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static float getFloat(String path, float def) {
|
|
||||||
// TODO: Figure out why getFloat() always returns the default value.
|
|
||||||
return (float) getDouble(path, def);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int getInt(String path, int def) {
|
|
||||||
config.addDefault(path, def);
|
|
||||||
return config.getInt(path, config.getInt(path));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static <T> List getList(String path, T def) {
|
|
||||||
config.addDefault(path, def);
|
|
||||||
return config.getList(path, config.getList(path));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String getString(String path, String def) {
|
|
||||||
config.addDefault(path, def);
|
|
||||||
return config.getString(path, config.getString(path));
|
|
||||||
}
|
|
||||||
/*========================================================================*/
|
|
||||||
public static boolean noResponseDoGC = true;
|
|
||||||
private static void noResponseDoGC() {
|
|
||||||
noResponseDoGC = getBoolean("alternative.gc-before-stuck-restart", noResponseDoGC);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String serverBrandName = "";
|
|
||||||
private static void serverBrandName() {
|
|
||||||
serverBrandName = getString("alternative.modified-server-brand-name", serverBrandName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int fileIOThreads = 2;
|
|
||||||
private static void fileIOThreads() {
|
|
||||||
fileIOThreads = getInt("core.chunk-save-threads", fileIOThreads);
|
|
||||||
fileIOThreads = fileIOThreads < 1 ? 1 : fileIOThreads;
|
|
||||||
fileIOThreads = fileIOThreads > 8 ? 8 : fileIOThreads;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean fixPhysicsEventBehaviour = false;
|
|
||||||
private static void fixPhysicsEventBehavior() {
|
|
||||||
fixPhysicsEventBehaviour = getBoolean("alternative.fix-physics-event-behaviour", fixPhysicsEventBehaviour);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean lazyThreadAssertion = true;
|
|
||||||
private static void lazyThreadAssertion() {
|
|
||||||
lazyThreadAssertion = getBoolean("core.lazy-thread-assertion", lazyThreadAssertion);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static double blockbreakAnimationVisibleDistance = 1024;
|
|
||||||
private static void blockbreakAnimationVisibleDistance() {
|
|
||||||
double def = 32.00;
|
|
||||||
if (version == 2)
|
|
||||||
def = getDouble("alternative.block-break-animation-visible-distance", def);
|
|
||||||
|
|
||||||
blockbreakAnimationVisibleDistance = Math.sqrt(getDouble("core.block-break-animation-visible-distance", def));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean enableAsyncLighting = true;
|
|
||||||
private static void enableAsyncLighting() {
|
|
||||||
enableAsyncLighting = getBoolean("core.async-lighting.enable", enableAsyncLighting);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String yggdrasilServerURL = "https://api.mojang.com/";
|
|
||||||
private static void yggdrasilServerURL() {
|
|
||||||
yggdrasilServerURL = getString("alternative.yggdrasil.url", yggdrasilServerURL);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean disallowBeforeLogin = false;
|
|
||||||
private static void disallowBeforeLogin() {
|
|
||||||
disallowBeforeLogin = getBoolean("alternative.disallow-before-login-event", disallowBeforeLogin);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean allowExcessiveSigns = false;
|
|
||||||
private static void allowExcessiveSigns() {
|
|
||||||
allowExcessiveSigns = getBoolean("alternative.allow-excessive-signs", allowExcessiveSigns);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean ignoreRayTraceForSeatableBlocks = false;
|
|
||||||
private static void ignoreRayTraceForSeatableBlocks() {
|
|
||||||
ignoreRayTraceForSeatableBlocks = getBoolean("alternative.ignore-ray-trace-for-seatable-blocks", ignoreRayTraceForSeatableBlocks);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean improvedMobSpawnMechanics = false;
|
|
||||||
private static void improvedMobSpawnMechanics() {
|
|
||||||
improvedMobSpawnMechanics = getBoolean("core.improved-mob-spawn-mechanics.enable", improvedMobSpawnMechanics);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int userCacheExpireDays = 30;
|
|
||||||
private static void enableModernUserCaches() {
|
|
||||||
userCacheExpireDays = getSeconds(getString("core.user-cache-expire-time", "30d"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean spinningAwaitTicking = true;
|
|
||||||
private static void spinningAwaitTicking() {
|
|
||||||
spinningAwaitTicking = getBoolean("core.spinning-tick-await", spinningAwaitTicking);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,17 +1,15 @@
|
|||||||
package org.bukkit;
|
package org.bukkit;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
import org.apache.commons.lang.Validate;
|
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import org.apache.commons.lang.Validate;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the art on a painting
|
* Represents the art on a painting
|
||||||
*/
|
*/
|
||||||
public enum Art {
|
public enum Art implements Keyed {
|
||||||
KEBAB(0, 1, 1),
|
KEBAB(0, 1, 1),
|
||||||
AZTEC(1, 1, 1),
|
AZTEC(1, 1, 1),
|
||||||
ALBAN(2, 1, 1),
|
ALBAN(2, 1, 1),
|
||||||
@@ -39,7 +37,8 @@ public enum Art {
|
|||||||
SKELETON(24, 4, 3),
|
SKELETON(24, 4, 3),
|
||||||
DONKEY_KONG(25, 4, 3);
|
DONKEY_KONG(25, 4, 3);
|
||||||
|
|
||||||
private int id, width, height;
|
private final int id, width, height;
|
||||||
|
private final NamespacedKey key;
|
||||||
private static final HashMap<String, Art> BY_NAME = Maps.newHashMap();
|
private static final HashMap<String, Art> BY_NAME = Maps.newHashMap();
|
||||||
private static final HashMap<Integer, Art> BY_ID = Maps.newHashMap();
|
private static final HashMap<Integer, Art> BY_ID = Maps.newHashMap();
|
||||||
|
|
||||||
@@ -47,6 +46,7 @@ public enum Art {
|
|||||||
this.id = id;
|
this.id = id;
|
||||||
this.width = width;
|
this.width = width;
|
||||||
this.height = height;
|
this.height = height;
|
||||||
|
this.key = NamespacedKey.minecraft(name().toLowerCase(java.util.Locale.ENGLISH));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -78,6 +78,12 @@ public enum Art {
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public NamespacedKey getKey() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a painting by its numeric ID
|
* Get a painting by its numeric ID
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
package org.bukkit;
|
package org.bukkit;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A single entry from a ban list. This may represent either a player ban or
|
* A single entry from a ban list. This may represent either a player ban or
|
||||||
* an IP ban.
|
* an IP ban.
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
package org.bukkit;
|
package org.bukkit;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A ban list, containing bans of some {@link Type}.
|
* A ban list, containing bans of some {@link Type}.
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package org.bukkit;
|
package org.bukkit;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@@ -12,8 +13,8 @@ import java.util.Set;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.bukkit.Warning.WarningState;
|
import org.bukkit.Warning.WarningState;
|
||||||
|
import org.bukkit.advancement.Advancement;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.boss.BarColor;
|
import org.bukkit.boss.BarColor;
|
||||||
import org.bukkit.boss.BarFlag;
|
import org.bukkit.boss.BarFlag;
|
||||||
@@ -28,12 +29,15 @@ import org.bukkit.entity.Entity;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.inventory.InventoryType;
|
import org.bukkit.event.inventory.InventoryType;
|
||||||
import org.bukkit.event.server.ServerListPingEvent;
|
import org.bukkit.event.server.ServerListPingEvent;
|
||||||
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
import org.bukkit.help.HelpMap;
|
import org.bukkit.help.HelpMap;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.InventoryHolder;
|
import org.bukkit.inventory.InventoryHolder;
|
||||||
|
import org.bukkit.inventory.ItemFactory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.Merchant;
|
import org.bukkit.inventory.Merchant;
|
||||||
import org.bukkit.inventory.Recipe;
|
import org.bukkit.inventory.Recipe;
|
||||||
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
import org.bukkit.loot.LootTable;
|
import org.bukkit.loot.LootTable;
|
||||||
import org.bukkit.map.MapView;
|
import org.bukkit.map.MapView;
|
||||||
import org.bukkit.permissions.Permissible;
|
import org.bukkit.permissions.Permissible;
|
||||||
@@ -43,13 +47,6 @@ import org.bukkit.plugin.messaging.Messenger;
|
|||||||
import org.bukkit.scheduler.BukkitScheduler;
|
import org.bukkit.scheduler.BukkitScheduler;
|
||||||
import org.bukkit.scoreboard.ScoreboardManager;
|
import org.bukkit.scoreboard.ScoreboardManager;
|
||||||
import org.bukkit.util.CachedServerIcon;
|
import org.bukkit.util.CachedServerIcon;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
import org.bukkit.advancement.Advancement;
|
|
||||||
import org.bukkit.generator.ChunkGenerator;
|
|
||||||
|
|
||||||
import org.bukkit.inventory.ItemFactory;
|
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
|
||||||
import org.jetbrains.annotations.Contract;
|
import org.jetbrains.annotations.Contract;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -192,31 +189,6 @@ public final class Bukkit {
|
|||||||
return server.getIp();
|
return server.getIp();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the name of this server.
|
|
||||||
*
|
|
||||||
* @return the name of this server
|
|
||||||
* @deprecated not a standard server property
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
@NotNull
|
|
||||||
public static String getServerName() {
|
|
||||||
return server.getServerName();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get an ID of this server. The ID is a simple generally alphanumeric ID
|
|
||||||
* that can be used for uniquely identifying this server.
|
|
||||||
*
|
|
||||||
* @return the ID of this server
|
|
||||||
* @deprecated not a standard server property
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
@NotNull
|
|
||||||
public static String getServerId() {
|
|
||||||
return server.getServerId();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get world type (level-type setting) for default world.
|
* Get world type (level-type setting) for default world.
|
||||||
*
|
*
|
||||||
@@ -981,11 +953,9 @@ public final class Bukkit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an empty inventory with the specified type and title. If the type
|
* Creates an empty inventory with the specified type. If the type
|
||||||
* is {@link InventoryType#CHEST}, the new inventory has a size of 27;
|
* is {@link InventoryType#CHEST}, the new inventory has a size of 27;
|
||||||
* otherwise the new inventory has the normal size for its type.<br>
|
* otherwise the new inventory has the normal size for its type.
|
||||||
* It should be noted that some inventory types do not support titles and
|
|
||||||
* may not render with said titles on the Minecraft client.
|
|
||||||
* <br>
|
* <br>
|
||||||
* {@link InventoryType#WORKBENCH} will not process crafting recipes if
|
* {@link InventoryType#WORKBENCH} will not process crafting recipes if
|
||||||
* created with this method. Use
|
* created with this method. Use
|
||||||
@@ -1533,9 +1503,7 @@ public final class Bukkit {
|
|||||||
* no further guarantees are made.
|
* no further guarantees are made.
|
||||||
* @throws IllegalArgumentException if the selector is malformed in any way
|
* @throws IllegalArgumentException if the selector is malformed in any way
|
||||||
* or a parameter is null
|
* or a parameter is null
|
||||||
* @deprecated draft API
|
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static List<Entity> selectEntities(@NotNull CommandSender sender, @NotNull String selector) throws IllegalArgumentException {
|
public static List<Entity> selectEntities(@NotNull CommandSender sender, @NotNull String selector) throws IllegalArgumentException {
|
||||||
return server.selectEntities(sender, selector);
|
return server.selectEntities(sender, selector);
|
||||||
@@ -1631,6 +1599,10 @@ public final class Bukkit {
|
|||||||
public static com.destroystokyo.paper.profile.PlayerProfile createProfile(@Nullable UUID uuid, @Nullable String name) {
|
public static com.destroystokyo.paper.profile.PlayerProfile createProfile(@Nullable UUID uuid, @Nullable String name) {
|
||||||
return server.createProfile(uuid, name);
|
return server.createProfile(uuid, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int getCurrentTick() {
|
||||||
|
return server.getCurrentTick();
|
||||||
|
}
|
||||||
// Paper end
|
// Paper end
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
package org.bukkit;
|
package org.bukkit;
|
||||||
|
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.apache.commons.lang.Validate;
|
import org.apache.commons.lang.Validate;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import org.jetbrains.annotations.Contract;
|
import org.jetbrains.annotations.Contract;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -13,7 +11,7 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
/**
|
/**
|
||||||
* All supported color values for chat
|
* All supported color values for chat
|
||||||
*/
|
*/
|
||||||
public enum ChatColor{
|
public enum ChatColor {
|
||||||
/**
|
/**
|
||||||
* Represents black
|
* Represents black
|
||||||
*/
|
*/
|
||||||
@@ -27,7 +25,7 @@ public enum ChatColor{
|
|||||||
/**
|
/**
|
||||||
* Represents dark blue
|
* Represents dark blue
|
||||||
*/
|
*/
|
||||||
DARK_BLUE('1', 0x1){
|
DARK_BLUE('1', 0x1) {
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public net.md_5.bungee.api.ChatColor asBungee() {
|
public net.md_5.bungee.api.ChatColor asBungee() {
|
||||||
@@ -37,7 +35,7 @@ public enum ChatColor{
|
|||||||
/**
|
/**
|
||||||
* Represents dark green
|
* Represents dark green
|
||||||
*/
|
*/
|
||||||
DARK_GREEN('2', 0x2){
|
DARK_GREEN('2', 0x2) {
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public net.md_5.bungee.api.ChatColor asBungee() {
|
public net.md_5.bungee.api.ChatColor asBungee() {
|
||||||
@@ -47,7 +45,7 @@ public enum ChatColor{
|
|||||||
/**
|
/**
|
||||||
* Represents dark blue (aqua)
|
* Represents dark blue (aqua)
|
||||||
*/
|
*/
|
||||||
DARK_AQUA('3', 0x3){
|
DARK_AQUA('3', 0x3) {
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public net.md_5.bungee.api.ChatColor asBungee() {
|
public net.md_5.bungee.api.ChatColor asBungee() {
|
||||||
@@ -57,7 +55,7 @@ public enum ChatColor{
|
|||||||
/**
|
/**
|
||||||
* Represents dark red
|
* Represents dark red
|
||||||
*/
|
*/
|
||||||
DARK_RED('4', 0x4){
|
DARK_RED('4', 0x4) {
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public net.md_5.bungee.api.ChatColor asBungee() {
|
public net.md_5.bungee.api.ChatColor asBungee() {
|
||||||
@@ -67,7 +65,7 @@ public enum ChatColor{
|
|||||||
/**
|
/**
|
||||||
* Represents dark purple
|
* Represents dark purple
|
||||||
*/
|
*/
|
||||||
DARK_PURPLE('5', 0x5){
|
DARK_PURPLE('5', 0x5) {
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public net.md_5.bungee.api.ChatColor asBungee() {
|
public net.md_5.bungee.api.ChatColor asBungee() {
|
||||||
@@ -77,7 +75,7 @@ public enum ChatColor{
|
|||||||
/**
|
/**
|
||||||
* Represents gold
|
* Represents gold
|
||||||
*/
|
*/
|
||||||
GOLD('6', 0x6){
|
GOLD('6', 0x6) {
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public net.md_5.bungee.api.ChatColor asBungee() {
|
public net.md_5.bungee.api.ChatColor asBungee() {
|
||||||
@@ -87,7 +85,7 @@ public enum ChatColor{
|
|||||||
/**
|
/**
|
||||||
* Represents gray
|
* Represents gray
|
||||||
*/
|
*/
|
||||||
GRAY('7', 0x7){
|
GRAY('7', 0x7) {
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public net.md_5.bungee.api.ChatColor asBungee() {
|
public net.md_5.bungee.api.ChatColor asBungee() {
|
||||||
@@ -97,7 +95,7 @@ public enum ChatColor{
|
|||||||
/**
|
/**
|
||||||
* Represents dark gray
|
* Represents dark gray
|
||||||
*/
|
*/
|
||||||
DARK_GRAY('8', 0x8){
|
DARK_GRAY('8', 0x8) {
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public net.md_5.bungee.api.ChatColor asBungee() {
|
public net.md_5.bungee.api.ChatColor asBungee() {
|
||||||
@@ -107,7 +105,7 @@ public enum ChatColor{
|
|||||||
/**
|
/**
|
||||||
* Represents blue
|
* Represents blue
|
||||||
*/
|
*/
|
||||||
BLUE('9', 0x9){
|
BLUE('9', 0x9) {
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public net.md_5.bungee.api.ChatColor asBungee() {
|
public net.md_5.bungee.api.ChatColor asBungee() {
|
||||||
@@ -117,7 +115,7 @@ public enum ChatColor{
|
|||||||
/**
|
/**
|
||||||
* Represents green
|
* Represents green
|
||||||
*/
|
*/
|
||||||
GREEN('a', 0xA){
|
GREEN('a', 0xA) {
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public net.md_5.bungee.api.ChatColor asBungee() {
|
public net.md_5.bungee.api.ChatColor asBungee() {
|
||||||
@@ -127,7 +125,7 @@ public enum ChatColor{
|
|||||||
/**
|
/**
|
||||||
* Represents aqua
|
* Represents aqua
|
||||||
*/
|
*/
|
||||||
AQUA('b', 0xB){
|
AQUA('b', 0xB) {
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public net.md_5.bungee.api.ChatColor asBungee() {
|
public net.md_5.bungee.api.ChatColor asBungee() {
|
||||||
@@ -137,7 +135,7 @@ public enum ChatColor{
|
|||||||
/**
|
/**
|
||||||
* Represents red
|
* Represents red
|
||||||
*/
|
*/
|
||||||
RED('c', 0xC){
|
RED('c', 0xC) {
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public net.md_5.bungee.api.ChatColor asBungee() {
|
public net.md_5.bungee.api.ChatColor asBungee() {
|
||||||
@@ -147,7 +145,7 @@ public enum ChatColor{
|
|||||||
/**
|
/**
|
||||||
* Represents light purple
|
* Represents light purple
|
||||||
*/
|
*/
|
||||||
LIGHT_PURPLE('d', 0xD){
|
LIGHT_PURPLE('d', 0xD) {
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public net.md_5.bungee.api.ChatColor asBungee() {
|
public net.md_5.bungee.api.ChatColor asBungee() {
|
||||||
@@ -157,7 +155,7 @@ public enum ChatColor{
|
|||||||
/**
|
/**
|
||||||
* Represents yellow
|
* Represents yellow
|
||||||
*/
|
*/
|
||||||
YELLOW('e', 0xE){
|
YELLOW('e', 0xE) {
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public net.md_5.bungee.api.ChatColor asBungee() {
|
public net.md_5.bungee.api.ChatColor asBungee() {
|
||||||
@@ -167,7 +165,7 @@ public enum ChatColor{
|
|||||||
/**
|
/**
|
||||||
* Represents white
|
* Represents white
|
||||||
*/
|
*/
|
||||||
WHITE('f', 0xF){
|
WHITE('f', 0xF) {
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public net.md_5.bungee.api.ChatColor asBungee() {
|
public net.md_5.bungee.api.ChatColor asBungee() {
|
||||||
@@ -177,7 +175,7 @@ public enum ChatColor{
|
|||||||
/**
|
/**
|
||||||
* Represents magical characters that change around randomly
|
* Represents magical characters that change around randomly
|
||||||
*/
|
*/
|
||||||
MAGIC('k', 0x10, true){
|
MAGIC('k', 0x10, true) {
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public net.md_5.bungee.api.ChatColor asBungee() {
|
public net.md_5.bungee.api.ChatColor asBungee() {
|
||||||
@@ -187,7 +185,7 @@ public enum ChatColor{
|
|||||||
/**
|
/**
|
||||||
* Makes the text bold.
|
* Makes the text bold.
|
||||||
*/
|
*/
|
||||||
BOLD('l', 0x11, true){
|
BOLD('l', 0x11, true) {
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public net.md_5.bungee.api.ChatColor asBungee() {
|
public net.md_5.bungee.api.ChatColor asBungee() {
|
||||||
@@ -197,7 +195,7 @@ public enum ChatColor{
|
|||||||
/**
|
/**
|
||||||
* Makes a line appear through the text.
|
* Makes a line appear through the text.
|
||||||
*/
|
*/
|
||||||
STRIKETHROUGH('m', 0x12, true){
|
STRIKETHROUGH('m', 0x12, true) {
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public net.md_5.bungee.api.ChatColor asBungee() {
|
public net.md_5.bungee.api.ChatColor asBungee() {
|
||||||
@@ -207,7 +205,7 @@ public enum ChatColor{
|
|||||||
/**
|
/**
|
||||||
* Makes the text appear underlined.
|
* Makes the text appear underlined.
|
||||||
*/
|
*/
|
||||||
UNDERLINE('n', 0x13, true){
|
UNDERLINE('n', 0x13, true) {
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public net.md_5.bungee.api.ChatColor asBungee() {
|
public net.md_5.bungee.api.ChatColor asBungee() {
|
||||||
@@ -217,7 +215,7 @@ public enum ChatColor{
|
|||||||
/**
|
/**
|
||||||
* Makes the text italic.
|
* Makes the text italic.
|
||||||
*/
|
*/
|
||||||
ITALIC('o', 0x14, true){
|
ITALIC('o', 0x14, true) {
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public net.md_5.bungee.api.ChatColor asBungee() {
|
public net.md_5.bungee.api.ChatColor asBungee() {
|
||||||
@@ -227,7 +225,7 @@ public enum ChatColor{
|
|||||||
/**
|
/**
|
||||||
* Resets all previous chat colors or formats.
|
* Resets all previous chat colors or formats.
|
||||||
*/
|
*/
|
||||||
RESET('r', 0x15){
|
RESET('r', 0x15) {
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public net.md_5.bungee.api.ChatColor asBungee() {
|
public net.md_5.bungee.api.ChatColor asBungee() {
|
||||||
@@ -246,8 +244,8 @@ public enum ChatColor{
|
|||||||
private final char code;
|
private final char code;
|
||||||
private final boolean isFormat;
|
private final boolean isFormat;
|
||||||
private final String toString;
|
private final String toString;
|
||||||
private final static Map<Integer, ChatColor> BY_ID = Maps.newHashMap();
|
private static final Map<Integer, ChatColor> BY_ID = Maps.newHashMap();
|
||||||
private final static Map<Character, ChatColor> BY_CHAR = Maps.newHashMap();
|
private static final Map<Character, ChatColor> BY_CHAR = Maps.newHashMap();
|
||||||
|
|
||||||
private ChatColor(char code, int intCode) {
|
private ChatColor(char code, int intCode) {
|
||||||
this(code, intCode, false);
|
this(code, intCode, false);
|
||||||
@@ -353,6 +351,8 @@ public enum ChatColor{
|
|||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
public static String translateAlternateColorCodes(char altColorChar, @NotNull String textToTranslate) {
|
public static String translateAlternateColorCodes(char altColorChar, @NotNull String textToTranslate) {
|
||||||
|
Validate.notNull(textToTranslate, "Cannot translate null text");
|
||||||
|
|
||||||
char[] b = textToTranslate.toCharArray();
|
char[] b = textToTranslate.toCharArray();
|
||||||
for (int i = 0; i < b.length - 1; i++) {
|
for (int i = 0; i < b.length - 1; i++) {
|
||||||
if (b[i] == altColorChar && "0123456789AaBbCcDdEeFfKkLlMmNnOoRr".indexOf(b[i+1]) > -1) {
|
if (b[i] == altColorChar && "0123456789AaBbCcDdEeFfKkLlMmNnOoRr".indexOf(b[i+1]) > -1) {
|
||||||
@@ -371,6 +371,8 @@ public enum ChatColor{
|
|||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
public static String getLastColors(@NotNull String input) {
|
public static String getLastColors(@NotNull String input) {
|
||||||
|
Validate.notNull(input, "Cannot get last colors from null text");
|
||||||
|
|
||||||
String result = "";
|
String result = "";
|
||||||
int length = input.length();
|
int length = input.length();
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
package org.bukkit;
|
package org.bukkit;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
|
import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -143,18 +146,6 @@ public interface Chunk {
|
|||||||
*/
|
*/
|
||||||
boolean load();
|
boolean load();
|
||||||
|
|
||||||
/**
|
|
||||||
* Unloads and optionally saves the Chunk
|
|
||||||
*
|
|
||||||
* @param save Controls whether the chunk is saved
|
|
||||||
* @param safe Controls whether to unload the chunk when players are
|
|
||||||
* nearby
|
|
||||||
* @return true if the chunk has unloaded successfully, otherwise false
|
|
||||||
* @deprecated it is never safe to remove a chunk in use
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
boolean unload(boolean save, boolean safe);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unloads and optionally saves the Chunk
|
* Unloads and optionally saves the Chunk
|
||||||
*
|
*
|
||||||
@@ -194,8 +185,81 @@ public interface Chunk {
|
|||||||
* <p>
|
* <p>
|
||||||
* A force loaded chunk will not be unloaded due to lack of player activity.
|
* A force loaded chunk will not be unloaded due to lack of player activity.
|
||||||
*
|
*
|
||||||
* @param forced
|
* @param forced force load status
|
||||||
* @see World#setChunkForceLoaded(int, int, boolean)
|
* @see World#setChunkForceLoaded(int, int, boolean)
|
||||||
*/
|
*/
|
||||||
void setForceLoaded(boolean forced);
|
void setForceLoaded(boolean forced);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a plugin ticket for this chunk, loading this chunk if it is not
|
||||||
|
* already loaded.
|
||||||
|
* <p>
|
||||||
|
* A plugin ticket will prevent a chunk from unloading until it is
|
||||||
|
* explicitly removed. A plugin instance may only have one ticket per chunk,
|
||||||
|
* but each chunk can have multiple plugin tickets.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param plugin Plugin which owns the ticket
|
||||||
|
* @return {@code true} if a plugin ticket was added, {@code false} if the
|
||||||
|
* ticket already exists for the plugin
|
||||||
|
* @throws IllegalStateException If the specified plugin is not enabled
|
||||||
|
* @see World#addPluginChunkTicket(int, int, Plugin)
|
||||||
|
*/
|
||||||
|
boolean addPluginChunkTicket(@NotNull Plugin plugin);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the specified plugin's ticket for this chunk
|
||||||
|
* <p>
|
||||||
|
* A plugin ticket will prevent a chunk from unloading until it is
|
||||||
|
* explicitly removed. A plugin instance may only have one ticket per chunk,
|
||||||
|
* but each chunk can have multiple plugin tickets.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param plugin Plugin which owns the ticket
|
||||||
|
* @return {@code true} if the plugin ticket was removed, {@code false} if
|
||||||
|
* there is no plugin ticket for the chunk
|
||||||
|
* @see World#removePluginChunkTicket(int, int, Plugin)
|
||||||
|
*/
|
||||||
|
boolean removePluginChunkTicket(@NotNull Plugin plugin);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves a collection specifying which plugins have tickets for this
|
||||||
|
* chunk. This collection is not updated when plugin tickets are added or
|
||||||
|
* removed to this chunk.
|
||||||
|
* <p>
|
||||||
|
* A plugin ticket will prevent a chunk from unloading until it is
|
||||||
|
* explicitly removed. A plugin instance may only have one ticket per chunk,
|
||||||
|
* but each chunk can have multiple plugin tickets.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @return unmodifiable collection containing which plugins have tickets for
|
||||||
|
* this chunk
|
||||||
|
* @see World#getPluginChunkTickets(int, int)
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
Collection<Plugin> getPluginChunkTickets();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the amount of time in ticks that this chunk has been inhabited.
|
||||||
|
*
|
||||||
|
* Note that the time is incremented once per tick per player in the chunk.
|
||||||
|
*
|
||||||
|
* @return inhabited time
|
||||||
|
*/
|
||||||
|
long getInhabitedTime();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the amount of time in ticks that this chunk has been inhabited.
|
||||||
|
*
|
||||||
|
* @param ticks new inhabited time
|
||||||
|
*/
|
||||||
|
void setInhabitedTime(long ticks);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests if this chunk contains the specified block.
|
||||||
|
*
|
||||||
|
* @param block block to test
|
||||||
|
* @return if the block is contained within
|
||||||
|
*/
|
||||||
|
boolean contains(@NotNull BlockData block);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -131,4 +131,12 @@ public interface ChunkSnapshot {
|
|||||||
* @return true if empty, false if not
|
* @return true if empty, false if not
|
||||||
*/
|
*/
|
||||||
boolean isSectionEmpty(int sy);
|
boolean isSectionEmpty(int sy);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests if this snapshot contains the specified block.
|
||||||
|
*
|
||||||
|
* @param block block to test
|
||||||
|
* @return if the block is contained within
|
||||||
|
*/
|
||||||
|
boolean contains(@NotNull BlockData block);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
package org.bukkit;
|
package org.bukkit;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
import java.util.Map;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -13,7 +12,7 @@ public enum CoalType {
|
|||||||
CHARCOAL(0x1);
|
CHARCOAL(0x1);
|
||||||
|
|
||||||
private final byte data;
|
private final byte data;
|
||||||
private final static Map<Byte, CoalType> BY_DATA = Maps.newHashMap();
|
private static final Map<Byte, CoalType> BY_DATA = Maps.newHashMap();
|
||||||
|
|
||||||
private CoalType(final int data) {
|
private CoalType(final int data) {
|
||||||
this.data = (byte) data;
|
this.data = (byte) data;
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
package org.bukkit;
|
package org.bukkit;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.commons.lang.Validate;
|
import org.apache.commons.lang.Validate;
|
||||||
import org.bukkit.configuration.serialization.ConfigurationSerializable;
|
import org.bukkit.configuration.serialization.ConfigurationSerializable;
|
||||||
import org.bukkit.configuration.serialization.SerializableAs;
|
import org.bukkit.configuration.serialization.SerializableAs;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -319,6 +317,7 @@ public final class Color implements ConfigurationSerializable {
|
|||||||
return asRGB() ^ Color.class.hashCode();
|
return asRGB() ^ Color.class.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@NotNull
|
@NotNull
|
||||||
public Map<String, Object> serialize() {
|
public Map<String, Object> serialize() {
|
||||||
return ImmutableMap.<String, Object>of(
|
return ImmutableMap.<String, Object>of(
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
package org.bukkit;
|
package org.bukkit;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
import java.util.Map;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -44,7 +43,7 @@ public enum CropState {
|
|||||||
RIPE(0x7);
|
RIPE(0x7);
|
||||||
|
|
||||||
private final byte data;
|
private final byte data;
|
||||||
private final static Map<Byte, CropState> BY_DATA = Maps.newHashMap();
|
private static final Map<Byte, CropState> BY_DATA = Maps.newHashMap();
|
||||||
|
|
||||||
private CropState(final int data) {
|
private CropState(final int data) {
|
||||||
this.data = (byte) data;
|
this.data = (byte) data;
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
package org.bukkit;
|
package org.bukkit;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
import java.util.Map;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -35,7 +34,7 @@ public enum Difficulty {
|
|||||||
HARD(3);
|
HARD(3);
|
||||||
|
|
||||||
private final int value;
|
private final int value;
|
||||||
private final static Map<Integer, Difficulty> BY_ID = Maps.newHashMap();
|
private static final Map<Integer, Difficulty> BY_ID = Maps.newHashMap();
|
||||||
|
|
||||||
private Difficulty(final int value) {
|
private Difficulty(final int value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
package org.bukkit;
|
package org.bukkit;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
import java.util.Map;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
@@ -80,10 +79,10 @@ public enum DyeColor {
|
|||||||
private final byte dyeData;
|
private final byte dyeData;
|
||||||
private final Color color;
|
private final Color color;
|
||||||
private final Color firework;
|
private final Color firework;
|
||||||
private final static DyeColor[] BY_WOOL_DATA;
|
private static final DyeColor[] BY_WOOL_DATA;
|
||||||
private final static DyeColor[] BY_DYE_DATA;
|
private static final DyeColor[] BY_DYE_DATA;
|
||||||
private final static Map<Color, DyeColor> BY_COLOR;
|
private static final Map<Color, DyeColor> BY_COLOR;
|
||||||
private final static Map<Color, DyeColor> BY_FIREWORK;
|
private static final Map<Color, DyeColor> BY_FIREWORK;
|
||||||
|
|
||||||
private DyeColor(final int woolData, final int dyeData, /*@NotNull*/ Color color, /*@NotNull*/ Color firework) {
|
private DyeColor(final int woolData, final int dyeData, /*@NotNull*/ Color color, /*@NotNull*/ Color firework) {
|
||||||
this.woolData = (byte) woolData;
|
this.woolData = (byte) woolData;
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
package org.bukkit;
|
package org.bukkit;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
import java.util.Map;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.potion.Potion;
|
import org.bukkit.potion.Potion;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
package org.bukkit;
|
package org.bukkit;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
import java.util.Map;
|
||||||
import org.bukkit.entity.Ageable;
|
import org.bukkit.entity.Ageable;
|
||||||
import org.bukkit.entity.ArmorStand;
|
import org.bukkit.entity.ArmorStand;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
@@ -153,7 +152,7 @@ public enum EntityEffect {
|
|||||||
|
|
||||||
private final byte data;
|
private final byte data;
|
||||||
private final Class<? extends Entity> applicable;
|
private final Class<? extends Entity> applicable;
|
||||||
private final static Map<Byte, EntityEffect> BY_DATA = Maps.newHashMap();
|
private static final Map<Byte, EntityEffect> BY_DATA = Maps.newHashMap();
|
||||||
|
|
||||||
EntityEffect(final int data, /*@NotNull*/ Class<? extends Entity> clazz) {
|
EntityEffect(final int data, /*@NotNull*/ Class<? extends Entity> clazz) {
|
||||||
this.data = (byte) data;
|
this.data = (byte) data;
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
package org.bukkit;
|
package org.bukkit;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.apache.commons.lang.Validate;
|
|
||||||
import org.bukkit.configuration.serialization.ConfigurationSerializable;
|
|
||||||
import org.bukkit.configuration.serialization.SerializableAs;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.apache.commons.lang.Validate;
|
||||||
|
import org.bukkit.configuration.serialization.ConfigurationSerializable;
|
||||||
|
import org.bukkit.configuration.serialization.SerializableAs;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
package org.bukkit;
|
package org.bukkit;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.bukkit.entity.HumanEntity;
|
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.bukkit.entity.HumanEntity;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -36,7 +34,7 @@ public enum GameMode {
|
|||||||
SPECTATOR(3);
|
SPECTATOR(3);
|
||||||
|
|
||||||
private final int value;
|
private final int value;
|
||||||
private final static Map<Integer, GameMode> BY_ID = Maps.newHashMap();
|
private static final Map<Integer, GameMode> BY_ID = Maps.newHashMap();
|
||||||
|
|
||||||
private GameMode(final int value) {
|
private GameMode(final int value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
package org.bukkit;
|
package org.bukkit;
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GameRules dictate certain behavior within Minecraft itself
|
* GameRules dictate certain behavior within Minecraft itself
|
||||||
@@ -117,6 +116,11 @@ public final class GameRule<T> {
|
|||||||
*/
|
*/
|
||||||
public static final GameRule<Boolean> SPECTATORS_GENERATE_CHUNKS = new GameRule<>("spectatorsGenerateChunks", Boolean.class);
|
public static final GameRule<Boolean> SPECTATORS_GENERATE_CHUNKS = new GameRule<>("spectatorsGenerateChunks", Boolean.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether pillager raids are enabled or not.
|
||||||
|
*/
|
||||||
|
public static final GameRule<Boolean> DISABLE_RAIDS = new GameRule<>("disableRaids", Boolean.class);
|
||||||
|
|
||||||
// Numerical rules
|
// Numerical rules
|
||||||
/**
|
/**
|
||||||
* How often a random block tick occurs (such as plant growth, leaf decay,
|
* How often a random block tick occurs (such as plant growth, leaf decay,
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
package org.bukkit;
|
package org.bukkit;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
import java.util.Map;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -24,7 +23,7 @@ public enum GrassSpecies {
|
|||||||
FERN_LIKE(0x2);
|
FERN_LIKE(0x2);
|
||||||
|
|
||||||
private final byte data;
|
private final byte data;
|
||||||
private final static Map<Byte, GrassSpecies> BY_DATA = Maps.newHashMap();
|
private static final Map<Byte, GrassSpecies> BY_DATA = Maps.newHashMap();
|
||||||
|
|
||||||
private GrassSpecies(final int data) {
|
private GrassSpecies(final int data) {
|
||||||
this.data = (byte) data;
|
this.data = (byte) data;
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
package org.bukkit;
|
package org.bukkit;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
import java.util.Map;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
public enum Instrument {
|
public enum Instrument {
|
||||||
@@ -51,10 +50,34 @@ public enum Instrument {
|
|||||||
/**
|
/**
|
||||||
* Xylophone is normally played when a note block is on top of a bone block.
|
* Xylophone is normally played when a note block is on top of a bone block.
|
||||||
*/
|
*/
|
||||||
XYLOPHONE(0x9);
|
XYLOPHONE(0x9),
|
||||||
|
/**
|
||||||
|
* Iron Xylophone is normally played when a note block is on top of a iron block.
|
||||||
|
*/
|
||||||
|
IRON_XYLOPHONE(0xA),
|
||||||
|
/**
|
||||||
|
* Cow Bell is normally played when a note block is on top of a soul sand block.
|
||||||
|
*/
|
||||||
|
COW_BELL(0xB),
|
||||||
|
/**
|
||||||
|
* Didgeridoo is normally played when a note block is on top of a pumpkin block.
|
||||||
|
*/
|
||||||
|
DIDGERIDOO(0xC),
|
||||||
|
/**
|
||||||
|
* Bit is normally played when a note block is on top of a emerald block.
|
||||||
|
*/
|
||||||
|
BIT(0xD),
|
||||||
|
/**
|
||||||
|
* Banjo is normally played when a note block is on top of a hay block.
|
||||||
|
*/
|
||||||
|
BANJO(0xE),
|
||||||
|
/**
|
||||||
|
* Pling is normally played when a note block is on top of a glowstone block.
|
||||||
|
*/
|
||||||
|
PLING(0xF);
|
||||||
|
|
||||||
private final byte type;
|
private final byte type;
|
||||||
private final static Map<Byte, Instrument> BY_DATA = Maps.newHashMap();
|
private static final Map<Byte, Instrument> BY_DATA = Maps.newHashMap();
|
||||||
|
|
||||||
private Instrument(final int type) {
|
private Instrument(final int type) {
|
||||||
this.type = (byte) type;
|
this.type = (byte) type;
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
package org.bukkit;
|
package org.bukkit;
|
||||||
|
|
||||||
|
import com.google.common.base.Preconditions;
|
||||||
|
import java.lang.ref.Reference;
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
import com.google.common.base.Preconditions; // Paper
|
import com.google.common.base.Preconditions; // Paper
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.configuration.serialization.ConfigurationSerializable;
|
import org.bukkit.configuration.serialization.ConfigurationSerializable;
|
||||||
import org.bukkit.entity.Entity; // Paper
|
import org.bukkit.entity.Entity; // Paper
|
||||||
@@ -29,7 +31,7 @@ import org.bukkit.entity.Player;
|
|||||||
* representation by the implementation.
|
* representation by the implementation.
|
||||||
*/
|
*/
|
||||||
public class Location implements Cloneable, ConfigurationSerializable {
|
public class Location implements Cloneable, ConfigurationSerializable {
|
||||||
private World world;
|
private Reference<World> world;
|
||||||
private double x;
|
private double x;
|
||||||
private double y;
|
private double y;
|
||||||
private double z;
|
private double z;
|
||||||
@@ -58,8 +60,11 @@ public class Location implements Cloneable, ConfigurationSerializable {
|
|||||||
* @param yaw The absolute rotation on the x-plane, in degrees
|
* @param yaw The absolute rotation on the x-plane, in degrees
|
||||||
* @param pitch The absolute rotation on the y-plane, in degrees
|
* @param pitch The absolute rotation on the y-plane, in degrees
|
||||||
*/
|
*/
|
||||||
public Location(@UndefinedNullability final World world, final double x, final double y, final double z, final float yaw, final float pitch) { // Paper
|
public Location(@UndefinedNullability final World world, final double x, final double y, final double z, final float yaw, final float pitch) {
|
||||||
this.world = world;
|
if (world != null) {
|
||||||
|
this.world = new WeakReference<>(world);
|
||||||
|
}
|
||||||
|
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
this.z = z;
|
this.z = z;
|
||||||
@@ -73,16 +78,38 @@ public class Location implements Cloneable, ConfigurationSerializable {
|
|||||||
* @param world New world that this location resides in
|
* @param world New world that this location resides in
|
||||||
*/
|
*/
|
||||||
public void setWorld(@Nullable World world) {
|
public void setWorld(@Nullable World world) {
|
||||||
this.world = world;
|
this.world = (world == null) ? null : new WeakReference<>(world);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if world in this location is present and loaded.
|
||||||
|
*
|
||||||
|
* @return true if is loaded, otherwise false
|
||||||
|
*/
|
||||||
|
public boolean isWorldLoaded() {
|
||||||
|
if (this.world == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
World world = this.world.get();
|
||||||
|
return world != null && Bukkit.getWorld(world.getUID()) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the world that this location resides in
|
* Gets the world that this location resides in
|
||||||
*
|
*
|
||||||
* @return World that contains this location
|
* @return World that contains this location, or {@code null} if it is not set
|
||||||
|
* @throws IllegalArgumentException when world is unloaded
|
||||||
|
* @see #isWorldLoaded()
|
||||||
*/
|
*/
|
||||||
@UndefinedNullability
|
@UndefinedNullability
|
||||||
public World getWorld() {
|
public World getWorld() {
|
||||||
|
if (this.world == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
World world = this.world.get();
|
||||||
|
Preconditions.checkArgument(world != null, "World unloaded");
|
||||||
return world;
|
return world;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,7 +120,7 @@ public class Location implements Cloneable, ConfigurationSerializable {
|
|||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
public Chunk getChunk() {
|
public Chunk getChunk() {
|
||||||
return world.getChunkAt(this);
|
return getWorld().getChunkAt(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -103,7 +130,7 @@ public class Location implements Cloneable, ConfigurationSerializable {
|
|||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
public Block getBlock() {
|
public Block getBlock() {
|
||||||
return world.getBlockAt(this);
|
return getWorld().getBlockAt(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -516,7 +543,7 @@ public class Location implements Cloneable, ConfigurationSerializable {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isChunkLoaded() { return world.isChunkLoaded(locToBlock(x) >> 4, locToBlock(z) >> 4); } // Paper
|
public boolean isChunkLoaded() { return this.getWorld().isChunkLoaded(locToBlock(x) >> 4, locToBlock(z) >> 4); } // Paper
|
||||||
|
|
||||||
// Paper start
|
// Paper start
|
||||||
/**
|
/**
|
||||||
@@ -525,6 +552,7 @@ public class Location implements Cloneable, ConfigurationSerializable {
|
|||||||
* @return true if a chunk has been generated at this location
|
* @return true if a chunk has been generated at this location
|
||||||
*/
|
*/
|
||||||
public boolean isGenerated() {
|
public boolean isGenerated() {
|
||||||
|
World world = this.getWorld();
|
||||||
Preconditions.checkNotNull(world, "Location has no world!");
|
Preconditions.checkNotNull(world, "Location has no world!");
|
||||||
return world.isChunkGenerated(locToBlock(x) >> 4, locToBlock(z) >> 4);
|
return world.isChunkGenerated(locToBlock(x) >> 4, locToBlock(z) >> 4);
|
||||||
}
|
}
|
||||||
@@ -610,6 +638,33 @@ public class Location implements Cloneable, ConfigurationSerializable {
|
|||||||
return centerLoc;
|
return centerLoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Paper start - Add heightmap api
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a copy of this location except with y = getWorld().getHighestBlockYAt(this.getBlockX(), this.getBlockZ())
|
||||||
|
* @return A copy of this location except with y = getWorld().getHighestBlockYAt(this.getBlockX(), this.getBlockZ())
|
||||||
|
* @throws NullPointerException if {{@link #getWorld()}} is {@code null}
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
public Location toHighestLocation() {
|
||||||
|
return this.toHighestLocation(com.destroystokyo.paper.HeightmapType.LIGHT_BLOCKING);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a copy of this location except with y = getWorld().getHighestBlockYAt(this.getBlockX(), this.getBlockZ(), heightmap)
|
||||||
|
* @param heightmap The heightmap to use for finding the highest y location.
|
||||||
|
* @return A copy of this location except with y = getWorld().getHighestBlockYAt(this.getBlockX(), this.getBlockZ(), heightmap)
|
||||||
|
* @throws NullPointerException if {{@link #getWorld()}} is {@code null}
|
||||||
|
* @throws UnsupportedOperationException if {@link World#getHighestBlockYAt(int, int, com.destroystokyo.paper.HeightmapType)} does not support the specified heightmap
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
public Location toHighestLocation(@NotNull final com.destroystokyo.paper.HeightmapType heightmap) {
|
||||||
|
final Location ret = this.clone();
|
||||||
|
ret.setY(this.getWorld().getHighestBlockYAt(this, heightmap));
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
// Paper end
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates explosion at this location with given power
|
* Creates explosion at this location with given power
|
||||||
*
|
*
|
||||||
@@ -619,7 +674,7 @@ public class Location implements Cloneable, ConfigurationSerializable {
|
|||||||
* @return false if explosion was canceled, otherwise true
|
* @return false if explosion was canceled, otherwise true
|
||||||
*/
|
*/
|
||||||
public boolean createExplosion(float power) {
|
public boolean createExplosion(float power) {
|
||||||
return world.createExplosion(this, power);
|
return this.getWorld().createExplosion(this, power);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -633,7 +688,7 @@ public class Location implements Cloneable, ConfigurationSerializable {
|
|||||||
* @return false if explosion was canceled, otherwise true
|
* @return false if explosion was canceled, otherwise true
|
||||||
*/
|
*/
|
||||||
public boolean createExplosion(float power, boolean setFire) {
|
public boolean createExplosion(float power, boolean setFire) {
|
||||||
return world.createExplosion(this, power, setFire);
|
return this.getWorld().createExplosion(this, power, setFire);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -646,7 +701,7 @@ public class Location implements Cloneable, ConfigurationSerializable {
|
|||||||
* @return false if explosion was canceled, otherwise true
|
* @return false if explosion was canceled, otherwise true
|
||||||
*/
|
*/
|
||||||
public boolean createExplosion(float power, boolean setFire, boolean breakBlocks) {
|
public boolean createExplosion(float power, boolean setFire, boolean breakBlocks) {
|
||||||
return world.createExplosion(this, power, setFire, breakBlocks);
|
return this.getWorld().createExplosion(this, power, setFire, breakBlocks);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -659,7 +714,7 @@ public class Location implements Cloneable, ConfigurationSerializable {
|
|||||||
* @return false if explosion was canceled, otherwise true
|
* @return false if explosion was canceled, otherwise true
|
||||||
*/
|
*/
|
||||||
public boolean createExplosion(@Nullable Entity source, float power) {
|
public boolean createExplosion(@Nullable Entity source, float power) {
|
||||||
return world.createExplosion(source, this, power, true, true);
|
return this.getWorld().createExplosion(source, this, power, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -674,7 +729,7 @@ public class Location implements Cloneable, ConfigurationSerializable {
|
|||||||
* @return false if explosion was canceled, otherwise true
|
* @return false if explosion was canceled, otherwise true
|
||||||
*/
|
*/
|
||||||
public boolean createExplosion(@Nullable Entity source, float power, boolean setFire) {
|
public boolean createExplosion(@Nullable Entity source, float power, boolean setFire) {
|
||||||
return world.createExplosion(source, this, power, setFire, true);
|
return this.getWorld().createExplosion(source, this, power, setFire, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -688,7 +743,7 @@ public class Location implements Cloneable, ConfigurationSerializable {
|
|||||||
* @return false if explosion was canceled, otherwise true
|
* @return false if explosion was canceled, otherwise true
|
||||||
*/
|
*/
|
||||||
public boolean createExplosion(@NotNull Entity source, float power, boolean setFire, boolean breakBlocks) {
|
public boolean createExplosion(@NotNull Entity source, float power, boolean setFire, boolean breakBlocks) {
|
||||||
return world.createExplosion(source, source.getLocation(), power, setFire, breakBlocks);
|
return this.getWorld().createExplosion(source, source.getLocation(), power, setFire, breakBlocks);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -703,6 +758,7 @@ public class Location implements Cloneable, ConfigurationSerializable {
|
|||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
public Collection<Entity> getNearbyEntities(double x, double y, double z) {
|
public Collection<Entity> getNearbyEntities(double x, double y, double z) {
|
||||||
|
World world = this.getWorld();
|
||||||
if (world == null) {
|
if (world == null) {
|
||||||
throw new IllegalArgumentException("Location has no world");
|
throw new IllegalArgumentException("Location has no world");
|
||||||
}
|
}
|
||||||
@@ -925,6 +981,7 @@ public class Location implements Cloneable, ConfigurationSerializable {
|
|||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
public <T extends Entity> Collection<T> getNearbyEntitiesByType(@Nullable Class<? extends Entity> clazz, double xRadius, double yRadius, double zRadius, @Nullable Predicate<T> predicate) {
|
public <T extends Entity> Collection<T> getNearbyEntitiesByType(@Nullable Class<? extends Entity> clazz, double xRadius, double yRadius, double zRadius, @Nullable Predicate<T> predicate) {
|
||||||
|
World world = this.getWorld();
|
||||||
if (world == null) {
|
if (world == null) {
|
||||||
throw new IllegalArgumentException("Location has no world");
|
throw new IllegalArgumentException("Location has no world");
|
||||||
}
|
}
|
||||||
@@ -941,7 +998,9 @@ public class Location implements Cloneable, ConfigurationSerializable {
|
|||||||
}
|
}
|
||||||
final Location other = (Location) obj;
|
final Location other = (Location) obj;
|
||||||
|
|
||||||
if (this.world != other.world && (this.world == null || !this.world.equals(other.world))) {
|
World world = (this.world == null) ? null : this.world.get();
|
||||||
|
World otherWorld = (other.world == null) ? null : other.world.get();
|
||||||
|
if (world != otherWorld && (world == null || !world.equals(otherWorld))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (Double.doubleToLongBits(this.x) != Double.doubleToLongBits(other.x)) {
|
if (Double.doubleToLongBits(this.x) != Double.doubleToLongBits(other.x)) {
|
||||||
@@ -966,7 +1025,8 @@ public class Location implements Cloneable, ConfigurationSerializable {
|
|||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = 3;
|
int hash = 3;
|
||||||
|
|
||||||
hash = 19 * hash + (this.world != null ? this.world.hashCode() : 0);
|
World world = (this.world == null) ? null : this.world.get();
|
||||||
|
hash = 19 * hash + (world != null ? world.hashCode() : 0);
|
||||||
hash = 19 * hash + (int) (Double.doubleToLongBits(this.x) ^ (Double.doubleToLongBits(this.x) >>> 32));
|
hash = 19 * hash + (int) (Double.doubleToLongBits(this.x) ^ (Double.doubleToLongBits(this.x) >>> 32));
|
||||||
hash = 19 * hash + (int) (Double.doubleToLongBits(this.y) ^ (Double.doubleToLongBits(this.y) >>> 32));
|
hash = 19 * hash + (int) (Double.doubleToLongBits(this.y) ^ (Double.doubleToLongBits(this.y) >>> 32));
|
||||||
hash = 19 * hash + (int) (Double.doubleToLongBits(this.z) ^ (Double.doubleToLongBits(this.z) >>> 32));
|
hash = 19 * hash + (int) (Double.doubleToLongBits(this.z) ^ (Double.doubleToLongBits(this.z) >>> 32));
|
||||||
@@ -977,6 +1037,7 @@ public class Location implements Cloneable, ConfigurationSerializable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
World world = (this.world == null) ? null : this.world.get();
|
||||||
return "Location{" + "world=" + world + ",x=" + x + ",y=" + y + ",z=" + z + ",pitch=" + pitch + ",yaw=" + yaw + '}';
|
return "Location{" + "world=" + world + ",x=" + x + ",y=" + y + ",z=" + z + ",pitch=" + pitch + ",yaw=" + yaw + '}';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1025,11 +1086,15 @@ public class Location implements Cloneable, ConfigurationSerializable {
|
|||||||
return NumberConversions.floor(loc);
|
return NumberConversions.floor(loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@Utility
|
@Utility
|
||||||
@NotNull
|
@NotNull
|
||||||
public Map<String, Object> serialize() {
|
public Map<String, Object> serialize() {
|
||||||
Map<String, Object> data = new HashMap<String, Object>();
|
Map<String, Object> data = new HashMap<String, Object>();
|
||||||
data.put("world", this.world.getName());
|
|
||||||
|
if (this.world != null) {
|
||||||
|
data.put("world", getWorld().getName());
|
||||||
|
}
|
||||||
|
|
||||||
data.put("x", this.x);
|
data.put("x", this.x);
|
||||||
data.put("y", this.y);
|
data.put("y", this.y);
|
||||||
@@ -1051,9 +1116,12 @@ public class Location implements Cloneable, ConfigurationSerializable {
|
|||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
public static Location deserialize(@NotNull Map<String, Object> args) {
|
public static Location deserialize(@NotNull Map<String, Object> args) {
|
||||||
World world = Bukkit.getWorld((String) args.get("world"));
|
World world = null;
|
||||||
if (world == null) {
|
if (args.containsKey("world")) {
|
||||||
throw new IllegalArgumentException("unknown world");
|
world = Bukkit.getWorld((String) args.get("world"));
|
||||||
|
if (world == null) {
|
||||||
|
throw new IllegalArgumentException("unknown world");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Location(world, NumberConversions.toDouble(args.get("x")), NumberConversions.toDouble(args.get("y")), NumberConversions.toDouble(args.get("z")), NumberConversions.toFloat(args.get("yaw")), NumberConversions.toFloat(args.get("pitch")));
|
return new Location(world, NumberConversions.toDouble(args.get("x")), NumberConversions.toDouble(args.get("y")), NumberConversions.toDouble(args.get("z")), NumberConversions.toFloat(args.get("yaw")), NumberConversions.toFloat(args.get("pitch")));
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -39,8 +39,8 @@ public final class NamespacedKey implements com.destroystokyo.paper.Namespaced {
|
|||||||
/**
|
/**
|
||||||
* Create a key in a specific namespace.
|
* Create a key in a specific namespace.
|
||||||
*
|
*
|
||||||
* @param namespace String representing a grouping of keys
|
* @param namespace namespace
|
||||||
* @param key Name for this specific key
|
* @param key key
|
||||||
* @deprecated should never be used by plugins, for internal use only!!
|
* @deprecated should never be used by plugins, for internal use only!!
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@@ -72,7 +72,7 @@ public final class NamespacedKey implements com.destroystokyo.paper.Namespaced {
|
|||||||
Preconditions.checkArgument(key != null, "Key cannot be null");
|
Preconditions.checkArgument(key != null, "Key cannot be null");
|
||||||
|
|
||||||
this.namespace = plugin.getName().toLowerCase(Locale.ROOT);
|
this.namespace = plugin.getName().toLowerCase(Locale.ROOT);
|
||||||
this.key = key.toLowerCase().toLowerCase(Locale.ROOT);
|
this.key = key.toLowerCase(Locale.ROOT);
|
||||||
|
|
||||||
// Check validity after normalization
|
// Check validity after normalization
|
||||||
Preconditions.checkArgument(VALID_NAMESPACE.matcher(this.namespace).matches(), "Invalid namespace. Must be [a-z0-9._-]: %s", this.namespace);
|
Preconditions.checkArgument(VALID_NAMESPACE.matcher(this.namespace).matches(), "Invalid namespace. Must be [a-z0-9._-]: %s", this.namespace);
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
package org.bukkit;
|
package org.bukkit;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.apache.commons.lang.Validate;
|
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.apache.commons.lang.Validate;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package org.bukkit;
|
package org.bukkit;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.configuration.serialization.ConfigurationSerializable;
|
import org.bukkit.configuration.serialization.ConfigurationSerializable;
|
||||||
import org.bukkit.entity.AnimalTamer;
|
import org.bukkit.entity.AnimalTamer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -26,6 +25,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
|||||||
*
|
*
|
||||||
* @return Player name or null if we have not seen a name for this player yet
|
* @return Player name or null if we have not seen a name for this player yet
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public String getName();
|
public String getName();
|
||||||
|
|
||||||
@@ -34,6 +34,7 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
|||||||
*
|
*
|
||||||
* @return Player UUID
|
* @return Player UUID
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
@NotNull
|
@NotNull
|
||||||
public UUID getUniqueId();
|
public UUID getUniqueId();
|
||||||
|
|
||||||
|
|||||||
@@ -60,6 +60,14 @@ public enum Particle {
|
|||||||
BUBBLE_COLUMN_UP,
|
BUBBLE_COLUMN_UP,
|
||||||
NAUTILUS,
|
NAUTILUS,
|
||||||
DOLPHIN,
|
DOLPHIN,
|
||||||
|
SNEEZE,
|
||||||
|
CAMPFIRE_COSY_SMOKE,
|
||||||
|
CAMPFIRE_SIGNAL_SMOKE,
|
||||||
|
COMPOSTER,
|
||||||
|
FLASH,
|
||||||
|
FALLING_LAVA,
|
||||||
|
LANDING_LAVA,
|
||||||
|
FALLING_WATER,
|
||||||
// ----- Legacy Separator -----
|
// ----- Legacy Separator -----
|
||||||
LEGACY_BLOCK_CRACK(MaterialData.class),
|
LEGACY_BLOCK_CRACK(MaterialData.class),
|
||||||
LEGACY_BLOCK_DUST(MaterialData.class),
|
LEGACY_BLOCK_DUST(MaterialData.class),
|
||||||
|
|||||||
134
api/src/main/java/org/bukkit/Raid.java
Normal file
134
api/src/main/java/org/bukkit/Raid.java
Normal file
@@ -0,0 +1,134 @@
|
|||||||
|
package org.bukkit;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
import org.bukkit.entity.Raider;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a raid event.
|
||||||
|
*/
|
||||||
|
public interface Raid {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get whether this raid started.
|
||||||
|
*
|
||||||
|
* @return whether raid is started
|
||||||
|
*/
|
||||||
|
boolean isStarted();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the amount of ticks this raid has existed.
|
||||||
|
*
|
||||||
|
* @return active ticks
|
||||||
|
*/
|
||||||
|
long getActiveTicks();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Bad Omen level of this raid.
|
||||||
|
*
|
||||||
|
* @return Bad Omen level (between 0 and 5)
|
||||||
|
*/
|
||||||
|
int getBadOmenLevel();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the Bad Omen level.
|
||||||
|
* <br>
|
||||||
|
* If the level is higher than 1, there will be an additional wave that as
|
||||||
|
* strong as the final wave.
|
||||||
|
*
|
||||||
|
* @param badOmenLevel new Bad Omen level (from 0-5)
|
||||||
|
* @throws IllegalArgumentException if invalid Bad Omen level
|
||||||
|
*/
|
||||||
|
void setBadOmenLevel(int badOmenLevel);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the center location where the raid occurs.
|
||||||
|
*
|
||||||
|
* @return location
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
Location getLocation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the current status of the raid.
|
||||||
|
* <br>
|
||||||
|
* Do not use this method to check if the raid has been started, call
|
||||||
|
* {@link #isStarted()} instead.
|
||||||
|
*
|
||||||
|
* @return Raids status
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
RaidStatus getStatus();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the number of raider groups which have spawned.
|
||||||
|
*
|
||||||
|
* @return total spawned groups
|
||||||
|
*/
|
||||||
|
int getSpawnedGroups();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the number of raider groups which would spawn.
|
||||||
|
* <br>
|
||||||
|
* This also includes the group which spawns in the additional wave (if
|
||||||
|
* present).
|
||||||
|
*
|
||||||
|
* @return total groups
|
||||||
|
*/
|
||||||
|
int getTotalGroups();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the number of waves in this raid (exclude the additional wave).
|
||||||
|
*
|
||||||
|
* @return number of waves
|
||||||
|
*/
|
||||||
|
int getTotalWaves();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the sum of all raider's health.
|
||||||
|
*
|
||||||
|
* @return total raiders health
|
||||||
|
*/
|
||||||
|
float getTotalHealth();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the UUID of all heroes in this raid.
|
||||||
|
*
|
||||||
|
* @return a set of unique ids
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
Set<UUID> getHeroes();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets all remaining {@link Raider} in the present wave.
|
||||||
|
*
|
||||||
|
* @return a list of current raiders
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
List<Raider> getRaiders();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents the status of a {@link Raid}.
|
||||||
|
*/
|
||||||
|
public enum RaidStatus {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The raid is in progress.
|
||||||
|
*/
|
||||||
|
ONGOING,
|
||||||
|
/**
|
||||||
|
* The raid was beaten by heroes.
|
||||||
|
*/
|
||||||
|
VICTORY,
|
||||||
|
/**
|
||||||
|
* The village has fallen (i.e. all villagers died).
|
||||||
|
*/
|
||||||
|
LOSS,
|
||||||
|
/**
|
||||||
|
* The raid was terminated.
|
||||||
|
*/
|
||||||
|
STOPPED;
|
||||||
|
}
|
||||||
|
}
|
||||||
196
api/src/main/java/org/bukkit/Registry.java
Normal file
196
api/src/main/java/org/bukkit/Registry.java
Normal file
@@ -0,0 +1,196 @@
|
|||||||
|
package org.bukkit;
|
||||||
|
|
||||||
|
import com.google.common.base.Predicates;
|
||||||
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.Predicate;
|
||||||
|
import org.bukkit.advancement.Advancement;
|
||||||
|
import org.bukkit.block.Biome;
|
||||||
|
import org.bukkit.boss.KeyedBossBar;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.Villager;
|
||||||
|
import org.bukkit.entity.memory.MemoryKey;
|
||||||
|
import org.bukkit.loot.LootTables;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a registry of Bukkit objects that may be retrieved by
|
||||||
|
* {@link NamespacedKey}.
|
||||||
|
*
|
||||||
|
* @param <T> type of item in the registry
|
||||||
|
*/
|
||||||
|
public interface Registry<T extends Keyed> extends Iterable<T> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Server advancements.
|
||||||
|
*
|
||||||
|
* @see Bukkit#getAdvancement(org.bukkit.NamespacedKey)
|
||||||
|
* @see Bukkit#advancementIterator()
|
||||||
|
*/
|
||||||
|
Registry<Advancement> ADVANCEMENT = new Registry<Advancement>() {
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public Advancement get(@NotNull NamespacedKey key) {
|
||||||
|
return Bukkit.getAdvancement(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public Iterator<Advancement> iterator() {
|
||||||
|
return Bukkit.advancementIterator();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Server art.
|
||||||
|
*
|
||||||
|
* @see Art
|
||||||
|
*/
|
||||||
|
Registry<Art> ART = new SimpleRegistry<>(Art.class);
|
||||||
|
/**
|
||||||
|
* Server biomes.
|
||||||
|
*
|
||||||
|
* @see Biome
|
||||||
|
*/
|
||||||
|
Registry<Biome> BIOME = new SimpleRegistry<>(Biome.class);
|
||||||
|
/**
|
||||||
|
* Custom boss bars.
|
||||||
|
*
|
||||||
|
* @see Bukkit#getBossBar(org.bukkit.NamespacedKey)
|
||||||
|
* @see Bukkit#getBossBars()
|
||||||
|
*/
|
||||||
|
Registry<KeyedBossBar> BOSS_BARS = new Registry<KeyedBossBar>() {
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public KeyedBossBar get(@NotNull NamespacedKey key) {
|
||||||
|
return Bukkit.getBossBar(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public Iterator<KeyedBossBar> iterator() {
|
||||||
|
return Bukkit.getBossBars();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Server enchantments.
|
||||||
|
*
|
||||||
|
* @see Enchantment#getByKey(org.bukkit.NamespacedKey)
|
||||||
|
*/
|
||||||
|
Registry<Enchantment> ENCHANTMENT = new Registry<Enchantment>() {
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public Enchantment get(@NotNull NamespacedKey key) {
|
||||||
|
return Enchantment.getByKey(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public Iterator<Enchantment> iterator() {
|
||||||
|
return Arrays.asList(Enchantment.values()).iterator();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Server entity types.
|
||||||
|
*
|
||||||
|
* @see EntityType
|
||||||
|
*/
|
||||||
|
Registry<EntityType> ENTITY_TYPE = new SimpleRegistry<>(EntityType.class, (entity) -> entity != EntityType.UNKNOWN);
|
||||||
|
/**
|
||||||
|
* Default server loot tables.
|
||||||
|
*
|
||||||
|
* @see LootTables
|
||||||
|
*/
|
||||||
|
Registry<LootTables> LOOT_TABLES = new SimpleRegistry<>(LootTables.class);
|
||||||
|
/**
|
||||||
|
* Server materials.
|
||||||
|
*
|
||||||
|
* @see Material
|
||||||
|
*/
|
||||||
|
Registry<Material> MATERIAL = new SimpleRegistry<>(Material.class, (mat) -> !mat.isLegacy());
|
||||||
|
/**
|
||||||
|
* Server statistics.
|
||||||
|
*
|
||||||
|
* @see Statistic
|
||||||
|
*/
|
||||||
|
Registry<Statistic> STATISTIC = new SimpleRegistry<>(Statistic.class);
|
||||||
|
/**
|
||||||
|
* Villager profession.
|
||||||
|
*
|
||||||
|
* @see Villager.Profession
|
||||||
|
*/
|
||||||
|
Registry<Villager.Profession> VILLAGER_PROFESSION = new SimpleRegistry<>(Villager.Profession.class);
|
||||||
|
/**
|
||||||
|
* Villager type.
|
||||||
|
*
|
||||||
|
* @see Villager.Type
|
||||||
|
*/
|
||||||
|
Registry<Villager.Type> VILLAGER_TYPE = new SimpleRegistry<>(Villager.Type.class);
|
||||||
|
/**
|
||||||
|
* Memory Keys.
|
||||||
|
*
|
||||||
|
* @see MemoryKey
|
||||||
|
*/
|
||||||
|
Registry<MemoryKey> MEMORY_MODULE_TYPE = new Registry<MemoryKey>() {
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public Iterator iterator() {
|
||||||
|
return MemoryKey.values().iterator();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public MemoryKey get(@NotNull NamespacedKey key) {
|
||||||
|
return MemoryKey.getByKey(key);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the object by its key.
|
||||||
|
*
|
||||||
|
* @param key non-null key
|
||||||
|
* @return item or null if does not exist
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
T get(@NotNull NamespacedKey key);
|
||||||
|
|
||||||
|
static final class SimpleRegistry<T extends Enum<T> & Keyed> implements Registry<T> {
|
||||||
|
|
||||||
|
private final Map<NamespacedKey, T> map;
|
||||||
|
|
||||||
|
protected SimpleRegistry(@NotNull Class<T> type) {
|
||||||
|
this(type, Predicates.<T>alwaysTrue());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected SimpleRegistry(@NotNull Class<T> type, @NotNull Predicate<T> predicate) {
|
||||||
|
ImmutableMap.Builder<NamespacedKey, T> builder = ImmutableMap.builder();
|
||||||
|
|
||||||
|
for (T entry : type.getEnumConstants()) {
|
||||||
|
if (predicate.test(entry)) {
|
||||||
|
builder.put(entry.getKey(), entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
map = builder.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public T get(@NotNull NamespacedKey key) {
|
||||||
|
return map.get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public Iterator<T> iterator() {
|
||||||
|
return map.values().iterator();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,7 @@
|
|||||||
package org.bukkit;
|
package org.bukkit;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
import java.util.Map;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -14,7 +13,7 @@ public enum SandstoneType {
|
|||||||
SMOOTH(0x2);
|
SMOOTH(0x2);
|
||||||
|
|
||||||
private final byte data;
|
private final byte data;
|
||||||
private final static Map<Byte, SandstoneType> BY_DATA = Maps.newHashMap();
|
private static final Map<Byte, SandstoneType> BY_DATA = Maps.newHashMap();
|
||||||
|
|
||||||
private SandstoneType(final int data) {
|
private SandstoneType(final int data) {
|
||||||
this.data = (byte) data;
|
this.data = (byte) data;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package org.bukkit;
|
package org.bukkit;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@@ -12,8 +13,8 @@ import java.util.Set;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.bukkit.Warning.WarningState;
|
import org.bukkit.Warning.WarningState;
|
||||||
|
import org.bukkit.advancement.Advancement;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.boss.BarColor;
|
import org.bukkit.boss.BarColor;
|
||||||
import org.bukkit.boss.BarFlag;
|
import org.bukkit.boss.BarFlag;
|
||||||
@@ -28,12 +29,15 @@ import org.bukkit.entity.Entity;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.inventory.InventoryType;
|
import org.bukkit.event.inventory.InventoryType;
|
||||||
import org.bukkit.event.server.ServerListPingEvent;
|
import org.bukkit.event.server.ServerListPingEvent;
|
||||||
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
import org.bukkit.help.HelpMap;
|
import org.bukkit.help.HelpMap;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.InventoryHolder;
|
import org.bukkit.inventory.InventoryHolder;
|
||||||
|
import org.bukkit.inventory.ItemFactory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.Merchant;
|
import org.bukkit.inventory.Merchant;
|
||||||
import org.bukkit.inventory.Recipe;
|
import org.bukkit.inventory.Recipe;
|
||||||
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
import org.bukkit.loot.LootTable;
|
import org.bukkit.loot.LootTable;
|
||||||
import org.bukkit.map.MapView;
|
import org.bukkit.map.MapView;
|
||||||
import org.bukkit.permissions.Permissible;
|
import org.bukkit.permissions.Permissible;
|
||||||
@@ -44,13 +48,6 @@ import org.bukkit.plugin.messaging.PluginMessageRecipient;
|
|||||||
import org.bukkit.scheduler.BukkitScheduler;
|
import org.bukkit.scheduler.BukkitScheduler;
|
||||||
import org.bukkit.scoreboard.ScoreboardManager;
|
import org.bukkit.scoreboard.ScoreboardManager;
|
||||||
import org.bukkit.util.CachedServerIcon;
|
import org.bukkit.util.CachedServerIcon;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
import org.bukkit.advancement.Advancement;
|
|
||||||
import org.bukkit.generator.ChunkGenerator;
|
|
||||||
|
|
||||||
import org.bukkit.inventory.ItemFactory;
|
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
|
||||||
import org.jetbrains.annotations.Contract;
|
import org.jetbrains.annotations.Contract;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -161,27 +158,6 @@ public interface Server extends PluginMessageRecipient {
|
|||||||
@NotNull
|
@NotNull
|
||||||
public String getIp();
|
public String getIp();
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the name of this server.
|
|
||||||
*
|
|
||||||
* @return the name of this server
|
|
||||||
* @deprecated not a standard server property
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
@NotNull
|
|
||||||
public String getServerName();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get an ID of this server. The ID is a simple generally alphanumeric ID
|
|
||||||
* that can be used for uniquely identifying this server.
|
|
||||||
*
|
|
||||||
* @return the ID of this server
|
|
||||||
* @deprecated not a standard server property
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
@NotNull
|
|
||||||
public String getServerId();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get world type (level-type setting) for default world.
|
* Get world type (level-type setting) for default world.
|
||||||
*
|
*
|
||||||
@@ -814,11 +790,9 @@ public interface Server extends PluginMessageRecipient {
|
|||||||
public HelpMap getHelpMap();
|
public HelpMap getHelpMap();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an empty inventory with the specified type and title. If the type
|
* Creates an empty inventory with the specified type. If the type
|
||||||
* is {@link InventoryType#CHEST}, the new inventory has a size of 27;
|
* is {@link InventoryType#CHEST}, the new inventory has a size of 27;
|
||||||
* otherwise the new inventory has the normal size for its type.<br>
|
* otherwise the new inventory has the normal size for its type.
|
||||||
* It should be noted that some inventory types do not support titles and
|
|
||||||
* may not render with said titles on the Minecraft client.
|
|
||||||
* <br>
|
* <br>
|
||||||
* {@link InventoryType#WORKBENCH} will not process crafting recipes if
|
* {@link InventoryType#WORKBENCH} will not process crafting recipes if
|
||||||
* created with this method. Use
|
* created with this method. Use
|
||||||
@@ -1305,9 +1279,7 @@ public interface Server extends PluginMessageRecipient {
|
|||||||
* no further guarantees are made.
|
* no further guarantees are made.
|
||||||
* @throws IllegalArgumentException if the selector is malformed in any way
|
* @throws IllegalArgumentException if the selector is malformed in any way
|
||||||
* or a parameter is null
|
* or a parameter is null
|
||||||
* @deprecated draft API
|
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
|
||||||
@NotNull
|
@NotNull
|
||||||
List<Entity> selectEntities(@NotNull CommandSender sender, @NotNull String selector) throws IllegalArgumentException;
|
List<Entity> selectEntities(@NotNull CommandSender sender, @NotNull String selector) throws IllegalArgumentException;
|
||||||
|
|
||||||
@@ -1426,5 +1398,12 @@ public interface Server extends PluginMessageRecipient {
|
|||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
com.destroystokyo.paper.profile.PlayerProfile createProfile(@Nullable UUID uuid, @Nullable String name);
|
com.destroystokyo.paper.profile.PlayerProfile createProfile(@Nullable UUID uuid, @Nullable String name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current internal server tick
|
||||||
|
*
|
||||||
|
* @return Current tick
|
||||||
|
*/
|
||||||
|
int getCurrentTick();
|
||||||
// Paper end
|
// Paper end
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,22 +24,40 @@ public enum Sound {
|
|||||||
BLOCK_ANVIL_PLACE,
|
BLOCK_ANVIL_PLACE,
|
||||||
BLOCK_ANVIL_STEP,
|
BLOCK_ANVIL_STEP,
|
||||||
BLOCK_ANVIL_USE,
|
BLOCK_ANVIL_USE,
|
||||||
|
BLOCK_BAMBOO_BREAK,
|
||||||
|
BLOCK_BAMBOO_FALL,
|
||||||
|
BLOCK_BAMBOO_HIT,
|
||||||
|
BLOCK_BAMBOO_PLACE,
|
||||||
|
BLOCK_BAMBOO_SAPLING_BREAK,
|
||||||
|
BLOCK_BAMBOO_SAPLING_HIT,
|
||||||
|
BLOCK_BAMBOO_SAPLING_PLACE,
|
||||||
|
BLOCK_BAMBOO_STEP,
|
||||||
|
BLOCK_BARREL_CLOSE,
|
||||||
|
BLOCK_BARREL_OPEN,
|
||||||
BLOCK_BEACON_ACTIVATE,
|
BLOCK_BEACON_ACTIVATE,
|
||||||
BLOCK_BEACON_AMBIENT,
|
BLOCK_BEACON_AMBIENT,
|
||||||
BLOCK_BEACON_DEACTIVATE,
|
BLOCK_BEACON_DEACTIVATE,
|
||||||
BLOCK_BEACON_POWER_SELECT,
|
BLOCK_BEACON_POWER_SELECT,
|
||||||
|
BLOCK_BELL_RESONATE,
|
||||||
|
BLOCK_BELL_USE,
|
||||||
|
BLOCK_BLASTFURNACE_FIRE_CRACKLE,
|
||||||
BLOCK_BREWING_STAND_BREW,
|
BLOCK_BREWING_STAND_BREW,
|
||||||
BLOCK_BUBBLE_COLUMN_BUBBLE_POP,
|
BLOCK_BUBBLE_COLUMN_BUBBLE_POP,
|
||||||
BLOCK_BUBBLE_COLUMN_UPWARDS_AMBIENT,
|
BLOCK_BUBBLE_COLUMN_UPWARDS_AMBIENT,
|
||||||
BLOCK_BUBBLE_COLUMN_UPWARDS_INSIDE,
|
BLOCK_BUBBLE_COLUMN_UPWARDS_INSIDE,
|
||||||
BLOCK_BUBBLE_COLUMN_WHIRLPOOL_AMBIENT,
|
BLOCK_BUBBLE_COLUMN_WHIRLPOOL_AMBIENT,
|
||||||
BLOCK_BUBBLE_COLUMN_WHIRLPOOL_INSIDE,
|
BLOCK_BUBBLE_COLUMN_WHIRLPOOL_INSIDE,
|
||||||
|
BLOCK_CAMPFIRE_CRACKLE,
|
||||||
BLOCK_CHEST_CLOSE,
|
BLOCK_CHEST_CLOSE,
|
||||||
BLOCK_CHEST_LOCKED,
|
BLOCK_CHEST_LOCKED,
|
||||||
BLOCK_CHEST_OPEN,
|
BLOCK_CHEST_OPEN,
|
||||||
BLOCK_CHORUS_FLOWER_DEATH,
|
BLOCK_CHORUS_FLOWER_DEATH,
|
||||||
BLOCK_CHORUS_FLOWER_GROW,
|
BLOCK_CHORUS_FLOWER_GROW,
|
||||||
BLOCK_COMPARATOR_CLICK,
|
BLOCK_COMPARATOR_CLICK,
|
||||||
|
BLOCK_COMPOSTER_EMPTY,
|
||||||
|
BLOCK_COMPOSTER_FILL,
|
||||||
|
BLOCK_COMPOSTER_FILL_SUCCESS,
|
||||||
|
BLOCK_COMPOSTER_READY,
|
||||||
BLOCK_CONDUIT_ACTIVATE,
|
BLOCK_CONDUIT_ACTIVATE,
|
||||||
BLOCK_CONDUIT_AMBIENT,
|
BLOCK_CONDUIT_AMBIENT,
|
||||||
BLOCK_CONDUIT_AMBIENT_SHORT,
|
BLOCK_CONDUIT_AMBIENT_SHORT,
|
||||||
@@ -50,6 +68,7 @@ public enum Sound {
|
|||||||
BLOCK_CORAL_BLOCK_HIT,
|
BLOCK_CORAL_BLOCK_HIT,
|
||||||
BLOCK_CORAL_BLOCK_PLACE,
|
BLOCK_CORAL_BLOCK_PLACE,
|
||||||
BLOCK_CORAL_BLOCK_STEP,
|
BLOCK_CORAL_BLOCK_STEP,
|
||||||
|
BLOCK_CROP_BREAK,
|
||||||
BLOCK_DISPENSER_DISPENSE,
|
BLOCK_DISPENSER_DISPENSE,
|
||||||
BLOCK_DISPENSER_FAIL,
|
BLOCK_DISPENSER_FAIL,
|
||||||
BLOCK_DISPENSER_LAUNCH,
|
BLOCK_DISPENSER_LAUNCH,
|
||||||
@@ -79,6 +98,7 @@ public enum Sound {
|
|||||||
BLOCK_GRAVEL_HIT,
|
BLOCK_GRAVEL_HIT,
|
||||||
BLOCK_GRAVEL_PLACE,
|
BLOCK_GRAVEL_PLACE,
|
||||||
BLOCK_GRAVEL_STEP,
|
BLOCK_GRAVEL_STEP,
|
||||||
|
BLOCK_GRINDSTONE_USE,
|
||||||
BLOCK_IRON_DOOR_CLOSE,
|
BLOCK_IRON_DOOR_CLOSE,
|
||||||
BLOCK_IRON_DOOR_OPEN,
|
BLOCK_IRON_DOOR_OPEN,
|
||||||
BLOCK_IRON_TRAPDOOR_CLOSE,
|
BLOCK_IRON_TRAPDOOR_CLOSE,
|
||||||
@@ -88,6 +108,11 @@ public enum Sound {
|
|||||||
BLOCK_LADDER_HIT,
|
BLOCK_LADDER_HIT,
|
||||||
BLOCK_LADDER_PLACE,
|
BLOCK_LADDER_PLACE,
|
||||||
BLOCK_LADDER_STEP,
|
BLOCK_LADDER_STEP,
|
||||||
|
BLOCK_LANTERN_BREAK,
|
||||||
|
BLOCK_LANTERN_FALL,
|
||||||
|
BLOCK_LANTERN_HIT,
|
||||||
|
BLOCK_LANTERN_PLACE,
|
||||||
|
BLOCK_LANTERN_STEP,
|
||||||
BLOCK_LAVA_AMBIENT,
|
BLOCK_LAVA_AMBIENT,
|
||||||
BLOCK_LAVA_EXTINGUISH,
|
BLOCK_LAVA_EXTINGUISH,
|
||||||
BLOCK_LAVA_POP,
|
BLOCK_LAVA_POP,
|
||||||
@@ -100,14 +125,20 @@ public enum Sound {
|
|||||||
BLOCK_METAL_PRESSURE_PLATE_CLICK_OFF,
|
BLOCK_METAL_PRESSURE_PLATE_CLICK_OFF,
|
||||||
BLOCK_METAL_PRESSURE_PLATE_CLICK_ON,
|
BLOCK_METAL_PRESSURE_PLATE_CLICK_ON,
|
||||||
BLOCK_METAL_STEP,
|
BLOCK_METAL_STEP,
|
||||||
|
BLOCK_NETHER_WART_BREAK,
|
||||||
|
BLOCK_NOTE_BLOCK_BANJO,
|
||||||
BLOCK_NOTE_BLOCK_BASEDRUM,
|
BLOCK_NOTE_BLOCK_BASEDRUM,
|
||||||
BLOCK_NOTE_BLOCK_BASS,
|
BLOCK_NOTE_BLOCK_BASS,
|
||||||
BLOCK_NOTE_BLOCK_BELL,
|
BLOCK_NOTE_BLOCK_BELL,
|
||||||
|
BLOCK_NOTE_BLOCK_BIT,
|
||||||
BLOCK_NOTE_BLOCK_CHIME,
|
BLOCK_NOTE_BLOCK_CHIME,
|
||||||
|
BLOCK_NOTE_BLOCK_COW_BELL,
|
||||||
|
BLOCK_NOTE_BLOCK_DIDGERIDOO,
|
||||||
BLOCK_NOTE_BLOCK_FLUTE,
|
BLOCK_NOTE_BLOCK_FLUTE,
|
||||||
BLOCK_NOTE_BLOCK_GUITAR,
|
BLOCK_NOTE_BLOCK_GUITAR,
|
||||||
BLOCK_NOTE_BLOCK_HARP,
|
BLOCK_NOTE_BLOCK_HARP,
|
||||||
BLOCK_NOTE_BLOCK_HAT,
|
BLOCK_NOTE_BLOCK_HAT,
|
||||||
|
BLOCK_NOTE_BLOCK_IRON_XYLOPHONE,
|
||||||
BLOCK_NOTE_BLOCK_PLING,
|
BLOCK_NOTE_BLOCK_PLING,
|
||||||
BLOCK_NOTE_BLOCK_SNARE,
|
BLOCK_NOTE_BLOCK_SNARE,
|
||||||
BLOCK_NOTE_BLOCK_XYLOPHONE,
|
BLOCK_NOTE_BLOCK_XYLOPHONE,
|
||||||
@@ -123,6 +154,11 @@ public enum Sound {
|
|||||||
BLOCK_SAND_HIT,
|
BLOCK_SAND_HIT,
|
||||||
BLOCK_SAND_PLACE,
|
BLOCK_SAND_PLACE,
|
||||||
BLOCK_SAND_STEP,
|
BLOCK_SAND_STEP,
|
||||||
|
BLOCK_SCAFFOLDING_BREAK,
|
||||||
|
BLOCK_SCAFFOLDING_FALL,
|
||||||
|
BLOCK_SCAFFOLDING_HIT,
|
||||||
|
BLOCK_SCAFFOLDING_PLACE,
|
||||||
|
BLOCK_SCAFFOLDING_STEP,
|
||||||
BLOCK_SHULKER_BOX_CLOSE,
|
BLOCK_SHULKER_BOX_CLOSE,
|
||||||
BLOCK_SHULKER_BOX_OPEN,
|
BLOCK_SHULKER_BOX_OPEN,
|
||||||
BLOCK_SLIME_BLOCK_BREAK,
|
BLOCK_SLIME_BLOCK_BREAK,
|
||||||
@@ -130,6 +166,7 @@ public enum Sound {
|
|||||||
BLOCK_SLIME_BLOCK_HIT,
|
BLOCK_SLIME_BLOCK_HIT,
|
||||||
BLOCK_SLIME_BLOCK_PLACE,
|
BLOCK_SLIME_BLOCK_PLACE,
|
||||||
BLOCK_SLIME_BLOCK_STEP,
|
BLOCK_SLIME_BLOCK_STEP,
|
||||||
|
BLOCK_SMOKER_SMOKE,
|
||||||
BLOCK_SNOW_BREAK,
|
BLOCK_SNOW_BREAK,
|
||||||
BLOCK_SNOW_FALL,
|
BLOCK_SNOW_FALL,
|
||||||
BLOCK_SNOW_HIT,
|
BLOCK_SNOW_HIT,
|
||||||
@@ -144,6 +181,8 @@ public enum Sound {
|
|||||||
BLOCK_STONE_PRESSURE_PLATE_CLICK_OFF,
|
BLOCK_STONE_PRESSURE_PLATE_CLICK_OFF,
|
||||||
BLOCK_STONE_PRESSURE_PLATE_CLICK_ON,
|
BLOCK_STONE_PRESSURE_PLATE_CLICK_ON,
|
||||||
BLOCK_STONE_STEP,
|
BLOCK_STONE_STEP,
|
||||||
|
BLOCK_SWEET_BERRY_BUSH_BREAK,
|
||||||
|
BLOCK_SWEET_BERRY_BUSH_PLACE,
|
||||||
BLOCK_TRIPWIRE_ATTACH,
|
BLOCK_TRIPWIRE_ATTACH,
|
||||||
BLOCK_TRIPWIRE_CLICK_OFF,
|
BLOCK_TRIPWIRE_CLICK_OFF,
|
||||||
BLOCK_TRIPWIRE_CLICK_ON,
|
BLOCK_TRIPWIRE_CLICK_ON,
|
||||||
@@ -193,11 +232,14 @@ public enum Sound {
|
|||||||
ENTITY_BOAT_PADDLE_LAND,
|
ENTITY_BOAT_PADDLE_LAND,
|
||||||
ENTITY_BOAT_PADDLE_WATER,
|
ENTITY_BOAT_PADDLE_WATER,
|
||||||
ENTITY_CAT_AMBIENT,
|
ENTITY_CAT_AMBIENT,
|
||||||
|
ENTITY_CAT_BEG_FOR_FOOD,
|
||||||
ENTITY_CAT_DEATH,
|
ENTITY_CAT_DEATH,
|
||||||
|
ENTITY_CAT_EAT,
|
||||||
ENTITY_CAT_HISS,
|
ENTITY_CAT_HISS,
|
||||||
ENTITY_CAT_HURT,
|
ENTITY_CAT_HURT,
|
||||||
ENTITY_CAT_PURR,
|
ENTITY_CAT_PURR,
|
||||||
ENTITY_CAT_PURREOW,
|
ENTITY_CAT_PURREOW,
|
||||||
|
ENTITY_CAT_STRAY_AMBIENT,
|
||||||
ENTITY_CHICKEN_AMBIENT,
|
ENTITY_CHICKEN_AMBIENT,
|
||||||
ENTITY_CHICKEN_DEATH,
|
ENTITY_CHICKEN_DEATH,
|
||||||
ENTITY_CHICKEN_EGG,
|
ENTITY_CHICKEN_EGG,
|
||||||
@@ -270,6 +312,7 @@ public enum Sound {
|
|||||||
ENTITY_ENDER_PEARL_THROW,
|
ENTITY_ENDER_PEARL_THROW,
|
||||||
ENTITY_EVOKER_AMBIENT,
|
ENTITY_EVOKER_AMBIENT,
|
||||||
ENTITY_EVOKER_CAST_SPELL,
|
ENTITY_EVOKER_CAST_SPELL,
|
||||||
|
ENTITY_EVOKER_CELEBRATE,
|
||||||
ENTITY_EVOKER_DEATH,
|
ENTITY_EVOKER_DEATH,
|
||||||
ENTITY_EVOKER_FANGS_ATTACK,
|
ENTITY_EVOKER_FANGS_ATTACK,
|
||||||
ENTITY_EVOKER_HURT,
|
ENTITY_EVOKER_HURT,
|
||||||
@@ -290,6 +333,16 @@ public enum Sound {
|
|||||||
ENTITY_FISHING_BOBBER_SPLASH,
|
ENTITY_FISHING_BOBBER_SPLASH,
|
||||||
ENTITY_FISHING_BOBBER_THROW,
|
ENTITY_FISHING_BOBBER_THROW,
|
||||||
ENTITY_FISH_SWIM,
|
ENTITY_FISH_SWIM,
|
||||||
|
ENTITY_FOX_AGGRO,
|
||||||
|
ENTITY_FOX_AMBIENT,
|
||||||
|
ENTITY_FOX_BITE,
|
||||||
|
ENTITY_FOX_DEATH,
|
||||||
|
ENTITY_FOX_EAT,
|
||||||
|
ENTITY_FOX_HURT,
|
||||||
|
ENTITY_FOX_SCREECH,
|
||||||
|
ENTITY_FOX_SLEEP,
|
||||||
|
ENTITY_FOX_SNIFF,
|
||||||
|
ENTITY_FOX_SPIT,
|
||||||
ENTITY_GENERIC_BIG_FALL,
|
ENTITY_GENERIC_BIG_FALL,
|
||||||
ENTITY_GENERIC_BURN,
|
ENTITY_GENERIC_BURN,
|
||||||
ENTITY_GENERIC_DEATH,
|
ENTITY_GENERIC_DEATH,
|
||||||
@@ -380,13 +433,31 @@ public enum Sound {
|
|||||||
ENTITY_MAGMA_CUBE_SQUISH_SMALL,
|
ENTITY_MAGMA_CUBE_SQUISH_SMALL,
|
||||||
ENTITY_MINECART_INSIDE,
|
ENTITY_MINECART_INSIDE,
|
||||||
ENTITY_MINECART_RIDING,
|
ENTITY_MINECART_RIDING,
|
||||||
|
ENTITY_MOOSHROOM_CONVERT,
|
||||||
|
ENTITY_MOOSHROOM_EAT,
|
||||||
|
ENTITY_MOOSHROOM_MILK,
|
||||||
ENTITY_MOOSHROOM_SHEAR,
|
ENTITY_MOOSHROOM_SHEAR,
|
||||||
|
ENTITY_MOOSHROOM_SUSPICIOUS_MILK,
|
||||||
ENTITY_MULE_AMBIENT,
|
ENTITY_MULE_AMBIENT,
|
||||||
ENTITY_MULE_CHEST,
|
ENTITY_MULE_CHEST,
|
||||||
ENTITY_MULE_DEATH,
|
ENTITY_MULE_DEATH,
|
||||||
ENTITY_MULE_HURT,
|
ENTITY_MULE_HURT,
|
||||||
|
ENTITY_OCELOT_AMBIENT,
|
||||||
|
ENTITY_OCELOT_DEATH,
|
||||||
|
ENTITY_OCELOT_HURT,
|
||||||
ENTITY_PAINTING_BREAK,
|
ENTITY_PAINTING_BREAK,
|
||||||
ENTITY_PAINTING_PLACE,
|
ENTITY_PAINTING_PLACE,
|
||||||
|
ENTITY_PANDA_AGGRESSIVE_AMBIENT,
|
||||||
|
ENTITY_PANDA_AMBIENT,
|
||||||
|
ENTITY_PANDA_BITE,
|
||||||
|
ENTITY_PANDA_CANT_BREED,
|
||||||
|
ENTITY_PANDA_DEATH,
|
||||||
|
ENTITY_PANDA_EAT,
|
||||||
|
ENTITY_PANDA_HURT,
|
||||||
|
ENTITY_PANDA_PRE_SNEEZE,
|
||||||
|
ENTITY_PANDA_SNEEZE,
|
||||||
|
ENTITY_PANDA_STEP,
|
||||||
|
ENTITY_PANDA_WORRIED_AMBIENT,
|
||||||
ENTITY_PARROT_AMBIENT,
|
ENTITY_PARROT_AMBIENT,
|
||||||
ENTITY_PARROT_DEATH,
|
ENTITY_PARROT_DEATH,
|
||||||
ENTITY_PARROT_EAT,
|
ENTITY_PARROT_EAT,
|
||||||
@@ -401,11 +472,15 @@ public enum Sound {
|
|||||||
ENTITY_PARROT_IMITATE_ENDER_DRAGON,
|
ENTITY_PARROT_IMITATE_ENDER_DRAGON,
|
||||||
ENTITY_PARROT_IMITATE_EVOKER,
|
ENTITY_PARROT_IMITATE_EVOKER,
|
||||||
ENTITY_PARROT_IMITATE_GHAST,
|
ENTITY_PARROT_IMITATE_GHAST,
|
||||||
|
ENTITY_PARROT_IMITATE_GUARDIAN,
|
||||||
ENTITY_PARROT_IMITATE_HUSK,
|
ENTITY_PARROT_IMITATE_HUSK,
|
||||||
ENTITY_PARROT_IMITATE_ILLUSIONER,
|
ENTITY_PARROT_IMITATE_ILLUSIONER,
|
||||||
ENTITY_PARROT_IMITATE_MAGMA_CUBE,
|
ENTITY_PARROT_IMITATE_MAGMA_CUBE,
|
||||||
|
ENTITY_PARROT_IMITATE_PANDA,
|
||||||
ENTITY_PARROT_IMITATE_PHANTOM,
|
ENTITY_PARROT_IMITATE_PHANTOM,
|
||||||
|
ENTITY_PARROT_IMITATE_PILLAGER,
|
||||||
ENTITY_PARROT_IMITATE_POLAR_BEAR,
|
ENTITY_PARROT_IMITATE_POLAR_BEAR,
|
||||||
|
ENTITY_PARROT_IMITATE_RAVAGER,
|
||||||
ENTITY_PARROT_IMITATE_SHULKER,
|
ENTITY_PARROT_IMITATE_SHULKER,
|
||||||
ENTITY_PARROT_IMITATE_SILVERFISH,
|
ENTITY_PARROT_IMITATE_SILVERFISH,
|
||||||
ENTITY_PARROT_IMITATE_SKELETON,
|
ENTITY_PARROT_IMITATE_SKELETON,
|
||||||
@@ -433,6 +508,10 @@ public enum Sound {
|
|||||||
ENTITY_PIG_HURT,
|
ENTITY_PIG_HURT,
|
||||||
ENTITY_PIG_SADDLE,
|
ENTITY_PIG_SADDLE,
|
||||||
ENTITY_PIG_STEP,
|
ENTITY_PIG_STEP,
|
||||||
|
ENTITY_PILLAGER_AMBIENT,
|
||||||
|
ENTITY_PILLAGER_CELEBRATE,
|
||||||
|
ENTITY_PILLAGER_DEATH,
|
||||||
|
ENTITY_PILLAGER_HURT,
|
||||||
ENTITY_PLAYER_ATTACK_CRIT,
|
ENTITY_PLAYER_ATTACK_CRIT,
|
||||||
ENTITY_PLAYER_ATTACK_KNOCKBACK,
|
ENTITY_PLAYER_ATTACK_KNOCKBACK,
|
||||||
ENTITY_PLAYER_ATTACK_NODAMAGE,
|
ENTITY_PLAYER_ATTACK_NODAMAGE,
|
||||||
@@ -446,6 +525,7 @@ public enum Sound {
|
|||||||
ENTITY_PLAYER_HURT,
|
ENTITY_PLAYER_HURT,
|
||||||
ENTITY_PLAYER_HURT_DROWN,
|
ENTITY_PLAYER_HURT_DROWN,
|
||||||
ENTITY_PLAYER_HURT_ON_FIRE,
|
ENTITY_PLAYER_HURT_ON_FIRE,
|
||||||
|
ENTITY_PLAYER_HURT_SWEET_BERRY_BUSH,
|
||||||
ENTITY_PLAYER_LEVELUP,
|
ENTITY_PLAYER_LEVELUP,
|
||||||
ENTITY_PLAYER_SMALL_FALL,
|
ENTITY_PLAYER_SMALL_FALL,
|
||||||
ENTITY_PLAYER_SPLASH,
|
ENTITY_PLAYER_SPLASH,
|
||||||
@@ -469,6 +549,14 @@ public enum Sound {
|
|||||||
ENTITY_RABBIT_DEATH,
|
ENTITY_RABBIT_DEATH,
|
||||||
ENTITY_RABBIT_HURT,
|
ENTITY_RABBIT_HURT,
|
||||||
ENTITY_RABBIT_JUMP,
|
ENTITY_RABBIT_JUMP,
|
||||||
|
ENTITY_RAVAGER_AMBIENT,
|
||||||
|
ENTITY_RAVAGER_ATTACK,
|
||||||
|
ENTITY_RAVAGER_CELEBRATE,
|
||||||
|
ENTITY_RAVAGER_DEATH,
|
||||||
|
ENTITY_RAVAGER_HURT,
|
||||||
|
ENTITY_RAVAGER_ROAR,
|
||||||
|
ENTITY_RAVAGER_STEP,
|
||||||
|
ENTITY_RAVAGER_STUNNED,
|
||||||
ENTITY_SALMON_AMBIENT,
|
ENTITY_SALMON_AMBIENT,
|
||||||
ENTITY_SALMON_DEATH,
|
ENTITY_SALMON_DEATH,
|
||||||
ENTITY_SALMON_FLOP,
|
ENTITY_SALMON_FLOP,
|
||||||
@@ -555,15 +643,41 @@ public enum Sound {
|
|||||||
ENTITY_VEX_DEATH,
|
ENTITY_VEX_DEATH,
|
||||||
ENTITY_VEX_HURT,
|
ENTITY_VEX_HURT,
|
||||||
ENTITY_VILLAGER_AMBIENT,
|
ENTITY_VILLAGER_AMBIENT,
|
||||||
|
ENTITY_VILLAGER_CELEBRATE,
|
||||||
ENTITY_VILLAGER_DEATH,
|
ENTITY_VILLAGER_DEATH,
|
||||||
ENTITY_VILLAGER_HURT,
|
ENTITY_VILLAGER_HURT,
|
||||||
ENTITY_VILLAGER_NO,
|
ENTITY_VILLAGER_NO,
|
||||||
ENTITY_VILLAGER_TRADE,
|
ENTITY_VILLAGER_TRADE,
|
||||||
|
ENTITY_VILLAGER_WORK_ARMORER,
|
||||||
|
ENTITY_VILLAGER_WORK_BUTCHER,
|
||||||
|
ENTITY_VILLAGER_WORK_CARTOGRAPHER,
|
||||||
|
ENTITY_VILLAGER_WORK_CLERIC,
|
||||||
|
ENTITY_VILLAGER_WORK_FARMER,
|
||||||
|
ENTITY_VILLAGER_WORK_FISHERMAN,
|
||||||
|
ENTITY_VILLAGER_WORK_FLETCHER,
|
||||||
|
ENTITY_VILLAGER_WORK_LEATHERWORKER,
|
||||||
|
ENTITY_VILLAGER_WORK_LIBRARIAN,
|
||||||
|
ENTITY_VILLAGER_WORK_MASON,
|
||||||
|
ENTITY_VILLAGER_WORK_SHEPHERD,
|
||||||
|
ENTITY_VILLAGER_WORK_TOOLSMITH,
|
||||||
|
ENTITY_VILLAGER_WORK_WEAPONSMITH,
|
||||||
ENTITY_VILLAGER_YES,
|
ENTITY_VILLAGER_YES,
|
||||||
ENTITY_VINDICATOR_AMBIENT,
|
ENTITY_VINDICATOR_AMBIENT,
|
||||||
|
ENTITY_VINDICATOR_CELEBRATE,
|
||||||
ENTITY_VINDICATOR_DEATH,
|
ENTITY_VINDICATOR_DEATH,
|
||||||
ENTITY_VINDICATOR_HURT,
|
ENTITY_VINDICATOR_HURT,
|
||||||
|
ENTITY_WANDERING_TRADER_AMBIENT,
|
||||||
|
ENTITY_WANDERING_TRADER_DEATH,
|
||||||
|
ENTITY_WANDERING_TRADER_DISAPPEARED,
|
||||||
|
ENTITY_WANDERING_TRADER_DRINK_MILK,
|
||||||
|
ENTITY_WANDERING_TRADER_DRINK_POTION,
|
||||||
|
ENTITY_WANDERING_TRADER_HURT,
|
||||||
|
ENTITY_WANDERING_TRADER_NO,
|
||||||
|
ENTITY_WANDERING_TRADER_REAPPEARED,
|
||||||
|
ENTITY_WANDERING_TRADER_TRADE,
|
||||||
|
ENTITY_WANDERING_TRADER_YES,
|
||||||
ENTITY_WITCH_AMBIENT,
|
ENTITY_WITCH_AMBIENT,
|
||||||
|
ENTITY_WITCH_CELEBRATE,
|
||||||
ENTITY_WITCH_DEATH,
|
ENTITY_WITCH_DEATH,
|
||||||
ENTITY_WITCH_DRINK,
|
ENTITY_WITCH_DRINK,
|
||||||
ENTITY_WITCH_HURT,
|
ENTITY_WITCH_HURT,
|
||||||
@@ -610,6 +724,7 @@ public enum Sound {
|
|||||||
ENTITY_ZOMBIE_VILLAGER_DEATH,
|
ENTITY_ZOMBIE_VILLAGER_DEATH,
|
||||||
ENTITY_ZOMBIE_VILLAGER_HURT,
|
ENTITY_ZOMBIE_VILLAGER_HURT,
|
||||||
ENTITY_ZOMBIE_VILLAGER_STEP,
|
ENTITY_ZOMBIE_VILLAGER_STEP,
|
||||||
|
EVENT_RAID_HORN,
|
||||||
ITEM_ARMOR_EQUIP_CHAIN,
|
ITEM_ARMOR_EQUIP_CHAIN,
|
||||||
ITEM_ARMOR_EQUIP_DIAMOND,
|
ITEM_ARMOR_EQUIP_DIAMOND,
|
||||||
ITEM_ARMOR_EQUIP_ELYTRA,
|
ITEM_ARMOR_EQUIP_ELYTRA,
|
||||||
@@ -619,6 +734,8 @@ public enum Sound {
|
|||||||
ITEM_ARMOR_EQUIP_LEATHER,
|
ITEM_ARMOR_EQUIP_LEATHER,
|
||||||
ITEM_ARMOR_EQUIP_TURTLE,
|
ITEM_ARMOR_EQUIP_TURTLE,
|
||||||
ITEM_AXE_STRIP,
|
ITEM_AXE_STRIP,
|
||||||
|
ITEM_BOOK_PAGE_TURN,
|
||||||
|
ITEM_BOOK_PUT,
|
||||||
ITEM_BOTTLE_EMPTY,
|
ITEM_BOTTLE_EMPTY,
|
||||||
ITEM_BOTTLE_FILL,
|
ITEM_BOTTLE_FILL,
|
||||||
ITEM_BOTTLE_FILL_DRAGONBREATH,
|
ITEM_BOTTLE_FILL_DRAGONBREATH,
|
||||||
@@ -629,13 +746,24 @@ public enum Sound {
|
|||||||
ITEM_BUCKET_FILL_FISH,
|
ITEM_BUCKET_FILL_FISH,
|
||||||
ITEM_BUCKET_FILL_LAVA,
|
ITEM_BUCKET_FILL_LAVA,
|
||||||
ITEM_CHORUS_FRUIT_TELEPORT,
|
ITEM_CHORUS_FRUIT_TELEPORT,
|
||||||
|
ITEM_CROP_PLANT,
|
||||||
|
ITEM_CROSSBOW_HIT,
|
||||||
|
ITEM_CROSSBOW_LOADING_END,
|
||||||
|
ITEM_CROSSBOW_LOADING_MIDDLE,
|
||||||
|
ITEM_CROSSBOW_LOADING_START,
|
||||||
|
ITEM_CROSSBOW_QUICK_CHARGE_1,
|
||||||
|
ITEM_CROSSBOW_QUICK_CHARGE_2,
|
||||||
|
ITEM_CROSSBOW_QUICK_CHARGE_3,
|
||||||
|
ITEM_CROSSBOW_SHOOT,
|
||||||
ITEM_ELYTRA_FLYING,
|
ITEM_ELYTRA_FLYING,
|
||||||
ITEM_FIRECHARGE_USE,
|
ITEM_FIRECHARGE_USE,
|
||||||
ITEM_FLINTANDSTEEL_USE,
|
ITEM_FLINTANDSTEEL_USE,
|
||||||
ITEM_HOE_TILL,
|
ITEM_HOE_TILL,
|
||||||
|
ITEM_NETHER_WART_PLANT,
|
||||||
ITEM_SHIELD_BLOCK,
|
ITEM_SHIELD_BLOCK,
|
||||||
ITEM_SHIELD_BREAK,
|
ITEM_SHIELD_BREAK,
|
||||||
ITEM_SHOVEL_FLATTEN,
|
ITEM_SHOVEL_FLATTEN,
|
||||||
|
ITEM_SWEET_BERRIES_PICK_FROM_BUSH,
|
||||||
ITEM_TOTEM_USE,
|
ITEM_TOTEM_USE,
|
||||||
ITEM_TRIDENT_HIT,
|
ITEM_TRIDENT_HIT,
|
||||||
ITEM_TRIDENT_HIT_GROUND,
|
ITEM_TRIDENT_HIT_GROUND,
|
||||||
@@ -666,6 +794,11 @@ public enum Sound {
|
|||||||
MUSIC_NETHER,
|
MUSIC_NETHER,
|
||||||
MUSIC_UNDER_WATER,
|
MUSIC_UNDER_WATER,
|
||||||
UI_BUTTON_CLICK,
|
UI_BUTTON_CLICK,
|
||||||
|
UI_CARTOGRAPHY_TABLE_TAKE_RESULT,
|
||||||
|
UI_LOOM_SELECT_PATTERN,
|
||||||
|
UI_LOOM_TAKE_RESULT,
|
||||||
|
UI_STONECUTTER_SELECT_RECIPE,
|
||||||
|
UI_STONECUTTER_TAKE_RESULT,
|
||||||
UI_TOAST_CHALLENGE_COMPLETE,
|
UI_TOAST_CHALLENGE_COMPLETE,
|
||||||
UI_TOAST_IN,
|
UI_TOAST_IN,
|
||||||
UI_TOAST_OUT,
|
UI_TOAST_OUT,
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
package org.bukkit;
|
package org.bukkit;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a countable statistic, which is tracked by the server.
|
* Represents a countable statistic, which is tracked by the server.
|
||||||
*/
|
*/
|
||||||
public enum Statistic {
|
public enum Statistic implements Keyed {
|
||||||
DAMAGE_DEALT,
|
DAMAGE_DEALT,
|
||||||
DAMAGE_TAKEN,
|
DAMAGE_TAKEN,
|
||||||
DEATHS,
|
DEATHS,
|
||||||
@@ -74,9 +75,21 @@ public enum Statistic {
|
|||||||
DAMAGE_BLOCKED_BY_SHIELD,
|
DAMAGE_BLOCKED_BY_SHIELD,
|
||||||
DAMAGE_ABSORBED,
|
DAMAGE_ABSORBED,
|
||||||
DAMAGE_RESISTED,
|
DAMAGE_RESISTED,
|
||||||
CLEAN_SHULKER_BOX;
|
CLEAN_SHULKER_BOX,
|
||||||
|
OPEN_BARREL,
|
||||||
|
INTERACT_WITH_BLAST_FURNACE,
|
||||||
|
INTERACT_WITH_SMOKER,
|
||||||
|
INTERACT_WITH_LECTERN,
|
||||||
|
INTERACT_WITH_CAMPFIRE,
|
||||||
|
INTERACT_WITH_CARTOGRAPHY_TABLE,
|
||||||
|
INTERACT_WITH_LOOM,
|
||||||
|
INTERACT_WITH_STONECUTTER,
|
||||||
|
BELL_RING,
|
||||||
|
RAID_TRIGGER,
|
||||||
|
RAID_WIN;
|
||||||
|
|
||||||
private final Type type;
|
private final Type type;
|
||||||
|
private final NamespacedKey key;
|
||||||
|
|
||||||
private Statistic() {
|
private Statistic() {
|
||||||
this(Type.UNTYPED);
|
this(Type.UNTYPED);
|
||||||
@@ -84,6 +97,7 @@ public enum Statistic {
|
|||||||
|
|
||||||
private Statistic(/*@NotNull*/ Type type) {
|
private Statistic(/*@NotNull*/ Type type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
this.key = NamespacedKey.minecraft(name().toLowerCase(Locale.ROOT));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -123,6 +137,12 @@ public enum Statistic {
|
|||||||
return type == Type.BLOCK;
|
return type == Type.BLOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public NamespacedKey getKey() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type of statistic.
|
* The type of statistic.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -2,15 +2,14 @@ package org.bukkit;
|
|||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import org.apache.commons.lang.Validate;
|
import org.apache.commons.lang.Validate;
|
||||||
import org.bukkit.map.MapCursor;
|
import org.bukkit.map.MapCursor;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class handles the creation and storage of all structure types for
|
* This class handles the creation and storage of all structure types for
|
||||||
* Bukkit. Structure Types are the different kinds of structures that can be
|
* Bukkit. Structure Types are the different kinds of structures that can be
|
||||||
@@ -20,7 +19,7 @@ import java.util.Objects;
|
|||||||
* The registration of new {@link StructureType}s is case-sensitive.
|
* The registration of new {@link StructureType}s is case-sensitive.
|
||||||
*/
|
*/
|
||||||
// Order is retrieved from WorldGenFactory
|
// Order is retrieved from WorldGenFactory
|
||||||
public class StructureType {
|
public final class StructureType {
|
||||||
|
|
||||||
private static final Map<String, StructureType> structureTypeMap = new HashMap<>();
|
private static final Map<String, StructureType> structureTypeMap = new HashMap<>();
|
||||||
|
|
||||||
@@ -31,7 +30,7 @@ public class StructureType {
|
|||||||
* They are the only place where cave spider spawners and minecarts with
|
* They are the only place where cave spider spawners and minecarts with
|
||||||
* chests can be found naturally.
|
* chests can be found naturally.
|
||||||
*/
|
*/
|
||||||
public static final StructureType MINESHAFT = register(new StructureType("Mineshaft", MapCursor.Type.RED_X));
|
public static final StructureType MINESHAFT = register(new StructureType("mineshaft", MapCursor.Type.RED_X));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Villages are naturally generating structures that form above ground.
|
* Villages are naturally generating structures that form above ground.
|
||||||
@@ -39,7 +38,7 @@ public class StructureType {
|
|||||||
* They are usually generated in desert, plains, taiga, and savanna biomes
|
* They are usually generated in desert, plains, taiga, and savanna biomes
|
||||||
* and are a site for villager spawns, with whom the player can trade.
|
* and are a site for villager spawns, with whom the player can trade.
|
||||||
*/
|
*/
|
||||||
public static final StructureType VILLAGE = register(new StructureType("Village", MapCursor.Type.MANSION));
|
public static final StructureType VILLAGE = register(new StructureType("village", MapCursor.Type.MANSION));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Nether fortresses are very large complexes that mainly consist of
|
* Nether fortresses are very large complexes that mainly consist of
|
||||||
@@ -48,7 +47,7 @@ public class StructureType {
|
|||||||
* They contain blaze spawners, nether wart farms, and loot chests. They are
|
* They contain blaze spawners, nether wart farms, and loot chests. They are
|
||||||
* only generated in the nether dimension.
|
* only generated in the nether dimension.
|
||||||
*/
|
*/
|
||||||
public static final StructureType NETHER_FORTRESS = register(new StructureType("Fortress", MapCursor.Type.RED_X));
|
public static final StructureType NETHER_FORTRESS = register(new StructureType("fortress", MapCursor.Type.RED_X));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Strongholds are underground structures that consist of many rooms,
|
* Strongholds are underground structures that consist of many rooms,
|
||||||
@@ -56,7 +55,7 @@ public class StructureType {
|
|||||||
* <br>
|
* <br>
|
||||||
* They can be found using an {@link Material#ENDER_EYE}.
|
* They can be found using an {@link Material#ENDER_EYE}.
|
||||||
*/
|
*/
|
||||||
public static final StructureType STRONGHOLD = register(new StructureType("Stronghold", MapCursor.Type.MANSION));
|
public static final StructureType STRONGHOLD = register(new StructureType("stronghold", MapCursor.Type.MANSION));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Jungle pyramids (also known as jungle temples) are found in jungles.
|
* Jungle pyramids (also known as jungle temples) are found in jungles.
|
||||||
@@ -65,7 +64,7 @@ public class StructureType {
|
|||||||
* consist of three floors, with the bottom floor containing treasure
|
* consist of three floors, with the bottom floor containing treasure
|
||||||
* chests.
|
* chests.
|
||||||
*/
|
*/
|
||||||
public static final StructureType JUNGLE_PYRAMID = register(new StructureType("Jungle_Pyramid", MapCursor.Type.RED_X));
|
public static final StructureType JUNGLE_PYRAMID = register(new StructureType("jungle_pyramid", MapCursor.Type.RED_X));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ocean ruins are clusters of many different blocks that generate
|
* Ocean ruins are clusters of many different blocks that generate
|
||||||
@@ -74,27 +73,27 @@ public class StructureType {
|
|||||||
* They come in my different variations. The cold variants consist primarily
|
* They come in my different variations. The cold variants consist primarily
|
||||||
* of stone brick, and the warm variants consist of sandstone.
|
* of stone brick, and the warm variants consist of sandstone.
|
||||||
*/
|
*/
|
||||||
public static final StructureType OCEAN_RUIN = register(new StructureType("Ocean_Ruin", MapCursor.Type.TEMPLE));
|
public static final StructureType OCEAN_RUIN = register(new StructureType("ocean_ruin", MapCursor.Type.TEMPLE));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Desert pyramids (also known as desert temples) are found in deserts.
|
* Desert pyramids (also known as desert temples) are found in deserts.
|
||||||
* <br>
|
* <br>
|
||||||
* They are usually composed of sandstone and stained terracotta.
|
* They are usually composed of sandstone and stained terracotta.
|
||||||
*/
|
*/
|
||||||
public static final StructureType DESERT_PYRAMID = register(new StructureType("Desert_Pyramid", MapCursor.Type.RED_X));
|
public static final StructureType DESERT_PYRAMID = register(new StructureType("desert_pyramid", MapCursor.Type.RED_X));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Igloos are structures that generate in snowy biomes.
|
* Igloos are structures that generate in snowy biomes.
|
||||||
* <br>
|
* <br>
|
||||||
* They consist of the house, as well as a basement.
|
* They consist of the house, as well as a basement.
|
||||||
*/
|
*/
|
||||||
public static final StructureType IGLOO = register(new StructureType("Igloo", MapCursor.Type.RED_X));
|
public static final StructureType IGLOO = register(new StructureType("igloo", MapCursor.Type.RED_X));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Swamp huts (also known as witch huts) generate in swamp biomes and have
|
* Swamp huts (also known as witch huts) generate in swamp biomes and have
|
||||||
* the ability to spawn witches.
|
* the ability to spawn witches.
|
||||||
*/
|
*/
|
||||||
public static final StructureType SWAMP_HUT = register(new StructureType("Swamp_Hut", MapCursor.Type.RED_X));
|
public static final StructureType SWAMP_HUT = register(new StructureType("swamp_hut", MapCursor.Type.RED_X));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ocean monuments are underwater structures.
|
* Ocean monuments are underwater structures.
|
||||||
@@ -103,7 +102,7 @@ public class StructureType {
|
|||||||
* lanterns. They are the only place guardians and elder guardians spawn
|
* lanterns. They are the only place guardians and elder guardians spawn
|
||||||
* naturally.
|
* naturally.
|
||||||
*/
|
*/
|
||||||
public static final StructureType OCEAN_MONUMENT = register(new StructureType("Monument", MapCursor.Type.TEMPLE));
|
public static final StructureType OCEAN_MONUMENT = register(new StructureType("monument", MapCursor.Type.TEMPLE));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* End Cities are tall castle-like structures that generate in the outer
|
* End Cities are tall castle-like structures that generate in the outer
|
||||||
@@ -112,7 +111,7 @@ public class StructureType {
|
|||||||
* They consist primarily of end stone bricks, purpur blocks, and end rods.
|
* They consist primarily of end stone bricks, purpur blocks, and end rods.
|
||||||
* They are the only place where shulkers can be found.
|
* They are the only place where shulkers can be found.
|
||||||
*/
|
*/
|
||||||
public static final StructureType END_CITY = register(new StructureType("EndCity", MapCursor.Type.RED_X));
|
public static final StructureType END_CITY = register(new StructureType("endcity", MapCursor.Type.RED_X));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mansions (also known as woodland mansions) are massive house structures
|
* Mansions (also known as woodland mansions) are massive house structures
|
||||||
@@ -121,13 +120,13 @@ public class StructureType {
|
|||||||
* They are the only place where evokers, vindicators, and vexes spawn
|
* They are the only place where evokers, vindicators, and vexes spawn
|
||||||
* naturally (but only once)
|
* naturally (but only once)
|
||||||
*/
|
*/
|
||||||
public static final StructureType WOODLAND_MANSION = register(new StructureType("Mansion", MapCursor.Type.MANSION));
|
public static final StructureType WOODLAND_MANSION = register(new StructureType("mansion", MapCursor.Type.MANSION));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Buried treasure consists of a single chest buried in the beach sand or
|
* Buried treasure consists of a single chest buried in the beach sand or
|
||||||
* gravel, with random loot in it.
|
* gravel, with random loot in it.
|
||||||
*/
|
*/
|
||||||
public static final StructureType BURIED_TREASURE = register(new StructureType("Buried_Treasure", MapCursor.Type.RED_X));
|
public static final StructureType BURIED_TREASURE = register(new StructureType("buried_treasure", MapCursor.Type.RED_X));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shipwrecks are structures that generate on the floor of oceans or
|
* Shipwrecks are structures that generate on the floor of oceans or
|
||||||
@@ -136,7 +135,12 @@ public class StructureType {
|
|||||||
* They are made up of wood materials, and contain 1-3 loot chests. They can
|
* They are made up of wood materials, and contain 1-3 loot chests. They can
|
||||||
* generate sideways, upside-down, or upright.
|
* generate sideways, upside-down, or upright.
|
||||||
*/
|
*/
|
||||||
public static final StructureType SHIPWRECK = register(new StructureType("Shipwreck", MapCursor.Type.RED_X));
|
public static final StructureType SHIPWRECK = register(new StructureType("shipwreck", MapCursor.Type.RED_X));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pillager outposts may contain crossbows.
|
||||||
|
*/
|
||||||
|
public static final StructureType PILLAGER_OUTPOST = register(new StructureType("pillager_outpost", MapCursor.Type.RED_X));
|
||||||
|
|
||||||
/* ****************
|
/* ****************
|
||||||
* STRUCTURE TYPES REGISTERED ABOVE THIS
|
* STRUCTURE TYPES REGISTERED ABOVE THIS
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
package org.bukkit;
|
package org.bukkit;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a tag that may be defined by the server or a resource pack to
|
* Represents a tag that may be defined by the server or a resource pack to
|
||||||
@@ -57,6 +56,10 @@ public interface Tag<T extends Keyed> extends Keyed {
|
|||||||
* Vanilla block tag representing all wooden slabs.
|
* Vanilla block tag representing all wooden slabs.
|
||||||
*/
|
*/
|
||||||
Tag<Material> WOODEN_SLABS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("wooden_slabs"), Material.class);
|
Tag<Material> WOODEN_SLABS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("wooden_slabs"), Material.class);
|
||||||
|
/**
|
||||||
|
* Vanilla block tag representing all wooden fences.
|
||||||
|
*/
|
||||||
|
Tag<Material> WOODEN_FENCES = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("wooden_fences"), Material.class);
|
||||||
/**
|
/**
|
||||||
* Vanilla block tag representing all wooden pressure plates.
|
* Vanilla block tag representing all wooden pressure plates.
|
||||||
*/
|
*/
|
||||||
@@ -118,6 +121,10 @@ public interface Tag<T extends Keyed> extends Keyed {
|
|||||||
* Vanilla block tag representing all slabs.
|
* Vanilla block tag representing all slabs.
|
||||||
*/
|
*/
|
||||||
Tag<Material> SLABS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("slabs"), Material.class);
|
Tag<Material> SLABS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("slabs"), Material.class);
|
||||||
|
/**
|
||||||
|
* Vanilla block tag representing all walls.
|
||||||
|
*/
|
||||||
|
Tag<Material> WALLS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("walls"), Material.class);
|
||||||
/**
|
/**
|
||||||
* Vanilla block tag representing all damaged and undamaged anvils.
|
* Vanilla block tag representing all damaged and undamaged anvils.
|
||||||
*/
|
*/
|
||||||
@@ -139,6 +146,18 @@ public interface Tag<T extends Keyed> extends Keyed {
|
|||||||
* Vanilla block tag representing all empty and filled flower pots.
|
* Vanilla block tag representing all empty and filled flower pots.
|
||||||
*/
|
*/
|
||||||
Tag<Material> FLOWER_POTS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("flower_pots"), Material.class);
|
Tag<Material> FLOWER_POTS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("flower_pots"), Material.class);
|
||||||
|
/**
|
||||||
|
* Vanilla block tag representing all small flowers.
|
||||||
|
*/
|
||||||
|
Tag<Material> SMALL_FLOWERS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("small_flowers"), Material.class);
|
||||||
|
/**
|
||||||
|
* Vanilla block tag representing all beds.
|
||||||
|
*/
|
||||||
|
Tag<Material> BEDS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("beds"), Material.class);
|
||||||
|
/**
|
||||||
|
* Vanilla block tag representing all fences.
|
||||||
|
*/
|
||||||
|
Tag<Material> FENCES = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("fences"), Material.class);
|
||||||
/**
|
/**
|
||||||
* Vanilla block tag denoting blocks that enderman may pick up and hold.
|
* Vanilla block tag denoting blocks that enderman may pick up and hold.
|
||||||
*/
|
*/
|
||||||
@@ -175,6 +194,26 @@ public interface Tag<T extends Keyed> extends Keyed {
|
|||||||
* Vanilla block tag representing all coral.
|
* Vanilla block tag representing all coral.
|
||||||
*/
|
*/
|
||||||
Tag<Material> CORALS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("corals"), Material.class);
|
Tag<Material> CORALS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("corals"), Material.class);
|
||||||
|
/**
|
||||||
|
* Vanilla block tag denoting all blocks bamboo may be planted on.
|
||||||
|
*/
|
||||||
|
Tag<Material> BAMBOO_PLANTABLE_ON = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("bamboo_plantable_on"), Material.class);
|
||||||
|
/**
|
||||||
|
* Vanilla block tag denoting dirt like blocks.
|
||||||
|
*/
|
||||||
|
Tag<Material> DIRT_LIKE = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("dirt_like"), Material.class);
|
||||||
|
/**
|
||||||
|
* Vanilla block tag representing all standing signs.
|
||||||
|
*/
|
||||||
|
Tag<Material> STANDING_SIGNS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("standing_signs"), Material.class);
|
||||||
|
/**
|
||||||
|
* Vanilla block tag representing all wall signs.
|
||||||
|
*/
|
||||||
|
Tag<Material> WALL_SIGNS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("wall_signs"), Material.class);
|
||||||
|
/**
|
||||||
|
* Vanilla block tag representing all signs.
|
||||||
|
*/
|
||||||
|
Tag<Material> SIGNS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("signs"), Material.class);
|
||||||
/**
|
/**
|
||||||
* Key for the built in item registry.
|
* Key for the built in item registry.
|
||||||
*/
|
*/
|
||||||
@@ -191,6 +230,18 @@ public interface Tag<T extends Keyed> extends Keyed {
|
|||||||
* Vanilla item tag representing all fish items.
|
* Vanilla item tag representing all fish items.
|
||||||
*/
|
*/
|
||||||
Tag<Material> ITEMS_FISHES = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("fishes"), Material.class);
|
Tag<Material> ITEMS_FISHES = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("fishes"), Material.class);
|
||||||
|
/**
|
||||||
|
* Vanilla item tag representing all music disc items.
|
||||||
|
*/
|
||||||
|
Tag<Material> ITEMS_MUSIC_DISCS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("music_discs"), Material.class);
|
||||||
|
/**
|
||||||
|
* Vanilla item tag representing all coal items.
|
||||||
|
*/
|
||||||
|
Tag<Material> ITEMS_COALS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("coals"), Material.class);
|
||||||
|
/**
|
||||||
|
* Vanilla item tag representing all arrow items.
|
||||||
|
*/
|
||||||
|
Tag<Material> ITEMS_ARROWS = Bukkit.getTag(REGISTRY_ITEMS, NamespacedKey.minecraft("arrows"), Material.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether or not this tag has an entry for the specified item.
|
* Returns whether or not this tag has an entry for the specified item.
|
||||||
|
|||||||
@@ -1,100 +0,0 @@
|
|||||||
package org.bukkit;
|
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Travel Agent handles the creation and the research of Nether and End
|
|
||||||
* portals when Entities try to use one.
|
|
||||||
* <p>
|
|
||||||
* It is used in {@link org.bukkit.event.entity.EntityPortalEvent} and in
|
|
||||||
* {@link org.bukkit.event.player.PlayerPortalEvent} to help developers
|
|
||||||
* reproduce and/or modify Vanilla behaviour.
|
|
||||||
*/
|
|
||||||
public interface TravelAgent {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the Block radius to search in for available portals.
|
|
||||||
*
|
|
||||||
* @param radius the radius in which to search for a portal from the
|
|
||||||
* location
|
|
||||||
* @return this travel agent
|
|
||||||
*/
|
|
||||||
@NotNull
|
|
||||||
public TravelAgent setSearchRadius(int radius);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the search radius value for finding an available portal.
|
|
||||||
*
|
|
||||||
* @return the currently set search radius
|
|
||||||
*/
|
|
||||||
public int getSearchRadius();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the maximum radius from the given location to create a portal.
|
|
||||||
*
|
|
||||||
* @param radius the radius in which to create a portal from the location
|
|
||||||
* @return this travel agent
|
|
||||||
*/
|
|
||||||
@NotNull
|
|
||||||
public TravelAgent setCreationRadius(int radius);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the maximum radius from the given location to create a portal.
|
|
||||||
*
|
|
||||||
* @return the currently set creation radius
|
|
||||||
*/
|
|
||||||
public int getCreationRadius();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns whether the TravelAgent will attempt to create a destination
|
|
||||||
* portal or not.
|
|
||||||
*
|
|
||||||
* @return whether the TravelAgent should create a destination portal or
|
|
||||||
* not
|
|
||||||
*/
|
|
||||||
public boolean getCanCreatePortal();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets whether the TravelAgent should attempt to create a destination
|
|
||||||
* portal or not.
|
|
||||||
*
|
|
||||||
* @param create Sets whether the TravelAgent should create a destination
|
|
||||||
* portal or not
|
|
||||||
*/
|
|
||||||
public void setCanCreatePortal(boolean create);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Attempt to find a portal near the given location, if a portal is not
|
|
||||||
* found it will attempt to create one.
|
|
||||||
*
|
|
||||||
* @param location the location where the search for a portal should begin
|
|
||||||
* @return the location of a portal which has been found or returns the
|
|
||||||
* location passed to the method if unsuccessful
|
|
||||||
* @see #createPortal(Location)
|
|
||||||
*/
|
|
||||||
@NotNull
|
|
||||||
public Location findOrCreate(@NotNull Location location);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Attempt to find a portal near the given location.
|
|
||||||
*
|
|
||||||
* @param location the desired location of the portal
|
|
||||||
* @return the location of the nearest portal to the location
|
|
||||||
*/
|
|
||||||
@NotNull
|
|
||||||
public Location findPortal(@NotNull Location location);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Attempt to create a portal near the given location.
|
|
||||||
* <p>
|
|
||||||
* In the case of a Nether portal teleportation, this will attempt to
|
|
||||||
* create a Nether portal.
|
|
||||||
* <p>
|
|
||||||
* In the case of an Ender portal teleportation, this will (re-)create the
|
|
||||||
* obsidian platform and clean blocks above it.
|
|
||||||
*
|
|
||||||
* @param location the desired location of the portal
|
|
||||||
* @return true if a portal was successfully created
|
|
||||||
*/
|
|
||||||
public boolean createPortal(@NotNull Location location);
|
|
||||||
}
|
|
||||||
@@ -1,8 +1,7 @@
|
|||||||
package org.bukkit;
|
package org.bukkit;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
import java.util.Map;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -37,7 +36,7 @@ public enum TreeSpecies {
|
|||||||
;
|
;
|
||||||
|
|
||||||
private final byte data;
|
private final byte data;
|
||||||
private final static Map<Byte, TreeSpecies> BY_DATA = Maps.newHashMap();
|
private static final Map<Byte, TreeSpecies> BY_DATA = Maps.newHashMap();
|
||||||
|
|
||||||
private TreeSpecies(final int data) {
|
private TreeSpecies(final int data) {
|
||||||
this.data = (byte) data;
|
this.data = (byte) data;
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ public interface UnsafeValues {
|
|||||||
|
|
||||||
BlockData fromLegacy(Material material, byte data);
|
BlockData fromLegacy(Material material, byte data);
|
||||||
|
|
||||||
|
Material getMaterial(String material, int version);
|
||||||
|
|
||||||
int getDataVersion();
|
int getDataVersion();
|
||||||
|
|
||||||
ItemStack modifyItemStack(ItemStack stack, String arguments);
|
ItemStack modifyItemStack(ItemStack stack, String arguments);
|
||||||
@@ -68,9 +70,22 @@ public interface UnsafeValues {
|
|||||||
*/
|
*/
|
||||||
boolean removeAdvancement(NamespacedKey key);
|
boolean removeAdvancement(NamespacedKey key);
|
||||||
|
|
||||||
// Paper start - Add legacy check util
|
// Paper start
|
||||||
|
/**
|
||||||
|
* Server name to report to timings v2
|
||||||
|
* @return name
|
||||||
|
*/
|
||||||
|
String getTimingsServerName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called once by the version command on first use, then cached.
|
||||||
|
*/
|
||||||
|
default com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() {
|
||||||
|
return new com.destroystokyo.paper.util.VersionFetcher.DummyVersionFetcher();
|
||||||
|
}
|
||||||
|
|
||||||
static boolean isLegacyPlugin(org.bukkit.plugin.Plugin plugin) {
|
static boolean isLegacyPlugin(org.bukkit.plugin.Plugin plugin) {
|
||||||
return !("1.13".equals(plugin.getDescription().getAPIVersion()));
|
return !"1.13".equals(plugin.getDescription().getAPIVersion()) && !"1.14".equals(plugin.getDescription().getAPIVersion());
|
||||||
}
|
}
|
||||||
// Paper end
|
// Paper end
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
package org.bukkit;
|
package org.bukkit;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableMap;
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
import java.lang.annotation.Target;
|
import java.lang.annotation.Target;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
|||||||
@@ -10,15 +10,24 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.AbstractArrow;
|
||||||
|
import org.bukkit.entity.Arrow;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.FallingBlock;
|
||||||
|
import org.bukkit.entity.Item;
|
||||||
|
import org.bukkit.entity.LightningStrike;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.generator.BlockPopulator;
|
import org.bukkit.generator.BlockPopulator;
|
||||||
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.material.MaterialData;
|
import org.bukkit.material.MaterialData;
|
||||||
import org.bukkit.metadata.Metadatable;
|
import org.bukkit.metadata.Metadatable;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.messaging.PluginMessageRecipient;
|
import org.bukkit.plugin.messaging.PluginMessageRecipient;
|
||||||
import org.bukkit.util.BoundingBox;
|
import org.bukkit.util.BoundingBox;
|
||||||
import org.bukkit.util.Consumer;
|
import org.bukkit.util.Consumer;
|
||||||
@@ -33,22 +42,6 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
*/
|
*/
|
||||||
public interface World extends PluginMessageRecipient, Metadatable {
|
public interface World extends PluginMessageRecipient, Metadatable {
|
||||||
|
|
||||||
// Akarin start
|
|
||||||
/**
|
|
||||||
* Get the nearest village of the location in range.
|
|
||||||
*
|
|
||||||
* @return The nearest village, null if there is no village in range.
|
|
||||||
*/
|
|
||||||
public io.akarin.server.api.structure.Village getNearestVillage(@NotNull Location location, double xRadius, double yRadius, double zRadius);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get villages which are near by the location in range.
|
|
||||||
*
|
|
||||||
* @return All the villages in range, an empty list if there is no village in range.
|
|
||||||
*/
|
|
||||||
public List<io.akarin.server.api.structure.Village> getVillagesInRange(@NotNull Location location, double xRadius, double yRadius, double zRadius);
|
|
||||||
// Akarin end
|
|
||||||
|
|
||||||
// Paper start
|
// Paper start
|
||||||
/**
|
/**
|
||||||
* @return The amount of Entities in this world
|
* @return The amount of Entities in this world
|
||||||
@@ -169,6 +162,79 @@ public interface World extends PluginMessageRecipient, Metadatable {
|
|||||||
@NotNull
|
@NotNull
|
||||||
public Block getHighestBlockAt(@NotNull Location location);
|
public Block getHighestBlockAt(@NotNull Location location);
|
||||||
|
|
||||||
|
// Paper start - Add heightmap API
|
||||||
|
/**
|
||||||
|
* Returns the highest block's y-coordinate at the specified block coordinates that match the specified heightmap's conditions.
|
||||||
|
* <p>
|
||||||
|
* <b>implNote:</b> Implementations are recommended to use an iterative search as a fallback before resorting to
|
||||||
|
* throwing an {@code UnsupportedOperationException}.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param x The block's x-coordinate.
|
||||||
|
* @param z The block's z-coordinate.
|
||||||
|
* @param heightmap The specified heightmap to use. See {@link com.destroystokyo.paper.HeightmapType}
|
||||||
|
* @return The highest block's y-coordinate at (x, z) that matches the specified heightmap's conditions.
|
||||||
|
* @throws UnsupportedOperationException If the heightmap type is not supported.
|
||||||
|
*
|
||||||
|
* @see com.destroystokyo.paper.HeightmapType
|
||||||
|
*/
|
||||||
|
public int getHighestBlockYAt(int x, int z, @NotNull com.destroystokyo.paper.HeightmapType heightmap) throws UnsupportedOperationException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the highest block's y-coordinate at the specified block coordinates that match the specified heightmap's conditions.
|
||||||
|
* Note that the y-coordinate of the specified location is ignored.
|
||||||
|
* <p>
|
||||||
|
* <b>implNote:</b> Implementations are recommended to use an iterative search as a fallback before resorting to
|
||||||
|
* throwing an {@code UnsupportedOperationException}.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param location The specified block coordinates.
|
||||||
|
* @param heightmap The specified heightmap to use. See {@link com.destroystokyo.paper.HeightmapType}
|
||||||
|
* @return The highest block's y-coordinate at {@code location} that matches the specified heightmap's conditions.
|
||||||
|
* @throws UnsupportedOperationException If the heightmap type is not supported.
|
||||||
|
* @see com.destroystokyo.paper.HeightmapType
|
||||||
|
*/
|
||||||
|
default int getHighestBlockYAt(@NotNull Location location, @NotNull com.destroystokyo.paper.HeightmapType heightmap) throws UnsupportedOperationException {
|
||||||
|
return this.getHighestBlockYAt(location.getBlockX(), location.getBlockZ(), heightmap);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the highest {@link Block} at the specified block coordinates that match the specified heightmap's conditions.
|
||||||
|
* <p>
|
||||||
|
* <b>implNote:</b> Implementations are recommended to use an iterative search as a fallback before resorting to
|
||||||
|
* throwing an {@code UnsupportedOperationException}.
|
||||||
|
* </p>
|
||||||
|
* @param x The block's x-coordinate.
|
||||||
|
* @param z The block's z-coordinate.
|
||||||
|
* @param heightmap The specified heightmap to use. See {@link com.destroystokyo.paper.HeightmapType}
|
||||||
|
* @return The highest {@link Block} at (x, z) that matches the specified heightmap's conditions.
|
||||||
|
* @throws UnsupportedOperationException If the heightmap type is not supported.
|
||||||
|
* @see com.destroystokyo.paper.HeightmapType
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
default Block getHighestBlockAt(int x, int z, @NotNull com.destroystokyo.paper.HeightmapType heightmap) throws UnsupportedOperationException {
|
||||||
|
return this.getBlockAt(x, this.getHighestBlockYAt(x, z, heightmap), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the highest {@link Block} at the specified block coordinates that match the specified heightmap's conditions.
|
||||||
|
* Note that the y-coordinate of the specified location is ignored.
|
||||||
|
* <p>
|
||||||
|
* <b>implNote:</b> Implementations are recommended to use an iterative search as a fallback before resorting to
|
||||||
|
* throwing an {@code UnsupportedOperationException}.
|
||||||
|
* </p>
|
||||||
|
* @param location The specified block coordinates.
|
||||||
|
* @param heightmap The specified heightmap to use. See {@link com.destroystokyo.paper.HeightmapType}
|
||||||
|
* @return The highest {@link Block} at {@code location} that matches the specified heightmap's conditions.
|
||||||
|
* @throws UnsupportedOperationException If the heightmap type is not supported.
|
||||||
|
* @see com.destroystokyo.paper.HeightmapType
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
default Block getHighestBlockAt(@NotNull Location location, @NotNull com.destroystokyo.paper.HeightmapType heightmap) throws UnsupportedOperationException {
|
||||||
|
return this.getHighestBlockAt(location.getBlockX(), location.getBlockZ(), heightmap);
|
||||||
|
}
|
||||||
|
// Paper end
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the {@link Chunk} at the given coordinates
|
* Gets the {@link Chunk} at the given coordinates
|
||||||
*
|
*
|
||||||
@@ -593,7 +659,11 @@ public interface World extends PluginMessageRecipient, Metadatable {
|
|||||||
public Chunk[] getLoadedChunks();
|
public Chunk[] getLoadedChunks();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the specified {@link Chunk}
|
* Loads the specified {@link Chunk}.
|
||||||
|
* <p>
|
||||||
|
* <b>This method will keep the specified chunk loaded until one of the
|
||||||
|
* unload methods is manually called. Callers are advised to instead use
|
||||||
|
* getChunkAt which will only temporarily load the requested chunk.</b>
|
||||||
*
|
*
|
||||||
* @param chunk The chunk to load
|
* @param chunk The chunk to load
|
||||||
*/
|
*/
|
||||||
@@ -625,11 +695,19 @@ public interface World extends PluginMessageRecipient, Metadatable {
|
|||||||
* @param z Z-coordinate of the chunk
|
* @param z Z-coordinate of the chunk
|
||||||
* @return true if the chunk is loaded and in use by one or more players,
|
* @return true if the chunk is loaded and in use by one or more players,
|
||||||
* otherwise false
|
* otherwise false
|
||||||
|
* @deprecated This method was added to facilitate chunk garbage collection.
|
||||||
|
* As of the current Minecraft version chunks are now strictly managed and
|
||||||
|
* will not be loaded for more than 1 tick unless they are in use.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public boolean isChunkInUse(int x, int z);
|
public boolean isChunkInUse(int x, int z);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the {@link Chunk} at the specified coordinates
|
* Loads the {@link Chunk} at the specified coordinates.
|
||||||
|
* <p>
|
||||||
|
* <b>This method will keep the specified chunk loaded until one of the
|
||||||
|
* unload methods is manually called. Callers are advised to instead use
|
||||||
|
* getChunkAt which will only temporarily load the requested chunk.</b>
|
||||||
* <p>
|
* <p>
|
||||||
* If the chunk does not exist, it will be generated.
|
* If the chunk does not exist, it will be generated.
|
||||||
* <p>
|
* <p>
|
||||||
@@ -642,7 +720,11 @@ public interface World extends PluginMessageRecipient, Metadatable {
|
|||||||
public void loadChunk(int x, int z);
|
public void loadChunk(int x, int z);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the {@link Chunk} at the specified coordinates
|
* Loads the {@link Chunk} at the specified coordinates.
|
||||||
|
* <p>
|
||||||
|
* <b>This method will keep the specified chunk loaded until one of the
|
||||||
|
* unload methods is manually called. Callers are advised to instead use
|
||||||
|
* getChunkAt which will only temporarily load the requested chunk.</b>
|
||||||
*
|
*
|
||||||
* @param x X-coordinate of the chunk
|
* @param x X-coordinate of the chunk
|
||||||
* @param z Z-coordinate of the chunk
|
* @param z Z-coordinate of the chunk
|
||||||
@@ -655,8 +737,8 @@ public interface World extends PluginMessageRecipient, Metadatable {
|
|||||||
/**
|
/**
|
||||||
* Safely unloads and saves the {@link Chunk} at the specified coordinates
|
* Safely unloads and saves the {@link Chunk} at the specified coordinates
|
||||||
* <p>
|
* <p>
|
||||||
* This method is analogous to {@link #unloadChunk(int, int, boolean,
|
* This method is analogous to {@link #unloadChunk(int, int, boolean)}
|
||||||
* boolean)} where safe and save is true
|
* where save is true.
|
||||||
*
|
*
|
||||||
* @param chunk the chunk to unload
|
* @param chunk the chunk to unload
|
||||||
* @return true if the chunk has unloaded successfully, otherwise false
|
* @return true if the chunk has unloaded successfully, otherwise false
|
||||||
@@ -666,8 +748,8 @@ public interface World extends PluginMessageRecipient, Metadatable {
|
|||||||
/**
|
/**
|
||||||
* Safely unloads and saves the {@link Chunk} at the specified coordinates
|
* Safely unloads and saves the {@link Chunk} at the specified coordinates
|
||||||
* <p>
|
* <p>
|
||||||
* This method is analogous to {@link #unloadChunk(int, int, boolean,
|
* This method is analogous to {@link #unloadChunk(int, int, boolean)}
|
||||||
* boolean)} where safe and saveis true
|
* where save is true.
|
||||||
*
|
*
|
||||||
* @param x X-coordinate of the chunk
|
* @param x X-coordinate of the chunk
|
||||||
* @param z Z-coordinate of the chunk
|
* @param z Z-coordinate of the chunk
|
||||||
@@ -677,10 +759,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Safely unloads and optionally saves the {@link Chunk} at the specified
|
* Safely unloads and optionally saves the {@link Chunk} at the specified
|
||||||
* coordinates
|
* coordinates.
|
||||||
* <p>
|
|
||||||
* This method is analogous to {@link #unloadChunk(int, int, boolean,
|
|
||||||
* boolean)} where save is true
|
|
||||||
*
|
*
|
||||||
* @param x X-coordinate of the chunk
|
* @param x X-coordinate of the chunk
|
||||||
* @param z Z-coordinate of the chunk
|
* @param z Z-coordinate of the chunk
|
||||||
@@ -689,27 +768,9 @@ public interface World extends PluginMessageRecipient, Metadatable {
|
|||||||
*/
|
*/
|
||||||
public boolean unloadChunk(int x, int z, boolean save);
|
public boolean unloadChunk(int x, int z, boolean save);
|
||||||
|
|
||||||
/**
|
|
||||||
* Unloads and optionally saves the {@link Chunk} at the specified
|
|
||||||
* coordinates
|
|
||||||
*
|
|
||||||
* @param x X-coordinate of the chunk
|
|
||||||
* @param z Z-coordinate of the chunk
|
|
||||||
* @param save Controls whether the chunk is saved
|
|
||||||
* @param safe Controls whether to unload the chunk when players are
|
|
||||||
* nearby
|
|
||||||
* @return true if the chunk has unloaded successfully, otherwise false
|
|
||||||
* @deprecated it is never safe to remove a chunk in use
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public boolean unloadChunk(int x, int z, boolean save, boolean safe);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Safely queues the {@link Chunk} at the specified coordinates for
|
* Safely queues the {@link Chunk} at the specified coordinates for
|
||||||
* unloading
|
* unloading.
|
||||||
* <p>
|
|
||||||
* This method is analogous to {@link #unloadChunkRequest(int, int,
|
|
||||||
* boolean)} where safe is true
|
|
||||||
*
|
*
|
||||||
* @param x X-coordinate of the chunk
|
* @param x X-coordinate of the chunk
|
||||||
* @param z Z-coordinate of the chunk
|
* @param z Z-coordinate of the chunk
|
||||||
@@ -717,18 +778,6 @@ public interface World extends PluginMessageRecipient, Metadatable {
|
|||||||
*/
|
*/
|
||||||
public boolean unloadChunkRequest(int x, int z);
|
public boolean unloadChunkRequest(int x, int z);
|
||||||
|
|
||||||
/**
|
|
||||||
* Queues the {@link Chunk} at the specified coordinates for unloading
|
|
||||||
*
|
|
||||||
* @param x X-coordinate of the chunk
|
|
||||||
* @param z Z-coordinate of the chunk
|
|
||||||
* @param safe Controls whether to queue the chunk when players are nearby
|
|
||||||
* @return Whether the chunk was actually queued
|
|
||||||
* @deprecated it is never safe to remove a chunk in use
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public boolean unloadChunkRequest(int x, int z, boolean safe);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Regenerates the {@link Chunk} at the specified coordinates
|
* Regenerates the {@link Chunk} at the specified coordinates
|
||||||
*
|
*
|
||||||
@@ -775,7 +824,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
|
|||||||
*
|
*
|
||||||
* @param x X-coordinate of the chunk
|
* @param x X-coordinate of the chunk
|
||||||
* @param z Z-coordinate of the chunk
|
* @param z Z-coordinate of the chunk
|
||||||
* @param forced
|
* @param forced force load status
|
||||||
*/
|
*/
|
||||||
public void setChunkForceLoaded(int x, int z, boolean forced);
|
public void setChunkForceLoaded(int x, int z, boolean forced);
|
||||||
|
|
||||||
@@ -789,6 +838,94 @@ public interface World extends PluginMessageRecipient, Metadatable {
|
|||||||
@NotNull
|
@NotNull
|
||||||
public Collection<Chunk> getForceLoadedChunks();
|
public Collection<Chunk> getForceLoadedChunks();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a plugin ticket for the specified chunk, loading the chunk if it is
|
||||||
|
* not already loaded.
|
||||||
|
* <p>
|
||||||
|
* A plugin ticket will prevent a chunk from unloading until it is
|
||||||
|
* explicitly removed. A plugin instance may only have one ticket per chunk,
|
||||||
|
* but each chunk can have multiple plugin tickets.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param x X-coordinate of the chunk
|
||||||
|
* @param z Z-coordinate of the chunk
|
||||||
|
* @param plugin Plugin which owns the ticket
|
||||||
|
* @return {@code true} if a plugin ticket was added, {@code false} if the
|
||||||
|
* ticket already exists for the plugin
|
||||||
|
* @throws IllegalStateException If the specified plugin is not enabled
|
||||||
|
* @see #removePluginChunkTicket(int, int, Plugin)
|
||||||
|
*/
|
||||||
|
public boolean addPluginChunkTicket(int x, int z, @NotNull Plugin plugin);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the specified plugin's ticket for the specified chunk
|
||||||
|
* <p>
|
||||||
|
* A plugin ticket will prevent a chunk from unloading until it is
|
||||||
|
* explicitly removed. A plugin instance may only have one ticket per chunk,
|
||||||
|
* but each chunk can have multiple plugin tickets.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param x X-coordinate of the chunk
|
||||||
|
* @param z Z-coordinate of the chunk
|
||||||
|
* @param plugin Plugin which owns the ticket
|
||||||
|
* @return {@code true} if the plugin ticket was removed, {@code false} if
|
||||||
|
* there is no plugin ticket for the chunk
|
||||||
|
* @see #addPluginChunkTicket(int, int, Plugin)
|
||||||
|
*/
|
||||||
|
public boolean removePluginChunkTicket(int x, int z, @NotNull Plugin plugin);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes all plugin tickets for the specified plugin
|
||||||
|
* <p>
|
||||||
|
* A plugin ticket will prevent a chunk from unloading until it is
|
||||||
|
* explicitly removed. A plugin instance may only have one ticket per chunk,
|
||||||
|
* but each chunk can have multiple plugin tickets.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param plugin Specified plugin
|
||||||
|
* @see #addPluginChunkTicket(int, int, Plugin)
|
||||||
|
* @see #removePluginChunkTicket(int, int, Plugin)
|
||||||
|
*/
|
||||||
|
public void removePluginChunkTickets(@NotNull Plugin plugin);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves a collection specifying which plugins have tickets for the
|
||||||
|
* specified chunk. This collection is not updated when plugin tickets are
|
||||||
|
* added or removed to the chunk.
|
||||||
|
* <p>
|
||||||
|
* A plugin ticket will prevent a chunk from unloading until it is
|
||||||
|
* explicitly removed. A plugin instance may only have one ticket per chunk,
|
||||||
|
* but each chunk can have multiple plugin tickets.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param x X-coordinate of the chunk
|
||||||
|
* @param z Z-coordinate of the chunk
|
||||||
|
* @return unmodifiable collection containing which plugins have tickets for
|
||||||
|
* the chunk
|
||||||
|
* @see #addPluginChunkTicket(int, int, Plugin)
|
||||||
|
* @see #removePluginChunkTicket(int, int, Plugin)
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
public Collection<Plugin> getPluginChunkTickets(int x, int z);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a map of which plugins have tickets for what chunks. The returned
|
||||||
|
* map is not updated when plugin tickets are added or removed to chunks. If
|
||||||
|
* a plugin has no tickets, it will be absent from the map.
|
||||||
|
* <p>
|
||||||
|
* A plugin ticket will prevent a chunk from unloading until it is
|
||||||
|
* explicitly removed. A plugin instance may only have one ticket per chunk,
|
||||||
|
* but each chunk can have multiple plugin tickets.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @return unmodifiable map containing which plugins have tickets for what
|
||||||
|
* chunks
|
||||||
|
* @see #addPluginChunkTicket(int, int, Plugin)
|
||||||
|
* @see #removePluginChunkTicket(int, int, Plugin)
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
public Map<Plugin, Collection<Chunk>> getPluginChunkTickets();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Drops an item at the specified {@link Location}
|
* Drops an item at the specified {@link Location}
|
||||||
*
|
*
|
||||||
@@ -834,7 +971,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
|
|||||||
* @return Arrow entity spawned as a result of this method
|
* @return Arrow entity spawned as a result of this method
|
||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
public <T extends Arrow> T spawnArrow(@NotNull Location location, @NotNull Vector direction, float speed, float spread, @NotNull Class<T> clazz);
|
public <T extends AbstractArrow> T spawnArrow(@NotNull Location location, @NotNull Vector direction, float speed, float spread, @NotNull Class<T> clazz);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a tree at the given {@link Location}
|
* Creates a tree at the given {@link Location}
|
||||||
@@ -1638,6 +1775,21 @@ public interface World extends PluginMessageRecipient, Metadatable {
|
|||||||
*/
|
*/
|
||||||
public boolean createExplosion(double x, double y, double z, float power, boolean setFire, boolean breakBlocks);
|
public boolean createExplosion(double x, double y, double z, float power, boolean setFire, boolean breakBlocks);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates explosion at given coordinates with given power and optionally
|
||||||
|
* setting blocks on fire or breaking blocks.
|
||||||
|
*
|
||||||
|
* @param x X coordinate
|
||||||
|
* @param y Y coordinate
|
||||||
|
* @param z Z coordinate
|
||||||
|
* @param power The power of explosion, where 4F is TNT
|
||||||
|
* @param setFire Whether or not to set blocks on fire
|
||||||
|
* @param breakBlocks Whether or not to have blocks be destroyed
|
||||||
|
* @param source the source entity, used for tracking damage
|
||||||
|
* @return false if explosion was canceled, otherwise true
|
||||||
|
*/
|
||||||
|
public boolean createExplosion(double x, double y, double z, float power, boolean setFire, boolean breakBlocks, @Nullable Entity source);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates explosion at given coordinates with given power
|
* Creates explosion at given coordinates with given power
|
||||||
*
|
*
|
||||||
@@ -1738,9 +1890,10 @@ public interface World extends PluginMessageRecipient, Metadatable {
|
|||||||
public default boolean createExplosion(@NotNull Entity source, float power) {
|
public default boolean createExplosion(@NotNull Entity source, float power) {
|
||||||
return createExplosion(source, source.getLocation(), power, true, true);
|
return createExplosion(source, source.getLocation(), power, true, true);
|
||||||
}
|
}
|
||||||
|
// Paper end
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates explosion at given location with given power and optionally
|
* Creates explosion at given coordinates with given power and optionally
|
||||||
* setting blocks on fire or breaking blocks.
|
* setting blocks on fire or breaking blocks.
|
||||||
*
|
*
|
||||||
* @param loc Location to blow up
|
* @param loc Location to blow up
|
||||||
@@ -1749,10 +1902,20 @@ public interface World extends PluginMessageRecipient, Metadatable {
|
|||||||
* @param breakBlocks Whether or not to have blocks be destroyed
|
* @param breakBlocks Whether or not to have blocks be destroyed
|
||||||
* @return false if explosion was canceled, otherwise true
|
* @return false if explosion was canceled, otherwise true
|
||||||
*/
|
*/
|
||||||
public default boolean createExplosion(@NotNull Location loc, float power, boolean setFire, boolean breakBlocks) {
|
public boolean createExplosion(@NotNull Location loc, float power, boolean setFire, boolean breakBlocks);
|
||||||
return createExplosion(loc.getX(), loc.getY(), loc.getZ(), power, setFire, breakBlocks);
|
|
||||||
}
|
/**
|
||||||
// Paper end
|
* Creates explosion at given coordinates with given power and optionally
|
||||||
|
* setting blocks on fire or breaking blocks.
|
||||||
|
*
|
||||||
|
* @param loc Location to blow up
|
||||||
|
* @param power The power of explosion, where 4F is TNT
|
||||||
|
* @param setFire Whether or not to set blocks on fire
|
||||||
|
* @param breakBlocks Whether or not to have blocks be destroyed
|
||||||
|
* @param source the source entity, used for tracking damage
|
||||||
|
* @return false if explosion was canceled, otherwise true
|
||||||
|
*/
|
||||||
|
public boolean createExplosion(@NotNull Location loc, float power, boolean setFire, boolean breakBlocks, @Nullable Entity source);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the {@link Environment} type of this world
|
* Gets the {@link Environment} type of this world
|
||||||
@@ -2457,6 +2620,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
|
|||||||
* Spawns the particle (the number of times specified by count)
|
* Spawns the particle (the number of times specified by count)
|
||||||
* at the target location.
|
* at the target location.
|
||||||
*
|
*
|
||||||
|
* @param <T> type of particle data (see {@link Particle#getDataType()}
|
||||||
* @param particle the particle to spawn
|
* @param particle the particle to spawn
|
||||||
* @param location the location to spawn at
|
* @param location the location to spawn at
|
||||||
* @param count the number of particles
|
* @param count the number of particles
|
||||||
@@ -2471,6 +2635,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
|
|||||||
* Spawns the particle (the number of times specified by count)
|
* Spawns the particle (the number of times specified by count)
|
||||||
* at the target location.
|
* at the target location.
|
||||||
*
|
*
|
||||||
|
* @param <T> type of particle data (see {@link Particle#getDataType()}
|
||||||
* @param particle the particle to spawn
|
* @param particle the particle to spawn
|
||||||
* @param x the position on the x axis to spawn at
|
* @param x the position on the x axis to spawn at
|
||||||
* @param y the position on the y axis to spawn at
|
* @param y the position on the y axis to spawn at
|
||||||
@@ -2520,6 +2685,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
|
|||||||
* randomized positively and negatively by the offset parameters
|
* randomized positively and negatively by the offset parameters
|
||||||
* on each axis.
|
* on each axis.
|
||||||
*
|
*
|
||||||
|
* @param <T> type of particle data (see {@link Particle#getDataType()}
|
||||||
* @param particle the particle to spawn
|
* @param particle the particle to spawn
|
||||||
* @param location the location to spawn at
|
* @param location the location to spawn at
|
||||||
* @param count the number of particles
|
* @param count the number of particles
|
||||||
@@ -2538,6 +2704,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
|
|||||||
* randomized positively and negatively by the offset parameters
|
* randomized positively and negatively by the offset parameters
|
||||||
* on each axis.
|
* on each axis.
|
||||||
*
|
*
|
||||||
|
* @param <T> type of particle data (see {@link Particle#getDataType()}
|
||||||
* @param particle the particle to spawn
|
* @param particle the particle to spawn
|
||||||
* @param x the position on the x axis to spawn at
|
* @param x the position on the x axis to spawn at
|
||||||
* @param y the position on the y axis to spawn at
|
* @param y the position on the y axis to spawn at
|
||||||
@@ -2594,6 +2761,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
|
|||||||
* randomized positively and negatively by the offset parameters
|
* randomized positively and negatively by the offset parameters
|
||||||
* on each axis.
|
* on each axis.
|
||||||
*
|
*
|
||||||
|
* @param <T> type of particle data (see {@link Particle#getDataType()}
|
||||||
* @param particle the particle to spawn
|
* @param particle the particle to spawn
|
||||||
* @param location the location to spawn at
|
* @param location the location to spawn at
|
||||||
* @param count the number of particles
|
* @param count the number of particles
|
||||||
@@ -2614,6 +2782,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
|
|||||||
* randomized positively and negatively by the offset parameters
|
* randomized positively and negatively by the offset parameters
|
||||||
* on each axis.
|
* on each axis.
|
||||||
*
|
*
|
||||||
|
* @param <T> type of particle data (see {@link Particle#getDataType()}
|
||||||
* @param particle the particle to spawn
|
* @param particle the particle to spawn
|
||||||
* @param x the position on the x axis to spawn at
|
* @param x the position on the x axis to spawn at
|
||||||
* @param y the position on the y axis to spawn at
|
* @param y the position on the y axis to spawn at
|
||||||
@@ -2686,6 +2855,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
|
|||||||
* randomized positively and negatively by the offset parameters
|
* randomized positively and negatively by the offset parameters
|
||||||
* on each axis.
|
* on each axis.
|
||||||
*
|
*
|
||||||
|
* @param <T> type of particle data (see {@link Particle#getDataType()}
|
||||||
* @param particle the particle to spawn
|
* @param particle the particle to spawn
|
||||||
* @param location the location to spawn at
|
* @param location the location to spawn at
|
||||||
* @param count the number of particles
|
* @param count the number of particles
|
||||||
@@ -2709,6 +2879,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
|
|||||||
* randomized positively and negatively by the offset parameters
|
* randomized positively and negatively by the offset parameters
|
||||||
* on each axis.
|
* on each axis.
|
||||||
*
|
*
|
||||||
|
* @param <T> type of particle data (see {@link Particle#getDataType()}
|
||||||
* @param particle the particle to spawn
|
* @param particle the particle to spawn
|
||||||
* @param x the position on the x axis to spawn at
|
* @param x the position on the x axis to spawn at
|
||||||
* @param y the position on the y axis to spawn at
|
* @param y the position on the y axis to spawn at
|
||||||
@@ -2755,6 +2926,15 @@ public interface World extends PluginMessageRecipient, Metadatable {
|
|||||||
@Nullable
|
@Nullable
|
||||||
public Location locateNearestStructure(@NotNull Location origin, @NotNull StructureType structureType, int radius, boolean findUnexplored);
|
public Location locateNearestStructure(@NotNull Location origin, @NotNull StructureType structureType, int radius, boolean findUnexplored);
|
||||||
|
|
||||||
|
// Spigot start
|
||||||
|
/**
|
||||||
|
* Returns the view distance used for this world.
|
||||||
|
*
|
||||||
|
* @return the view distance used for this world
|
||||||
|
*/
|
||||||
|
int getViewDistance();
|
||||||
|
// Spigot end
|
||||||
|
|
||||||
// Spigot start
|
// Spigot start
|
||||||
public class Spigot
|
public class Spigot
|
||||||
{
|
{
|
||||||
@@ -2790,6 +2970,24 @@ public interface World extends PluginMessageRecipient, Metadatable {
|
|||||||
Spigot spigot();
|
Spigot spigot();
|
||||||
// Spigot end
|
// Spigot end
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds the nearest raid close to the given location.
|
||||||
|
*
|
||||||
|
* @param location the origin location
|
||||||
|
* @param radius the radius
|
||||||
|
* @return the closest {@link Raid}, or null if no raids were found
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
public Raid locateNearestRaid(@NotNull Location location, int radius);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets all raids that are going on over this world.
|
||||||
|
*
|
||||||
|
* @return the list of all active raids
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
public List<Raid> getRaids();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents various map environment types that a world may be
|
* Represents various map environment types that a world may be
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ public class WorldCreator {
|
|||||||
seed = world.getSeed();
|
seed = world.getSeed();
|
||||||
environment = world.getEnvironment();
|
environment = world.getEnvironment();
|
||||||
generator = world.getGenerator();
|
generator = world.getGenerator();
|
||||||
|
type = world.getWorldType();
|
||||||
|
generateStructures = world.canGenerateStructures();
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@@ -67,6 +69,9 @@ public class WorldCreator {
|
|||||||
seed = creator.seed();
|
seed = creator.seed();
|
||||||
environment = creator.environment();
|
environment = creator.environment();
|
||||||
generator = creator.generator();
|
generator = creator.generator();
|
||||||
|
type = creator.type();
|
||||||
|
generateStructures = creator.generateStructures();
|
||||||
|
generatorSettings = creator.generatorSettings();
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
package org.bukkit;
|
package org.bukkit;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
import java.util.Map;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents various types of worlds that may exist
|
* Represents various types of worlds that may exist
|
||||||
*/
|
*/
|
||||||
@@ -18,7 +17,7 @@ public enum WorldType {
|
|||||||
CUSTOMIZED("CUSTOMIZED"),
|
CUSTOMIZED("CUSTOMIZED"),
|
||||||
BUFFET("BUFFET");
|
BUFFET("BUFFET");
|
||||||
|
|
||||||
private final static Map<String, WorldType> BY_NAME = Maps.newHashMap();
|
private static final Map<String, WorldType> BY_NAME = Maps.newHashMap();
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
private WorldType(/*@NotNull*/ String name) {
|
private WorldType(/*@NotNull*/ String name) {
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
package org.bukkit.advancement;
|
package org.bukkit.advancement;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The individual status of an advancement for a player. This class is not
|
* The individual status of an advancement for a player. This class is not
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
package org.bukkit.attribute;
|
package org.bukkit.attribute;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a mutable instance of an attribute and its associated modifiers
|
* Represents a mutable instance of an attribute and its associated modifiers
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
package org.bukkit.block;
|
package org.bukkit.block;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import org.bukkit.DyeColor;
|
import org.bukkit.DyeColor;
|
||||||
import org.bukkit.block.banner.Pattern;
|
import org.bukkit.block.banner.Pattern;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a captured state of a banner.
|
* Represents a captured state of a banner.
|
||||||
*/
|
*/
|
||||||
public interface Banner extends BlockState {
|
public interface Banner extends TileState {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the base color for this banner
|
* Returns the base color for this banner
|
||||||
|
|||||||
8
api/src/main/java/org/bukkit/block/Barrel.java
Normal file
8
api/src/main/java/org/bukkit/block/Barrel.java
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
package org.bukkit.block;
|
||||||
|
|
||||||
|
import org.bukkit.loot.Lootable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a captured state of a Barrel.
|
||||||
|
*/
|
||||||
|
public interface Barrel extends Container, Lootable { }
|
||||||
@@ -3,7 +3,6 @@ package org.bukkit.block;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import org.bukkit.Nameable;
|
import org.bukkit.Nameable;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.inventory.BeaconInventory;
|
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -12,15 +11,7 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
/**
|
/**
|
||||||
* Represents a captured state of a beacon.
|
* Represents a captured state of a beacon.
|
||||||
*/
|
*/
|
||||||
public interface Beacon extends Container, Nameable {
|
public interface Beacon extends TileState, Lockable, Nameable {
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
BeaconInventory getInventory();
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
BeaconInventory getSnapshotInventory();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the list of players within the beacon's range of effect.
|
* Returns the list of players within the beacon's range of effect.
|
||||||
|
|||||||
@@ -7,4 +7,4 @@ import org.bukkit.material.Colorable;
|
|||||||
* @deprecated does not provide useful information beyond the material itself
|
* @deprecated does not provide useful information beyond the material itself
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public interface Bed extends BlockState, Colorable { }
|
public interface Bed extends TileState, Colorable { }
|
||||||
|
|||||||
6
api/src/main/java/org/bukkit/block/Bell.java
Normal file
6
api/src/main/java/org/bukkit/block/Bell.java
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
package org.bukkit.block;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a captured state of Bell.
|
||||||
|
*/
|
||||||
|
public interface Bell extends TileState { }
|
||||||
@@ -1,9 +1,14 @@
|
|||||||
package org.bukkit.block;
|
package org.bukkit.block;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
import org.bukkit.Keyed;
|
||||||
|
import org.bukkit.NamespacedKey;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds all accepted Biomes in the default server
|
* Holds all accepted Biomes in the default server
|
||||||
*/
|
*/
|
||||||
public enum Biome {
|
public enum Biome implements Keyed {
|
||||||
OCEAN,
|
OCEAN,
|
||||||
PLAINS,
|
PLAINS,
|
||||||
DESERT,
|
DESERT,
|
||||||
@@ -76,5 +81,19 @@ public enum Biome {
|
|||||||
SHATTERED_SAVANNA_PLATEAU,
|
SHATTERED_SAVANNA_PLATEAU,
|
||||||
ERODED_BADLANDS,
|
ERODED_BADLANDS,
|
||||||
MODIFIED_WOODED_BADLANDS_PLATEAU,
|
MODIFIED_WOODED_BADLANDS_PLATEAU,
|
||||||
MODIFIED_BADLANDS_PLATEAU
|
MODIFIED_BADLANDS_PLATEAU,
|
||||||
|
BAMBOO_JUNGLE,
|
||||||
|
BAMBOO_JUNGLE_HILLS;
|
||||||
|
|
||||||
|
private final NamespacedKey key;
|
||||||
|
|
||||||
|
private Biome() {
|
||||||
|
this.key = NamespacedKey.minecraft(name().toLowerCase(Locale.ROOT));
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public NamespacedKey getKey() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
6
api/src/main/java/org/bukkit/block/BlastFurnace.java
Normal file
6
api/src/main/java/org/bukkit/block/BlastFurnace.java
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
package org.bukkit.block;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a captured state of a blast furnace.
|
||||||
|
*/
|
||||||
|
public interface BlastFurnace extends Furnace { }
|
||||||
@@ -170,20 +170,16 @@ public interface Block extends Metadatable {
|
|||||||
* The return value can be computed as follows:
|
* The return value can be computed as follows:
|
||||||
* <br>
|
* <br>
|
||||||
* {@code long value = ((long)x & 0x7FFFFFF) | (((long)z & 0x7FFFFFF) << 27) | ((long)y << 54);}
|
* {@code long value = ((long)x & 0x7FFFFFF) | (((long)z & 0x7FFFFFF) << 27) | ((long)y << 54);}
|
||||||
* </br>
|
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* And may be unpacked as follows:
|
* And may be unpacked as follows:
|
||||||
* <br>
|
* <br>
|
||||||
* {@code int x = (int) ((packed << 37) >> 37);}
|
* {@code int x = (int) ((packed << 37) >> 37);}
|
||||||
* </br>
|
|
||||||
* <br>
|
* <br>
|
||||||
* {@code int y = (int) (packed >>> 54);}
|
* {@code int y = (int) (packed >>> 54);}
|
||||||
* </br>
|
|
||||||
* <br>
|
* <br>
|
||||||
* {@code int z = (int) ((packed << 10) >> 37);}
|
* {@code int z = (int) ((packed << 10) >> 37);}
|
||||||
* </br>
|
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @return This block's x, y, and z coordinates packed into a long value
|
* @return This block's x, y, and z coordinates packed into a long value
|
||||||
@@ -532,4 +528,16 @@ public interface Block extends Metadatable {
|
|||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
BoundingBox getBoundingBox();
|
BoundingBox getBoundingBox();
|
||||||
|
|
||||||
|
// Paper start
|
||||||
|
/**
|
||||||
|
* Gets the {@link com.destroystokyo.paper.block.BlockSoundGroup} for this block.
|
||||||
|
* <p>
|
||||||
|
* This object contains the block, step, place, hit, and fall sounds.
|
||||||
|
*
|
||||||
|
* @return the sound group for this block
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
com.destroystokyo.paper.block.BlockSoundGroup getSoundGroup();
|
||||||
|
// Paper end
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
package org.bukkit.block;
|
package org.bukkit.block;
|
||||||
|
|
||||||
import org.bukkit.Nameable;
|
|
||||||
import org.bukkit.inventory.BrewerInventory;
|
import org.bukkit.inventory.BrewerInventory;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a captured state of a brewing stand.
|
* Represents a captured state of a brewing stand.
|
||||||
*/
|
*/
|
||||||
public interface BrewingStand extends Container, Nameable {
|
public interface BrewingStand extends Container {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* How much time is left in the brewing cycle.
|
* How much time is left in the brewing cycle.
|
||||||
|
|||||||
75
api/src/main/java/org/bukkit/block/Campfire.java
Normal file
75
api/src/main/java/org/bukkit/block/Campfire.java
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
package org.bukkit.block;
|
||||||
|
|
||||||
|
import org.bukkit.inventory.Inventory;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a captured state of a campfire.
|
||||||
|
*/
|
||||||
|
public interface Campfire extends TileState {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Inventory#getSize()
|
||||||
|
*
|
||||||
|
* @return The size of the inventory
|
||||||
|
*/
|
||||||
|
int getSize();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Inventory#getItem(int)
|
||||||
|
*
|
||||||
|
* @param index The index of the Slot's ItemStack to return
|
||||||
|
* @return The ItemStack in the slot
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
ItemStack getItem(int index);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Inventory#setItem(int, org.bukkit.inventory.ItemStack)
|
||||||
|
*
|
||||||
|
* @param index The index where to put the ItemStack
|
||||||
|
* @param item The ItemStack to set
|
||||||
|
*/
|
||||||
|
void setItem(int index, @Nullable ItemStack item);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get cook time.
|
||||||
|
*
|
||||||
|
* This is the amount of time the item has been cooking for.
|
||||||
|
*
|
||||||
|
* @param index item slot index
|
||||||
|
* @return Cook time
|
||||||
|
*/
|
||||||
|
int getCookTime(int index);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set cook time.
|
||||||
|
*
|
||||||
|
* This is the amount of time the item has been cooking for.
|
||||||
|
*
|
||||||
|
* @param index item slot index
|
||||||
|
* @param cookTime Cook time
|
||||||
|
*/
|
||||||
|
void setCookTime(int index, int cookTime);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get cook time total.
|
||||||
|
*
|
||||||
|
* This is the amount of time the item is required to cook for.
|
||||||
|
*
|
||||||
|
* @param index item slot index
|
||||||
|
* @return Cook time total
|
||||||
|
*/
|
||||||
|
int getCookTimeTotal(int index);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set cook time.
|
||||||
|
*
|
||||||
|
* This is the amount of time the item is required to cook for.
|
||||||
|
*
|
||||||
|
* @param index item slot index
|
||||||
|
* @param cookTimeTotal Cook time total
|
||||||
|
*/
|
||||||
|
void setCookTimeTotal(int index, int cookTimeTotal);
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package org.bukkit.block;
|
package org.bukkit.block;
|
||||||
|
|
||||||
import com.destroystokyo.paper.loottable.LootableBlockInventory;
|
import com.destroystokyo.paper.loottable.LootableBlockInventory; // Paper
|
||||||
import org.bukkit.Nameable;
|
import org.bukkit.Nameable; // Paper
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.loot.Lootable;
|
import org.bukkit.loot.Lootable;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -9,7 +9,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
/**
|
/**
|
||||||
* Represents a captured state of a chest.
|
* Represents a captured state of a chest.
|
||||||
*/
|
*/
|
||||||
public interface Chest extends Container, Nameable, LootableBlockInventory { // Paper
|
public interface Chest extends Container, LootableBlockInventory { // Paper
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the inventory of the chest block represented by this block state.
|
* Gets the inventory of the chest block represented by this block state.
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
/**
|
/**
|
||||||
* Represents a captured state of a command block.
|
* Represents a captured state of a command block.
|
||||||
*/
|
*/
|
||||||
public interface CommandBlock extends BlockState {
|
public interface CommandBlock extends TileState {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the command that this CommandBlock will run when powered.
|
* Gets the command that this CommandBlock will run when powered.
|
||||||
|
|||||||
@@ -3,4 +3,4 @@ package org.bukkit.block;
|
|||||||
/**
|
/**
|
||||||
* Represents a captured state of an on / off comparator.
|
* Represents a captured state of an on / off comparator.
|
||||||
*/
|
*/
|
||||||
public interface Comparator extends BlockState { }
|
public interface Comparator extends TileState { }
|
||||||
|
|||||||
@@ -3,4 +3,4 @@ package org.bukkit.block;
|
|||||||
/**
|
/**
|
||||||
* Represents a captured state of a conduit.
|
* Represents a captured state of a conduit.
|
||||||
*/
|
*/
|
||||||
public interface Conduit extends BlockState { }
|
public interface Conduit extends TileState { }
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
package org.bukkit.block;
|
package org.bukkit.block;
|
||||||
|
|
||||||
|
import org.bukkit.Nameable;
|
||||||
|
import org.bukkit.inventory.BlockInventoryHolder;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.InventoryHolder;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a captured state of a container block.
|
* Represents a captured state of a container block.
|
||||||
*/
|
*/
|
||||||
public interface Container extends BlockState, InventoryHolder, Lockable {
|
public interface Container extends TileState, BlockInventoryHolder, Lockable, Nameable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the inventory of the block represented by this block state.
|
* Gets the inventory of the block represented by this block state.
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
/**
|
/**
|
||||||
* Represents a captured state of a creature spawner.
|
* Represents a captured state of a creature spawner.
|
||||||
*/
|
*/
|
||||||
public interface CreatureSpawner extends BlockState {
|
public interface CreatureSpawner extends TileState {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the spawner's creature type.
|
* Get the spawner's creature type.
|
||||||
@@ -199,4 +199,18 @@ public interface CreatureSpawner extends BlockState {
|
|||||||
* @param spawnRange the new spawn range
|
* @param spawnRange the new spawn range
|
||||||
*/
|
*/
|
||||||
public void setSpawnRange(int spawnRange);
|
public void setSpawnRange(int spawnRange);
|
||||||
|
|
||||||
|
// Paper start
|
||||||
|
/**
|
||||||
|
* Check if spawner is activated (a player is close enough)
|
||||||
|
*
|
||||||
|
* @return True if a player is close enough to activate it
|
||||||
|
*/
|
||||||
|
public boolean isActivated();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resets the spawn delay timer within the min/max range
|
||||||
|
*/
|
||||||
|
public void resetTimer();
|
||||||
|
// Paper end
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,4 +3,4 @@ package org.bukkit.block;
|
|||||||
/**
|
/**
|
||||||
* Represents a captured state of a (possibly inverted) daylight detector.
|
* Represents a captured state of a (possibly inverted) daylight detector.
|
||||||
*/
|
*/
|
||||||
public interface DaylightDetector extends BlockState { }
|
public interface DaylightDetector extends TileState { }
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ public class DoubleChest implements InventoryHolder {
|
|||||||
inventory = chest;
|
inventory = chest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@NotNull
|
@NotNull
|
||||||
public Inventory getInventory() {
|
public Inventory getInventory() {
|
||||||
return inventory;
|
return inventory;
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
package org.bukkit.block;
|
package org.bukkit.block;
|
||||||
|
|
||||||
import com.destroystokyo.paper.loottable.LootableBlockInventory;
|
import com.destroystokyo.paper.loottable.LootableBlockInventory;
|
||||||
import org.bukkit.Nameable;
|
|
||||||
import org.bukkit.loot.Lootable;
|
import org.bukkit.loot.Lootable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a captured state of a dropper.
|
* Represents a captured state of a dropper.
|
||||||
*/
|
*/
|
||||||
public interface Dropper extends Container, Nameable, LootableBlockInventory { // Paper
|
public interface Dropper extends Container, LootableBlockInventory { // Paper
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tries to drop a randomly selected item from the dropper's inventory,
|
* Tries to drop a randomly selected item from the dropper's inventory,
|
||||||
|
|||||||
@@ -5,4 +5,4 @@ import org.bukkit.Nameable;
|
|||||||
/**
|
/**
|
||||||
* Represents a captured state of an enchanting table.
|
* Represents a captured state of an enchanting table.
|
||||||
*/
|
*/
|
||||||
public interface EnchantingTable extends BlockState, Nameable { }
|
public interface EnchantingTable extends TileState, Nameable { }
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
/**
|
/**
|
||||||
* Represents a captured state of an end gateway.
|
* Represents a captured state of an end gateway.
|
||||||
*/
|
*/
|
||||||
public interface EndGateway extends BlockState {
|
public interface EndGateway extends TileState {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the location that entities are teleported to when
|
* Gets the location that entities are teleported to when
|
||||||
|
|||||||
@@ -3,4 +3,4 @@ package org.bukkit.block;
|
|||||||
/**
|
/**
|
||||||
* Represents a captured state of an ender chest.
|
* Represents a captured state of an ender chest.
|
||||||
*/
|
*/
|
||||||
public interface EnderChest extends BlockState { }
|
public interface EnderChest extends TileState { }
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user