Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
69c163468f | ||
|
|
34421b64f7 | ||
|
|
0edf160f43 | ||
|
|
45d4642086 | ||
|
|
af35a98b1d | ||
|
|
950cf9460b | ||
|
|
1b6d2ec667 | ||
|
|
d7910262be | ||
|
|
8459181f77 | ||
|
|
58f4a76d75 | ||
|
|
a46deeb6ba | ||
|
|
7fd50a0507 | ||
|
|
9e1d5af97d | ||
|
|
4cce566e37 | ||
|
|
703c36f356 | ||
|
|
1dd293c5a4 | ||
|
|
1331b8d0c5 | ||
|
|
2476aa2ea8 | ||
|
|
6045799fea | ||
|
|
342fadd0f6 | ||
|
|
e81c84671c | ||
|
|
e501046073 | ||
|
|
c6a0f20fff | ||
|
|
05aebe7544 | ||
|
|
36ad62007f | ||
|
|
bdde2d36be | ||
|
|
f32a3e7c5e | ||
|
|
c7cf035564 | ||
|
|
d4997cca60 | ||
|
|
355eea1cf9 | ||
|
|
d7b76135c8 | ||
|
|
1a06e6a6bf | ||
|
|
e7a6f21d88 | ||
|
|
5973206bb3 | ||
|
|
1e007c98a4 | ||
|
|
df9b478be7 | ||
|
|
054beb700b | ||
|
|
47a000a57f | ||
|
|
cde18dc529 | ||
|
|
d200616fe1 | ||
|
|
e0d65453b6 | ||
|
|
d414db1c0b | ||
|
|
b0469924a7 | ||
|
|
4e43a42662 | ||
|
|
7e97e12969 | ||
|
|
d7d53bf9e2 | ||
|
|
b9309482cf | ||
|
|
410eba5559 | ||
|
|
814ae4d9d5 | ||
|
|
d64ec8d911 | ||
|
|
5d90f25211 | ||
|
|
7825f61e45 | ||
|
|
7e49c95832 | ||
|
|
4b9e69c40f | ||
|
|
f2934fd876 | ||
|
|
f706bcf38e | ||
|
|
fe6023450c | ||
|
|
ace870b930 | ||
|
|
7170e29452 | ||
|
|
29345e2fb1 | ||
|
|
a22db638fa | ||
|
|
de3c326203 | ||
|
|
acb71a83a2 | ||
|
|
3ffed30b1e | ||
|
|
5d6fd60d40 | ||
|
|
20710a00de | ||
|
|
5eabee6504 | ||
|
|
97eb0d777b | ||
|
|
61847f2f8d | ||
|
|
12f2000085 | ||
|
|
66e32c02bf | ||
|
|
9da1343f7f | ||
|
|
272ecae858 | ||
|
|
3db2159292 | ||
|
|
78ef45d049 | ||
|
|
2f28183261 | ||
|
|
d82f92e06b | ||
|
|
ce5c1c50bf | ||
|
|
026b9ce322 | ||
|
|
3cedc69205 | ||
|
|
f4fe410141 | ||
|
|
e3b82858b4 | ||
|
|
990f90bab9 | ||
|
|
3b349c9d07 | ||
|
|
319d104622 | ||
|
|
9f8c2e8a2f | ||
|
|
fcd789ef5b | ||
|
|
b450f4d05a | ||
|
|
606c043bf0 | ||
|
|
4b056d9474 | ||
|
|
1cca7bc573 | ||
|
|
204456d6c5 | ||
|
|
d34b60dc8f | ||
|
|
070c5139e1 | ||
|
|
1974838f74 | ||
|
|
acdfb3515b | ||
|
|
8cdf99429d | ||
|
|
e848d65b93 | ||
|
|
85ebd53e5f | ||
|
|
209c63b009 | ||
|
|
8fd41ac231 | ||
|
|
703d52bcc7 | ||
|
|
aea0c82fd7 | ||
|
|
01ed2e9f97 | ||
|
|
5861570f8a | ||
|
|
840eb3b4ee | ||
|
|
92e030f3e8 | ||
|
|
d97f5482ee | ||
|
|
2763952dc6 | ||
|
|
3011aece46 | ||
|
|
dedba3c57f |
No files matched your search
+2
-2
@@ -10,7 +10,7 @@ Please note we have a code of conduct, please follow it in all your interactions
|
||||
- For consistency, please only use spaces for indentation.
|
||||
- Use descriptiveCamelCase for variable/method names. Names containing underscore or abbreviations should be changed.
|
||||
- Restrict changes in a commit to a single event or section of code (e.g. refactor BlockBreakEvent and BlockPlaceEvent in separate commits)
|
||||
- Attempt to keep the amount of code modified in a single commit small and readable.
|
||||
- Attempt to keep the amount of code modified in a single pull request small and readable.
|
||||
- Please utilize [SonarLint](https://www.sonarlint.org) in your IDE. Contributions are automatically analyzed.
|
||||
- When adding new functionality, please also be sure to update the documentation as well.
|
||||
- Use common sense. If you have a suggestion for a contribution guideline, post it on Discord.
|
||||
@@ -148,4 +148,4 @@ at [https://www.contributor-covenant.org/translations][translations].
|
||||
[v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html
|
||||
[Mozilla CoC]: https://github.com/mozilla/diversity
|
||||
[FAQ]: https://www.contributor-covenant.org/faq
|
||||
[translations]: https://www.contributor-covenant.org/translations
|
||||
[translations]: https://www.contributor-covenant.org/translations
|
||||
@@ -11,14 +11,14 @@ CoreProtect
|
||||
|
||||
CoreProtect is a blazing fast data logging and anti-griefing tool for Minecraft servers.
|
||||
|
||||
For a detailed description of the plugin, please visit [spigotmc.org/resources/coreprotect.8631](https://www.spigotmc.org/resources/coreprotect.8631/).
|
||||
For a detailed description of the plugin, please visit [coreprotect.net](https://coreprotect.net).
|
||||
|
||||
| Quick Links | |
|
||||
| --- | --- |
|
||||
| CoreProtect Discord: | [discord.gg/b4DZ4jy](https://discord.gg/b4DZ4jy) |
|
||||
| CoreProtect Patreon: | [patreon.com/coreprotect](https://www.patreon.com/coreprotect) |
|
||||
| CoreProtect Documentation: | [docs.coreprotect.net](https://docs.coreprotect.net) |
|
||||
| Downloads for MC 1.14 - 1.18: | [spigotmc.org/resources/coreprotect.8631](https://www.spigotmc.org/resources/coreprotect.8631/) |
|
||||
| Downloads for MC 1.14 - 1.20: | [coreprotect.net/latest](https://coreprotect.net/latest/) |
|
||||
| Downloads for MC 1.8 - 1.12: | [coreprotect.net/legacy](https://coreprotect.net/legacy/) |
|
||||
|
||||
bStats
|
||||
@@ -41,7 +41,7 @@ Maven
|
||||
<dependency>
|
||||
<groupId>net.coreprotect</groupId>
|
||||
<artifactId>coreprotect</artifactId>
|
||||
<version>21.0</version>
|
||||
<version>22.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
+7
-4
@@ -7,7 +7,7 @@ plugins {
|
||||
}
|
||||
|
||||
group = 'net.coreprotect'
|
||||
String projectVersion = '21.1'
|
||||
String projectVersion = '22.1'
|
||||
String projectBranch = ''
|
||||
version = projectVersion // `version` might be modified, we don't always want that (e.g. plugin.yml)
|
||||
description = 'Provides block protection for your server.'
|
||||
@@ -34,9 +34,9 @@ dependencies {
|
||||
compileOnly('com.sk89q.worldedit:worldedit-bukkit:7.0.0-SNAPSHOT') {
|
||||
exclude group: 'org.bukkit'
|
||||
}
|
||||
compileOnly 'io.papermc.paper:paper-api:1.18.1-R0.1-SNAPSHOT'
|
||||
compileOnly 'dev.folia:folia-api:1.20.1-R0.1-SNAPSHOT'
|
||||
implementation 'org.bstats:bstats-bukkit-lite:1.8'
|
||||
implementation 'com.zaxxer:HikariCP:4.0.3'
|
||||
implementation 'com.zaxxer:HikariCP:5.0.1'
|
||||
}
|
||||
|
||||
jar {
|
||||
@@ -52,6 +52,10 @@ shadowJar {
|
||||
// #toString because #getGroup technically returns an Object
|
||||
relocate('org.bstats', project.group.toString())
|
||||
relocate('com.zaxxer', project.group.toString())
|
||||
exclude(dependency('com.google.code.gson:.*'))
|
||||
exclude(dependency('org.intellij:.*'))
|
||||
exclude(dependency('org.jetbrains:.*'))
|
||||
exclude(dependency('org.slf4j:.*'))
|
||||
}
|
||||
archiveClassifier.set(null)
|
||||
}
|
||||
@@ -85,4 +89,3 @@ processResources {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
# Networking API
|
||||
|
||||
The CoreProtect Networking API allows clients to receive data using packets.
|
||||
|
||||
| Networking Details | |
|
||||
|-------------------------|--------|
|
||||
| **Networking Version:** | 1 |
|
||||
| **Plugin Version:** | v21.3+ |
|
||||
|
||||
---
|
||||
|
||||
## Packets
|
||||
|
||||
The server will not respond unless the player has the correct permission, which is `coreprotect.networking`.
|
||||
|
||||
---
|
||||
|
||||
## Server to Client
|
||||
|
||||
### Data Packet
|
||||
Sends data from the database.
|
||||
|
||||
* Channel: `coreprotect:data`
|
||||
|
||||
| Type: `Int` | 1 | 2 | 3 | 4 |
|
||||
|-------------|------------------------|------------------------|--------------------|--------------------|
|
||||
| | Time: `long` | Time: `long` | Time: `long` | Time: `long` |
|
||||
| | Phrase selector: `UTF` | Phrase selector: `UTF` | Result User: `UTF` | Result User: `UTF` |
|
||||
| | Result User: `UTF` | Result User: `UTF` | Message: `UTF` | Target: `UTF` |
|
||||
| | Target: `UTF` | Amount: `Int` | Sign: `Boolean` | |
|
||||
| | Amount: `Int` | X: `Int` | X: `Int` | |
|
||||
| | X: `Int` | Y: `Int` | Y: `Int` | |
|
||||
| | Y: `Int` | Z: `Int` | Z: `Int` | |
|
||||
| | Z: `Int` | World name: `UTF` | World name: `UTF` | |
|
||||
| | World name: `UTF` | | | |
|
||||
| | Rolledback: `Boolean` | | | |
|
||||
| | isContainer: `Boolean` | | | |
|
||||
| | Added: `Boolean` | | | |
|
||||
|
||||
Example (Fabric):
|
||||
```
|
||||
ByteArrayInputStream in = new ByteArrayInputStream(buf.getWrittenBytes());
|
||||
DataInputStream dis = new DataInputStream(in);
|
||||
int type = dis.readInt();
|
||||
long time = dis.readLong();
|
||||
String selector = dis.readUTF();
|
||||
String resultUser = dis.readUTF();
|
||||
String target = dis.readUTF();
|
||||
int amount = dis.readInt();
|
||||
int x = dis.readInt();
|
||||
int y = dis.readInt();
|
||||
int z = dis.readInt();
|
||||
String worldName = dis.readUTF();
|
||||
boolean rolledback = dis.readBoolean();
|
||||
boolean isContainer = dis.readBoolean();
|
||||
boolean added = dis.readBoolean();
|
||||
```
|
||||
|
||||
### Handshake Packet
|
||||
Sends handshake if player is registered.
|
||||
|
||||
* Channel: `coreprotect:handshake`
|
||||
* Registered: `Boolean`
|
||||
|
||||
---
|
||||
|
||||
## Client to Server
|
||||
|
||||
### Handshake Packet
|
||||
Sends handshake to register
|
||||
|
||||
* Channel: `coreprotect:handshake`
|
||||
* Mod Version: `UTF`
|
||||
* Mod Id: `UTF`
|
||||
* CoreProtect Protocol: `Int`
|
||||
|
||||
Example (Fabric):
|
||||
```
|
||||
PacketByteBuf packetByteBuf = new PacketByteBuf(Unpooled.buffer());
|
||||
ByteArrayOutputStream msgBytes = new ByteArrayOutputStream();
|
||||
DataOutputStream msgOut = new DataOutputStream(msgBytes);
|
||||
msgOut.writeUTF(modVersion);
|
||||
msgOut.writeUTF(modId);
|
||||
msgOut.writeInt(coreprotectProtocol);
|
||||
packetByteBuf.writeBytes(msgBytes.toByteArray());
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Debugging
|
||||
|
||||
### /co network-debug
|
||||
Allows you to debug the networking API if you are registered and have correct permissions.
|
||||
To utilize the command, `network-debug: true` must be set in the CoreProtect `config.yml`.
|
||||
|
||||
**Example**
|
||||
`/co network-debug <type>`
|
||||
|
||||
___
|
||||
@@ -203,7 +203,7 @@ This will parse results from a lookup. You'll then be able to view the following
|
||||
* **getZ():** Get the Z coordinate of the block.
|
||||
* **getType():** Get the Material of the block.
|
||||
* **getBlockData():** Get the BlockData of the block.
|
||||
* **getPlayer():** Get the username as a string..
|
||||
* **getPlayer():** Get the username as a string.
|
||||
* **getTimestamp():** Get the time of the action.
|
||||
* **getActionId():** Get the action ID. (0=removed, 1=placed, 2=interaction)
|
||||
* **getActionString():** Get the action as a string. (Removal, Placement, Interaction)
|
||||
@@ -296,7 +296,7 @@ if (CoreProtect!=null){ //Ensure we have access to the API
|
||||
int x = parseResult.getX();
|
||||
int y = parseResult.getY();
|
||||
int z = parseResult.getZ();
|
||||
//...
|
||||
// ...
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -316,7 +316,7 @@ if (CoreProtect!=null){ //Ensure we have access to the API
|
||||
int x = result.getX();
|
||||
int y = result.getY();
|
||||
int z = result.getZ();
|
||||
//...
|
||||
// ...
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -335,7 +335,7 @@ if (CoreProtect!=null){ //Ensure we have access to the API
|
||||
int x = result.getX();
|
||||
int y = result.getY();
|
||||
int z = result.getZ();
|
||||
//...
|
||||
// ...
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -358,7 +358,7 @@ public void run() {
|
||||
int x = result.getX();
|
||||
int y = result.getY();
|
||||
int z = result.getZ();
|
||||
//...
|
||||
// ...
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -392,11 +392,11 @@ if (CoreProtect!=null){ //Ensure we have access to the API
|
||||
List<String[]> lookup = CoreProtect.blockLookup(block, 60);
|
||||
if (lookup!=null){
|
||||
for (String[] result : lookup){
|
||||
ParseResult parseResult = CoreProtect.parseResult(value);
|
||||
ParseResult parseResult = CoreProtect.parseResult(result);
|
||||
int x = parseResult.getX();
|
||||
int y = parseResult.getY();
|
||||
int z = parseResult.getZ();
|
||||
//...
|
||||
// ...
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ This will parse results from a lookup. You'll then be able to view the following
|
||||
* **getZ():** Get the Z coordinate of the block.
|
||||
* **getType():** Get the Material of the block.
|
||||
* **getBlockData():** Get the BlockData of the block.
|
||||
* **getPlayer():** Get the username as a string..
|
||||
* **getPlayer():** Get the username as a string.
|
||||
* **getTimestamp():** Get the time of the action.
|
||||
* **getActionId():** Get the action ID. (0=removed, 1=placed, 2=interaction)
|
||||
* **getActionString():** Get the action as a string. (Removal, Placement, Interaction)
|
||||
@@ -296,7 +296,7 @@ if (CoreProtect!=null){ //Ensure we have access to the API
|
||||
int x = parseResult.getX();
|
||||
int y = parseResult.getY();
|
||||
int z = parseResult.getZ();
|
||||
//...
|
||||
// ...
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -316,7 +316,7 @@ if (CoreProtect!=null){ //Ensure we have access to the API
|
||||
int x = result.getX();
|
||||
int y = result.getY();
|
||||
int z = result.getZ();
|
||||
//...
|
||||
// ...
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -335,7 +335,7 @@ if (CoreProtect!=null){ //Ensure we have access to the API
|
||||
int x = result.getX();
|
||||
int y = result.getY();
|
||||
int z = result.getZ();
|
||||
//...
|
||||
// ...
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -358,7 +358,7 @@ public void run() {
|
||||
int x = result.getX();
|
||||
int y = result.getY();
|
||||
int z = result.getZ();
|
||||
//...
|
||||
// ...
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -392,11 +392,11 @@ if (CoreProtect!=null){ //Ensure we have access to the API
|
||||
List<String[]> lookup = CoreProtect.blockLookup(block, 60);
|
||||
if (lookup!=null){
|
||||
for (String[] result : lookup){
|
||||
ParseResult parseResult = CoreProtect.parseResult(value);
|
||||
ParseResult parseResult = CoreProtect.parseResult(result);
|
||||
int x = parseResult.getX();
|
||||
int y = parseResult.getY();
|
||||
int z = parseResult.getZ();
|
||||
//...
|
||||
// ...
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+14
-11
@@ -89,6 +89,8 @@ List<String[]> blockLookup(Block block, int time)
|
||||
|
||||
List<String[]> sessionLookup(String user, int time)
|
||||
|
||||
List<String[]> queueLookup(Block block)
|
||||
|
||||
ParseResult parseResult(String[] result)
|
||||
|
||||
boolean logChat(Player player, String message)
|
||||
@@ -118,11 +120,12 @@ void performPurge(int time)
|
||||
|
||||
#### CoreProtectPreLogEvent
|
||||
|
||||
Fired when a CoreProtect logger is about to log an action. Not cancellable.
|
||||
Fired when a CoreProtect logger is about to log an action. Cancellable.
|
||||
|
||||
| Property | Description | Mutable |
|
||||
| --- | --- | --- |
|
||||
| User | The name of the user under which this action will be logged. | Yes |
|
||||
| Cancelled | If cancelled, the action won't be logged to the database. | Yes |
|
||||
|
||||
---
|
||||
|
||||
@@ -222,7 +225,7 @@ This will parse results from a lookup. You'll then be able to view the following
|
||||
* **getZ():** Get the Z coordinate of the block.
|
||||
* **getType():** Get the Material of the block.
|
||||
* **getBlockData():** Get the BlockData of the block.
|
||||
* **getPlayer():** Get the username as a string..
|
||||
* **getPlayer():** Get the username as a string.
|
||||
* **getTimestamp():** Get the time of the action.
|
||||
* **getActionId():** Get the action ID. (0=removed, 1=placed, 2=interaction)
|
||||
* **getActionString():** Get the action as a string. (Removal, Placement, Interaction)
|
||||
@@ -315,7 +318,7 @@ if (CoreProtect != null){ // Ensure we have access to the API
|
||||
int x = parseResult.getX();
|
||||
int y = parseResult.getY();
|
||||
int z = parseResult.getZ();
|
||||
//...
|
||||
// ...
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -335,7 +338,7 @@ if (CoreProtect != null){ // Ensure we have access to the API
|
||||
int x = result.getX();
|
||||
int y = result.getY();
|
||||
int z = result.getZ();
|
||||
//...
|
||||
// ...
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -354,7 +357,7 @@ if (CoreProtect != null){ // Ensure we have access to the API
|
||||
int x = result.getX();
|
||||
int y = result.getY();
|
||||
int z = result.getZ();
|
||||
//...
|
||||
// ...
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -377,7 +380,7 @@ public void run() {
|
||||
int x = result.getX();
|
||||
int y = result.getY();
|
||||
int z = result.getZ();
|
||||
//...
|
||||
// ...
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -404,7 +407,7 @@ if (CoreProtect != null){ // Ensure we have access to the API
|
||||
if (!hasPlaced){
|
||||
List<String[]> lookup = CoreProtect.queueLookup(block);
|
||||
for (String[] result : lookup){
|
||||
ParseResult parseResult = CoreProtect.parseResult(value);
|
||||
ParseResult parseResult = CoreProtect.parseResult(result);
|
||||
if (parseResult.getActionId()==1 && parseResult.getPlayer().equals("Notch")){
|
||||
hasPlaced = true;
|
||||
break;
|
||||
@@ -423,11 +426,11 @@ if (CoreProtect != null){ // Ensure we have access to the API
|
||||
List<String[]> lookup = CoreProtect.blockLookup(block, 60);
|
||||
if (lookup != null){
|
||||
for (String[] result : lookup){
|
||||
ParseResult parseResult = CoreProtect.parseResult(value);
|
||||
ParseResult parseResult = CoreProtect.parseResult(result);
|
||||
int x = parseResult.getX();
|
||||
int y = parseResult.getY();
|
||||
int z = parseResult.getZ();
|
||||
//...
|
||||
// ...
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -442,12 +445,12 @@ if (CoreProtect != null){ // Ensure we have access to the API
|
||||
List<String[]> lookup = CoreProtect.sessionLookup("Notch", (24 * 60 * 60));
|
||||
if (lookup != null){
|
||||
for (String[] result : lookup){
|
||||
ParseResult parseResult = CoreProtect.parseResult(value);
|
||||
ParseResult parseResult = CoreProtect.parseResult(result);
|
||||
int x = parseResult.getX();
|
||||
int y = parseResult.getY();
|
||||
int z = parseResult.getZ();
|
||||
int action = parseResult.getActionId(); // 0 = logout, 1 = login
|
||||
//...
|
||||
// ...
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+7
-1
@@ -15,6 +15,7 @@ ___
|
||||
| [/co purge](#co-purge) | Delete old block data |
|
||||
| [/co reload](#co-reload) | Reload the configuration file |
|
||||
| [/co status](#co-status) | View the plugin status |
|
||||
| [/co consumer](#co-consumer) | Toggle consumer processing |
|
||||
|
||||
### Alias Commands
|
||||
|
||||
@@ -119,6 +120,10 @@ ___
|
||||
Displays the plugin status and version information.
|
||||
___
|
||||
|
||||
### /co consumer
|
||||
Console command to pause or resume consumer queue processing.
|
||||
___
|
||||
|
||||
|
||||
## Parameter Details
|
||||
|
||||
@@ -128,6 +133,7 @@ ___
|
||||
|
||||
* Example: `u:Notch`
|
||||
* Example: `u:Notch,Intelli`
|
||||
* Example: `u:#fire,#tnt,#creeper,#explosion`
|
||||
|
||||
---
|
||||
|
||||
@@ -271,4 +277,4 @@ Lookup commands are generally the same as rollback commands. The primary differe
|
||||
* `/co lookup u:Notch a:username`
|
||||
*(lookup previous usernames used by Notch)*
|
||||
|
||||
___
|
||||
___
|
||||
+2
-1
@@ -24,8 +24,9 @@ To disable logging for specific users or commands, simply do the following:
|
||||
2. Enter the names of the users (or commands) you'd like to disable logging for (each username on a new line).
|
||||
3. Either restart your server, or type "/co reload" in-game.
|
||||
|
||||
This can be used to disable logging for non-player users, such as "#tnt". For example, if you'd like to disable logging for the user "Notch" and for TNT explosions, the blacklist.txt file would look like this:
|
||||
This can be used to disable logging for non-player users, such as "#tnt". For example, if you'd like to disable logging for the user "Notch", TNT explosions, and the "/help" command, the blacklist.txt file would look like this:
|
||||
```text
|
||||
Notch
|
||||
#tnt
|
||||
/help
|
||||
```
|
||||
@@ -12,6 +12,9 @@ A list of all commands that can be used within CoreProtect.
|
||||
[**CoreProtect Permissions**](/permissions/)
|
||||
A list of all permissions that can be used with CoreProtect.
|
||||
|
||||
[**CoreProtect Language Codes**](/languages/)
|
||||
A list of all language codes that can be used with CoreProtect.
|
||||
|
||||
[**CoreProtect API Documentation**](/api/)
|
||||
Log your own block changes, perform lookups, rollbacks, restores, and more.
|
||||
|
||||
|
||||
@@ -35,6 +35,12 @@ The following permissions can be used to restrict functionality within the plugi
|
||||
|
||||
* **coreprotect.status** *(default: op)*
|
||||
Allows access to the CoreProtect status command.
|
||||
|
||||
* **coreprotect.consumer** *(default: op)*
|
||||
Allows access to the CoreProtect consumer command.
|
||||
|
||||
* **coreprotect.networking** *(default: op)*
|
||||
Allows access to the CoreProtect networking API.
|
||||
|
||||
---
|
||||
|
||||
@@ -58,6 +64,9 @@ The following permissions can be used to restrict functionality within the plugi
|
||||
* **coreprotect.lookup.inventory** *(default: op)*
|
||||
Can be optionally used as a negative permission to prevent inventory lookups.
|
||||
|
||||
* **coreprotect.lookup.item** *(default: op)*
|
||||
Can be optionally used as a negative permission to prevent item lookups.
|
||||
|
||||
* **coreprotect.lookup.kill** *(default: op)*
|
||||
Can be optionally used as a negative permission to prevent entity kill lookups.
|
||||
|
||||
|
||||
+2
-2
@@ -104,7 +104,7 @@ LINK_WIKI_BLOCK: "Blocknamen: {0}"
|
||||
LINK_WIKI_ENTITY: "Entitätsnamen: {0}"
|
||||
LOGGING_ITEMS: "{0} Elemente, die noch zu loggen sind. Warten Sie mal..."
|
||||
LOGGING_TIME_LIMIT: "Zeitlimit für die Protokollierung erreicht. Daten verwerfen und herunterfahren."
|
||||
LOOKUP_BLOCK: "{0} {platziert|kaputt} {1}."
|
||||
LOOKUP_BLOCK: "{0} {platziert|entfernt} {1}."
|
||||
LOOKUP_CONTAINER: "{0} {hinzugefügt|entfernt} {1} {2}."
|
||||
LOOKUP_HEADER: "{0} Ergebnisse"
|
||||
LOOKUP_INTERACTION: "{0} {angeklickt|getötet} {1}."
|
||||
@@ -198,4 +198,4 @@ USING_SQLITE: "Verwenden von SQLite zur Datenspeicherung."
|
||||
VALID_DONATION_KEY: "Gültiger Spendenschlüssel."
|
||||
VERSION_NOTICE: "Ausführung {0} ist nun verfügbar."
|
||||
VERSION_REQUIRED: "{0} {1} oder höher erforderlich."
|
||||
WORLD_NOT_FOUND: "Welt \"{0}\" nicht gefunden."
|
||||
WORLD_NOT_FOUND: "Welt \"{0}\" nicht gefunden."
|
||||
@@ -125,6 +125,8 @@ MISSING_PARAMETERS: "Please use \"{0}\"."
|
||||
MISSING_ROLLBACK_RADIUS: "You did not specify a {rollback|restore} radius."
|
||||
MISSING_ROLLBACK_USER: "You did not specify a {rollback|restore} user."
|
||||
MYSQL_UNAVAILABLE: "Unable to connect to MySQL server."
|
||||
NETWORK_CONNECTION: "Connection by {0} {successful|failed}. Using {1} {2}."
|
||||
NETWORK_TEST: "Network test data has been successful sent."
|
||||
NO_DATA: "No data found at {0}."
|
||||
NO_DATA_LOCATION: "No {data|transactions|interactions|messages} found at this location."
|
||||
NO_PERMISSION: "You do not have permission to do that."
|
||||
|
||||
+166
-166
@@ -1,201 +1,201 @@
|
||||
# CoreProtect Language File (es)
|
||||
|
||||
ACTION_NOT_SUPPORTED: "Esa acción no es compatible."
|
||||
ACTION_NOT_SUPPORTED: "Está acción no es compatible con el comando."
|
||||
AMOUNT_BLOCK: "{0} {bloque|bloques}"
|
||||
AMOUNT_CHUNK: "{0} {trozo|trozos}"
|
||||
AMOUNT_CHUNK: "{0} {chunk|chunks}"
|
||||
AMOUNT_ENTITY: "{0} {entidad|entidades}"
|
||||
AMOUNT_ITEM: "{0} {artículo|artículos}"
|
||||
API_TEST: "Prueba de API exitosa."
|
||||
CACHE_ERROR: "ADVERTENCIA: Error al validar {0} cache."
|
||||
CACHE_RELOAD: "Forzando la recarga de {mapeo|mundo} cachés de la base de datos."
|
||||
CHECK_CONFIG: "Por favor revise config.yml"
|
||||
COMMAND_CONSOLE: "Ejecute el comando desde la consola."
|
||||
COMMAND_NOT_FOUND: "Comando \"{0}\" extraviado."
|
||||
COMMAND_THROTTLED: "Espere un momento y vuelva a intentarlo."
|
||||
CONSUMER_ERROR: "Procesamiento de colas de consumidores ya {en pausa|reanudado}."
|
||||
CONSUMER_TOGGLED: "El procesamiento de la cola del consumidor ha sido {en pausa|reanudado}."
|
||||
CONTAINER_HEADER: "Transacciones de contenedores"
|
||||
DATABASE_BUSY: "Base de datos ocupado. Por favor, inténtelo de nuevo más tarde."
|
||||
DATABASE_INDEX_ERROR: "No se pueden validar los índices de la base de datos."
|
||||
DATABASE_LOCKED_1: "Base de datos bloqueada. Esperando hasta 15 segundos..."
|
||||
DATABASE_LOCKED_2: "La base de datos ya está en uso. Inténtalo de nuevo."
|
||||
DATABASE_LOCKED_3: "Para deshabilitar el bloqueo de la base de datos, establezca \"database-lock: false\"."
|
||||
DATABASE_LOCKED_4: "La desactivación del bloqueo de la base de datos puede provocar daños en los datos."
|
||||
DATABASE_UNREACHABLE: "La base de datos es inalcanzable. Descartando datos y cerrando."
|
||||
DEVELOPMENT_BRANCH: "Se detectó una rama de desarrollo, omitiendo los scripts de parches."
|
||||
DIRT_BLOCK: "Colocó un bloque de tierra debajo de usted."
|
||||
DISABLE_SUCCESS: "¡Éxito! Discapacitado {0}"
|
||||
ENABLE_FAILED: "{0} fue incapaz de comenzar."
|
||||
ENABLE_SUCCESS: "{0} ahora está habilitado!"
|
||||
ENJOY_COREPROTECT: "Disfrutar {0}? Únete a nuestro Discord!"
|
||||
FINISHING_CONVERSION: "Terminando la conversión de datos. Espere por favor..."
|
||||
FINISHING_LOGGING: "Terminando el registro de datos. Espere por favor..."
|
||||
FIRST_VERSION: "DB inicial: {0}"
|
||||
GLOBAL_LOOKUP: "No especifique un radio para realizar una búsqueda global."
|
||||
GLOBAL_ROLLBACK: "Usar \"{0}\" para hacer un global {deshacer|restaurar}"
|
||||
HELP_ACTION_1: "Restrinja la búsqueda a una acción."
|
||||
AMOUNT_ITEM: "{0} {objeto|objetos}"
|
||||
API_TEST: "Testeo de la API exitosa."
|
||||
CACHE_ERROR: "ADVERTENCIA: Error mientras se validaba el caché {0}."
|
||||
CACHE_RELOAD: "Forzando recarga de cachés desde la base de datos de {mapeado|mundo}."
|
||||
CHECK_CONFIG: "Por favor revise su config.yml"
|
||||
COMMAND_CONSOLE: "Intente ejecutar el comando desde la consola."
|
||||
COMMAND_NOT_FOUND: "Comando \"{0}\" no encontrado."
|
||||
COMMAND_THROTTLED: "Espere un momento e intente nuevamente."
|
||||
CONSUMER_ERROR: "La espera en el procesamiento del consumidor ha sido {pausada|continuada}."
|
||||
CONSUMER_TOGGLED: "Consumer queue processing has been {pausado|continuado}."
|
||||
CONTAINER_HEADER: "Transacciones del contenedor"
|
||||
DATABASE_BUSY: "Base de datos ocupada. Intente más tarde."
|
||||
DATABASE_INDEX_ERROR: "Imposible validar los indices de la base de datos."
|
||||
DATABASE_LOCKED_1: "Base de datos bloqueada. Espere en los siguientes 15 segundos..."
|
||||
DATABASE_LOCKED_2: "Base de datos ya en uso. Intente nuevamente."
|
||||
DATABASE_LOCKED_3: "Para desactivar el bloqueo de la base de datos, coloque \"database-lock: false\"."
|
||||
DATABASE_LOCKED_4: "Desactivando el bloqueo en la base de datos resultaría en una posible corrupción de datos."
|
||||
DATABASE_UNREACHABLE: "No se pudo alcanzar la base de datos. Descartando datos y apagando."
|
||||
DEVELOPMENT_BRANCH: "Rama de desarrollo detectada, saltando scripts de parche."
|
||||
DIRT_BLOCK: "Se ha colocado un bloque de tierra debajo de tí."
|
||||
DISABLE_SUCCESS: "¡Se ha desactivado exitosamente {0}!"
|
||||
ENABLE_FAILED: "Imposible de iniciar {0}."
|
||||
ENABLE_SUCCESS: "¡{0} ha sido exitosamente activado!"
|
||||
ENJOY_COREPROTECT: "¿Disfrutando {0}? ¡Ingrese a nuestro Discord!"
|
||||
FINISHING_CONVERSION: "Terminando la conversión de datos. Espere..."
|
||||
FINISHING_LOGGING: "Terminando el registro de datos. Espere..."
|
||||
FIRST_VERSION: "Base de datos inicial: {0}"
|
||||
GLOBAL_LOOKUP: "No especificaste el radio para una busqueda global."
|
||||
GLOBAL_ROLLBACK: "Usa \"{0}\" para hacer un {respaldo|restauración} global"
|
||||
HELP_ACTION_1: "Restringir la busqueda a una acción."
|
||||
HELP_ACTION_2: "Ejemplos: [a:block], [a:+block], [a:-block] [a:click], [a:container], [a:inventory], [a:item], [a:kill], [a:chat], [a:command], [a:sign], [a:session], [a:username]"
|
||||
HELP_COMMAND: "Muestra información adicional."
|
||||
HELP_EXCLUDE_1: "Excluir bloques / usuarios."
|
||||
HELP_COMMAND: "Mostrar información sobre un comando."
|
||||
HELP_EXCLUDE_1: "Excluir bloques/usuarios."
|
||||
HELP_EXCLUDE_2: "Ejemplos: [e:stone], [e:Notch], [e:stone,Notch]"
|
||||
HELP_HEADER: "{0} Ayudar"
|
||||
HELP_INCLUDE_1: "Incluya bloques / entidades."
|
||||
HELP_HEADER: "Ayuda {0}"
|
||||
HELP_INCLUDE_1: "Incluir bloques/entidades exactos."
|
||||
HELP_INCLUDE_2: "Ejemplos: [i:stone], [i:zombie], [i:stone,wood,bedrock]"
|
||||
HELP_INSPECT_1: "Con el inspector habilitado, puede:"
|
||||
HELP_INSPECT_2: "Haga clic con el botón izquierdo para ver la ubicación."
|
||||
HELP_INSPECT_3: "Haga clic derecho para ver las eliminaciones adyacentes."
|
||||
HELP_INSPECT_4: "Coloque un bloque para ver la eliminación."
|
||||
HELP_INSPECT_5: "Coloque un bloque en líquido para ver la ubicación."
|
||||
HELP_INSPECT_6: "Haga clic derecho para ver las transacciones del cofre."
|
||||
HELP_INSPECT_7: "Sugerencia: puede usar solo \"/co i\"."
|
||||
HELP_INSPECT_COMMAND: "Alterna el inspector de bloques."
|
||||
HELP_INSPECT_1: "Con el inspeccionador activo, puedes hacer lo siguiente:"
|
||||
HELP_INSPECT_2: "Clic izquierdo para ver quien colocó ese bloque."
|
||||
HELP_INSPECT_3: "Clic derecho para ver quien rompió el bloque de encima."
|
||||
HELP_INSPECT_4: "Coloca un bloque para ver si se ha roto alguno en la zona."
|
||||
HELP_INSPECT_5: "Coloca el bloque en un liquido (etc) para ver quien lo colocó."
|
||||
HELP_INSPECT_6: "Clic derecho sobre un cofres y ver sus transacciones."
|
||||
HELP_INSPECT_7: "Consejo: Puedes usar \"/co i\" para un acceso rápido."
|
||||
HELP_INSPECT_COMMAND: "Alterna el revisor de bloques."
|
||||
HELP_LIST: "Muestra una lista de todos los comandos."
|
||||
HELP_LOOKUP_1: "Atajo de comando."
|
||||
HELP_LOOKUP_2: "Ver páginas adicionales."
|
||||
HELP_LOOKUP_COMMAND: "Búsqueda de datos de bloques."
|
||||
HELP_NO_INFO: "Información para el mando \"{0}\" extraviado."
|
||||
HELP_PARAMETER: "Por favor mira \"{0}\" para obtener información detallada sobre los parámetros."
|
||||
HELP_PARAMS_1: "Realizar el {buscar|deshacer|restaurar}."
|
||||
HELP_PARAMS_2: "Especifique los usuarios para {buscar|deshacer|restaurar}."
|
||||
HELP_PARAMS_3: "Especifique el tiempo para {buscar|deshacer|restaurar}."
|
||||
HELP_PARAMS_4: "Restringir el {buscar|deshacer|restaurar} a un radio."
|
||||
HELP_PARAMS_5: "Restringir el {buscar|deshacer|restaurar} a una acción."
|
||||
HELP_PARAMS_6: "Incluir bloques / entidades en el {buscar|deshacer|restaurar}."
|
||||
HELP_PARAMS_7: "Excluir bloques / usuarios del {buscar|deshacer|restaurar}."
|
||||
HELP_PURGE_1: "Eliminar datos antiguos."
|
||||
HELP_PURGE_2: "Por ejemplo, \"{0}\" eliminará todos los datos anteriores a un mes y solo conservará los datos de los últimos 30 días."
|
||||
HELP_PURGE_COMMAND: "Elimina los datos del bloque antiguo."
|
||||
HELP_RADIUS_1: "Especifique un área de radio."
|
||||
HELP_RADIUS_2: "Ejemplos: [r:10] (Solo haga cambios dentro de las 10 cuadras de usted)"
|
||||
HELP_RELOAD_COMMAND: "Vuelve a cargar el archivo de configuración."
|
||||
HELP_RESTORE_COMMAND: "Restaurar los datos del bloque."
|
||||
HELP_ROLLBACK_COMMAND: "Revertir los datos del bloque."
|
||||
HELP_STATUS: "Ver el estado del complemento."
|
||||
HELP_STATUS_COMMAND: "Muestra el estado del complemento."
|
||||
HELP_TELEPORT: "Teletransportarse."
|
||||
HELP_TIME_1: "Especifique la hora."
|
||||
HELP_LOOKUP_1: "Atajo de comandos."
|
||||
HELP_LOOKUP_2: "Mostrar páginas adicionales."
|
||||
HELP_LOOKUP_COMMAND: "Busqueda de bloques avanzada."
|
||||
HELP_NO_INFO: "Información para el comando \"{0}\" no encontrada."
|
||||
HELP_PARAMETER: "Revisa \"{0}\" para una información más detallada."
|
||||
HELP_PARAMS_1: "Ingrese la {búsqueda|respaldo|restauración}."
|
||||
HELP_PARAMS_2: "Especifique al usuario a {buscar|respaldar|restaurar}."
|
||||
HELP_PARAMS_3: "Especifique la cantidad de tiempo a {buscar|respaldar|restaurar}."
|
||||
HELP_PARAMS_4: "Especifique el radio de area a {buscar|respaldar|restaurar}."
|
||||
HELP_PARAMS_5: "Restringir la {búsqueda|respaldo|restauración} a una acción dada."
|
||||
HELP_PARAMS_6: "Incluir bloques/entidades exactas a {buscar|respaldar|restaurar}."
|
||||
HELP_PARAMS_7: "Excluir bloques/usuarios a {buscar|respaldar|resturar}."
|
||||
HELP_PURGE_1: "Eliminar los datos en un tiempo dado."
|
||||
HELP_PURGE_2: "Por ejemplo, \"{0}\" eliminará los datos que sean más viejos, y solo mantendrá lo que está en los 30d."
|
||||
HELP_PURGE_COMMAND: "Elimina los datos de bloques viejos."
|
||||
HELP_RADIUS_1: "Especifica un radio del area."
|
||||
HELP_RADIUS_2: "Ejemplos: [r:10] (Solo cambiará 10 bloques delante de ti)"
|
||||
HELP_RELOAD_COMMAND: "Recarga los archivos de configuración."
|
||||
HELP_RESTORE_COMMAND: "Restaurar los datos de bloques."
|
||||
HELP_ROLLBACK_COMMAND: "Restaurar bloques."
|
||||
HELP_STATUS: "Muestra el estado del plugin y su información."
|
||||
HELP_STATUS_COMMAND: "Muestra el estado del plugin."
|
||||
HELP_TELEPORT: "Teletransportar a una coordenada."
|
||||
HELP_TIME_1: "Especifique una cantidad de tiempo."
|
||||
HELP_TIME_2: "Ejemplos: [t:2w,5d,7h,2m,10s], [t:5d2h], [t:2.50h]"
|
||||
HELP_USER_1: "Especifique los usuarios."
|
||||
HELP_USER_1: "Especifica al usuario para buscar."
|
||||
HELP_USER_2: "Ejemplos: [u:Notch], [u:Notch,#enderman]"
|
||||
INCOMPATIBLE_ACTION: "\"{0}\" no se puede utilizar con esa acción."
|
||||
INSPECTOR_ERROR: "Inspector ya {habilitado|deshabilitado}."
|
||||
INSPECTOR_TOGGLED: "Inspector ahora {habilitado|deshabilitado}."
|
||||
INTEGRATION_ERROR: "Incapaz de {inicializar|deshabilitar} {0} Inicio sesión."
|
||||
INTEGRATION_SUCCESS: "{0} registrando exitosamente {inicializado|deshabilitado}."
|
||||
INTEGRATION_VERSION: "Inválido {0} versión encontrada."
|
||||
INCOMPATIBLE_ACTION: "\"{0}\" no puede ser usado para esta acción."
|
||||
INSPECTOR_ERROR: "Inspeccionador ya {activado|desactivado}."
|
||||
INSPECTOR_TOGGLED: "Inspeccionador {activado|desactivado}."
|
||||
INTEGRATION_ERROR: "Imposible {inicializar|desactivar} los registros {0}."
|
||||
INTEGRATION_SUCCESS: "Registros en {0} han sido correctamente {inicializados|desactivados}."
|
||||
INTEGRATION_VERSION: "Versión inválida {0} encontrada."
|
||||
INTERACTIONS_HEADER: "Interacciones del jugador"
|
||||
INVALID_ACTION: "Esa no es una acción válida."
|
||||
INVALID_BRANCH_1: "Versión de complemento no válida (la rama no se ha configurado)."
|
||||
INVALID_BRANCH_2: "Para continuar, establezca la rama del proyecto en \"desarrollo\"."
|
||||
INVALID_BRANCH_3: "La ejecución de código de desarrollo puede provocar daños en los datos."
|
||||
INVALID_CONTAINER: "Primero inspeccione un contenedor válido."
|
||||
INVALID_DONATION_KEY: "Clave de donación no válida."
|
||||
INVALID_INCLUDE: "\"{0}\" es un valor no válido."
|
||||
INVALID_INCLUDE_COMBO: "Esa es una combinación de tipos no válida."
|
||||
INVALID_RADIUS: "Ingrese un radio válido."
|
||||
INVALID_SELECTION: "{0} selección no encontrada."
|
||||
INVALID_USERNAME: "\"{0}\" es un nombre de usuario no válido."
|
||||
INVALID_ACTION: "No es una acción válida."
|
||||
INVALID_BRANCH_1: "Versión del plugin inválida (la rama no ha sido definida)."
|
||||
INVALID_BRANCH_2: "Para continuar, coloque la rama del proyecto a \"development\"."
|
||||
INVALID_BRANCH_3: "Ejecutar códigos en desarrollo puede resultar en una corrupción de datos."
|
||||
INVALID_CONTAINER: "Intente inspeccionar un contenedor válido primero."
|
||||
INVALID_DONATION_KEY: "Clave de donación inválida."
|
||||
INVALID_INCLUDE: "\"{0}\" es un bloque inválido/ o nombre de entidad."
|
||||
INVALID_INCLUDE_COMBO: "Es una combinación inválida de bloque/entidad."
|
||||
INVALID_RADIUS: "Coloque un radio válido."
|
||||
INVALID_SELECTION: "{0} sección no encontrada."
|
||||
INVALID_USERNAME: "\"{0}\" no es usuario existente."
|
||||
INVALID_WORLD: "Especifique un mundo válido."
|
||||
LATEST_VERSION: "Última versión: {0}"
|
||||
LINK_DISCORD: "Discord: {0}"
|
||||
LINK_DOWNLOAD: "Descargar: {0}"
|
||||
LINK_DOWNLOAD: "Descarga: {0}"
|
||||
LINK_PATREON: "Patreon: {0}"
|
||||
LINK_WIKI_BLOCK: "Nombres de bloque: {0}"
|
||||
LINK_WIKI_BLOCK: "Nombres de bloques: {0}"
|
||||
LINK_WIKI_ENTITY: "Nombres de entidades: {0}"
|
||||
LOGGING_ITEMS: "{0} elementos que quedan por registrar. Espere por favor..."
|
||||
LOGGING_TIME_LIMIT: "Se alcanzó el límite de tiempo de registro. Descartando datos y cerrando."
|
||||
LOOKUP_BLOCK: "{0} {colocado|roto} {1}."
|
||||
LOOKUP_CONTAINER: "{0} {añadido|eliminado} {1} {2}."
|
||||
LOGGING_ITEMS: "{0} objetos restantes por registrar. Espere un momento..."
|
||||
LOGGING_TIME_LIMIT: "Limite de tiempo de registros. Descartamdo pérdida de información."
|
||||
LOOKUP_BLOCK: "{0} {colocó|rompió} {1}."
|
||||
LOOKUP_CONTAINER: "{0} {agregó|removió} {1} {2}."
|
||||
LOOKUP_HEADER: "{0} Resultados"
|
||||
LOOKUP_INTERACTION: "{0} {clickeado|muerto} {1}."
|
||||
LOOKUP_ITEM: "{0} {recogido|caído} {1} {2}."
|
||||
LOOKUP_LOGIN: "{0} registrado {adentro|afuera}."
|
||||
LOOKUP_INTERACTION: "{0} {clickeó|mató} {1}."
|
||||
LOOKUP_ITEM: "{0} {recogió|soltó} {1} {2}."
|
||||
LOOKUP_LOGIN: "{0} ha {entrado|salido}."
|
||||
LOOKUP_PAGE: "Página {0}"
|
||||
LOOKUP_PROJECTILE: "{0} {tiró|disparó} {1} {2}."
|
||||
LOOKUP_ROWS_FOUND: "{0} {fila|filas} encontró."
|
||||
LOOKUP_SEARCHING: "Búsqueda de búsqueda. Espere por favor..."
|
||||
LOOKUP_STORAGE: "{0} {depositado|retirado} {1} {2}."
|
||||
LOOKUP_TIME: "{0} atrás"
|
||||
LOOKUP_USERNAME: "{0} Conectado como {1}."
|
||||
MAXIMUM_RADIUS: "El maximo {buscar|deshacer|restaurar} el radio es {0}."
|
||||
MISSING_ACTION_USER: "Para utilizar esa acción, especifique un usuario."
|
||||
MISSING_LOOKUP_TIME: "Por favor, especifique el tiempo para {buscar|deshacer|restaurar}."
|
||||
MISSING_LOOKUP_USER: "Especifique un usuario o {bloque|radio}."
|
||||
MISSING_PARAMETERS: "Por favor use \"{0}\"."
|
||||
MISSING_ROLLBACK_RADIUS: "No especificó un {deshacer|restaurar} radio."
|
||||
MISSING_ROLLBACK_USER: "No especificó un {deshacer|restaurar} usuario."
|
||||
MYSQL_UNAVAILABLE: "Incapaz de conectarse a MySQL servidor."
|
||||
NO_DATA: "No se encontraron datos en {0}."
|
||||
NO_DATA_LOCATION: "No se encontraron {datos|transacciones|interacciones|mensajes}."
|
||||
NO_PERMISSION: "No tienes permiso para hacer eso."
|
||||
NO_RESULTS: "No se han encontrado resultados."
|
||||
NO_RESULTS_PAGE: "No {resultados|datos} encontrado para esa página."
|
||||
NO_ROLLBACK: "No {pendiente|anterior} deshacer / restaurar encontrado."
|
||||
PATCH_INTERRUPTED: "Actualización interrumpida. Intentará de nuevo al reiniciar."
|
||||
PATCH_OUTDATED_1: "No se pueden actualizar las bases de datos anteriores a {0}."
|
||||
PATCH_OUTDATED_2: "Actualice con una versión compatible de CoreProtect."
|
||||
PATCH_PROCESSING: "Procesando nuevos datos. Espere por favor..."
|
||||
PATCH_SKIP_UPDATE: "Salto a la comba {tabla|índice} {actualización|creación|eliminación} en {0}."
|
||||
PATCH_STARTED: "Ejecutando {0} potenciar. Espere por favor..."
|
||||
PATCH_SUCCESS: "Actualizado con éxito a {0}."
|
||||
PATCH_UPGRADING: "Actualización de la base de datos en curso. Espere por favor..."
|
||||
LOOKUP_ROWS_FOUND: "{0} {fila|filas} encontradas."
|
||||
LOOKUP_SEARCHING: "Busqueda iniciada. Espere..."
|
||||
LOOKUP_STORAGE: "{0} {depositó|retiró} {1} {2}."
|
||||
LOOKUP_TIME: "Hace {0}"
|
||||
LOOKUP_USERNAME: "{0} entró como {1}."
|
||||
MAXIMUM_RADIUS: "El radio máximo de {búsqueda|retorno|restauración} es {0}."
|
||||
MISSING_ACTION_USER: "Para usar esta acción, especifique a un usuario."
|
||||
MISSING_LOOKUP_TIME: "Especifique la cantidad de tiempo para {buscar|retornar|restaurar}."
|
||||
MISSING_LOOKUP_USER: "Especifique un usuario o {bloque|radio} para buscar."
|
||||
MISSING_PARAMETERS: "Usa \"{0}\"."
|
||||
MISSING_ROLLBACK_RADIUS: "No especificaste un radio para {retornar|resturar}."
|
||||
MISSING_ROLLBACK_USER: "No especificaste a un usuario para {retornar|restaurar}."
|
||||
MYSQL_UNAVAILABLE: "No se pudo conectar con el servidor de MySQL."
|
||||
NO_DATA: "Sin datos para {0}."
|
||||
NO_DATA_LOCATION: "Sin {datos|transacciones|interacciones|mensajes} encontrados acá."
|
||||
NO_PERMISSION: "No tienes permisos para hacer esto."
|
||||
NO_RESULTS: "No se hallaron resultados."
|
||||
NO_RESULTS_PAGE: "Sin {resultados|datos} encontados para esta página."
|
||||
NO_ROLLBACK: "No hay rollbacks {pendientes|previos} encontrados."
|
||||
PATCH_INTERRUPTED: "Mejora interrumpida. Se intentará nuevamente en el reinicio."
|
||||
PATCH_OUTDATED_1: "No se puede mejorar base de datos más antiguas de {0}."
|
||||
PATCH_OUTDATED_2: "Actualice con una versión soportada de CoreProtect."
|
||||
PATCH_PROCESSING: "Procesando nueva información. Espere un momento..."
|
||||
PATCH_SKIP_UPDATE: "Saltando {tabla|índice} {actualización|creación|remoción} en {0}."
|
||||
PATCH_STARTED: "Intentando actualizar {0}. Espere..."
|
||||
PATCH_SUCCESS: "Exitosamente actualizada a {0}."
|
||||
PATCH_UPGRADING: "Mejora de base de datos en progreso. Espere un momento..."
|
||||
PLEASE_SELECT: "Seleccione: \"{0}\" o \"{1}\"."
|
||||
PREVIEW_CANCELLED: "Vista previa cancelada."
|
||||
PREVIEW_CANCELLING: "Cancelando vista previa..."
|
||||
PREVIEW_IN_GAME: "Solo puedes obtener una vista previa de las reversiones en el juego."
|
||||
PREVIEW_TRANSACTION: "No puedes previsualizar {contenedor|inventario} actas."
|
||||
PURGE_ABORTED: "La purga falló. La base de datos puede estar dañada."
|
||||
PURGE_ERROR: "No se puede procesar {0} ¡datos!"
|
||||
PURGE_FAILED: "La purga falló. Por favor, inténtelo de nuevo más tarde."
|
||||
PURGE_IN_PROGRESS: "Purga en curso. Por favor, inténtelo de nuevo más tarde."
|
||||
PURGE_MINIMUM_TIME: "Solo puede depurar datos anteriores a {0} {días|horas}."
|
||||
PURGE_NOTICE_1: "Tenga en cuenta que esto puede llevar algún tiempo."
|
||||
PURGE_NOTICE_2: "No reinicie su servidor hasta que haya terminado."
|
||||
PURGE_OPTIMIZING: "Optimización de la base de datos. Espere por favor..."
|
||||
PREVIEW_CANCELLED: "Muestra cancelada."
|
||||
PREVIEW_CANCELLING: "Cancelando muestra..."
|
||||
PREVIEW_IN_GAME: "Solo puedes mostrar respaldos en el juego."
|
||||
PREVIEW_TRANSACTION: "No puedes mostrar transacciones de {contenedor|inventario}."
|
||||
PURGE_ABORTED: "Purga fallida. La base de datos debe estar corrupta."
|
||||
PURGE_ERROR: "¡No se pudo procesar {0} datos!"
|
||||
PURGE_FAILED: "Purga fallida. Intente nuevamente."
|
||||
PURGE_IN_PROGRESS: "Purga en progreso. Intentelo nuevamente."
|
||||
PURGE_MINIMUM_TIME: "Solo puedes limpiar datos viejos desde {0} {días|horas}."
|
||||
PURGE_NOTICE_1: "Ten en cuenta que va a demorar un poco."
|
||||
PURGE_NOTICE_2: "No reinicies el servidor hasta que se complete."
|
||||
PURGE_OPTIMIZING: "Optimizando base de datos. Espere..."
|
||||
PURGE_PROCESSING: "Procesando {0} datos..."
|
||||
PURGE_REPAIRING: "Intentando reparar. Esto puede tomar algo de tiempo..."
|
||||
PURGE_ROWS: "{0} {fila|filas} de datos eliminados."
|
||||
PURGE_STARTED: "La depuración de datos comenzó el \"{0}\"."
|
||||
PURGE_REPAIRING: "Intentando reparar. Esto tomará algo de tiempo..."
|
||||
PURGE_ROWS: "{0} {fila|filas} de datos limpiados."
|
||||
PURGE_STARTED: "Purga de datos iniciada en \"{0}\"."
|
||||
PURGE_SUCCESS: "Purga de datos exitosa."
|
||||
RELOAD_STARTED: "Recargando la configuración - espere."
|
||||
RELOAD_SUCCESS: "Configuración recargada correctamente."
|
||||
ROLLBACK_ABORTED: "Reversión o restauración abortada."
|
||||
ROLLBACK_CHUNKS_FOUND: "Encontró {0} {trozo|trozos} Modificar."
|
||||
ROLLBACK_CHUNKS_MODIFIED: "Modificado {0}/{1} {trozo|trozos}."
|
||||
ROLLBACK_COMPLETED: "{Retroceder|Restaurar|Vista previa} completado para \"{0}\"."
|
||||
ROLLBACK_EXCLUDED_USERS: "Excluido {usuario|usuarios}: \"{0}\"."
|
||||
RELOAD_STARTED: "Recargando configuración - espere."
|
||||
RELOAD_SUCCESS: "Configuración exitosamente recargada."
|
||||
ROLLBACK_ABORTED: "Retorno o restauración abortado."
|
||||
ROLLBACK_CHUNKS_FOUND: "Encontrado {0} {chunk|chunks} para modificar."
|
||||
ROLLBACK_CHUNKS_MODIFIED: "Se han modificado {0}/{1} {chunk|chunks}."
|
||||
ROLLBACK_COMPLETED: "{Respaldo|Restauración|Muestra} completado por \"{0}\"."
|
||||
ROLLBACK_EXCLUDED_USERS: "Excluir al {usuario|usuarios}: \"{0}\"."
|
||||
ROLLBACK_INCLUDE: "{Incluido|Excluido} {bloque|entidad|objetivo} {tipo|tipos}: \"{0}\"."
|
||||
ROLLBACK_IN_PROGRESS: "Ya se está realizando una reversión / restauración."
|
||||
ROLLBACK_LENGTH: "Tiempo tomado: {0} {segundo|segundos}."
|
||||
ROLLBACK_IN_PROGRESS: "Un retorno/resturación ya está en progreso."
|
||||
ROLLBACK_LENGTH: "Tiempo gastado: {0} {segundo|segundos}."
|
||||
ROLLBACK_MODIFIED: "{Modificado|Modificando} {0}."
|
||||
ROLLBACK_RADIUS: "Radio: {0} {bloque|bloques}."
|
||||
ROLLBACK_SELECTION: "Radio establecido en \"{0}\"."
|
||||
ROLLBACK_STARTED: "{Retroceder|Restaurar|Vista previa} comenzó en \"{0}\"."
|
||||
ROLLBACK_TIME: "Intervalo de tiempo: {0}."
|
||||
ROLLBACK_WORLD_ACTION: "Prohibido para {mundo|acción} \"{0}\"."
|
||||
SIGN_HEADER: "Firmar mensajes"
|
||||
STATUS_CONSUMER: "Consumidor: {0} {artículo|artículos} en la cola."
|
||||
ROLLBACK_SELECTION: "Radio definido a \"{0}\"."
|
||||
ROLLBACK_STARTED: "{Retorno|Restauración|Muestra} iniciado en \"{0}\"."
|
||||
ROLLBACK_TIME: "Tiempo hecho: {0}."
|
||||
ROLLBACK_WORLD_ACTION: "Restringido para {mundo|acción} \"{0}\"."
|
||||
SIGN_HEADER: "Mensajes de cartel"
|
||||
STATUS_CONSUMER: "Consumidor: {0} {objeto|objetos} en espera."
|
||||
STATUS_DATABASE: "Base de datos: Usando {0}."
|
||||
STATUS_INTEGRATION: "{0}: Integración {habilitado|deshabilitado}."
|
||||
STATUS_INTEGRATION: "{0}: Integración {activada|desactivada}."
|
||||
STATUS_LICENSE: "Licencia: {0}"
|
||||
STATUS_VERSION: "Versión: {0}"
|
||||
TELEPORTED: "Teletransportado a {0}."
|
||||
TELEPORTED_SAFETY: "Te teletransportó a un lugar seguro."
|
||||
TELEPORT_PLAYERS: "El comando de teletransporte solo puede ser utilizado por jugadores."
|
||||
TELEPORTED_SAFETY: "Te he teletransportado a un lugar seguro."
|
||||
TELEPORT_PLAYERS: "El comando de teletransporte solo puede ser usado por jugadores."
|
||||
TIME_DAYS: "{0} {día|días}"
|
||||
TIME_HOURS: "{0} {hora|horas}"
|
||||
TIME_MINUTES: "{0} {minuto|minutos}"
|
||||
TIME_SECONDS: "{0} {segundo|segundos}"
|
||||
TIME_WEEKS: "{0} {semana|semanas}"
|
||||
UPDATE_ERROR: "Se produjo un error al buscar actualizaciones."
|
||||
UPDATE_HEADER: "{0} Actualizar"
|
||||
UPDATE_NOTICE: "Darse cuenta: {0} Ya está disponible."
|
||||
UPGRADE_IN_PROGRESS: "Actualización en curso. Por favor, inténtelo de nuevo más tarde."
|
||||
USER_NOT_FOUND: "Usuario \"{0}\" extraviado."
|
||||
USER_OFFLINE: "El usuario \"{0}\" no está en línea."
|
||||
USING_MYSQL: "Utilizando MySQL para el almacenamiento de datos."
|
||||
USING_SQLITE: "Utilizando SQLite para el almacenamiento de datos."
|
||||
UPDATE_ERROR: "Un error ocurrió mientras se revisaban las actualizaciones."
|
||||
UPDATE_HEADER: "Actualización {0}"
|
||||
UPDATE_NOTICE: "Noticia: {0} está disponible."
|
||||
UPGRADE_IN_PROGRESS: "Actualización en progreso. Intente nuevamente."
|
||||
USER_NOT_FOUND: "Usuario \"{0}\" no encontrado."
|
||||
USER_OFFLINE: "El usuario \"{0}\" no está conectado."
|
||||
USING_MYSQL: "Usando MySQL para el guardado de información."
|
||||
USING_SQLITE: "Usando SQLite para el guardado de información."
|
||||
VALID_DONATION_KEY: "Clave de donación válida."
|
||||
VERSION_NOTICE: "Versión {0} Ya está disponible."
|
||||
VERSION_REQUIRED: "{0} {1} se requiere o superior."
|
||||
WORLD_NOT_FOUND: "Mundo \"{0}\" extraviado."
|
||||
VERSION_NOTICE: "Versión {0} está disponible."
|
||||
VERSION_REQUIRED: "{0} {1} o súperior es requerida."
|
||||
WORLD_NOT_FOUND: "Mundo \"{0}\" inexistente."
|
||||
+201
@@ -0,0 +1,201 @@
|
||||
# CoreProtect Language File (tr)
|
||||
|
||||
ACTION_NOT_SUPPORTED: "Bu işlem desteklenmiyor."
|
||||
AMOUNT_BLOCK: "{0} {blok|bloklar}"
|
||||
AMOUNT_CHUNK: "{0} {yığın|parçalar}"
|
||||
AMOUNT_ENTITY: "{0} {varlık|kuruluşlar}"
|
||||
AMOUNT_ITEM: "{0} {öğe|öğeler}"
|
||||
API_TEST: "API testi başarılı."
|
||||
CACHE_ERROR: "UYARI: Doğrulama sırasında hata {0} önbellek."
|
||||
CACHE_RELOAD: "Yeniden yüklemeye zorlama {haritalama|dünya} veritabanından önbellekler."
|
||||
CHECK_CONFIG: "Lütfen config.yml'yi kontrol edin"
|
||||
COMMAND_CONSOLE: "Lütfen komutu konsoldan çalıştırın."
|
||||
COMMAND_NOT_FOUND: "Emretmek \"{0}\" bulunamadı."
|
||||
COMMAND_THROTTLED: "Lütfen biraz bekleyin ve tekrar deneyin."
|
||||
CONSUMER_ERROR: "Tüketici kuyruğu işleme zaten {duraklatıldı|devam ettirildi}."
|
||||
CONSUMER_TOGGLED: "Tüketici kuyruğu işleme {duraklatıldı|devam ettirildi}."
|
||||
CONTAINER_HEADER: "Konteyner İşlemleri"
|
||||
DATABASE_BUSY: "Veritabanı meşgul. Lütfen daha sonra tekrar deneyiniz."
|
||||
DATABASE_INDEX_ERROR: "Veritabanı dizinleri doğrulanamıyor."
|
||||
DATABASE_LOCKED_1: "Veritabanı kilitlendi. 15 saniyeye kadar bekleniyor..."
|
||||
DATABASE_LOCKED_2: "Veritabanı zaten kullanılıyor. Lütfen tekrar deneyin."
|
||||
DATABASE_LOCKED_3: "Veritabanı kilitlemeyi devre dışı bırakmak için \"veritabanı kilidi: yanlış\" olarak ayarlayın."
|
||||
DATABASE_LOCKED_4: "Veritabanı kilitlemeyi devre dışı bırakmak, verilerin bozulmasına neden olabilir."
|
||||
DATABASE_UNREACHABLE: "Veritabanına erişilemiyor. Verileri atma ve kapatma."
|
||||
DEVELOPMENT_BRANCH: "Geliştirme dalı algılandı, yama komut dosyaları atlandı."
|
||||
DIRT_BLOCK: "Altına bir toprak bloğu yerleştirdi."
|
||||
DISABLE_SUCCESS: "Başarı! Engelli {0}"
|
||||
ENABLE_FAILED: "{0} başlayamadı."
|
||||
ENABLE_SUCCESS: "{0} şimdi etkinleştirildi!"
|
||||
ENJOY_COREPROTECT: "Eğlence {0}? Bize katılın Discord!"
|
||||
FINISHING_CONVERSION: "Veri dönüştürme işlemi tamamlanıyor. Lütfen bekle..."
|
||||
FINISHING_LOGGING: "Veri kaydının tamamlanması. Lütfen bekle..."
|
||||
FIRST_VERSION: "İlk Veri Tabanı: {0}"
|
||||
GLOBAL_LOOKUP: "Genel arama yapmak için bir yarıçap belirlemeyin."
|
||||
GLOBAL_ROLLBACK: "Kullanmak \"{0}\" küresel yapmak {geri alma|geri yükleme}"
|
||||
HELP_ACTION_1: "Aramayı bir eylemle sınırlayın."
|
||||
HELP_ACTION_2: "Örnekler: [a:block], [a:+block], [a:-block] [a:click], [a:container], [a:inventory], [a:item], [a:kill], [a:chat], [a:command], [a:sign], [a:session], [a:username]"
|
||||
HELP_COMMAND: "Ek bilgileri görüntüleyin."
|
||||
HELP_EXCLUDE_1: "Blokları/kullanıcıları hariç tutun."
|
||||
HELP_EXCLUDE_2: "Örnekler: [e:stone], [e:Notch], [e:stone,Notch]"
|
||||
HELP_HEADER: "{0} Yardım"
|
||||
HELP_INCLUDE_1: "Blokları/varlıkları dahil et."
|
||||
HELP_INCLUDE_2: "Örnekler: [i:stone], [i:zombie], [i:stone,wood,bedrock]"
|
||||
HELP_INSPECT_1: "Müfettiş etkinken şunları yapabilirsiniz:"
|
||||
HELP_INSPECT_2: "Yerleşimi görmek için sol tıklayın."
|
||||
HELP_INSPECT_3: "Bitişik kaldırmaları görmek için sağ tıklayın."
|
||||
HELP_INSPECT_4: "Kaldırma işlemini görmek için bir blok yerleştirin."
|
||||
HELP_INSPECT_5: "Yerleşimi görmek için sıvıya bir blok yerleştirin."
|
||||
HELP_INSPECT_6: "Sandık işlemlerini görmek için sağ tıklayın."
|
||||
HELP_INSPECT_7: "İpucu: Yalnızca \"/co i\" kullanabilirsiniz."
|
||||
HELP_INSPECT_COMMAND: "Blok denetçisini değiştirir."
|
||||
HELP_LIST: "Tüm komutların bir listesini görüntüler."
|
||||
HELP_LOOKUP_1: "Komut kısayolu."
|
||||
HELP_LOOKUP_2: "Ek sayfaları görüntüleyin."
|
||||
HELP_LOOKUP_COMMAND: "Blok verilerini arayın."
|
||||
HELP_NO_INFO: "Komut için bilgi \"{0}\" bulunamadı."
|
||||
HELP_PARAMETER: "Bakınız \"{0}\" detaylı parametre bilgisi için."
|
||||
HELP_PARAMS_1: "Gerçekleştir {arama|geri alma|geri yükleme}."
|
||||
HELP_PARAMS_2: "Kullanıcıları belirtin {arama|geri alma|geri yükleme}."
|
||||
HELP_PARAMS_3: "Zamanı belirtin {arama|geri alma|geri yükleme}."
|
||||
HELP_PARAMS_4: "kısıtlamak {arama|geri alma|geri yükleme} bir yarıçapa."
|
||||
HELP_PARAMS_5: "kısıtlamak {arama|geri alma|geri yükleme} bir eyleme."
|
||||
HELP_PARAMS_6: "Blokları/varlıkları dahil et {arama|geri alma|geri yükleme}."
|
||||
HELP_PARAMS_7: "Blokları/kullanıcıları {arama|geri alma|geri yükleme}."
|
||||
HELP_PURGE_1: "Eski verileri kaldırın."
|
||||
HELP_PURGE_2: "Örneğin, \"{0}\" bir aydan eski tüm verileri silecek ve yalnızca son 30 güne ait verileri tutacaktır."
|
||||
HELP_PURGE_COMMAND: "Eski blok verilerini silin."
|
||||
HELP_RADIUS_1: "Bir yarıçap alanı belirtin."
|
||||
HELP_RADIUS_2: "Örnekler: [r:10] (Sadece 10 blok içinde değişiklik yapın)"
|
||||
HELP_RELOAD_COMMAND: "Yapılandırma dosyasını yeniden yükler."
|
||||
HELP_RESTORE_COMMAND: "Blok verilerini geri yükleyin."
|
||||
HELP_ROLLBACK_COMMAND: "Geri alma blok verileri."
|
||||
HELP_STATUS: "Eklenti durumunu görüntüleyin."
|
||||
HELP_STATUS_COMMAND: "Eklenti durumunu görüntüler."
|
||||
HELP_TELEPORT: "Işınlanma."
|
||||
HELP_TIME_1: "Zamanı belirtin."
|
||||
HELP_TIME_2: "Örnekler: [t:2w,5d,7h,2m,10s], [t:5d2h], [t:2.50h]"
|
||||
HELP_USER_1: "Kullanıcıları belirtin."
|
||||
HELP_USER_2: "Örnekler: [u:Notch], [u:Notch,#enderman]"
|
||||
INCOMPATIBLE_ACTION: "\"{0}\" bu eylemle kullanılamaz."
|
||||
INSPECTOR_ERROR: "Müfettiş zaten {etkin|devre dışı}."
|
||||
INSPECTOR_TOGGLED: "Müfettiş şimdi {etkin|devre dışı}."
|
||||
INTEGRATION_ERROR: "Olanaksız {başlat|devre dışı bırak} {0} Kerestecilik."
|
||||
INTEGRATION_SUCCESS: "{0} başarıyla giriş yapmak {başlatıldı|devre dışı}."
|
||||
INTEGRATION_VERSION: "Geçersiz {0} sürüm bulundu."
|
||||
INTERACTIONS_HEADER: "Oyuncu Etkileşimleri"
|
||||
INVALID_ACTION: "Bu geçerli bir eylem değil."
|
||||
INVALID_BRANCH_1: "Geçersiz eklenti sürümü (dal ayarlanmadı)."
|
||||
INVALID_BRANCH_2: "Devam etmek için proje dalını \"geliştirme\" olarak ayarlayın."
|
||||
INVALID_BRANCH_3: "Geliştirme kodunu çalıştırmak, verilerin bozulmasına neden olabilir."
|
||||
INVALID_CONTAINER: "Lütfen önce geçerli bir kapsayıcıyı inceleyin."
|
||||
INVALID_DONATION_KEY: "Geçersiz bağış anahtarı."
|
||||
INVALID_INCLUDE: "\"{0}\" geçersiz bir değerdir."
|
||||
INVALID_INCLUDE_COMBO: "Bu geçersiz bir tür birleşimidir."
|
||||
INVALID_RADIUS: "Lütfen geçerli bir yarıçap girin."
|
||||
INVALID_SELECTION: "{0} seçim bulunamadı."
|
||||
INVALID_USERNAME: "\"{0}\" geçersiz bir kullanıcı adıdır."
|
||||
INVALID_WORLD: "Lütfen geçerli bir dünya belirtin."
|
||||
LATEST_VERSION: "En son sürüm: {0}"
|
||||
LINK_DISCORD: "Discord: {0}"
|
||||
LINK_DOWNLOAD: "İndirmek: {0}"
|
||||
LINK_PATREON: "Patreon: {0}"
|
||||
LINK_WIKI_BLOCK: "Blok İsimleri: {0}"
|
||||
LINK_WIKI_ENTITY: "Varlık Adları: {0}"
|
||||
LOGGING_ITEMS: "{0} günlüğe bırakılan öğeler. Lütfen bekle..."
|
||||
LOGGING_TIME_LIMIT: "Günlüğe kaydetme zaman sınırına ulaşıldı. Verileri atma ve kapatma."
|
||||
LOOKUP_BLOCK: "{0} {yerleştirilmiş|kırıldı} {1}."
|
||||
LOOKUP_CONTAINER: "{0} {eklendi|kaldırıldı} {1} {2}."
|
||||
LOOKUP_HEADER: "{0} Sonuçlar"
|
||||
LOOKUP_INTERACTION: "{0} {tıklandı|öldürüldü} {1}."
|
||||
LOOKUP_ITEM: "{0} {aldı|bıraktı} {1} {2}."
|
||||
LOOKUP_LOGIN: "{0} günlüğe kaydedildi {içeri|dışarı}."
|
||||
LOOKUP_PAGE: "Sayfa {0}"
|
||||
LOOKUP_PROJECTILE: "{0} {fırlattı|vuruş} {1} {2}."
|
||||
LOOKUP_ROWS_FOUND: "{0} {satır|satır} kurmak."
|
||||
LOOKUP_SEARCHING: "Arama arama. Lütfen bekle..."
|
||||
LOOKUP_STORAGE: "{0} {yatırıldı|geri çekildi} {1} {2}."
|
||||
LOOKUP_TIME: "{0} evvel"
|
||||
LOOKUP_USERNAME: "{0} olarak giriş yaptı {1}."
|
||||
MAXIMUM_RADIUS: "Maksimum {arama|geri alma|geri yükleme} yarıçap {0}."
|
||||
MISSING_ACTION_USER: "Bu eylemi kullanmak için lütfen bir kullanıcı belirtin."
|
||||
MISSING_LOOKUP_TIME: "Lütfen zamanı belirtin {arama|geri alma|geri yükleme}."
|
||||
MISSING_LOOKUP_USER: "Lütfen bir kullanıcı belirtin veya {blok|yarıçap}."
|
||||
MISSING_PARAMETERS: "Lütfen kullan \"{0}\"."
|
||||
MISSING_ROLLBACK_RADIUS: "bir belirtmemişsin {geri alma|geri yükleme} yarıçap."
|
||||
MISSING_ROLLBACK_USER: "bir belirtmemişsin {geri alma|geri yükleme} kullanıcı."
|
||||
MYSQL_UNAVAILABLE: "Bağlantı kurulamıyor MySQL sunucu."
|
||||
NO_DATA: "şurada veri bulunamadı {0}."
|
||||
NO_DATA_LOCATION: "Numara {veri|işlemler|etkileşimler|mesajlar} kurmak."
|
||||
NO_PERMISSION: "Bunu yapmaya iznin yok."
|
||||
NO_RESULTS: "Sonuç bulunamadı."
|
||||
NO_RESULTS_PAGE: "Numara {sonuçlar|veri} o sayfa için bulundu."
|
||||
NO_ROLLBACK: "Numara {beklemede|önceki} geri alma/geri yükleme bulundu."
|
||||
PATCH_INTERRUPTED: "Yükseltme kesintiye uğradı. Yeniden başlatıldığında tekrar deneyecek."
|
||||
PATCH_OUTDATED_1: "Daha eski veritabanları yükseltilemiyor {0}."
|
||||
PATCH_OUTDATED_2: "Lütfen desteklenen bir sürümle yükseltin CoreProtect."
|
||||
PATCH_PROCESSING: "Yeni veriler işleniyor. Lütfen bekle..."
|
||||
PATCH_SKIP_UPDATE: "Atlama {tablo|dizin} {güncelleme|oluşturma|kaldırma} üzerinde {0}."
|
||||
PATCH_STARTED: "performans {0} Yükselt. Lütfen bekle..."
|
||||
PATCH_SUCCESS: "Başarıyla yükseltildi {0}."
|
||||
PATCH_UPGRADING: "Veritabanı yükseltmesi devam ediyor. Lütfen bekle..."
|
||||
PLEASE_SELECT: "Lütfen seçin: \"{0}\" veya \"{1}\"."
|
||||
PREVIEW_CANCELLED: "Önizleme iptal edildi."
|
||||
PREVIEW_CANCELLING: "Önizleme iptal ediliyor..."
|
||||
PREVIEW_IN_GAME: "Geri almaları yalnızca oyun içinde önizleyebilirsiniz."
|
||||
PREVIEW_TRANSACTION: "önizleme yapamazsınız {konteyner|envanter} işlemler."
|
||||
PURGE_ABORTED: "Temizleme başarısız oldu. Veritabanı bozuk olabilir."
|
||||
PURGE_ERROR: "işlenemiyor {0} veri!"
|
||||
PURGE_FAILED: "Temizleme başarısız oldu. Lütfen daha sonra tekrar deneyiniz."
|
||||
PURGE_IN_PROGRESS: "Temizleme işlemi devam ediyor. Lütfen daha sonra tekrar deneyiniz."
|
||||
PURGE_MINIMUM_TIME: "Yalnızca şu tarihten daha eski verileri temizleyebilirsiniz: {0} {gün|saat}."
|
||||
PURGE_NOTICE_1: "Lütfen bunun biraz zaman alabileceğini unutmayın."
|
||||
PURGE_NOTICE_2: "Tamamlanana kadar sunucunuzu yeniden başlatmayın."
|
||||
PURGE_OPTIMIZING: "Veritabanını optimize etme. Lütfen bekle..."
|
||||
PURGE_PROCESSING: "İşleme {0} veri..."
|
||||
PURGE_REPAIRING: "Tamir etmeye çalışmak. Bu biraz zaman alabilir..."
|
||||
PURGE_ROWS: "{0} {satır|satır} silinen veriler."
|
||||
PURGE_STARTED: "Veri temizleme başladı \"{0}\"."
|
||||
PURGE_SUCCESS: "Veri temizleme başarılı."
|
||||
RELOAD_STARTED: "Yapılandırma yeniden yükleniyor - lütfen bekleyin."
|
||||
RELOAD_SUCCESS: "Yapılandırma başarıyla yeniden yüklendi."
|
||||
ROLLBACK_ABORTED: "Geri alma veya geri yükleme iptal edildi."
|
||||
ROLLBACK_CHUNKS_FOUND: "Kurmak {0} {yığın|parçalar} düzenlemek."
|
||||
ROLLBACK_CHUNKS_MODIFIED: "Değiştirilmiş {0}/{1} {yığın|parçalar}."
|
||||
ROLLBACK_COMPLETED: "{Geri Alma|Geri Yükleme|Önizleme} için tamamlandı \"{0}\"."
|
||||
ROLLBACK_EXCLUDED_USERS: "Hariç tutulan {kullanıcı|kullanıcılar}: \"{0}\"."
|
||||
ROLLBACK_INCLUDE: "{Dahil|Hariç} {blok|varlık|hedef} {tip|tür}: \"{0}\"."
|
||||
ROLLBACK_IN_PROGRESS: "Halihazırda bir geri alma/geri yükleme işlemi devam ediyor."
|
||||
ROLLBACK_LENGTH: "Geçen süre: {0} {saniye|saniye}."
|
||||
ROLLBACK_MODIFIED: "{Değiştirildi|Değiştiriliyor} {0}."
|
||||
ROLLBACK_RADIUS: "yarıçap: {0} {blok|bloklar}."
|
||||
ROLLBACK_SELECTION: "Yarıçap \" olarak ayarlandı{0}\"."
|
||||
ROLLBACK_STARTED: "{Geri Alma|Geri Yükleme|Önizleme} başladı \"{0}\"."
|
||||
ROLLBACK_TIME: "Zaman aralığı: {0}."
|
||||
ROLLBACK_WORLD_ACTION: "Sınırlı {dünya|eylem} \"{0}\"."
|
||||
SIGN_HEADER: "Mesajları İmzala"
|
||||
STATUS_CONSUMER: "Tüketici: {0} {öğe|öğeler} sırada."
|
||||
STATUS_DATABASE: "Veri tabanı: kullanma {0}."
|
||||
STATUS_INTEGRATION: "{0}: Entegrasyon {etkin|devre dışı}."
|
||||
STATUS_LICENSE: "Lisans: {0}"
|
||||
STATUS_VERSION: "Sürüm: {0}"
|
||||
TELEPORTED: "Işınlandı {0}."
|
||||
TELEPORTED_SAFETY: "Sizi emniyete ışınladım."
|
||||
TELEPORT_PLAYERS: "Teleport komutu sadece oyuncular tarafından kullanılabilir."
|
||||
TIME_DAYS: "{0} {gün|gün}"
|
||||
TIME_HOURS: "{0} {saat|saat}"
|
||||
TIME_MINUTES: "{0} {dakika|dakika}"
|
||||
TIME_SECONDS: "{0} {saniye|saniye}"
|
||||
TIME_WEEKS: "{0} {hafta|hafta}"
|
||||
UPDATE_ERROR: "Güncellemeler kontrol edilirken bir hata oluştu."
|
||||
UPDATE_HEADER: "{0} Güncelleme"
|
||||
UPDATE_NOTICE: "Fark etme: {0} şimdi kullanılabilir."
|
||||
UPGRADE_IN_PROGRESS: "Yükseltme devam ediyor. Lütfen daha sonra tekrar deneyiniz."
|
||||
USER_NOT_FOUND: "kullanıcı \"{0}\" bulunamadı."
|
||||
USER_OFFLINE: "Kullanıcı \"{0}\" çevrimiçi değil."
|
||||
USING_MYSQL: "kullanma MySQL veri depolama için."
|
||||
USING_SQLITE: "kullanma SQLite veri depolama için."
|
||||
VALID_DONATION_KEY: "Geçerli bağış anahtarı."
|
||||
VERSION_NOTICE: "sürüm {0} şimdi kullanılabilir."
|
||||
VERSION_REQUIRED: "{0} {1} veya daha yüksek gereklidir."
|
||||
WORLD_NOT_FOUND: "Dünya \"{0}\" bulunamadı."
|
||||
+7
-7
@@ -10,11 +10,11 @@ API_TEST: "API 测试成功。"
|
||||
CACHE_ERROR: "警告: 验证缓存 {0} 时出错。"
|
||||
CACHE_RELOAD: "正在强制从数据库中重新加载{映射|世界}的缓存。"
|
||||
CHECK_CONFIG: "请检查 config.yml 文件"
|
||||
COMMAND_CONSOLE: "请从控制台运行命令。"
|
||||
COMMAND_CONSOLE: "请在控制台中运行此命令。"
|
||||
COMMAND_NOT_FOUND: "找不到命令 \"{0}\""
|
||||
COMMAND_THROTTLED: "请稍等片刻,然后重试。"
|
||||
CONSUMER_ERROR: "消费者队列处理已经 {暂停|继续}."
|
||||
CONSUMER_TOGGLED: "消费者队列处理已 {暂停|继续}."
|
||||
CONSUMER_ERROR: "数据处理队列已经{暂停|恢复}。"
|
||||
CONSUMER_TOGGLED: "数据处理队列现已{暂停|恢复}。"
|
||||
CONTAINER_HEADER: "容器物品变更记录"
|
||||
DATABASE_BUSY: "数据库繁忙,请稍后重试。"
|
||||
DATABASE_INDEX_ERROR: "无法验证数据库索引。"
|
||||
@@ -112,7 +112,7 @@ LOOKUP_INTERACTION: "{0} {点击|击杀} {1}."
|
||||
LOOKUP_ITEM: "{0} {拾起|丢弃} {1} {2}."
|
||||
LOOKUP_LOGIN: "{0} {登入|离开}."
|
||||
LOOKUP_PAGE: "第 {0} 页"
|
||||
LOOKUP_PROJECTILE: "{0} {扔|射} {1} {2}."
|
||||
LOOKUP_PROJECTILE: "{0} {扔出|发射} {1} {2}."
|
||||
LOOKUP_ROWS_FOUND: "已找到 {0}{行|行}。"
|
||||
LOOKUP_SEARCHING: "正在搜索,请稍等..."
|
||||
LOOKUP_STORAGE: "{0} {放入|取出} {1} {2}."
|
||||
@@ -144,7 +144,7 @@ PLEASE_SELECT: "请选择: \"{0}\"或\"{1}\"。"
|
||||
PREVIEW_CANCELLED: "预览已取消。"
|
||||
PREVIEW_CANCELLING: "正在取消预览..."
|
||||
PREVIEW_IN_GAME: "你只能在游戏中预览回滚操作。"
|
||||
PREVIEW_TRANSACTION: "您无法预览 {集装箱|库存} 交易。"
|
||||
PREVIEW_TRANSACTION: "你不能预览{容器|背包}物品交换。"
|
||||
PURGE_ABORTED: "清除失败,数据库可能已损坏。"
|
||||
PURGE_ERROR: "无法处理 {0} 数据!"
|
||||
PURGE_FAILED: "数据清除失败,请稍后再试。"
|
||||
@@ -193,10 +193,10 @@ UPDATE_HEADER: "{0} 更新"
|
||||
UPDATE_NOTICE: "注意: {0} 现在可用。"
|
||||
UPGRADE_IN_PROGRESS: "正在进行升级,请稍后再试。"
|
||||
USER_NOT_FOUND: "玩家\"{0}\"未找到。"
|
||||
USER_OFFLINE: "用户 \"{0}\"不在线。"
|
||||
USER_OFFLINE: "玩家\"{0}\"不在线。"
|
||||
USING_MYSQL: "使用 MySQL 用于数据存储。"
|
||||
USING_SQLITE: "使用 SQLite 用于数据存储。"
|
||||
VALID_DONATION_KEY: "有效的捐赠密钥。"
|
||||
VERSION_NOTICE: "版本 {0} 现在可用。"
|
||||
VERSION_REQUIRED: "{0} 需要使用 {1} 或更高版本。"
|
||||
WORLD_NOT_FOUND: "找不到世界 \"{0}\"。"
|
||||
WORLD_NOT_FOUND: "找不到世界 \"{0}\"。"
|
||||
+93
-93
@@ -1,8 +1,8 @@
|
||||
# CoreProtect Language File (zh-TW)
|
||||
# Translators: whitebear13579, Flandre_tw
|
||||
# Translators: whitebear13579, flandretw, ianiiaannn
|
||||
|
||||
ACTION_NOT_SUPPORTED: "此指令不支援該操作。"
|
||||
AMOUNT_BLOCK: "{0} 個{方塊|方塊}"
|
||||
ACTION_NOT_SUPPORTED: "此指令不支援該行為。"
|
||||
AMOUNT_BLOCK: "{0} 格{方塊|方塊}"
|
||||
AMOUNT_CHUNK: "{0} 個{區塊|區塊}"
|
||||
AMOUNT_ENTITY: "{0} 個{實體|實體}"
|
||||
AMOUNT_ITEM: "{0} 個{物品|物品}"
|
||||
@@ -10,52 +10,52 @@ API_TEST: "API 測試成功。"
|
||||
CACHE_ERROR: "警告: 驗證快取 {0} 時出現錯誤。"
|
||||
CACHE_RELOAD: "正在強制從資料庫中重新載入{鏡像|世界}快取。"
|
||||
CHECK_CONFIG: "請檢查 config.yml 檔案。"
|
||||
COMMAND_CONSOLE: "請從控制台運行命令。"
|
||||
COMMAND_NOT_FOUND: "未知的指令 \"{0}\"。"
|
||||
COMMAND_CONSOLE: "請從控制台執行此指令。"
|
||||
COMMAND_NOT_FOUND: "未知的指令「{0}」。"
|
||||
COMMAND_THROTTLED: "請稍後再試。"
|
||||
CONSUMER_ERROR: "消費者隊列處理已經 {暫停|繼續}."
|
||||
CONSUMER_TOGGLED: "消費者隊列處理已 {暫停|繼續}."
|
||||
CONTAINER_HEADER: "儲存容器變更記錄。"
|
||||
CONSUMER_ERROR: "消費者隊列處理已經{暫停|繼續}."
|
||||
CONSUMER_TOGGLED: "消費者隊列處理已{暫停|繼續}."
|
||||
CONTAINER_HEADER: "儲存容器變更紀錄。"
|
||||
DATABASE_BUSY: "資料庫繁忙,請稍後再試。"
|
||||
DATABASE_INDEX_ERROR: "無法驗證資料庫索引。"
|
||||
DATABASE_LOCKED_1: "資料庫已被鎖定,請等待 15 秒後再試……"
|
||||
DATABASE_LOCKED_1: "資料庫已被鎖定,請稍後 15 秒後再試……"
|
||||
DATABASE_LOCKED_2: "資料庫正在使用,請稍後再試一次。"
|
||||
DATABASE_LOCKED_3: "若要關閉資料庫鎖定功能,請設定 \"database-lock: false\"。"
|
||||
DATABASE_LOCKED_4: "關閉資料庫鎖定功能,可能導致資料損壞。"
|
||||
DATABASE_UNREACHABLE: "資料庫無法存取,正在拋棄資料並關閉。"
|
||||
DEVELOPMENT_BRANCH: "檢測到正在使用開發分支的版本,已跳過使用補丁腳本。"
|
||||
DATABASE_LOCKED_3: "若要停用資料庫鎖定功能,請設定「database-lock: false」。"
|
||||
DATABASE_LOCKED_4: "停用資料庫鎖定功能可能導致資料毀損。"
|
||||
DATABASE_UNREACHABLE: "資料庫無法存取,正在拋棄資料並停用。"
|
||||
DEVELOPMENT_BRANCH: "檢測到正在使用開發分支的版本,已跳過資料庫版本更新。"
|
||||
DIRT_BLOCK: "已在你的下方放置了泥土。"
|
||||
DISABLE_SUCCESS: "執行成功 ! 關閉 {0} !"
|
||||
DISABLE_SUCCESS: "執行成功!已停用 {0}!"
|
||||
ENABLE_FAILED: "無法啟用 {0}。"
|
||||
ENABLE_SUCCESS: "已經成功啟用 {0} !"
|
||||
ENJOY_COREPROTECT: "喜歡 {0} 嗎 ? 加入我們的 Discord !"
|
||||
ENABLE_SUCCESS: "已經成功啟用 {0}!"
|
||||
ENJOY_COREPROTECT: "喜歡 {0} 嗎?加入我們的 Discord!"
|
||||
FINISHING_CONVERSION: "正在完成資料轉換,請稍候……"
|
||||
FINISHING_LOGGING: "正在完成資料記錄,請稍候……"
|
||||
FIRST_VERSION: "初始化資料庫: {0}"
|
||||
FINISHING_LOGGING: "正在完成紀錄檔處理,請稍候……"
|
||||
FIRST_VERSION: "資料庫初始化版本: {0}"
|
||||
GLOBAL_LOOKUP: "請勿指定範圍來進行全面的搜尋。"
|
||||
GLOBAL_ROLLBACK: "使用 \"{0}\" 來進行全面的{回滾|恢復}。"
|
||||
HELP_ACTION_1: "將搜尋限制為某個行為。"
|
||||
GLOBAL_ROLLBACK: "使用「{0}」來進行全面的{回滾|恢復}。"
|
||||
HELP_ACTION_1: "僅過濾某個行為。"
|
||||
HELP_ACTION_2: "範例: [a:block], [a:+block], [a:-block] [a:click], [a:container], [a:inventory], [a:item], [a:kill], [a:chat], [a:command], [a:sign], [a:session], [a:username]"
|
||||
HELP_COMMAND: "顯示該指令的更多資訊。"
|
||||
HELP_EXCLUDE_1: "排除方塊/玩家"
|
||||
HELP_EXCLUDE_2: "範例: [e:stone], [e:Notch], [e:stone,Notch]"
|
||||
HELP_HEADER: "{0} 說明"
|
||||
HELP_INCLUDE_1: "包括指定的方塊/實體"
|
||||
HELP_INCLUDE_1: "僅過濾指定的方塊/實體"
|
||||
HELP_INCLUDE_2: "範例: [i:stone], [i:zombie], [i:stone,wood,bedrock]"
|
||||
HELP_INSPECT_1: "當檢查器啟用後,你可以執行以下操作:"
|
||||
HELP_INSPECT_2: "對你欲查詢的方塊點擊左鍵,可以查看方塊放置記錄。"
|
||||
HELP_INSPECT_3: "對你欲查詢的方塊點擊右鍵,可以查看相鄰方塊破壞記錄。"
|
||||
HELP_INSPECT_4: "對你欲查詢的位置放置方塊,可以查看放置位置破壞記錄。"
|
||||
HELP_INSPECT_5: "對你欲查詢的液體中放置方塊,可以查看液體變更記錄。"
|
||||
HELP_INSPECT_6: "對你欲查詢的門、儲物箱等方塊點擊右鍵,可以查看使用記錄。"
|
||||
HELP_INSPECT_7: "小提醒: 你可以使用 \"/co i\" 來加快搜尋的速度。"
|
||||
HELP_INSPECT_COMMAND: "開啟或關閉檢查器。"
|
||||
HELP_INSPECT_2: "對你欲查詢的方塊點擊左鍵,可以查看方塊放置紀錄。"
|
||||
HELP_INSPECT_3: "對你欲查詢的方塊點擊右鍵,可以查看相鄰方塊破壞紀錄。"
|
||||
HELP_INSPECT_4: "對你欲查詢的位置放置方塊,可以查看放置位置破壞紀錄。"
|
||||
HELP_INSPECT_5: "對你欲查詢的液體中放置方塊,可以查看液體變更紀錄。"
|
||||
HELP_INSPECT_6: "對你欲查詢的門、儲物箱等方塊點擊右鍵,可以查看使用紀錄。"
|
||||
HELP_INSPECT_7: "小提醒: 你可以使用「/co i」來快速啟用或停用檢查器。"
|
||||
HELP_INSPECT_COMMAND: "啟用或停用檢查器。"
|
||||
HELP_LIST: "顯示所有指令列表。"
|
||||
HELP_LOOKUP_1: "指令捷徑"
|
||||
HELP_LOOKUP_2: "在使用檢查器檢查後以便查看日誌。"
|
||||
HELP_LOOKUP_COMMAND: "進階查詢方塊的資料。"
|
||||
HELP_NO_INFO: "未找到 \"{0}\" 的相關指令資訊。"
|
||||
HELP_PARAMETER: "若需查看相關詳細參數資訊,請查閱 \"{0}\"。"
|
||||
HELP_LOOKUP_COMMAND: "進階查詢方塊資料。"
|
||||
HELP_NO_INFO: "未找到「{0}」的相關指令資訊。"
|
||||
HELP_PARAMETER: "若需查看相關詳細參數資訊,請查閱「{0}」。"
|
||||
HELP_PARAMS_1: "執行{查詢|回滾|恢復}。"
|
||||
HELP_PARAMS_2: "指定需要{查詢|回滾|恢復}的玩家。"
|
||||
HELP_PARAMS_3: "指定需要{查詢|回滾|恢復}的時間範圍。"
|
||||
@@ -63,12 +63,12 @@ HELP_PARAMS_4: "指定限制{查詢|回滾|恢復}的範圍。"
|
||||
HELP_PARAMS_5: "將{查詢|回滾|恢復}限制在某個行為。"
|
||||
HELP_PARAMS_6: "在{查詢|回滾|恢復}中指定特定的實體/方塊。"
|
||||
HELP_PARAMS_7: "從{查詢|回滾|恢復}中排除特定的方塊/玩家。"
|
||||
HELP_PURGE_1: "刪除了指定時間範圍的資料。"
|
||||
HELP_PURGE_2: "舉例來說,\"{0}\" 將會刪除超過一個月的所有方塊資料,只保留最近 30 天的資料。"
|
||||
HELP_PURGE_COMMAND: "刪除舊的方塊資料。"
|
||||
HELP_PURGE_1: "清除指定時間範圍內的資料。"
|
||||
HELP_PURGE_2: "舉例來說,「{0}」將會清除超過一個月的所有資料,只保留最近 30 天的資料。"
|
||||
HELP_PURGE_COMMAND: "清除舊資料。"
|
||||
HELP_RADIUS_1: "指定半徑範圍。"
|
||||
HELP_RADIUS_2: "範例: [r:10] (僅會更改你周圍的 10 格方塊)"
|
||||
HELP_RELOAD_COMMAND: "重新載入配置檔案。"
|
||||
HELP_RADIUS_2: "範例: [r:10](僅會更改你周圍的 10 格方塊)"
|
||||
HELP_RELOAD_COMMAND: "重新載入設定檔。"
|
||||
HELP_RESTORE_COMMAND: "恢復方塊資料。"
|
||||
HELP_ROLLBACK_COMMAND: "回滾方塊資料。"
|
||||
HELP_STATUS: "查看插件狀態與版本資訊。"
|
||||
@@ -78,106 +78,106 @@ HELP_TIME_1: "指定搜尋的時間範圍。"
|
||||
HELP_TIME_2: "範例: [t:2w,5d,7h,2m,10s], [t:5d2h], [t:2.50h]"
|
||||
HELP_USER_1: "指定要搜尋的玩家。"
|
||||
HELP_USER_2: "範例: [u:Notch], [u:Notch,#enderman]"
|
||||
INCOMPATIBLE_ACTION: "\"{0}\" 不能用於此操作。"
|
||||
INSPECTOR_ERROR: "已{開啟|關閉}檢查器了。"
|
||||
INSPECTOR_TOGGLED: "已{開啟|關閉}檢查器。"
|
||||
INTEGRATION_ERROR: "無法{初始化|關閉} {0} 日誌記錄。"
|
||||
INTEGRATION_SUCCESS: "{0} 成功記錄{初始化|關閉}。"
|
||||
INTEGRATION_VERSION: "發現 {0} 版本無效。"
|
||||
INCOMPATIBLE_ACTION: "「{0}」不能用於此行為。"
|
||||
INSPECTOR_ERROR: "檢查器已經{啟用|停用}了。"
|
||||
INSPECTOR_TOGGLED: "已{啟用|停用}檢查器。"
|
||||
INTEGRATION_ERROR: "無法{初始化|停用}{0}紀錄檔。"
|
||||
INTEGRATION_SUCCESS: "{0} 紀錄檔已成功{初始化|停用}。"
|
||||
INTEGRATION_VERSION: "{0} 的版本無效。"
|
||||
INTERACTIONS_HEADER: "玩家互動"
|
||||
INVALID_ACTION: "這不是有效的行為。"
|
||||
INVALID_BRANCH_1: "插件版本無效 (未設定分支)。"
|
||||
INVALID_BRANCH_2: "若要繼續行為,請將你的項目分之設定為 \"development\"。"
|
||||
INVALID_BRANCH_3: "執行開發中的插件可能會導致資料損毀。"
|
||||
INVALID_CONTAINER: "請先檢查有效的容器。"
|
||||
INVALID_DONATION_KEY: "無效的捐贈金鑰。"
|
||||
INVALID_INCLUDE: "\"{0}\" 是無效的方塊/實體名稱。"
|
||||
INVALID_INCLUDE_COMBO: "這是無效的方塊/實體組合。"
|
||||
INVALID_RADIUS: "請輸入有效的範圍。"
|
||||
INVALID_SELECTION: "未找到選擇 {0} 的內容。"
|
||||
INVALID_USERNAME: "\"{0}\" 是無效的玩家名稱。"
|
||||
INVALID_WORLD: "請指定有效的世界。"
|
||||
INVALID_ACTION: "此並非有效的行為。"
|
||||
INVALID_BRANCH_1: "插件版本無效(未設定分支)。"
|
||||
INVALID_BRANCH_2: "若要繼續,請將分支設定為「development」。"
|
||||
INVALID_BRANCH_3: "執行開發中的插件版本可能會導致資料損毀。"
|
||||
INVALID_CONTAINER: "此並非有效的容器。"
|
||||
INVALID_DONATION_KEY: "無效的贊助金鑰。"
|
||||
INVALID_INCLUDE: "「{0}」為無效的方塊/實體名稱。"
|
||||
INVALID_INCLUDE_COMBO: "此為無效的方塊/實體組合。"
|
||||
INVALID_RADIUS: "此並非有效的範圍。"
|
||||
INVALID_SELECTION: "「{0}」為無效的選擇範圍。"
|
||||
INVALID_USERNAME: "「{0}」為無效的使用者名稱。"
|
||||
INVALID_WORLD: "此並非有效的世界。"
|
||||
LATEST_VERSION: "最新版本: {0}"
|
||||
LINK_DISCORD: "Discord: {0}"
|
||||
LINK_DOWNLOAD: "下載: {0}"
|
||||
LINK_PATREON: "Patreon: {0}"
|
||||
LINK_WIKI_BLOCK: "方塊名稱: {0}"
|
||||
LINK_WIKI_ENTITY: "實體名稱: {0}"
|
||||
LOGGING_ITEMS: "還剩 {0} 項要進行記錄,請稍候……"
|
||||
LOGGING_TIME_LIMIT: "已達到記錄的時間上限,正在刪除資料並關閉……"
|
||||
LOGGING_ITEMS: "還剩 {0} 項要進行紀錄,請稍候……"
|
||||
LOGGING_TIME_LIMIT: "已達到紀錄的時間上限,正在捨棄資料並停用……"
|
||||
LOOKUP_BLOCK: "{0} {放置|破壞} {1}。"
|
||||
LOOKUP_CONTAINER: "{0} {新增|刪除} {1} {2}。"
|
||||
LOOKUP_HEADER: "{0} 搜尋結果。"
|
||||
LOOKUP_CONTAINER: "{0} {存入|取出} {1} {2}。"
|
||||
LOOKUP_HEADER: "{0} 條搜尋結果。"
|
||||
LOOKUP_INTERACTION: "{0} {點擊|殺死} {1}。"
|
||||
LOOKUP_ITEM: "{0} {撿起|拋棄} {1} {2}。"
|
||||
LOOKUP_LOGIN: "{0} 已登{入|出}。"
|
||||
LOOKUP_PAGE: "第 {0} 頁"
|
||||
LOOKUP_PROJECTILE: "{0} {扔|射} {1} {2}."
|
||||
LOOKUP_ROWS_FOUND: "已找到 {0} {行|行}。"
|
||||
LOOKUP_ROWS_FOUND: "已找到 {0} {條|條}。"
|
||||
LOOKUP_SEARCHING: "正在搜尋,請稍候……"
|
||||
LOOKUP_STORAGE: "{0} {存|取} {1} {2}。"
|
||||
LOOKUP_STORAGE: "{0} {存入|取出} {1} {2}。"
|
||||
LOOKUP_TIME: "{0} 前"
|
||||
LOOKUP_USERNAME: "{0} 以 {1} 的身分登入。"
|
||||
MAXIMUM_RADIUS: "最大 {查詢|回滾|恢復} 的範圍為 {0}。"
|
||||
MISSING_ACTION_USER: "若要使用此操作,請指定玩家。"
|
||||
LOOKUP_USERNAME: "{0} 已改變使用者名稱為 {1}。"
|
||||
MAXIMUM_RADIUS: "最大{查詢|回滾|恢復}的範圍為 {0}。"
|
||||
MISSING_ACTION_USER: "若要使用此行為,請指定玩家。"
|
||||
MISSING_LOOKUP_TIME: "請指定{查詢|回滾|恢復}的時間範圍。"
|
||||
MISSING_LOOKUP_USER: "請指定搜尋的玩家或是{方塊|範圍}。"
|
||||
MISSING_PARAMETERS: "請使用 \"{0}\"。"
|
||||
MISSING_PARAMETERS: "請使用「{0}」。"
|
||||
MISSING_ROLLBACK_RADIUS: "你沒有指定{回滾|恢復}的範圍。"
|
||||
MISSING_ROLLBACK_USER: "你沒有指定{回滾|恢復}的玩家。"
|
||||
MYSQL_UNAVAILABLE: "無法連線到 MySQL 伺服器。"
|
||||
NO_DATA: "找不到 {0} §f的資料。"
|
||||
NO_DATA_LOCATION: "找不到這個位置的{資料|交易|互動|訊息}。"
|
||||
NO_DATA: "未找到 {0} §f的資料。"
|
||||
NO_DATA_LOCATION: "未找到此位置的{資料|交易|互動|訊息}。"
|
||||
NO_PERMISSION: "你沒有使用該操作的權限。"
|
||||
NO_RESULTS: "未找到相關結果。"
|
||||
NO_RESULTS_PAGE: "未找到該頁面相關的{結果|資料}。"
|
||||
NO_ROLLBACK: "未找到{待處理|上一個}回滾/恢復。"
|
||||
PATCH_INTERRUPTED: "更新已中斷 ! 將會在下次重新啟動時再次嘗試。"
|
||||
PATCH_INTERRUPTED: "更新已中斷!將會在下次啟動時再次嘗試。"
|
||||
PATCH_OUTDATED_1: "無法更新早於 {0} 的資料庫。"
|
||||
PATCH_OUTDATED_2: "請使用受到支援的 CoreProtect 版本。"
|
||||
PATCH_PROCESSING: "正在處理新資訊,請稍候……"
|
||||
PATCH_SKIP_UPDATE: "已在 {0} 上跳過{列表|索引}的{更新|建立|刪除}。"
|
||||
PATCH_SKIP_UPDATE: "已在 {0} 上跳過{資料表|索引}的{更新|建立|清除}。"
|
||||
PATCH_STARTED: "正在執行 {0} 更新,請稍候……"
|
||||
PATCH_SUCCESS: "已成功升級到 {0}。"
|
||||
PATCH_UPGRADING: "正在進行資料庫升級,請稍候……"
|
||||
PLEASE_SELECT: "請選擇: \"{0}\" 或是 \"{1}\"。"
|
||||
PATCH_SUCCESS: "資料庫已成功更新到 {0}。"
|
||||
PATCH_UPGRADING: "正在進行資料庫更新,請稍候……"
|
||||
PLEASE_SELECT: "請選擇:「{0}」或是「{1}」。"
|
||||
PREVIEW_CANCELLED: "預覽已取消。"
|
||||
PREVIEW_CANCELLING: "正在取消預覽……"
|
||||
PREVIEW_IN_GAME: "你只能在遊戲中預覽回滾。"
|
||||
PREVIEW_TRANSACTION: "您無法預覽 {集裝箱|庫存} 交易。"
|
||||
PREVIEW_TRANSACTION: "您無法預覽{集裝箱|庫存}交易。"
|
||||
PURGE_ABORTED: "清除失敗,你的資料可能已損毀。"
|
||||
PURGE_ERROR: "無法處理 {0} 條資料 !"
|
||||
PURGE_ERROR: "無法處理 {0} 筆資料!"
|
||||
PURGE_FAILED: "清除失敗,請稍後再試。"
|
||||
PURGE_IN_PROGRESS: "正在執行清除作業,請稍後再試。"
|
||||
PURGE_MINIMUM_TIME: "你只能清除早於 {0} {天|小時}的資料。"
|
||||
PURGE_NOTICE_1: "請注意,此操作可能需要一些時間。"
|
||||
PURGE_NOTICE_2: "在完成此程序前請不要重新啟動伺服器。"
|
||||
PURGE_OPTIMIZING: "正在最佳化資料庫,請稍候……"
|
||||
PURGE_PROCESSING: "正在處理 {0} 資料……"
|
||||
PURGE_REPAIRING: "正在嘗試修復此問題,這可能需要一些時間。"
|
||||
PURGE_ROWS: "已刪除 {0} {行|行}資料。"
|
||||
PURGE_STARTED: "資料刪除開始於 \"{0}\"。"
|
||||
PURGE_PROCESSING: "正在清除 {0} 筆資料……"
|
||||
PURGE_REPAIRING: "正在嘗試修復問題,這可能需要一些時間。"
|
||||
PURGE_ROWS: "已清除 {0} {筆|筆}資料。"
|
||||
PURGE_STARTED: "資料清除開始於「{0}」。"
|
||||
PURGE_SUCCESS: "成功清除資料。"
|
||||
RELOAD_STARTED: "正在重新載入配置檔案 - 請稍候……"
|
||||
RELOAD_SUCCESS: "成功重新載入配置檔案。"
|
||||
ROLLBACK_ABORTED: "已中止回滾/恢復。"
|
||||
RELOAD_STARTED: "正在重新載入設定檔——請稍候……"
|
||||
RELOAD_SUCCESS: "成功重新載入設定檔。"
|
||||
ROLLBACK_ABORTED: "已中斷回滾/恢復。"
|
||||
ROLLBACK_CHUNKS_FOUND: "找到 {0} 個{區塊|區塊}需要修改。"
|
||||
ROLLBACK_CHUNKS_MODIFIED: "已修改 {0}/{1}個{區塊|區塊}。"
|
||||
ROLLBACK_COMPLETED: "已完成 \"{0}\" 的{回滾|恢復|預覽}。"
|
||||
ROLLBACK_EXCLUDED_USERS: "已排除{玩家|玩家}: \"{0}\"。"
|
||||
ROLLBACK_INCLUDE: "{包括|不包括}{方塊|實體|目標}{類型|類型}: \"{0}\"。"
|
||||
ROLLBACK_COMPLETED: "已完成「{0}」的{回滾|恢復|預覽}。"
|
||||
ROLLBACK_EXCLUDED_USERS: "已排除{玩家|玩家}「{0}」。"
|
||||
ROLLBACK_INCLUDE: "{包括|不包括}{方塊|實體|目標}{類型|類型}「{0}」。"
|
||||
ROLLBACK_IN_PROGRESS: "已在進行回滾/恢復。"
|
||||
ROLLBACK_LENGTH: "花費時間: {0} {秒|秒}。"
|
||||
ROLLBACK_MODIFIED: "{已修改|正在修改} {0}。"
|
||||
ROLLBACK_RADIUS: "範圍: {0} {方塊|方塊}。"
|
||||
ROLLBACK_SELECTION: "範圍設定為 \"{0}\"。"
|
||||
ROLLBACK_STARTED: "{回滾|恢復|預覽}開始於 \"{0}\"。"
|
||||
ROLLBACK_RADIUS: "範圍: {0} 格{方塊|方塊}。"
|
||||
ROLLBACK_SELECTION: "選擇範圍為「{0}」。"
|
||||
ROLLBACK_STARTED: "{回滾|恢復|預覽}開始於「{0}」。"
|
||||
ROLLBACK_TIME: "時間範圍: {0}。"
|
||||
ROLLBACK_WORLD_ACTION: "限制{世界|互動} \"{0}\"。"
|
||||
ROLLBACK_WORLD_ACTION: "限制{世界|行為}「{0}」。"
|
||||
SIGN_HEADER: "簽名訊息"
|
||||
STATUS_CONSUMER: "玩家: {0} 個{物品|物品}已在隊列中。"
|
||||
STATUS_CONSUMER: "消費者隊列: {0} 筆{資料|資料}在隊列中。"
|
||||
STATUS_DATABASE: "資料庫: 使用 {0}。"
|
||||
STATUS_INTEGRATION: "{0}: 整合{開啟|關閉}。"
|
||||
STATUS_INTEGRATION: "{0}: 整合{啟用|停用}。"
|
||||
STATUS_LICENSE: "憑證: {0}"
|
||||
STATUS_VERSION: "版本: {0}"
|
||||
TELEPORTED: "傳送到 {0}。"
|
||||
@@ -192,11 +192,11 @@ UPDATE_ERROR: "檢查更新時發生錯誤。"
|
||||
UPDATE_HEADER: "{0} 更新"
|
||||
UPDATE_NOTICE: "通知: {0} 現已推出。"
|
||||
UPGRADE_IN_PROGRESS: "正在進行更新,請稍後再試。"
|
||||
USER_NOT_FOUND: "找不到玩家 \"{0}\"。"
|
||||
USER_OFFLINE: "用戶 \"{0}\"不在線。"
|
||||
USER_NOT_FOUND: "未找到玩家「{0}」。"
|
||||
USER_OFFLINE: "用戶「{0}」不在線上。"
|
||||
USING_MYSQL: "使用 MySQL 進行資料儲存。"
|
||||
USING_SQLITE: "使用 SQLite 進行資料儲存。"
|
||||
VALID_DONATION_KEY: "有效的贈品金鑰"
|
||||
VALID_DONATION_KEY: "有效的贊助金鑰"
|
||||
VERSION_NOTICE: "版本 {0} 現已推出。"
|
||||
VERSION_REQUIRED: "{0} 需要使用 {1} 或更高版本。"
|
||||
WORLD_NOT_FOUND: "世界: \"{0}\" 不存在。"
|
||||
WORLD_NOT_FOUND: "世界「{0}」不存在。"
|
||||
@@ -2,7 +2,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>net.coreprotect</groupId>
|
||||
<artifactId>CoreProtect</artifactId>
|
||||
<version>21.1</version>
|
||||
<version>22.1</version>
|
||||
<properties>
|
||||
<project.branch></project.branch>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
@@ -51,6 +51,14 @@
|
||||
</excludes>
|
||||
</filter>
|
||||
</filters>
|
||||
<artifactSet>
|
||||
<excludes>
|
||||
<exclude>com.google.code.gson:*</exclude>
|
||||
<exclude>org.intellij:*</exclude>
|
||||
<exclude>org.jetbrains:*</exclude>
|
||||
<exclude>org.slf4j:*</exclude>
|
||||
</excludes>
|
||||
</artifactSet>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>org.bstats</pattern>
|
||||
@@ -74,7 +82,7 @@
|
||||
</repository>
|
||||
<repository>
|
||||
<id>paper-repo</id>
|
||||
<url>https://papermc.io/repo/repository/maven-public/</url>
|
||||
<url>https://repo.papermc.io/repository/maven-public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>codemc-repo</id>
|
||||
@@ -87,14 +95,15 @@
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<!--
|
||||
paper-api: io.papermc.paper
|
||||
paper-api (<= 1.16): com.destroystokyo.paper
|
||||
spigot-api: org.spigotmc
|
||||
bukkit: org.bukkit
|
||||
-->
|
||||
<dependency>
|
||||
<groupId>io.papermc.paper</groupId>
|
||||
<artifactId>paper-api</artifactId>
|
||||
<version>1.18.1-R0.1-SNAPSHOT</version>
|
||||
<groupId>dev.folia</groupId>
|
||||
<artifactId>folia-api</artifactId>
|
||||
<version>1.20.1-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -118,7 +127,7 @@
|
||||
<dependency>
|
||||
<groupId>com.zaxxer</groupId>
|
||||
<artifactId>HikariCP</artifactId>
|
||||
<version>4.0.3</version>
|
||||
<version>5.0.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
+1
-1
@@ -1 +1 @@
|
||||
mkdocs==1.2.3
|
||||
mkdocs==1.3.1
|
||||
@@ -14,7 +14,6 @@ import net.coreprotect.config.Config;
|
||||
import net.coreprotect.config.ConfigHandler;
|
||||
import net.coreprotect.consumer.Consumer;
|
||||
import net.coreprotect.consumer.process.Process;
|
||||
import net.coreprotect.database.Database;
|
||||
import net.coreprotect.language.Language;
|
||||
import net.coreprotect.language.Phrase;
|
||||
import net.coreprotect.listener.ListenerHandler;
|
||||
@@ -22,6 +21,7 @@ import net.coreprotect.listener.player.PlayerQuitListener;
|
||||
import net.coreprotect.paper.PaperAdapter;
|
||||
import net.coreprotect.thread.CacheHandler;
|
||||
import net.coreprotect.thread.NetworkHandler;
|
||||
import net.coreprotect.thread.Scheduler;
|
||||
import net.coreprotect.utility.Chat;
|
||||
import net.coreprotect.utility.Color;
|
||||
import net.coreprotect.utility.Util;
|
||||
@@ -95,7 +95,7 @@ public final class CoreProtect extends JavaPlugin {
|
||||
Chat.console(Phrase.build(Phrase.LINK_DISCORD, "www.coreprotect.net/discord/"));
|
||||
Chat.console("--------------------");
|
||||
|
||||
getServer().getScheduler().scheduleSyncDelayedTask(this, () -> {
|
||||
Scheduler.scheduleSyncDelayedTask(this, () -> {
|
||||
try {
|
||||
Thread networkHandler = new Thread(new NetworkHandler(true, true));
|
||||
networkHandler.start();
|
||||
@@ -162,7 +162,7 @@ public final class CoreProtect extends JavaPlugin {
|
||||
private static void safeShutdown(CoreProtect plugin) {
|
||||
try {
|
||||
/* if server is stopping, log disconnections of online players */
|
||||
if (PaperAdapter.ADAPTER.isStopping(plugin.getServer())) {
|
||||
if (ConfigHandler.serverRunning && PaperAdapter.ADAPTER.isStopping(plugin.getServer())) {
|
||||
for (Player player : plugin.getServer().getOnlinePlayers()) {
|
||||
PlayerQuitListener.queuePlayerQuit(player);
|
||||
}
|
||||
@@ -200,7 +200,7 @@ public final class CoreProtect extends JavaPlugin {
|
||||
Thread.sleep(100);
|
||||
}
|
||||
|
||||
Database.closeConnection();
|
||||
ConfigHandler.performDisable();
|
||||
Chat.console(Phrase.build(Phrase.DISABLE_SUCCESS, "CoreProtect v" + plugin.getDescription().getVersion()));
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
||||
@@ -191,8 +191,8 @@ public class CoreProtectAPI extends Queue {
|
||||
boolean match = false;
|
||||
|
||||
if (Config.getGlobal().API_ENABLED) {
|
||||
long timestamp = System.currentTimeMillis() / 1000L;
|
||||
long offsetTime = timestamp - offset;
|
||||
long timestamp = System.currentTimeMillis();
|
||||
long offsetTime = timestamp - offset * 1000L;
|
||||
List<String[]> check = blockLookup(block, time);
|
||||
|
||||
for (String[] value : check) {
|
||||
@@ -212,8 +212,8 @@ public class CoreProtectAPI extends Queue {
|
||||
boolean match = false;
|
||||
|
||||
if (Config.getGlobal().API_ENABLED) {
|
||||
long timestamp = System.currentTimeMillis() / 1000L;
|
||||
long offsetTime = timestamp - offset;
|
||||
long timestamp = System.currentTimeMillis();
|
||||
long offsetTime = timestamp - offset * 1000L;
|
||||
List<String[]> check = blockLookup(block, time);
|
||||
|
||||
for (String[] value : check) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package net.coreprotect.api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -74,6 +75,7 @@ public class QueueLookup extends Queue {
|
||||
}
|
||||
}
|
||||
|
||||
Collections.reverse(result);
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -3,9 +3,13 @@ package net.coreprotect.bukkit;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Tag;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.Directional;
|
||||
@@ -13,7 +17,8 @@ import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.ItemFrame;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.block.SignChangeEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.MerchantRecipe;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
@@ -30,15 +35,15 @@ public class BukkitAdapter implements BukkitInterface {
|
||||
public static final int BUKKIT_V1_16 = 16;
|
||||
public static final int BUKKIT_V1_17 = 17;
|
||||
public static final int BUKKIT_V1_18 = 18;
|
||||
public static final int BUKKIT_V1_19 = 19;
|
||||
public static final int BUKKIT_V1_20 = 20;
|
||||
|
||||
public static void loadAdapter() {
|
||||
switch (ConfigHandler.SERVER_VERSION) {
|
||||
case BUKKIT_V1_13:
|
||||
case BUKKIT_V1_14:
|
||||
BukkitAdapter.ADAPTER = new BukkitAdapter();
|
||||
break;
|
||||
case BUKKIT_V1_15:
|
||||
BukkitAdapter.ADAPTER = new Bukkit_v1_15();
|
||||
BukkitAdapter.ADAPTER = new BukkitAdapter();
|
||||
break;
|
||||
case BUKKIT_V1_16:
|
||||
BukkitAdapter.ADAPTER = new Bukkit_v1_16();
|
||||
@@ -47,9 +52,15 @@ public class BukkitAdapter implements BukkitInterface {
|
||||
BukkitAdapter.ADAPTER = new Bukkit_v1_17();
|
||||
break;
|
||||
case BUKKIT_V1_18:
|
||||
default:
|
||||
BukkitAdapter.ADAPTER = new Bukkit_v1_18();
|
||||
break;
|
||||
case BUKKIT_V1_19:
|
||||
BukkitAdapter.ADAPTER = new Bukkit_v1_19();
|
||||
break;
|
||||
case BUKKIT_V1_20:
|
||||
default:
|
||||
BukkitAdapter.ADAPTER = new Bukkit_v1_20();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,11 +108,6 @@ public class BukkitAdapter implements BukkitInterface {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendSignChange(Player player, Sign sign) {
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinHeight(World world) {
|
||||
return 0;
|
||||
@@ -133,13 +139,13 @@ public class BukkitAdapter implements BukkitInterface {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGlowing(Sign sign) {
|
||||
public boolean isGlowing(Sign sign, boolean isFront) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGlowing(Sign sign, boolean set) {
|
||||
return;
|
||||
public boolean isWaxed(Sign sign) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -152,4 +158,104 @@ public class BukkitAdapter implements BukkitInterface {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGlowing(Sign sign, boolean isFront, boolean isGlowing) {
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setColor(Sign sign, boolean isFront, int color) {
|
||||
if (!isFront) {
|
||||
return;
|
||||
}
|
||||
|
||||
sign.setColor(DyeColor.getByColor(Color.fromRGB(color)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWaxed(Sign sign, boolean isWaxed) {
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor(Sign sign, boolean isFront) {
|
||||
if (isFront) {
|
||||
return sign.getColor().getColor().asRGB();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Material getPlantSeeds(Material material) {
|
||||
switch (material) {
|
||||
case WHEAT:
|
||||
material = Material.WHEAT_SEEDS;
|
||||
break;
|
||||
case PUMPKIN_STEM:
|
||||
material = Material.PUMPKIN_SEEDS;
|
||||
break;
|
||||
case MELON_STEM:
|
||||
material = Material.MELON_SEEDS;
|
||||
break;
|
||||
case BEETROOTS:
|
||||
material = Material.BEETROOT_SEEDS;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
return material;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSuspiciousBlock(Material material) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSign(Material material) {
|
||||
return Tag.SIGNS.isTagged(material);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isChiseledBookshelf(Material material) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBookshelfBook(Material material) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getChiseledBookshelfBook(BlockState blockState, PlayerInteractEvent event) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLine(Sign sign, int line) {
|
||||
if (line < 4) {
|
||||
return sign.getLine(line);
|
||||
}
|
||||
else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLine(Sign sign, int line, String string) {
|
||||
if (string == null) {
|
||||
string = "";
|
||||
}
|
||||
|
||||
if (line < 4) {
|
||||
sign.setLine(line, string);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSignFront(SignChangeEvent event) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,12 +6,14 @@ import java.util.Map;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.block.SignChangeEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.MerchantRecipe;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
@@ -44,16 +46,40 @@ public interface BukkitInterface {
|
||||
|
||||
public boolean isItemFrame(Material material);
|
||||
|
||||
public boolean isGlowing(Sign sign);
|
||||
public boolean isGlowing(Sign sign, boolean isFront);
|
||||
|
||||
public boolean isInvisible(Material material);
|
||||
|
||||
public boolean isWaxed(Sign sign);
|
||||
|
||||
public int getMinHeight(World world);
|
||||
|
||||
public int getLegacyBlockId(Material material);
|
||||
|
||||
public void sendSignChange(Player player, Sign sign);
|
||||
public void setGlowing(Sign sign, boolean isFront, boolean isGlowing);
|
||||
|
||||
public void setGlowing(Sign sign, boolean b);
|
||||
public void setColor(Sign sign, boolean isFront, int color);
|
||||
|
||||
public void setWaxed(Sign sign, boolean isWaxed);
|
||||
|
||||
public int getColor(Sign sign, boolean isFront);
|
||||
|
||||
public Material getPlantSeeds(Material material);
|
||||
|
||||
public boolean isSuspiciousBlock(Material material);
|
||||
|
||||
public boolean isSign(Material material);
|
||||
|
||||
public boolean isChiseledBookshelf(Material material);
|
||||
|
||||
public boolean isBookshelfBook(Material material);
|
||||
|
||||
public ItemStack getChiseledBookshelfBook(BlockState blockState, PlayerInteractEvent event);
|
||||
|
||||
public String getLine(Sign sign, int line);
|
||||
|
||||
public void setLine(Sign sign, int line, String string);
|
||||
|
||||
public boolean isSignFront(SignChangeEvent event);
|
||||
|
||||
}
|
||||
@@ -1,105 +0,0 @@
|
||||
package net.coreprotect.bukkit;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.entity.Bee;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.SuspiciousStewMeta;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
|
||||
public class Bukkit_v1_15 extends BukkitAdapter implements BukkitInterface {
|
||||
|
||||
@Override
|
||||
public boolean getEntityMeta(LivingEntity entity, List<Object> info) {
|
||||
if (entity instanceof Bee) {
|
||||
Bee bee = (Bee) entity;
|
||||
info.add(bee.getAnger());
|
||||
info.add(bee.hasNectar());
|
||||
info.add(bee.hasStung());
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setEntityMeta(Entity entity, Object value, int count) {
|
||||
if (entity instanceof Bee) {
|
||||
Bee bee = (Bee) entity;
|
||||
if (count == 0) {
|
||||
int set = (int) value;
|
||||
bee.setAnger(set);
|
||||
}
|
||||
else if (count == 1) {
|
||||
boolean set = (Boolean) value;
|
||||
bee.setHasNectar(set);
|
||||
}
|
||||
else if (count == 2) {
|
||||
boolean set = (Boolean) value;
|
||||
bee.setHasStung(set);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getItemMeta(ItemMeta itemMeta, List<Map<String, Object>> list, List<List<Map<String, Object>>> metadata, int slot) {
|
||||
if (itemMeta instanceof SuspiciousStewMeta) {
|
||||
SuspiciousStewMeta meta = (SuspiciousStewMeta) itemMeta;
|
||||
SuspiciousStewMeta subMeta = meta.clone();
|
||||
meta.clearCustomEffects();
|
||||
list.add(meta.serialize());
|
||||
metadata.add(list);
|
||||
|
||||
if (subMeta.hasCustomEffects()) {
|
||||
for (PotionEffect effect : subMeta.getCustomEffects()) {
|
||||
list = new ArrayList<>();
|
||||
list.add(effect.serialize());
|
||||
metadata.add(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setItemMeta(Material rowType, ItemStack itemstack, List<Map<String, Object>> map) {
|
||||
if ((rowType == Material.SUSPICIOUS_STEW)) {
|
||||
for (Map<String, Object> suspiciousStewData : map) {
|
||||
SuspiciousStewMeta meta = (SuspiciousStewMeta) itemstack.getItemMeta();
|
||||
PotionEffect effect = new PotionEffect(suspiciousStewData);
|
||||
meta.addCustomEffect(effect, true);
|
||||
itemstack.setItemMeta(meta);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendSignChange(Player player, Sign sign) {
|
||||
player.sendSignChange(sign.getLocation(), sign.getLines(), sign.getColor());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,7 +17,7 @@ import org.bukkit.entity.Zoglin;
|
||||
|
||||
import net.coreprotect.model.BlockGroup;
|
||||
|
||||
public class Bukkit_v1_16 extends Bukkit_v1_15 implements BukkitInterface {
|
||||
public class Bukkit_v1_16 extends BukkitAdapter implements BukkitInterface {
|
||||
|
||||
public Bukkit_v1_16() {
|
||||
BlockGroup.TRACK_TOP = new HashSet<>(Arrays.asList(Material.TORCH, Material.REDSTONE_TORCH, Material.BAMBOO, Material.BAMBOO_SAPLING, Material.CORNFLOWER, Material.LILY_OF_THE_VALLEY, Material.WITHER_ROSE, Material.SWEET_BERRY_BUSH, Material.SCAFFOLDING, Material.OAK_SAPLING, Material.SPRUCE_SAPLING, Material.BIRCH_SAPLING, Material.JUNGLE_SAPLING, Material.ACACIA_SAPLING, Material.DARK_OAK_SAPLING, Material.POWERED_RAIL, Material.DETECTOR_RAIL, Material.GRASS, Material.FERN, Material.DEAD_BUSH, Material.DANDELION, Material.POPPY, Material.BLUE_ORCHID, Material.ALLIUM, Material.AZURE_BLUET, Material.RED_TULIP, Material.ORANGE_TULIP, Material.WHITE_TULIP, Material.PINK_TULIP, Material.OXEYE_DAISY, Material.BROWN_MUSHROOM, Material.RED_MUSHROOM, Material.REDSTONE_WIRE, Material.WHEAT, Material.ACACIA_SIGN, Material.BIRCH_SIGN, Material.DARK_OAK_SIGN, Material.JUNGLE_SIGN, Material.OAK_SIGN, Material.SPRUCE_SIGN, Material.WHITE_BANNER, Material.ORANGE_BANNER, Material.MAGENTA_BANNER, Material.LIGHT_BLUE_BANNER, Material.YELLOW_BANNER, Material.LIME_BANNER, Material.PINK_BANNER, Material.GRAY_BANNER, Material.LIGHT_GRAY_BANNER, Material.CYAN_BANNER, Material.PURPLE_BANNER, Material.BLUE_BANNER, Material.BROWN_BANNER, Material.GREEN_BANNER, Material.RED_BANNER, Material.BLACK_BANNER, Material.RAIL, Material.IRON_DOOR, Material.SNOW, Material.CACTUS, Material.SUGAR_CANE, Material.REPEATER, Material.PUMPKIN_STEM, Material.MELON_STEM, Material.CARROT, Material.POTATO, Material.COMPARATOR, Material.ACTIVATOR_RAIL, Material.SUNFLOWER, Material.LILAC, Material.TALL_GRASS, Material.LARGE_FERN, Material.ROSE_BUSH, Material.PEONY, Material.NETHER_WART, Material.CHORUS_PLANT, Material.CHORUS_FLOWER, Material.KELP, Material.SOUL_TORCH, Material.TWISTING_VINES, Material.CRIMSON_FUNGUS, Material.WARPED_FUNGUS, Material.CRIMSON_ROOTS, Material.WARPED_ROOTS, Material.NETHER_SPROUTS, Material.CRIMSON_SIGN, Material.WARPED_SIGN));
|
||||
|
||||
@@ -218,13 +218,21 @@ public class Bukkit_v1_17 extends Bukkit_v1_16 implements BukkitInterface {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGlowing(Sign sign) {
|
||||
public boolean isGlowing(Sign sign, boolean isFront) {
|
||||
if (!isFront) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return sign.isGlowingText();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGlowing(Sign sign, boolean set) {
|
||||
sign.setGlowingText(set);
|
||||
public void setGlowing(Sign sign, boolean isFront, boolean isGlowing) {
|
||||
if (!isFront) {
|
||||
return;
|
||||
}
|
||||
|
||||
sign.setGlowingText(isGlowing);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
package net.coreprotect.bukkit;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Frog;
|
||||
import org.bukkit.entity.Goat;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Tadpole;
|
||||
|
||||
import net.coreprotect.model.BlockGroup;
|
||||
|
||||
public class Bukkit_v1_19 extends Bukkit_v1_18 implements BukkitInterface {
|
||||
|
||||
public Bukkit_v1_19() {
|
||||
BlockGroup.TRACK_TOP = new HashSet<>(Arrays.asList(Material.TORCH, Material.REDSTONE_TORCH, Material.BAMBOO, Material.BAMBOO_SAPLING, Material.CORNFLOWER, Material.LILY_OF_THE_VALLEY, Material.WITHER_ROSE, Material.SWEET_BERRY_BUSH, Material.SCAFFOLDING, Material.OAK_SAPLING, Material.SPRUCE_SAPLING, Material.BIRCH_SAPLING, Material.JUNGLE_SAPLING, Material.MANGROVE_PROPAGULE, Material.ACACIA_SAPLING, Material.DARK_OAK_SAPLING, Material.POWERED_RAIL, Material.DETECTOR_RAIL, Material.GRASS, Material.FERN, Material.DEAD_BUSH, Material.DANDELION, Material.POPPY, Material.BLUE_ORCHID, Material.ALLIUM, Material.AZURE_BLUET, Material.RED_TULIP, Material.ORANGE_TULIP, Material.WHITE_TULIP, Material.PINK_TULIP, Material.OXEYE_DAISY, Material.BROWN_MUSHROOM, Material.RED_MUSHROOM, Material.REDSTONE_WIRE, Material.WHEAT, Material.MANGROVE_SIGN, Material.ACACIA_SIGN, Material.BIRCH_SIGN, Material.DARK_OAK_SIGN, Material.JUNGLE_SIGN, Material.OAK_SIGN, Material.SPRUCE_SIGN, Material.WHITE_BANNER, Material.ORANGE_BANNER, Material.MAGENTA_BANNER, Material.LIGHT_BLUE_BANNER, Material.YELLOW_BANNER, Material.LIME_BANNER, Material.PINK_BANNER, Material.GRAY_BANNER, Material.LIGHT_GRAY_BANNER, Material.CYAN_BANNER, Material.PURPLE_BANNER, Material.BLUE_BANNER, Material.BROWN_BANNER, Material.GREEN_BANNER, Material.RED_BANNER, Material.BLACK_BANNER, Material.RAIL, Material.IRON_DOOR, Material.SNOW, Material.CACTUS, Material.SUGAR_CANE, Material.REPEATER, Material.PUMPKIN_STEM, Material.MELON_STEM, Material.CARROT, Material.POTATO, Material.COMPARATOR, Material.ACTIVATOR_RAIL, Material.SUNFLOWER, Material.LILAC, Material.TALL_GRASS, Material.LARGE_FERN, Material.ROSE_BUSH, Material.PEONY, Material.NETHER_WART, Material.CHORUS_PLANT, Material.CHORUS_FLOWER, Material.KELP, Material.SOUL_TORCH, Material.TWISTING_VINES, Material.CRIMSON_FUNGUS, Material.WARPED_FUNGUS, Material.CRIMSON_ROOTS, Material.WARPED_ROOTS, Material.NETHER_SPROUTS, Material.CRIMSON_SIGN, Material.WARPED_SIGN, Material.AZALEA, Material.FLOWERING_AZALEA, Material.SMALL_DRIPLEAF, Material.BIG_DRIPLEAF));
|
||||
BlockGroup.TRACK_SIDE = new HashSet<>(Arrays.asList(Material.WALL_TORCH, Material.REDSTONE_WALL_TORCH, Material.RAIL, Material.POWERED_RAIL, Material.DETECTOR_RAIL, Material.ACTIVATOR_RAIL, Material.WHITE_BED, Material.ORANGE_BED, Material.MAGENTA_BED, Material.LIGHT_BLUE_BED, Material.YELLOW_BED, Material.LIME_BED, Material.PINK_BED, Material.GRAY_BED, Material.LIGHT_GRAY_BED, Material.CYAN_BED, Material.PURPLE_BED, Material.BLUE_BED, Material.BROWN_BED, Material.GREEN_BED, Material.RED_BED, Material.BLACK_BED, Material.LADDER, Material.MANGROVE_WALL_SIGN, Material.ACACIA_WALL_SIGN, Material.BIRCH_WALL_SIGN, Material.DARK_OAK_WALL_SIGN, Material.JUNGLE_WALL_SIGN, Material.OAK_WALL_SIGN, Material.SPRUCE_WALL_SIGN, Material.VINE, Material.COCOA, Material.TRIPWIRE_HOOK, Material.WHITE_WALL_BANNER, Material.ORANGE_WALL_BANNER, Material.MAGENTA_WALL_BANNER, Material.LIGHT_BLUE_WALL_BANNER, Material.YELLOW_WALL_BANNER, Material.LIME_WALL_BANNER, Material.PINK_WALL_BANNER, Material.GRAY_WALL_BANNER, Material.LIGHT_GRAY_WALL_BANNER, Material.CYAN_WALL_BANNER, Material.PURPLE_WALL_BANNER, Material.BLUE_WALL_BANNER, Material.BROWN_WALL_BANNER, Material.GREEN_WALL_BANNER, Material.RED_WALL_BANNER, Material.BLACK_WALL_BANNER, Material.SOUL_WALL_TORCH, Material.CRIMSON_WALL_SIGN, Material.WARPED_WALL_SIGN));
|
||||
BlockGroup.DOORS = new HashSet<>(Arrays.asList(Material.OAK_DOOR, Material.SPRUCE_DOOR, Material.BIRCH_DOOR, Material.JUNGLE_DOOR, Material.MANGROVE_DOOR, Material.ACACIA_DOOR, Material.DARK_OAK_DOOR, Material.CRIMSON_DOOR, Material.WARPED_DOOR));
|
||||
BlockGroup.BUTTONS = new HashSet<>(Arrays.asList(Material.STONE_BUTTON, Material.OAK_BUTTON, Material.MANGROVE_BUTTON, Material.ACACIA_BUTTON, Material.BIRCH_BUTTON, Material.DARK_OAK_BUTTON, Material.JUNGLE_BUTTON, Material.SPRUCE_BUTTON, Material.POLISHED_BLACKSTONE_BUTTON, Material.CRIMSON_BUTTON, Material.WARPED_BUTTON));
|
||||
BlockGroup.PRESSURE_PLATES = new HashSet<>(Arrays.asList(Material.STONE_PRESSURE_PLATE, Material.MANGROVE_PRESSURE_PLATE, Material.ACACIA_PRESSURE_PLATE, Material.BIRCH_PRESSURE_PLATE, Material.DARK_OAK_PRESSURE_PLATE, Material.HEAVY_WEIGHTED_PRESSURE_PLATE, Material.JUNGLE_PRESSURE_PLATE, Material.LIGHT_WEIGHTED_PRESSURE_PLATE, Material.OAK_PRESSURE_PLATE, Material.SPRUCE_PRESSURE_PLATE, Material.CRIMSON_PRESSURE_PLATE, Material.WARPED_PRESSURE_PLATE, Material.POLISHED_BLACKSTONE_PRESSURE_PLATE));
|
||||
BlockGroup.INTERACT_BLOCKS = new HashSet<>(Arrays.asList(Material.SPRUCE_FENCE_GATE, Material.BIRCH_FENCE_GATE, Material.JUNGLE_FENCE_GATE, Material.DARK_OAK_FENCE_GATE, Material.MANGROVE_FENCE_GATE, Material.ACACIA_FENCE_GATE, Material.DISPENSER, Material.NOTE_BLOCK, Material.CHEST, Material.FURNACE, Material.LEVER, Material.REPEATER, Material.MANGROVE_TRAPDOOR, Material.ACACIA_TRAPDOOR, Material.BIRCH_TRAPDOOR, Material.DARK_OAK_TRAPDOOR, Material.JUNGLE_TRAPDOOR, Material.SPRUCE_TRAPDOOR, Material.OAK_TRAPDOOR, Material.OAK_FENCE_GATE, Material.BREWING_STAND, Material.ANVIL, Material.CHIPPED_ANVIL, Material.DAMAGED_ANVIL, Material.ENDER_CHEST, Material.TRAPPED_CHEST, Material.COMPARATOR, Material.HOPPER, Material.DROPPER, Material.SHULKER_BOX, Material.BLACK_SHULKER_BOX, Material.BLUE_SHULKER_BOX, Material.BROWN_SHULKER_BOX, Material.CYAN_SHULKER_BOX, Material.GRAY_SHULKER_BOX, Material.GREEN_SHULKER_BOX, Material.LIGHT_BLUE_SHULKER_BOX, Material.LIME_SHULKER_BOX, Material.MAGENTA_SHULKER_BOX, Material.ORANGE_SHULKER_BOX, Material.PINK_SHULKER_BOX, Material.PURPLE_SHULKER_BOX, Material.RED_SHULKER_BOX, Material.LIGHT_GRAY_SHULKER_BOX, Material.WHITE_SHULKER_BOX, Material.YELLOW_SHULKER_BOX, Material.BARREL, Material.BLAST_FURNACE, Material.GRINDSTONE, Material.LOOM, Material.SMOKER, Material.CRAFTING_TABLE, Material.CARTOGRAPHY_TABLE, Material.ENCHANTING_TABLE, Material.SMITHING_TABLE, Material.STONECUTTER, Material.CRIMSON_FENCE_GATE, Material.WARPED_FENCE_GATE, Material.CRIMSON_TRAPDOOR, Material.WARPED_TRAPDOOR));
|
||||
BlockGroup.SAFE_INTERACT_BLOCKS = new HashSet<>(Arrays.asList(Material.LEVER, Material.MANGROVE_TRAPDOOR, Material.ACACIA_TRAPDOOR, Material.BIRCH_TRAPDOOR, Material.DARK_OAK_TRAPDOOR, Material.JUNGLE_TRAPDOOR, Material.SPRUCE_TRAPDOOR, Material.OAK_TRAPDOOR, Material.OAK_FENCE_GATE, Material.SPRUCE_FENCE_GATE, Material.BIRCH_FENCE_GATE, Material.JUNGLE_FENCE_GATE, Material.DARK_OAK_FENCE_GATE, Material.MANGROVE_FENCE_GATE, Material.ACACIA_FENCE_GATE, Material.CRIMSON_FENCE_GATE, Material.WARPED_FENCE_GATE, Material.CRIMSON_TRAPDOOR, Material.WARPED_TRAPDOOR));
|
||||
BlockGroup.NON_ATTACHABLE = new HashSet<>(Arrays.asList(Material.AIR, Material.CAVE_AIR, Material.BARRIER, Material.CORNFLOWER, Material.LILY_OF_THE_VALLEY, Material.WITHER_ROSE, Material.SWEET_BERRY_BUSH, Material.OAK_SAPLING, Material.SPRUCE_SAPLING, Material.BIRCH_SAPLING, Material.JUNGLE_SAPLING, Material.MANGROVE_PROPAGULE, Material.ACACIA_SAPLING, Material.DARK_OAK_SAPLING, Material.WATER, Material.LAVA, Material.POWERED_RAIL, Material.DETECTOR_RAIL, Material.GRASS, Material.FERN, Material.DEAD_BUSH, Material.DANDELION, Material.POPPY, Material.BLUE_ORCHID, Material.ALLIUM, Material.AZURE_BLUET, Material.RED_TULIP, Material.ORANGE_TULIP, Material.WHITE_TULIP, Material.PINK_TULIP, Material.OXEYE_DAISY, Material.BROWN_MUSHROOM, Material.RED_MUSHROOM, Material.TORCH, Material.WALL_TORCH, Material.REDSTONE_WIRE, Material.LADDER, Material.RAIL, Material.LEVER, Material.REDSTONE_TORCH, Material.REDSTONE_WALL_TORCH, Material.SNOW, Material.SUGAR_CANE, Material.NETHER_PORTAL, Material.REPEATER, Material.KELP, Material.CHORUS_FLOWER, Material.CHORUS_PLANT, Material.SOUL_TORCH, Material.SOUL_WALL_TORCH, Material.LIGHT, Material.SMALL_DRIPLEAF, Material.BIG_DRIPLEAF, Material.BIG_DRIPLEAF_STEM, Material.GLOW_LICHEN, Material.HANGING_ROOTS));
|
||||
BlockGroup.SCULK = new HashSet<>(Arrays.asList(Material.SCULK, Material.SCULK_VEIN, Material.SCULK_SENSOR, Material.SCULK_SHRIEKER));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getEntityMeta(LivingEntity entity, List<Object> info) {
|
||||
if (entity instanceof Frog) {
|
||||
Frog frog = (Frog) entity;
|
||||
info.add(frog.getVariant());
|
||||
}
|
||||
else if (entity instanceof Tadpole) {
|
||||
Tadpole tadpole = (Tadpole) entity;
|
||||
info.add(tadpole.getAge());
|
||||
}
|
||||
else if (entity instanceof Goat) {
|
||||
Goat goat = (Goat) entity;
|
||||
info.add(goat.isScreaming());
|
||||
info.add(goat.hasLeftHorn());
|
||||
info.add(goat.hasRightHorn());
|
||||
}
|
||||
else if (super.getEntityMeta(entity, info)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setEntityMeta(Entity entity, Object value, int count) {
|
||||
if (entity instanceof Frog) {
|
||||
Frog frog = (Frog) entity;
|
||||
if (count == 0) {
|
||||
Frog.Variant set = (Frog.Variant) value;
|
||||
frog.setVariant(set);
|
||||
}
|
||||
}
|
||||
else if (entity instanceof Tadpole) {
|
||||
Tadpole tadpole = (Tadpole) entity;
|
||||
if (count == 0) {
|
||||
int set = (int) value;
|
||||
tadpole.setAge(set);
|
||||
}
|
||||
}
|
||||
else if (entity instanceof Goat) {
|
||||
Goat goat = (Goat) entity;
|
||||
boolean set = (Boolean) value;
|
||||
if (count == 0) {
|
||||
goat.setScreaming(set);
|
||||
}
|
||||
else if (count == 1) {
|
||||
goat.setLeftHorn(set);
|
||||
}
|
||||
else if (count == 2) {
|
||||
goat.setRightHorn(set);
|
||||
}
|
||||
}
|
||||
else if (super.setEntityMeta(entity, value, count)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,231 @@
|
||||
package net.coreprotect.bukkit;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Tag;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.ChiseledBookshelf;
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.block.sign.Side;
|
||||
import org.bukkit.event.block.SignChangeEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import net.coreprotect.model.BlockGroup;
|
||||
|
||||
public class Bukkit_v1_20 extends Bukkit_v1_19 implements BukkitInterface {
|
||||
|
||||
private Boolean hasClickedPosition = null;
|
||||
|
||||
public Bukkit_v1_20() {
|
||||
BlockGroup.CONTAINERS = new HashSet<>(Arrays.asList(Material.JUKEBOX, Material.DISPENSER, Material.CHEST, Material.FURNACE, Material.BREWING_STAND, Material.TRAPPED_CHEST, Material.HOPPER, Material.DROPPER, Material.ARMOR_STAND, Material.ITEM_FRAME, Material.SHULKER_BOX, Material.BLACK_SHULKER_BOX, Material.BLUE_SHULKER_BOX, Material.BROWN_SHULKER_BOX, Material.CYAN_SHULKER_BOX, Material.GRAY_SHULKER_BOX, Material.GREEN_SHULKER_BOX, Material.LIGHT_BLUE_SHULKER_BOX, Material.LIME_SHULKER_BOX, Material.MAGENTA_SHULKER_BOX, Material.ORANGE_SHULKER_BOX, Material.PINK_SHULKER_BOX, Material.PURPLE_SHULKER_BOX, Material.RED_SHULKER_BOX, Material.LIGHT_GRAY_SHULKER_BOX, Material.WHITE_SHULKER_BOX, Material.YELLOW_SHULKER_BOX, Material.BARREL, Material.BLAST_FURNACE, Material.SMOKER, Material.LECTERN, Material.CHISELED_BOOKSHELF));
|
||||
BlockGroup.UPDATE_STATE = new HashSet<>(Arrays.asList(Material.TORCH, Material.WALL_TORCH, Material.REDSTONE_WIRE, Material.RAIL, Material.POWERED_RAIL, Material.DETECTOR_RAIL, Material.FURNACE, Material.BLAST_FURNACE, Material.SMOKER, Material.LEVER, Material.REDSTONE_TORCH, Material.REDSTONE_WALL_TORCH, Material.GLOWSTONE, Material.JACK_O_LANTERN, Material.REPEATER, Material.REDSTONE_LAMP, Material.BEACON, Material.COMPARATOR, Material.DAYLIGHT_DETECTOR, Material.REDSTONE_BLOCK, Material.HOPPER, Material.CHEST, Material.TRAPPED_CHEST, Material.ACTIVATOR_RAIL, Material.SOUL_TORCH, Material.SOUL_WALL_TORCH, Material.SHROOMLIGHT, Material.RESPAWN_ANCHOR, Material.CRYING_OBSIDIAN, Material.TARGET, Material.SMALL_AMETHYST_BUD, Material.MEDIUM_AMETHYST_BUD, Material.LARGE_AMETHYST_BUD, Material.AMETHYST_CLUSTER, Material.CAVE_VINES, Material.CAVE_VINES_PLANT, Material.GLOW_LICHEN, Material.LIGHT, Material.LAVA_CAULDRON, Material.CHISELED_BOOKSHELF));
|
||||
|
||||
BlockGroup.BUTTONS.clear();
|
||||
BlockGroup.BUTTONS.addAll(Tag.BUTTONS.getValues());
|
||||
BlockGroup.PRESSURE_PLATES.clear();
|
||||
BlockGroup.PRESSURE_PLATES.addAll(Tag.PRESSURE_PLATES.getValues());
|
||||
|
||||
for (Material value : Tag.DOORS.getValues()) {
|
||||
if (!BlockGroup.DOORS.contains(value)) {
|
||||
BlockGroup.DOORS.add(value);
|
||||
}
|
||||
}
|
||||
for (Material value : Tag.FENCE_GATES.getValues()) {
|
||||
if (!BlockGroup.INTERACT_BLOCKS.contains(value)) {
|
||||
BlockGroup.INTERACT_BLOCKS.add(value);
|
||||
}
|
||||
if (!BlockGroup.SAFE_INTERACT_BLOCKS.contains(value)) {
|
||||
BlockGroup.SAFE_INTERACT_BLOCKS.add(value);
|
||||
}
|
||||
}
|
||||
for (Material value : Tag.WOODEN_TRAPDOORS.getValues()) {
|
||||
if (!BlockGroup.INTERACT_BLOCKS.contains(value)) {
|
||||
BlockGroup.INTERACT_BLOCKS.add(value);
|
||||
}
|
||||
if (!BlockGroup.SAFE_INTERACT_BLOCKS.contains(value)) {
|
||||
BlockGroup.SAFE_INTERACT_BLOCKS.add(value);
|
||||
}
|
||||
}
|
||||
for (Material value : Tag.CEILING_HANGING_SIGNS.getValues()) {
|
||||
if (!BlockGroup.TRACK_BOTTOM.contains(value)) {
|
||||
BlockGroup.TRACK_BOTTOM.add(value);
|
||||
}
|
||||
}
|
||||
for (Material value : Tag.WALL_SIGNS.getValues()) {
|
||||
if (!BlockGroup.TRACK_SIDE.contains(value)) {
|
||||
BlockGroup.TRACK_SIDE.add(value);
|
||||
}
|
||||
}
|
||||
for (Material value : Tag.SAPLINGS.getValues()) {
|
||||
if (!BlockGroup.TRACK_TOP.contains(value)) {
|
||||
BlockGroup.TRACK_TOP.add(value);
|
||||
}
|
||||
if (!BlockGroup.NON_ATTACHABLE.contains(value)) {
|
||||
BlockGroup.NON_ATTACHABLE.add(value);
|
||||
}
|
||||
}
|
||||
for (Material value : Tag.FLOWERS.getValues()) {
|
||||
if (!BlockGroup.TRACK_TOP.contains(value)) {
|
||||
BlockGroup.TRACK_TOP.add(value);
|
||||
}
|
||||
if (!BlockGroup.NON_ATTACHABLE.contains(value)) {
|
||||
BlockGroup.NON_ATTACHABLE.add(value);
|
||||
}
|
||||
}
|
||||
for (Material value : Tag.SIGNS.getValues()) {
|
||||
if (!Tag.WALL_SIGNS.isTagged(value) && !BlockGroup.TRACK_TOP.contains(value)) {
|
||||
BlockGroup.TRACK_TOP.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGlowing(Sign sign, boolean isFront, boolean isGlowing) {
|
||||
if (isFront) {
|
||||
sign.getSide(Side.FRONT).setGlowingText(isGlowing);
|
||||
}
|
||||
else {
|
||||
sign.getSide(Side.BACK).setGlowingText(isGlowing);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setColor(Sign sign, boolean isFront, int color) {
|
||||
if (isFront) {
|
||||
sign.getSide(Side.FRONT).setColor(DyeColor.getByColor(Color.fromRGB(color)));
|
||||
}
|
||||
else {
|
||||
sign.getSide(Side.BACK).setColor(DyeColor.getByColor(Color.fromRGB(color)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWaxed(Sign sign, boolean isWaxed) {
|
||||
sign.setWaxed(isWaxed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor(Sign sign, boolean isFront) {
|
||||
if (isFront) {
|
||||
return sign.getSide(Side.FRONT).getColor().getColor().asRGB();
|
||||
}
|
||||
else {
|
||||
return sign.getSide(Side.BACK).getColor().getColor().asRGB();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGlowing(Sign sign, boolean isFront) {
|
||||
if (isFront) {
|
||||
return sign.getSide(Side.FRONT).isGlowingText();
|
||||
}
|
||||
else {
|
||||
return sign.getSide(Side.BACK).isGlowingText();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWaxed(Sign sign) {
|
||||
return sign.isWaxed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Material getPlantSeeds(Material material) {
|
||||
switch (material) {
|
||||
case WHEAT:
|
||||
material = Material.WHEAT_SEEDS;
|
||||
break;
|
||||
case PUMPKIN_STEM:
|
||||
material = Material.PUMPKIN_SEEDS;
|
||||
break;
|
||||
case MELON_STEM:
|
||||
material = Material.MELON_SEEDS;
|
||||
break;
|
||||
case BEETROOTS:
|
||||
material = Material.BEETROOT_SEEDS;
|
||||
break;
|
||||
case TORCHFLOWER_CROP:
|
||||
material = Material.TORCHFLOWER_SEEDS;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
return material;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSuspiciousBlock(Material material) {
|
||||
return material == Material.SUSPICIOUS_GRAVEL || material == Material.SUSPICIOUS_SAND;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSign(Material material) {
|
||||
return Tag.ALL_SIGNS.isTagged(material);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isChiseledBookshelf(Material material) {
|
||||
return material == Material.CHISELED_BOOKSHELF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBookshelfBook(Material material) {
|
||||
return Tag.ITEMS_BOOKSHELF_BOOKS.isTagged(material);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getChiseledBookshelfBook(BlockState blockState, PlayerInteractEvent event) {
|
||||
try {
|
||||
if (hasClickedPosition == null) {
|
||||
hasClickedPosition = true;
|
||||
PlayerInteractEvent.class.getMethod("getClickedPosition"); // Bukkit 1.20.1+
|
||||
}
|
||||
else if (Boolean.FALSE.equals(hasClickedPosition)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ChiseledBookshelf chiseledBookshelf = (ChiseledBookshelf) blockState;
|
||||
ItemStack book = chiseledBookshelf.getInventory().getItem(chiseledBookshelf.getSlot(event.getClickedPosition()));
|
||||
return book == null ? new ItemStack(Material.AIR) : book;
|
||||
}
|
||||
catch (Exception e) {
|
||||
hasClickedPosition = false;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLine(Sign sign, int line) {
|
||||
if (line < 4) {
|
||||
return sign.getSide(Side.FRONT).getLine(line);
|
||||
}
|
||||
else {
|
||||
return sign.getSide(Side.BACK).getLine(line - 4);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLine(Sign sign, int line, String string) {
|
||||
if (string == null) {
|
||||
string = "";
|
||||
}
|
||||
|
||||
if (line < 4) {
|
||||
sign.getSide(Side.FRONT).setLine(line, string);
|
||||
}
|
||||
else {
|
||||
sign.getSide(Side.BACK).setLine(line - 4, string);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSignFront(SignChangeEvent event) {
|
||||
return event.getSide().equals(Side.FRONT);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1196,6 +1196,9 @@ public class CommandHandler implements CommandExecutor {
|
||||
else if (user.hasPermission("coreprotect.consumer") && corecommand.equals("consumer")) {
|
||||
permission = true;
|
||||
}
|
||||
else if (user.hasPermission("coreprotect.networking") && corecommand.equals("network-debug")) {
|
||||
permission = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (corecommand.equals("rollback") || corecommand.equals("restore") || corecommand.equals("rb") || corecommand.equals("rs") || corecommand.equals("ro") || corecommand.equals("re")) {
|
||||
@@ -1237,6 +1240,9 @@ public class CommandHandler implements CommandExecutor {
|
||||
else if (corecommand.equals("consumer")) {
|
||||
ConsumerCommand.runCommand(user, permission, argumentArray);
|
||||
}
|
||||
else if (corecommand.equals("network-debug")) {
|
||||
NetworkDebugCommand.runCommand(user, permission, argumentArray);
|
||||
}
|
||||
else {
|
||||
Chat.sendMessage(user, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.COMMAND_NOT_FOUND, Color.WHITE, "/co " + corecommand));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.coreprotect.command;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.sql.Connection;
|
||||
import java.sql.Statement;
|
||||
import java.text.NumberFormat;
|
||||
@@ -34,6 +35,8 @@ import net.coreprotect.database.lookup.SignMessageLookup;
|
||||
import net.coreprotect.database.statement.UserStatement;
|
||||
import net.coreprotect.language.Phrase;
|
||||
import net.coreprotect.language.Selector;
|
||||
import net.coreprotect.listener.channel.PluginChannelHandshakeListener;
|
||||
import net.coreprotect.listener.channel.PluginChannelListener;
|
||||
import net.coreprotect.utility.Chat;
|
||||
import net.coreprotect.utility.ChatMessage;
|
||||
import net.coreprotect.utility.Color;
|
||||
@@ -267,6 +270,11 @@ public class LookupCommand {
|
||||
}
|
||||
|
||||
if (argAction.contains(4) && argAction.contains(11)) { // a:inventory
|
||||
if (argUsers.size() == 0) {
|
||||
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.MISSING_ACTION_USER));
|
||||
return;
|
||||
}
|
||||
|
||||
argExclude.put(Material.FIRE, false);
|
||||
argExclude.put(Material.WATER, false);
|
||||
argExclude.put(Material.FARMLAND, false);
|
||||
@@ -349,14 +357,9 @@ public class LookupCommand {
|
||||
ConfigHandler.lookupThrottle.put(player2.getName(), new Object[] { true, System.currentTimeMillis() });
|
||||
if (connection != null) {
|
||||
Statement statement = connection.createStatement();
|
||||
String blockdata = ChestTransactionLookup.performLookup(command.getName(), statement, location, player2, p2, finalLimit, false);
|
||||
if (blockdata.contains("\n")) {
|
||||
for (String b : blockdata.split("\n")) {
|
||||
Chat.sendComponent(player2, b);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Chat.sendComponent(player2, blockdata);
|
||||
List<String> blockData = ChestTransactionLookup.performLookup(command.getName(), statement, location, player2, p2, finalLimit, false);
|
||||
for (String data : blockData) {
|
||||
Chat.sendComponent(player2, data);
|
||||
}
|
||||
statement.close();
|
||||
}
|
||||
@@ -572,6 +575,13 @@ public class LookupCommand {
|
||||
}
|
||||
}
|
||||
c++;
|
||||
|
||||
if (argAction.contains(4) && argAction.contains(11)) {
|
||||
if (ruser.startsWith("#")) {
|
||||
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.INVALID_USERNAME, ruser));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
long timeStart = -1;
|
||||
@@ -820,6 +830,13 @@ public class LookupCommand {
|
||||
String message = data[2];
|
||||
String timeago = Util.getTimeSince(Integer.parseInt(time), unixtimestamp, true);
|
||||
Chat.sendComponent(player2, timeago + " " + Color.WHITE + "- " + Color.DARK_AQUA + dplayer + ": " + Color.WHITE, message);
|
||||
if (PluginChannelHandshakeListener.getInstance().isPluginChannelPlayer(player2)) {
|
||||
int wid = Integer.parseInt(data[3]);
|
||||
int x = Integer.parseInt(data[4]);
|
||||
int y = Integer.parseInt(data[5]);
|
||||
int z = Integer.parseInt(data[6]);
|
||||
PluginChannelListener.getInstance().sendMessageData(player2, Integer.parseInt(time), dplayer, message, false, x, y, z, wid);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (finalArgAction.contains(8)) { // login/logouts
|
||||
@@ -844,6 +861,7 @@ public class LookupCommand {
|
||||
String tag = (action != 0 ? Color.GREEN + "+" : Color.RED + "-");
|
||||
Chat.sendComponent(player2, timeago + " " + tag + " " + Color.DARK_AQUA + Phrase.build(Phrase.LOOKUP_LOGIN, Color.DARK_AQUA + dplayer + Color.WHITE, (action != 0 ? Selector.FIRST : Selector.SECOND)));
|
||||
Chat.sendComponent(player2, Color.WHITE + leftPadding + Color.GREY + "^ " + Util.getCoordinates(command.getName(), wid, x, y, z, true, true) + "");
|
||||
PluginChannelListener.getInstance().sendInfoData(player2, Integer.parseInt(time), Phrase.LOOKUP_LOGIN, (action != 0 ? Selector.FIRST : Selector.SECOND), dplayer, -1, x, y, z, wid);
|
||||
}
|
||||
}
|
||||
else if (finalArgAction.contains(9)) { // username-changes
|
||||
@@ -853,6 +871,7 @@ public class LookupCommand {
|
||||
String username = data[2];
|
||||
String timeago = Util.getTimeSince(Integer.parseInt(time), unixtimestamp, true);
|
||||
Chat.sendComponent(player2, timeago + " " + Color.WHITE + "- " + Phrase.build(Phrase.LOOKUP_USERNAME, Color.DARK_AQUA + user + Color.WHITE, Color.DARK_AQUA + username + Color.WHITE));
|
||||
PluginChannelListener.getInstance().sendUsernameData(player2, Integer.parseInt(time), user, username);
|
||||
}
|
||||
}
|
||||
else if (finalArgAction.contains(10)) { // sign messages
|
||||
@@ -876,20 +895,27 @@ public class LookupCommand {
|
||||
|
||||
Chat.sendComponent(player2, timeago + " " + Color.WHITE + "- " + Color.DARK_AQUA + dplayer + ": " + Color.WHITE, message);
|
||||
Chat.sendComponent(player2, Color.WHITE + leftPadding + Color.GREY + "^ " + Util.getCoordinates(command.getName(), wid, x, y, z, true, true) + "");
|
||||
PluginChannelListener.getInstance().sendMessageData(player2, Integer.parseInt(time), dplayer, message, true, x, y, z, wid);
|
||||
}
|
||||
}
|
||||
else if (finalArgAction.contains(4) && finalArgAction.contains(11)) { // inventory transactions
|
||||
for (String[] data : lookupList) {
|
||||
String time = data[0];
|
||||
String dplayer = data[1];
|
||||
String dtype = data[5];
|
||||
int dtype = Integer.parseInt(data[5]);
|
||||
int ddata = Integer.parseInt(data[6]);
|
||||
int daction = Integer.parseInt(data[7]);
|
||||
int amount = Integer.parseInt(data[10]);
|
||||
int wid = Integer.parseInt(data[9]);
|
||||
int x = Integer.parseInt(data[2]);
|
||||
int y = Integer.parseInt(data[3]);
|
||||
int z = Integer.parseInt(data[4]);
|
||||
String rbd = ((Integer.parseInt(data[8]) == 2 || Integer.parseInt(data[8]) == 3) ? Color.STRIKETHROUGH : "");
|
||||
String timeago = Util.getTimeSince(Integer.parseInt(time), unixtimestamp, true);
|
||||
Material blockType = Util.itemFilter(Util.getType(Integer.parseInt(dtype)), (Integer.parseInt(data[13]) == 0));
|
||||
Material blockType = Util.itemFilter(Util.getType(dtype), (Integer.parseInt(data[13]) == 0));
|
||||
String dname = Util.nameFilter(blockType.name().toLowerCase(Locale.ROOT), ddata);
|
||||
byte[] metadata = data[11] == null ? null : data[11].getBytes(StandardCharsets.ISO_8859_1);
|
||||
String tooltip = Util.getEnchantments(metadata, dtype, amount);
|
||||
|
||||
String selector = Selector.FIRST;
|
||||
String tag = Color.WHITE + "-";
|
||||
@@ -918,7 +944,8 @@ public class LookupCommand {
|
||||
tag = (daction == 0 ? Color.GREEN + "+" : Color.RED + "-");
|
||||
}
|
||||
|
||||
Chat.sendComponent(player2, timeago + " " + tag + " " + Phrase.build(Phrase.LOOKUP_CONTAINER, Color.DARK_AQUA + rbd + dplayer + Color.WHITE + rbd, "x" + amount, Color.DARK_AQUA + rbd + dname + Color.WHITE, selector));
|
||||
Chat.sendComponent(player2, timeago + " " + tag + " " + Phrase.build(Phrase.LOOKUP_CONTAINER, Color.DARK_AQUA + rbd + dplayer + Color.WHITE + rbd, "x" + amount, Util.createTooltip(Color.DARK_AQUA + rbd + dname, tooltip) + Color.WHITE, selector));
|
||||
PluginChannelListener.getInstance().sendData(player2, Integer.parseInt(time), Phrase.LOOKUP_CONTAINER, selector, dplayer, dname, amount, x, y, z, wid, rbd, true, tag.contains("+"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -934,7 +961,7 @@ public class LookupCommand {
|
||||
int x = Integer.parseInt(data[2]);
|
||||
int y = Integer.parseInt(data[3]);
|
||||
int z = Integer.parseInt(data[4]);
|
||||
String dtype = data[5];
|
||||
int dtype = Integer.parseInt(data[5]);
|
||||
int ddata = Integer.parseInt(data[6]);
|
||||
int daction = Integer.parseInt(data[7]);
|
||||
int wid = Integer.parseInt(data[9]);
|
||||
@@ -954,8 +981,7 @@ public class LookupCommand {
|
||||
String dname = "";
|
||||
boolean isPlayer = false;
|
||||
if (daction == 3 && !finalArgAction.contains(11) && amount == -1) {
|
||||
int dTypeInt = Integer.parseInt(dtype);
|
||||
if (dTypeInt == 0) {
|
||||
if (dtype == 0) {
|
||||
if (ConfigHandler.playerIdCacheReversed.get(ddata) == null) {
|
||||
UserStatement.loadName(connection, ddata);
|
||||
}
|
||||
@@ -963,11 +989,11 @@ public class LookupCommand {
|
||||
isPlayer = true;
|
||||
}
|
||||
else {
|
||||
dname = Util.getEntityType(dTypeInt).name();
|
||||
dname = Util.getEntityType(dtype).name();
|
||||
}
|
||||
}
|
||||
else {
|
||||
dname = Util.getType(Integer.parseInt(dtype)).name().toLowerCase(Locale.ROOT);
|
||||
dname = Util.getType(dtype).name().toLowerCase(Locale.ROOT);
|
||||
dname = Util.nameFilter(dname, ddata);
|
||||
}
|
||||
if (dname.length() > 0 && !isPlayer) {
|
||||
@@ -986,6 +1012,9 @@ public class LookupCommand {
|
||||
String selector = Selector.FIRST;
|
||||
String action = "a:block";
|
||||
if (finalArgAction.contains(4) || finalArgAction.contains(5) || finalArgAction.contains(11) || amount > -1) {
|
||||
byte[] metadata = data[11] == null ? null : data[11].getBytes(StandardCharsets.ISO_8859_1);
|
||||
String tooltip = Util.getEnchantments(metadata, dtype, amount);
|
||||
|
||||
if (daction == 2 || daction == 3) {
|
||||
phrase = Phrase.LOOKUP_ITEM; // {picked up|dropped}
|
||||
selector = (daction != 2 ? Selector.FIRST : Selector.SECOND);
|
||||
@@ -1011,7 +1040,8 @@ public class LookupCommand {
|
||||
action = "a:container";
|
||||
}
|
||||
|
||||
Chat.sendComponent(player2, timeago + " " + tag + " " + Phrase.build(phrase, Color.DARK_AQUA + rbd + dplayer + Color.WHITE + rbd, "x" + amount, Color.DARK_AQUA + rbd + dname + Color.WHITE, selector));
|
||||
Chat.sendComponent(player2, timeago + " " + tag + " " + Phrase.build(phrase, Color.DARK_AQUA + rbd + dplayer + Color.WHITE + rbd, "x" + amount, Util.createTooltip(Color.DARK_AQUA + rbd + dname, tooltip) + Color.WHITE, selector));
|
||||
PluginChannelListener.getInstance().sendData(player2, Integer.parseInt(time), phrase, selector, dplayer, dname, (tag.contains("+") ? 1 : -1), x, y, z, wid, rbd, action.contains("container"), tag.contains("+"));
|
||||
}
|
||||
else {
|
||||
if (daction == 2 || daction == 3) {
|
||||
@@ -1027,6 +1057,7 @@ public class LookupCommand {
|
||||
}
|
||||
|
||||
Chat.sendComponent(player2, timeago + " " + tag + " " + Phrase.build(phrase, Color.DARK_AQUA + rbd + dplayer + Color.WHITE + rbd, Color.DARK_AQUA + rbd + dname + Color.WHITE, selector));
|
||||
PluginChannelListener.getInstance().sendData(player2, Integer.parseInt(time), phrase, selector, dplayer, dname, (tag.contains("+") ? 1 : -1), x, y, z, wid, rbd, false, tag.contains("+"));
|
||||
}
|
||||
|
||||
action = (finalArgAction.size() == 0 ? " (" + action + ")" : "");
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package net.coreprotect.command;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import net.coreprotect.config.Config;
|
||||
import net.coreprotect.language.Phrase;
|
||||
import net.coreprotect.listener.channel.PluginChannelListener;
|
||||
import net.coreprotect.utility.Chat;
|
||||
import net.coreprotect.utility.Color;
|
||||
|
||||
public class NetworkDebugCommand {
|
||||
protected static void runCommand(CommandSender player, boolean permission, String[] args) {
|
||||
if (!permission || !Config.getGlobal().NETWORK_DEBUG) {
|
||||
Chat.sendMessage(player, Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_PERMISSION));
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
PluginChannelListener.getInstance().sendTest(player, args.length == 2 ? args[1] : "");
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -141,11 +141,11 @@ public class TabHandler implements TabCompleter {
|
||||
}
|
||||
}
|
||||
|
||||
if (lastArg.equals("a:") || lastArg.equals("action:")) {
|
||||
if ((lastArg.equals("a:") || lastArg.equals("action:")) && (sender.hasPermission("coreprotect.lookup") || sender.hasPermission("coreprotect.rollback") || sender.hasPermission("coreprotect.restore"))) {
|
||||
List<String> completions = new ArrayList<>(Arrays.asList(ACTIONS));
|
||||
return StringUtil.copyPartialMatches(currentArg, completions, new ArrayList<>(completions.size()));
|
||||
}
|
||||
else if (currentArg.startsWith("a:") || currentArg.startsWith("action:")) {
|
||||
else if ((currentArg.startsWith("a:") || currentArg.startsWith("action:")) && (sender.hasPermission("coreprotect.lookup") || sender.hasPermission("coreprotect.rollback") || sender.hasPermission("coreprotect.restore"))) {
|
||||
String arg = "";
|
||||
String[] split = currentArg.split(":", 2);
|
||||
String filter = split[0] + ":";
|
||||
@@ -159,10 +159,10 @@ public class TabHandler implements TabCompleter {
|
||||
}
|
||||
return StringUtil.copyPartialMatches(filter + arg, completions, new ArrayList<>(completions.size()));
|
||||
}
|
||||
else if (lastArg.equals("u:") || lastArg.equals("user:") || lastArg.equals("users:") || lastArg.equals("p:")) {
|
||||
else if ((lastArg.equals("u:") || lastArg.equals("user:") || lastArg.equals("users:") || lastArg.equals("p:")) && (sender.hasPermission("coreprotect.lookup") || sender.hasPermission("coreprotect.rollback") || sender.hasPermission("coreprotect.restore"))) {
|
||||
return null;
|
||||
}
|
||||
else if (currentArg.startsWith("u:") || currentArg.startsWith("user:") || currentArg.startsWith("users:") || currentArg.startsWith("p:")) {
|
||||
else if ((currentArg.startsWith("u:") || currentArg.startsWith("user:") || currentArg.startsWith("users:") || currentArg.startsWith("p:")) && (sender.hasPermission("coreprotect.lookup") || sender.hasPermission("coreprotect.rollback") || sender.hasPermission("coreprotect.restore"))) {
|
||||
String arg = "";
|
||||
String[] split = currentArg.split(":", 2);
|
||||
String filter = split[0] + ":";
|
||||
@@ -177,7 +177,7 @@ public class TabHandler implements TabCompleter {
|
||||
|
||||
return StringUtil.copyPartialMatches(filter + arg, completions, new ArrayList<>(completions.size()));
|
||||
}
|
||||
else if (lastArg.equals("t:") || lastArg.equals("time:") || currentArg.startsWith("t:") || currentArg.startsWith("time:")) {
|
||||
else if ((lastArg.equals("t:") || lastArg.equals("time:") || currentArg.startsWith("t:") || currentArg.startsWith("time:")) && (sender.hasPermission("coreprotect.lookup") || sender.hasPermission("coreprotect.rollback") || sender.hasPermission("coreprotect.restore") || sender.hasPermission("coreprotect.purge"))) {
|
||||
String filter = lastArg;
|
||||
String arg = "";
|
||||
if (currentArg.contains(":")) {
|
||||
@@ -215,7 +215,7 @@ public class TabHandler implements TabCompleter {
|
||||
|
||||
return StringUtil.copyPartialMatches(filter + arg, completions, new ArrayList<>(completions.size()));
|
||||
}
|
||||
else if (lastArg.equals("page:") || currentArg.startsWith("page:")) {
|
||||
else if ((lastArg.equals("page:") || currentArg.startsWith("page:")) && (sender.hasPermission("coreprotect.lookup") || sender.hasPermission("coreprotect.lookup.near") || sender.hasPermission("coreprotect.inspect"))) {
|
||||
String filter = lastArg;
|
||||
String arg = "";
|
||||
if (currentArg.contains(":")) {
|
||||
@@ -243,7 +243,7 @@ public class TabHandler implements TabCompleter {
|
||||
return StringUtil.copyPartialMatches(filter + arg, completions, new ArrayList<>(completions.size()));
|
||||
}
|
||||
}
|
||||
else if (lastArg.equals("r:") || lastArg.equals("radius:") || currentArg.startsWith("r:") || currentArg.startsWith("radius:")) {
|
||||
else if ((lastArg.equals("r:") || lastArg.equals("radius:") || currentArg.startsWith("r:") || currentArg.startsWith("radius:")) && (sender.hasPermission("coreprotect.lookup") || sender.hasPermission("coreprotect.rollback") || sender.hasPermission("coreprotect.restore") || sender.hasPermission("coreprotect.purge"))) {
|
||||
String filter = lastArg;
|
||||
String arg = "";
|
||||
if (currentArg.contains(":")) {
|
||||
@@ -284,7 +284,7 @@ public class TabHandler implements TabCompleter {
|
||||
return StringUtil.copyPartialMatches(filter + arg, completions, new ArrayList<>(completions.size()));
|
||||
}
|
||||
}
|
||||
else if (lastArg.equals("i:") || lastArg.equals("include:") || lastArg.equals("item:") || lastArg.equals("items:") || lastArg.equals("b:") || lastArg.equals("block:") || lastArg.equals("blocks:") || currentArg.startsWith("i:") || currentArg.startsWith("include:") || currentArg.startsWith("item:") || currentArg.startsWith("items:") || currentArg.startsWith("b:") || currentArg.startsWith("block:") || currentArg.startsWith("blocks:") || lastArg.equals("e:") || lastArg.equals("exclude:") || currentArg.startsWith("e:") || currentArg.startsWith("exclude:")) {
|
||||
else if ((sender.hasPermission("coreprotect.lookup") || sender.hasPermission("coreprotect.rollback") || sender.hasPermission("coreprotect.restore")) && (lastArg.equals("i:") || lastArg.equals("include:") || lastArg.equals("item:") || lastArg.equals("items:") || lastArg.equals("b:") || lastArg.equals("block:") || lastArg.equals("blocks:") || currentArg.startsWith("i:") || currentArg.startsWith("include:") || currentArg.startsWith("item:") || currentArg.startsWith("items:") || currentArg.startsWith("b:") || currentArg.startsWith("block:") || currentArg.startsWith("blocks:") || lastArg.equals("e:") || lastArg.equals("exclude:") || currentArg.startsWith("e:") || currentArg.startsWith("exclude:"))) {
|
||||
String filter = lastArg;
|
||||
String arg = "";
|
||||
if (currentArg.contains(":")) {
|
||||
@@ -328,21 +328,21 @@ public class TabHandler implements TabCompleter {
|
||||
|
||||
}
|
||||
else if (args.length == 2) {
|
||||
if (argument0.equals("help")) {
|
||||
if (argument0.equals("help") && sender.hasPermission("coreprotect.help")) {
|
||||
List<String> completions = new ArrayList<>(Arrays.asList(HELP));
|
||||
return StringUtil.copyPartialMatches(argument1, completions, new ArrayList<>(completions.size()));
|
||||
}
|
||||
else if (argument0.equals("purge")) {
|
||||
else if (argument0.equals("purge") && sender.hasPermission("coreprotect.purge")) {
|
||||
List<String> completions = new ArrayList<>(Arrays.asList("t:", "r:"));
|
||||
return StringUtil.copyPartialMatches(argument1, completions, new ArrayList<>(completions.size()));
|
||||
}
|
||||
else if (argument0.equals("l") || argument0.equals("lookup") || argument0.equals("rollback") || argument0.equals("rb") || argument0.equals("ro") || argument0.equals("restore") || argument0.equals("rs") || argument0.equals("re")) {
|
||||
else if ((sender.hasPermission("coreprotect.lookup") && (argument0.equals("l") || argument0.equals("lookup"))) || (sender.hasPermission("coreprotect.rollback") && (argument0.equals("rollback") || argument0.equals("rb") || argument0.equals("ro"))) || (sender.hasPermission("coreprotect.restore") && (argument0.equals("restore") || argument0.equals("rs") || argument0.equals("re")))) {
|
||||
List<String> completions = new ArrayList<>(filterParams(true, argument0, argument1, hasUser, hasAction, hasInclude, hasExclude, hasRadius, hasTime, hasContainer, hasCount, hasPreview, pageLookup, validContainer));
|
||||
completions.addAll(Bukkit.getOnlinePlayers().stream().filter(player -> player.getName().toLowerCase(Locale.ROOT).startsWith(argument1)).map(Player::getName).collect(Collectors.toList()));
|
||||
return StringUtil.copyPartialMatches(argument1, completions, new ArrayList<>(completions.size()));
|
||||
}
|
||||
}
|
||||
else if (args.length == 3 && argument0.equals("purge")) {
|
||||
else if (args.length == 3 && argument0.equals("purge") && sender.hasPermission("coreprotect.purge")) {
|
||||
if (argument1.startsWith("t:")) {
|
||||
List<String> completions = new ArrayList<>(Arrays.asList("r:"));
|
||||
return StringUtil.copyPartialMatches(args[2].toLowerCase(Locale.ROOT), completions, new ArrayList<>(completions.size()));
|
||||
@@ -353,7 +353,7 @@ public class TabHandler implements TabCompleter {
|
||||
}
|
||||
return Arrays.asList("");
|
||||
}
|
||||
else if (argument0.equals("l") || argument0.equals("lookup") || argument0.equals("rollback") || argument0.equals("rb") || argument0.equals("ro") || argument0.equals("restore") || argument0.equals("rs") || argument0.equals("re")) {
|
||||
else if ((sender.hasPermission("coreprotect.lookup") && (argument0.equals("l") || argument0.equals("lookup"))) || (sender.hasPermission("coreprotect.rollback") && (argument0.equals("rollback") || argument0.equals("rb") || argument0.equals("ro"))) || (sender.hasPermission("coreprotect.restore") && (argument0.equals("restore") || argument0.equals("rs") || argument0.equals("re")))) {
|
||||
if ((!argument0.equals("l") && !argument0.equals("lookup")) || !hasPage) {
|
||||
ArrayList<String> params = filterParams(false, argument0, currentArg, hasUser, hasAction, hasInclude, hasExclude, hasRadius, hasTime, hasContainer, hasCount, hasPreview, pageLookup, validContainer);
|
||||
List<String> completions = new ArrayList<>(params);
|
||||
|
||||
@@ -6,8 +6,10 @@ import org.bukkit.World;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.coreprotect.CoreProtect;
|
||||
import net.coreprotect.config.ConfigHandler;
|
||||
import net.coreprotect.language.Phrase;
|
||||
import net.coreprotect.thread.Scheduler;
|
||||
import net.coreprotect.utility.Chat;
|
||||
import net.coreprotect.utility.ChatMessage;
|
||||
import net.coreprotect.utility.Color;
|
||||
@@ -99,12 +101,14 @@ public class TeleportCommand {
|
||||
|
||||
int chunkX = location.getBlockX() >> 4;
|
||||
int chunkZ = location.getBlockZ() >> 4;
|
||||
if (location.getWorld().isChunkLoaded(chunkX, chunkZ) == false) {
|
||||
location.getWorld().getChunkAt(location);
|
||||
}
|
||||
Scheduler.runTask(CoreProtect.getInstance(), () -> {
|
||||
if (!location.getWorld().isChunkLoaded(chunkX, chunkZ)) {
|
||||
location.getWorld().getChunkAt(location);
|
||||
}
|
||||
|
||||
// Teleport the player to a safe location
|
||||
Teleport.performSafeTeleport(((Player) player), location, true);
|
||||
// Teleport the player to a safe location
|
||||
Teleport.performSafeTeleport(((Player) player), location, true);
|
||||
}, location);
|
||||
|
||||
ConfigHandler.teleportThrottle.put(player.getName(), new Object[] { false, System.currentTimeMillis() });
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import org.bukkit.World;
|
||||
|
||||
import net.coreprotect.CoreProtect;
|
||||
import net.coreprotect.language.Language;
|
||||
import net.coreprotect.thread.Scheduler;
|
||||
|
||||
public class Config extends Language {
|
||||
|
||||
@@ -42,11 +43,14 @@ public class Config extends Language {
|
||||
public String MYSQL_PASSWORD;
|
||||
public String LANGUAGE;
|
||||
public boolean ENABLE_AWE;
|
||||
public boolean ENABLE_SSL;
|
||||
public boolean DISABLE_WAL;
|
||||
public boolean HOVER_EVENTS;
|
||||
public boolean DATABASE_LOCK;
|
||||
public boolean LOG_CANCELLED_CHAT;
|
||||
public boolean HOPPER_FILTER_META;
|
||||
public boolean EXCLUDE_TNT;
|
||||
public boolean NETWORK_DEBUG;
|
||||
public boolean MYSQL;
|
||||
public boolean CHECK_UPDATES;
|
||||
public boolean API_ENABLED;
|
||||
@@ -70,6 +74,7 @@ public class Config extends Language {
|
||||
public boolean TREE_GROWTH;
|
||||
public boolean MUSHROOM_GROWTH;
|
||||
public boolean VINE_GROWTH;
|
||||
public boolean SCULK_SPREAD;
|
||||
public boolean PORTALS;
|
||||
public boolean WATER_FLOW;
|
||||
public boolean LAVA_FLOW;
|
||||
@@ -82,8 +87,10 @@ public class Config extends Language {
|
||||
public boolean PLAYER_MESSAGES;
|
||||
public boolean PLAYER_COMMANDS;
|
||||
public boolean PLAYER_SESSIONS;
|
||||
public boolean UNKNOWN_LOGGING;
|
||||
public boolean USERNAME_CHANGES;
|
||||
public boolean WORLDEDIT;
|
||||
public int MAXIMUM_POOL_SIZE;
|
||||
public int MYSQL_PORT;
|
||||
public int DEFAULT_RADIUS;
|
||||
public int MAX_RADIUS;
|
||||
@@ -122,6 +129,7 @@ public class Config extends Language {
|
||||
DEFAULT_VALUES.put("tree-growth", "true");
|
||||
DEFAULT_VALUES.put("mushroom-growth", "true");
|
||||
DEFAULT_VALUES.put("vine-growth", "true");
|
||||
DEFAULT_VALUES.put("sculk-spread", "true");
|
||||
DEFAULT_VALUES.put("portals", "true");
|
||||
DEFAULT_VALUES.put("water-flow", "true");
|
||||
DEFAULT_VALUES.put("lava-flow", "true");
|
||||
@@ -137,7 +145,7 @@ public class Config extends Language {
|
||||
DEFAULT_VALUES.put("username-changes", "true");
|
||||
DEFAULT_VALUES.put("worldedit", "true");
|
||||
|
||||
HEADERS.put("donation-key", new String[] { "# CoreProtect is donationware. For more information, visit our project page." });
|
||||
HEADERS.put("donation-key", new String[] { "# CoreProtect is donationware. Obtain a donation key from coreprotect.net/donate/" });
|
||||
HEADERS.put("use-mysql", new String[] { "# MySQL is optional and not required.", "# If you prefer to use MySQL, enable the following and fill out the fields." });
|
||||
HEADERS.put("language", new String[] { "# If modified, will automatically attempt to translate languages phrases.", "# List of language codes: https://coreprotect.net/languages/" });
|
||||
HEADERS.put("check-updates", new String[] { "# If enabled, CoreProtect will check for updates when your server starts up.", "# If an update is available, you'll be notified via your server console.", });
|
||||
@@ -161,9 +169,10 @@ public class Config extends Language {
|
||||
HEADERS.put("sign-text", new String[] { "# Logs text on signs. If disabled, signs will be blank when rolled back." });
|
||||
HEADERS.put("buckets", new String[] { "# Logs lava and water sources placed/removed by players who are using buckets." });
|
||||
HEADERS.put("leaf-decay", new String[] { "# Logs natural tree leaf decay." });
|
||||
HEADERS.put("tree-growth", new String[] { "# Logs tree growth. Trees are linked to the player who planted the sappling." });
|
||||
HEADERS.put("tree-growth", new String[] { "# Logs tree growth. Trees are linked to the player who planted the sapling." });
|
||||
HEADERS.put("mushroom-growth", new String[] { "# Logs mushroom growth." });
|
||||
HEADERS.put("vine-growth", new String[] { "# Logs natural vine growth." });
|
||||
HEADERS.put("sculk-spread", new String[] { "# Logs the spread of sculk blocks from sculk catalysts." });
|
||||
HEADERS.put("portals", new String[] { "# Logs when portals such as Nether portals generate naturally." });
|
||||
HEADERS.put("water-flow", new String[] { "# Logs water flow. If water destroys other blocks, such as torches,", "# this allows it to be properly rolled back." });
|
||||
HEADERS.put("lava-flow", new String[] { "# Logs lava flow. If lava destroys other blocks, such as torches,", "# this allows it to be properly rolled back." });
|
||||
@@ -182,11 +191,16 @@ public class Config extends Language {
|
||||
|
||||
private void readValues() {
|
||||
this.ENABLE_AWE = this.getBoolean("enable-awe", false);
|
||||
this.ENABLE_SSL = this.getBoolean("enable-ssl", false);
|
||||
this.DISABLE_WAL = this.getBoolean("disable-wal", false);
|
||||
this.HOVER_EVENTS = this.getBoolean("hover-events", true);
|
||||
this.DATABASE_LOCK = this.getBoolean("database-lock", true);
|
||||
this.LOG_CANCELLED_CHAT = this.getBoolean("log-cancelled-chat", true);
|
||||
this.HOPPER_FILTER_META = this.getBoolean("hopper-filter-meta", false);
|
||||
this.EXCLUDE_TNT = this.getBoolean("exclude-tnt", false);
|
||||
this.NETWORK_DEBUG = this.getBoolean("network-debug", false);
|
||||
this.UNKNOWN_LOGGING = this.getBoolean("unknown-logging", false);
|
||||
this.MAXIMUM_POOL_SIZE = this.getInt("maximum-pool-size", 10);
|
||||
this.DONATION_KEY = this.getString("donation-key");
|
||||
this.MYSQL = this.getBoolean("use-mysql");
|
||||
this.PREFIX = this.getString("table-prefix");
|
||||
@@ -220,6 +234,7 @@ public class Config extends Language {
|
||||
this.TREE_GROWTH = this.getBoolean("tree-growth");
|
||||
this.MUSHROOM_GROWTH = this.getBoolean("mushroom-growth");
|
||||
this.VINE_GROWTH = this.getBoolean("vine-growth");
|
||||
this.SCULK_SPREAD = this.getBoolean("sculk-spread");
|
||||
this.PORTALS = this.getBoolean("portals");
|
||||
this.WATER_FLOW = this.getBoolean("water-flow");
|
||||
this.LAVA_FLOW = this.getBoolean("lava-flow");
|
||||
@@ -302,7 +317,7 @@ public class Config extends Language {
|
||||
|
||||
configured = configured.replaceAll("[^0-9]", "");
|
||||
|
||||
return configured.isEmpty() ? 0 : Integer.parseInt(configured);
|
||||
return configured.isEmpty() ? dfl : Integer.parseInt(configured);
|
||||
}
|
||||
|
||||
private String getString(final String key) {
|
||||
@@ -375,7 +390,7 @@ public class Config extends Language {
|
||||
// for now this solution is good enough to ensure we only modify on the main thread
|
||||
final CompletableFuture<Void> complete = new CompletableFuture<>();
|
||||
|
||||
Bukkit.getScheduler().runTask(CoreProtect.getInstance(), () -> {
|
||||
Scheduler.runTask(CoreProtect.getInstance(), () -> {
|
||||
try {
|
||||
parseConfig(data);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -29,6 +28,7 @@ import net.coreprotect.consumer.Queue;
|
||||
import net.coreprotect.database.Database;
|
||||
import net.coreprotect.database.statement.UserStatement;
|
||||
import net.coreprotect.language.Phrase;
|
||||
import net.coreprotect.listener.ListenerHandler;
|
||||
import net.coreprotect.model.BlockGroup;
|
||||
import net.coreprotect.paper.PaperAdapter;
|
||||
import net.coreprotect.patch.Patch;
|
||||
@@ -43,7 +43,7 @@ public class ConfigHandler extends Queue {
|
||||
public static final String EDITION_BRANCH = Util.getBranch();
|
||||
public static final String EDITION_NAME = Util.getPluginName();
|
||||
public static final String JAVA_VERSION = "11.0";
|
||||
public static final String SPIGOT_VERSION = "1.14";
|
||||
public static final String SPIGOT_VERSION = "1.15";
|
||||
public static String path = "plugins/CoreProtect/";
|
||||
public static String sqlite = "database.db";
|
||||
public static String host = "127.0.0.1";
|
||||
@@ -52,9 +52,12 @@ public class ConfigHandler extends Queue {
|
||||
public static String username = "root";
|
||||
public static String password = "";
|
||||
public static String prefix = "co_";
|
||||
public static int maximumPoolSize = 10;
|
||||
|
||||
public static HikariDataSource hikariDataSource = null;
|
||||
public static final boolean isSpigot = Util.isSpigot();
|
||||
public static final boolean isPaper = Util.isPaper();
|
||||
public static final boolean isFolia = Util.isFolia();
|
||||
public static volatile boolean serverRunning = false;
|
||||
public static volatile boolean converterRunning = false;
|
||||
public static volatile boolean purgeRunning = false;
|
||||
@@ -118,7 +121,7 @@ public class ConfigHandler extends Queue {
|
||||
public static Map<Integer, String> playerIdCacheReversed = syncMap();
|
||||
public static Map<String, List<Object>> lastRollback = syncMap();
|
||||
public static Map<String, Boolean> activeRollbacks = syncMap();
|
||||
public static Map<UUID, Object[]> entityBlockMapper = syncMap();
|
||||
public static Map<String, Object[]> entityBlockMapper = new ConcurrentHashMap<>();
|
||||
public static ConcurrentHashMap<Long, Long> populatedChunks = new ConcurrentHashMap<>();
|
||||
public static ConcurrentHashMap<String, String> language = new ConcurrentHashMap<>();
|
||||
public static List<String> databaseTables = new ArrayList<>();
|
||||
@@ -173,6 +176,7 @@ public class ConfigHandler extends Queue {
|
||||
ConfigHandler.database = Config.getGlobal().MYSQL_DATABASE;
|
||||
ConfigHandler.username = Config.getGlobal().MYSQL_USERNAME;
|
||||
ConfigHandler.password = Config.getGlobal().MYSQL_PASSWORD;
|
||||
ConfigHandler.maximumPoolSize = Config.getGlobal().MAXIMUM_POOL_SIZE;
|
||||
ConfigHandler.prefix = Config.getGlobal().PREFIX;
|
||||
|
||||
ConfigHandler.loadBlacklist(); // Load the blacklist file if it exists.
|
||||
@@ -229,6 +233,8 @@ public class ConfigHandler extends Queue {
|
||||
config.setJdbcUrl("jdbc:mysql://" + ConfigHandler.host + ":" + ConfigHandler.port + "/" + ConfigHandler.database);
|
||||
config.setUsername(ConfigHandler.username);
|
||||
config.setPassword(ConfigHandler.password);
|
||||
config.setMaximumPoolSize(ConfigHandler.maximumPoolSize);
|
||||
config.setMaxLifetime(60000);
|
||||
config.addDataSourceProperty("characterEncoding", "UTF-8");
|
||||
config.addDataSourceProperty("connectionTimeout", "10000");
|
||||
/* https://github.com/brettwooldridge/HikariCP/wiki/MySQL-Configuration */
|
||||
@@ -243,7 +249,7 @@ public class ConfigHandler extends Queue {
|
||||
config.addDataSourceProperty("maintainTimeStats", "false");
|
||||
/* Disable SSL to suppress the unverified server identity warning */
|
||||
config.addDataSourceProperty("allowPublicKeyRetrieval", "true");
|
||||
config.addDataSourceProperty("useSSL", "false");
|
||||
config.addDataSourceProperty("useSSL", Config.getGlobal().ENABLE_SSL);
|
||||
|
||||
ConfigHandler.hikariDataSource = new HikariDataSource(config);
|
||||
}
|
||||
@@ -413,6 +419,9 @@ public class ConfigHandler extends Queue {
|
||||
ConfigHandler.loadConfig(); // Load (or create) the configuration file.
|
||||
ConfigHandler.loadDatabase(); // Initialize MySQL and create tables if necessary.
|
||||
|
||||
if (startup) {
|
||||
ListenerHandler.registerNetworking(); // Register channels for networking API
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -456,4 +465,14 @@ public class ConfigHandler extends Queue {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void performDisable() {
|
||||
try {
|
||||
Database.closeConnection();
|
||||
ListenerHandler.unregisterNetworking(); // Unregister channels for networking API
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,6 +24,7 @@ import net.coreprotect.config.ConfigHandler;
|
||||
import net.coreprotect.consumer.process.Process;
|
||||
import net.coreprotect.listener.block.BlockUtil;
|
||||
import net.coreprotect.model.BlockGroup;
|
||||
import net.coreprotect.thread.Scheduler;
|
||||
import net.coreprotect.utility.Util;
|
||||
|
||||
public class Queue {
|
||||
@@ -85,7 +86,7 @@ public class Queue {
|
||||
}
|
||||
|
||||
protected static void queueBlockBreakValidate(final String user, final Block block, final BlockState blockState, final Material type, final String blockData, final int extraData, int ticks) {
|
||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(CoreProtect.getInstance(), () -> {
|
||||
Scheduler.scheduleSyncDelayedTask(CoreProtect.getInstance(), () -> {
|
||||
try {
|
||||
if (!block.getType().equals(type)) {
|
||||
queueBlockBreak(user, blockState, type, blockData, null, extraData, 0);
|
||||
@@ -94,7 +95,7 @@ public class Queue {
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}, ticks);
|
||||
}, block.getLocation(), ticks);
|
||||
}
|
||||
|
||||
protected static void queueBlockBreak(String user, BlockState block, Material type, String blockData, Material breakType, int extraData, int blockNumber) {
|
||||
@@ -178,18 +179,18 @@ public class Queue {
|
||||
}
|
||||
|
||||
protected static void queueBlockPlaceDelayed(final String user, final Location placed, final Material type, final String blockData, final BlockState replaced, int ticks) {
|
||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(CoreProtect.getInstance(), () -> {
|
||||
Scheduler.scheduleSyncDelayedTask(CoreProtect.getInstance(), () -> {
|
||||
try {
|
||||
queueBlockPlace(user, placed.getBlock().getState(), type, replaced, null, -1, 0, blockData);
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}, ticks);
|
||||
}, placed, ticks);
|
||||
}
|
||||
|
||||
protected static void queueBlockPlaceValidate(final String user, final BlockState blockLocation, final Block block, final BlockState blockReplaced, final Material forceT, final int forceD, final int forceData, final String blockData, int ticks) {
|
||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(CoreProtect.getInstance(), () -> {
|
||||
Scheduler.scheduleSyncDelayedTask(CoreProtect.getInstance(), () -> {
|
||||
try {
|
||||
Material blockType = block.getType();
|
||||
if (blockType.equals(forceT)) {
|
||||
@@ -204,11 +205,11 @@ public class Queue {
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}, ticks);
|
||||
}, blockLocation.getLocation(), ticks);
|
||||
}
|
||||
|
||||
protected static void queueBlockGravityValidate(final String user, final Location location, final Block block, final Material blockType, int ticks) {
|
||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(CoreProtect.getInstance(), () -> {
|
||||
Scheduler.scheduleSyncDelayedTask(CoreProtect.getInstance(), () -> {
|
||||
try {
|
||||
Block placementBlock = BlockUtil.gravityScan(location, blockType, user);
|
||||
if (!block.equals(placementBlock)) {
|
||||
@@ -218,7 +219,7 @@ public class Queue {
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}, ticks);
|
||||
}, location, ticks);
|
||||
}
|
||||
|
||||
protected static void queueContainerBreak(String user, Location location, Material type, ItemStack[] oldInventory) {
|
||||
@@ -351,7 +352,7 @@ public class Queue {
|
||||
queueStandardData(consumerId, currentConsumer, new String[] { user, null }, location);
|
||||
}
|
||||
|
||||
protected static void queueSignText(String user, Location location, int action, int color, boolean glowing, String line1, String line2, String line3, String line4, int offset) {
|
||||
protected static void queueSignText(String user, Location location, int action, int color, int colorSecondary, boolean frontGlowing, boolean backGlowing, boolean isWaxed, boolean isFront, String line1, String line2, String line3, String line4, String line5, String line6, String line7, String line8, int offset) {
|
||||
/*
|
||||
if (line1.length() == 0 && line2.length() == 0 && line3.length() == 0 && line4.length() == 0) {
|
||||
return;
|
||||
@@ -360,7 +361,7 @@ public class Queue {
|
||||
int currentConsumer = Consumer.currentConsumer;
|
||||
int consumerId = Consumer.newConsumerId(currentConsumer);
|
||||
addConsumer(currentConsumer, new Object[] { consumerId, Process.SIGN_TEXT, null, color, null, action, offset, null });
|
||||
Consumer.consumerSigns.get(currentConsumer).put(consumerId, new Object[] { (glowing == true ? 1 : 0), line1, line2, line3, line4 });
|
||||
Consumer.consumerSigns.get(currentConsumer).put(consumerId, new Object[] { colorSecondary, Util.getSignData(frontGlowing, backGlowing), isWaxed, isFront, line1, line2, line3, line4, line5, line6, line7, line8 });
|
||||
queueStandardData(consumerId, currentConsumer, new String[] { user, null }, location);
|
||||
}
|
||||
|
||||
|
||||
@@ -73,8 +73,10 @@ public class Process {
|
||||
return;
|
||||
}
|
||||
|
||||
Consumer.isPaused = true;
|
||||
Statement statement = connection.createStatement();
|
||||
Database.performCheckpoint(statement);
|
||||
|
||||
Consumer.isPaused = true;
|
||||
ArrayList<Object[]> consumerData = Consumer.consumer.get(processId);
|
||||
Map<Integer, String[]> users = Consumer.consumerUsers.get(processId);
|
||||
Map<Integer, Object> consumerObject = Consumer.consumerObjects.get(processId);
|
||||
|
||||
@@ -16,7 +16,7 @@ class SignTextProcess {
|
||||
Map<Integer, Object[]> signs = Consumer.consumerSigns.get(processId);
|
||||
if (signs.get(id) != null) {
|
||||
Object[] SIGN_DATA = signs.get(id);
|
||||
SignTextLogger.log(preparedStmt, batchCount, user, location, action, color, (Integer) SIGN_DATA[0], (String) SIGN_DATA[1], (String) SIGN_DATA[2], (String) SIGN_DATA[3], (String) SIGN_DATA[4], forceData);
|
||||
SignTextLogger.log(preparedStmt, batchCount, user, location, action, color, (Integer) SIGN_DATA[0], (Integer) SIGN_DATA[1], (Boolean) SIGN_DATA[2], (Boolean) SIGN_DATA[3], (String) SIGN_DATA[4], (String) SIGN_DATA[5], (String) SIGN_DATA[6], (String) SIGN_DATA[7], (String) SIGN_DATA[8], (String) SIGN_DATA[9], (String) SIGN_DATA[10], (String) SIGN_DATA[11], forceData);
|
||||
signs.remove(id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,10 +26,10 @@ class SignUpdateProcess {
|
||||
int userid = ConfigHandler.playerIdCache.get(user.toLowerCase(Locale.ROOT));
|
||||
String query = "";
|
||||
if (action == 0) {
|
||||
query = "SELECT color, data, line_1, line_2, line_3, line_4 FROM " + ConfigHandler.prefix + "sign WHERE user='" + userid + "' AND wid='" + wid + "' AND x='" + x + "' AND z='" + z + "' AND y='" + y + "' AND time < '" + time + "' ORDER BY rowid DESC LIMIT 0, 1";
|
||||
query = "SELECT color, color_secondary, data, waxed, face, line_1, line_2, line_3, line_4, line_5, line_6, line_7, line_8 FROM " + ConfigHandler.prefix + "sign WHERE user='" + userid + "' AND wid='" + wid + "' AND x='" + x + "' AND z='" + z + "' AND y='" + y + "' AND time < '" + time + "' ORDER BY rowid DESC LIMIT 0, 1";
|
||||
}
|
||||
else {
|
||||
query = "SELECT color, data, line_1, line_2, line_3, line_4 FROM " + ConfigHandler.prefix + "sign WHERE user='" + userid + "' AND wid='" + wid + "' AND x='" + x + "' AND z='" + z + "' AND y='" + y + "' AND time >= '" + time + "' ORDER BY rowid ASC LIMIT 0, 1";
|
||||
query = "SELECT color, color_secondary, data, waxed, face, line_1, line_2, line_3, line_4, line_5, line_6, line_7, line_8 FROM " + ConfigHandler.prefix + "sign WHERE user='" + userid + "' AND wid='" + wid + "' AND x='" + x + "' AND z='" + z + "' AND y='" + y + "' AND time >= '" + time + "' ORDER BY rowid ASC LIMIT 0, 1";
|
||||
}
|
||||
SignStatement.getData(statement, block, query);
|
||||
Util.updateBlock(block);
|
||||
|
||||
@@ -21,7 +21,10 @@ class StructureGrowthProcess {
|
||||
Map<Integer, List<BlockState>> blockLists = Consumer.consumerBlockList.get(processId);
|
||||
if (blockLists.get(id) != null) {
|
||||
List<BlockState> blockStates = blockLists.get(id);
|
||||
String resultData = Lookup.whoPlaced(statement, block);
|
||||
String resultData = Lookup.whoPlacedCache(block);
|
||||
if (resultData.isEmpty()) {
|
||||
resultData = Lookup.whoPlaced(statement, block);
|
||||
}
|
||||
if (resultData.length() > 0) {
|
||||
user = resultData;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
@@ -24,6 +23,7 @@ import net.coreprotect.consumer.Queue;
|
||||
import net.coreprotect.consumer.process.Process;
|
||||
import net.coreprotect.language.Phrase;
|
||||
import net.coreprotect.model.BlockGroup;
|
||||
import net.coreprotect.thread.Scheduler;
|
||||
import net.coreprotect.utility.Chat;
|
||||
import net.coreprotect.utility.Util;
|
||||
|
||||
@@ -46,9 +46,9 @@ public class ContainerRollback extends Queue {
|
||||
Queue.queueRollbackUpdate(userString, location, lookupList, Process.CONTAINER_ROLLBACK_UPDATE, rollbackType); // Perform update transaction in consumer
|
||||
|
||||
final String finalUserString = userString;
|
||||
ConfigHandler.rollbackHash.put(userString, new int[] { 0, 0, 0, 0 });
|
||||
ConfigHandler.rollbackHash.put(userString, new int[] { 0, 0, 0, 0, 0 });
|
||||
|
||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(CoreProtect.getInstance(), new Runnable() {
|
||||
Scheduler.scheduleSyncDelayedTask(CoreProtect.getInstance(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
@@ -140,13 +140,13 @@ public class ContainerRollback extends Queue {
|
||||
}
|
||||
matchingFrames.clear();
|
||||
|
||||
ConfigHandler.rollbackHash.put(finalUserString, new int[] { itemCount, modifyCount, entityCount, 1 });
|
||||
ConfigHandler.rollbackHash.put(finalUserString, new int[] { itemCount, modifyCount, entityCount, 1, 1 });
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}, 0);
|
||||
}, location, 0);
|
||||
|
||||
int[] rollbackHashData = ConfigHandler.rollbackHash.get(finalUserString);
|
||||
int next = rollbackHashData[3];
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -88,6 +89,12 @@ public class Database extends Queue {
|
||||
}
|
||||
}
|
||||
|
||||
public static void performCheckpoint(Statement statement) throws SQLException {
|
||||
if (!Config.getGlobal().MYSQL) {
|
||||
statement.executeUpdate("PRAGMA wal_checkpoint(TRUNCATE)");
|
||||
}
|
||||
}
|
||||
|
||||
public static void setMultiInt(PreparedStatement statement, int value, int count) {
|
||||
try {
|
||||
for (int i = 1; i <= count; i++) {
|
||||
@@ -208,7 +215,7 @@ public class Database extends Queue {
|
||||
public static PreparedStatement prepareStatement(Connection connection, int type, boolean keys) {
|
||||
PreparedStatement preparedStatement = null;
|
||||
try {
|
||||
String signInsert = "INSERT INTO " + ConfigHandler.prefix + "sign (time, user, wid, x, y, z, action, color, data, line_1, line_2, line_3, line_4) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
String signInsert = "INSERT INTO " + ConfigHandler.prefix + "sign (time, user, wid, x, y, z, action, color, color_secondary, data, waxed, face, line_1, line_2, line_3, line_4, line_5, line_6, line_7, line_8) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
String blockInsert = "INSERT INTO " + ConfigHandler.prefix + "block (time, user, wid, x, y, z, type, data, meta, blockdata, action, rolled_back) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
String skullInsert = "INSERT INTO " + ConfigHandler.prefix + "skull (time, owner) VALUES (?, ?)";
|
||||
String containerInsert = "INSERT INTO " + ConfigHandler.prefix + "container (time, user, wid, x, y, z, type, data, amount, metadata, action, rolled_back) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
@@ -295,7 +302,12 @@ public class Database extends Queue {
|
||||
private static void initializeTables(String prefix, Statement statement) {
|
||||
try {
|
||||
if (!Config.getGlobal().MYSQL) {
|
||||
statement.executeUpdate("PRAGMA journal_mode=WAL;");
|
||||
if (!Config.getGlobal().DISABLE_WAL) {
|
||||
statement.executeUpdate("PRAGMA journal_mode=WAL;");
|
||||
}
|
||||
else {
|
||||
statement.executeUpdate("PRAGMA journal_mode=DELETE;");
|
||||
}
|
||||
}
|
||||
|
||||
boolean lockInitialized = false;
|
||||
@@ -328,37 +340,37 @@ public class Database extends Queue {
|
||||
String index = "";
|
||||
Statement statement = connection.createStatement();
|
||||
index = ", INDEX(id)";
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "art_map(rowid int(8) NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid),id int(8),art varchar(255)" + index + ") ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4");
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "art_map(rowid int NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid),id int,art varchar(255)" + index + ") ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4");
|
||||
index = ", INDEX(wid,x,z,time), INDEX(user,time), INDEX(type,time)";
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "block(rowid bigint(20) NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid), time int(10), user int(8), wid int(4), x int(8), y int(3), z int(8), type int(6), data int(8), meta mediumblob, blockdata blob, action int(2), rolled_back tinyint(1)" + index + ") ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4");
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "block(rowid bigint NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid), time int, user int, wid int, x int, y int, z int, type int, data int, meta mediumblob, blockdata blob, action tinyint, rolled_back tinyint" + index + ") ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4");
|
||||
index = ", INDEX(time), INDEX(user,time), INDEX(wid,x,z,time)";
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "chat(rowid int(8) NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid),time int(10), user int(8), wid int(4), x int(8), y int (3), z int(8), message varchar(16000)" + index + ") ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4");
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "chat(rowid int NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid),time int, user int, wid int, x int, y int (3), z int, message varchar(16000)" + index + ") ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4");
|
||||
index = ", INDEX(time), INDEX(user,time), INDEX(wid,x,z,time)";
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "command(rowid int(8) NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid),time int(10), user int(8), wid int(4), x int(8), y int (3), z int(8), message varchar(16000)" + index + ") ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4");
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "command(rowid int NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid),time int, user int, wid int, x int, y int (3), z int, message varchar(16000)" + index + ") ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4");
|
||||
index = ", INDEX(wid,x,z,time), INDEX(user,time), INDEX(type,time)";
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "container(rowid int(10) NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid), time int(10), user int(8), wid int(4), x int(8), y int(3), z int(8), type int(6), data int(6), amount int(4), metadata blob, action int(2), rolled_back tinyint(1)" + index + ") ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4");
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "container(rowid int NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid), time int, user int, wid int, x int, y int, z int, type int, data int, amount int, metadata blob, action tinyint, rolled_back tinyint" + index + ") ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4");
|
||||
index = ", INDEX(wid,x,z,time), INDEX(user,time), INDEX(type,time)";
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "item(rowid int(10) NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid), time int(10), user int(8), wid int(4), x int(8), y int(3), z int(8), type int(6), data blob, amount int(4), action tinyint(1), rolled_back tinyint(1)" + index + ") ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4");
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "database_lock(rowid int(8) NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid),status tinyint(1),time int(10)) ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4");
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "entity(rowid int(8) NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid), time int(10), data blob) ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4");
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "item(rowid int NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid), time int, user int, wid int, x int, y int, z int, type int, data blob, amount int, action tinyint, rolled_back tinyint" + index + ") ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4");
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "database_lock(rowid int NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid),status tinyint,time int) ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4");
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "entity(rowid int NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid), time int, data blob) ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4");
|
||||
index = ", INDEX(id)";
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "entity_map(rowid int(8) NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid),id int(8),entity varchar(255)" + index + ") ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4");
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "entity_map(rowid int NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid),id int,entity varchar(255)" + index + ") ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4");
|
||||
index = ", INDEX(id)";
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "material_map(rowid int(8) NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid),id int(8),material varchar(255)" + index + ") ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4");
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "material_map(rowid int NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid),id int,material varchar(255)" + index + ") ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4");
|
||||
index = ", INDEX(id)";
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "blockdata_map(rowid int(8) NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid),id int(8),data varchar(255)" + index + ") ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4");
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "blockdata_map(rowid int NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid),id int,data varchar(255)" + index + ") ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4");
|
||||
index = ", INDEX(wid,x,z,time), INDEX(action,time), INDEX(user,time), INDEX(time)";
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "session(rowid int(8) NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid),time int(10), user int(8), wid int(4), x int(8), y int (3), z int(8), action int(1)" + index + ") ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4");
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "session(rowid int NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid),time int, user int, wid int, x int, y int (3), z int, action tinyint" + index + ") ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4");
|
||||
index = ", INDEX(wid,x,z,time), INDEX(user,time), INDEX(time)";
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "sign(rowid int(8) NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid),time int(10), user int(8), wid int(4), x int(8), y int(3), z int(8), action tinyint(1), color int(8), data tinyint(1), line_1 varchar(100), line_2 varchar(100), line_3 varchar(100), line_4 varchar(100)" + index + ") ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4");
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "skull(rowid int(8) NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid), time int(10), owner varchar(64)) ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4");
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "sign(rowid int NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid),time int, user int, wid int, x int, y int, z int, action tinyint, color int, color_secondary int, data tinyint, waxed tinyint, face tinyint, line_1 varchar(100), line_2 varchar(100), line_3 varchar(100), line_4 varchar(100), line_5 varchar(100), line_6 varchar(100), line_7 varchar(100), line_8 varchar(100)" + index + ") ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4");
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "skull(rowid int NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid), time int, owner varchar(64)) ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4");
|
||||
index = ", INDEX(user), INDEX(uuid)";
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "user(rowid int(8) NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid),time int(10),user varchar(100),uuid varchar(64)" + index + ") ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4");
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "user(rowid int NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid),time int,user varchar(100),uuid varchar(64)" + index + ") ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4");
|
||||
index = ", INDEX(uuid,user)";
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "username_log(rowid int(8) NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid),time int(10),uuid varchar(64),user varchar(100)" + index + ") ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4");
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "version(rowid int(8) NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid),time int(10),version varchar(16)) ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4");
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "username_log(rowid int NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid),time int,uuid varchar(64),user varchar(100)" + index + ") ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4");
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "version(rowid int NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid),time int,version varchar(16)) ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4");
|
||||
index = ", INDEX(id)";
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "world(rowid int(8) NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid),id int(8),world varchar(255)" + index + ") ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4");
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "world(rowid int NOT NULL AUTO_INCREMENT,PRIMARY KEY(rowid),id int,world varchar(255)" + index + ") ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4");
|
||||
if (!purge) {
|
||||
initializeTables(prefix, statement);
|
||||
}
|
||||
@@ -438,7 +450,7 @@ public class Database extends Queue {
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "session (time INTEGER, user INTEGER, wid INTEGER, x INTEGER, y INTEGER, z INTEGER, action INTEGER);");
|
||||
}
|
||||
if (!tableData.contains(prefix + "sign")) {
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "sign (time INTEGER, user INTEGER, wid INTEGER, x INTEGER, y INTEGER, z INTEGER, action INTEGER, color INTEGER, data INTEGER, line_1 TEXT, line_2 TEXT, line_3 TEXT, line_4 TEXT);");
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "sign (time INTEGER, user INTEGER, wid INTEGER, x INTEGER, y INTEGER, z INTEGER, action INTEGER, color INTEGER, color_secondary INTEGER, data INTEGER, waxed INTEGER, face INTEGER, line_1 TEXT, line_2 TEXT, line_3 TEXT, line_4 TEXT, line_5 TEXT, line_6 TEXT, line_7 TEXT, line_8 TEXT);");
|
||||
}
|
||||
if (!tableData.contains(prefix + "skull")) {
|
||||
statement.executeUpdate("CREATE TABLE IF NOT EXISTS " + prefix + "skull (id INTEGER PRIMARY KEY ASC, time INTEGER, owner TEXT);");
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.coreprotect.database;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
@@ -22,6 +23,7 @@ import net.coreprotect.consumer.Consumer;
|
||||
import net.coreprotect.consumer.Queue;
|
||||
import net.coreprotect.database.logger.ItemLogger;
|
||||
import net.coreprotect.database.statement.UserStatement;
|
||||
import net.coreprotect.listener.channel.PluginChannelHandshakeListener;
|
||||
import net.coreprotect.thread.CacheHandler;
|
||||
import net.coreprotect.utility.Util;
|
||||
|
||||
@@ -54,7 +56,7 @@ public class Lookup extends Queue {
|
||||
results[newId] = (String) map[i];
|
||||
}
|
||||
}
|
||||
else if (i == 13 && map[i] instanceof Byte[]) {
|
||||
else if (i == 13 && map[i] instanceof byte[]) {
|
||||
results[newId] = Util.byteDataToString((byte[]) map[i], (int) map[6]);
|
||||
}
|
||||
else if (i > 0) { // skip rowid
|
||||
@@ -64,6 +66,9 @@ public class Lookup extends Queue {
|
||||
else if (map[i] instanceof String) {
|
||||
results[newId] = (String) map[i];
|
||||
}
|
||||
else if (map[i] instanceof byte[]) {
|
||||
results[newId] = new String((byte[]) map[i], StandardCharsets.ISO_8859_1);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
@@ -147,6 +152,13 @@ public class Lookup extends Queue {
|
||||
String resultMessage = results.getString("message");
|
||||
|
||||
Object[] dataArray = new Object[] { resultId, resultTime, resultUserId, resultMessage };
|
||||
if (PluginChannelHandshakeListener.getInstance().isPluginChannelPlayer(user)) {
|
||||
int resultWorldId = results.getInt("wid");
|
||||
int resultX = results.getInt("x");
|
||||
int resultY = results.getInt("y");
|
||||
int resultZ = results.getInt("z");
|
||||
dataArray = new Object[] { resultId, resultTime, resultUserId, resultMessage, resultWorldId, resultX, resultY, resultZ };
|
||||
}
|
||||
list.add(dataArray);
|
||||
}
|
||||
else if (actionList.contains(8)) {
|
||||
@@ -179,36 +191,65 @@ public class Lookup extends Queue {
|
||||
int resultX = results.getInt("x");
|
||||
int resultY = results.getInt("y");
|
||||
int resultZ = results.getInt("z");
|
||||
boolean isFront = results.getInt("face") == 0;
|
||||
String line1 = results.getString("line_1");
|
||||
String line2 = results.getString("line_2");
|
||||
String line3 = results.getString("line_3");
|
||||
String line4 = results.getString("line_4");
|
||||
String line5 = results.getString("line_5");
|
||||
String line6 = results.getString("line_6");
|
||||
String line7 = results.getString("line_7");
|
||||
String line8 = results.getString("line_8");
|
||||
|
||||
StringBuilder message = new StringBuilder();
|
||||
if (line1 != null && line1.length() > 0) {
|
||||
if (isFront && line1 != null && line1.length() > 0) {
|
||||
message.append(line1);
|
||||
if (!line1.endsWith(" ")) {
|
||||
message.append(" ");
|
||||
}
|
||||
}
|
||||
if (line2 != null && line2.length() > 0) {
|
||||
if (isFront && line2 != null && line2.length() > 0) {
|
||||
message.append(line2);
|
||||
if (!line2.endsWith(" ")) {
|
||||
message.append(" ");
|
||||
}
|
||||
}
|
||||
if (line3 != null && line3.length() > 0) {
|
||||
if (isFront && line3 != null && line3.length() > 0) {
|
||||
message.append(line3);
|
||||
if (!line3.endsWith(" ")) {
|
||||
message.append(" ");
|
||||
}
|
||||
}
|
||||
if (line4 != null && line4.length() > 0) {
|
||||
if (isFront && line4 != null && line4.length() > 0) {
|
||||
message.append(line4);
|
||||
if (!line4.endsWith(" ")) {
|
||||
message.append(" ");
|
||||
}
|
||||
}
|
||||
if (!isFront && line5 != null && line5.length() > 0) {
|
||||
message.append(line5);
|
||||
if (!line5.endsWith(" ")) {
|
||||
message.append(" ");
|
||||
}
|
||||
}
|
||||
if (!isFront && line6 != null && line6.length() > 0) {
|
||||
message.append(line6);
|
||||
if (!line6.endsWith(" ")) {
|
||||
message.append(" ");
|
||||
}
|
||||
}
|
||||
if (!isFront && line7 != null && line7.length() > 0) {
|
||||
message.append(line7);
|
||||
if (!line7.endsWith(" ")) {
|
||||
message.append(" ");
|
||||
}
|
||||
}
|
||||
if (!isFront && line8 != null && line8.length() > 0) {
|
||||
message.append(line8);
|
||||
if (!line8.endsWith(" ")) {
|
||||
message.append(" ");
|
||||
}
|
||||
}
|
||||
|
||||
Object[] dataArray = new Object[] { resultId, resultTime, resultUserId, resultWorldId, resultX, resultY, resultZ, message.toString() };
|
||||
list.add(dataArray);
|
||||
@@ -584,7 +625,7 @@ public class Lookup extends Queue {
|
||||
}
|
||||
|
||||
if (actionList.contains(10)) {
|
||||
queryBlock = queryBlock + " action = '1' AND (LENGTH(line_1) > 0 OR LENGTH(line_2) > 0 OR LENGTH(line_3) > 0 OR LENGTH(line_4) > 0) AND";
|
||||
queryBlock = queryBlock + " action = '1' AND (LENGTH(line_1) > 0 OR LENGTH(line_2) > 0 OR LENGTH(line_3) > 0 OR LENGTH(line_4) > 0 OR LENGTH(line_5) > 0 OR LENGTH(line_6) > 0 OR LENGTH(line_7) > 0 OR LENGTH(line_8) > 0) AND";
|
||||
}
|
||||
|
||||
if (queryBlock.length() > 0) {
|
||||
@@ -619,6 +660,9 @@ public class Lookup extends Queue {
|
||||
else if (actionList.contains(6) || actionList.contains(7)) {
|
||||
queryTable = "chat";
|
||||
rows = "rowid as id,time,user,message";
|
||||
if (PluginChannelHandshakeListener.getInstance().isPluginChannelPlayer(user)) {
|
||||
rows += ",wid,x,y,z";
|
||||
}
|
||||
|
||||
if (actionList.contains(7)) {
|
||||
queryTable = "command";
|
||||
@@ -634,7 +678,7 @@ public class Lookup extends Queue {
|
||||
}
|
||||
else if (actionList.contains(10)) {
|
||||
queryTable = "sign";
|
||||
rows = "rowid as id,time,user,wid,x,y,z,line_1,line_2,line_3,line_4";
|
||||
rows = "rowid as id,time,user,wid,x,y,z,face,line_1,line_2,line_3,line_4,line_5,line_6,line_7,line_8";
|
||||
}
|
||||
else if (actionList.contains(11)) {
|
||||
queryTable = "item";
|
||||
@@ -650,24 +694,17 @@ public class Lookup extends Queue {
|
||||
|
||||
String unionSelect = "SELECT * FROM (";
|
||||
if (Config.getGlobal().MYSQL) {
|
||||
if (radius == null || users.length() > 0 || includeBlock.length() > 0 || includeEntity.length() > 0) {
|
||||
// index_mysql = "IGNORE INDEX(wid) ";
|
||||
if (users.length() > 0) {
|
||||
// index_mysql = "IGNORE INDEX(wid,type,action) ";
|
||||
}
|
||||
}
|
||||
|
||||
if (queryTable.equals("block")) {
|
||||
if (includeBlock.length() > 0 || includeEntity.length() > 0) {
|
||||
index = "USE INDEX(type) ";
|
||||
index = "USE INDEX(type) IGNORE INDEX(user,wid) ";
|
||||
}
|
||||
if (users.length() > 0) {
|
||||
index = "USE INDEX(user) ";
|
||||
index = "USE INDEX(user) IGNORE INDEX(type,wid) ";
|
||||
}
|
||||
if ((index.equals("") && restrictWorld)) {
|
||||
index = "USE INDEX(wid) ";
|
||||
if (radius != null && (radius[2] - radius[1]) <= 50 && (radius[6] - radius[5]) <= 50) {
|
||||
index = "USE INDEX(wid) IGNORE INDEX(type,user) ";
|
||||
}
|
||||
if ((radius != null || actionList.size() > 0)) {
|
||||
if ((restrictWorld && (users.length() > 0 || includeBlock.length() > 0 || includeEntity.length() > 0))) {
|
||||
index = "";
|
||||
}
|
||||
}
|
||||
@@ -682,10 +719,10 @@ public class Lookup extends Queue {
|
||||
if (users.length() > 0) {
|
||||
index = "INDEXED BY block_user_index ";
|
||||
}
|
||||
if ((index.equals("") && restrictWorld)) {
|
||||
if (radius != null && (radius[2] - radius[1]) <= 50 && (radius[6] - radius[5]) <= 50) {
|
||||
index = "INDEXED BY block_index ";
|
||||
}
|
||||
if ((radius != null || actionList.size() > 0)) {
|
||||
if ((restrictWorld && (users.length() > 0 || includeBlock.length() > 0 || includeEntity.length() > 0))) {
|
||||
index = "";
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -9,6 +9,7 @@ import org.bukkit.Material;
|
||||
|
||||
import net.coreprotect.CoreProtect;
|
||||
import net.coreprotect.bukkit.BukkitAdapter;
|
||||
import net.coreprotect.config.Config;
|
||||
import net.coreprotect.config.ConfigHandler;
|
||||
import net.coreprotect.database.statement.BlockStatement;
|
||||
import net.coreprotect.database.statement.UserStatement;
|
||||
@@ -48,7 +49,9 @@ public class BlockBreakLogger {
|
||||
}
|
||||
|
||||
CoreProtectPreLogEvent event = new CoreProtectPreLogEvent(user);
|
||||
CoreProtect.getInstance().getServer().getPluginManager().callEvent(event);
|
||||
if (Config.getGlobal().API_ENABLED) {
|
||||
CoreProtect.getInstance().getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
|
||||
int userId = UserStatement.getId(preparedStmt, event.getUser(), true);
|
||||
int wid = Util.getWorldId(location.getWorld().getName());
|
||||
@@ -57,6 +60,11 @@ public class BlockBreakLogger {
|
||||
int y = location.getBlockY();
|
||||
int z = location.getBlockZ();
|
||||
CacheHandler.breakCache.put("" + x + "." + y + "." + z + "." + wid + "", new Object[] { time, event.getUser(), type });
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
BlockStatement.insert(preparedStmt, batchCount, time, userId, wid, x, y, z, type, data, meta, blockData, 0, 0);
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
||||
@@ -9,6 +9,7 @@ import org.bukkit.block.BlockState;
|
||||
|
||||
import net.coreprotect.CoreProtect;
|
||||
import net.coreprotect.bukkit.BukkitAdapter;
|
||||
import net.coreprotect.config.Config;
|
||||
import net.coreprotect.config.ConfigHandler;
|
||||
import net.coreprotect.database.statement.BlockStatement;
|
||||
import net.coreprotect.database.statement.UserStatement;
|
||||
@@ -79,7 +80,9 @@ public class BlockPlaceLogger {
|
||||
}
|
||||
|
||||
CoreProtectPreLogEvent event = new CoreProtectPreLogEvent(user);
|
||||
CoreProtect.getInstance().getServer().getPluginManager().callEvent(event);
|
||||
if (Config.getGlobal().API_ENABLED) {
|
||||
CoreProtect.getInstance().getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
|
||||
int userId = UserStatement.getId(preparedStmt, event.getUser(), true);
|
||||
int wid = Util.getWorldId(block.getWorld().getName());
|
||||
@@ -89,8 +92,11 @@ public class BlockPlaceLogger {
|
||||
CacheHandler.lookupCache.put("" + x + "." + y + "." + z + "." + wid + "", new Object[] { time, event.getUser(), type });
|
||||
}
|
||||
|
||||
int internalType = Util.getBlockId(type.name(), true);
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int internalType = Util.getBlockId(type.name(), true);
|
||||
if (replacedType > 0 && Util.getType(replacedType) != Material.AIR && Util.getType(replacedType) != Material.CAVE_AIR) {
|
||||
BlockStatement.insert(preparedStmt, batchCount, time, userId, wid, x, y, z, replacedType, replacedData, null, replaceBlockData, 0, 0);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.Locale;
|
||||
import org.bukkit.Location;
|
||||
|
||||
import net.coreprotect.CoreProtect;
|
||||
import net.coreprotect.config.Config;
|
||||
import net.coreprotect.config.ConfigHandler;
|
||||
import net.coreprotect.database.statement.CommandStatement;
|
||||
import net.coreprotect.database.statement.UserStatement;
|
||||
@@ -28,7 +29,13 @@ public class CommandLogger {
|
||||
}
|
||||
|
||||
CoreProtectPreLogEvent event = new CoreProtectPreLogEvent(user);
|
||||
CoreProtect.getInstance().getServer().getPluginManager().callEvent(event);
|
||||
if (Config.getGlobal().API_ENABLED) {
|
||||
CoreProtect.getInstance().getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int userId = UserStatement.getId(preparedStmt, event.getUser(), true);
|
||||
int wid = Util.getWorldId(location.getWorld().getName());
|
||||
|
||||
@@ -9,12 +9,12 @@ import java.util.Map;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.ItemFrame;
|
||||
import org.bukkit.inventory.EntityEquipment;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import net.coreprotect.CoreProtect;
|
||||
import net.coreprotect.config.Config;
|
||||
import net.coreprotect.config.ConfigHandler;
|
||||
import net.coreprotect.consumer.Queue;
|
||||
import net.coreprotect.database.statement.ContainerStatement;
|
||||
@@ -34,16 +34,12 @@ public class ContainerLogger extends Queue {
|
||||
ItemStack[] contents = null;
|
||||
String faceData = null;
|
||||
|
||||
if (type == Material.ARMOR_STAND) {
|
||||
EntityEquipment equipment = (EntityEquipment) container;
|
||||
if (equipment != null) {
|
||||
contents = Util.getArmorStandContents(equipment);
|
||||
}
|
||||
if (type == Material.ITEM_FRAME) {
|
||||
contents = (ItemStack[]) ((Object[]) container)[1];
|
||||
faceData = ((BlockFace) ((Object[]) container)[2]).name();
|
||||
}
|
||||
else if (type == Material.ITEM_FRAME) {
|
||||
ItemFrame itemFrame = (ItemFrame) container;
|
||||
contents = Util.getItemFrameItem(itemFrame);
|
||||
faceData = itemFrame.getFacing().name();
|
||||
else if (type == Material.JUKEBOX || type == Material.ARMOR_STAND) {
|
||||
contents = (ItemStack[]) ((Object[]) container)[1];
|
||||
}
|
||||
else {
|
||||
Inventory inventory = (Inventory) container;
|
||||
@@ -61,6 +57,9 @@ public class ContainerLogger extends Queue {
|
||||
ItemStack[] oi1 = oldList.get(0);
|
||||
ItemStack[] oldInventory = Util.getContainerState(oi1);
|
||||
ItemStack[] newInventory = Util.getContainerState(contents);
|
||||
if (oldInventory == null || newInventory == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<ItemStack[]> forceList = ConfigHandler.forceContainer.get(loggingContainerId);
|
||||
if (forceList != null) {
|
||||
@@ -173,7 +172,13 @@ public class ContainerLogger extends Queue {
|
||||
}
|
||||
|
||||
CoreProtectPreLogEvent event = new CoreProtectPreLogEvent(user);
|
||||
CoreProtect.getInstance().getServer().getPluginManager().callEvent(event);
|
||||
if (Config.getGlobal().API_ENABLED) {
|
||||
CoreProtect.getInstance().getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int userId = UserStatement.getId(preparedStmt, event.getUser(), true);
|
||||
int wid = Util.getWorldId(location.getWorld().getName());
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.util.Locale;
|
||||
import org.bukkit.block.BlockState;
|
||||
|
||||
import net.coreprotect.CoreProtect;
|
||||
import net.coreprotect.config.Config;
|
||||
import net.coreprotect.config.ConfigHandler;
|
||||
import net.coreprotect.database.statement.BlockStatement;
|
||||
import net.coreprotect.database.statement.EntityStatement;
|
||||
@@ -28,7 +29,13 @@ public class EntityKillLogger {
|
||||
}
|
||||
|
||||
CoreProtectPreLogEvent event = new CoreProtectPreLogEvent(user);
|
||||
CoreProtect.getInstance().getServer().getPluginManager().callEvent(event);
|
||||
if (Config.getGlobal().API_ENABLED) {
|
||||
CoreProtect.getInstance().getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int userId = UserStatement.getId(preparedStmt, event.getUser(), true);
|
||||
int wid = Util.getWorldId(block.getWorld().getName());
|
||||
|
||||
@@ -10,6 +10,7 @@ import org.bukkit.Location;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import net.coreprotect.CoreProtect;
|
||||
import net.coreprotect.config.Config;
|
||||
import net.coreprotect.config.ConfigHandler;
|
||||
import net.coreprotect.database.statement.ItemStatement;
|
||||
import net.coreprotect.database.statement.UserStatement;
|
||||
@@ -125,7 +126,13 @@ public class ItemLogger {
|
||||
}
|
||||
|
||||
CoreProtectPreLogEvent event = new CoreProtectPreLogEvent(user);
|
||||
CoreProtect.getInstance().getServer().getPluginManager().callEvent(event);
|
||||
if (Config.getGlobal().API_ENABLED) {
|
||||
CoreProtect.getInstance().getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int userId = UserStatement.getId(preparedStmt, event.getUser(), true);
|
||||
int wid = Util.getWorldId(location.getWorld().getName());
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockState;
|
||||
|
||||
import net.coreprotect.CoreProtect;
|
||||
import net.coreprotect.config.Config;
|
||||
import net.coreprotect.config.ConfigHandler;
|
||||
import net.coreprotect.database.statement.BlockStatement;
|
||||
import net.coreprotect.database.statement.UserStatement;
|
||||
@@ -27,7 +28,13 @@ public class PlayerInteractLogger {
|
||||
}
|
||||
|
||||
CoreProtectPreLogEvent event = new CoreProtectPreLogEvent(user);
|
||||
CoreProtect.getInstance().getServer().getPluginManager().callEvent(event);
|
||||
if (Config.getGlobal().API_ENABLED) {
|
||||
CoreProtect.getInstance().getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int userId = UserStatement.getId(preparedStmt, event.getUser(), true);
|
||||
int wid = Util.getWorldId(block.getWorld().getName());
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.Locale;
|
||||
import org.bukkit.block.BlockState;
|
||||
|
||||
import net.coreprotect.CoreProtect;
|
||||
import net.coreprotect.config.Config;
|
||||
import net.coreprotect.config.ConfigHandler;
|
||||
import net.coreprotect.database.statement.BlockStatement;
|
||||
import net.coreprotect.database.statement.UserStatement;
|
||||
@@ -24,8 +25,18 @@ public class PlayerKillLogger {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ConfigHandler.playerIdCache.get(player.toLowerCase(Locale.ROOT)) == null) {
|
||||
UserStatement.loadId(preparedStmt.getConnection(), player, null);
|
||||
}
|
||||
|
||||
CoreProtectPreLogEvent event = new CoreProtectPreLogEvent(user);
|
||||
CoreProtect.getInstance().getServer().getPluginManager().callEvent(event);
|
||||
if (Config.getGlobal().API_ENABLED) {
|
||||
CoreProtect.getInstance().getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int userId = UserStatement.getId(preparedStmt, event.getUser(), true);
|
||||
int playerId = ConfigHandler.playerIdCache.get(player.toLowerCase(Locale.ROOT));
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.Locale;
|
||||
import org.bukkit.Location;
|
||||
|
||||
import net.coreprotect.CoreProtect;
|
||||
import net.coreprotect.config.Config;
|
||||
import net.coreprotect.config.ConfigHandler;
|
||||
import net.coreprotect.database.statement.SignStatement;
|
||||
import net.coreprotect.database.statement.UserStatement;
|
||||
@@ -18,14 +19,20 @@ public class SignTextLogger {
|
||||
throw new IllegalStateException("Database class");
|
||||
}
|
||||
|
||||
public static void log(PreparedStatement preparedStmt, int batchCount, String user, Location location, int action, int color, int data, String line1, String line2, String line3, String line4, int timeOffset) {
|
||||
public static void log(PreparedStatement preparedStmt, int batchCount, String user, Location location, int action, int color, int colorSecondary, int data, boolean isWaxed, boolean isFront, String line1, String line2, String line3, String line4, String line5, String line6, String line7, String line8, int timeOffset) {
|
||||
try {
|
||||
if (ConfigHandler.blacklist.get(user.toLowerCase(Locale.ROOT)) != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
CoreProtectPreLogEvent event = new CoreProtectPreLogEvent(user);
|
||||
CoreProtect.getInstance().getServer().getPluginManager().callEvent(event);
|
||||
if (Config.getGlobal().API_ENABLED) {
|
||||
CoreProtect.getInstance().getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int userId = UserStatement.getId(preparedStmt, event.getUser(), true);
|
||||
int wid = Util.getWorldId(location.getWorld().getName());
|
||||
@@ -33,7 +40,21 @@ public class SignTextLogger {
|
||||
int x = location.getBlockX();
|
||||
int y = location.getBlockY();
|
||||
int z = location.getBlockZ();
|
||||
SignStatement.insert(preparedStmt, batchCount, time, userId, wid, x, y, z, action, color, data, line1, line2, line3, line4);
|
||||
|
||||
if (line1.isEmpty() && line2.isEmpty() && line3.isEmpty() && line4.isEmpty()) {
|
||||
line1 = null;
|
||||
line2 = null;
|
||||
line3 = null;
|
||||
line4 = null;
|
||||
}
|
||||
if (line5.isEmpty() && line6.isEmpty() && line7.isEmpty() && line8.isEmpty()) {
|
||||
line5 = null;
|
||||
line6 = null;
|
||||
line7 = null;
|
||||
line8 = null;
|
||||
}
|
||||
|
||||
SignStatement.insert(preparedStmt, batchCount, time, userId, wid, x, y, z, action, color, colorSecondary, data, isWaxed ? 1 : 0, isFront ? 0 : 1, line1, line2, line3, line4, line5, line6, line7, line8);
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -12,6 +12,7 @@ import net.coreprotect.config.ConfigHandler;
|
||||
import net.coreprotect.database.statement.UserStatement;
|
||||
import net.coreprotect.language.Phrase;
|
||||
import net.coreprotect.language.Selector;
|
||||
import net.coreprotect.listener.channel.PluginChannelListener;
|
||||
import net.coreprotect.utility.Color;
|
||||
import net.coreprotect.utility.Util;
|
||||
|
||||
@@ -130,6 +131,7 @@ public class BlockLookup {
|
||||
}
|
||||
|
||||
resultTextBuilder.append(timeAgo + " " + tag + " ").append(Phrase.build(phrase, Color.DARK_AQUA + rbFormat + resultUser + Color.WHITE + rbFormat, Color.DARK_AQUA + rbFormat + target + Color.WHITE, selector)).append("\n");
|
||||
PluginChannelListener.getInstance().sendData(commandSender, resultTime, phrase, selector, resultUser, target, -1, x, y, z, worldId, rbFormat, false, tag.contains("+"));
|
||||
}
|
||||
|
||||
resultText = resultTextBuilder.toString();
|
||||
|
||||
@@ -2,6 +2,8 @@ package net.coreprotect.database.lookup;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.bukkit.Location;
|
||||
@@ -12,13 +14,14 @@ import net.coreprotect.config.ConfigHandler;
|
||||
import net.coreprotect.database.statement.UserStatement;
|
||||
import net.coreprotect.language.Phrase;
|
||||
import net.coreprotect.language.Selector;
|
||||
import net.coreprotect.listener.channel.PluginChannelListener;
|
||||
import net.coreprotect.utility.Color;
|
||||
import net.coreprotect.utility.Util;
|
||||
|
||||
public class ChestTransactionLookup {
|
||||
|
||||
public static String performLookup(String command, Statement statement, Location l, CommandSender commandSender, int page, int limit, boolean exact) {
|
||||
String result = "";
|
||||
public static List<String> performLookup(String command, Statement statement, Location l, CommandSender commandSender, int page, int limit, boolean exact) {
|
||||
List<String> result = new ArrayList<>();
|
||||
|
||||
try {
|
||||
if (l == null) {
|
||||
@@ -66,13 +69,11 @@ public class ChestTransactionLookup {
|
||||
|
||||
int totalPages = (int) Math.ceil(count / (limit + 0.0));
|
||||
|
||||
query = "SELECT time,user,action,type,data,amount,rolled_back FROM " + ConfigHandler.prefix + "container " + Util.getWidIndex("container") + "WHERE wid = '" + worldId + "' AND (x = '" + x + "' OR x = '" + x2 + "') AND (z = '" + z + "' OR z = '" + z2 + "') AND y = '" + y + "' ORDER BY rowid DESC LIMIT " + pageStart + ", " + limit + "";
|
||||
query = "SELECT time,user,action,type,data,amount,metadata,rolled_back FROM " + ConfigHandler.prefix + "container " + Util.getWidIndex("container") + "WHERE wid = '" + worldId + "' AND (x = '" + x + "' OR x = '" + x2 + "') AND (z = '" + z + "' OR z = '" + z2 + "') AND y = '" + y + "' ORDER BY rowid DESC LIMIT " + pageStart + ", " + limit + "";
|
||||
if (exact) {
|
||||
query = "SELECT time,user,action,type,data,amount,rolled_back FROM " + ConfigHandler.prefix + "container " + Util.getWidIndex("container") + "WHERE wid = '" + worldId + "' AND (x = '" + l.getBlockX() + "') AND (z = '" + l.getBlockZ() + "') AND y = '" + y + "' ORDER BY rowid DESC LIMIT " + pageStart + ", " + limit + "";
|
||||
query = "SELECT time,user,action,type,data,amount,metadata,rolled_back FROM " + ConfigHandler.prefix + "container " + Util.getWidIndex("container") + "WHERE wid = '" + worldId + "' AND (x = '" + l.getBlockX() + "') AND (z = '" + l.getBlockZ() + "') AND y = '" + y + "' ORDER BY rowid DESC LIMIT " + pageStart + ", " + limit + "";
|
||||
}
|
||||
results = statement.executeQuery(query);
|
||||
|
||||
StringBuilder resultBuilder = new StringBuilder();
|
||||
while (results.next()) {
|
||||
int resultUserId = results.getInt("user");
|
||||
int resultAction = results.getInt("action");
|
||||
@@ -81,6 +82,8 @@ public class ChestTransactionLookup {
|
||||
long resultTime = results.getLong("time");
|
||||
int resultAmount = results.getInt("amount");
|
||||
int resultRolledBack = results.getInt("rolled_back");
|
||||
byte[] resultMetadata = results.getBytes("metadata");
|
||||
String tooltip = Util.getEnchantments(resultMetadata, resultType, resultAmount);
|
||||
|
||||
if (ConfigHandler.playerIdCacheReversed.get(resultUserId) == null) {
|
||||
UserStatement.loadName(statement.getConnection(), resultUserId);
|
||||
@@ -90,7 +93,7 @@ public class ChestTransactionLookup {
|
||||
String timeAgo = Util.getTimeSince(resultTime, time, true);
|
||||
|
||||
if (!found) {
|
||||
resultBuilder = new StringBuilder(Color.WHITE + "----- " + Color.DARK_AQUA + Phrase.build(Phrase.CONTAINER_HEADER) + Color.WHITE + " ----- " + Util.getCoordinates(command, worldId, x, y, z, false, false) + "\n");
|
||||
result.add(new StringBuilder(Color.WHITE + "----- " + Color.DARK_AQUA + Phrase.build(Phrase.CONTAINER_HEADER) + Color.WHITE + " ----- " + Util.getCoordinates(command, worldId, x, y, z, false, false)).toString());
|
||||
}
|
||||
found = true;
|
||||
|
||||
@@ -116,24 +119,23 @@ public class ChestTransactionLookup {
|
||||
target = target.split(":")[1];
|
||||
}
|
||||
|
||||
resultBuilder.append(timeAgo + " " + tag + " ").append(Phrase.build(Phrase.LOOKUP_CONTAINER, Color.DARK_AQUA + rbFormat + resultUser + Color.WHITE + rbFormat, "x" + resultAmount, Color.DARK_AQUA + rbFormat + target + Color.WHITE, selector)).append("\n");
|
||||
result.add(new StringBuilder(timeAgo + " " + tag + " " + Phrase.build(Phrase.LOOKUP_CONTAINER, Color.DARK_AQUA + rbFormat + resultUser + Color.WHITE + rbFormat, "x" + resultAmount, Util.createTooltip(Color.DARK_AQUA + rbFormat + target, tooltip) + Color.WHITE, selector)).toString());
|
||||
PluginChannelListener.getInstance().sendData(commandSender, resultTime, Phrase.LOOKUP_CONTAINER, selector, resultUser, target, resultAmount, x, y, z, worldId, rbFormat, true, tag.contains("+"));
|
||||
}
|
||||
result = resultBuilder.toString();
|
||||
results.close();
|
||||
|
||||
if (found) {
|
||||
if (count > limit) {
|
||||
String pageInfo = Color.WHITE + "-----\n";
|
||||
pageInfo = pageInfo + Util.getPageNavigation(command, page, totalPages) + "\n";
|
||||
result = result + pageInfo;
|
||||
result.add(Color.WHITE + "-----");
|
||||
result.add(Util.getPageNavigation(command, page, totalPages));
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (rowMax > count && count > 0) {
|
||||
result = Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_RESULTS_PAGE, Selector.SECOND);
|
||||
result.add(Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_RESULTS_PAGE, Selector.SECOND));
|
||||
}
|
||||
else {
|
||||
result = Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_DATA_LOCATION, Selector.SECOND);
|
||||
result.add(Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NO_DATA_LOCATION, Selector.SECOND));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import net.coreprotect.config.ConfigHandler;
|
||||
import net.coreprotect.database.statement.UserStatement;
|
||||
import net.coreprotect.language.Phrase;
|
||||
import net.coreprotect.language.Selector;
|
||||
import net.coreprotect.listener.channel.PluginChannelListener;
|
||||
import net.coreprotect.utility.Color;
|
||||
import net.coreprotect.utility.Util;
|
||||
|
||||
@@ -108,6 +109,7 @@ public class InteractionLookup {
|
||||
}
|
||||
|
||||
resultBuilder.append(timeAgo + " " + Color.WHITE + "- ").append(Phrase.build(Phrase.LOOKUP_INTERACTION, Color.DARK_AQUA + rbFormat + resultUser + Color.WHITE + rbFormat, Color.DARK_AQUA + rbFormat + target + Color.WHITE, Selector.FIRST)).append("\n");
|
||||
PluginChannelListener.getInstance().sendData(commandSender, resultTime, Phrase.LOOKUP_INTERACTION, Selector.FIRST, resultUser, target, -1, x, y, z, worldId, rbFormat, false, false);
|
||||
}
|
||||
result = resultBuilder.toString();
|
||||
results.close();
|
||||
|
||||
@@ -4,6 +4,8 @@ import java.sql.ResultSet;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -12,11 +14,14 @@ import net.coreprotect.config.ConfigHandler;
|
||||
import net.coreprotect.database.statement.UserStatement;
|
||||
import net.coreprotect.language.Phrase;
|
||||
import net.coreprotect.language.Selector;
|
||||
import net.coreprotect.listener.channel.PluginChannelListener;
|
||||
import net.coreprotect.utility.Color;
|
||||
import net.coreprotect.utility.Util;
|
||||
|
||||
public class SignMessageLookup {
|
||||
|
||||
static Pattern pattern = Pattern.compile("§x(§[a-fA-F0-9]){6}");
|
||||
|
||||
public static List<String> performLookup(String command, Statement statement, Location l, CommandSender commandSender, int page, int limit) {
|
||||
List<String> result = new ArrayList<>();
|
||||
|
||||
@@ -50,7 +55,7 @@ public class SignMessageLookup {
|
||||
int rowMax = page * limit;
|
||||
int pageStart = rowMax - limit;
|
||||
|
||||
String query = "SELECT COUNT(*) as count from " + ConfigHandler.prefix + "sign " + Util.getWidIndex("sign") + "WHERE wid = '" + worldId + "' AND x = '" + x + "' AND z = '" + z + "' AND y = '" + y + "' AND action = '1' AND (LENGTH(line_1) > 0 OR LENGTH(line_2) > 0 OR LENGTH(line_3) > 0 OR LENGTH(line_4) > 0) LIMIT 0, 1";
|
||||
String query = "SELECT COUNT(*) as count from " + ConfigHandler.prefix + "sign " + Util.getWidIndex("sign") + "WHERE wid = '" + worldId + "' AND x = '" + x + "' AND z = '" + z + "' AND y = '" + y + "' AND action = '1' AND (LENGTH(line_1) > 0 OR LENGTH(line_2) > 0 OR LENGTH(line_3) > 0 OR LENGTH(line_4) > 0 OR LENGTH(line_5) > 0 OR LENGTH(line_6) > 0 OR LENGTH(line_7) > 0 OR LENGTH(line_8) > 0) LIMIT 0, 1";
|
||||
ResultSet results = statement.executeQuery(query);
|
||||
|
||||
while (results.next()) {
|
||||
@@ -60,7 +65,7 @@ public class SignMessageLookup {
|
||||
|
||||
int totalPages = (int) Math.ceil(count / (limit + 0.0));
|
||||
|
||||
query = "SELECT time,user,line_1,line_2,line_3,line_4 FROM " + ConfigHandler.prefix + "sign " + Util.getWidIndex("sign") + "WHERE wid = '" + worldId + "' AND x = '" + x + "' AND z = '" + z + "' AND y = '" + y + "' AND action = '1' AND (LENGTH(line_1) > 0 OR LENGTH(line_2) > 0 OR LENGTH(line_3) > 0 OR LENGTH(line_4) > 0) ORDER BY rowid DESC LIMIT " + pageStart + ", " + limit + "";
|
||||
query = "SELECT time,user,face,line_1,line_2,line_3,line_4,line_5,line_6,line_7,line_8 FROM " + ConfigHandler.prefix + "sign " + Util.getWidIndex("sign") + "WHERE wid = '" + worldId + "' AND x = '" + x + "' AND z = '" + z + "' AND y = '" + y + "' AND action = '1' AND (LENGTH(line_1) > 0 OR LENGTH(line_2) > 0 OR LENGTH(line_3) > 0 OR LENGTH(line_4) > 0 OR LENGTH(line_5) > 0 OR LENGTH(line_6) > 0 OR LENGTH(line_7) > 0 OR LENGTH(line_8) > 0) ORDER BY rowid DESC LIMIT " + pageStart + ", " + limit + "";
|
||||
results = statement.executeQuery(query);
|
||||
|
||||
while (results.next()) {
|
||||
@@ -70,32 +75,69 @@ public class SignMessageLookup {
|
||||
String line2 = results.getString("line_2");
|
||||
String line3 = results.getString("line_3");
|
||||
String line4 = results.getString("line_4");
|
||||
String line5 = results.getString("line_5");
|
||||
String line6 = results.getString("line_6");
|
||||
String line7 = results.getString("line_7");
|
||||
String line8 = results.getString("line_8");
|
||||
boolean isFront = results.getInt("face") == 0;
|
||||
|
||||
StringBuilder message = new StringBuilder();
|
||||
if (line1 != null && line1.length() > 0) {
|
||||
if (isFront && line1 != null && line1.length() > 0) {
|
||||
message.append(line1);
|
||||
if (!line1.endsWith(" ")) {
|
||||
message.append(" ");
|
||||
}
|
||||
}
|
||||
if (line2 != null && line2.length() > 0) {
|
||||
if (isFront && line2 != null && line2.length() > 0) {
|
||||
message.append(line2);
|
||||
if (!line2.endsWith(" ")) {
|
||||
message.append(" ");
|
||||
}
|
||||
}
|
||||
if (line3 != null && line3.length() > 0) {
|
||||
if (isFront && line3 != null && line3.length() > 0) {
|
||||
message.append(line3);
|
||||
if (!line3.endsWith(" ")) {
|
||||
message.append(" ");
|
||||
}
|
||||
}
|
||||
if (line4 != null && line4.length() > 0) {
|
||||
if (isFront && line4 != null && line4.length() > 0) {
|
||||
message.append(line4);
|
||||
if (!line4.endsWith(" ")) {
|
||||
message.append(" ");
|
||||
}
|
||||
}
|
||||
if (!isFront && line5 != null && line5.length() > 0) {
|
||||
message.append(line5);
|
||||
if (!line5.endsWith(" ")) {
|
||||
message.append(" ");
|
||||
}
|
||||
}
|
||||
if (!isFront && line6 != null && line6.length() > 0) {
|
||||
message.append(line6);
|
||||
if (!line6.endsWith(" ")) {
|
||||
message.append(" ");
|
||||
}
|
||||
}
|
||||
if (!isFront && line7 != null && line7.length() > 0) {
|
||||
message.append(line7);
|
||||
if (!line7.endsWith(" ")) {
|
||||
message.append(" ");
|
||||
}
|
||||
}
|
||||
if (!isFront && line8 != null && line8.length() > 0) {
|
||||
message.append(line8);
|
||||
if (!line8.endsWith(" ")) {
|
||||
message.append(" ");
|
||||
}
|
||||
}
|
||||
|
||||
String parsedMessage = message.toString();
|
||||
if (parsedMessage.contains("§x")) {
|
||||
for (Matcher matcher = pattern.matcher(parsedMessage); matcher.find(); matcher = pattern.matcher(parsedMessage)) {
|
||||
String color = parsedMessage.substring(matcher.start(), matcher.end());
|
||||
parsedMessage = parsedMessage.replace(color, "");
|
||||
}
|
||||
}
|
||||
|
||||
if (ConfigHandler.playerIdCacheReversed.get(resultUserId) == null) {
|
||||
UserStatement.loadName(statement.getConnection(), resultUserId);
|
||||
@@ -108,7 +150,8 @@ public class SignMessageLookup {
|
||||
result.add(new StringBuilder(Color.WHITE + "----- " + Color.DARK_AQUA + Phrase.build(Phrase.SIGN_HEADER) + Color.WHITE + " ----- " + Util.getCoordinates(command, worldId, x, y, z, false, false) + "").toString());
|
||||
}
|
||||
found = true;
|
||||
result.add(timeAgo + Color.WHITE + " - " + Color.DARK_AQUA + resultUser + ": " + Color.WHITE + "\n" + message.toString() + Color.WHITE);
|
||||
result.add(timeAgo + Color.WHITE + " - " + Color.DARK_AQUA + resultUser + ": " + Color.WHITE + "\n" + parsedMessage + Color.WHITE);
|
||||
PluginChannelListener.getInstance().sendMessageData(commandSender, resultTime, resultUser, message.toString(), true, x, y, z, worldId);
|
||||
}
|
||||
results.close();
|
||||
|
||||
|
||||
@@ -4,12 +4,11 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Statement;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.Sign;
|
||||
|
||||
import net.coreprotect.bukkit.BukkitAdapter;
|
||||
import net.coreprotect.utility.Util;
|
||||
|
||||
public class SignStatement {
|
||||
|
||||
@@ -17,7 +16,7 @@ public class SignStatement {
|
||||
throw new IllegalStateException("Database class");
|
||||
}
|
||||
|
||||
public static void insert(PreparedStatement preparedStmt, int batchCount, int time, int id, int wid, int x, int y, int z, int action, int color, int data, String line1, String line2, String line3, String line4) {
|
||||
public static void insert(PreparedStatement preparedStmt, int batchCount, int time, int id, int wid, int x, int y, int z, int action, int color, int colorSecondary, int data, int waxed, int face, String line1, String line2, String line3, String line4, String line5, String line6, String line7, String line8) {
|
||||
try {
|
||||
preparedStmt.setInt(1, time);
|
||||
preparedStmt.setInt(2, id);
|
||||
@@ -27,11 +26,18 @@ public class SignStatement {
|
||||
preparedStmt.setInt(6, z);
|
||||
preparedStmt.setInt(7, action);
|
||||
preparedStmt.setInt(8, color);
|
||||
preparedStmt.setInt(9, data);
|
||||
preparedStmt.setString(10, line1);
|
||||
preparedStmt.setString(11, line2);
|
||||
preparedStmt.setString(12, line3);
|
||||
preparedStmt.setString(13, line4);
|
||||
preparedStmt.setInt(9, colorSecondary);
|
||||
preparedStmt.setInt(10, data);
|
||||
preparedStmt.setInt(11, waxed);
|
||||
preparedStmt.setInt(12, face);
|
||||
preparedStmt.setString(13, line1);
|
||||
preparedStmt.setString(14, line2);
|
||||
preparedStmt.setString(15, line3);
|
||||
preparedStmt.setString(16, line4);
|
||||
preparedStmt.setString(17, line5);
|
||||
preparedStmt.setString(18, line6);
|
||||
preparedStmt.setString(19, line7);
|
||||
preparedStmt.setString(20, line8);
|
||||
preparedStmt.addBatch();
|
||||
|
||||
if (batchCount > 0 && batchCount % 1000 == 0) {
|
||||
@@ -54,24 +60,39 @@ public class SignStatement {
|
||||
|
||||
while (resultSet.next()) {
|
||||
int color = resultSet.getInt("color");
|
||||
int colorSecondary = resultSet.getInt("color_secondary");
|
||||
int data = resultSet.getInt("data");
|
||||
boolean isWaxed = resultSet.getInt("waxed") == 1;
|
||||
// boolean isFront = resultSet.getInt("face") == 0;
|
||||
String line1 = resultSet.getString("line_1");
|
||||
String line2 = resultSet.getString("line_2");
|
||||
String line3 = resultSet.getString("line_3");
|
||||
String line4 = resultSet.getString("line_4");
|
||||
String line5 = resultSet.getString("line_5");
|
||||
String line6 = resultSet.getString("line_6");
|
||||
String line7 = resultSet.getString("line_7");
|
||||
String line8 = resultSet.getString("line_8");
|
||||
|
||||
if (color > 0) {
|
||||
sign.setColor(DyeColor.getByColor(Color.fromRGB(color)));
|
||||
BukkitAdapter.ADAPTER.setColor(sign, true, color);
|
||||
}
|
||||
if (colorSecondary > 0) {
|
||||
BukkitAdapter.ADAPTER.setColor(sign, false, colorSecondary);
|
||||
}
|
||||
|
||||
if (data > 0) {
|
||||
BukkitAdapter.ADAPTER.setGlowing(sign, (data == 1 ? true : false));
|
||||
}
|
||||
|
||||
sign.setLine(0, line1);
|
||||
sign.setLine(1, line2);
|
||||
sign.setLine(2, line3);
|
||||
sign.setLine(3, line4);
|
||||
boolean frontGlowing = Util.isSideGlowing(true, data);
|
||||
boolean backGlowing = Util.isSideGlowing(false, data);
|
||||
BukkitAdapter.ADAPTER.setGlowing(sign, true, frontGlowing);
|
||||
BukkitAdapter.ADAPTER.setGlowing(sign, false, backGlowing);
|
||||
BukkitAdapter.ADAPTER.setLine(sign, 0, line1);
|
||||
BukkitAdapter.ADAPTER.setLine(sign, 1, line2);
|
||||
BukkitAdapter.ADAPTER.setLine(sign, 2, line3);
|
||||
BukkitAdapter.ADAPTER.setLine(sign, 3, line4);
|
||||
BukkitAdapter.ADAPTER.setLine(sign, 4, line5);
|
||||
BukkitAdapter.ADAPTER.setLine(sign, 5, line6);
|
||||
BukkitAdapter.ADAPTER.setLine(sign, 6, line7);
|
||||
BukkitAdapter.ADAPTER.setLine(sign, 7, line8);
|
||||
BukkitAdapter.ADAPTER.setWaxed(sign, isWaxed);
|
||||
}
|
||||
|
||||
resultSet.close();
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package net.coreprotect.event;
|
||||
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class CoreProtectPreLogEvent extends Event {
|
||||
public class CoreProtectPreLogEvent extends Event implements Cancellable {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled = false;
|
||||
private String user;
|
||||
|
||||
public CoreProtectPreLogEvent(String user) {
|
||||
@@ -17,6 +19,16 @@ public class CoreProtectPreLogEvent extends Event {
|
||||
return user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
public void setUser(String newUser) {
|
||||
if (newUser == null || newUser.isEmpty()) {
|
||||
throw new IllegalArgumentException("Invalid user");
|
||||
|
||||
@@ -154,6 +154,8 @@ public class Language {
|
||||
phrases.put(Phrase.MISSING_ROLLBACK_RADIUS, "You did not specify a {rollback|restore} radius.");
|
||||
phrases.put(Phrase.MISSING_ROLLBACK_USER, "You did not specify a {rollback|restore} user.");
|
||||
phrases.put(Phrase.MYSQL_UNAVAILABLE, "Unable to connect to MySQL server.");
|
||||
phrases.put(Phrase.NETWORK_CONNECTION, "Connection by {0} {successful|failed}. Using {1} {2}.");
|
||||
phrases.put(Phrase.NETWORK_TEST, "Network test data has been successful sent.");
|
||||
phrases.put(Phrase.NO_DATA, "No data found at {0}.");
|
||||
phrases.put(Phrase.NO_DATA_LOCATION, "No {data|transactions|interactions|messages} found at this location.");
|
||||
phrases.put(Phrase.NO_PERMISSION, "You do not have permission to do that.");
|
||||
|
||||
@@ -3,6 +3,8 @@ package net.coreprotect.language;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import net.coreprotect.utility.ChatMessage;
|
||||
import net.coreprotect.utility.Color;
|
||||
@@ -135,6 +137,8 @@ public enum Phrase {
|
||||
MISSING_ROLLBACK_RADIUS,
|
||||
MISSING_ROLLBACK_USER,
|
||||
MYSQL_UNAVAILABLE,
|
||||
NETWORK_CONNECTION,
|
||||
NETWORK_TEST,
|
||||
NO_DATA,
|
||||
NO_DATA_LOCATION,
|
||||
NO_PERMISSION,
|
||||
@@ -212,7 +216,8 @@ public enum Phrase {
|
||||
|
||||
final private static Set<Phrase> HEADERS = new HashSet<>(Arrays.asList(Phrase.CONTAINER_HEADER, Phrase.HELP_HEADER, Phrase.INTERACTIONS_HEADER, Phrase.LOOKUP_HEADER, Phrase.SIGN_HEADER, Phrase.UPDATE_HEADER));
|
||||
final private static Set<String> COLORS = new HashSet<>(Arrays.asList(Color.WHITE, Color.DARK_AQUA));
|
||||
final private static String split = ":";
|
||||
final private static String SPLIT = ":";
|
||||
final private static String FULL_WIDTH_SPLIT = ":";
|
||||
|
||||
public String getPhrase() {
|
||||
return Language.getPhrase(this);
|
||||
@@ -261,7 +266,8 @@ public enum Phrase {
|
||||
}
|
||||
|
||||
if (color.length() > 0) {
|
||||
output = output.replaceFirst(split, split + color);
|
||||
output = output.replaceFirst(SPLIT, SPLIT + color);
|
||||
output = output.replaceFirst(FULL_WIDTH_SPLIT, FULL_WIDTH_SPLIT + color);
|
||||
output = ChatMessage.parseQuotes(output, color);
|
||||
}
|
||||
|
||||
@@ -287,4 +293,16 @@ public enum Phrase {
|
||||
return output;
|
||||
}
|
||||
|
||||
public static String getPhraseSelector(Phrase phrase, String selector) {
|
||||
String translatedPhrase = phrase.getTranslatedPhrase();
|
||||
Pattern phrasePattern = Pattern.compile("(\\{[a-zA-Z| ]+})");
|
||||
Matcher patternMatch = phrasePattern.matcher(translatedPhrase);
|
||||
String match = "";
|
||||
if (patternMatch.find()) {
|
||||
match = patternMatch.group(1);
|
||||
match = Selector.processSelection(match, selector, "");
|
||||
}
|
||||
|
||||
return match;
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,9 @@ import net.coreprotect.listener.block.BlockIgniteListener;
|
||||
import net.coreprotect.listener.block.BlockPistonListener;
|
||||
import net.coreprotect.listener.block.BlockPlaceListener;
|
||||
import net.coreprotect.listener.block.BlockSpreadListener;
|
||||
import net.coreprotect.listener.block.CampfireStartListener;
|
||||
import net.coreprotect.listener.channel.PluginChannelHandshakeListener;
|
||||
import net.coreprotect.listener.channel.PluginChannelListener;
|
||||
import net.coreprotect.listener.entity.CreatureSpawnListener;
|
||||
import net.coreprotect.listener.entity.EntityBlockFormListener;
|
||||
import net.coreprotect.listener.entity.EntityChangeBlockListener;
|
||||
@@ -50,6 +53,7 @@ import net.coreprotect.listener.world.ChunkPopulateListener;
|
||||
import net.coreprotect.listener.world.LeavesDecayListener;
|
||||
import net.coreprotect.listener.world.PortalCreateListener;
|
||||
import net.coreprotect.listener.world.StructureGrowListener;
|
||||
import net.coreprotect.paper.listener.BlockPreDispenseListener;
|
||||
import net.coreprotect.paper.listener.PaperChatListener;
|
||||
|
||||
public final class ListenerHandler {
|
||||
@@ -58,6 +62,15 @@ public final class ListenerHandler {
|
||||
|
||||
PluginManager pluginManager = plugin.getServer().getPluginManager();
|
||||
|
||||
// Paper Listeners / Fallbacks (Block Listeners)
|
||||
try {
|
||||
Class.forName("io.papermc.paper.event.block.BlockPreDispenseEvent"); // Paper 1.16+
|
||||
pluginManager.registerEvents(new BlockPreDispenseListener(), plugin);
|
||||
}
|
||||
catch (Exception e) {
|
||||
BlockPreDispenseListener.useBlockPreDispenseEvent = false;
|
||||
}
|
||||
|
||||
// Block Listeners
|
||||
pluginManager.registerEvents(new BlockBreakListener(), plugin);
|
||||
pluginManager.registerEvents(new BlockBurnListener(), plugin);
|
||||
@@ -71,6 +84,13 @@ public final class ListenerHandler {
|
||||
pluginManager.registerEvents(new BlockPistonListener(), plugin);
|
||||
pluginManager.registerEvents(new BlockPlaceListener(), plugin);
|
||||
pluginManager.registerEvents(new BlockSpreadListener(), plugin);
|
||||
try {
|
||||
Class.forName("org.bukkit.event.block.CampfireStartEvent"); // Bukkit 1.20+
|
||||
pluginManager.registerEvents(new CampfireStartListener(), plugin);
|
||||
}
|
||||
catch (Exception e) {
|
||||
CampfireStartListener.useCampfireStartEvent = false;
|
||||
}
|
||||
|
||||
// Entity Listeners
|
||||
pluginManager.registerEvents(new CreatureSpawnListener(), plugin);
|
||||
@@ -86,6 +106,15 @@ public final class ListenerHandler {
|
||||
pluginManager.registerEvents(new HangingBreakListener(), plugin);
|
||||
pluginManager.registerEvents(new HangingBreakByEntityListener(), plugin);
|
||||
|
||||
// Paper Listeners / Fallbacks (Player Listeners)
|
||||
try {
|
||||
Class.forName("net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer"); // Paper 1.16+
|
||||
pluginManager.registerEvents(new PaperChatListener(), plugin);
|
||||
}
|
||||
catch (Exception e) {
|
||||
pluginManager.registerEvents(new PlayerChatListener(), plugin);
|
||||
}
|
||||
|
||||
// Player Listeners
|
||||
pluginManager.registerEvents(new ArmorStandManipulateListener(), plugin);
|
||||
pluginManager.registerEvents(new CraftItemListener(), plugin);
|
||||
@@ -113,15 +142,20 @@ public final class ListenerHandler {
|
||||
pluginManager.registerEvents(new PortalCreateListener(), plugin);
|
||||
pluginManager.registerEvents(new StructureGrowListener(), plugin);
|
||||
|
||||
// Paper Listeners / Fallbacks
|
||||
try {
|
||||
Class.forName("net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer");
|
||||
pluginManager.registerEvents(new PaperChatListener(), plugin);
|
||||
}
|
||||
catch (Exception e) {
|
||||
pluginManager.registerEvents(new PlayerChatListener(), plugin);
|
||||
}
|
||||
// Plugin channel events
|
||||
pluginManager.registerEvents(new PluginChannelListener(), plugin);
|
||||
}
|
||||
|
||||
public static void registerNetworking() {
|
||||
CoreProtect.getInstance().getServer().getMessenger().registerIncomingPluginChannel(CoreProtect.getInstance(), PluginChannelHandshakeListener.pluginChannel, new PluginChannelHandshakeListener());
|
||||
CoreProtect.getInstance().getServer().getMessenger().registerOutgoingPluginChannel(CoreProtect.getInstance(), PluginChannelHandshakeListener.pluginChannel);
|
||||
CoreProtect.getInstance().getServer().getMessenger().registerOutgoingPluginChannel(CoreProtect.getInstance(), PluginChannelListener.pluginChannel);
|
||||
}
|
||||
|
||||
public static void unregisterNetworking() {
|
||||
CoreProtect.getInstance().getServer().getMessenger().unregisterIncomingPluginChannel(CoreProtect.getInstance(), PluginChannelHandshakeListener.pluginChannel);
|
||||
CoreProtect.getInstance().getServer().getMessenger().unregisterOutgoingPluginChannel(CoreProtect.getInstance(), PluginChannelHandshakeListener.pluginChannel);
|
||||
CoreProtect.getInstance().getServer().getMessenger().unregisterOutgoingPluginChannel(CoreProtect.getInstance(), PluginChannelListener.pluginChannel);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,7 +7,6 @@ import java.util.Locale;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Tag;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Banner;
|
||||
import org.bukkit.block.Block;
|
||||
@@ -38,6 +37,7 @@ import net.coreprotect.config.Config;
|
||||
import net.coreprotect.consumer.Queue;
|
||||
import net.coreprotect.database.Database;
|
||||
import net.coreprotect.model.BlockGroup;
|
||||
import net.coreprotect.paper.PaperAdapter;
|
||||
import net.coreprotect.utility.Util;
|
||||
|
||||
public final class BlockBreakListener extends Queue implements Listener {
|
||||
@@ -125,7 +125,7 @@ public final class BlockBreakListener extends Queue implements Listener {
|
||||
Block scanBlock = world.getBlockAt(scanLocation);
|
||||
Material scanType = scanBlock.getType();
|
||||
if (scanMin == 5) {
|
||||
if (scanType.hasGravity()) {
|
||||
if (scanType.hasGravity() || BukkitAdapter.ADAPTER.isSuspiciousBlock(scanType)) {
|
||||
if (Config.getConfig(world).BLOCK_MOVEMENT) {
|
||||
// log the top-most sand/gravel block as being removed
|
||||
int scanY = y + 2;
|
||||
@@ -133,7 +133,7 @@ public final class BlockBreakListener extends Queue implements Listener {
|
||||
while (!topFound) {
|
||||
Block topBlock = world.getBlockAt(x, scanY, z);
|
||||
Material topMaterial = topBlock.getType();
|
||||
if (!topMaterial.hasGravity()) {
|
||||
if (!topMaterial.hasGravity() && !BukkitAdapter.ADAPTER.isSuspiciousBlock(topMaterial)) {
|
||||
scanLocation = new Location(world, x, (scanY - 1), z);
|
||||
topFound = true;
|
||||
}
|
||||
@@ -209,7 +209,7 @@ public final class BlockBreakListener extends Queue implements Listener {
|
||||
}
|
||||
}
|
||||
else if (scanMin == 5) {
|
||||
if (scanType.hasGravity()) {
|
||||
if (scanType.hasGravity() || BukkitAdapter.ADAPTER.isSuspiciousBlock(scanType)) {
|
||||
log = true;
|
||||
}
|
||||
}
|
||||
@@ -273,18 +273,28 @@ public final class BlockBreakListener extends Queue implements Listener {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (log && Tag.SIGNS.isTagged(blockType)) {
|
||||
if (log && BukkitAdapter.ADAPTER.isSign(blockType)) {
|
||||
if (Config.getConfig(world).SIGN_TEXT) {
|
||||
try {
|
||||
Location location = blockState.getLocation();
|
||||
Sign sign = (Sign) blockLog.getState();
|
||||
String line1 = sign.getLine(0);
|
||||
String line2 = sign.getLine(1);
|
||||
String line3 = sign.getLine(2);
|
||||
String line4 = sign.getLine(3);
|
||||
int color = sign.getColor().getColor().asRGB();
|
||||
boolean isGlowing = BukkitAdapter.ADAPTER.isGlowing(sign);
|
||||
Queue.queueSignText(user, location, 0, color, isGlowing, line1, line2, line3, line4, 5);
|
||||
String line1 = PaperAdapter.ADAPTER.getLine(sign, 0);
|
||||
String line2 = PaperAdapter.ADAPTER.getLine(sign, 1);
|
||||
String line3 = PaperAdapter.ADAPTER.getLine(sign, 2);
|
||||
String line4 = PaperAdapter.ADAPTER.getLine(sign, 3);
|
||||
String line5 = PaperAdapter.ADAPTER.getLine(sign, 4);
|
||||
String line6 = PaperAdapter.ADAPTER.getLine(sign, 5);
|
||||
String line7 = PaperAdapter.ADAPTER.getLine(sign, 6);
|
||||
String line8 = PaperAdapter.ADAPTER.getLine(sign, 7);
|
||||
|
||||
boolean isFront = true;
|
||||
int color = BukkitAdapter.ADAPTER.getColor(sign, isFront);
|
||||
int colorSecondary = BukkitAdapter.ADAPTER.getColor(sign, !isFront);
|
||||
boolean frontGlowing = BukkitAdapter.ADAPTER.isGlowing(sign, isFront);
|
||||
boolean backGlowing = BukkitAdapter.ADAPTER.isGlowing(sign, !isFront);
|
||||
boolean isWaxed = BukkitAdapter.ADAPTER.isWaxed(sign);
|
||||
|
||||
Queue.queueSignText(user, location, 0, color, colorSecondary, frontGlowing, backGlowing, isWaxed, isFront, line1, line2, line3, line4, line5, line6, line7, line8, 5);
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -315,7 +325,10 @@ public final class BlockBreakListener extends Queue implements Listener {
|
||||
}
|
||||
|
||||
for (Block placementBlock : placementMap) {
|
||||
queueBlockPlace(user, block.getState(), placementBlock.getType(), null, null, -1, 0, placementBlock.getBlockData().getAsString());
|
||||
Material placementType = placementBlock.getType();
|
||||
if (placementType.hasGravity()) {
|
||||
queueBlockPlace(user, block.getState(), placementType, null, null, -1, 0, placementBlock.getBlockData().getAsString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ import net.coreprotect.config.Config;
|
||||
import net.coreprotect.consumer.Queue;
|
||||
import net.coreprotect.listener.player.InventoryChangeListener;
|
||||
import net.coreprotect.model.BlockGroup;
|
||||
import net.coreprotect.paper.listener.BlockPreDispenseListener;
|
||||
import net.coreprotect.thread.CacheHandler;
|
||||
|
||||
public final class BlockDispenseListener extends Queue implements Listener {
|
||||
@@ -48,20 +49,22 @@ public final class BlockDispenseListener extends Queue implements Listener {
|
||||
boolean dispenseSuccess = !event.getVelocity().equals(new Vector()); // true if velocity is set
|
||||
boolean dispenseRelative = newBlock.getLocation().equals(velocityLocation); // true if velocity location matches relative location
|
||||
|
||||
if (dispenseRelative || material.equals(Material.FLINT_AND_STEEL) || material.equals(Material.SHEARS)) {
|
||||
forceItem = false;
|
||||
}
|
||||
if (!BlockPreDispenseListener.useBlockPreDispenseEvent || (!BlockPreDispenseListener.useForDroppers && block.getType() == Material.DROPPER)) {
|
||||
if (dispenseRelative || material.equals(Material.FLINT_AND_STEEL) || material.equals(Material.SHEARS)) {
|
||||
forceItem = false;
|
||||
}
|
||||
|
||||
if (block.getType() == Material.DROPPER) {
|
||||
forceItem = true; // droppers always drop items
|
||||
}
|
||||
if (block.getType() == Material.DROPPER) {
|
||||
forceItem = true; // droppers always drop items
|
||||
}
|
||||
|
||||
ItemStack[] inventory = ((InventoryHolder) block.getState()).getInventory().getStorageContents();
|
||||
if (forceItem) {
|
||||
inventory = Arrays.copyOf(inventory, inventory.length + 1);
|
||||
inventory[inventory.length - 1] = item;
|
||||
ItemStack[] inventory = ((InventoryHolder) block.getState()).getInventory().getStorageContents();
|
||||
if (forceItem) {
|
||||
inventory = Arrays.copyOf(inventory, inventory.length + 1);
|
||||
inventory[inventory.length - 1] = item;
|
||||
}
|
||||
InventoryChangeListener.inventoryTransaction(user, block.getLocation(), inventory);
|
||||
}
|
||||
InventoryChangeListener.inventoryTransaction(user, block.getLocation(), inventory);
|
||||
|
||||
if (material.equals(Material.WATER_BUCKET)) {
|
||||
type = Material.WATER;
|
||||
|
||||
@@ -8,7 +8,6 @@ import java.util.Map;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Tag;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
@@ -26,6 +25,7 @@ import net.coreprotect.config.Config;
|
||||
import net.coreprotect.consumer.Queue;
|
||||
import net.coreprotect.database.Database;
|
||||
import net.coreprotect.model.BlockGroup;
|
||||
import net.coreprotect.paper.PaperAdapter;
|
||||
|
||||
public final class BlockExplodeListener extends Queue implements Listener {
|
||||
|
||||
@@ -114,17 +114,27 @@ public final class BlockExplodeListener extends Queue implements Listener {
|
||||
Block block = entry.getValue();
|
||||
Material blockType = block.getType();
|
||||
BlockState blockState = block.getState();
|
||||
if (Tag.SIGNS.isTagged(blockType) && Config.getConfig(world).SIGN_TEXT) {
|
||||
if (BukkitAdapter.ADAPTER.isSign(blockType) && Config.getConfig(world).SIGN_TEXT) {
|
||||
try {
|
||||
Location location = blockState.getLocation();
|
||||
Sign sign = (Sign) blockState;
|
||||
String line1 = sign.getLine(0);
|
||||
String line2 = sign.getLine(1);
|
||||
String line3 = sign.getLine(2);
|
||||
String line4 = sign.getLine(3);
|
||||
int color = sign.getColor().getColor().asRGB();
|
||||
boolean isGlowing = BukkitAdapter.ADAPTER.isGlowing(sign);
|
||||
Queue.queueSignText(user, location, 0, color, isGlowing, line1, line2, line3, line4, 5);
|
||||
String line1 = PaperAdapter.ADAPTER.getLine(sign, 0);
|
||||
String line2 = PaperAdapter.ADAPTER.getLine(sign, 1);
|
||||
String line3 = PaperAdapter.ADAPTER.getLine(sign, 2);
|
||||
String line4 = PaperAdapter.ADAPTER.getLine(sign, 3);
|
||||
String line5 = PaperAdapter.ADAPTER.getLine(sign, 4);
|
||||
String line6 = PaperAdapter.ADAPTER.getLine(sign, 5);
|
||||
String line7 = PaperAdapter.ADAPTER.getLine(sign, 6);
|
||||
String line8 = PaperAdapter.ADAPTER.getLine(sign, 7);
|
||||
|
||||
boolean isFront = true;
|
||||
int color = BukkitAdapter.ADAPTER.getColor(sign, isFront);
|
||||
int colorSecondary = BukkitAdapter.ADAPTER.getColor(sign, !isFront);
|
||||
boolean frontGlowing = BukkitAdapter.ADAPTER.isGlowing(sign, isFront);
|
||||
boolean backGlowing = BukkitAdapter.ADAPTER.isGlowing(sign, !isFront);
|
||||
boolean isWaxed = BukkitAdapter.ADAPTER.isWaxed(sign);
|
||||
|
||||
Queue.queueSignText(user, location, 0, color, colorSecondary, frontGlowing, backGlowing, isWaxed, isFront, line1, line2, line3, line4, line5, line6, line7, line8, 5);
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
package net.coreprotect.listener.block;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Tag;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockFertilizeEvent;
|
||||
|
||||
@@ -17,7 +20,7 @@ import net.coreprotect.thread.CacheHandler;
|
||||
|
||||
public final class BlockFertilizeListener extends Queue implements Listener {
|
||||
|
||||
@EventHandler
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
protected void onBlockFertilize(BlockFertilizeEvent event) {
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
@@ -30,7 +33,14 @@ public final class BlockFertilizeListener extends Queue implements Listener {
|
||||
|
||||
Location location = block.getLocation();
|
||||
List<BlockState> blocks = event.getBlocks();
|
||||
if (blocks.size() == 1 && blocks.get(0).getLocation().equals(location) && Tag.SAPLINGS.isTagged(block.getType())) {
|
||||
|
||||
if (Tag.SAPLINGS.isTagged(block.getType()) && (!Config.getConfig(location.getWorld()).TREE_GROWTH || (blocks.size() == 1 && blocks.get(0).getLocation().equals(location)))) {
|
||||
return;
|
||||
}
|
||||
if (block.getType().name().toLowerCase(Locale.ROOT).contains("mushroom") && (!Config.getConfig(location.getWorld()).MUSHROOM_GROWTH || (blocks.size() == 1 && blocks.get(0).getLocation().equals(location)))) {
|
||||
return;
|
||||
}
|
||||
if (block.getType() == Material.AIR && blocks.size() > 1 && Tag.LOGS.isTagged(blocks.get(1).getType()) && !Config.getConfig(location.getWorld()).TREE_GROWTH) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,10 +20,11 @@ public final class BlockFormListener extends Queue implements Listener {
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
protected void onBlockForm(BlockFormEvent event) {
|
||||
// random form, snow/ice
|
||||
World world = event.getBlock().getWorld();
|
||||
Block block = event.getBlock();
|
||||
World world = block.getWorld();
|
||||
BlockState newState = event.getNewState();
|
||||
if (Config.getConfig(world).LIQUID_TRACKING && (newState.getType().equals(Material.OBSIDIAN) || newState.getType().equals(Material.COBBLESTONE) || event.getBlock().getType().name().endsWith("_CONCRETE_POWDER"))) {
|
||||
Block block = event.getBlock();
|
||||
boolean log = false;
|
||||
if (Config.getConfig(world).LIQUID_TRACKING && (newState.getType().equals(Material.OBSIDIAN) || newState.getType().equals(Material.COBBLESTONE) || block.getType().name().endsWith("_CONCRETE_POWDER"))) {
|
||||
String player = Lookup.whoPlacedCache(block);
|
||||
int wid = Util.getWorldId(world.getName());
|
||||
if (!(player.length() > 0)) {
|
||||
@@ -58,7 +59,7 @@ public final class BlockFormListener extends Queue implements Listener {
|
||||
}
|
||||
}
|
||||
if (player.length() > 0) {
|
||||
boolean log = true;
|
||||
log = true;
|
||||
/*
|
||||
if (newState.getType().equals(Material.COBBLESTONE)) {
|
||||
log = false;
|
||||
@@ -78,6 +79,9 @@ public final class BlockFormListener extends Queue implements Listener {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!log && Config.getConfig(world).UNKNOWN_LOGGING && Lookup.whoPlacedCache(block).length() == 0) {
|
||||
Queue.queueBlockPlace("#unknown", block.getLocation().getBlock().getState(), block.getType(), block.getState(), newState.getType(), -1, 0, newState.getBlockData().getAsString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -87,6 +87,39 @@ public final class BlockFromToListener extends Queue implements Listener {
|
||||
CacheHandler.lookupCache.put("" + x + "." + y + "." + z + "." + wid + "", new Object[] { unixtimestamp, f, type });
|
||||
Queue.queueBlockPlace(f, toBlock.getState(), block.getType(), toBlockState, type, -1, 0, blockData.getAsString());
|
||||
}
|
||||
else if (type.equals(Material.DRAGON_EGG)) {
|
||||
Location location = block.getLocation();
|
||||
int worldId = Util.getWorldId(location.getWorld().getName());
|
||||
int x = location.getBlockX();
|
||||
int y = location.getBlockY();
|
||||
int z = location.getBlockZ();
|
||||
String coordinates = x + "." + y + "." + z + "." + worldId + "." + type.name();
|
||||
String user = "#entity";
|
||||
|
||||
Object[] data = CacheHandler.interactCache.get(coordinates);
|
||||
if (data != null && data[1] == Material.DRAGON_EGG) {
|
||||
long newTime = System.currentTimeMillis();
|
||||
long oldTime = (long) data[0];
|
||||
|
||||
if ((newTime - oldTime) < 20) { // 50ms = 1 tick
|
||||
user = (String) data[2];
|
||||
}
|
||||
CacheHandler.interactCache.remove(coordinates);
|
||||
}
|
||||
|
||||
if (Config.getConfig(block.getWorld()).BLOCK_BREAK) {
|
||||
Queue.queueBlockBreak(user, block.getState(), block.getType(), block.getBlockData().getAsString(), 0);
|
||||
}
|
||||
if (Config.getConfig(block.getWorld()).BLOCK_PLACE) {
|
||||
Block toBlock = event.getToBlock();
|
||||
BlockState toBlockState = toBlock.getState();
|
||||
if (Config.getConfig(world).BLOCK_MOVEMENT) {
|
||||
toBlockState = BlockUtil.gravityScan(toBlock.getLocation(), type, user).getState();
|
||||
}
|
||||
|
||||
Queue.queueBlockPlace(user, toBlockState, block.getType(), toBlockState, type, -1, 0, blockData.getAsString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import java.util.Locale;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Tag;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
@@ -28,6 +27,7 @@ import net.coreprotect.config.Config;
|
||||
import net.coreprotect.consumer.Queue;
|
||||
import net.coreprotect.listener.player.InventoryChangeListener;
|
||||
import net.coreprotect.model.BlockGroup;
|
||||
import net.coreprotect.paper.PaperAdapter;
|
||||
import net.coreprotect.utility.Util;
|
||||
|
||||
public final class BlockPlaceListener extends Queue implements Listener {
|
||||
@@ -106,19 +106,29 @@ public final class BlockPlaceListener extends Queue implements Listener {
|
||||
|
||||
Queue.queueBlockPlace(player.getName(), blockState, blockPlaced.getType(), blockReplaced, forceType, forceData, 0, bBlockData);
|
||||
|
||||
if (Tag.SIGNS.isTagged(blockType)) {
|
||||
if (BukkitAdapter.ADAPTER.isSign(blockType)) {
|
||||
if (Config.getConfig(world).SIGN_TEXT) {
|
||||
try {
|
||||
Location location = blockState.getLocation();
|
||||
Sign sign = (Sign) blockState;
|
||||
String line1 = sign.getLine(0);
|
||||
String line2 = sign.getLine(1);
|
||||
String line3 = sign.getLine(2);
|
||||
String line4 = sign.getLine(3);
|
||||
int color = sign.getColor().getColor().asRGB();
|
||||
boolean isGlowing = BukkitAdapter.ADAPTER.isGlowing(sign);
|
||||
if (line1.length() > 0 || line2.length() > 0 || line3.length() > 0 || line4.length() > 0) {
|
||||
Queue.queueSignText(player.getName(), location, 1, color, isGlowing, line1, line2, line3, line4, 0);
|
||||
String line1 = PaperAdapter.ADAPTER.getLine(sign, 0);
|
||||
String line2 = PaperAdapter.ADAPTER.getLine(sign, 1);
|
||||
String line3 = PaperAdapter.ADAPTER.getLine(sign, 2);
|
||||
String line4 = PaperAdapter.ADAPTER.getLine(sign, 3);
|
||||
String line5 = PaperAdapter.ADAPTER.getLine(sign, 4);
|
||||
String line6 = PaperAdapter.ADAPTER.getLine(sign, 5);
|
||||
String line7 = PaperAdapter.ADAPTER.getLine(sign, 6);
|
||||
String line8 = PaperAdapter.ADAPTER.getLine(sign, 7);
|
||||
|
||||
boolean isFront = true;
|
||||
int color = BukkitAdapter.ADAPTER.getColor(sign, isFront);
|
||||
int colorSecondary = BukkitAdapter.ADAPTER.getColor(sign, !isFront);
|
||||
boolean frontGlowing = BukkitAdapter.ADAPTER.isGlowing(sign, isFront);
|
||||
boolean backGlowing = BukkitAdapter.ADAPTER.isGlowing(sign, !isFront);
|
||||
boolean isWaxed = BukkitAdapter.ADAPTER.isWaxed(sign);
|
||||
|
||||
if (line1.length() > 0 || line2.length() > 0 || line3.length() > 0 || line4.length() > 0 || line5.length() > 0 || line6.length() > 0 || line7.length() > 0 || line8.length() > 0) {
|
||||
Queue.queueSignText(player.getName(), location, 1, color, colorSecondary, frontGlowing, backGlowing, isWaxed, isFront, line1, line2, line3, line4, line5, line6, line7, line8, 0);
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
||||
@@ -27,20 +27,16 @@ public final class BlockSpreadListener extends Queue implements Listener {
|
||||
* block-change: true
|
||||
*
|
||||
*/
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!event.isCancelled() && Config.getConfig(event.getBlock().getWorld()).VINE_GROWTH) {
|
||||
BlockState blockstate = event.getNewState();
|
||||
Material type = blockstate.getType();
|
||||
if (!BlockGroup.VINES.contains(type) && !BlockGroup.AMETHYST.contains(type) && type != Material.CHORUS_FLOWER && type != Material.BAMBOO) {
|
||||
return;
|
||||
}
|
||||
BlockState blockstate = event.getNewState();
|
||||
Material type = blockstate.getType();
|
||||
|
||||
if (Config.getConfig(event.getBlock().getWorld()).VINE_GROWTH && (BlockGroup.VINES.contains(type) || BlockGroup.AMETHYST.contains(type) || type == Material.CHORUS_FLOWER || type == Material.BAMBOO)) {
|
||||
Block block = event.getBlock();
|
||||
Location location = block.getLocation();
|
||||
int timestamp = (int) (System.currentTimeMillis() / 1000L);
|
||||
Object[] cacheData = CacheHandler.spreadCache.get(location);
|
||||
CacheHandler.spreadCache.put(location, new Object[] { timestamp, type });
|
||||
if (cacheData != null && ((Material) cacheData[1]) == type) {
|
||||
if (checkCacheData(block, type)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -74,6 +70,25 @@ public final class BlockSpreadListener extends Queue implements Listener {
|
||||
Queue.queueBlockPlaceDelayed("#bamboo", block.getLocation(), type, null, block.getState(), 0);
|
||||
}
|
||||
}
|
||||
else if (Config.getConfig(event.getBlock().getWorld()).SCULK_SPREAD && BlockGroup.SCULK.contains(type)) {
|
||||
Block block = event.getBlock();
|
||||
if (checkCacheData(block, type)) {
|
||||
return;
|
||||
}
|
||||
|
||||
queueBlockPlace("#sculk_catalyst", block.getState(), block.getType(), block.getState(), type, -1, 0, blockstate.getBlockData().getAsString());
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkCacheData(Block block, Material type) {
|
||||
Location location = block.getLocation();
|
||||
int timestamp = (int) (System.currentTimeMillis() / 1000L);
|
||||
Object[] cacheData = CacheHandler.spreadCache.get(location);
|
||||
CacheHandler.spreadCache.put(location, new Object[] { timestamp, type });
|
||||
if (cacheData != null && ((Material) cacheData[1]) == type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package net.coreprotect.listener.block;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.CampfireStartEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import net.coreprotect.consumer.Queue;
|
||||
import net.coreprotect.listener.player.PlayerDropItemListener;
|
||||
import net.coreprotect.thread.CacheHandler;
|
||||
import net.coreprotect.utility.Util;
|
||||
|
||||
public final class CampfireStartListener extends Queue implements Listener {
|
||||
|
||||
public static boolean useCampfireStartEvent = true;
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
protected void onCampfireStart(CampfireStartEvent event) {
|
||||
Block block = event.getBlock();
|
||||
Location location = block.getLocation();
|
||||
int worldId = Util.getWorldId(location.getWorld().getName());
|
||||
int x = location.getBlockX();
|
||||
int y = location.getBlockY();
|
||||
int z = location.getBlockZ();
|
||||
String coordinates = x + "." + y + "." + z + "." + worldId + "." + block.getType().name();
|
||||
String user = "#entity";
|
||||
|
||||
Object[] data = CacheHandler.interactCache.get(coordinates);
|
||||
if (data != null && data[1].equals(event.getSource())) {
|
||||
long newTime = System.currentTimeMillis();
|
||||
long oldTime = (long) data[0];
|
||||
if ((newTime - oldTime) < 20) { // 50ms = 1 tick
|
||||
user = (String) data[2];
|
||||
}
|
||||
CacheHandler.interactCache.remove(coordinates);
|
||||
}
|
||||
|
||||
if (user.equals("#entity")) {
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack itemStack = event.getSource().clone();
|
||||
itemStack.setAmount(1);
|
||||
PlayerDropItemListener.playerDropItem(event.getBlock().getLocation(), user, itemStack);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package net.coreprotect.listener.channel;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||
|
||||
import net.coreprotect.CoreProtect;
|
||||
import net.coreprotect.config.Config;
|
||||
import net.coreprotect.language.Phrase;
|
||||
import net.coreprotect.language.Selector;
|
||||
import net.coreprotect.utility.Chat;
|
||||
|
||||
public class PluginChannelHandshakeListener implements PluginMessageListener, Listener {
|
||||
|
||||
public static final String pluginChannel = "coreprotect:handshake";
|
||||
private final int networkingProtocolVersion = 1;
|
||||
private final Set<UUID> pluginChannelPlayers;
|
||||
private static PluginChannelHandshakeListener instance;
|
||||
|
||||
public PluginChannelHandshakeListener() {
|
||||
instance = this;
|
||||
pluginChannelPlayers = new HashSet<>();
|
||||
}
|
||||
|
||||
public static PluginChannelHandshakeListener getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public Set<UUID> getPluginChannelPlayers() {
|
||||
return pluginChannelPlayers;
|
||||
}
|
||||
|
||||
public boolean isPluginChannelPlayer(CommandSender commandSender) {
|
||||
if (!(commandSender instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return getPluginChannelPlayers().contains(((Player) commandSender).getUniqueId());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||
getPluginChannelPlayers().remove(event.getPlayer().getUniqueId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPluginMessageReceived(String s, Player player, byte[] bytes) {
|
||||
handleHandshake(s, player, bytes);
|
||||
}
|
||||
|
||||
private void handleHandshake(String channel, Player player, byte[] bytes) {
|
||||
if (!player.hasPermission("coreprotect.networking")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!channel.equals(pluginChannel)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ByteArrayInputStream in = new ByteArrayInputStream(bytes);
|
||||
DataInputStream dis = new DataInputStream(in);
|
||||
|
||||
try {
|
||||
String modVersion = dis.readUTF();
|
||||
String modId = dis.readUTF();
|
||||
int protocolVersion = dis.readInt();
|
||||
if (Config.getGlobal().NETWORK_DEBUG) {
|
||||
Chat.console(new String(bytes));
|
||||
Chat.console(modVersion);
|
||||
Chat.console(modId);
|
||||
Chat.console(String.valueOf(protocolVersion));
|
||||
}
|
||||
|
||||
if (protocolVersion != networkingProtocolVersion) {
|
||||
Chat.console(Phrase.build(Phrase.NETWORK_CONNECTION, player.getName(), modId, modVersion, Selector.SECOND));
|
||||
return;
|
||||
}
|
||||
|
||||
getPluginChannelPlayers().add(player.getUniqueId());
|
||||
Chat.console(Phrase.build(Phrase.NETWORK_CONNECTION, player.getName(), modId, modVersion, Selector.FIRST));
|
||||
|
||||
player.sendPluginMessage(CoreProtect.getInstance(), pluginChannel, sendRegistered());
|
||||
}
|
||||
catch (Exception exception) {
|
||||
Chat.console(exception.toString());
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private byte[] sendRegistered() throws IOException {
|
||||
ByteArrayOutputStream msgBytes = new ByteArrayOutputStream();
|
||||
DataOutputStream msgOut = new DataOutputStream(msgBytes);
|
||||
msgOut.writeBoolean(true);
|
||||
|
||||
return msgBytes.toByteArray();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,218 @@
|
||||
package net.coreprotect.listener.channel;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import net.coreprotect.CoreProtect;
|
||||
import net.coreprotect.config.Config;
|
||||
import net.coreprotect.language.Phrase;
|
||||
import net.coreprotect.language.Selector;
|
||||
import net.coreprotect.utility.Chat;
|
||||
import net.coreprotect.utility.Color;
|
||||
import net.coreprotect.utility.Util;
|
||||
|
||||
public class PluginChannelListener implements Listener {
|
||||
|
||||
public static final String pluginChannel = "coreprotect:data";
|
||||
private static PluginChannelListener instance;
|
||||
|
||||
public PluginChannelListener() {
|
||||
instance = this;
|
||||
}
|
||||
|
||||
public static PluginChannelListener getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void sendData(CommandSender commandSender, long timeAgo, Phrase phrase, String selector, String resultUser, String target, int amount, int x, int y, int z, int worldId, String rbFormat, boolean isContainer, boolean added) throws IOException {
|
||||
if (!PluginChannelHandshakeListener.getInstance().isPluginChannelPlayer(commandSender)) {
|
||||
return;
|
||||
}
|
||||
|
||||
String phraseSelector = Phrase.getPhraseSelector(phrase, selector);
|
||||
String worldName = Util.getWorldName(worldId);
|
||||
|
||||
ByteArrayOutputStream msgBytes = new ByteArrayOutputStream();
|
||||
DataOutputStream msgOut = new DataOutputStream(msgBytes);
|
||||
msgOut.writeInt(1);
|
||||
msgOut.writeLong(timeAgo * 1000);
|
||||
msgOut.writeUTF(phraseSelector);
|
||||
msgOut.writeUTF(resultUser);
|
||||
msgOut.writeUTF(target);
|
||||
msgOut.writeInt(amount);
|
||||
msgOut.writeInt(x);
|
||||
msgOut.writeInt(y);
|
||||
msgOut.writeInt(z);
|
||||
msgOut.writeUTF(worldName);
|
||||
msgOut.writeBoolean(!rbFormat.isEmpty());
|
||||
msgOut.writeBoolean(isContainer);
|
||||
msgOut.writeBoolean(added);
|
||||
if (Config.getGlobal().NETWORK_DEBUG) {
|
||||
Chat.console(String.valueOf(timeAgo * 1000));
|
||||
Chat.console(phraseSelector);
|
||||
Chat.console(resultUser);
|
||||
Chat.console(target);
|
||||
Chat.console(String.valueOf(amount));
|
||||
Chat.console(String.valueOf(x));
|
||||
Chat.console(String.valueOf(y));
|
||||
Chat.console(String.valueOf(z));
|
||||
Chat.console(worldName);
|
||||
Chat.console(String.valueOf(!rbFormat.isEmpty()));
|
||||
Chat.console(String.valueOf(isContainer));
|
||||
Chat.console(String.valueOf(added));
|
||||
Chat.console("");
|
||||
}
|
||||
|
||||
send(commandSender, msgBytes.toByteArray());
|
||||
}
|
||||
|
||||
public void sendInfoData(CommandSender commandSender, long timeAgo, Phrase phrase, String selector, String resultUser, int amount, int x, int y, int z, int worldId) throws IOException {
|
||||
if (!PluginChannelHandshakeListener.getInstance().isPluginChannelPlayer(commandSender)) {
|
||||
return;
|
||||
}
|
||||
|
||||
String phraseSelector = Phrase.getPhraseSelector(phrase, selector);
|
||||
String worldName = Util.getWorldName(worldId);
|
||||
|
||||
ByteArrayOutputStream msgBytes = new ByteArrayOutputStream();
|
||||
DataOutputStream msgOut = new DataOutputStream(msgBytes);
|
||||
|
||||
msgOut.writeInt(2);
|
||||
msgOut.writeLong(timeAgo * 1000);
|
||||
msgOut.writeUTF(phraseSelector);
|
||||
msgOut.writeUTF(resultUser);
|
||||
msgOut.writeInt(amount);
|
||||
msgOut.writeInt(x);
|
||||
msgOut.writeInt(y);
|
||||
msgOut.writeInt(z);
|
||||
msgOut.writeUTF(worldName);
|
||||
if (Config.getGlobal().NETWORK_DEBUG) {
|
||||
Chat.console(String.valueOf(timeAgo * 1000));
|
||||
Chat.console(phraseSelector);
|
||||
Chat.console(resultUser);
|
||||
Chat.console(String.valueOf(amount));
|
||||
Chat.console(String.valueOf(x));
|
||||
Chat.console(String.valueOf(y));
|
||||
Chat.console(String.valueOf(z));
|
||||
Chat.console(worldName);
|
||||
Chat.console("");
|
||||
}
|
||||
|
||||
send(commandSender, msgBytes.toByteArray());
|
||||
}
|
||||
|
||||
public void sendMessageData(CommandSender commandSender, long timeAgo, String resultUser, String message, boolean sign, int x, int y, int z, int worldId) throws IOException {
|
||||
if (!PluginChannelHandshakeListener.getInstance().isPluginChannelPlayer(commandSender)) {
|
||||
return;
|
||||
}
|
||||
|
||||
String worldName = Util.getWorldName(worldId);
|
||||
|
||||
ByteArrayOutputStream msgBytes = new ByteArrayOutputStream();
|
||||
DataOutputStream msgOut = new DataOutputStream(msgBytes);
|
||||
|
||||
msgOut.writeInt(3);
|
||||
msgOut.writeLong(timeAgo * 1000);
|
||||
msgOut.writeUTF(resultUser);
|
||||
msgOut.writeUTF(message);
|
||||
msgOut.writeBoolean(sign);
|
||||
msgOut.writeInt(x);
|
||||
msgOut.writeInt(y);
|
||||
msgOut.writeInt(z);
|
||||
msgOut.writeUTF(worldName);
|
||||
if (Config.getGlobal().NETWORK_DEBUG) {
|
||||
Chat.console(String.valueOf(timeAgo * 1000));
|
||||
Chat.console(resultUser);
|
||||
Chat.console(message);
|
||||
Chat.console(String.valueOf(sign));
|
||||
Chat.console(String.valueOf(x));
|
||||
Chat.console(String.valueOf(y));
|
||||
Chat.console(String.valueOf(z));
|
||||
Chat.console(worldName);
|
||||
Chat.console("");
|
||||
}
|
||||
|
||||
send(commandSender, msgBytes.toByteArray());
|
||||
}
|
||||
|
||||
public void sendUsernameData(CommandSender commandSender, long timeAgo, String resultUser, String target) throws IOException {
|
||||
if (!PluginChannelHandshakeListener.getInstance().isPluginChannelPlayer(commandSender)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ByteArrayOutputStream msgBytes = new ByteArrayOutputStream();
|
||||
DataOutputStream msgOut = new DataOutputStream(msgBytes);
|
||||
|
||||
msgOut.writeInt(4);
|
||||
msgOut.writeLong(timeAgo * 1000);
|
||||
msgOut.writeUTF(resultUser);
|
||||
msgOut.writeUTF(target);
|
||||
|
||||
if (Config.getGlobal().NETWORK_DEBUG) {
|
||||
Chat.console(String.valueOf(timeAgo * 1000));
|
||||
Chat.console(resultUser);
|
||||
Chat.console(target);
|
||||
Chat.console("");
|
||||
}
|
||||
|
||||
send(commandSender, msgBytes.toByteArray());
|
||||
}
|
||||
|
||||
public void sendTest(CommandSender commandSender, String type) throws IOException {
|
||||
if (!PluginChannelHandshakeListener.getInstance().isPluginChannelPlayer(commandSender)) {
|
||||
return;
|
||||
}
|
||||
|
||||
int worldId = 1;
|
||||
Random rand = new Random();
|
||||
int timeAgo = rand.nextInt(20);
|
||||
String selector = Selector.FIRST;
|
||||
String resultUser = "Anne";
|
||||
int amount = 5;
|
||||
int x = rand.nextInt(10);
|
||||
int y = rand.nextInt(10);
|
||||
int z = rand.nextInt(10);
|
||||
String rbFormat = "test";
|
||||
String message = "This is a test";
|
||||
boolean sign = true;
|
||||
|
||||
switch (type) {
|
||||
case "2":
|
||||
sendInfoData(commandSender, timeAgo, Phrase.LOOKUP_LOGIN, selector, resultUser, amount, x, y, z, worldId);
|
||||
break;
|
||||
case "3":
|
||||
sendMessageData(commandSender, timeAgo, resultUser, message, sign, x, y, z, worldId);
|
||||
break;
|
||||
case "4":
|
||||
sendUsernameData(commandSender, timeAgo, resultUser, "Arne");
|
||||
break;
|
||||
default:
|
||||
sendData(commandSender, timeAgo, Phrase.LOOKUP_CONTAINER, selector, resultUser, "clay_ball", amount, x, y, z, worldId, rbFormat, false, true);
|
||||
break;
|
||||
}
|
||||
|
||||
commandSender.sendMessage(Color.DARK_AQUA + "CoreProtect " + Color.WHITE + "- " + Phrase.build(Phrase.NETWORK_TEST));
|
||||
}
|
||||
|
||||
private void send(CommandSender commandSender, byte[] msgBytes) {
|
||||
if (!(commandSender instanceof Player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
PluginChannelListener.getInstance().sendCoreProtectData((Player) commandSender, msgBytes);
|
||||
}
|
||||
|
||||
private void sendCoreProtectData(Player player, byte[] data) {
|
||||
if (!player.hasPermission("coreprotect.networking")) {
|
||||
return;
|
||||
}
|
||||
|
||||
player.sendPluginMessage(CoreProtect.getInstance(), pluginChannel, data);
|
||||
}
|
||||
}
|
||||
@@ -3,15 +3,12 @@ package net.coreprotect.listener.entity;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
@@ -38,15 +35,14 @@ public final class CreatureSpawnListener extends Queue implements Listener {
|
||||
|
||||
Location location = event.getEntity().getLocation();
|
||||
String key = world.getName() + "-" + location.getBlockX() + "-" + location.getBlockY() + "-" + location.getBlockZ();
|
||||
Iterator<Entry<UUID, Object[]>> it = ConfigHandler.entityBlockMapper.entrySet().iterator();
|
||||
Iterator<Entry<String, Object[]>> it = ConfigHandler.entityBlockMapper.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry<UUID, Object[]> pair = it.next();
|
||||
UUID uuid = pair.getKey();
|
||||
Map.Entry<String, Object[]> pair = it.next();
|
||||
String name = pair.getKey();
|
||||
Object[] data = pair.getValue();
|
||||
if ((data[0].equals(key) || data[1].equals(key)) && Util.getEntityMaterial(event.getEntityType()) == ((ItemStack) data[2]).getType()) {
|
||||
Player player = Bukkit.getServer().getPlayer(uuid);
|
||||
Block gravityLocation = BlockUtil.gravityScan(location, Material.ARMOR_STAND, player.getName());
|
||||
Queue.queueBlockPlace(player.getName(), gravityLocation.getState(), location.getBlock().getType(), location.getBlock().getState(), ((ItemStack) data[2]).getType(), (int) event.getEntity().getLocation().getYaw(), 1, null);
|
||||
Block gravityLocation = BlockUtil.gravityScan(location, Material.ARMOR_STAND, name);
|
||||
Queue.queueBlockPlace(name, gravityLocation.getState(), location.getBlock().getType(), location.getBlock().getState(), ((ItemStack) data[2]).getType(), (int) event.getEntity().getLocation().getYaw(), 1, null);
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityDamageByBlockEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import net.coreprotect.config.Config;
|
||||
import net.coreprotect.consumer.Queue;
|
||||
@@ -45,7 +46,9 @@ public final class EntityDamageByBlockListener extends Queue implements Listener
|
||||
if (entity instanceof ItemFrame && Config.getConfig(entity.getWorld()).ITEM_TRANSACTIONS) {
|
||||
ItemFrame frame = (ItemFrame) entity;
|
||||
if (frame.getItem().getType() != Material.AIR) {
|
||||
PlayerInteractEntityListener.queueFrameTransaction(user, frame, false);
|
||||
ItemStack[] oldState = new ItemStack[] { frame.getItem().clone() };
|
||||
ItemStack[] newState = new ItemStack[] { new ItemStack(Material.AIR) };
|
||||
PlayerInteractEntityListener.queueContainerSpecifiedItems(user, Material.ITEM_FRAME, new Object[] { oldState, newState, frame.getFacing() }, frame.getLocation(), false);
|
||||
}
|
||||
}
|
||||
else if (entity instanceof ArmorStand && Config.getConfig(entity.getWorld()).BLOCK_BREAK) {
|
||||
|
||||
@@ -2,7 +2,6 @@ package net.coreprotect.listener.entity;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@@ -35,6 +34,7 @@ import net.coreprotect.config.ConfigHandler;
|
||||
import net.coreprotect.consumer.Queue;
|
||||
import net.coreprotect.database.Database;
|
||||
import net.coreprotect.listener.player.PlayerInteractEntityListener;
|
||||
import net.coreprotect.thread.Scheduler;
|
||||
import net.coreprotect.utility.Util;
|
||||
|
||||
public final class EntityDamageByEntityListener extends Queue implements Listener {
|
||||
@@ -113,7 +113,9 @@ public final class EntityDamageByEntityListener extends Queue implements Listene
|
||||
if (entity instanceof ItemFrame && Config.getConfig(entityLocation.getWorld()).ITEM_TRANSACTIONS) {
|
||||
ItemFrame frame = (ItemFrame) entity;
|
||||
if (frame.getItem().getType() != Material.AIR) {
|
||||
PlayerInteractEntityListener.queueFrameTransaction(user, frame, logDrops);
|
||||
ItemStack[] oldState = new ItemStack[] { frame.getItem().clone() };
|
||||
ItemStack[] newState = new ItemStack[] { new ItemStack(Material.AIR) };
|
||||
PlayerInteractEntityListener.queueContainerSpecifiedItems(user, Material.ITEM_FRAME, new Object[] { oldState, newState, frame.getFacing() }, frame.getLocation(), logDrops);
|
||||
}
|
||||
}
|
||||
else if (entity instanceof EnderCrystal && Config.getConfig(entity.getWorld()).BLOCK_BREAK) {
|
||||
@@ -125,13 +127,13 @@ public final class EntityDamageByEntityListener extends Queue implements Listene
|
||||
if (Config.getConfig(entityLocation.getWorld()).ITEM_TRANSACTIONS) {
|
||||
String killer = user;
|
||||
ItemStack[] contents = Util.getContainerContents(Material.ARMOR_STAND, entity, block.getLocation());
|
||||
Bukkit.getScheduler().runTask(CoreProtect.getInstance(), () -> {
|
||||
Scheduler.runTask(CoreProtect.getInstance(), () -> {
|
||||
if (entity != null && entity.isDead()) {
|
||||
entityLocation.setY(entityLocation.getY() + 0.99);
|
||||
Database.containerBreakCheck(killer, Material.ARMOR_STAND, entity, contents, block.getLocation());
|
||||
Queue.queueBlockBreak(killer, block.getState(), Material.ARMOR_STAND, null, (int) entityLocation.getYaw());
|
||||
}
|
||||
});
|
||||
}, entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import org.bukkit.entity.AbstractHorse;
|
||||
import org.bukkit.entity.AbstractVillager;
|
||||
import org.bukkit.entity.Ageable;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.Bee;
|
||||
import org.bukkit.entity.Cat;
|
||||
import org.bukkit.entity.ChestedHorse;
|
||||
import org.bukkit.entity.Creeper;
|
||||
@@ -66,6 +67,7 @@ import net.coreprotect.CoreProtect;
|
||||
import net.coreprotect.bukkit.BukkitAdapter;
|
||||
import net.coreprotect.config.Config;
|
||||
import net.coreprotect.consumer.Queue;
|
||||
import net.coreprotect.thread.Scheduler;
|
||||
import net.coreprotect.utility.serialize.ItemMetaHandler;
|
||||
|
||||
public final class EntityDeathListener extends Queue implements Listener {
|
||||
@@ -95,13 +97,13 @@ public final class EntityDeathListener extends Queue implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
Bukkit.getScheduler().runTask(CoreProtect.getInstance(), () -> {
|
||||
for (LivingEntity entity : entityList) {
|
||||
for (LivingEntity entity : entityList) {
|
||||
Scheduler.runTask(CoreProtect.getInstance(), () -> {
|
||||
if (entity != null && entity.isDead()) {
|
||||
logEntityDeath(entity, "#command");
|
||||
}
|
||||
}
|
||||
});
|
||||
}, entity);
|
||||
}
|
||||
}
|
||||
|
||||
protected static void logEntityDeath(LivingEntity entity, String e) {
|
||||
@@ -496,6 +498,12 @@ public final class EntityDeathListener extends Queue implements Listener {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (entity instanceof Bee) {
|
||||
Bee bee = (Bee) entity;
|
||||
info.add(bee.getAnger());
|
||||
info.add(bee.hasNectar());
|
||||
info.add(bee.hasStung());
|
||||
}
|
||||
else {
|
||||
BukkitAdapter.ADAPTER.getEntityMeta(entity, info);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import net.coreprotect.bukkit.BukkitAdapter;
|
||||
import net.coreprotect.config.Config;
|
||||
@@ -133,7 +134,9 @@ public final class HangingBreakByEntityListener extends Queue implements Listene
|
||||
|
||||
if (!event.isCancelled() && Config.getConfig(entity.getWorld()).ITEM_TRANSACTIONS && !inspecting) {
|
||||
if (itemframe.getItem().getType() != Material.AIR) {
|
||||
PlayerInteractEntityListener.queueFrameTransaction(culprit, itemframe, logDrops);
|
||||
ItemStack[] oldState = new ItemStack[] { itemframe.getItem().clone() };
|
||||
ItemStack[] newState = new ItemStack[] { new ItemStack(Material.AIR) };
|
||||
PlayerInteractEntityListener.queueContainerSpecifiedItems(culprit, Material.ITEM_FRAME, new Object[] { oldState, newState, itemframe.getFacing() }, itemframe.getLocation(), logDrops);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.hanging.HangingBreakEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import net.coreprotect.bukkit.BukkitAdapter;
|
||||
import net.coreprotect.config.Config;
|
||||
@@ -61,7 +62,9 @@ public final class HangingBreakListener extends Queue implements Listener {
|
||||
|
||||
if (!event.isCancelled() && Config.getConfig(entity.getWorld()).ITEM_TRANSACTIONS) {
|
||||
if (itemframe.getItem().getType() != Material.AIR) {
|
||||
PlayerInteractEntityListener.queueFrameTransaction(causeName, itemframe, logDrops);
|
||||
ItemStack[] oldState = new ItemStack[] { itemframe.getItem().clone() };
|
||||
ItemStack[] newState = new ItemStack[] { new ItemStack(Material.AIR) };
|
||||
PlayerInteractEntityListener.queueContainerSpecifiedItems(causeName, Material.ITEM_FRAME, new Object[] { oldState, newState, itemframe.getFacing() }, itemframe.getLocation(), logDrops);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,10 +2,7 @@ package net.coreprotect.listener.player;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@@ -60,15 +57,9 @@ public final class ArmorStandManipulateListener extends Queue implements Listene
|
||||
try (Connection connection = Database.getConnection(true)) {
|
||||
if (connection != null) {
|
||||
Statement statement = connection.createStatement();
|
||||
String blockData = ChestTransactionLookup.performLookup(null, statement, location, finalPlayer, 1, 7, true);
|
||||
|
||||
if (blockData.contains("\n")) {
|
||||
for (String b : blockData.split("\n")) {
|
||||
Chat.sendComponent(finalPlayer, b);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Chat.sendComponent(finalPlayer, blockData);
|
||||
List<String> blockData = ChestTransactionLookup.performLookup(null, statement, location, finalPlayer, 1, 7, true);
|
||||
for (String data : blockData) {
|
||||
Chat.sendComponent(finalPlayer, data);
|
||||
}
|
||||
statement.close();
|
||||
}
|
||||
@@ -93,7 +84,8 @@ public final class ArmorStandManipulateListener extends Queue implements Listene
|
||||
Player player = event.getPlayer();
|
||||
final ArmorStand armorStand = event.getRightClicked();
|
||||
EntityEquipment equipment = armorStand.getEquipment();
|
||||
ItemStack[] contents = Util.getArmorStandContents(equipment);
|
||||
ItemStack[] oldContents = Util.getArmorStandContents(equipment);
|
||||
ItemStack[] newContents = oldContents.clone();
|
||||
ItemStack item = event.getArmorStandItem();
|
||||
ItemStack playerItem = event.getPlayerItem();
|
||||
|
||||
@@ -116,49 +108,45 @@ public final class ArmorStandManipulateListener extends Queue implements Listene
|
||||
return;
|
||||
}
|
||||
|
||||
if (item == null && playerItem == null) {
|
||||
int slot = 0;
|
||||
switch (event.getSlot()) {
|
||||
case LEGS:
|
||||
slot = 1;
|
||||
break;
|
||||
case CHEST:
|
||||
slot = 2;
|
||||
break;
|
||||
case HEAD:
|
||||
slot = 3;
|
||||
break;
|
||||
case HAND:
|
||||
slot = 4;
|
||||
break;
|
||||
case OFF_HAND:
|
||||
slot = 5;
|
||||
break;
|
||||
default:
|
||||
slot = 0;
|
||||
}
|
||||
// 0: BOOTS, 1: LEGGINGS, 2: CHESTPLATE, 3: HELMET, 4: MAINHAND, 5: OFFHAND
|
||||
|
||||
if (item.getType() == playerItem.getType()) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
if (item!=null && playerItem==null){
|
||||
//player gets item
|
||||
}
|
||||
if (item==null && playerItem!=null){
|
||||
//players item placed on armor stands
|
||||
}
|
||||
if (item!=null && playerItem!=null){
|
||||
//items are swapped
|
||||
}
|
||||
*/
|
||||
|
||||
Material type = Material.ARMOR_STAND;
|
||||
Location standLocation = armorStand.getLocation();
|
||||
int x = standLocation.getBlockX();
|
||||
int y = standLocation.getBlockY();
|
||||
int z = standLocation.getBlockZ();
|
||||
|
||||
String transactingChestId = standLocation.getWorld().getUID().toString() + "." + x + "." + y + "." + z;
|
||||
String loggingChestId = player.getName().toLowerCase(Locale.ROOT) + "." + x + "." + y + "." + z;
|
||||
int chestId = Queue.getChestId(loggingChestId);
|
||||
if (chestId > 0) {
|
||||
if (ConfigHandler.forceContainer.get(loggingChestId) != null) {
|
||||
int force_size = ConfigHandler.forceContainer.get(loggingChestId).size();
|
||||
List<ItemStack[]> list = ConfigHandler.oldContainer.get(loggingChestId);
|
||||
|
||||
if (list.size() <= force_size) {
|
||||
list.add(Util.getContainerState(contents));
|
||||
ConfigHandler.oldContainer.put(loggingChestId, list);
|
||||
}
|
||||
}
|
||||
else if (item.getType() != Material.AIR && playerItem.getType() == Material.AIR) {
|
||||
oldContents[slot] = item.clone();
|
||||
newContents[slot] = new ItemStack(Material.AIR);
|
||||
PlayerInteractEntityListener.queueContainerSpecifiedItems(player.getName(), Material.ARMOR_STAND, new Object[] { oldContents, newContents }, armorStand.getLocation(), false);
|
||||
}
|
||||
else {
|
||||
List<ItemStack[]> list = new ArrayList<>();
|
||||
list.add(Util.getContainerState(contents));
|
||||
ConfigHandler.oldContainer.put(loggingChestId, list);
|
||||
else if (item.getType() == Material.AIR && playerItem.getType() != Material.AIR) {
|
||||
oldContents[slot] = new ItemStack(Material.AIR);
|
||||
newContents[slot] = playerItem.clone();
|
||||
PlayerInteractEntityListener.queueContainerSpecifiedItems(player.getName(), Material.ARMOR_STAND, new Object[] { oldContents, newContents }, armorStand.getLocation(), false);
|
||||
}
|
||||
else if (item.getType() != Material.AIR && playerItem.getType() != Material.AIR) {
|
||||
oldContents[slot] = item.clone();
|
||||
newContents[slot] = playerItem.clone();
|
||||
PlayerInteractEntityListener.queueContainerSpecifiedItems(player.getName(), Material.ARMOR_STAND, new Object[] { oldContents, newContents }, armorStand.getLocation(), false);
|
||||
}
|
||||
|
||||
ConfigHandler.transactingChest.computeIfAbsent(transactingChestId, k -> Collections.synchronizedList(new ArrayList<>()));
|
||||
Queue.queueContainerTransaction(player.getName(), standLocation, type, equipment, chestId);
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import java.util.Locale;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.event.Event.Result;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@@ -71,7 +71,7 @@ public final class CraftItemListener extends Queue implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = (Player) event.getWhoClicked();
|
||||
HumanEntity player = event.getWhoClicked();
|
||||
if (event.getClick() == ClickType.NUMBER_KEY && player.getInventory().getItem(event.getHotbarButton()) != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package net.coreprotect.listener.player;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
@@ -15,6 +14,7 @@ import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||
import net.coreprotect.CoreProtect;
|
||||
import net.coreprotect.consumer.Queue;
|
||||
import net.coreprotect.thread.CacheHandler;
|
||||
import net.coreprotect.thread.Scheduler;
|
||||
import net.coreprotect.utility.Util;
|
||||
|
||||
public final class FoodLevelChangeListener extends Queue implements Listener {
|
||||
@@ -50,7 +50,7 @@ public final class FoodLevelChangeListener extends Queue implements Listener {
|
||||
}
|
||||
final Material oldBlockType = oldType;
|
||||
|
||||
Bukkit.getServer().getScheduler().runTask(CoreProtect.getInstance(), () -> {
|
||||
Scheduler.runTask(CoreProtect.getInstance(), () -> {
|
||||
try {
|
||||
Block newBlock = oldBlockState.getBlock();
|
||||
BlockState newBlockState = newBlock.getState();
|
||||
@@ -66,7 +66,7 @@ public final class FoodLevelChangeListener extends Queue implements Listener {
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}, oldBlockState.getLocation());
|
||||
}
|
||||
|
||||
CacheHandler.interactCache.remove(coordinates);
|
||||
|
||||
@@ -5,7 +5,6 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.inventory.BrewerInventory;
|
||||
import org.bukkit.inventory.FurnaceInventory;
|
||||
@@ -16,6 +15,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import net.coreprotect.CoreProtect;
|
||||
import net.coreprotect.config.Config;
|
||||
import net.coreprotect.config.ConfigHandler;
|
||||
import net.coreprotect.thread.Scheduler;
|
||||
import net.coreprotect.utility.Util;
|
||||
|
||||
public final class HopperPullListener {
|
||||
@@ -38,7 +38,7 @@ public final class HopperPullListener {
|
||||
ItemStack movedItem = item.clone();
|
||||
|
||||
final long taskStarted = InventoryChangeListener.tasksStarted.incrementAndGet();
|
||||
Bukkit.getServer().getScheduler().runTaskAsynchronously(CoreProtect.getInstance(), () -> {
|
||||
Scheduler.runTaskAsynchronously(CoreProtect.getInstance(), () -> {
|
||||
try {
|
||||
if (sourceHolder == null || destinationHolder == null) {
|
||||
return;
|
||||
|
||||
@@ -5,7 +5,6 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.inventory.BrewerInventory;
|
||||
import org.bukkit.inventory.FurnaceInventory;
|
||||
@@ -16,6 +15,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import net.coreprotect.CoreProtect;
|
||||
import net.coreprotect.config.Config;
|
||||
import net.coreprotect.config.ConfigHandler;
|
||||
import net.coreprotect.thread.Scheduler;
|
||||
import net.coreprotect.utility.Util;
|
||||
|
||||
public final class HopperPushListener {
|
||||
@@ -38,7 +38,7 @@ public final class HopperPushListener {
|
||||
ItemStack movedItem = item.clone();
|
||||
|
||||
final long taskStarted = InventoryChangeListener.tasksStarted.incrementAndGet();
|
||||
Bukkit.getServer().getScheduler().runTaskAsynchronously(CoreProtect.getInstance(), () -> {
|
||||
Scheduler.runTaskAsynchronously(CoreProtect.getInstance(), () -> {
|
||||
try {
|
||||
if (sourceHolder == null || destinationHolder == null) {
|
||||
return;
|
||||
|
||||
@@ -6,7 +6,6 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
@@ -32,6 +31,7 @@ import net.coreprotect.config.ConfigHandler;
|
||||
import net.coreprotect.consumer.Queue;
|
||||
import net.coreprotect.model.BlockGroup;
|
||||
import net.coreprotect.paper.PaperAdapter;
|
||||
import net.coreprotect.thread.Scheduler;
|
||||
import net.coreprotect.utility.Util;
|
||||
import net.coreprotect.utility.Validate;
|
||||
|
||||
@@ -122,7 +122,7 @@ public final class InventoryChangeListener extends Queue implements Listener {
|
||||
ConfigHandler.forceContainer.computeIfAbsent(loggingChestIdViewer, k -> new ArrayList<>());
|
||||
List<ItemStack[]> list = ConfigHandler.forceContainer.get(loggingChestIdViewer);
|
||||
|
||||
if (list.size() < sizeOld) {
|
||||
if (list != null && list.size() < sizeOld) {
|
||||
ItemStack[] containerState = Util.getContainerState(inventoryData);
|
||||
|
||||
// If items have been removed by a hopper, merge into containerState
|
||||
@@ -227,7 +227,7 @@ public final class InventoryChangeListener extends Queue implements Listener {
|
||||
ItemStack[] containerState = Util.getContainerState(inventory.getContents());
|
||||
|
||||
final long taskStarted = InventoryChangeListener.tasksStarted.incrementAndGet();
|
||||
Bukkit.getServer().getScheduler().runTaskAsynchronously(CoreProtect.getInstance(), () -> {
|
||||
Scheduler.runTaskAsynchronously(CoreProtect.getInstance(), () -> {
|
||||
try {
|
||||
Material containerType = (enderChest != true ? null : Material.ENDER_CHEST);
|
||||
InventoryChangeListener.checkTasks(taskStarted);
|
||||
@@ -249,7 +249,13 @@ public final class InventoryChangeListener extends Queue implements Listener {
|
||||
boolean enderChest = false;
|
||||
if (inventoryAction != InventoryAction.MOVE_TO_OTHER_INVENTORY && inventoryAction != InventoryAction.COLLECT_TO_CURSOR && inventoryAction != InventoryAction.UNKNOWN) {
|
||||
// Perform this check to prevent triggering onInventoryInteractAsync when a user is just clicking items in their own inventory
|
||||
Inventory inventory = event.getView().getInventory(event.getRawSlot());
|
||||
Inventory inventory = null;
|
||||
try {
|
||||
inventory = event.getView().getInventory(event.getRawSlot());
|
||||
}
|
||||
catch (Exception e) {
|
||||
return;
|
||||
}
|
||||
if (inventory == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ import net.coreprotect.consumer.Queue;
|
||||
|
||||
public final class PlayerDropItemListener extends Queue implements Listener {
|
||||
|
||||
protected static void playerDropItem(Location location, String user, ItemStack itemStack) {
|
||||
public static void playerDropItem(Location location, String user, ItemStack itemStack) {
|
||||
if (!Config.getConfig(location.getWorld()).ITEM_DROPS || itemStack == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.Locale;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Creature;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.ItemFrame;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -21,6 +22,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import net.coreprotect.config.Config;
|
||||
import net.coreprotect.config.ConfigHandler;
|
||||
import net.coreprotect.consumer.Queue;
|
||||
import net.coreprotect.database.logger.ItemLogger;
|
||||
import net.coreprotect.model.BlockGroup;
|
||||
import net.coreprotect.utility.Util;
|
||||
|
||||
@@ -36,14 +38,14 @@ public final class PlayerInteractEntityListener extends Queue implements Listene
|
||||
final Entity entity = event.getRightClicked(); // change item in ItemFrame, etc
|
||||
if (entity instanceof ItemFrame) {
|
||||
ItemFrame frame = (ItemFrame) entity;
|
||||
Material handType = Material.AIR;
|
||||
ItemStack handItem = new ItemStack(Material.AIR);
|
||||
ItemStack mainHand = player.getInventory().getItemInMainHand();
|
||||
ItemStack offHand = player.getInventory().getItemInOffHand();
|
||||
if (event.getHand().equals(EquipmentSlot.HAND) && mainHand.getType() != Material.AIR) {
|
||||
handType = mainHand.getType();
|
||||
handItem = mainHand;
|
||||
}
|
||||
else if (event.getHand().equals(EquipmentSlot.OFF_HAND) && offHand.getType() != Material.AIR) {
|
||||
handType = offHand.getType();
|
||||
handItem = offHand;
|
||||
}
|
||||
else if (event.getHand().equals(EquipmentSlot.OFF_HAND)) {
|
||||
return;
|
||||
@@ -70,21 +72,51 @@ public final class PlayerInteractEntityListener extends Queue implements Listene
|
||||
return;
|
||||
}
|
||||
|
||||
if (frame.getItem().getType().equals(Material.AIR) && !handType.equals(Material.AIR)) {
|
||||
queueFrameTransaction(player.getName(), frame, false);
|
||||
if (frame.getItem().getType().equals(Material.AIR) && !handItem.getType().equals(Material.AIR)) { // add item to item frame
|
||||
ItemStack[] oldState = new ItemStack[] { new ItemStack(Material.AIR) };
|
||||
ItemStack[] newState = new ItemStack[] { handItem.clone() };
|
||||
queueContainerSpecifiedItems(player.getName(), Material.ITEM_FRAME, new Object[] { oldState, newState, frame.getFacing() }, frame.getLocation(), false);
|
||||
}
|
||||
}
|
||||
else if (!event.isCancelled() && entity instanceof Creature && entity.getType().name().equals("ALLAY")) {
|
||||
ItemStack handItem = new ItemStack(Material.AIR);
|
||||
ItemStack mainHand = player.getInventory().getItemInMainHand();
|
||||
ItemStack offHand = player.getInventory().getItemInOffHand();
|
||||
if (event.getHand().equals(EquipmentSlot.HAND) && mainHand.getType() != Material.AIR) {
|
||||
handItem = mainHand;
|
||||
}
|
||||
else if (event.getHand().equals(EquipmentSlot.OFF_HAND) && offHand.getType() != Material.AIR) {
|
||||
handItem = offHand;
|
||||
}
|
||||
else if (event.getHand().equals(EquipmentSlot.OFF_HAND)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack allayItem = ((Creature) entity).getEquipment().getItemInMainHand();
|
||||
if (handItem.getType().equals(allayItem.getType())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (allayItem.getType().equals(Material.AIR)) {
|
||||
ItemStack removedItem = handItem.clone();
|
||||
removedItem.setAmount(1);
|
||||
CraftItemListener.logCraftedItem(player.getLocation(), player.getName(), removedItem, ItemLogger.ITEM_SELL);
|
||||
}
|
||||
else if (handItem.getType().equals(Material.AIR)) {
|
||||
ItemStack addItem = allayItem.clone();
|
||||
addItem.setAmount(1);
|
||||
CraftItemListener.logCraftedItem(player.getLocation(), player.getName(), addItem, ItemLogger.ITEM_BUY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void queueFrameTransaction(String user, ItemFrame frame, boolean logDrop) {
|
||||
ItemStack[] contents = Util.getItemFrameItem(frame);
|
||||
Material type = Material.ITEM_FRAME;
|
||||
Location frameLocation = frame.getLocation();
|
||||
int x = frameLocation.getBlockX();
|
||||
int y = frameLocation.getBlockY();
|
||||
int z = frameLocation.getBlockZ();
|
||||
public static void queueContainerSpecifiedItems(String user, Material type, Object container, Location location, boolean logDrop) {
|
||||
ItemStack[] contents = (ItemStack[]) ((Object[]) container)[0];
|
||||
int x = location.getBlockX();
|
||||
int y = location.getBlockY();
|
||||
int z = location.getBlockZ();
|
||||
|
||||
String transactingChestId = frameLocation.getWorld().getUID().toString() + "." + x + "." + y + "." + z;
|
||||
String transactingChestId = location.getWorld().getUID().toString() + "." + x + "." + y + "." + z;
|
||||
String loggingChestId = user.toLowerCase(Locale.ROOT) + "." + x + "." + y + "." + z;
|
||||
int chestId = Queue.getChestId(loggingChestId);
|
||||
if (chestId > 0) {
|
||||
@@ -105,15 +137,15 @@ public final class PlayerInteractEntityListener extends Queue implements Listene
|
||||
}
|
||||
|
||||
ConfigHandler.transactingChest.computeIfAbsent(transactingChestId, k -> Collections.synchronizedList(new ArrayList<>()));
|
||||
Queue.queueContainerTransaction(user, frameLocation, type, frame, chestId);
|
||||
Queue.queueContainerTransaction(user, location, type, container, chestId);
|
||||
|
||||
if (logDrop) {
|
||||
ItemStack dropItem = frame.getItem();
|
||||
ItemStack dropItem = contents[0];
|
||||
if (dropItem.getType() == Material.AIR) {
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerDropItemListener.playerDropItem(frame.getLocation(), user, dropItem);
|
||||
PlayerDropItemListener.playerDropItem(location, user, dropItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,8 +8,6 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@@ -19,6 +17,7 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.Chest;
|
||||
import org.bukkit.block.DoubleChest;
|
||||
import org.bukkit.block.Jukebox;
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.block.data.Bisected;
|
||||
import org.bukkit.block.data.Bisected.Half;
|
||||
@@ -37,6 +36,7 @@ import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.BlockInventoryHolder;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@@ -52,8 +52,11 @@ import net.coreprotect.database.lookup.ChestTransactionLookup;
|
||||
import net.coreprotect.database.lookup.InteractionLookup;
|
||||
import net.coreprotect.database.lookup.SignMessageLookup;
|
||||
import net.coreprotect.language.Phrase;
|
||||
import net.coreprotect.listener.block.CampfireStartListener;
|
||||
import net.coreprotect.model.BlockGroup;
|
||||
import net.coreprotect.paper.PaperAdapter;
|
||||
import net.coreprotect.thread.CacheHandler;
|
||||
import net.coreprotect.thread.Scheduler;
|
||||
import net.coreprotect.utility.Chat;
|
||||
import net.coreprotect.utility.Color;
|
||||
import net.coreprotect.utility.Util;
|
||||
@@ -61,6 +64,7 @@ import net.coreprotect.utility.Util;
|
||||
public final class PlayerInteractListener extends Queue implements Listener {
|
||||
|
||||
public static ConcurrentHashMap<String, Object[]> lastInspectorEvent = new ConcurrentHashMap<>();
|
||||
public static ConcurrentHashMap<String, Object[]> suspiciousBlockEvent = new ConcurrentHashMap<>();
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
protected void onPlayerInspect(PlayerInteractEvent event) {
|
||||
@@ -139,7 +143,7 @@ public final class PlayerInteractListener extends Queue implements Listener {
|
||||
if (blockFinal instanceof Sign && player.getGameMode() != GameMode.CREATIVE) {
|
||||
Thread.sleep(1500);
|
||||
Sign sign = (Sign) blockFinal;
|
||||
BukkitAdapter.ADAPTER.sendSignChange(player, sign);
|
||||
player.sendSignChange(sign.getLocation(), sign.getLines(), sign.getColor());
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -186,7 +190,7 @@ public final class PlayerInteractListener extends Queue implements Listener {
|
||||
final Material type = block.getType();
|
||||
boolean isInteractBlock = BlockGroup.INTERACT_BLOCKS.contains(type);
|
||||
boolean isContainerBlock = BlockGroup.CONTAINERS.contains(type);
|
||||
boolean isSignBlock = Tag.SIGNS.isTagged(type);
|
||||
boolean isSignBlock = BukkitAdapter.ADAPTER.isSign(type);
|
||||
|
||||
if (isInteractBlock || isContainerBlock || isSignBlock) {
|
||||
final Block clickedBlock = event.getClickedBlock();
|
||||
@@ -303,15 +307,9 @@ public final class PlayerInteractListener extends Queue implements Listener {
|
||||
try (Connection connection = Database.getConnection(true)) {
|
||||
if (connection != null) {
|
||||
Statement statement = connection.createStatement();
|
||||
String blockData = ChestTransactionLookup.performLookup(null, statement, finalLocation, player, 1, 7, false);
|
||||
|
||||
if (blockData.contains("\n")) {
|
||||
for (String splitData : blockData.split("\n")) {
|
||||
Chat.sendComponent(player, splitData);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Chat.sendComponent(player, blockData);
|
||||
List<String> blockData = ChestTransactionLookup.performLookup(null, statement, finalLocation, player, 1, 7, false);
|
||||
for (String data : blockData) {
|
||||
Chat.sendComponent(player, data);
|
||||
}
|
||||
|
||||
statement.close();
|
||||
@@ -527,13 +525,20 @@ public final class PlayerInteractListener extends Queue implements Listener {
|
||||
/* Logging for players punching out fire blocks. */
|
||||
if (event.getAction().equals(Action.LEFT_CLICK_BLOCK)) {
|
||||
World world = event.getClickedBlock().getWorld();
|
||||
if (event.useInteractedBlock() != Event.Result.DENY && Config.getConfig(world).BLOCK_BREAK) {
|
||||
Block relativeBlock = event.getClickedBlock().getRelative(event.getBlockFace());
|
||||
if (event.useInteractedBlock() != Event.Result.DENY) {
|
||||
Block block = event.getClickedBlock();
|
||||
if (block.getType() == Material.DRAGON_EGG) {
|
||||
clickedDragonEgg(event.getPlayer(), block);
|
||||
}
|
||||
|
||||
if (BlockGroup.FIRE.contains(relativeBlock.getType())) {
|
||||
Player player = event.getPlayer();
|
||||
Material type = relativeBlock.getType();
|
||||
Queue.queueBlockBreak(player.getName(), relativeBlock.getState(), type, relativeBlock.getBlockData().getAsString(), 0);
|
||||
if (Config.getConfig(world).BLOCK_BREAK) {
|
||||
Block relativeBlock = event.getClickedBlock().getRelative(event.getBlockFace());
|
||||
|
||||
if (BlockGroup.FIRE.contains(relativeBlock.getType())) {
|
||||
Player player = event.getPlayer();
|
||||
Material type = relativeBlock.getType();
|
||||
Queue.queueBlockBreak(player.getName(), relativeBlock.getState(), type, relativeBlock.getBlockData().getAsString(), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -547,7 +552,7 @@ public final class PlayerInteractListener extends Queue implements Listener {
|
||||
if (event.useInteractedBlock() != Event.Result.DENY) {
|
||||
boolean isCake = false;
|
||||
|
||||
if (Tag.SIGNS.isTagged(type)) {
|
||||
if (BukkitAdapter.ADAPTER.isSign(type)) {
|
||||
// check if right clicked sign with dye
|
||||
Set<Material> dyeSet = EnumSet.of(Material.BLACK_DYE, Material.BLUE_DYE, Material.BROWN_DYE, Material.CYAN_DYE, Material.GRAY_DYE, Material.GREEN_DYE, Material.LIGHT_BLUE_DYE, Material.LIGHT_GRAY_DYE, Material.LIME_DYE, Material.MAGENTA_DYE, Material.ORANGE_DYE, Material.PINK_DYE, Material.PURPLE_DYE, Material.RED_DYE, Material.WHITE_DYE, Material.YELLOW_DYE);
|
||||
Material handType = null;
|
||||
@@ -557,30 +562,47 @@ public final class PlayerInteractListener extends Queue implements Listener {
|
||||
handType = mainHand.getType();
|
||||
}
|
||||
|
||||
if (handType != null && (dyeSet.contains(handType) || handType.name().endsWith("INK_SAC")) && Config.getConfig(block.getWorld()).SIGN_TEXT) {
|
||||
if (handType != null && (dyeSet.contains(handType) || handType.name().endsWith("INK_SAC") || handType == Material.HONEYCOMB) && Config.getConfig(block.getWorld()).SIGN_TEXT) {
|
||||
BlockState blockState = block.getState();
|
||||
Sign sign = (Sign) blockState;
|
||||
String line1 = sign.getLine(0);
|
||||
String line2 = sign.getLine(1);
|
||||
String line3 = sign.getLine(2);
|
||||
String line4 = sign.getLine(3);
|
||||
int oldColor = sign.getColor().getColor().asRGB();
|
||||
int newColor = oldColor;
|
||||
boolean oldGlowing = BukkitAdapter.ADAPTER.isGlowing(sign);
|
||||
boolean newGlowing = oldGlowing;
|
||||
String line1 = PaperAdapter.ADAPTER.getLine(sign, 0);
|
||||
String line2 = PaperAdapter.ADAPTER.getLine(sign, 1);
|
||||
String line3 = PaperAdapter.ADAPTER.getLine(sign, 2);
|
||||
String line4 = PaperAdapter.ADAPTER.getLine(sign, 3);
|
||||
String line5 = PaperAdapter.ADAPTER.getLine(sign, 4);
|
||||
String line6 = PaperAdapter.ADAPTER.getLine(sign, 5);
|
||||
String line7 = PaperAdapter.ADAPTER.getLine(sign, 6);
|
||||
String line8 = PaperAdapter.ADAPTER.getLine(sign, 7);
|
||||
|
||||
if (dyeSet.contains(handType)) {
|
||||
newColor = (DyeColor.valueOf(handType.name().replaceFirst("_DYE", ""))).getColor().asRGB();
|
||||
}
|
||||
else {
|
||||
newGlowing = (handType != Material.INK_SAC);
|
||||
}
|
||||
boolean isFront = true;
|
||||
int oldColor = BukkitAdapter.ADAPTER.getColor(sign, isFront);
|
||||
int oldColorSecondary = BukkitAdapter.ADAPTER.getColor(sign, !isFront);
|
||||
boolean oldFrontGlowing = BukkitAdapter.ADAPTER.isGlowing(sign, isFront);
|
||||
boolean oldBackGlowing = BukkitAdapter.ADAPTER.isGlowing(sign, !isFront);
|
||||
boolean oldIsWaxed = BukkitAdapter.ADAPTER.isWaxed(sign);
|
||||
|
||||
if (oldGlowing != newGlowing || oldColor != newColor) {
|
||||
Location location = blockState.getLocation();
|
||||
Queue.queueSignText(player.getName(), location, 0, oldColor, oldGlowing, line1, line2, line3, line4, 1); // 1 second timeOffset
|
||||
Queue.queueBlockPlace(player.getName(), block.getState(), block.getType(), blockState, block.getType(), -1, 0, blockState.getBlockData().getAsString());
|
||||
Queue.queueSignText(player.getName(), location, 2, newColor, newGlowing, line1, line2, line3, line4, 0);
|
||||
if (!oldIsWaxed) {
|
||||
Scheduler.runTask(CoreProtect.getInstance(), () -> {
|
||||
BlockState newState = block.getState();
|
||||
if (newState instanceof Sign) {
|
||||
Sign newSign = (Sign) newState;
|
||||
int newColor = BukkitAdapter.ADAPTER.getColor(newSign, isFront);
|
||||
int newColorSecondary = BukkitAdapter.ADAPTER.getColor(newSign, !isFront);
|
||||
boolean newFrontGlowing = BukkitAdapter.ADAPTER.isGlowing(newSign, isFront);
|
||||
boolean newBackGlowing = BukkitAdapter.ADAPTER.isGlowing(newSign, !isFront);
|
||||
boolean newIsWaxed = BukkitAdapter.ADAPTER.isWaxed(newSign);
|
||||
|
||||
boolean modifyingFront = oldBackGlowing == newBackGlowing && oldColorSecondary == newColorSecondary;
|
||||
if (oldColor != newColor || oldColorSecondary != newColorSecondary || oldFrontGlowing != newFrontGlowing || oldBackGlowing != newBackGlowing || oldIsWaxed != newIsWaxed) {
|
||||
Location location = blockState.getLocation();
|
||||
Queue.queueSignText(player.getName(), location, 0, oldColor, oldColorSecondary, oldFrontGlowing, oldBackGlowing, oldIsWaxed, modifyingFront, line1, line2, line3, line4, line5, line6, line7, line8, 1); // 1 second timeOffset
|
||||
Queue.queueBlockPlace(player.getName(), blockState, block.getType(), blockState, block.getType(), -1, 0, blockState.getBlockData().getAsString());
|
||||
Queue.queueSignText(player.getName(), location, 2, newColor, newColorSecondary, newFrontGlowing, newBackGlowing, newIsWaxed, modifyingFront, line1, line2, line3, line4, line5, line6, line7, line8, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}, block.getLocation());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -620,9 +642,158 @@ public final class PlayerInteractListener extends Queue implements Listener {
|
||||
});
|
||||
*/
|
||||
}
|
||||
else if (CampfireStartListener.useCampfireStartEvent && (type == Material.CAMPFIRE || type == Material.SOUL_CAMPFIRE)) {
|
||||
ItemStack handItem = null;
|
||||
ItemStack mainHand = player.getInventory().getItemInMainHand();
|
||||
ItemStack offHand = player.getInventory().getItemInOffHand();
|
||||
|
||||
if (event.getHand().equals(EquipmentSlot.HAND) && mainHand != null && mainHand.getType() != Material.BUCKET) {
|
||||
handItem = mainHand;
|
||||
}
|
||||
else if (event.getHand().equals(EquipmentSlot.OFF_HAND) && offHand != null) {
|
||||
handItem = offHand;
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.getGameMode() != GameMode.CREATIVE) {
|
||||
Location location = block.getLocation();
|
||||
long time = System.currentTimeMillis();
|
||||
int wid = Util.getWorldId(location.getWorld().getName());
|
||||
int x = location.getBlockX();
|
||||
int y = location.getBlockY();
|
||||
int z = location.getBlockZ();
|
||||
String coordinates = x + "." + y + "." + z + "." + wid + "." + type.name();
|
||||
CacheHandler.interactCache.put(coordinates, new Object[] { time, handItem, player.getName() });
|
||||
}
|
||||
}
|
||||
|
||||
isCake = type.name().endsWith(Material.CAKE.name());
|
||||
}
|
||||
else if (type == Material.JUKEBOX) {
|
||||
BlockState blockState = block.getState();
|
||||
if (blockState instanceof Jukebox) {
|
||||
Jukebox jukebox = (Jukebox) blockState;
|
||||
ItemStack jukeboxRecord = jukebox.isPlaying() ? jukebox.getRecord() : new ItemStack(Material.AIR);
|
||||
ItemStack oldItemState = jukeboxRecord.clone();
|
||||
ItemStack newItemState = new ItemStack(Material.AIR);
|
||||
|
||||
if (jukeboxRecord.getType() == Material.AIR) {
|
||||
ItemStack handItem = null;
|
||||
ItemStack mainHand = player.getInventory().getItemInMainHand();
|
||||
ItemStack offHand = player.getInventory().getItemInOffHand();
|
||||
|
||||
if (event.getHand().equals(EquipmentSlot.HAND) && mainHand != null && Tag.ITEMS_MUSIC_DISCS.isTagged(mainHand.getType())) {
|
||||
handItem = mainHand;
|
||||
}
|
||||
else if (event.getHand().equals(EquipmentSlot.OFF_HAND) && offHand != null && Tag.ITEMS_MUSIC_DISCS.isTagged(offHand.getType())) {
|
||||
handItem = offHand;
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
|
||||
oldItemState = new ItemStack(Material.AIR);
|
||||
newItemState = handItem.clone();
|
||||
}
|
||||
|
||||
if (!oldItemState.equals(newItemState)) {
|
||||
if (Config.getConfig(player.getWorld()).PLAYER_INTERACTIONS) {
|
||||
Queue.queuePlayerInteraction(player.getName(), blockState, type);
|
||||
}
|
||||
|
||||
if (Config.getConfig(block.getWorld()).ITEM_TRANSACTIONS) {
|
||||
boolean logDrops = player.getGameMode() != GameMode.CREATIVE;
|
||||
ItemStack[] oldState = new ItemStack[] { oldItemState };
|
||||
ItemStack[] newState = new ItemStack[] { newItemState };
|
||||
PlayerInteractEntityListener.queueContainerSpecifiedItems(player.getName(), Material.JUKEBOX, new Object[] { oldState, newState }, jukebox.getLocation(), logDrops);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (BukkitAdapter.ADAPTER.isChiseledBookshelf(type)) {
|
||||
BlockState blockState = block.getState();
|
||||
if (blockState instanceof BlockInventoryHolder) {
|
||||
ItemStack book = BukkitAdapter.ADAPTER.getChiseledBookshelfBook(blockState, event);
|
||||
if (book != null) {
|
||||
ItemStack oldItemState = book.clone();
|
||||
ItemStack newItemState = new ItemStack(Material.AIR);
|
||||
|
||||
if (book.getType() == Material.AIR) {
|
||||
ItemStack handItem = null;
|
||||
ItemStack mainHand = player.getInventory().getItemInMainHand();
|
||||
ItemStack offHand = player.getInventory().getItemInOffHand();
|
||||
|
||||
if (event.getHand().equals(EquipmentSlot.HAND) && mainHand != null && BukkitAdapter.ADAPTER.isBookshelfBook(mainHand.getType())) {
|
||||
handItem = mainHand;
|
||||
}
|
||||
else if (event.getHand().equals(EquipmentSlot.OFF_HAND) && offHand != null && BukkitAdapter.ADAPTER.isBookshelfBook(offHand.getType())) {
|
||||
handItem = offHand;
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
|
||||
oldItemState = new ItemStack(Material.AIR);
|
||||
newItemState = handItem.clone();
|
||||
}
|
||||
|
||||
if (!oldItemState.equals(newItemState)) {
|
||||
if (Config.getConfig(player.getWorld()).PLAYER_INTERACTIONS) {
|
||||
Queue.queuePlayerInteraction(player.getName(), blockState, type);
|
||||
}
|
||||
|
||||
InventoryChangeListener.inventoryTransaction(player.getName(), blockState.getLocation(), null);
|
||||
}
|
||||
}
|
||||
else { // fallback if unable to determine bookshelf slot
|
||||
InventoryChangeListener.inventoryTransaction(player.getName(), blockState.getLocation(), null);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (BukkitAdapter.ADAPTER.isSuspiciousBlock(type)) {
|
||||
ItemStack handItem = null;
|
||||
ItemStack mainHand = player.getInventory().getItemInMainHand();
|
||||
ItemStack offHand = player.getInventory().getItemInOffHand();
|
||||
if (event.getHand().equals(EquipmentSlot.HAND) && mainHand != null) {
|
||||
handItem = mainHand;
|
||||
}
|
||||
else if (event.getHand().equals(EquipmentSlot.OFF_HAND) && offHand != null) {
|
||||
handItem = offHand;
|
||||
}
|
||||
|
||||
if (handItem.getType() == Material.BRUSH) {
|
||||
BlockState blockState = block.getState();
|
||||
Location blockLocation = block.getLocation();
|
||||
Scheduler.scheduleSyncDelayedTask(CoreProtect.getInstance(), () -> {
|
||||
Material newType = block.getType();
|
||||
if (type == newType || (newType != Material.SAND && newType != Material.GRAVEL)) {
|
||||
return;
|
||||
}
|
||||
|
||||
long systemTime = System.currentTimeMillis();
|
||||
boolean logChange = true;
|
||||
if (suspiciousBlockEvent.get(player.getName()) != null) {
|
||||
Object[] lastEvent = suspiciousBlockEvent.get(player.getName());
|
||||
long lastTime = (long) lastEvent[0];
|
||||
long timeSince = systemTime - lastTime;
|
||||
Location lastLocation = (Location) lastEvent[1];
|
||||
if (timeSince < 5000 && blockLocation.equals(lastLocation)) {
|
||||
logChange = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (logChange) {
|
||||
Queue.queueBlockPlace(player.getName(), blockState, newType, blockState, newType, -1, 0, null);
|
||||
suspiciousBlockEvent.put(player.getName(), new Object[] { systemTime, blockLocation });
|
||||
}
|
||||
}, blockLocation, 100);
|
||||
}
|
||||
}
|
||||
else if (type == Material.DRAGON_EGG) {
|
||||
clickedDragonEgg(player, block);
|
||||
}
|
||||
|
||||
if (isCake || type == Material.CAKE) {
|
||||
boolean placeCandle = false;
|
||||
@@ -691,7 +862,7 @@ public final class PlayerInteractListener extends Queue implements Listener {
|
||||
if (!exists) {
|
||||
final Player playerFinal = player;
|
||||
final Location locationFinal = crystalLocation;
|
||||
Bukkit.getServer().getScheduler().runTask(CoreProtect.getInstance(), () -> {
|
||||
Scheduler.runTask(CoreProtect.getInstance(), () -> {
|
||||
try {
|
||||
boolean blockExists = false;
|
||||
int showingBottom = 0;
|
||||
@@ -711,7 +882,7 @@ public final class PlayerInteractListener extends Queue implements Listener {
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}, locationFinal);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -734,7 +905,7 @@ public final class PlayerInteractListener extends Queue implements Listener {
|
||||
String relativeBlockKey = world.getName() + "-" + relativeBlockLocation.getBlockX() + "-" + relativeBlockLocation.getBlockY() + "-" + relativeBlockLocation.getBlockZ();
|
||||
String blockKey = world.getName() + "-" + blockLocation.getBlockX() + "-" + blockLocation.getBlockY() + "-" + blockLocation.getBlockZ();
|
||||
Object[] keys = new Object[] { relativeBlockKey, blockKey, handItem };
|
||||
ConfigHandler.entityBlockMapper.put(player.getUniqueId(), keys);
|
||||
ConfigHandler.entityBlockMapper.put(player.getName(), keys);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -762,4 +933,16 @@ public final class PlayerInteractListener extends Queue implements Listener {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void clickedDragonEgg(Player player, Block block) {
|
||||
Location location = block.getLocation();
|
||||
long time = System.currentTimeMillis();
|
||||
int wid = Util.getWorldId(location.getWorld().getName());
|
||||
int x = location.getBlockX();
|
||||
int y = location.getBlockY();
|
||||
int z = location.getBlockZ();
|
||||
String coordinates = x + "." + y + "." + z + "." + wid + "." + Material.DRAGON_EGG.name();
|
||||
CacheHandler.interactCache.put(coordinates, new Object[] { time, Material.DRAGON_EGG, player.getName() });
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,13 +9,10 @@ import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.AbstractArrow;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
@@ -66,17 +63,15 @@ public final class ProjectileLaunchListener extends Queue implements Listener {
|
||||
protected void onProjectileLaunch(ProjectileLaunchEvent event) {
|
||||
Location location = event.getEntity().getLocation();
|
||||
String key = location.getWorld().getName() + "-" + location.getBlockX() + "-" + location.getBlockY() + "-" + location.getBlockZ();
|
||||
Iterator<Entry<UUID, Object[]>> it = ConfigHandler.entityBlockMapper.entrySet().iterator();
|
||||
Iterator<Entry<String, Object[]>> it = ConfigHandler.entityBlockMapper.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry<UUID, Object[]> pair = it.next();
|
||||
UUID uuid = pair.getKey();
|
||||
Map.Entry<String, Object[]> pair = it.next();
|
||||
String name = pair.getKey();
|
||||
Object[] data = pair.getValue();
|
||||
ItemStack itemStack = (ItemStack) data[2];
|
||||
Material entityMaterial = Util.getEntityMaterial(event.getEntityType());
|
||||
boolean isBow = BOWS.contains(itemStack.getType());
|
||||
if ((data[0].equals(key) || data[1].equals(key)) && (entityMaterial == itemStack.getType() || (itemStack.getType() == Material.LINGERING_POTION && entityMaterial == Material.SPLASH_POTION) || isBow)) {
|
||||
Player player = Bukkit.getServer().getPlayer(uuid);
|
||||
|
||||
boolean thrownItem = (itemStack.getType() != Material.FIREWORK_ROCKET && !isBow);
|
||||
if (isBow) {
|
||||
if (itemStack.getType() == Material.CROSSBOW) {
|
||||
@@ -95,7 +90,7 @@ public final class ProjectileLaunchListener extends Queue implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
playerLaunchProjectile(location, player.getName(), itemStack, 1, 1, 0, (thrownItem ? ItemLogger.ITEM_THROW : ItemLogger.ITEM_SHOOT));
|
||||
playerLaunchProjectile(location, name, itemStack, 1, 1, 0, (thrownItem ? ItemLogger.ITEM_THROW : ItemLogger.ITEM_SHOOT));
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,24 +12,85 @@ import org.bukkit.event.block.SignChangeEvent;
|
||||
import net.coreprotect.bukkit.BukkitAdapter;
|
||||
import net.coreprotect.config.Config;
|
||||
import net.coreprotect.consumer.Queue;
|
||||
import net.coreprotect.paper.PaperAdapter;
|
||||
|
||||
public final class SignChangeListener extends Queue implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
protected void onSignChange(SignChangeEvent event) {
|
||||
String player = event.getPlayer().getName();
|
||||
Block block = event.getBlock();
|
||||
if (event.isCancelled() || !Config.getConfig(block.getWorld()).SIGN_TEXT) {
|
||||
return;
|
||||
}
|
||||
|
||||
String player = event.getPlayer().getName();
|
||||
Location location = block.getLocation();
|
||||
BlockState blockState = block.getState();
|
||||
String line1 = event.getLine(0);
|
||||
String line2 = event.getLine(1);
|
||||
String line3 = event.getLine(2);
|
||||
String line4 = event.getLine(3);
|
||||
int color = (blockState instanceof Sign) ? ((Sign) blockState).getColor().getColor().asRGB() : 0;
|
||||
boolean isGlowing = (blockState instanceof Sign) ? BukkitAdapter.ADAPTER.isGlowing((Sign) blockState) : false;
|
||||
|
||||
if (!event.isCancelled() && Config.getConfig(block.getWorld()).SIGN_TEXT) {
|
||||
Queue.queueSignText(player, location, 1, color, isGlowing, line1, line2, line3, line4, 0);
|
||||
String edit1 = event.getLine(0);
|
||||
String edit2 = event.getLine(1);
|
||||
String edit3 = event.getLine(2);
|
||||
String edit4 = event.getLine(3);
|
||||
String line1 = "";
|
||||
String line2 = "";
|
||||
String line3 = "";
|
||||
String line4 = "";
|
||||
String line5 = "";
|
||||
String line6 = "";
|
||||
String line7 = "";
|
||||
String line8 = "";
|
||||
int color = 0;
|
||||
int colorSecondary = 0;
|
||||
boolean frontGlowing = false;
|
||||
boolean backGlowing = false;
|
||||
boolean isWaxed = false;
|
||||
boolean isFront = BukkitAdapter.ADAPTER.isSignFront(event);
|
||||
boolean existingText = false;
|
||||
|
||||
if (blockState instanceof Sign) {
|
||||
Sign sign = (Sign) blockState;
|
||||
line1 = PaperAdapter.ADAPTER.getLine(sign, 0);
|
||||
line2 = PaperAdapter.ADAPTER.getLine(sign, 1);
|
||||
line3 = PaperAdapter.ADAPTER.getLine(sign, 2);
|
||||
line4 = PaperAdapter.ADAPTER.getLine(sign, 3);
|
||||
line5 = PaperAdapter.ADAPTER.getLine(sign, 4);
|
||||
line6 = PaperAdapter.ADAPTER.getLine(sign, 5);
|
||||
line7 = PaperAdapter.ADAPTER.getLine(sign, 6);
|
||||
line8 = PaperAdapter.ADAPTER.getLine(sign, 7);
|
||||
color = BukkitAdapter.ADAPTER.getColor(sign, true);
|
||||
colorSecondary = BukkitAdapter.ADAPTER.getColor(sign, false);
|
||||
frontGlowing = BukkitAdapter.ADAPTER.isGlowing(sign, true);
|
||||
backGlowing = BukkitAdapter.ADAPTER.isGlowing(sign, false);
|
||||
isWaxed = BukkitAdapter.ADAPTER.isWaxed(sign);
|
||||
|
||||
if (isFront && line1.equals(edit1) && line2.equals(edit2) && line3.equals(edit3) && line4.equals(edit4)) {
|
||||
return;
|
||||
}
|
||||
else if (!isFront && line5.equals(edit1) && line6.equals(edit2) && line7.equals(edit3) && line8.equals(edit4)) {
|
||||
return;
|
||||
}
|
||||
else if (line1.length() > 0 || line2.length() > 0 || line3.length() > 0 || line4.length() > 0 || line5.length() > 0 || line6.length() > 0 || line7.length() > 0 || line8.length() > 0) {
|
||||
existingText = true;
|
||||
Queue.queueSignText(player, location, 0, color, colorSecondary, frontGlowing, backGlowing, isWaxed, isFront, line1, line2, line3, line4, line5, line6, line7, line8, 1);
|
||||
Queue.queueBlockPlace(player, blockState, block.getType(), blockState, block.getType(), -1, 0, blockState.getBlockData().getAsString());
|
||||
}
|
||||
}
|
||||
|
||||
if (isFront) {
|
||||
line1 = edit1;
|
||||
line2 = edit2;
|
||||
line3 = edit3;
|
||||
line4 = edit4;
|
||||
}
|
||||
else {
|
||||
line5 = edit1;
|
||||
line6 = edit2;
|
||||
line7 = edit3;
|
||||
line8 = edit4;
|
||||
}
|
||||
|
||||
if (existingText || line1.length() > 0 || line2.length() > 0 || line3.length() > 0 || line4.length() > 0 || line5.length() > 0 || line6.length() > 0 || line7.length() > 0 || line8.length() > 0) {
|
||||
Queue.queueSignText(player, location, 1, color, colorSecondary, frontGlowing, backGlowing, isWaxed, isFront, line1, line2, line3, line4, line5, line6, line7, line8, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import java.util.Locale;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Tag;
|
||||
import org.bukkit.TreeType;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.BlockState;
|
||||
@@ -35,7 +36,7 @@ public final class StructureGrowListener extends Queue implements Listener {
|
||||
List<BlockState> blocks = event.getBlocks();
|
||||
if (blocks.size() <= 4) {
|
||||
for (BlockState block : blocks) {
|
||||
if (block.getType().equals(Material.OAK_SAPLING) || block.getType().equals(Material.SPRUCE_SAPLING) || block.getType().equals(Material.BIRCH_SAPLING) || block.getType().equals(Material.JUNGLE_SAPLING) || block.getType().equals(Material.ACACIA_SAPLING) || block.getType().equals(Material.DARK_OAK_SAPLING) || block.getType().equals(Material.BROWN_MUSHROOM) || block.getType().equals(Material.RED_MUSHROOM)) {
|
||||
if (Tag.SAPLINGS.isTagged(block.getType()) || block.getType().equals(Material.BROWN_MUSHROOM) || block.getType().equals(Material.RED_MUSHROOM)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,6 @@ import java.util.Set;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Tag;
|
||||
|
||||
import net.coreprotect.config.ConfigHandler;
|
||||
|
||||
public final class BlockGroup {
|
||||
|
||||
public static Set<Material> TRACK_ANY = new HashSet<>(Arrays.asList(Material.PISTON_HEAD, Material.LEVER, Material.BELL));
|
||||
@@ -17,7 +15,7 @@ public final class BlockGroup {
|
||||
public static Set<Material> TRACK_BOTTOM = new HashSet<>(Arrays.asList());
|
||||
public static Set<Material> TRACK_SIDE = new HashSet<>(Arrays.asList(Material.WALL_TORCH, Material.REDSTONE_WALL_TORCH, Material.RAIL, Material.POWERED_RAIL, Material.DETECTOR_RAIL, Material.ACTIVATOR_RAIL, Material.WHITE_BED, Material.ORANGE_BED, Material.MAGENTA_BED, Material.LIGHT_BLUE_BED, Material.YELLOW_BED, Material.LIME_BED, Material.PINK_BED, Material.GRAY_BED, Material.LIGHT_GRAY_BED, Material.CYAN_BED, Material.PURPLE_BED, Material.BLUE_BED, Material.BROWN_BED, Material.GREEN_BED, Material.RED_BED, Material.BLACK_BED, Material.LADDER, Material.ACACIA_WALL_SIGN, Material.BIRCH_WALL_SIGN, Material.DARK_OAK_WALL_SIGN, Material.JUNGLE_WALL_SIGN, Material.OAK_WALL_SIGN, Material.SPRUCE_WALL_SIGN, Material.VINE, Material.COCOA, Material.TRIPWIRE_HOOK, Material.WHITE_WALL_BANNER, Material.ORANGE_WALL_BANNER, Material.MAGENTA_WALL_BANNER, Material.LIGHT_BLUE_WALL_BANNER, Material.YELLOW_WALL_BANNER, Material.LIME_WALL_BANNER, Material.PINK_WALL_BANNER, Material.GRAY_WALL_BANNER, Material.LIGHT_GRAY_WALL_BANNER, Material.CYAN_WALL_BANNER, Material.PURPLE_WALL_BANNER, Material.BLUE_WALL_BANNER, Material.BROWN_WALL_BANNER, Material.GREEN_WALL_BANNER, Material.RED_WALL_BANNER, Material.BLACK_WALL_BANNER));
|
||||
public static Set<Material> SHULKER_BOXES = new HashSet<>(Arrays.asList(Material.SHULKER_BOX, Material.BLACK_SHULKER_BOX, Material.BLUE_SHULKER_BOX, Material.BROWN_SHULKER_BOX, Material.CYAN_SHULKER_BOX, Material.GRAY_SHULKER_BOX, Material.GREEN_SHULKER_BOX, Material.LIGHT_BLUE_SHULKER_BOX, Material.LIME_SHULKER_BOX, Material.MAGENTA_SHULKER_BOX, Material.ORANGE_SHULKER_BOX, Material.PINK_SHULKER_BOX, Material.PURPLE_SHULKER_BOX, Material.RED_SHULKER_BOX, Material.LIGHT_GRAY_SHULKER_BOX, Material.WHITE_SHULKER_BOX, Material.YELLOW_SHULKER_BOX));
|
||||
public static Set<Material> CONTAINERS = new HashSet<>(Arrays.asList(Material.DISPENSER, Material.CHEST, Material.FURNACE, Material.BREWING_STAND, Material.TRAPPED_CHEST, Material.HOPPER, Material.DROPPER, Material.ARMOR_STAND, Material.ITEM_FRAME, Material.SHULKER_BOX, Material.BLACK_SHULKER_BOX, Material.BLUE_SHULKER_BOX, Material.BROWN_SHULKER_BOX, Material.CYAN_SHULKER_BOX, Material.GRAY_SHULKER_BOX, Material.GREEN_SHULKER_BOX, Material.LIGHT_BLUE_SHULKER_BOX, Material.LIME_SHULKER_BOX, Material.MAGENTA_SHULKER_BOX, Material.ORANGE_SHULKER_BOX, Material.PINK_SHULKER_BOX, Material.PURPLE_SHULKER_BOX, Material.RED_SHULKER_BOX, Material.LIGHT_GRAY_SHULKER_BOX, Material.WHITE_SHULKER_BOX, Material.YELLOW_SHULKER_BOX, Material.BARREL, Material.BLAST_FURNACE, Material.SMOKER, Material.LECTERN));
|
||||
public static Set<Material> CONTAINERS = new HashSet<>(Arrays.asList(Material.JUKEBOX, Material.DISPENSER, Material.CHEST, Material.FURNACE, Material.BREWING_STAND, Material.TRAPPED_CHEST, Material.HOPPER, Material.DROPPER, Material.ARMOR_STAND, Material.ITEM_FRAME, Material.SHULKER_BOX, Material.BLACK_SHULKER_BOX, Material.BLUE_SHULKER_BOX, Material.BROWN_SHULKER_BOX, Material.CYAN_SHULKER_BOX, Material.GRAY_SHULKER_BOX, Material.GREEN_SHULKER_BOX, Material.LIGHT_BLUE_SHULKER_BOX, Material.LIME_SHULKER_BOX, Material.MAGENTA_SHULKER_BOX, Material.ORANGE_SHULKER_BOX, Material.PINK_SHULKER_BOX, Material.PURPLE_SHULKER_BOX, Material.RED_SHULKER_BOX, Material.LIGHT_GRAY_SHULKER_BOX, Material.WHITE_SHULKER_BOX, Material.YELLOW_SHULKER_BOX, Material.BARREL, Material.BLAST_FURNACE, Material.SMOKER, Material.LECTERN));
|
||||
public static Set<Material> DOORS = new HashSet<>(Arrays.asList(Material.OAK_DOOR, Material.SPRUCE_DOOR, Material.BIRCH_DOOR, Material.JUNGLE_DOOR, Material.ACACIA_DOOR, Material.DARK_OAK_DOOR));
|
||||
public static Set<Material> BUTTONS = new HashSet<>(Arrays.asList(Material.STONE_BUTTON, Material.OAK_BUTTON, Material.ACACIA_BUTTON, Material.BIRCH_BUTTON, Material.DARK_OAK_BUTTON, Material.JUNGLE_BUTTON, Material.SPRUCE_BUTTON));
|
||||
public static Set<Material> PRESSURE_PLATES = new HashSet<>(Arrays.asList(Material.STONE_PRESSURE_PLATE, Material.ACACIA_PRESSURE_PLATE, Material.BIRCH_PRESSURE_PLATE, Material.DARK_OAK_PRESSURE_PLATE, Material.HEAVY_WEIGHTED_PRESSURE_PLATE, Material.JUNGLE_PRESSURE_PLATE, Material.LIGHT_WEIGHTED_PRESSURE_PLATE, Material.OAK_PRESSURE_PLATE, Material.SPRUCE_PRESSURE_PLATE));
|
||||
@@ -33,6 +31,7 @@ public final class BlockGroup {
|
||||
public static Set<Material> SAFE_INTERACT_BLOCKS = new HashSet<>(Arrays.asList(Material.LEVER, Material.ACACIA_TRAPDOOR, Material.BIRCH_TRAPDOOR, Material.DARK_OAK_TRAPDOOR, Material.JUNGLE_TRAPDOOR, Material.SPRUCE_TRAPDOOR, Material.OAK_TRAPDOOR, Material.OAK_FENCE_GATE, Material.SPRUCE_FENCE_GATE, Material.BIRCH_FENCE_GATE, Material.JUNGLE_FENCE_GATE, Material.DARK_OAK_FENCE_GATE, Material.ACACIA_FENCE_GATE));
|
||||
public static Set<Material> UPDATE_STATE = new HashSet<>(Arrays.asList(Material.TORCH, Material.WALL_TORCH, Material.REDSTONE_WIRE, Material.RAIL, Material.POWERED_RAIL, Material.DETECTOR_RAIL, Material.FURNACE, Material.BLAST_FURNACE, Material.SMOKER, Material.LEVER, Material.REDSTONE_TORCH, Material.REDSTONE_WALL_TORCH, Material.GLOWSTONE, Material.JACK_O_LANTERN, Material.REPEATER, Material.REDSTONE_LAMP, Material.BEACON, Material.COMPARATOR, Material.DAYLIGHT_DETECTOR, Material.REDSTONE_BLOCK, Material.HOPPER, Material.CHEST, Material.TRAPPED_CHEST, Material.ACTIVATOR_RAIL));
|
||||
public static Set<Material> NATURAL_BLOCKS = new HashSet<>(Arrays.asList(Material.STONE, Material.GOLD_ORE, Material.IRON_ORE, Material.COAL_ORE, Material.LAPIS_ORE, Material.SANDSTONE, Material.COBWEB, Material.FERN, Material.DEAD_BUSH, Material.DANDELION, Material.POPPY, Material.BLUE_ORCHID, Material.ALLIUM, Material.AZURE_BLUET, Material.RED_TULIP, Material.ORANGE_TULIP, Material.WHITE_TULIP, Material.PINK_TULIP, Material.OXEYE_DAISY, Material.BROWN_MUSHROOM, Material.RED_MUSHROOM, Material.OBSIDIAN, Material.DIAMOND_ORE, Material.WHEAT, Material.REDSTONE_ORE, Material.SNOW, Material.ICE, Material.CACTUS, Material.CLAY, Material.SUGAR_CANE, Material.PUMPKIN, Material.NETHERRACK, Material.SOUL_SAND, Material.MELON, Material.PUMPKIN_STEM, Material.MELON_STEM, Material.MYCELIUM, Material.LILY_PAD, Material.NETHER_WART, Material.END_STONE, Material.EMERALD_ORE, Material.CARROT, Material.POTATO, Material.KELP, Material.CHORUS_FLOWER, Material.CHORUS_PLANT, Material.CORNFLOWER, Material.LILY_OF_THE_VALLEY, Material.WITHER_ROSE, Material.SWEET_BERRY_BUSH));
|
||||
public static Set<Material> SCULK = new HashSet<>(Arrays.asList());
|
||||
|
||||
/* blocks that support vertical scanning */
|
||||
public static Set<Material> VERTICAL_TOP_BOTTOM = new HashSet<>(Arrays.asList());
|
||||
@@ -45,75 +44,73 @@ public final class BlockGroup {
|
||||
public static Set<Material> NON_ATTACHABLE = new HashSet<>(Arrays.asList(Material.AIR, Material.CAVE_AIR, Material.BARRIER, Material.CORNFLOWER, Material.LILY_OF_THE_VALLEY, Material.WITHER_ROSE, Material.SWEET_BERRY_BUSH, Material.OAK_SAPLING, Material.SPRUCE_SAPLING, Material.BIRCH_SAPLING, Material.JUNGLE_SAPLING, Material.ACACIA_SAPLING, Material.DARK_OAK_SAPLING, Material.WATER, Material.LAVA, Material.POWERED_RAIL, Material.DETECTOR_RAIL, Material.GRASS, Material.FERN, Material.DEAD_BUSH, Material.DANDELION, Material.POPPY, Material.BLUE_ORCHID, Material.ALLIUM, Material.AZURE_BLUET, Material.RED_TULIP, Material.ORANGE_TULIP, Material.WHITE_TULIP, Material.PINK_TULIP, Material.OXEYE_DAISY, Material.BROWN_MUSHROOM, Material.RED_MUSHROOM, Material.TORCH, Material.WALL_TORCH, Material.REDSTONE_WIRE, Material.LADDER, Material.RAIL, Material.LEVER, Material.REDSTONE_TORCH, Material.REDSTONE_WALL_TORCH, Material.SNOW, Material.SUGAR_CANE, Material.NETHER_PORTAL, Material.REPEATER, Material.KELP, Material.CHORUS_FLOWER, Material.CHORUS_PLANT));
|
||||
|
||||
public static void initialize() {
|
||||
if (!ConfigHandler.serverRunning) {
|
||||
TRACK_ANY.addAll(BUTTONS);
|
||||
TRACK_TOP.addAll(DOORS);
|
||||
TRACK_TOP.addAll(PRESSURE_PLATES);
|
||||
TRACK_TOP.addAll(Tag.CARPETS.getValues());
|
||||
TRACK_TOP_BOTTOM.addAll(LANTERNS);
|
||||
LIGHTABLES.addAll(CANDLES);
|
||||
INTERACT_BLOCKS.addAll(DOORS);
|
||||
INTERACT_BLOCKS.addAll(BUTTONS);
|
||||
SAFE_INTERACT_BLOCKS.addAll(DOORS);
|
||||
SAFE_INTERACT_BLOCKS.addAll(BUTTONS);
|
||||
NON_ATTACHABLE.addAll(BUTTONS);
|
||||
NON_ATTACHABLE.addAll(CANDLES);
|
||||
NON_ATTACHABLE.addAll(FIRE);
|
||||
UPDATE_STATE.addAll(LIGHTABLES);
|
||||
UPDATE_STATE.addAll(LANTERNS);
|
||||
TRACK_ANY.addAll(BUTTONS);
|
||||
TRACK_TOP.addAll(DOORS);
|
||||
TRACK_TOP.addAll(PRESSURE_PLATES);
|
||||
TRACK_TOP.addAll(Tag.CARPETS.getValues());
|
||||
TRACK_TOP_BOTTOM.addAll(LANTERNS);
|
||||
LIGHTABLES.addAll(CANDLES);
|
||||
INTERACT_BLOCKS.addAll(DOORS);
|
||||
INTERACT_BLOCKS.addAll(BUTTONS);
|
||||
SAFE_INTERACT_BLOCKS.addAll(DOORS);
|
||||
SAFE_INTERACT_BLOCKS.addAll(BUTTONS);
|
||||
NON_ATTACHABLE.addAll(BUTTONS);
|
||||
NON_ATTACHABLE.addAll(CANDLES);
|
||||
NON_ATTACHABLE.addAll(FIRE);
|
||||
UPDATE_STATE.addAll(LIGHTABLES);
|
||||
UPDATE_STATE.addAll(LANTERNS);
|
||||
|
||||
/* add all blocks that support vertical scanning */
|
||||
VERTICAL.addAll(VERTICAL_TOP_BOTTOM);
|
||||
VERTICAL.addAll(VERTICAL_TOP);
|
||||
VERTICAL.addAll(VERTICAL_BOTTOM);
|
||||
/* add all blocks that support vertical scanning */
|
||||
VERTICAL.addAll(VERTICAL_TOP_BOTTOM);
|
||||
VERTICAL.addAll(VERTICAL_TOP);
|
||||
VERTICAL.addAll(VERTICAL_BOTTOM);
|
||||
|
||||
/* Natural block group */
|
||||
/* https://minecraft.fandom.com/wiki/Tag */
|
||||
NATURAL_BLOCKS.addAll(Tag.BAMBOO_PLANTABLE_ON.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.VALID_SPAWN.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.SAND.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.LOGS.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.LEAVES.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.ICE.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.UNDERWATER_BONEMEALS.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.CORAL_BLOCKS.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.ENDERMAN_HOLDABLE.getValues());
|
||||
NATURAL_BLOCKS.addAll(SOUL_BLOCKS);
|
||||
NATURAL_BLOCKS.addAll(VINES);
|
||||
/* Natural block group */
|
||||
/* https://minecraft.fandom.com/wiki/Tag */
|
||||
NATURAL_BLOCKS.addAll(Tag.BAMBOO_PLANTABLE_ON.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.VALID_SPAWN.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.SAND.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.LOGS.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.LEAVES.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.ICE.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.UNDERWATER_BONEMEALS.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.CORAL_BLOCKS.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.ENDERMAN_HOLDABLE.getValues());
|
||||
NATURAL_BLOCKS.addAll(SOUL_BLOCKS);
|
||||
NATURAL_BLOCKS.addAll(VINES);
|
||||
|
||||
/*
|
||||
NATURAL_BLOCKS.addAll(Tag.BASE_STONE_OVERWORLD.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.BEACON_BASE_BLOCKS.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.SOUL_FIRE_BASE_BLOCKS.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.GEODE_INVALID_BLOCKS.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.GUARDED_BY_PIGLINS.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.INFINIBURN_END.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.INFINIBURN_NETHER.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.INFINIBURN_OVERWORLD.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.INSIDE_STEP_SOUND_BLOCKS.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.DEEPSLATE_ORE_REPLACEABLES.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.DIRT.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.STONE_ORE_REPLACEABLES.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.COAL_ORES.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.COPPER_ORES.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.DIAMOND_ORES.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.EMERALD_ORES.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.GOLD_ORES.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.IRON_ORES.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.LAPIS_ORES.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.REDSTONE_ORES.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.FIRE.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.SNOW.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.BEEHIVES.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.BEE_GROWABLES.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.FLOWERS.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.CROPS.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.FEATURES_CANNOT_REPLACE.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.LUSH_GROUND_REPLACEABLE.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.MUSHROOM_GROW_BLOCK.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.NYLIUM.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.PORTALS.getValues());
|
||||
*/
|
||||
}
|
||||
/*
|
||||
NATURAL_BLOCKS.addAll(Tag.BASE_STONE_OVERWORLD.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.BEACON_BASE_BLOCKS.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.SOUL_FIRE_BASE_BLOCKS.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.GEODE_INVALID_BLOCKS.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.GUARDED_BY_PIGLINS.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.INFINIBURN_END.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.INFINIBURN_NETHER.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.INFINIBURN_OVERWORLD.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.INSIDE_STEP_SOUND_BLOCKS.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.DEEPSLATE_ORE_REPLACEABLES.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.DIRT.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.STONE_ORE_REPLACEABLES.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.COAL_ORES.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.COPPER_ORES.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.DIAMOND_ORES.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.EMERALD_ORES.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.GOLD_ORES.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.IRON_ORES.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.LAPIS_ORES.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.REDSTONE_ORES.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.FIRE.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.SNOW.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.BEEHIVES.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.BEE_GROWABLES.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.FLOWERS.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.CROPS.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.FEATURES_CANNOT_REPLACE.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.LUSH_GROUND_REPLACEABLE.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.MUSHROOM_GROW_BLOCK.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.NYLIUM.getValues());
|
||||
NATURAL_BLOCKS.addAll(Tag.PORTALS.getValues());
|
||||
*/
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
package net.coreprotect.paper;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
|
||||
@@ -17,6 +20,8 @@ public class PaperAdapter implements PaperInterface {
|
||||
public static final int PAPER_V1_16 = BukkitAdapter.BUKKIT_V1_16;
|
||||
public static final int PAPER_V1_17 = BukkitAdapter.BUKKIT_V1_17;
|
||||
public static final int PAPER_V1_18 = BukkitAdapter.BUKKIT_V1_18;
|
||||
public static final int PAPER_V1_19 = BukkitAdapter.BUKKIT_V1_19;
|
||||
public static final int PAPER_V1_20 = BukkitAdapter.BUKKIT_V1_20;
|
||||
|
||||
public static void loadAdapter() {
|
||||
int paperVersion = ConfigHandler.SERVER_VERSION;
|
||||
@@ -34,10 +39,16 @@ public class PaperAdapter implements PaperInterface {
|
||||
PaperAdapter.ADAPTER = new PaperHandler();
|
||||
break;
|
||||
case PAPER_V1_16:
|
||||
PaperAdapter.ADAPTER = new Paper_v1_16();
|
||||
break;
|
||||
case PAPER_V1_17:
|
||||
case PAPER_V1_18:
|
||||
case PAPER_V1_19:
|
||||
PaperAdapter.ADAPTER = new Paper_v1_17();
|
||||
break;
|
||||
case PAPER_V1_20:
|
||||
default:
|
||||
PaperAdapter.ADAPTER = new Paper_v1_16();
|
||||
PaperAdapter.ADAPTER = new Paper_v1_20();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -52,4 +63,14 @@ public class PaperAdapter implements PaperInterface {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLine(Sign sign, int line) {
|
||||
return BukkitAdapter.ADAPTER.getLine(sign, line);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void teleportAsync(Entity entity, Location location) {
|
||||
entity.teleport(location);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package net.coreprotect.paper;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
public class PaperHandler extends PaperAdapter implements PaperInterface {
|
||||
|
||||
@@ -9,4 +11,9 @@ public class PaperHandler extends PaperAdapter implements PaperInterface {
|
||||
return server.isStopping();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void teleportAsync(Entity entity, Location location) {
|
||||
entity.teleportAsync(location);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
package net.coreprotect.paper;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
|
||||
@@ -10,4 +13,8 @@ public interface PaperInterface {
|
||||
|
||||
public boolean isStopping(Server server);
|
||||
|
||||
public String getLine(Sign sign, int line);
|
||||
|
||||
public void teleportAsync(Entity entity, Location location);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package net.coreprotect.paper;
|
||||
|
||||
import org.bukkit.block.Sign;
|
||||
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
|
||||
public class Paper_v1_17 extends Paper_v1_16 implements PaperInterface {
|
||||
|
||||
@Override
|
||||
public String getLine(Sign sign, int line) {
|
||||
if (line >= 4) {
|
||||
return "";
|
||||
}
|
||||
|
||||
// https://docs.adventure.kyori.net/serializer/
|
||||
return LegacyComponentSerializer.legacySection().serialize(sign.line(line));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package net.coreprotect.paper;
|
||||
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.block.sign.Side;
|
||||
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
|
||||
public class Paper_v1_20 extends Paper_v1_17 implements PaperInterface {
|
||||
|
||||
@Override
|
||||
public String getLine(Sign sign, int line) {
|
||||
// https://docs.adventure.kyori.net/serializer/
|
||||
if (line < 4) {
|
||||
return LegacyComponentSerializer.legacySection().serialize(sign.getSide(Side.FRONT).line(line));
|
||||
}
|
||||
else {
|
||||
return LegacyComponentSerializer.legacySection().serialize(sign.getSide(Side.BACK).line(line - 4));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package net.coreprotect.paper.listener;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.type.Dispenser;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.papermc.paper.event.block.BlockPreDispenseEvent;
|
||||
import net.coreprotect.config.Config;
|
||||
import net.coreprotect.consumer.Queue;
|
||||
import net.coreprotect.listener.player.InventoryChangeListener;
|
||||
|
||||
public final class BlockPreDispenseListener extends Queue implements Listener {
|
||||
|
||||
public static boolean useBlockPreDispenseEvent = true;
|
||||
public static boolean useForDroppers = false;
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onBlockPreDispense(BlockPreDispenseEvent event) {
|
||||
Block block = event.getBlock();
|
||||
World world = block.getWorld();
|
||||
if (!Config.getConfig(world).BLOCK_PLACE) {
|
||||
return;
|
||||
}
|
||||
|
||||
BlockData blockData = block.getBlockData();
|
||||
if (blockData instanceof Dispenser) {
|
||||
if (!useForDroppers && block.getType() == Material.DROPPER) {
|
||||
useForDroppers = true;
|
||||
}
|
||||
|
||||
String user = "#dispenser";
|
||||
ItemStack[] inventory = ((InventoryHolder) block.getState()).getInventory().getStorageContents();
|
||||
InventoryChangeListener.inventoryTransaction(user, block.getLocation(), inventory);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -40,7 +40,7 @@ public class __2_15_0 {
|
||||
|
||||
try {
|
||||
if (Config.getGlobal().MYSQL) {
|
||||
statement.executeUpdate("ALTER TABLE " + ConfigHandler.prefix + "block MODIFY COLUMN rowid bigint(20) NOT NULL AUTO_INCREMENT, ADD COLUMN blockdata BLOB");
|
||||
statement.executeUpdate("ALTER TABLE " + ConfigHandler.prefix + "block MODIFY COLUMN rowid bigint NOT NULL AUTO_INCREMENT, ADD COLUMN blockdata BLOB");
|
||||
}
|
||||
else {
|
||||
statement.executeUpdate("ALTER TABLE " + ConfigHandler.prefix + "block ADD COLUMN blockdata BLOB");
|
||||
|
||||
Loaded 100 of 118 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user