mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-07-22 15:24:43 +02:00
Compare commits
93 Commits
Author | SHA1 | Date | |
---|---|---|---|
c31c855952 | |||
312b2ad1a8 | |||
0953b5627e | |||
57af89f1d0 | |||
f71f481ff3 | |||
0ba31ed56b | |||
edc81bc668 | |||
7797e33ec5 | |||
118adb42b9 | |||
cadd0cd9b4 | |||
f3187a465c | |||
6fe856c002 | |||
9a626ea1de | |||
026233b7e7 | |||
6ee9d91aef | |||
808a1ed703 | |||
7142e9e0e3 | |||
66a2e5427e | |||
3aa554c52b | |||
4322f4c31d | |||
33f8df3afe | |||
42a83b56c3 | |||
0f39df0e0b | |||
a17588199f | |||
fad835c029 | |||
568e9537ec | |||
58bb0509f7 | |||
0ad2682210 | |||
f97e52ea0b | |||
4c90523121 | |||
519d3ee2d6 | |||
3abb35e506 | |||
c6e36fd70e | |||
ccc7b0ec65 | |||
4d1d3a165c | |||
e54cf24248 | |||
7103969bba | |||
3bb40a8fff | |||
f4dcc9e786 | |||
9fd29b264e | |||
478c761750 | |||
dbd6feed4e | |||
480c9f11b8 | |||
ed8fa0a2a5 | |||
3af05e7960 | |||
07b6942690 | |||
7d8a5213dd | |||
241589fdb0 | |||
eb09e0a633 | |||
4e2c90e399 | |||
1097f44feb | |||
e5423b5e08 | |||
4ba5b6da1d | |||
c1a7844f4a | |||
781a4d8d78 | |||
3ba29583fc | |||
7760631751 | |||
05d6d557b8 | |||
9925a320f5 | |||
dca5d84d29 | |||
0b470f8e01 | |||
7e58f4341e | |||
d8933afb50 | |||
4bb45fc220 | |||
09f913cba4 | |||
006d730185 | |||
cf558d8f62 | |||
a65d546f3b | |||
bf02c9fe5f | |||
6908b9f29b | |||
cd06dbc915 | |||
977dfa807f | |||
8b7e8ec635 | |||
c14e1d7add | |||
7377366372 | |||
9c9841663a | |||
612e96201c | |||
d7aa4a0e1f | |||
8b7414770f | |||
a26ede4dae | |||
7591770c40 | |||
7623698a00 | |||
f518c47e09 | |||
c23086259d | |||
765a021ecd | |||
7e21107120 | |||
322e186c4b | |||
59b8776814 | |||
5bb7069c7f | |||
1a2c15684e | |||
b02565532f | |||
7d7414ebb9 | |||
55d6217c32 |
@ -11,12 +11,12 @@ assignees: ''
|
||||
|
||||
<!--- ##### DO NOT REMOVE THIS TEMPLATE! YOUR ISSUE *WILL* FIT IN IT! ##### -->
|
||||
|
||||
# NOTICE:
|
||||
<!--- # NOTICE:
|
||||
```diff
|
||||
! PlotSquared for Minecraft Java Edition versions between 1.7 through to 1.12.2 are considered
|
||||
! legacy, and will receive limited to no support. Please consider upgrading to 1.13+ for
|
||||
! future support. Plugins exist for 1.13+ which bring back behaviors found in 1.8.8
|
||||
! All versions of PlotSquared for Sponge and Nukkit(X) will recieve limited to no support
|
||||
! All versions of PlotSquared for Sponge and Nukkit(X) will receive limited to no support
|
||||
! due to lack of developer interest and time. Additionally, NukkitX has not had feature
|
||||
! updates since the Better Together, which prevents some PlotSquared features from ever
|
||||
! functioning. Contributions are always welcome however!
|
||||
@ -27,40 +27,44 @@ assignees: ''
|
||||
**Code contributions are to be done through [PRs](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request), tagging the specific issue ticket(s) if applicable.**
|
||||
|
||||
**[DISCORD INVITE LINK](https://discord.gg/cSMxtGn)** and please, for the love of the little sanity we have left, use the correct channels!
|
||||
-->
|
||||
|
||||
# BUG REPORT TEMPLATE:
|
||||
# Bug Report Template:
|
||||
<!--- Incomplete reports will most likely be marked as invalid, and closed, with few exceptions.-->
|
||||
## Required Information section:
|
||||
> ALL FIELDS IN THIS SECTION ARE REQUIRED, and must contain appropriate information
|
||||
### Server config info (Debug/file paste links):
|
||||
### Server config info (/plot debugpaste / file paste links):
|
||||
<!--- Issue /plot debugpaste in game or in your console and copy the supplied URL here -->
|
||||
<!--- If you cannot perform the above, we require logs/latest.log; settings.yml; worlds.yml and possibly PlotSquared.use_THIS.yml -->
|
||||
<!--- If you are unwilling to supply the information we need, we reserve the right to not assist you. Redact IP addresses if you need to. -->
|
||||
|
||||
|
||||
### Server type:
|
||||
**select one**
|
||||
**Select one**
|
||||
<!-- Select the type you are reporting the issue for (put an "X" between of brackets): -->
|
||||
- [ ] Spigot / Paper *(CraftBukkit should not be used, re-test with Spigot first!)*
|
||||
- [ ] Sponge *- NOTE: NOT ACTIVELY MAINTAINED*
|
||||
- [ ] NukkitX *- NOTE: NOT ACTIVELY MAINTAINED*
|
||||
- [] Spigot / Paper *(CraftBukkit should not be used, re-test with Spigot first!)*
|
||||
- [] Sponge *- NOTE: NOT ACTIVELY MAINTAINED*
|
||||
- [] NukkitX *- NOTE: NOT ACTIVELY MAINTAINED*
|
||||
|
||||
### Minecraft Version:
|
||||
**select one**
|
||||
<!-- Select the type you are reporting the issue for (put an "X" between of brackets): -->
|
||||
- [ ] Minecraft 1.14.4 ***This is the ONLY actively maintained target for PlotSquared***
|
||||
- [ ] Minecraft 1.13.2
|
||||
- [ ] Minecraft Java Edition *other versions, please specify*:
|
||||
- [ ] Minecraft Bedrock Edition *speicify version*:
|
||||
**Select one**
|
||||
<!-- Select the type you are reporting the issue for (put an "X" between of brackets):
|
||||
The maintained versions are 1.14.4 and 1.15.x -->
|
||||
- [] Minecraft 1.15
|
||||
- [] Minecraft 1.14.4
|
||||
- [] Minecraft 1.13.2
|
||||
- [] Minecraft Java Edition *other versions, please specify*:
|
||||
- [] Minecraft Bedrock Edition *specify version*:
|
||||
|
||||
### Server build info:
|
||||
<!--- Run /version in-game or in console & paste the full output here: -->
|
||||
``` paste here, between the tick marks, replacing this text ```
|
||||
```
|
||||
Paste the output here, between the tick marks, replacing this text
|
||||
```
|
||||
|
||||
### WorldEdit/FAWE versions:
|
||||
<!--- Specify which plugin you are using, and add its version -->
|
||||
- [ ] FAWE *version*:
|
||||
- [ ] WorldEdit *version*:
|
||||
- [] FAWE *version*:
|
||||
- [] WorldEdit *version*:
|
||||
|
||||
### Description of the problem:
|
||||
<!--- Be as specific as possible. Don't lie, redact information, or use false names/situations. -->
|
||||
@ -76,15 +80,19 @@ assignees: ''
|
||||
<!--- Optional but recommended - issue "/plugins" in-game or in console and copy/paste the list -->
|
||||
|
||||
### Relevant console output, log lines, and/or screenshots:
|
||||
<!--- Please use in-line code insertion ( ```like this``` ) for short (20 lines or less) text blobs, or a paste service for large blobs -->
|
||||
<!--- Please use in-line code insertion
|
||||
```
|
||||
like this
|
||||
```
|
||||
for short (20 lines or less) text blobs, or a paste service for large blobs -->
|
||||
|
||||
### Additional relevant comments/remarks:
|
||||
<!--- Use this space to give us any additional information which may be relevant to this issue, such as: if you are using a Minecraft hosting provider; unusual installation environment; etc -->
|
||||
|
||||
# AFFIRMATION OF COMPLETION:
|
||||
<!-- Make sure you have completed the following steps (put an "X" between of brackets): -->
|
||||
- [ ] I included all information required in the sections above
|
||||
- [ ] I made sure there are no duplicates of this report [(Use Search)](https://github.com/IntellectualSites/PlotSquared/issues?utf8=%E2%9C%93&q=is%3Aissue)
|
||||
- [ ] I made sure I am using an up-to-date version of PlotSquared
|
||||
- [ ] I made sure the bug/error is not caused by any other plugin
|
||||
- [] I included all information required in the sections above
|
||||
- [] I made sure there are no duplicates of this report [(Use Search)](https://github.com/IntellectualSites/PlotSquared/issues?utf8=%E2%9C%93&q=is%3Aissue)
|
||||
- [] I made sure I am using an up-to-date version of PlotSquared
|
||||
- [] I made sure the bug/error is not caused by any other plugin
|
||||
- [x] I didn't read but checked everything above.
|
||||
|
5
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
5
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: PlotSquared Suggestions
|
||||
url: https://github.com/IntellectualSites/PlotSquaredSuggestions
|
||||
about: If you want to submit feature or suggestion ideas, do that here
|
10
.github/workflows/gradle.yml
vendored
10
.github/workflows/gradle.yml
vendored
@ -3,12 +3,14 @@ name: Java CI
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- breaking
|
||||
- master
|
||||
- v4
|
||||
- v5
|
||||
- leagcy/1.8-1.12
|
||||
pull_request:
|
||||
branches:
|
||||
- breaking
|
||||
- master
|
||||
- v4
|
||||
- v5
|
||||
- leagcy/1.8-1.12
|
||||
|
||||
jobs:
|
||||
test:
|
||||
|
@ -19,8 +19,8 @@ dependencies {
|
||||
compile(project(":Core"))
|
||||
compile("com.destroystokyo.paper:paper-api:1.14.4-R0.1-SNAPSHOT")
|
||||
//implementation 'com.onarandombox.multiversecore:Multiverse-Core:3.0.0-SNAPSHOT'
|
||||
implementation("org.spigotmc:spigot-api:1.14.4-R0.1-SNAPSHOT")
|
||||
compile(group: "com.sk89q.worldedit", name: "worldedit-bukkit", version: "7.0.0")
|
||||
implementation("org.spigotmc:spigot-api:1.15.2-R0.1-SNAPSHOT")
|
||||
compile(group: "com.sk89q.worldedit", name: "worldedit-bukkit", version: "7.0.1")
|
||||
compile("io.papermc:paperlib:1.0.2")
|
||||
compile(group: "com.squareup.retrofit2", name: "retrofit", version: "2.4.0")
|
||||
implementation("net.kyori:text-adapter-bukkit:3.0.3")
|
||||
@ -82,15 +82,14 @@ shadowJar {
|
||||
// update notification stuff
|
||||
include(dependency("com.github.Sauilitired:Jenkins4J:2.0-SNAPSHOT"))
|
||||
include(dependency("com.squareup.retrofit2:retrofit:2.4.0"))
|
||||
include(dependency("com.squareup.okhttp3:okhttp:3.12.0"))
|
||||
include(dependency("com.squareup.okio:okio:2.2.2"))
|
||||
include(dependency("org.jetbrains.kotlin:kotlin-stdlib:1.3.50"))
|
||||
include(dependency("com.squareup.okhttp3:okhttp:4.2.2"))
|
||||
include(dependency("com.squareup.okio:okio:2.4.1"))
|
||||
include(dependency("org.jetbrains.kotlin:kotlin-stdlib:1.3.61"))
|
||||
include(dependency("io.papermc:paperlib:1.0.2"))
|
||||
include(dependency("net.kyori:text-adapter-bukkit:3.0.3"))
|
||||
}
|
||||
relocate('net.kyori.text', 'com.github.intellectualsites.plotsquared.formatting.text')
|
||||
relocate("io.papermc.lib", "com.github.intellectualsites.plotsquared.bukkit.paperlib")
|
||||
// relocate('org.mcstats', 'com.plotsquared.stats')
|
||||
archiveFileName = "${parent.name}-${project.name}-${parent.version}.jar"
|
||||
destinationDirectory = file "../target"
|
||||
}
|
||||
|
@ -92,10 +92,12 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.AbstractMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.getRefClass;
|
||||
@ -117,6 +119,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
private Method methodUnloadChunk0;
|
||||
private boolean methodUnloadSetup = false;
|
||||
private boolean metricsStarted;
|
||||
private static final int BSTATS_ID = 1404;
|
||||
|
||||
@Override public int[] getServerVersion() {
|
||||
if (this.version == null) {
|
||||
@ -169,7 +172,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
getLogger().info("-------- PlotSquared Update Check --------");
|
||||
if (throwable != null) {
|
||||
getLogger().severe(String
|
||||
.format("Could not check for update. Reason: %s",
|
||||
.format("Could not check for updates. Reason: %s",
|
||||
throwable.getMessage()));
|
||||
} else {
|
||||
if (updateDescription == null) {
|
||||
@ -178,8 +181,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
} else {
|
||||
getLogger()
|
||||
.info("There appears to be a PlotSquared update available!");
|
||||
getLogger().info(String.format("You are running version %s,"
|
||||
+ " the newest available version is %s",
|
||||
getLogger().info(String.format(
|
||||
"You are running version %s, the newest available version is %s",
|
||||
getPluginVersionString(), updateDescription.getVersion()));
|
||||
getLogger().info(
|
||||
String.format("Update URL: %s", updateDescription.getUrl()));
|
||||
@ -538,6 +541,14 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
case PUFFERFISH:
|
||||
case PHANTOM:
|
||||
case ILLUSIONER:
|
||||
case CAT:
|
||||
case PANDA:
|
||||
case FOX:
|
||||
case PILLAGER:
|
||||
case TRADER_LLAMA:
|
||||
case WANDERING_TRADER:
|
||||
case RAVAGER:
|
||||
//case BEE:
|
||||
default: {
|
||||
if (Settings.Enabled_Components.KILL_ROAD_MOBS) {
|
||||
Location location = entity.getLocation();
|
||||
@ -672,12 +683,14 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
return new BukkitSetupUtils();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
// Metrics are controlled via bstats config
|
||||
@Override public void startMetrics() {
|
||||
if (this.metricsStarted) {
|
||||
return;
|
||||
}
|
||||
this.metricsStarted = true;
|
||||
Metrics metrics = new Metrics(this);// bstats
|
||||
Metrics metrics = new Metrics(this, BSTATS_ID);// bstats
|
||||
PlotSquared.log(Captions.PREFIX + "&6Metrics enabled.");
|
||||
}
|
||||
|
||||
@ -818,11 +831,11 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
return new BukkitPlotGenerator(generator);
|
||||
}
|
||||
|
||||
@Override public List<String> getPluginIds() {
|
||||
final List<String> names = new ArrayList<>();
|
||||
@Override public List<Map.Entry<Map.Entry<String, String>, Boolean>> getPluginIds() {
|
||||
List<Map.Entry<Map.Entry<String, String>, Boolean>> names = new ArrayList<>();
|
||||
for (final Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
|
||||
names.add(plugin.getName() + ';' + plugin.getDescription().getVersion() + ':' + plugin
|
||||
.isEnabled());
|
||||
Map.Entry<String, String> id = new AbstractMap.SimpleEntry<>(plugin.getName(), plugin.getDescription().getVersion());
|
||||
names.add(new AbstractMap.SimpleEntry<>(id, plugin.isEnabled()));
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
@ -73,7 +73,9 @@ public class BukkitPlotGenerator extends ChunkGenerator
|
||||
return this.platformGenerator;
|
||||
}
|
||||
|
||||
@Override @NotNull public List<BlockPopulator> getDefaultPopulators(@NotNull World world) {
|
||||
@Override
|
||||
@NotNull
|
||||
public List<BlockPopulator> getDefaultPopulators(@NotNull World world) {
|
||||
try {
|
||||
if (!this.loaded) {
|
||||
String name = world.getName();
|
||||
@ -117,7 +119,8 @@ public class BukkitPlotGenerator extends ChunkGenerator
|
||||
return toAdd;
|
||||
}
|
||||
|
||||
@Override @NotNull
|
||||
@Override
|
||||
@NotNull
|
||||
public ChunkData generateChunkData(@NotNull World world, @NotNull Random random, int x, int z,
|
||||
@NotNull BiomeGrid biome) {
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.github.intellectualsites.plotsquared.bukkit.listeners;
|
||||
|
||||
import com.destroystokyo.paper.MaterialTags;
|
||||
import com.github.intellectualsites.plotsquared.bukkit.BukkitMain;
|
||||
import com.github.intellectualsites.plotsquared.bukkit.object.BukkitBlockUtil;
|
||||
import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer;
|
||||
@ -29,13 +30,14 @@ import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.UpdateUtility;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.item.ItemType;
|
||||
import io.papermc.lib.PaperLib;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.FluidCollisionMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Tag;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
@ -638,7 +640,7 @@ import java.util.regex.Pattern;
|
||||
Optional<List<String>> flag = plot.getFlag(Flags.BLOCKED_CMDS);
|
||||
if (flag.isPresent() && !Permissions
|
||||
.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_INTERACT_BLOCKED_CMDS)) {
|
||||
List<String> blocked_cmds = flag.get();
|
||||
List<String> blockedCommands = flag.get();
|
||||
String part = parts[0];
|
||||
if (parts[0].contains(":")) {
|
||||
part = parts[0].split(":")[1];
|
||||
@ -672,7 +674,7 @@ import java.util.regex.Pattern;
|
||||
if (!s1.equals(part)) {
|
||||
msg = msg.replace(s1, part);
|
||||
}
|
||||
for (String s : blocked_cmds) {
|
||||
for (String s : blockedCommands) {
|
||||
Pattern pattern;
|
||||
if (!RegExUtil.compiledPatterns.containsKey(s)) {
|
||||
RegExUtil.compiledPatterns.put(s, pattern = Pattern.compile(s));
|
||||
@ -743,8 +745,8 @@ import java.util.regex.Pattern;
|
||||
.text(" --------").color("$2").send(pp);
|
||||
new PlotMessage("There appears to be a PlotSquared update available!")
|
||||
.color("$1").send(pp);
|
||||
new PlotMessage(String.format("You are running version %s,"
|
||||
+ " the newest available version is %s",
|
||||
new PlotMessage(String.format(
|
||||
"You are running version %s, the newest available version is %s",
|
||||
bukkitMain.getPluginVersionString(),
|
||||
updateDescription.getVersion())).color("$1").send(pp);
|
||||
new PlotMessage("Update URL").color("$1").text(": ").color("$2")
|
||||
@ -772,6 +774,7 @@ import java.util.regex.Pattern;
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
Plot lastPlot = pp.getMeta(PlotPlayer.META_LAST_PLOT);
|
||||
org.bukkit.Location to = event.getTo();
|
||||
//noinspection ConstantConditions
|
||||
if (to != null) {
|
||||
Location location = BukkitUtil.getLocation(to);
|
||||
PlotArea area = location.getPlotArea();
|
||||
@ -838,17 +841,10 @@ import java.util.regex.Pattern;
|
||||
dest = null;
|
||||
}
|
||||
if (dest != null) {
|
||||
if (passengers != null) {
|
||||
vehicle.eject();
|
||||
vehicle.setVelocity(new Vector(0d, 0d, 0d));
|
||||
PaperLib.teleportAsync(vehicle, dest);
|
||||
passengers.forEach(vehicle::addPassenger);
|
||||
} else {
|
||||
vehicle.eject();
|
||||
vehicle.setVelocity(new Vector(0d, 0d, 0d));
|
||||
PaperLib.teleportAsync(vehicle, dest);
|
||||
vehicle.addPassenger(player);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1023,6 +1019,9 @@ import java.util.regex.Pattern;
|
||||
if (plot == null) {
|
||||
return;
|
||||
}
|
||||
if (plot.isDenied(plotPlayer.getUUID())) {
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
String message = event.getMessage();
|
||||
String format = Captions.PLOT_CHAT_FORMAT.getTranslated();
|
||||
@ -1089,13 +1088,10 @@ import java.util.regex.Pattern;
|
||||
.replace("{limit}", String.valueOf(area.MAX_BUILD_HEIGHT)));
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
if (Permissions
|
||||
.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_DESTROY_UNOWNED)) {
|
||||
return;
|
||||
}
|
||||
MainUtil.sendMessage(plotPlayer, Captions.NO_PERMISSION_EVENT,
|
||||
Captions.PERMISSION_ADMIN_DESTROY_UNOWNED);
|
||||
if (!Permissions
|
||||
.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_DESTROY_UNOWNED, true)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!plot.isAdded(plotPlayer.getUUID())) {
|
||||
@ -1344,12 +1340,6 @@ import java.util.regex.Pattern;
|
||||
if (Flags.ICE_FORM.isFalse(plot)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
return;
|
||||
case STONE:
|
||||
case OBSIDIAN:
|
||||
case COBBLESTONE:
|
||||
// TODO event ?
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1357,12 +1347,6 @@ import java.util.regex.Pattern;
|
||||
public void onBlockDamage(BlockDamageEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
Location location = BukkitUtil.getLocation(event.getBlock().getLocation());
|
||||
if (player == null) {
|
||||
if (location.isPlotRoad()) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
PlotArea area = location.getPlotArea();
|
||||
if (area == null) {
|
||||
return;
|
||||
@ -1387,7 +1371,7 @@ import java.util.regex.Pattern;
|
||||
Optional<Set<BlockType>> destroy = plot.getFlag(Flags.BREAK);
|
||||
Block block = event.getBlock();
|
||||
if (destroy.isPresent() && destroy.get()
|
||||
.contains(BukkitBlockUtil.get(block)) || Permissions
|
||||
.contains(BukkitAdapter.asBlockType(block.getType())) || Permissions
|
||||
.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_DESTROY_OTHER)) {
|
||||
return;
|
||||
}
|
||||
@ -1501,8 +1485,7 @@ import java.util.regex.Pattern;
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
List<Block> blocks = event.getBlocks();
|
||||
for (Block block1 : blocks) {
|
||||
for (Block block1 : event.getBlocks()) {
|
||||
Location bloc = BukkitUtil.getLocation(block1.getLocation());
|
||||
if (!area.contains(bloc.getX(), bloc.getZ()) || !area
|
||||
.contains(bloc.getX() + relative.getBlockX(), bloc.getZ() + relative.getBlockZ())) {
|
||||
@ -1660,11 +1643,11 @@ import java.util.regex.Pattern;
|
||||
location = BukkitUtil.getLocation(blocks.get(i).getLocation());
|
||||
Plot plot = area.getOwnedPlot(location);
|
||||
/*
|
||||
* plot -> the base plot of the merged area
|
||||
* origin -> the plot where the event gets called
|
||||
* plot → the base plot of the merged area
|
||||
* origin → the plot where the event gets called
|
||||
*/
|
||||
|
||||
// Are plot and origin not the same AND are both plots merged
|
||||
// Are plot and origin different AND are both plots merged
|
||||
if (!Objects.equals(plot, origin) && (!plot.isMerged() && !origin.isMerged())) {
|
||||
event.getBlocks().remove(i);
|
||||
}
|
||||
@ -1734,9 +1717,6 @@ import java.util.regex.Pattern;
|
||||
}
|
||||
Block block = player.getTargetBlock(null, 7);
|
||||
org.bukkit.block.BlockState state = block.getState();
|
||||
if (state == null) {
|
||||
return;
|
||||
}
|
||||
Material stateType = state.getType();
|
||||
Material itemType = newItem.getType();
|
||||
if (stateType != itemType) {
|
||||
@ -1895,7 +1875,7 @@ import java.util.regex.Pattern;
|
||||
return;
|
||||
}
|
||||
if (event.getAction() == Action.RIGHT_CLICK_AIR) {
|
||||
Material item = event.getItem().getType();
|
||||
Material item = event.getMaterial();
|
||||
if (item.toString().toLowerCase().endsWith("egg")) {
|
||||
event.setCancelled(true);
|
||||
event.setUseItemInHand(Event.Result.DENY);
|
||||
@ -1903,8 +1883,8 @@ import java.util.regex.Pattern;
|
||||
}
|
||||
ItemStack hand = player.getInventory().getItemInMainHand();
|
||||
ItemStack offHand = player.getInventory().getItemInOffHand();
|
||||
Material type = (hand == null) ? Material.AIR : hand.getType();
|
||||
Material offType = (offHand == null) ? Material.AIR : offHand.getType();
|
||||
Material type = hand.getType();
|
||||
Material offType = offHand.getType();
|
||||
if (type == Material.AIR) {
|
||||
type = offType;
|
||||
}
|
||||
@ -1912,10 +1892,8 @@ import java.util.regex.Pattern;
|
||||
Block block = player.getTargetBlockExact(5, FluidCollisionMode.SOURCE_ONLY);
|
||||
if (block != null && block.getType() != Material.AIR) {
|
||||
Location location = BukkitUtil.getLocation(block.getLocation());
|
||||
Material finalType = type;
|
||||
if (!EventUtil.manager
|
||||
.checkPlayerBlockEvent(pp, PlayerBlockEventType.SPAWN_MOB, location, () -> BukkitAdapter.asBlockType(
|
||||
finalType).getDefaultState(), true)) {
|
||||
.checkPlayerBlockEvent(pp, PlayerBlockEventType.SPAWN_MOB, location, null, true)) {
|
||||
event.setCancelled(true);
|
||||
event.setUseItemInHand(Event.Result.DENY);
|
||||
}
|
||||
@ -1933,259 +1911,70 @@ import java.util.regex.Pattern;
|
||||
return;
|
||||
}
|
||||
PlayerBlockEventType eventType = null;
|
||||
Supplier<BlockState> lb;
|
||||
Location location;
|
||||
BlockType blocktype1;
|
||||
Block block = event.getClickedBlock();
|
||||
Location location = BukkitUtil.getLocation(block.getLocation());
|
||||
Action action = event.getAction();
|
||||
switch (action) {
|
||||
outer: switch (action) {
|
||||
case PHYSICAL: {
|
||||
eventType = PlayerBlockEventType.TRIGGER_PHYSICAL;
|
||||
Block block = event.getClickedBlock();
|
||||
lb = BukkitBlockUtil.supply(block);
|
||||
location = BukkitUtil.getLocation(block.getLocation());
|
||||
blocktype1 = BukkitAdapter.asBlockType(block.getType());
|
||||
break;
|
||||
}
|
||||
//todo rearrange the right click code. it is all over the place.
|
||||
case RIGHT_CLICK_BLOCK: {
|
||||
Block block = event.getClickedBlock();
|
||||
location = BukkitUtil.getLocation(block.getLocation());
|
||||
Material blockType = block.getType();
|
||||
switch (blockType) {
|
||||
case ACACIA_DOOR:
|
||||
case BIRCH_DOOR:
|
||||
case DARK_OAK_DOOR:
|
||||
case IRON_DOOR:
|
||||
case JUNGLE_DOOR:
|
||||
case OAK_DOOR:
|
||||
case SPRUCE_DOOR:
|
||||
|
||||
case ACACIA_TRAPDOOR:
|
||||
case BIRCH_TRAPDOOR:
|
||||
case DARK_OAK_TRAPDOOR:
|
||||
case IRON_TRAPDOOR:
|
||||
case JUNGLE_TRAPDOOR:
|
||||
case OAK_TRAPDOOR:
|
||||
case SPRUCE_TRAPDOOR:
|
||||
|
||||
case CHEST:
|
||||
case ENDER_CHEST:
|
||||
case TRAPPED_CHEST:
|
||||
|
||||
case ACACIA_FENCE_GATE:
|
||||
case BIRCH_FENCE_GATE:
|
||||
case DARK_OAK_FENCE_GATE:
|
||||
case OAK_FENCE_GATE:
|
||||
case JUNGLE_FENCE_GATE:
|
||||
case SPRUCE_FENCE_GATE:
|
||||
|
||||
case ACACIA_BUTTON:
|
||||
case BIRCH_BUTTON:
|
||||
case DARK_OAK_BUTTON:
|
||||
case JUNGLE_BUTTON:
|
||||
case OAK_BUTTON:
|
||||
case SPRUCE_BUTTON:
|
||||
case STONE_BUTTON:
|
||||
|
||||
case BLACK_BED:
|
||||
case BLUE_BED:
|
||||
case BROWN_BED:
|
||||
case CYAN_BED:
|
||||
case GRAY_BED:
|
||||
case GREEN_BED:
|
||||
case LIGHT_BLUE_BED:
|
||||
case LIGHT_GRAY_BED:
|
||||
case LIME_BED:
|
||||
case MAGENTA_BED:
|
||||
case ORANGE_BED:
|
||||
case PINK_BED:
|
||||
case PURPLE_BED:
|
||||
case RED_BED:
|
||||
case WHITE_BED:
|
||||
case YELLOW_BED:
|
||||
|
||||
case BLACK_BANNER:
|
||||
case BLACK_WALL_BANNER:
|
||||
case BLUE_BANNER:
|
||||
case BLUE_WALL_BANNER:
|
||||
case BROWN_BANNER:
|
||||
case BROWN_WALL_BANNER:
|
||||
case CYAN_BANNER:
|
||||
case CYAN_WALL_BANNER:
|
||||
case GRAY_BANNER:
|
||||
case GRAY_WALL_BANNER:
|
||||
case GREEN_BANNER:
|
||||
case GREEN_WALL_BANNER:
|
||||
case LIGHT_BLUE_BANNER:
|
||||
case LIGHT_BLUE_WALL_BANNER:
|
||||
case LIGHT_GRAY_BANNER:
|
||||
case LIGHT_GRAY_WALL_BANNER:
|
||||
case LIME_BANNER:
|
||||
case LIME_WALL_BANNER:
|
||||
case MAGENTA_BANNER:
|
||||
case MAGENTA_WALL_BANNER:
|
||||
case ORANGE_BANNER:
|
||||
case ORANGE_WALL_BANNER:
|
||||
case PINK_BANNER:
|
||||
case PINK_WALL_BANNER:
|
||||
case PURPLE_BANNER:
|
||||
case PURPLE_WALL_BANNER:
|
||||
case RED_BANNER:
|
||||
case RED_WALL_BANNER:
|
||||
case WHITE_BANNER:
|
||||
case WHITE_WALL_BANNER:
|
||||
case YELLOW_BANNER:
|
||||
case YELLOW_WALL_BANNER:
|
||||
|
||||
case BLACK_SHULKER_BOX:
|
||||
case BLUE_SHULKER_BOX:
|
||||
case BROWN_SHULKER_BOX:
|
||||
case CYAN_SHULKER_BOX:
|
||||
case GRAY_SHULKER_BOX:
|
||||
case GREEN_SHULKER_BOX:
|
||||
case LIGHT_BLUE_SHULKER_BOX:
|
||||
case LIGHT_GRAY_SHULKER_BOX:
|
||||
case LIME_SHULKER_BOX:
|
||||
case MAGENTA_SHULKER_BOX:
|
||||
case ORANGE_SHULKER_BOX:
|
||||
case PINK_SHULKER_BOX:
|
||||
case PURPLE_SHULKER_BOX:
|
||||
case RED_SHULKER_BOX:
|
||||
case WHITE_SHULKER_BOX:
|
||||
case YELLOW_SHULKER_BOX:
|
||||
|
||||
case CHAIN_COMMAND_BLOCK:
|
||||
case REPEATING_COMMAND_BLOCK:
|
||||
|
||||
case LEGACY_SIGN:
|
||||
case LEGACY_WALL_SIGN:
|
||||
case OAK_SIGN:
|
||||
case ACACIA_SIGN:
|
||||
case ACACIA_WALL_SIGN:
|
||||
case BIRCH_SIGN:
|
||||
case BIRCH_WALL_SIGN:
|
||||
case DARK_OAK_SIGN:
|
||||
case DARK_OAK_WALL_SIGN:
|
||||
case JUNGLE_SIGN:
|
||||
case JUNGLE_WALL_SIGN:
|
||||
case OAK_WALL_SIGN:
|
||||
case SPRUCE_SIGN:
|
||||
case SPRUCE_WALL_SIGN:
|
||||
|
||||
case REDSTONE_TORCH:
|
||||
case REDSTONE_WALL_TORCH:
|
||||
|
||||
case TURTLE_EGG:
|
||||
case TURTLE_HELMET:
|
||||
case TURTLE_SPAWN_EGG:
|
||||
|
||||
case ANVIL:
|
||||
case BEACON:
|
||||
case BREWING_STAND:
|
||||
case CAKE:
|
||||
case COMMAND_BLOCK:
|
||||
case COMPARATOR:
|
||||
case CRAFTING_TABLE:
|
||||
//todo re-evaluate adding lectern here
|
||||
case LECTERN:
|
||||
case GRINDSTONE:
|
||||
case LOOM:
|
||||
case SMOKER:
|
||||
case STONECUTTER:
|
||||
case DISPENSER:
|
||||
case DROPPER:
|
||||
case ENCHANTING_TABLE:
|
||||
case FURNACE:
|
||||
case BLAST_FURNACE:
|
||||
case HOPPER:
|
||||
case JUKEBOX:
|
||||
case LEVER:
|
||||
case NOTE_BLOCK:
|
||||
case REDSTONE_ORE:
|
||||
eventType = PlayerBlockEventType.INTERACT_BLOCK;
|
||||
break;
|
||||
case DRAGON_EGG:
|
||||
eventType = PlayerBlockEventType.TELEPORT_OBJECT;
|
||||
break;
|
||||
default:
|
||||
blocktype1 = BukkitAdapter.asBlockType(block.getType());
|
||||
|
||||
if (blockType.isInteractable()) {
|
||||
eventType = PlayerBlockEventType.INTERACT_BLOCK;
|
||||
}
|
||||
}
|
||||
lb = BukkitBlockUtil.supply(block);
|
||||
if (eventType != null && (eventType != PlayerBlockEventType.INTERACT_BLOCK
|
||||
|| !player.isSneaking())) {
|
||||
if (!player.isSneaking()) {
|
||||
break;
|
||||
}
|
||||
ItemStack hand = player.getInventory().getItemInMainHand();
|
||||
ItemStack offHand = player.getInventory().getItemInOffHand();
|
||||
Material type = (hand == null) ? Material.AIR : hand.getType();
|
||||
Material offType = (offHand == null) ? Material.AIR : offHand.getType();
|
||||
if ((type == Material.AIR && offType != Material.AIR && !player.isSneaking()
|
||||
&& blockType.isInteractable()) || (type == Material.AIR
|
||||
&& offType == Material.AIR)) {
|
||||
eventType = PlayerBlockEventType.INTERACT_BLOCK;
|
||||
|
||||
// sneaking players interact with blocks if both hands are empty
|
||||
if (hand.getType() == Material.AIR && offHand.getType() == Material.AIR) {
|
||||
break;
|
||||
}
|
||||
if (type == Material.AIR) {
|
||||
type = offType;
|
||||
}
|
||||
|
||||
Material type = event.getMaterial();
|
||||
|
||||
// in the following, lb needs to have the material of the item in hand i.e. type
|
||||
lb = BukkitBlockUtil.supply(type);
|
||||
switch (type) {
|
||||
case REDSTONE:
|
||||
case STRING:
|
||||
case PUMPKIN_SEEDS:
|
||||
case MELON_SEEDS:
|
||||
case COCOA_BEANS:
|
||||
case WHEAT_SEEDS:
|
||||
case BEETROOT_SEEDS:
|
||||
case SWEET_BERRIES:
|
||||
return;
|
||||
default:
|
||||
//eventType = PlayerBlockEventType.PLACE_BLOCK;
|
||||
if (type.isBlock()) {
|
||||
location = BukkitUtil
|
||||
.getLocation(block.getRelative(event.getBlockFace()).getLocation());
|
||||
eventType = PlayerBlockEventType.PLACE_BLOCK;
|
||||
break;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (PaperLib.isPaper()) {
|
||||
if (MaterialTags.SPAWN_EGGS.isTagged(type) || Material.EGG.equals(type)) {
|
||||
eventType = PlayerBlockEventType.SPAWN_MOB;
|
||||
break outer;
|
||||
}
|
||||
} else {
|
||||
if (type.toString().toLowerCase().endsWith("egg")) {
|
||||
eventType = PlayerBlockEventType.SPAWN_MOB;
|
||||
} else {
|
||||
break outer;
|
||||
}
|
||||
}
|
||||
if (type.isEdible()) {
|
||||
//Allow all players to eat while also allowing the block place event ot be fired
|
||||
return;
|
||||
}
|
||||
switch (type) {
|
||||
case FIREWORK_ROCKET:
|
||||
case FIREWORK_STAR:
|
||||
eventType = PlayerBlockEventType.SPAWN_MOB;
|
||||
break;
|
||||
case ARMOR_STAND:
|
||||
location = BukkitUtil
|
||||
.getLocation(block.getRelative(event.getBlockFace()).getLocation());
|
||||
eventType = PlayerBlockEventType.PLACE_MISC;
|
||||
break;
|
||||
case BOOK:
|
||||
case ENCHANTED_BOOK:
|
||||
case KNOWLEDGE_BOOK:
|
||||
case WRITABLE_BOOK:
|
||||
case WRITTEN_BOOK:
|
||||
eventType = PlayerBlockEventType.READ;
|
||||
break;
|
||||
case APPLE:
|
||||
case BAKED_POTATO:
|
||||
case BEEF:
|
||||
case BREAD:
|
||||
case CARROT:
|
||||
case CHICKEN:
|
||||
case COD:
|
||||
case COOKED_BEEF:
|
||||
case COOKED_CHICKEN:
|
||||
case COOKED_COD:
|
||||
case COOKED_MUTTON:
|
||||
case COOKED_PORKCHOP:
|
||||
case COOKED_RABBIT:
|
||||
case COOKED_SALMON:
|
||||
case COOKIE:
|
||||
case GOLDEN_CARROT:
|
||||
case MUSHROOM_STEW:
|
||||
case MUTTON:
|
||||
case POISONOUS_POTATO:
|
||||
case PORKCHOP:
|
||||
case POTATO:
|
||||
case POTION:
|
||||
case PUFFERFISH:
|
||||
case PUMPKIN_PIE:
|
||||
case RABBIT:
|
||||
case RABBIT_FOOT:
|
||||
case RABBIT_STEW:
|
||||
case SALMON:
|
||||
case TROPICAL_FISH:
|
||||
eventType = PlayerBlockEventType.EAT;
|
||||
break;
|
||||
case ACACIA_BOAT:
|
||||
case BIRCH_BOAT:
|
||||
case CHEST_MINECART:
|
||||
@ -2199,31 +1988,47 @@ import java.util.regex.Pattern;
|
||||
case SPRUCE_BOAT:
|
||||
case TNT_MINECART:
|
||||
eventType = PlayerBlockEventType.PLACE_VEHICLE;
|
||||
break;
|
||||
default:
|
||||
eventType = PlayerBlockEventType.INTERACT_BLOCK;
|
||||
break;
|
||||
}
|
||||
break outer;
|
||||
case FIREWORK_ROCKET:
|
||||
case FIREWORK_STAR:
|
||||
eventType = PlayerBlockEventType.SPAWN_MOB;
|
||||
break outer;
|
||||
case BOOK:
|
||||
case KNOWLEDGE_BOOK:
|
||||
case WRITABLE_BOOK:
|
||||
case WRITTEN_BOOK:
|
||||
eventType = PlayerBlockEventType.READ;
|
||||
break outer;
|
||||
case ARMOR_STAND:
|
||||
location = BukkitUtil
|
||||
.getLocation(block.getRelative(event.getBlockFace()).getLocation());
|
||||
eventType = PlayerBlockEventType.PLACE_MISC;
|
||||
break outer;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LEFT_CLICK_BLOCK:
|
||||
Block block = event.getClickedBlock();
|
||||
case LEFT_CLICK_BLOCK: {
|
||||
location = BukkitUtil.getLocation(block.getLocation());
|
||||
eventType = PlayerBlockEventType.BREAK_BLOCK;
|
||||
lb = BukkitBlockUtil.supply(block);
|
||||
//eventType = PlayerBlockEventType.BREAK_BLOCK;
|
||||
blocktype1 = BukkitAdapter.asBlockType(block.getType());
|
||||
if (block.getType() == Material.DRAGON_EGG) {
|
||||
eventType = PlayerBlockEventType.TELEPORT_OBJECT;
|
||||
break;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
default:
|
||||
return;
|
||||
}
|
||||
if (PlotSquared.get().worldedit != null && pp.getAttribute("worldedit")) {
|
||||
if (player.getInventory().getItemInMainHand().getType() == Material
|
||||
.getMaterial(PlotSquared.get().worldedit.getConfiguration().wandItem)) {
|
||||
if (event.getMaterial() == Material.getMaterial(PlotSquared.get().worldedit.getConfiguration().wandItem)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!EventUtil.manager.checkPlayerBlockEvent(pp, eventType, location, lb, true)) {
|
||||
if (!EventUtil.manager.checkPlayerBlockEvent(pp, eventType, location, blocktype1, true)) {
|
||||
event.setCancelled(true);
|
||||
event.setUseInteractedBlock(Event.Result.DENY);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2344,7 +2149,6 @@ import java.util.regex.Pattern;
|
||||
Plot plot = location.getOwnedPlot();
|
||||
if (plot == null || !plot.getFlag(Flags.BLOCK_BURN, false)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
@ -2355,16 +2159,7 @@ import java.util.regex.Pattern;
|
||||
Entity ignitingEntity = event.getIgnitingEntity();
|
||||
Block block = event.getBlock();
|
||||
BlockIgniteEvent.IgniteCause igniteCause = event.getCause();
|
||||
Location location1;
|
||||
if (block != null) {
|
||||
location1 = BukkitUtil.getLocation(block.getLocation());
|
||||
} else if (ignitingEntity != null) {
|
||||
location1 = BukkitUtil.getLocation(ignitingEntity);
|
||||
} else if (player != null) {
|
||||
location1 = BukkitUtil.getLocation(player);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
Location location1 = BukkitUtil.getLocation(block.getLocation());
|
||||
PlotArea area = location1.getPlotArea();
|
||||
if (area == null) {
|
||||
return;
|
||||
@ -2470,7 +2265,7 @@ import java.util.regex.Pattern;
|
||||
Captions.PERMISSION_ADMIN_BUILD_UNOWNED);
|
||||
event.setCancelled(true);
|
||||
} else if (!plot.isAdded(pp.getUUID())) {
|
||||
if (Flags.USE.contains(plot, BukkitBlockUtil.get(block))) {
|
||||
if (Flags.USE.contains(plot, BukkitAdapter.asItemType(block.getType()))) {
|
||||
return;
|
||||
}
|
||||
if (Permissions.hasPermission(pp, Captions.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||
@ -2532,7 +2327,7 @@ import java.util.regex.Pattern;
|
||||
} else if (!plot.isAdded(plotPlayer.getUUID())) {
|
||||
Optional<Set<BlockType>> use = plot.getFlag(Flags.USE);
|
||||
Block block = event.getBlockClicked();
|
||||
if (use.isPresent() && use.get().contains(BukkitBlockUtil.get(block))) {
|
||||
if (use.isPresent() && use.get().contains(BukkitAdapter.asBlockType(block.getType()))) {
|
||||
return;
|
||||
}
|
||||
if (Permissions.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_BUILD_OTHER)) {
|
||||
@ -2578,6 +2373,11 @@ import java.util.regex.Pattern;
|
||||
return;
|
||||
}
|
||||
Player p = event.getPlayer();
|
||||
if (p == null) {
|
||||
PlotSquared.debug("PlotSquared does not support HangingPlaceEvent for non-players.");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
Plot plot = area.getPlot(location);
|
||||
if (plot == null) {
|
||||
@ -2797,11 +2597,11 @@ import java.util.regex.Pattern;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") @EventHandler(priority = EventPriority.HIGHEST)
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onEntityCombustByEntity(EntityCombustByEntityEvent event) {
|
||||
EntityDamageByEntityEvent eventChange =
|
||||
new EntityDamageByEntityEvent(event.getCombuster(), event.getEntity(),
|
||||
EntityDamageEvent.DamageCause.FIRE_TICK, (double) event.getDuration());
|
||||
EntityDamageEvent.DamageCause.FIRE_TICK, event.getDuration());
|
||||
onEntityDamageByEntityEvent(eventChange);
|
||||
if (eventChange.isCancelled()) {
|
||||
event.setCancelled(true);
|
||||
@ -3091,7 +2891,7 @@ import java.util.regex.Pattern;
|
||||
Set<BlockType> place = plot.getFlag(Flags.PLACE, null);
|
||||
if (place != null) {
|
||||
Block block = event.getBlock();
|
||||
if (place.contains(BukkitBlockUtil.get(block))) {
|
||||
if (place.contains(BukkitAdapter.asBlockType(block.getType()))) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -3120,5 +2920,5 @@ import java.util.regex.Pattern;
|
||||
Captions.PERMISSION_ADMIN_BUILD_ROAD);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,18 +2,23 @@ package com.github.intellectualsites.plotsquared.bukkit.object;
|
||||
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.item.ItemType;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class BukkitBlockUtil {
|
||||
public static Supplier<BlockState> supply(Block block) {
|
||||
return () -> BukkitAdapter.asBlockType(block.getType()).getDefaultState();
|
||||
public static Supplier<ItemType> supplyItem(Block block) {
|
||||
return new Supplier<ItemType>() {
|
||||
@Override public ItemType get() {
|
||||
return BukkitAdapter.asItemType(block.getType());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static Supplier<BlockState> supply(Material type) {
|
||||
return () -> BukkitAdapter.asBlockType(type).getDefaultState();
|
||||
public static Supplier<ItemType> supplyItem(Material type) {
|
||||
return () -> BukkitAdapter.asItemType(type);
|
||||
}
|
||||
|
||||
public static BlockState get(Block block) {
|
||||
|
@ -1,19 +1,22 @@
|
||||
package com.github.intellectualsites.plotsquared.bukkit.object;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitEventUtil;
|
||||
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.TeleportCause;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.EconHandler;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.EventUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MathMan;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.PlotGameMode;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.PlotWeather;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.world.item.ItemType;
|
||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
||||
import io.papermc.lib.PaperLib;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Sound;
|
||||
@ -31,6 +34,11 @@ import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.sk89q.worldedit.world.gamemode.GameModes.ADVENTURE;
|
||||
import static com.sk89q.worldedit.world.gamemode.GameModes.CREATIVE;
|
||||
import static com.sk89q.worldedit.world.gamemode.GameModes.SPECTATOR;
|
||||
import static com.sk89q.worldedit.world.gamemode.GameModes.SURVIVAL;
|
||||
|
||||
public class BukkitPlayer extends PlotPlayer {
|
||||
|
||||
private static boolean CHECK_EFFECTIVE = true;
|
||||
@ -188,13 +196,13 @@ public class BukkitPlayer extends PlotPlayer {
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void teleport(@NotNull final Location location) {
|
||||
@Override public void teleport(@NotNull final Location location, @NotNull final TeleportCause cause) {
|
||||
if (Math.abs(location.getX()) >= 30000000 || Math.abs(location.getZ()) >= 30000000) {
|
||||
return;
|
||||
}
|
||||
final org.bukkit.Location bukkitLocation = new org.bukkit.Location(BukkitUtil.getWorld(location.getWorld()), location.getX() + 0.5,
|
||||
location.getY(), location.getZ() + 0.5, location.getYaw(), location.getPitch());
|
||||
PaperLib.teleportAsync(player, bukkitLocation, PlayerTeleportEvent.TeleportCause.PLUGIN);
|
||||
PaperLib.teleportAsync(player, bukkitLocation, ((BukkitEventUtil) EventUtil.manager).getTeleportCause(cause));
|
||||
}
|
||||
|
||||
@Override public String getName() {
|
||||
@ -233,36 +241,29 @@ public class BukkitPlayer extends PlotPlayer {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull @Override public PlotGameMode getGameMode() {
|
||||
@NotNull @Override public com.sk89q.worldedit.world.gamemode.GameMode getGameMode() {
|
||||
switch (this.player.getGameMode()) {
|
||||
case ADVENTURE:
|
||||
return PlotGameMode.ADVENTURE;
|
||||
return ADVENTURE;
|
||||
case CREATIVE:
|
||||
return PlotGameMode.CREATIVE;
|
||||
return CREATIVE;
|
||||
case SPECTATOR:
|
||||
return PlotGameMode.SPECTATOR;
|
||||
return SPECTATOR;
|
||||
case SURVIVAL:
|
||||
return PlotGameMode.SURVIVAL;
|
||||
default:
|
||||
return PlotGameMode.NOT_SET;
|
||||
return SURVIVAL;
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void setGameMode(@NotNull final PlotGameMode gameMode) {
|
||||
switch (gameMode) {
|
||||
case ADVENTURE:
|
||||
@Override public void setGameMode(@NotNull final com.sk89q.worldedit.world.gamemode.GameMode gameMode) {
|
||||
if (ADVENTURE.equals(gameMode)) {
|
||||
this.player.setGameMode(GameMode.ADVENTURE);
|
||||
break;
|
||||
case CREATIVE:
|
||||
} else if (CREATIVE.equals(gameMode)) {
|
||||
this.player.setGameMode(GameMode.CREATIVE);
|
||||
break;
|
||||
case SPECTATOR:
|
||||
} else if (SPECTATOR.equals(gameMode)) {
|
||||
this.player.setGameMode(GameMode.SPECTATOR);
|
||||
break;
|
||||
case SURVIVAL:
|
||||
default:
|
||||
} else {
|
||||
this.player.setGameMode(GameMode.SURVIVAL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -283,7 +284,7 @@ public class BukkitPlayer extends PlotPlayer {
|
||||
}
|
||||
|
||||
@Override public void playMusic(@NotNull final Location location, @NotNull final ItemType id) {
|
||||
if (id.getBlockType().getMaterial().isAir()) {
|
||||
if (id == ItemTypes.AIR) {
|
||||
// Let's just stop all the discs because why not?
|
||||
for (final Sound sound : Arrays.stream(Sound.values())
|
||||
.filter(sound -> sound.name().contains("DISC")).collect(Collectors.toList())) {
|
||||
@ -302,7 +303,7 @@ public class BukkitPlayer extends PlotPlayer {
|
||||
}
|
||||
|
||||
@Override public void stopSpectating() {
|
||||
if (getGameMode() == PlotGameMode.SPECTATOR) {
|
||||
if (getGameMode() == SPECTATOR) {
|
||||
this.player.setSpectatorTarget(null);
|
||||
}
|
||||
}
|
||||
|
@ -40,9 +40,12 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
public class BukkitChunkManager extends ChunkManager {
|
||||
|
||||
public static boolean isIn(CuboidRegion region, int x, int z) {
|
||||
@ -111,7 +114,7 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
|
||||
@Override public Set<BlockVector2> getChunkChunks(String world) {
|
||||
Set<BlockVector2> chunks = super.getChunkChunks(world);
|
||||
for (Chunk chunk : Bukkit.getWorld(world).getLoadedChunks()) {
|
||||
for (Chunk chunk : Objects.requireNonNull(Bukkit.getWorld(world)).getLoadedChunks()) {
|
||||
BlockVector2 loc = BlockVector2.at(chunk.getX() >> 5, chunk.getZ() >> 5);
|
||||
chunks.add(loc);
|
||||
}
|
||||
@ -269,6 +272,7 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
}
|
||||
}
|
||||
final World worldObj = Bukkit.getWorld(world);
|
||||
checkNotNull(worldObj, "Critical error during regeneration.");
|
||||
final BukkitWorld bukkitWorldObj = new BukkitWorld(worldObj);
|
||||
TaskManager.runTask(new Runnable() {
|
||||
@Override public void run() {
|
||||
@ -398,7 +402,7 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override public CompletableFuture loadChunk(String world, BlockVector2 chunkLoc, boolean force) {
|
||||
@Override public CompletableFuture<?> loadChunk(String world, BlockVector2 chunkLoc, boolean force) {
|
||||
return PaperLib.getChunkAtAsync(BukkitUtil.getWorld(world),chunkLoc.getX(), chunkLoc.getZ(), force);
|
||||
}
|
||||
|
||||
@ -440,8 +444,9 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
CuboidRegion region2 =
|
||||
RegionUtil.createRegion(bot2.getX(), top2.getX(), bot2.getZ(), top2.getZ());
|
||||
final World world1 = Bukkit.getWorld(bot1.getWorld());
|
||||
World world2 = Bukkit.getWorld(bot2.getWorld());
|
||||
|
||||
final World world2 = Bukkit.getWorld(bot2.getWorld());
|
||||
checkNotNull(world1,"Critical error during swap.");
|
||||
checkNotNull(world2,"Critical error during swap.");
|
||||
int relX = bot2.getX() - bot1.getX();
|
||||
int relZ = bot2.getZ() - bot1.getZ();
|
||||
|
||||
|
@ -48,12 +48,12 @@ public class BukkitCommand implements CommandExecutor, TabCompleter {
|
||||
if (args.length == 0) {
|
||||
return Collections.singletonList("plots");
|
||||
}
|
||||
Collection objects = MainCommand.getInstance().tab(player, args, s.endsWith(" "));
|
||||
Collection<com.github.intellectualsites.plotsquared.commands.Command> objects = MainCommand.getInstance().tab(player, args, s.endsWith(" "));
|
||||
if (objects == null) {
|
||||
return null;
|
||||
}
|
||||
List<String> result = new ArrayList<>();
|
||||
for (Object o : objects) {
|
||||
for (com.github.intellectualsites.plotsquared.commands.Command o : objects) {
|
||||
result.add(o.toString());
|
||||
}
|
||||
return result.isEmpty() ? null : result;
|
||||
|
@ -25,11 +25,13 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Rating;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.TeleportCause;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.EventUtil;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@ -130,4 +132,14 @@ public final class BukkitEventUtil extends EventUtil {
|
||||
}
|
||||
return event.getRating();
|
||||
}
|
||||
|
||||
public PlayerTeleportEvent.TeleportCause getTeleportCause(@NotNull final TeleportCause cause) {
|
||||
switch (cause) {
|
||||
case COMMAND:
|
||||
return PlayerTeleportEvent.TeleportCause.COMMAND;
|
||||
case PLUGIN:
|
||||
return PlayerTeleportEvent.TeleportCause.PLUGIN;
|
||||
default: return PlayerTeleportEvent.TeleportCause.UNKNOWN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotInventory;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotItemStack;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.InventoryUtil;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
@ -56,7 +57,7 @@ public class BukkitInventoryUtil extends InventoryUtil {
|
||||
if (item == null) {
|
||||
return null;
|
||||
}
|
||||
ItemStack stack = new ItemStack(BukkitUtil.getMaterial(item.getBlockState()), item.amount);
|
||||
ItemStack stack = new ItemStack(BukkitAdapter.adapt(item.getType()), item.amount);
|
||||
ItemMeta meta = null;
|
||||
if (item.name != null) {
|
||||
meta = stack.getItemMeta();
|
||||
@ -95,6 +96,7 @@ public class BukkitInventoryUtil extends InventoryUtil {
|
||||
}
|
||||
if (meta.hasLore()) {
|
||||
List<String> itemLore = meta.getLore();
|
||||
assert itemLore != null;
|
||||
lore = itemLore.toArray(new String[0]);
|
||||
}
|
||||
}
|
||||
|
@ -317,10 +317,6 @@ import java.util.Set;
|
||||
});
|
||||
}
|
||||
|
||||
@Override public Location getSpawn(@NonNull final PlotPlayer player) {
|
||||
return getLocation(((BukkitPlayer) player).player.getBedSpawnLocation());
|
||||
}
|
||||
|
||||
@Override public Location getSpawn(@NonNull final String world) {
|
||||
final org.bukkit.Location temp = getWorld(world).getSpawnLocation();
|
||||
return new Location(world, temp.getBlockX(), temp.getBlockY(), temp.getBlockZ(),
|
||||
|
@ -2,6 +2,4 @@ package com.github.intellectualsites.plotsquared.bukkit.util;
|
||||
|
||||
public class BukkitVersion {
|
||||
public static int[] v1_13_2 = {1, 13, 2};
|
||||
public static int[] v1_13_1 = {1, 13, 1};
|
||||
public static int[] v1_13_0 = {1, 13, 0};
|
||||
}
|
||||
|
@ -79,6 +79,9 @@ public class Metrics {
|
||||
// The plugin
|
||||
private final Plugin plugin;
|
||||
|
||||
// The plugin id
|
||||
private final int bstatsId;
|
||||
|
||||
// A list with all custom charts
|
||||
private final List<CustomChart> charts = new ArrayList<>();
|
||||
|
||||
@ -86,12 +89,14 @@ public class Metrics {
|
||||
* Class constructor.
|
||||
*
|
||||
* @param plugin The plugin which stats should be submitted.
|
||||
* @param bstatsId The ID of the plugin. It can be found in the url when you open the plugin on bStats.
|
||||
*/
|
||||
public Metrics(Plugin plugin) {
|
||||
public Metrics(Plugin plugin, int bstatsId) {
|
||||
if (plugin == null) {
|
||||
throw new IllegalArgumentException("Plugin cannot be null!");
|
||||
}
|
||||
this.plugin = plugin;
|
||||
this.bstatsId = bstatsId;
|
||||
|
||||
// Get the config file
|
||||
File bStatsFolder = new File(plugin.getDataFolder().getParentFile(), "bStats");
|
||||
@ -206,6 +211,7 @@ public class Metrics {
|
||||
String pluginVersion = plugin.getDescription().getVersion();
|
||||
|
||||
data.put("pluginName", pluginName); // Append the name of the plugin
|
||||
data.put("id", bstatsId); // Append the id of the plugin
|
||||
data.put("pluginVersion", pluginVersion); // Append the version of the plugin
|
||||
JSONArray customCharts = new JSONArray();
|
||||
for (CustomChart customChart : charts) {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,5 @@
|
||||
package com.github.intellectualsites.plotsquared.bukkit.uuid;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.bukkit.util.NbtFactory;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||
@ -15,6 +14,13 @@ import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.uuid.UUIDWrapper;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.jnbt.NBTInputStream;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.Map;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
|
||||
@ -38,6 +44,16 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
return super.startCaching(whenDone) && cache(whenDone);
|
||||
}
|
||||
|
||||
private Tag readTag(File file) throws IOException {
|
||||
// Don't chain the creation of the GZIP stream and the NBT stream, because their
|
||||
// constructors may throw an IOException.
|
||||
try (BufferedInputStream inputStream = new BufferedInputStream(new FileInputStream(file));
|
||||
GZIPInputStream gzipInputStream = new GZIPInputStream(inputStream);
|
||||
NBTInputStream nbtInputStream = new NBTInputStream(gzipInputStream)) {
|
||||
return nbtInputStream.readNamedTag().getTag();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean cache(final Runnable whenDone) {
|
||||
final File container = Bukkit.getWorldContainer();
|
||||
List<World> worlds = Bukkit.getWorlds();
|
||||
@ -94,18 +110,18 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
UUID uuid = UUID.fromString(s);
|
||||
if (check || all.remove(uuid)) {
|
||||
File file = new File(playerDataFolder, current);
|
||||
NbtFactory.NbtCompound compound = NbtFactory
|
||||
.fromStream(new FileInputStream(file),
|
||||
NbtFactory.StreamOptions.GZIP_COMPRESSION);
|
||||
CompoundTag compound = (CompoundTag) readTag(file);
|
||||
if (!compound.containsKey("bukkit")) {
|
||||
PlotSquared.debug("ERROR: Player data (" + uuid.toString()
|
||||
+ ".dat) does not contain the the key \"bukkit\"");
|
||||
} else {
|
||||
NbtFactory.NbtCompound bukkit =
|
||||
(NbtFactory.NbtCompound) compound.get("bukkit");
|
||||
String name = (String) bukkit.get("lastKnownName");
|
||||
long last = (long) bukkit.get("lastPlayed");
|
||||
long first = (long) bukkit.get("firstPlayed");
|
||||
Map<String, Tag> compoundMap = compound.getValue();
|
||||
CompoundTag bukkit = (CompoundTag) compoundMap.get("bukkit");
|
||||
Map<String, Tag> bukkitMap = bukkit.getValue();
|
||||
String name =
|
||||
(String) bukkitMap.get("lastKnownName").getValue();
|
||||
long last = (long) bukkitMap.get("lastPlayed").getValue();
|
||||
long first = (long) bukkitMap.get("firstPlayed").getValue();
|
||||
if (ExpireManager.IMP != null) {
|
||||
ExpireManager.IMP.storeDate(uuid, last);
|
||||
ExpireManager.IMP.storeAccountAge(uuid, last - first);
|
||||
@ -167,27 +183,26 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
if (!file.exists()) {
|
||||
continue;
|
||||
}
|
||||
NbtFactory.NbtCompound compound = NbtFactory
|
||||
.fromStream(new FileInputStream(file),
|
||||
NbtFactory.StreamOptions.GZIP_COMPRESSION);
|
||||
CompoundTag compound = (CompoundTag) readTag(file);
|
||||
if (!compound.containsKey("bukkit")) {
|
||||
PlotSquared.debug("ERROR: Player data (" + uuid.toString()
|
||||
+ ".dat) does not contain the the key \"bukkit\"");
|
||||
} else {
|
||||
NbtFactory.NbtCompound bukkit =
|
||||
(NbtFactory.NbtCompound) compound.get("bukkit");
|
||||
String name = (String) bukkit.get("lastKnownName");
|
||||
Map<String, Tag> compoundMap = compound.getValue();
|
||||
CompoundTag bukkit = (CompoundTag) compoundMap.get("bukkit");
|
||||
Map<String, Tag> bukkitMap = bukkit.getValue();
|
||||
String name = (String) bukkitMap.get("lastKnownName").getValue();
|
||||
StringWrapper wrap = new StringWrapper(name);
|
||||
if (!toAdd.containsKey(wrap)) {
|
||||
long last = (long) bukkit.get("lastPlayed");
|
||||
long first = (long) bukkit.get("firstPlayed");
|
||||
long last = (long) bukkitMap.get("lastPlayed").getValue();
|
||||
long first = (long) bukkitMap.get("firstPlayed").getValue();
|
||||
if (Settings.UUID.OFFLINE) {
|
||||
if (Settings.UUID.FORCE_LOWERCASE && !name.toLowerCase()
|
||||
.equals(name)) {
|
||||
uuid = FileUUIDHandler.this.uuidWrapper.getUUID(name);
|
||||
} else {
|
||||
long most = (long) compound.get("UUIDMost");
|
||||
long least = (long) compound.get("UUIDLeast");
|
||||
long most = (long) compoundMap.get("UUIDMost").getValue();
|
||||
long least = (long) compoundMap.get("UUIDLeast").getValue();
|
||||
uuid = new UUID(most, least);
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import com.google.common.base.Charsets;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
public class LowerOfflineUUIDWrapper extends OfflineUUIDWrapper {
|
||||
@ -21,7 +22,7 @@ public class LowerOfflineUUIDWrapper extends OfflineUUIDWrapper {
|
||||
|
||||
@Override public UUID getUUID(OfflinePlayer player) {
|
||||
return UUID.nameUUIDFromBytes(
|
||||
("OfflinePlayer:" + player.getName().toLowerCase()).getBytes(Charsets.UTF_8));
|
||||
("OfflinePlayer:" + Objects.requireNonNull(player.getName()).toLowerCase()).getBytes(Charsets.UTF_8));
|
||||
}
|
||||
|
||||
@Override public UUID getUUID(String name) {
|
||||
|
@ -52,8 +52,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
||||
}
|
||||
|
||||
try (PreparedStatement stmt = getConnection().prepareStatement(
|
||||
"CREATE TABLE IF NOT EXISTS `usercache` (uuid VARCHAR(32) NOT NULL, username VARCHAR(32) NOT NULL, PRIMARY KEY (uuid, username)"
|
||||
+ ')')) {
|
||||
"CREATE TABLE IF NOT EXISTS `usercache` (uuid VARCHAR(32) NOT NULL, username VARCHAR(32) NOT NULL, PRIMARY KEY (uuid, username))")) {
|
||||
stmt.execute();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
@ -237,7 +236,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
||||
return false;
|
||||
}
|
||||
|
||||
private class SQLUUIDHandlerException extends RuntimeException {
|
||||
private static class SQLUUIDHandlerException extends RuntimeException {
|
||||
|
||||
SQLUUIDHandlerException(String s, Throwable c) {
|
||||
super("SQLUUIDHandler caused an exception: " + s, c);
|
||||
|
@ -19,6 +19,8 @@ commands:
|
||||
permissions:
|
||||
plots.use:
|
||||
default: true
|
||||
plots.teleport.delay.bypass:
|
||||
default: op
|
||||
plots.permpack.basicflags:
|
||||
default: op
|
||||
children:
|
||||
|
@ -5,19 +5,19 @@ def textVersion = "3.0.2"
|
||||
|
||||
dependencies {
|
||||
implementation("org.yaml:snakeyaml:1.25")
|
||||
implementation("com.google.code.gson:gson:2.8.0") {
|
||||
implementation("com.google.code.gson:gson:2.8.6") {
|
||||
because("Minecraft uses GSON 2.8.0")
|
||||
force = true
|
||||
}
|
||||
implementation("org.projectlombok:lombok:1.18.8")
|
||||
implementation("org.projectlombok:lombok:1.18.10")
|
||||
compileOnly("org.projectlombok:lombok:1.18.8")
|
||||
testCompileOnly("org.projectlombok:lombok:1.18.8")
|
||||
annotationProcessor("org.projectlombok:lombok:1.18.8")
|
||||
testAnnotationProcessor("org.projectlombok:lombok:1.18.8")
|
||||
implementation("com.github.Sauilitired:Jenkins4J:2.0-SNAPSHOT")
|
||||
implementation("com.squareup.okhttp3:okhttp:3.12.0")
|
||||
implementation("com.squareup.okio:okio:2.2.2")
|
||||
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.3.50")
|
||||
implementation("com.squareup.okhttp3:okhttp:4.2.2")
|
||||
implementation("com.squareup.okio:okio:2.4.1")
|
||||
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.3.61")
|
||||
}
|
||||
|
||||
sourceCompatibility = 1.8
|
||||
|
@ -33,7 +33,7 @@ public abstract class Argument<T> {
|
||||
}
|
||||
};
|
||||
public static final Argument<String> PlayerName =
|
||||
new Argument<String>("PlayerName", "<player>") {
|
||||
new Argument<String>("PlayerName", "<player|*>") {
|
||||
@Override public String parse(String in) {
|
||||
return in.length() <= 16 ? in : null;
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface IPlotMain extends ILogger {
|
||||
|
||||
@ -244,7 +245,7 @@ public interface IPlotMain extends ILogger {
|
||||
*/
|
||||
@NotNull IndependentPlotGenerator getDefaultGenerator();
|
||||
|
||||
List<String> getPluginIds();
|
||||
List<Map.Entry<Map.Entry<String, String>, Boolean>> getPluginIds();
|
||||
|
||||
Actor getConsole();
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ import java.util.zip.ZipInputStream;
|
||||
if (Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS) {
|
||||
try {
|
||||
if (this.IMP.initWorldEdit()) {
|
||||
PlotSquared.debug(IMP.getPluginName() + " hooked into WorldEdit.");
|
||||
PlotSquared.log(Captions.PREFIX + "&6" + IMP.getPluginName() + " hooked into WorldEdit.");
|
||||
this.worldedit = WorldEdit.getInstance();
|
||||
WorldEdit.getInstance().getEventBus().register(new WESubscriber());
|
||||
if (Settings.Enabled_Components.COMMANDS) {
|
||||
@ -311,13 +311,15 @@ import java.util.zip.ZipInputStream;
|
||||
copyFile("zh-CN.yml", Settings.Paths.TRANSLATIONS);
|
||||
copyFile("it-IT.yml", Settings.Paths.TRANSLATIONS);
|
||||
copyFile("ko-KR.yml", Settings.Paths.TRANSLATIONS);
|
||||
copyFile("hu-HU.yml", Settings.Paths.TRANSLATIONS);
|
||||
copyFile("fr-FR.yml", Settings.Paths.TRANSLATIONS);
|
||||
showDebug();
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
PlotSquared.log(Captions.ENABLED.f(IMP.getPluginName()));
|
||||
PlotSquared.log(Captions.PREFIX + Captions
|
||||
.format(Captions.ENABLED.getTranslated(), IMP.getPluginName()));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1827,11 +1829,24 @@ import java.util.zip.ZipInputStream;
|
||||
if (this.version != null) {
|
||||
this.style.set("Version", this.version.toString());
|
||||
}
|
||||
Map<String, Object> object = new HashMap<>(4);
|
||||
this.style.set("Information", "Left Row: PlotSquared color codes ($), right row: Minecraft color codes (&)");
|
||||
Map<String, Object> object = new HashMap<>(16);
|
||||
object.put("color.1", "6");
|
||||
object.put("color.2", "7");
|
||||
object.put("color.3", "8");
|
||||
object.put("color.4", "3");
|
||||
object.put("color.5", "1");
|
||||
object.put("color.6", "2");
|
||||
object.put("color.7", "4");
|
||||
object.put("color.8", "5");
|
||||
object.put("color.9", "9");
|
||||
object.put("color.10", "0");
|
||||
object.put("color.11", "a");
|
||||
object.put("color.12", "b");
|
||||
object.put("color.13", "c");
|
||||
object.put("color.14", "d");
|
||||
object.put("color.15", "e");
|
||||
object.put("color.16", "f");
|
||||
if (!this.style.contains("color")) {
|
||||
for (Entry<String, Object> node : object.entrySet()) {
|
||||
this.style.set(node.getKey(), node.getValue());
|
||||
|
@ -18,8 +18,8 @@ import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@CommandDeclaration(command = "add",
|
||||
description = "Allow a user to build in a plot while you are online",
|
||||
usage = "/plot add <player>", category = CommandCategory.SETTINGS, permission = "plots.add",
|
||||
description = "Allow a user to build in a plot while the plot owner is online.",
|
||||
usage = "/plot add <player|*>", category = CommandCategory.SETTINGS, permission = "plots.add",
|
||||
requiredType = RequiredType.PLAYER) public class Add extends Command {
|
||||
|
||||
public Add() {
|
||||
|
@ -46,7 +46,7 @@ import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
|
||||
switch (args[0].toLowerCase()) {
|
||||
case "set":
|
||||
if (args.length != 2) {
|
||||
Captions.COMMAND_SYNTAX.send(player, "/plot alias <set> <value>");
|
||||
Captions.COMMAND_SYNTAX.send(player, getUsage());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -74,7 +74,7 @@ import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
|
||||
|
||||
private boolean setAlias(PlotPlayer player, Plot plot, String alias) {
|
||||
if (alias.isEmpty()) {
|
||||
Captions.COMMAND_SYNTAX.send(player, "/plot alias <set> <value>");
|
||||
Captions.COMMAND_SYNTAX.send(player, getUsage());
|
||||
return false;
|
||||
}
|
||||
if (alias.length() >= 50) {
|
||||
|
@ -15,6 +15,7 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.SetupObject;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.TeleportCause;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.CmdConfirm;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
@ -134,7 +135,7 @@ import java.util.Set;
|
||||
if (WorldUtil.IMP.isWorld(world)) {
|
||||
PlotSquared.get().loadWorld(world, null);
|
||||
Captions.SETUP_FINISHED.send(player);
|
||||
player.teleport(WorldUtil.IMP.getSpawn(world));
|
||||
player.teleport(WorldUtil.IMP.getSpawn(world), TeleportCause.COMMAND);
|
||||
if (area.TERRAIN != 3) {
|
||||
ChunkManager.largeRegionTask(world, region,
|
||||
new RunnableVal<BlockVector2>() {
|
||||
@ -257,7 +258,7 @@ import java.util.Set;
|
||||
String world = SetupUtils.manager.setupWorld(object);
|
||||
if (WorldUtil.IMP.isWorld(world)) {
|
||||
Captions.SETUP_FINISHED.send(player);
|
||||
player.teleport(WorldUtil.IMP.getSpawn(world));
|
||||
player.teleport(WorldUtil.IMP.getSpawn(world), TeleportCause.COMMAND);
|
||||
} else {
|
||||
MainUtil.sendMessage(player,
|
||||
"An error occurred while creating the world: "
|
||||
@ -284,13 +285,13 @@ import java.util.Set;
|
||||
}
|
||||
if (WorldUtil.IMP.isWorld(pa.worldname)) {
|
||||
if (!player.getLocation().getWorld().equals(pa.worldname)) {
|
||||
player.teleport(WorldUtil.IMP.getSpawn(pa.worldname));
|
||||
player.teleport(WorldUtil.IMP.getSpawn(pa.worldname), TeleportCause.COMMAND);
|
||||
}
|
||||
} else {
|
||||
object.terrain = 0;
|
||||
object.type = 0;
|
||||
SetupUtils.manager.setupWorld(object);
|
||||
player.teleport(WorldUtil.IMP.getSpawn(pa.worldname));
|
||||
player.teleport(WorldUtil.IMP.getSpawn(pa.worldname), TeleportCause.COMMAND);
|
||||
}
|
||||
player.setMeta("area_create_area", pa);
|
||||
MainUtil.sendMessage(player,
|
||||
@ -468,7 +469,7 @@ import java.util.Set;
|
||||
center.setY(1 + WorldUtil.IMP
|
||||
.getHighestBlock(area.worldname, center.getX(), center.getZ()));
|
||||
}
|
||||
player.teleport(center);
|
||||
player.teleport(center, TeleportCause.COMMAND);
|
||||
return true;
|
||||
case "delete":
|
||||
case "remove":
|
||||
|
@ -12,11 +12,12 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.ByteArrayUtilities;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.TeleportCause;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.EconHandler;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
|
||||
import com.google.common.primitives.Ints;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Set;
|
||||
@ -47,8 +48,7 @@ public class Auto extends SubCommand {
|
||||
MainUtil.sendMessage(player, Captions.CANT_CLAIM_MORE_PLOTS_NUM, -diff + "");
|
||||
return false;
|
||||
} else if (player.hasPersistentMeta("grantedPlots")) {
|
||||
int grantedPlots =
|
||||
ByteArrayUtilities.bytesToInteger(player.getPersistentMeta("grantedPlots"));
|
||||
int grantedPlots = Ints.fromByteArray(player.getPersistentMeta("grantedPlots"));
|
||||
if (grantedPlots - diff < sizeX * sizeZ) {
|
||||
player.removePersistentMeta("grantedPlots");
|
||||
MainUtil.sendMessage(player, Captions.CANT_CLAIM_MORE_PLOTS);
|
||||
@ -58,8 +58,7 @@ public class Auto extends SubCommand {
|
||||
if (left == 0) {
|
||||
player.removePersistentMeta("grantedPlots");
|
||||
} else {
|
||||
player.setPersistentMeta("grantedPlots",
|
||||
ByteArrayUtilities.integerToBytes(left));
|
||||
player.setPersistentMeta("grantedPlots", Ints.toByteArray(left));
|
||||
}
|
||||
MainUtil.sendMessage(player, Captions.REMOVED_GRANTED_PLOT, "" + left,
|
||||
"" + (grantedPlots - left));
|
||||
@ -84,7 +83,7 @@ public class Auto extends SubCommand {
|
||||
final String schematic) {
|
||||
Set<Plot> plots = player.getPlots();
|
||||
if (!plots.isEmpty()) {
|
||||
plots.iterator().next().teleportPlayer(player);
|
||||
plots.iterator().next().teleportPlayer(player, TeleportCause.COMMAND);
|
||||
} else {
|
||||
autoClaimSafe(player, area, start, schematic);
|
||||
}
|
||||
@ -176,10 +175,16 @@ public class Auto extends SubCommand {
|
||||
if (Permissions.hasPermission(player, Captions.PERMISSION_AUTO_MEGA)) {
|
||||
try {
|
||||
String[] split = args[0].split(",|;");
|
||||
if (split[1] == null) {
|
||||
MainUtil.sendMessage(player,"Correct use /plot auto [length,width]");
|
||||
size_x = 1;
|
||||
size_z = 1;
|
||||
} else {
|
||||
size_x = Integer.parseInt(split[0]);
|
||||
size_z = Integer.parseInt(split[1]);
|
||||
}
|
||||
if (size_x < 1 || size_z < 1) {
|
||||
MainUtil.sendMessage(player, "&cError: size<=0");
|
||||
MainUtil.sendMessage(player, "Error: size<=0");
|
||||
}
|
||||
if (args.length > 1) {
|
||||
schematic = args[1];
|
||||
@ -214,11 +219,12 @@ public class Auto extends SubCommand {
|
||||
sendMessage(player, Captions.SCHEMATIC_INVALID, "non-existent: " + schematic);
|
||||
return true;
|
||||
}
|
||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_CLAIM_SCHEMATIC.f(schematic))
|
||||
if (!Permissions.hasPermission(player,
|
||||
Captions.format(Captions.PERMISSION_CLAIM_SCHEMATIC.getTranslated(), schematic))
|
||||
&& !Permissions
|
||||
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SCHEMATIC)) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||
Captions.PERMISSION_CLAIM_SCHEMATIC.f(schematic));
|
||||
Captions.format(Captions.PERMISSION_CLAIM_SCHEMATIC.getTranslated(), schematic));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -15,8 +15,18 @@ import com.sk89q.worldedit.world.biome.BiomeTypes;
|
||||
requiredType = RequiredType.NONE) public class Biome extends SetCommand {
|
||||
|
||||
@Override public boolean set(final PlotPlayer player, final Plot plot, final String value) {
|
||||
BiomeType biome = null;
|
||||
try {
|
||||
BiomeType biome = BiomeTypes.get(value);
|
||||
biome = BiomeTypes.get(value.toLowerCase());
|
||||
} catch (final Exception ignore) {}
|
||||
if (biome == null) {
|
||||
String biomes = StringMan
|
||||
.join(BiomeType.REGISTRY.values(), Captions.BLOCK_LIST_SEPARATOR.getTranslated());
|
||||
Captions.NEED_BIOME.send(player);
|
||||
MainUtil.sendMessage(player,
|
||||
Captions.SUBCOMMAND_SET_OPTIONS_HEADER.getTranslated() + biomes);
|
||||
return false;
|
||||
}
|
||||
if (plot.getRunning() > 0) {
|
||||
MainUtil.sendMessage(player, Captions.WAIT_FOR_TIMER);
|
||||
return false;
|
||||
@ -28,13 +38,5 @@ import com.sk89q.worldedit.world.biome.BiomeTypes;
|
||||
.sendMessage(player, Captions.BIOME_SET_TO.getTranslated() + value.toLowerCase());
|
||||
});
|
||||
return true;
|
||||
} catch (IllegalStateException ignore) {
|
||||
String biomes = StringMan
|
||||
.join(BiomeType.REGISTRY.values(), Captions.BLOCK_LIST_SEPARATOR.getTranslated());
|
||||
Captions.NEED_BIOME.send(player);
|
||||
MainUtil.sendMessage(player,
|
||||
Captions.SUBCOMMAND_SET_OPTIONS_HEADER.getTranslated() + biomes);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,14 +11,14 @@ import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.ByteArrayUtilities;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.EconHandler;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
|
||||
import com.google.common.primitives.Ints;
|
||||
|
||||
@CommandDeclaration(command = "claim", aliases = "c",
|
||||
description = "Claim the current plot you're standing on", category = CommandCategory.CLAIMING,
|
||||
requiredType = RequiredType.NONE, permission = "plots.claim", usage = "/plot claim")
|
||||
requiredType = RequiredType.PLAYER, permission = "plots.claim", usage = "/plot claim")
|
||||
public class Claim extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(final PlotPlayer player, String[] args) {
|
||||
@ -38,7 +38,7 @@ public class Claim extends SubCommand {
|
||||
if (currentPlots >= player.getAllowedPlots()) {
|
||||
if (player.hasPersistentMeta("grantedPlots")) {
|
||||
grants =
|
||||
ByteArrayUtilities.bytesToInteger(player.getPersistentMeta("grantedPlots"));
|
||||
Ints.fromByteArray(player.getPersistentMeta("grantedPlots"));
|
||||
if (grants <= 0) {
|
||||
player.removePersistentMeta("grantedPlots");
|
||||
return sendMessage(player, Captions.CANT_CLAIM_MORE_PLOTS);
|
||||
@ -58,7 +58,8 @@ public class Claim extends SubCommand {
|
||||
"non-existent: " + schematic);
|
||||
}
|
||||
if (!Permissions
|
||||
.hasPermission(player, Captions.PERMISSION_CLAIM_SCHEMATIC.f(schematic))
|
||||
.hasPermission(player, Captions
|
||||
.format(Captions.PERMISSION_CLAIM_SCHEMATIC.getTranslated(), schematic))
|
||||
&& !Permissions
|
||||
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND_SCHEMATIC)) {
|
||||
return sendMessage(player, Captions.NO_SCHEMATIC_PERMISSION, schematic);
|
||||
@ -85,7 +86,7 @@ public class Claim extends SubCommand {
|
||||
player.removePersistentMeta("grantedPlots");
|
||||
} else {
|
||||
player.setPersistentMeta("grantedPlots",
|
||||
ByteArrayUtilities.integerToBytes(grants - 1));
|
||||
Ints.toByteArray(grants - 1));
|
||||
}
|
||||
sendMessage(player, Captions.REMOVED_GRANTED_PLOT, "1", "" + (grants - 1));
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@CommandDeclaration(command = "clear", description = "Clear the plot you stand on",
|
||||
@CommandDeclaration(command = "clear", description = "Clear the plot you stand on", requiredType = RequiredType.NONE,
|
||||
permission = "plots.clear", category = CommandCategory.APPEARANCE, usage = "/plot clear",
|
||||
aliases = "reset", confirmation = true) public class Clear extends Command {
|
||||
|
||||
|
@ -12,6 +12,7 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotCluster;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.TeleportCause;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
|
||||
@ -551,7 +552,7 @@ import java.util.UUID;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
player.teleport(cluster.getHome());
|
||||
player.teleport(cluster.getHome(), TeleportCause.COMMAND);
|
||||
return MainUtil.sendMessage(player, Captions.CLUSTER_TELEPORTING);
|
||||
}
|
||||
case "i":
|
||||
|
@ -10,7 +10,7 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
|
||||
@CommandDeclaration(command = "createroadschematic", aliases = {"crs"},
|
||||
category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.NONE,
|
||||
category = CommandCategory.ADMINISTRATION, requiredType = RequiredType.PLAYER,
|
||||
permission = "plots.createroadschematic",
|
||||
description = "Add a road schematic to your world using the roads around your current plot",
|
||||
usage = "/plot createroadschematic") public class CreateRoadSchematic extends SubCommand {
|
||||
|
@ -21,6 +21,8 @@ import java.lang.management.ManagementFactory;
|
||||
import java.lang.management.RuntimeMXBean;
|
||||
import java.nio.file.Files;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@CommandDeclaration(command = "debugpaste", aliases = "dp", usage = "/plot debugpaste",
|
||||
@ -54,18 +56,19 @@ public class DebugPaste extends SubCommand {
|
||||
b.append("online_mode: ").append(UUIDHandler.getUUIDWrapper()).append(';')
|
||||
.append(!Settings.UUID.OFFLINE).append('\n');
|
||||
b.append("Plugins:");
|
||||
for (String id : PlotSquared.get().IMP.getPluginIds()) {
|
||||
String[] split = id.split(":");
|
||||
String[] split2 = split[0].split(";");
|
||||
String enabled = split.length == 2 ? split[1] : "unknown";
|
||||
String name = split2[0];
|
||||
String version = split2.length == 2 ? split2[1] : "unknown";
|
||||
for (Map.Entry<Map.Entry<String, String>, Boolean> pluginInfo : PlotSquared.get().IMP.getPluginIds()) {
|
||||
Map.Entry<String, String> nameVersion = pluginInfo.getKey();
|
||||
String name = nameVersion.getKey();
|
||||
String version = nameVersion.getValue();
|
||||
boolean enabled = pluginInfo.getValue();
|
||||
b.append("\n ").append(name).append(":\n ").append("version: '")
|
||||
.append(version).append('\'').append("\n enabled: ").append(enabled);
|
||||
}
|
||||
b.append("\n\n# YAY! Now, let's see what we can find in your JVM\n");
|
||||
Runtime runtime = Runtime.getRuntime();
|
||||
RuntimeMXBean rb = ManagementFactory.getRuntimeMXBean();
|
||||
b.append("Uptime: ").append(TimeUnit.MINUTES.convert(rb.getUptime(), TimeUnit.MILLISECONDS) + " minutes").append('\n');
|
||||
b.append("JVM Flags: ").append(rb.getInputArguments()).append('\n');
|
||||
b.append("Free Memory: ").append(runtime.freeMemory() / 1024 / 1024 + " MB").append('\n');
|
||||
b.append("Max Memory: ").append(runtime.maxMemory() / 1024 / 1024 + " MB").append('\n');
|
||||
b.append("Java Name: ").append(rb.getVmName()).append('\n');
|
||||
|
@ -11,15 +11,15 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.EventUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.PlotGameMode;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
|
||||
import com.sk89q.worldedit.world.gamemode.GameModes;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
@CommandDeclaration(command = "deny", aliases = {"d", "ban"},
|
||||
description = "Deny a user from a plot", usage = "/plot deny <player>",
|
||||
description = "Deny a user from entering a plot", usage = "/plot deny <player|*>",
|
||||
category = CommandCategory.SETTINGS, requiredType = RequiredType.PLAYER) public class Deny
|
||||
extends SubCommand {
|
||||
|
||||
@ -94,7 +94,7 @@ import java.util.UUID;
|
||||
if (player.hasPermission("plots.admin.entry.denied")) {
|
||||
return;
|
||||
}
|
||||
if (player.getGameMode() == PlotGameMode.SPECTATOR) {
|
||||
if (player.getGameMode() == GameModes.SPECTATOR) {
|
||||
player.stopSpectating();
|
||||
}
|
||||
Location location = player.getLocation();
|
||||
|
@ -40,8 +40,9 @@ public class FlagCmd extends SubCommand {
|
||||
private boolean checkPermValue(PlotPlayer player, Flag flag, String key, String value) {
|
||||
key = key.toLowerCase();
|
||||
value = value.toLowerCase();
|
||||
String perm =
|
||||
Captions.PERMISSION_SET_FLAG_KEY_VALUE.f(key.toLowerCase(), value.toLowerCase());
|
||||
String perm = Captions
|
||||
.format(Captions.PERMISSION_SET_FLAG_KEY_VALUE.getTranslated(), key.toLowerCase(),
|
||||
value.toLowerCase());
|
||||
if (flag instanceof IntegerFlag && MathMan.isInteger(value)) {
|
||||
try {
|
||||
int numeric = Integer.parseInt(value);
|
||||
@ -52,9 +53,9 @@ public class FlagCmd extends SubCommand {
|
||||
Settings.Limit.MAX_PLOTS;
|
||||
final boolean result = player.hasPermissionRange(perm, checkRange) >= numeric;
|
||||
if (!result) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||
Captions.PERMISSION_SET_FLAG_KEY_VALUE
|
||||
.f(key.toLowerCase(), value.toLowerCase()));
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION, Captions
|
||||
.format(Captions.PERMISSION_SET_FLAG_KEY_VALUE.getTranslated(),
|
||||
key.toLowerCase(), value.toLowerCase()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -65,13 +66,14 @@ public class FlagCmd extends SubCommand {
|
||||
final BlockStateListFlag blockListFlag = (BlockStateListFlag) flag;
|
||||
Set<BlockType> parsedBlocks = blockListFlag.parseValue(value);
|
||||
for (final BlockType block : parsedBlocks) {
|
||||
final String permission = Captions.PERMISSION_SET_FLAG_KEY_VALUE
|
||||
.f(key.toLowerCase(), block.toString().toLowerCase());
|
||||
final String permission = Captions
|
||||
.format(Captions.PERMISSION_SET_FLAG_KEY_VALUE.getTranslated(),
|
||||
key.toLowerCase(), block.toString().toLowerCase());
|
||||
final boolean result = Permissions.hasPermission(player, permission);
|
||||
if (!result) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||
Captions.PERMISSION_SET_FLAG_KEY_VALUE
|
||||
.f(key.toLowerCase(), value.toLowerCase()));
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION, Captions
|
||||
.format(Captions.PERMISSION_SET_FLAG_KEY_VALUE.getTranslated(),
|
||||
key.toLowerCase(), value.toLowerCase()));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -79,8 +81,9 @@ public class FlagCmd extends SubCommand {
|
||||
}
|
||||
final boolean result = Permissions.hasPermission(player, perm);
|
||||
if (!result) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||
Captions.PERMISSION_SET_FLAG_KEY_VALUE.f(key.toLowerCase(), value.toLowerCase()));
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION, Captions
|
||||
.format(Captions.PERMISSION_SET_FLAG_KEY_VALUE.getTranslated(), key.toLowerCase(),
|
||||
value.toLowerCase()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -196,11 +199,13 @@ public class FlagCmd extends SubCommand {
|
||||
"/plot flag remove <flag> [values]");
|
||||
return false;
|
||||
}
|
||||
if (!Permissions.hasPermission(player,
|
||||
Captions.PERMISSION_SET_FLAG_KEY.f(args[1].toLowerCase()))) {
|
||||
if (!Permissions.hasPermission(player, Captions
|
||||
.format(Captions.PERMISSION_SET_FLAG_KEY.getTranslated(),
|
||||
args[1].toLowerCase()))) {
|
||||
if (args.length != 3) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||
Captions.PERMISSION_SET_FLAG_KEY.f(args[1].toLowerCase()));
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION, Captions
|
||||
.format(Captions.PERMISSION_SET_FLAG_KEY.getTranslated(),
|
||||
args[1].toLowerCase()));
|
||||
return false;
|
||||
}
|
||||
for (String entry : args[2].split(",")) {
|
||||
|
@ -8,10 +8,10 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.ByteArrayUtilities;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
|
||||
import com.google.common.primitives.Ints;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
@ -32,8 +32,10 @@ import java.util.concurrent.CompletableFuture;
|
||||
switch (arg0) {
|
||||
case "add":
|
||||
case "check":
|
||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_GRANT.f(arg0))) {
|
||||
Captions.NO_PERMISSION.send(player, Captions.PERMISSION_GRANT.f(arg0));
|
||||
if (!Permissions.hasPermission(player,
|
||||
Captions.format(Captions.PERMISSION_GRANT.getTranslated(), arg0))) {
|
||||
Captions.NO_PERMISSION.send(player,
|
||||
Captions.format(Captions.PERMISSION_GRANT.getTranslated(), arg0));
|
||||
return CompletableFuture.completedFuture(false);
|
||||
}
|
||||
if (args.length > 2) {
|
||||
@ -56,7 +58,7 @@ import java.util.concurrent.CompletableFuture;
|
||||
if (array == null) {
|
||||
granted = 0;
|
||||
} else {
|
||||
granted = ByteArrayUtilities.bytesToInteger(array);
|
||||
granted = Ints.fromByteArray(array);
|
||||
}
|
||||
Captions.GRANTED_PLOTS.send(player, granted);
|
||||
} else { // add
|
||||
@ -64,11 +66,11 @@ import java.util.concurrent.CompletableFuture;
|
||||
if (array == null) {
|
||||
amount = 1;
|
||||
} else {
|
||||
amount = 1 + ByteArrayUtilities.bytesToInteger(array);
|
||||
amount = 1 + Ints.fromByteArray(array);
|
||||
}
|
||||
boolean replace = array != null;
|
||||
String key = "grantedPlots";
|
||||
byte[] rawData = ByteArrayUtilities.integerToBytes(amount);
|
||||
byte[] rawData = Ints.toByteArray(amount);
|
||||
PlotPlayer online = UUIDHandler.getPlayer(uuid);
|
||||
if (online != null) {
|
||||
online.setPersistentMeta(key, rawData);
|
||||
|
@ -100,7 +100,7 @@ public class Info extends SubCommand {
|
||||
UUID uuid = player.getUUID();
|
||||
String name = MainUtil.getName(plot.getOwner());
|
||||
inv.setItem(1, new PlotItemStack(388, (short) 0, 1, "&cPlot Info",
|
||||
"&cID: &6" + plot.getId().toString(), "&cOwner: &6" + name,
|
||||
"&cID: &6" + plot.getId().toString(), "&cOwner:&6" + name,
|
||||
"&cAlias: &6" + plot.getAlias(),
|
||||
"&cBiome: &6" + plot.getBiome().toString().replaceAll("_", "").toLowerCase(),
|
||||
"&cCan Build: &6" + plot.isAdded(uuid),
|
||||
|
@ -18,7 +18,7 @@ import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
@CommandDeclaration(command = "kick", aliases = "k", description = "Kick a player from your plot",
|
||||
permission = "plots.kick", usage = "/plot kick <player>", category = CommandCategory.TELEPORT,
|
||||
permission = "plots.kick", usage = "/plot kick <player|*>", category = CommandCategory.TELEPORT,
|
||||
requiredType = RequiredType.PLAYER) public class Kick extends SubCommand {
|
||||
|
||||
public Kick() {
|
||||
|
@ -15,7 +15,7 @@ import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@CommandDeclaration(command = "leave",
|
||||
description = "Removes self from being trusted or a member of the plot",
|
||||
permission = "plots.leave", category = CommandCategory.CLAIMING,
|
||||
permission = "plots.leave", usage = "/plot leave", category = CommandCategory.CLAIMING,
|
||||
requiredType = RequiredType.PLAYER) public class Leave extends Command {
|
||||
public Leave() {
|
||||
super(MainCommand.getInstance(), true);
|
||||
@ -26,7 +26,7 @@ import java.util.concurrent.CompletableFuture;
|
||||
RunnableVal2<Command, CommandResult> whenDone) throws CommandException {
|
||||
final Plot plot = check(player.getCurrentPlot(), Captions.NOT_IN_PLOT);
|
||||
checkTrue(plot.hasOwner(), Captions.PLOT_UNOWNED);
|
||||
checkTrue(plot.isAdded(player.getUUID()), Captions.NO_PLOT_PERMS);
|
||||
checkTrue(plot.isAdded(player.getUUID()), Captions.NOT_ADDED_TRUSTED);
|
||||
checkTrue(args.length == 0, Captions.COMMAND_SYNTAX, getUsage());
|
||||
if (plot.isOwner(player.getUUID())) {
|
||||
checkTrue(plot.hasOwner(), Captions.ALREADY_OWNER);
|
||||
@ -40,9 +40,9 @@ import java.util.concurrent.CompletableFuture;
|
||||
if (plot.removeMember(uuid)) {
|
||||
EventUtil.manager.callMember(player, plot, uuid, false);
|
||||
}
|
||||
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, args[0]);
|
||||
MainUtil.sendMessage(player, Captions.PLOT_LEFT, player.getName());
|
||||
} else {
|
||||
MainUtil.sendMessage(player, Captions.REMOVED_PLAYERS, 1);
|
||||
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, 1);
|
||||
}
|
||||
}
|
||||
return CompletableFuture.completedFuture(true);
|
||||
|
@ -9,6 +9,7 @@ import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Rating;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.TeleportCause;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.EventUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
||||
@ -42,7 +43,7 @@ import java.util.UUID;
|
||||
for (final Plot plot : plots) {
|
||||
if ((!Settings.Done.REQUIRED_FOR_RATINGS || plot.hasFlag(Flags.DONE))
|
||||
&& plot.isBasePlot() && (!plot.getLikes().containsKey(uuid))) {
|
||||
plot.teleportPlayer(player);
|
||||
plot.teleportPlayer(player, TeleportCause.COMMAND);
|
||||
MainUtil.sendMessage(player, Captions.RATE_THIS);
|
||||
return true;
|
||||
}
|
||||
|
@ -137,9 +137,10 @@ public class ListCmd extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
if (!Permissions
|
||||
.hasPermission(player, Captions.PERMISSION_LIST_WORLD_NAME.f(world))) {
|
||||
.hasPermission(player,
|
||||
Captions.format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), world))) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||
Captions.PERMISSION_LIST_WORLD_NAME.f(world));
|
||||
Captions.format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), world));
|
||||
return false;
|
||||
}
|
||||
plots = new ArrayList<>(PlotSquared.get().getPlots(world));
|
||||
@ -161,9 +162,10 @@ public class ListCmd extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
if (!Permissions
|
||||
.hasPermission(player, Captions.PERMISSION_LIST_WORLD_NAME.f(world))) {
|
||||
.hasPermission(player,
|
||||
Captions.format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), world))) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||
Captions.PERMISSION_LIST_WORLD_NAME.f(world));
|
||||
Captions.format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), world));
|
||||
return false;
|
||||
}
|
||||
plots = area == null ? new ArrayList<Plot>() : new ArrayList<>(area.getPlots());
|
||||
@ -308,9 +310,10 @@ public class ListCmd extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
if (!Permissions
|
||||
.hasPermission(player, Captions.PERMISSION_LIST_WORLD_NAME.f(args[0]))) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||
Captions.PERMISSION_LIST_WORLD_NAME.f(args[0]));
|
||||
.hasPermission(player, Captions
|
||||
.format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), args[0]))) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION, Captions
|
||||
.format(Captions.PERMISSION_LIST_WORLD_NAME.getTranslated(), args[0]));
|
||||
return false;
|
||||
}
|
||||
plots = new ArrayList<>(PlotSquared.get().getPlots(args[0]));
|
||||
|
@ -5,6 +5,7 @@ import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.TeleportCause;
|
||||
|
||||
/**
|
||||
* @author manuelgu, altered by Citymonstret
|
||||
@ -20,7 +21,7 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
if (plot == null) {
|
||||
return sendMessage(player, Captions.NOT_IN_PLOT);
|
||||
}
|
||||
player.teleport(plot.getCenter());
|
||||
player.teleport(plot.getCenter(), TeleportCause.COMMAND);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ import java.util.Locale;
|
||||
plot.removeFlag(Flags.MUSIC);
|
||||
Captions.FLAG_REMOVED.send(player);
|
||||
} else if (item.name.toLowerCase(Locale.ENGLISH).contains("disc")) {
|
||||
plot.setFlag(Flags.MUSIC, item);
|
||||
plot.setFlag(Flags.MUSIC, item.getType().getId());
|
||||
Captions.FLAG_ADDED.send(player);
|
||||
} else {
|
||||
Captions.FLAG_NOT_ADDED.send(player);
|
||||
|
@ -12,6 +12,7 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotInventory;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotItemStack;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Rating;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.TeleportCause;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.EventUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MathMan;
|
||||
@ -55,7 +56,7 @@ import java.util.UUID;
|
||||
if ((!Settings.Done.REQUIRED_FOR_RATINGS || p.hasFlag(Flags.DONE)) && p
|
||||
.isBasePlot() && (!p.getRatings().containsKey(uuid)) && !p
|
||||
.isAdded(uuid)) {
|
||||
p.teleportPlayer(player);
|
||||
p.teleportPlayer(player, TeleportCause.COMMAND);
|
||||
MainUtil.sendMessage(player, Captions.RATE_THIS);
|
||||
return true;
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
@CommandDeclaration(command = "remove", aliases = {"r", "untrust", "ut", "undeny", "unban", "ud"},
|
||||
description = "Remove a player from a plot", usage = "/plot remove <player>",
|
||||
description = "Remove a player from a plot", usage = "/plot remove <player|*>",
|
||||
category = CommandCategory.SETTINGS, requiredType = RequiredType.NONE,
|
||||
permission = "plots.remove") public class Remove extends SubCommand {
|
||||
|
||||
|
@ -50,10 +50,11 @@ import java.util.stream.IntStream;
|
||||
|
||||
for (String component : components) {
|
||||
if (component.equalsIgnoreCase(args[0])) {
|
||||
if (!Permissions.hasPermission(player,
|
||||
Captions.PERMISSION_SET_COMPONENT.f(component))) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||
Captions.PERMISSION_SET_COMPONENT.f(component));
|
||||
if (!Permissions.hasPermission(player, Captions
|
||||
.format(Captions.PERMISSION_SET_COMPONENT.getTranslated(), component))) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION, Captions
|
||||
.format(Captions.PERMISSION_SET_COMPONENT.getTranslated(),
|
||||
component));
|
||||
return false;
|
||||
}
|
||||
if (args.length < 2) {
|
||||
|
@ -18,18 +18,20 @@ public abstract class SetCommand extends SubCommand {
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
if (!Permissions
|
||||
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND.f(getFullId()))) {
|
||||
.hasPermission(player,
|
||||
Captions.format(Captions.PERMISSION_ADMIN_COMMAND.getTranslated(), getFullId()))) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||
Captions.PERMISSION_ADMIN_COMMAND.f(getFullId()));
|
||||
Captions.format(Captions.PERMISSION_ADMIN_COMMAND.getTranslated(), getFullId()));
|
||||
MainUtil.sendMessage(player, Captions.PLOT_NOT_CLAIMED);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!plot.isOwner(player.getUUID())) {
|
||||
if (!Permissions
|
||||
.hasPermission(player, Captions.PERMISSION_ADMIN_COMMAND.f(getFullId()))) {
|
||||
.hasPermission(player,
|
||||
Captions.format(Captions.PERMISSION_ADMIN_COMMAND.getTranslated(), getFullId()))) {
|
||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||
Captions.PERMISSION_ADMIN_COMMAND.f(getFullId()));
|
||||
Captions.format(Captions.PERMISSION_ADMIN_COMMAND.getTranslated(), getFullId()));
|
||||
MainUtil.sendMessage(player, Captions.NO_PLOT_PERMS);
|
||||
return false;
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotMessage;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.SetupObject;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.TeleportCause;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.SetupUtils;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
||||
@ -325,7 +326,7 @@ import java.util.UUID;
|
||||
world = object.setupManager.setupWorld(object);
|
||||
}
|
||||
try {
|
||||
player.teleport(WorldUtil.IMP.getSpawn(world));
|
||||
player.teleport(WorldUtil.IMP.getSpawn(world), TeleportCause.COMMAND);
|
||||
} catch (Exception e) {
|
||||
player.sendMessage("&cAn error occurred. See console for more information");
|
||||
e.printStackTrace();
|
||||
|
@ -13,6 +13,7 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.SetupObject;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.TeleportCause;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.SetupUtils;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
|
||||
@ -167,7 +168,7 @@ import java.util.zip.ZipOutputStream;
|
||||
SetupUtils.manager.setupWorld(setup);
|
||||
GlobalBlockQueue.IMP.addEmptyTask(() -> {
|
||||
MainUtil.sendMessage(player, "Done!");
|
||||
player.teleport(WorldUtil.IMP.getSpawn(world));
|
||||
player.teleport(WorldUtil.IMP.getSpawn(world), TeleportCause.COMMAND);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
@ -18,8 +18,8 @@ import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@CommandDeclaration(command = "trust", aliases = {"t"}, requiredType = RequiredType.PLAYER,
|
||||
usage = "/plot trust <player>",
|
||||
description = "Allow a user to build in a plot and use WorldEdit while you are offline",
|
||||
usage = "/plot trust <player|*>",
|
||||
description = "Allow a user to build in a plot and use WorldEdit while the plot owner is offline.",
|
||||
category = CommandCategory.SETTINGS) public class Trust extends Command {
|
||||
|
||||
public Trust() {
|
||||
|
@ -11,6 +11,7 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal2;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal3;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.TeleportCause;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MathMan;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
||||
@ -145,7 +146,7 @@ import java.util.concurrent.CompletableFuture;
|
||||
}
|
||||
}
|
||||
confirm.run(this, () -> {
|
||||
if (plot.teleportPlayer(player)) {
|
||||
if (plot.teleportPlayer(player, TeleportCause.COMMAND)) {
|
||||
whenDone.run(Visit.this, CommandResult.SUCCESS);
|
||||
} else {
|
||||
whenDone.run(Visit.this, CommandResult.FAILURE);
|
||||
|
@ -465,7 +465,7 @@ public enum Captions {
|
||||
PLOT_INFO_UNCLAIMED("$2Plot $1%s$2 is not yet claimed", "Info"),
|
||||
PLOT_INFO_HEADER("$3&m---------&r $1INFO $3&m---------", false, "Info"),
|
||||
PLOT_INFO_HIDDEN("$2You cannot view the information about this plot", "Info"),
|
||||
PLOT_INFO("$1ID: $2%id%$1&-" + "$1Alias: $2%alias%$1&-" + "$1Owner: $2%owner%$1&-"
|
||||
PLOT_INFO("$1ID: $2%id%$1&-" + "$1Alias: $2%alias%$1&-" + "$1Owner:$2%owner%$1&-"
|
||||
+ "$1Biome: $2%biome%$1&-" + "$1Can Build: $2%build%$1&-" + "$1Rating: $2%rating%&-"
|
||||
+ "$1Seen: $2%seen%&-" + "$1Trusted: $2%trusted%$1&-" + "$1Members: $2%members%$1&-"
|
||||
+ "$1Denied: $2%denied%$1&-" + "$1Flags: $2%flags%", "Info"),
|
||||
@ -477,7 +477,7 @@ public enum Captions {
|
||||
PLOT_INFO_BIOME("$1Biome:$2 %biome%", "Info"),
|
||||
PLOT_INFO_RATING("$1Rating:$2 %rating%", "Info"),
|
||||
PLOT_INFO_LIKES("$1Like Ratio:$2 %likes%%", "Info"),
|
||||
PLOT_INFO_OWNER("$1Owner:$2 %owner%", "Info"),
|
||||
PLOT_INFO_OWNER("$1Owner:$2%owner%", "Info"),
|
||||
PLOT_INFO_ID("$1ID:$2 %id%", "Info"),
|
||||
PLOT_INFO_ALIAS("$1Alias:$2 %alias%", "Info"),
|
||||
PLOT_INFO_SIZE("$1Size:$2 %size%", "Info"),
|
||||
@ -570,10 +570,12 @@ public enum Captions {
|
||||
//</editor-fold>
|
||||
//<editor-fold desc="Member">
|
||||
REMOVED_PLAYERS("$2Removed %s players from this plot.", "Member"),
|
||||
PLOT_LEFT("$2%s left the plot.", "Member"),
|
||||
ALREADY_OWNER("$2That user is already the plot owner: %s0", "Member"),
|
||||
ALREADY_ADDED("$2That user is already added to that category: %s0", "Member"),
|
||||
MEMBER_ADDED("$4That user can now build while the plot owner is online", "Member"),
|
||||
PLOT_MAX_MEMBERS("$2You are not allowed to add any more players to this plot", "Member"),
|
||||
NOT_ADDED_TRUSTED("$2You must be added or trusted to the plot to run that command", "Member"),
|
||||
//</editor-fold>
|
||||
//<editor-fold desc="Set Owner">
|
||||
SET_OWNER("$4You successfully set the plot owner", "Owner"),
|
||||
@ -772,10 +774,6 @@ public enum Captions {
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated public String f(final Object... args) {
|
||||
return format(getTranslated(), args);
|
||||
}
|
||||
|
||||
@Override public String toString() {
|
||||
return this.translatedString;
|
||||
}
|
||||
|
@ -1,8 +1,6 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.config;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.object.BlockBucket;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.StringComparison;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.biome.BiomeTypes;
|
||||
@ -10,8 +8,6 @@ import com.sk89q.worldedit.world.block.BlockState;
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
/**
|
||||
* Main Configuration Utility
|
||||
*/
|
||||
@ -53,7 +49,7 @@ public class Configuration {
|
||||
|
||||
@Override public BiomeType parseString(String string) {
|
||||
if (validateValue(string)) {
|
||||
return BiomeTypes.get(string.toUpperCase());
|
||||
return BiomeTypes.get(string.toLowerCase());
|
||||
}
|
||||
return BiomeTypes.FOREST;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ public class Settings extends Config {
|
||||
|
||||
@Comment("Show additional information in console") public static boolean DEBUG = false;
|
||||
@Comment({"The big annoying text that appears when you enter a plot",
|
||||
"For a single plot: `/plot flag set titles false`", "For just you: `/plot toggle titles`"})
|
||||
"For a single plot: `/plot flag set titles false`", "For just you: `/plot toggle titles`", "For all plots: Add `titles: false` in the worlds.yml flags block"})
|
||||
public static boolean TITLES = true;
|
||||
|
||||
@Create // This value will be generated automatically
|
||||
@ -292,7 +292,7 @@ public class Settings extends Config {
|
||||
@Comment("Teleport to your plot on death") public static boolean ON_DEATH = false;
|
||||
@Comment("Teleport to your plot on login") public static boolean ON_LOGIN = false;
|
||||
@Comment("Teleport to your plot on claim") public static boolean ON_CLAIM = true;
|
||||
@Comment("Add a delay to all teleport commands") public static int DELAY = 0;
|
||||
@Comment({"Add a delay to all teleport commands", "Assign `plots.teleport.delay.bypass` to bypass the cooldown."}) public static int DELAY = 0;
|
||||
@Comment("The visit command is ordered by world instead of globally") public static boolean
|
||||
PER_WORLD_VISIT = false;
|
||||
}
|
||||
@ -331,7 +331,7 @@ public class Settings extends Config {
|
||||
true;
|
||||
@Comment("The UUID cacher is used to resolve player names") public static boolean
|
||||
UUID_CACHE = true;
|
||||
@Comment("The plugin auto updater") public static boolean UPDATER = true;
|
||||
@Comment("The plugin auto updater will notify you if updates are available.") public static boolean UPDATER = true;
|
||||
@Comment("Stores user metadata in a database") public static boolean PERSISTENT_META = true;
|
||||
@Comment("Optimizes permission checks") public static boolean PERMISSION_CACHE = true;
|
||||
@Comment("Optimizes block changing code") public static boolean BLOCK_CACHE = true;
|
||||
@ -340,7 +340,7 @@ public class Settings extends Config {
|
||||
@Comment("Allow WorldEdit to be restricted to plots") public static boolean
|
||||
WORLDEDIT_RESTRICTIONS = true;
|
||||
@Comment("Allow economy to be used") public static boolean ECONOMY = true;
|
||||
@Comment("Send anonymous usage statistics to bStats. Bukkit only setting.") public static boolean
|
||||
@Comment("@deprecated - use bstats config.yml") public static boolean
|
||||
METRICS = true;
|
||||
@Comment("Expiry will clear old or simplistic plots") public static boolean PLOT_EXPIRY =
|
||||
false;
|
||||
|
@ -375,7 +375,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
if (statement.isClosed()) {
|
||||
statement = null;
|
||||
}
|
||||
} catch (AbstractMethodError ignore) {
|
||||
} catch (NullPointerException | AbstractMethodError ignore) {
|
||||
}
|
||||
}
|
||||
lastTask = task;
|
||||
|
@ -8,6 +8,7 @@ import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -22,7 +23,7 @@ public class BlockStateListFlag extends ListFlag<Set<BlockType>> {
|
||||
}
|
||||
|
||||
@Override public Set<BlockType> parseValue(final String value) {
|
||||
return Arrays.stream(BlockUtil.parse(value)).map(BlockState::getBlockType).collect(Collectors.toSet());
|
||||
return Arrays.stream(BlockUtil.parse(value)).filter(Objects::nonNull).map(BlockState::getBlockType).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
@Override public String getValueDescription() {
|
||||
|
@ -1,38 +1,38 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.flag;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.PlotGameMode;
|
||||
import com.sk89q.worldedit.world.gamemode.GameMode;
|
||||
import com.sk89q.worldedit.world.gamemode.GameModes;
|
||||
|
||||
public class GameModeFlag extends Flag<PlotGameMode> {
|
||||
public class GameModeFlag extends Flag<GameMode> {
|
||||
|
||||
public GameModeFlag(String name) {
|
||||
super(Captions.FLAG_CATEGORY_GAMEMODE, name);
|
||||
}
|
||||
|
||||
@Override public String valueToString(Object value) {
|
||||
return ((PlotGameMode) value).getName();
|
||||
return ((GameMode) value).getName();
|
||||
}
|
||||
|
||||
@Override public PlotGameMode parseValue(String value) {
|
||||
@Override public GameMode parseValue(String value) {
|
||||
switch (value.toLowerCase()) {
|
||||
case "survival":
|
||||
case "s":
|
||||
case "0":
|
||||
return PlotGameMode.SURVIVAL;
|
||||
case "creative":
|
||||
case "c":
|
||||
case "1":
|
||||
return PlotGameMode.CREATIVE;
|
||||
return GameModes.CREATIVE;
|
||||
case "adventure":
|
||||
case "a":
|
||||
case "2":
|
||||
return PlotGameMode.ADVENTURE;
|
||||
return GameModes.ADVENTURE;
|
||||
case "spectator":
|
||||
case "sp":
|
||||
case "3":
|
||||
return PlotGameMode.SPECTATOR;
|
||||
return GameModes.SPECTATOR;
|
||||
case "survival":
|
||||
case "s":
|
||||
case "0":
|
||||
default:
|
||||
return PlotGameMode.NOT_SET;
|
||||
return GameModes.SURVIVAL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,31 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.flag;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.world.ItemUtil;
|
||||
import com.sk89q.worldedit.world.item.ItemType;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ItemTypeListFlag extends ListFlag<Set<ItemType>> {
|
||||
|
||||
public ItemTypeListFlag(String name) {
|
||||
super(Captions.FLAG_CATEGORY_BLOCK_LIST, name);
|
||||
}
|
||||
|
||||
@Override public String valueToString(Object value) {
|
||||
return StringMan.join((Set<ItemType>) value, ",");
|
||||
}
|
||||
|
||||
@Override public Set<ItemType> parseValue(final String value) {
|
||||
return Arrays.stream(ItemUtil.parse(value)).filter(Objects::nonNull)
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
@Override public String getValueDescription() {
|
||||
return Captions.FLAG_ERROR_PLOTBLOCKLIST.getTranslated();
|
||||
}
|
||||
}
|
@ -12,6 +12,7 @@ import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -289,7 +290,7 @@ public class ClassicPlotManager extends SquarePlotManager {
|
||||
queue.setCuboid(
|
||||
new Location(classicPlotWorld.worldname, sx, Math.min(classicPlotWorld.WALL_HEIGHT, classicPlotWorld.ROAD_HEIGHT) + 1,
|
||||
sz + 1), new Location(classicPlotWorld.worldname, ex, maxY, ez - 1),
|
||||
BlockUtil.get((short) 0, (byte) 0));
|
||||
BlockTypes.AIR.getDefaultState());
|
||||
queue.setCuboid(new Location(classicPlotWorld.worldname, sx, 0, sz + 1),
|
||||
new Location(classicPlotWorld.worldname, ex, 0, ez - 1), BlockUtil.get((short) 7, (byte) 0));
|
||||
queue.setCuboid(new Location(classicPlotWorld.worldname, sx, 1, sz + 1),
|
||||
@ -317,7 +318,7 @@ public class ClassicPlotManager extends SquarePlotManager {
|
||||
new Location(classicPlotWorld.worldname, sx + 1, Math.min(classicPlotWorld.WALL_HEIGHT, classicPlotWorld.ROAD_HEIGHT) + 1,
|
||||
sz),
|
||||
new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.getPlotManager().getWorldHeight(),
|
||||
ez), BlockUtil.get((short) 0, (byte) 0));
|
||||
ez), BlockTypes.AIR.getDefaultState());
|
||||
queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 0, sz),
|
||||
new Location(classicPlotWorld.worldname, ex - 1, 0, ez), BlockUtil.get((short) 7, (byte) 0));
|
||||
queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 1, sz),
|
||||
@ -342,7 +343,7 @@ public class ClassicPlotManager extends SquarePlotManager {
|
||||
LocalBlockQueue queue = classicPlotWorld.getQueue(false);
|
||||
queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, classicPlotWorld.ROAD_HEIGHT + 1, sz + 1),
|
||||
new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.getPlotManager().getWorldHeight(), ez - 1),
|
||||
BlockUtil.get((short) 0, (byte) 0));
|
||||
BlockTypes.AIR.getDefaultState());
|
||||
queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 0, sz + 1),
|
||||
new Location(classicPlotWorld.worldname, ex - 1, 0, ez - 1),
|
||||
BlockUtil.get((short) 7, (byte) 0));
|
||||
@ -362,8 +363,7 @@ public class ClassicPlotManager extends SquarePlotManager {
|
||||
queue.setCuboid(
|
||||
new Location(classicPlotWorld.worldname, sx, Math.min(classicPlotWorld.PLOT_HEIGHT, classicPlotWorld.ROAD_HEIGHT) + 1,
|
||||
sz),
|
||||
new Location(classicPlotWorld.worldname, ex, classicPlotWorld.getPlotManager().getWorldHeight(), ez),
|
||||
BlockUtil.get((short) 0, (byte) 0));
|
||||
new Location(classicPlotWorld.worldname, ex, classicPlotWorld.getPlotManager().getWorldHeight(), ez), BlockTypes.AIR.getDefaultState());
|
||||
queue.setCuboid(new Location(classicPlotWorld.worldname, sx, 1, sz + 1),
|
||||
new Location(classicPlotWorld.worldname, ex, classicPlotWorld.PLOT_HEIGHT - 1, ez - 1), classicPlotWorld.MAIN_BLOCK.toPattern());
|
||||
queue.setCuboid(new Location(classicPlotWorld.worldname, sx, classicPlotWorld.PLOT_HEIGHT, sz + 1),
|
||||
@ -383,7 +383,7 @@ public class ClassicPlotManager extends SquarePlotManager {
|
||||
new Location(classicPlotWorld.worldname, sx, Math.min(classicPlotWorld.PLOT_HEIGHT, classicPlotWorld.ROAD_HEIGHT) + 1,
|
||||
sz),
|
||||
new Location(classicPlotWorld.worldname, ex, classicPlotWorld.getPlotManager().getWorldHeight(), ez),
|
||||
BlockUtil.get((short) 0, (byte) 0));
|
||||
BlockTypes.AIR.getDefaultState());
|
||||
queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, 1, sz),
|
||||
new Location(classicPlotWorld.worldname, ex - 1, classicPlotWorld.PLOT_HEIGHT - 1, ez), classicPlotWorld.MAIN_BLOCK.toPattern());
|
||||
queue.setCuboid(new Location(classicPlotWorld.worldname, sx + 1, classicPlotWorld.PLOT_HEIGHT, sz),
|
||||
@ -400,7 +400,7 @@ public class ClassicPlotManager extends SquarePlotManager {
|
||||
LocalBlockQueue queue = classicPlotWorld.getQueue(false);
|
||||
queue.setCuboid(new Location(classicPlotWorld.worldname, sx, classicPlotWorld.ROAD_HEIGHT + 1, sz),
|
||||
new Location(classicPlotWorld.worldname, ex, classicPlotWorld.getPlotManager().getWorldHeight(), ez),
|
||||
BlockUtil.get((short) 0, (byte) 0));
|
||||
BlockTypes.AIR.getDefaultState());
|
||||
queue.setCuboid(new Location(classicPlotWorld.worldname, sx, 1, sz),
|
||||
new Location(classicPlotWorld.worldname, ex, classicPlotWorld.ROAD_HEIGHT - 1, ez), classicPlotWorld.MAIN_BLOCK.toPattern());
|
||||
queue.setCuboid(new Location(classicPlotWorld.worldname, sx, classicPlotWorld.ROAD_HEIGHT, sz),
|
||||
|
@ -2,7 +2,7 @@ package com.github.intellectualsites.plotsquared.plot.listener;
|
||||
|
||||
public enum PlayerBlockEventType {
|
||||
// Non interactive
|
||||
EAT, READ,
|
||||
READ,
|
||||
|
||||
// Right click with monster egg
|
||||
SPAWN_MOB,
|
||||
@ -11,21 +11,11 @@ public enum PlayerBlockEventType {
|
||||
TELEPORT_OBJECT,
|
||||
|
||||
// armor stands
|
||||
PLACE_MISC, // blocks
|
||||
PLACE_BLOCK, // paintings / item frames
|
||||
PLACE_HANGING, // vehicles
|
||||
PLACE_MISC,
|
||||
PLACE_VEHICLE,
|
||||
|
||||
// armor stands
|
||||
BREAK_MISC, // blocks
|
||||
BREAK_BLOCK, // paintings / item frames
|
||||
BREAK_HANGING, BREAK_VEHICLE,
|
||||
|
||||
// armor stands
|
||||
INTERACT_MISC, // blocks
|
||||
INTERACT_BLOCK, // vehicle
|
||||
INTERACT_VEHICLE, // item frame / painting
|
||||
INTERACT_HANGING,
|
||||
INTERACT_BLOCK, // blocks
|
||||
|
||||
// Pressure plate, tripwire etc
|
||||
TRIGGER_PHYSICAL,
|
||||
|
@ -15,13 +15,14 @@ import com.github.intellectualsites.plotsquared.plot.util.CommentManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.EventUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.PlotGameMode;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.PlotWeather;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.world.ItemUtil;
|
||||
import com.sk89q.worldedit.world.gamemode.GameMode;
|
||||
import com.sk89q.worldedit.world.gamemode.GameModes;
|
||||
import com.sk89q.worldedit.world.item.ItemType;
|
||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
||||
|
||||
@ -95,9 +96,9 @@ public class PlotListener {
|
||||
Optional<Boolean> flyFlag = plot.getFlag(Flags.FLY);
|
||||
if (flyFlag.isPresent()) {
|
||||
boolean flight = player.getFlight();
|
||||
PlotGameMode gamemode = player.getGameMode();
|
||||
if (flight != (gamemode == PlotGameMode.CREATIVE
|
||||
|| gamemode == PlotGameMode.SPECTATOR)) {
|
||||
GameMode gamemode = player.getGameMode();
|
||||
if (flight != (gamemode == GameModes.CREATIVE
|
||||
|| gamemode == GameModes.SPECTATOR)) {
|
||||
player.setPersistentMeta("flight",
|
||||
ByteArrayUtilities.booleanToBytes(player.getFlight()));
|
||||
}
|
||||
@ -105,7 +106,7 @@ public class PlotListener {
|
||||
player.setFlight(flyFlag.get());
|
||||
}
|
||||
}
|
||||
Optional<PlotGameMode> gamemodeFlag = plot.getFlag(Flags.GAMEMODE);
|
||||
Optional<GameMode> gamemodeFlag = plot.getFlag(Flags.GAMEMODE);
|
||||
if (gamemodeFlag.isPresent()) {
|
||||
if (player.getGameMode() != gamemodeFlag.get()) {
|
||||
if (!Permissions.hasPermission(player, "plots.gamemode.bypass")) {
|
||||
@ -118,7 +119,7 @@ public class PlotListener {
|
||||
}
|
||||
}
|
||||
}
|
||||
Optional<PlotGameMode> guestGamemodeFlag = plot.getFlag(Flags.GUEST_GAMEMODE);
|
||||
Optional<GameMode> guestGamemodeFlag = plot.getFlag(Flags.GUEST_GAMEMODE);
|
||||
if (guestGamemodeFlag.isPresent()) {
|
||||
if (player.getGameMode() != guestGamemodeFlag.get() && !plot
|
||||
.isAdded(player.getUUID())) {
|
||||
@ -152,12 +153,12 @@ public class PlotListener {
|
||||
Location location = player.getLocation();
|
||||
Location lastLocation = player.getMeta("music");
|
||||
if (lastLocation != null) {
|
||||
player.playMusic(lastLocation, ItemTypes.AIR);
|
||||
player.playMusic(lastLocation, item);
|
||||
if (item == ItemTypes.AIR) {
|
||||
player.deleteMeta("music");
|
||||
}
|
||||
}
|
||||
if (!(item == ItemTypes.AIR)) {
|
||||
if (item != ItemTypes.AIR) {
|
||||
try {
|
||||
player.setMeta("music", location);
|
||||
player.playMusic(location, item);
|
||||
@ -227,7 +228,7 @@ public class PlotListener {
|
||||
} else {
|
||||
MainUtil.sendMessage(player, StringMan
|
||||
.replaceAll(Captions.GAMEMODE_WAS_BYPASSED.getTranslated(), "{plot}",
|
||||
plot.toString(), "{gamemode}", pw.GAMEMODE.name().toLowerCase()));
|
||||
plot.toString(), "{gamemode}", pw.GAMEMODE.getName().toLowerCase()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -258,8 +259,8 @@ public class PlotListener {
|
||||
ByteArrayUtilities.bytesToBoolean(player.getPersistentMeta("flight")));
|
||||
player.removePersistentMeta("flight");
|
||||
} else {
|
||||
PlotGameMode gameMode = player.getGameMode();
|
||||
if (gameMode == PlotGameMode.SURVIVAL || gameMode == PlotGameMode.ADVENTURE) {
|
||||
GameMode gameMode = player.getGameMode();
|
||||
if (gameMode == GameModes.SURVIVAL || gameMode == GameModes.ADVENTURE) {
|
||||
player.setFlight(false);
|
||||
} else if (!player.getFlight()) {
|
||||
player.setFlight(true);
|
||||
|
@ -23,8 +23,7 @@ import java.util.Set;
|
||||
public class WESubscriber {
|
||||
|
||||
@Subscribe(priority = Priority.VERY_EARLY) public void onEditSession(EditSessionEvent event) {
|
||||
WorldEdit worldedit = PlotSquared.get().worldedit;
|
||||
if (worldedit == null) {
|
||||
if (!Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS) {
|
||||
WorldEdit.getInstance().getEventBus().unregister(this);
|
||||
return;
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ import java.util.regex.Matcher;
|
||||
* A block bucket is a container of block types, where each block
|
||||
* has a specified chance of being randomly picked
|
||||
*/
|
||||
@EqualsAndHashCode(of={"input"}) @SuppressWarnings({"unused", "WeakerAccess"})
|
||||
@EqualsAndHashCode(of = {"input"}) @SuppressWarnings({"unused", "WeakerAccess"})
|
||||
public final class BlockBucket implements ConfigurationSerializable {
|
||||
private boolean compiled;
|
||||
|
||||
@ -78,7 +78,7 @@ public final class BlockBucket implements ConfigurationSerializable {
|
||||
private void addBlock(@NonNull final BlockState block, double chance) {
|
||||
if (chance == -1) chance = 1;
|
||||
String prefix = input.length() == 0 ? "" : ",";
|
||||
input.append(prefix).append(chance + "%" + prefix);
|
||||
input.append(prefix).append(chance).append("%").append(prefix);
|
||||
this.compiled = false;
|
||||
}
|
||||
|
||||
@ -104,10 +104,19 @@ public final class BlockBucket implements ConfigurationSerializable {
|
||||
String[] blocksStr = string.split(",(?![^\\(\\[]*[\\]\\)])");
|
||||
if (blocksStr.length == 1) {
|
||||
try {
|
||||
Matcher matcher = regex.matcher(string);
|
||||
if (matcher.find()) {
|
||||
String chanceStr = matcher.group("chance");
|
||||
String block = matcher.group("block");
|
||||
if (chanceStr != null && block != null && !MathMan.isInteger(block) && MathMan.isInteger(chanceStr)) {
|
||||
String namespace = matcher.group("namespace");
|
||||
string = (namespace == null ? "" : namespace + ":") + block;
|
||||
}
|
||||
}
|
||||
this.single = BlockUtil.get(string);
|
||||
this.pattern = new BlockPattern(single);
|
||||
return;
|
||||
} catch (Exception ignore) {}
|
||||
} catch (Exception ignore) { }
|
||||
}
|
||||
for (int i = 0; i < blocksStr.length; i++) {
|
||||
String entry = blocksStr[i];
|
||||
@ -154,7 +163,7 @@ public final class BlockBucket implements ConfigurationSerializable {
|
||||
return ImmutableMap.of("blocks", this.toString());
|
||||
}
|
||||
|
||||
@Getter @EqualsAndHashCode @RequiredArgsConstructor private final static class Range {
|
||||
@Getter @EqualsAndHashCode @RequiredArgsConstructor private static final class Range {
|
||||
|
||||
private final int min;
|
||||
private final int max;
|
||||
|
@ -3,10 +3,11 @@ package com.github.intellectualsites.plotsquared.plot.object;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.commands.RequiredType;
|
||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.PlotGameMode;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.PlotWeather;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.world.gamemode.GameMode;
|
||||
import com.sk89q.worldedit.world.gamemode.GameModes;
|
||||
import com.sk89q.worldedit.world.item.ItemType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -77,7 +78,7 @@ public class ConsolePlayer extends PlotPlayer {
|
||||
PlotSquared.log(message);
|
||||
}
|
||||
|
||||
@Override public void teleport(Location location) {
|
||||
@Override public void teleport(Location location, TeleportCause cause) {
|
||||
setMeta(PlotPlayer.META_LAST_PLOT, location.getPlot());
|
||||
setMeta(PlotPlayer.META_LOCATION, location);
|
||||
}
|
||||
@ -110,11 +111,11 @@ public class ConsolePlayer extends PlotPlayer {
|
||||
@Override public void setWeather(@NotNull PlotWeather weather) {
|
||||
}
|
||||
|
||||
@NotNull @Override public PlotGameMode getGameMode() {
|
||||
return PlotGameMode.NOT_SET;
|
||||
@Override public @NotNull GameMode getGameMode() {
|
||||
return GameModes.SPECTATOR;
|
||||
}
|
||||
|
||||
@Override public void setGameMode(@NotNull PlotGameMode gameMode) {
|
||||
@Override public void setGameMode(@NotNull GameMode gameMode) {
|
||||
}
|
||||
|
||||
@Override public void setTime(long time) {
|
||||
|
@ -9,9 +9,9 @@ import lombok.Setter;
|
||||
|
||||
public class Location implements Cloneable, Comparable<Location> {
|
||||
|
||||
@Getter private int x;
|
||||
@Getter private int y;
|
||||
@Getter private int z;
|
||||
private int x;
|
||||
private int y;
|
||||
private int z;
|
||||
@Getter @Setter private float yaw;
|
||||
@Getter @Setter private float pitch;
|
||||
@Getter @Setter private String world;
|
||||
@ -31,6 +31,18 @@ public class Location implements Cloneable, Comparable<Location> {
|
||||
this(world, x, y, z, 0f, 0f);
|
||||
}
|
||||
|
||||
public int getX() {
|
||||
return this.x;
|
||||
}
|
||||
|
||||
public int getY() {
|
||||
return this.y;
|
||||
}
|
||||
|
||||
public int getZ() {
|
||||
return this.z;
|
||||
}
|
||||
|
||||
public void setX(int x) {
|
||||
this.x = x;
|
||||
this.blockVector3 = BlockVector3.at(x, y, z);
|
||||
@ -53,7 +65,8 @@ public class Location implements Cloneable, Comparable<Location> {
|
||||
this.z = blockVector3.getZ();
|
||||
}
|
||||
|
||||
@Override public Location clone() {
|
||||
@Override
|
||||
public Location clone() {
|
||||
try {
|
||||
return (Location) super.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
@ -92,6 +105,10 @@ public class Location implements Cloneable, Comparable<Location> {
|
||||
return area != null && area.getPlotAbs(this) == null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if anyone owns a plot at the current location.
|
||||
* @return true if the location is a road, not a plot area, or if the plot is unclaimed.
|
||||
*/
|
||||
public boolean isUnownedPlotArea() {
|
||||
PlotArea area = getPlotArea();
|
||||
return area != null && area.getOwnedPlotAbs(this) == null;
|
||||
|
@ -1,5 +1,8 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.object;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Captions;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.Configuration;
|
||||
@ -36,6 +39,7 @@ import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@ -946,10 +950,16 @@ public class Plot {
|
||||
ChunkManager.chunkTask(pos1, pos2, new RunnableVal<int[]>() {
|
||||
@Override public void run(int[] value) {
|
||||
BlockVector2 loc = BlockVector2.at(value[0], value[1]);
|
||||
long start = System.currentTimeMillis();
|
||||
ChunkManager.manager.loadChunk(getWorldName(), loc, false);
|
||||
long end = System.currentTimeMillis();
|
||||
PlotSquared.debug("[Biome Operation] Loading chunk took: " + TimeUnit.MILLISECONDS.toSeconds(end - start));
|
||||
MainUtil.setBiome(getWorldName(), value[2], value[3], value[4], value[5],
|
||||
biome);
|
||||
start = System.currentTimeMillis();
|
||||
ChunkManager.manager.unloadChunk(getWorldName(), loc, true);
|
||||
end = System.currentTimeMillis();
|
||||
PlotSquared.debug("[Biome Operation] Unloading chunk took: " + TimeUnit.MILLISECONDS.toSeconds(end - start));
|
||||
}
|
||||
}, this, 5);
|
||||
|
||||
@ -997,7 +1007,8 @@ public class Plot {
|
||||
manager.createRoadSouthEast(current);
|
||||
}
|
||||
}
|
||||
} else if (current.getMerged(Direction.SOUTH)) {
|
||||
}
|
||||
if (current.getMerged(Direction.SOUTH)) {
|
||||
manager.createRoadSouth(current);
|
||||
}
|
||||
}
|
||||
@ -1513,7 +1524,7 @@ public class Plot {
|
||||
setSign(player.getName());
|
||||
MainUtil.sendMessage(player, Captions.CLAIMED);
|
||||
if (teleport && Settings.Teleport.ON_CLAIM) {
|
||||
teleportPlayer(player);
|
||||
teleportPlayer(player, TeleportCause.COMMAND);
|
||||
}
|
||||
PlotArea plotworld = getArea();
|
||||
if (plotworld.SCHEMATIC_ON_CLAIM) {
|
||||
@ -2798,6 +2809,17 @@ public class Plot {
|
||||
* @return if the teleport succeeded
|
||||
*/
|
||||
public boolean teleportPlayer(final PlotPlayer player) {
|
||||
return teleportPlayer(player, TeleportCause.PLUGIN);
|
||||
}
|
||||
|
||||
/**
|
||||
* Teleport a player to a plot and send them the teleport message.
|
||||
*
|
||||
* @param player the player
|
||||
* @param cause the cause of the teleport
|
||||
* @return if the teleport succeeded
|
||||
*/
|
||||
public boolean teleportPlayer(final PlotPlayer player, TeleportCause cause) {
|
||||
Plot plot = this.getBasePlot(false);
|
||||
boolean result = EventUtil.manager.callTeleport(player, player.getLocation(), plot);
|
||||
if (result) {
|
||||
@ -2807,14 +2829,12 @@ public class Plot {
|
||||
} else {
|
||||
location = this.getDefaultHome(false);
|
||||
}
|
||||
if (Settings.Teleport.DELAY == 0 || Permissions
|
||||
.hasPermission(player, "plots.teleport.delay.bypass")) {
|
||||
if (Settings.Teleport.DELAY == 0 || Permissions.hasPermission(player, "plots.teleport.delay.bypass")) {
|
||||
MainUtil.sendMessage(player, Captions.TELEPORTED_TO_PLOT);
|
||||
player.teleport(location);
|
||||
player.teleport(location, cause);
|
||||
return true;
|
||||
}
|
||||
MainUtil
|
||||
.sendMessage(player, Captions.TELEPORT_IN_SECONDS, Settings.Teleport.DELAY + "");
|
||||
MainUtil.sendMessage(player, Captions.TELEPORT_IN_SECONDS, Settings.Teleport.DELAY + "");
|
||||
final String name = player.getName();
|
||||
TaskManager.TELEPORT_QUEUE.add(name);
|
||||
TaskManager.runTaskLater(() -> {
|
||||
@ -2825,7 +2845,7 @@ public class Plot {
|
||||
TaskManager.TELEPORT_QUEUE.remove(name);
|
||||
if (player.isOnline()) {
|
||||
MainUtil.sendMessage(player, Captions.TELEPORTED_TO_PLOT);
|
||||
player.teleport(location);
|
||||
player.teleport(location, cause);
|
||||
}
|
||||
}, Settings.Teleport.DELAY * 20);
|
||||
return true;
|
||||
|
@ -14,7 +14,6 @@ import com.github.intellectualsites.plotsquared.plot.util.EconHandler;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.EventUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MathMan;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.PlotGameMode;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.area.QuadMap;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue;
|
||||
@ -27,6 +26,8 @@ import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.biome.BiomeTypes;
|
||||
import com.sk89q.worldedit.world.gamemode.GameMode;
|
||||
import com.sk89q.worldedit.world.gamemode.GameModes;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@ -82,7 +83,7 @@ public abstract class PlotArea {
|
||||
public PlotLoc DEFAULT_HOME;
|
||||
public int MAX_BUILD_HEIGHT = 256;
|
||||
public int MIN_BUILD_HEIGHT = 1;
|
||||
public PlotGameMode GAMEMODE = PlotGameMode.CREATIVE;
|
||||
public GameMode GAMEMODE = GameModes.CREATIVE;
|
||||
private int hash;
|
||||
private CuboidRegion region;
|
||||
private ConcurrentHashMap<String, Object> meta;
|
||||
@ -116,7 +117,7 @@ public abstract class PlotArea {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the region for this PlotArea or a CuboidRegion encompassing
|
||||
* Returns the region for this PlotArea, or a CuboidRegion encompassing
|
||||
* the whole world if none exists.
|
||||
*
|
||||
* @return CuboidRegion
|
||||
@ -248,27 +249,25 @@ public abstract class PlotArea {
|
||||
this.MIN_BUILD_HEIGHT = config.getInt("world.min_height");
|
||||
|
||||
switch (config.getString("world.gamemode").toLowerCase()) {
|
||||
case "survival":
|
||||
case "s":
|
||||
case "0":
|
||||
this.GAMEMODE = PlotGameMode.SURVIVAL;
|
||||
break;
|
||||
case "creative":
|
||||
case "c":
|
||||
case "1":
|
||||
this.GAMEMODE = PlotGameMode.CREATIVE;
|
||||
this.GAMEMODE = GameModes.CREATIVE;
|
||||
break;
|
||||
case "adventure":
|
||||
case "a":
|
||||
case "2":
|
||||
this.GAMEMODE = PlotGameMode.ADVENTURE;
|
||||
this.GAMEMODE = GameModes.ADVENTURE;
|
||||
break;
|
||||
case "spectator":
|
||||
case "3":
|
||||
this.GAMEMODE = PlotGameMode.SPECTATOR;
|
||||
this.GAMEMODE = GameModes.SPECTATOR;
|
||||
break;
|
||||
case "survival":
|
||||
case "s":
|
||||
case "0":
|
||||
default:
|
||||
this.GAMEMODE = PlotGameMode.NOT_SET;
|
||||
this.GAMEMODE = GameModes.SURVIVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -363,7 +362,7 @@ public abstract class PlotArea {
|
||||
options.put("home.nonmembers", position);
|
||||
options.put("world.max_height", this.MAX_BUILD_HEIGHT);
|
||||
options.put("world.min_height", this.MIN_BUILD_HEIGHT);
|
||||
options.put("world.gamemode", this.GAMEMODE.name().toLowerCase());
|
||||
options.put("world.gamemode", this.GAMEMODE.getName().toLowerCase());
|
||||
|
||||
if (this.TYPE != 0) {
|
||||
options.put("generator.terrain", this.TERRAIN);
|
||||
@ -628,7 +627,7 @@ public abstract class PlotArea {
|
||||
this.meta.put(key, value);
|
||||
}
|
||||
|
||||
@NotNull public <T> T getMeta(@Nullable final String key, @NotNull final T def) {
|
||||
@NotNull public <T> T getMeta(@NotNull final String key, @NotNull final T def) {
|
||||
final Object v = getMeta(key);
|
||||
return v == null ? def : (T) v;
|
||||
}
|
||||
@ -638,7 +637,8 @@ public abstract class PlotArea {
|
||||
* <br>
|
||||
* For persistent metadata use the flag system
|
||||
*/
|
||||
@Nullable public Object getMeta(@NotNull final String key) {
|
||||
@Nullable
|
||||
public Object getMeta(@NotNull final String key) {
|
||||
if (this.meta != null) {
|
||||
return this.meta.get(key);
|
||||
}
|
||||
@ -700,7 +700,7 @@ public abstract class PlotArea {
|
||||
PlotId max = getMax();
|
||||
if (TYPE == 2) {
|
||||
center = new PlotId(MathMan.average(min.x, max.x), MathMan.average(min.y, max.y));
|
||||
plots = Math.max(max.x - min.x, max.y - min.y) + 1;
|
||||
plots = Math.max(max.x - min.x + 1, max.y - min.y + 1) + 1;
|
||||
if (start != null) {
|
||||
start = new PlotId(start.x - center.x, start.y - center.y);
|
||||
}
|
||||
@ -717,7 +717,7 @@ public abstract class PlotArea {
|
||||
PlotId currentId = new PlotId(center.x + start.x, center.y + start.y);
|
||||
Plot plot = getPlotAbs(currentId);
|
||||
if (plot != null && plot.canClaim(player)) {
|
||||
setMeta("lastPlot", currentId);
|
||||
setMeta("lastPlot", start);
|
||||
return plot;
|
||||
}
|
||||
}
|
||||
|
@ -13,13 +13,13 @@ import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotAre
|
||||
import com.github.intellectualsites.plotsquared.plot.util.EconHandler;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.EventUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.Permissions;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.PlotGameMode;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.PlotWeather;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.world.gamemode.GameMode;
|
||||
import com.sk89q.worldedit.world.item.ItemType;
|
||||
import lombok.NonNull;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@ -373,7 +373,17 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
||||
*
|
||||
* @param location the target location
|
||||
*/
|
||||
public abstract void teleport(Location location);
|
||||
public void teleport(Location location) {
|
||||
teleport(location, TeleportCause.PLUGIN);
|
||||
}
|
||||
|
||||
/**
|
||||
* Teleport this player to a location.
|
||||
*
|
||||
* @param location the target location
|
||||
* @param cause the cause of the teleport
|
||||
*/
|
||||
public abstract void teleport(Location location, TeleportCause cause);
|
||||
|
||||
/**
|
||||
* Kick this player to a location
|
||||
@ -438,14 +448,14 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
||||
*
|
||||
* @return the gamemode of the player.
|
||||
*/
|
||||
@NotNull public abstract PlotGameMode getGameMode();
|
||||
public abstract @NotNull GameMode getGameMode();
|
||||
|
||||
/**
|
||||
* Set this player's gameMode.
|
||||
*
|
||||
* @param gameMode the gamemode to set
|
||||
*/
|
||||
public abstract void setGameMode(@NotNull PlotGameMode gameMode);
|
||||
public abstract void setGameMode(@NotNull GameMode gameMode);
|
||||
|
||||
/**
|
||||
* Set this player's local time (ticks).
|
||||
@ -612,7 +622,8 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
||||
if (getMeta("teleportOnLogin", true)) {
|
||||
teleport(location);
|
||||
sendMessage(
|
||||
Captions.TELEPORTED_TO_PLOT.f() + " (quitLoc) (" + plotX
|
||||
Captions.format(Captions.TELEPORTED_TO_PLOT.getTranslated())
|
||||
+ " (quitLoc) (" + plotX
|
||||
+ "," + plotZ + ")");
|
||||
}
|
||||
});
|
||||
@ -623,7 +634,8 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
|
||||
if (getMeta("teleportOnLogin", true)) {
|
||||
if (plot.isLoaded()) {
|
||||
teleport(location);
|
||||
sendMessage(Captions.TELEPORTED_TO_PLOT.f()
|
||||
sendMessage(Captions.format(
|
||||
Captions.TELEPORTED_TO_PLOT.getTranslated())
|
||||
+ " (quitLoc-unloaded) (" + plotX + "," + plotZ
|
||||
+ ")");
|
||||
}
|
||||
|
@ -0,0 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.object;
|
||||
|
||||
public enum TeleportCause {
|
||||
COMMAND,
|
||||
PLUGIN,
|
||||
UNKNOWN
|
||||
}
|
@ -8,6 +8,7 @@ import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.TeleportCause;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@ -50,9 +51,9 @@ public class SinglePlot extends Plot {
|
||||
return (SinglePlotArea) super.getArea();
|
||||
}
|
||||
|
||||
public boolean teleportPlayer(final PlotPlayer player) {
|
||||
public boolean teleportPlayer(final PlotPlayer player, TeleportCause cause) {
|
||||
if (isLoaded()) {
|
||||
return super.teleportPlayer(player);
|
||||
return super.teleportPlayer(player, cause);
|
||||
} else {
|
||||
Captions.NOT_LOADED.send(player);
|
||||
return false;
|
||||
|
@ -1,21 +1,9 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.util;
|
||||
|
||||
import com.google.common.primitives.Ints;
|
||||
|
||||
public class ByteArrayUtilities {
|
||||
|
||||
public static byte[] integerToBytes(int i) {
|
||||
byte[] bytes = new byte[4];
|
||||
bytes[0] = (byte) (i >> 24);
|
||||
bytes[1] = (byte) (i >> 16);
|
||||
bytes[2] = (byte) (i >> 8);
|
||||
bytes[3] = (byte) (i);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
public static int bytesToInteger(byte[] bytes) {
|
||||
return (bytes[0] << 24) & 0xff000000 | (bytes[1] << 16) & 0x00ff0000
|
||||
| (bytes[2] << 8) & 0x0000ff00 | (bytes[3]) & 0x000000ff;
|
||||
}
|
||||
|
||||
public static boolean bytesToBoolean(byte[] bytes) {
|
||||
return bytes[0] == 1;
|
||||
}
|
||||
|
@ -14,16 +14,15 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Rating;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public abstract class EventUtil {
|
||||
|
||||
@ -89,7 +88,7 @@ public abstract class EventUtil {
|
||||
.getArea() instanceof SinglePlotArea)) {
|
||||
TaskManager.runTask(() -> plot.teleportPlayer(player));
|
||||
MainUtil.sendMessage(player,
|
||||
Captions.TELEPORTED_TO_ROAD.f() + " (on-login) " + "(" + plot.getId().x + ";" + plot
|
||||
Captions.format(Captions.TELEPORTED_TO_ROAD.getTranslated()) + " (on-login) " + "(" + plot.getId().x + ";" + plot
|
||||
.getId().y + ")");
|
||||
}
|
||||
}
|
||||
@ -102,8 +101,8 @@ public abstract class EventUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean checkPlayerBlockEvent(PlotPlayer player, PlayerBlockEventType type,
|
||||
Location location, Supplier<BlockState> block, boolean notifyPerms) {
|
||||
public boolean checkPlayerBlockEvent(PlotPlayer player, @NotNull PlayerBlockEventType type,
|
||||
Location location, BlockType blockType, boolean notifyPerms) {
|
||||
PlotArea area = location.getPlotArea();
|
||||
assert area != null;
|
||||
Plot plot = area.getPlot(location);
|
||||
@ -115,103 +114,8 @@ public abstract class EventUtil {
|
||||
switch (type) {
|
||||
case TELEPORT_OBJECT:
|
||||
return false;
|
||||
case EAT:
|
||||
case READ:
|
||||
return true;
|
||||
case BREAK_BLOCK:
|
||||
if (plot == null) {
|
||||
return Permissions.hasPermission(player,
|
||||
Captions.PERMISSION_ADMIN_INTERACT_ROAD.getTranslated(),
|
||||
notifyPerms);
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
return Permissions.hasPermission(player,
|
||||
Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(),
|
||||
notifyPerms);
|
||||
}
|
||||
Optional<Set<BlockType>> use = plot.getFlag(Flags.USE);
|
||||
if (use.isPresent()) {
|
||||
Set<BlockType> value = use.get();
|
||||
if (value.contains(BlockTypes.AIR) || value
|
||||
.contains(block.get())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Optional<Set<BlockType>> destroy = plot.getFlag(Flags.BREAK);
|
||||
if (destroy.isPresent()) {
|
||||
Set<BlockType> value = destroy.get();
|
||||
if (value.contains(BlockTypes.AIR) || value
|
||||
.contains(block.get())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (Permissions
|
||||
.hasPermission(player, Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(),
|
||||
false)) {
|
||||
return true;
|
||||
}
|
||||
return !(!notifyPerms || MainUtil.sendMessage(player, Captions.FLAG_TUTORIAL_USAGE,
|
||||
Captions.FLAG_USE.getTranslated() + '/' + Captions.FLAG_BREAK.getTranslated()));
|
||||
case BREAK_HANGING:
|
||||
if (plot == null) {
|
||||
return Permissions.hasPermission(player,
|
||||
Captions.PERMISSION_ADMIN_INTERACT_ROAD.getTranslated(),
|
||||
notifyPerms);
|
||||
}
|
||||
if (plot.getFlag(Flags.HANGING_BREAK).orElse(false)) {
|
||||
return true;
|
||||
}
|
||||
if (plot.hasOwner()) {
|
||||
return Permissions.hasPermission(player,
|
||||
Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)
|
||||
|| !(!notifyPerms || MainUtil
|
||||
.sendMessage(player, Captions.FLAG_TUTORIAL_USAGE,
|
||||
Captions.FLAG_HANGING_BREAK.getTranslated()));
|
||||
}
|
||||
return Permissions.hasPermission(player,
|
||||
Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(),
|
||||
notifyPerms);
|
||||
case BREAK_MISC:
|
||||
if (plot == null) {
|
||||
return Permissions.hasPermission(player,
|
||||
Captions.PERMISSION_ADMIN_INTERACT_ROAD.getTranslated(),
|
||||
notifyPerms);
|
||||
}
|
||||
if (plot.getFlag(Flags.MISC_BREAK).orElse(false)) {
|
||||
return true;
|
||||
}
|
||||
if (plot.hasOwner()) {
|
||||
return Permissions.hasPermission(player,
|
||||
Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)
|
||||
|| !(!notifyPerms || MainUtil
|
||||
.sendMessage(player, Captions.FLAG_TUTORIAL_USAGE,
|
||||
Captions.FLAG_MISC_BREAK.getTranslated()));
|
||||
}
|
||||
return Permissions.hasPermission(player,
|
||||
Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(),
|
||||
notifyPerms);
|
||||
case BREAK_VEHICLE:
|
||||
if (plot == null) {
|
||||
return Permissions.hasPermission(player,
|
||||
Captions.PERMISSION_ADMIN_INTERACT_ROAD.getTranslated(),
|
||||
notifyPerms);
|
||||
}
|
||||
if (plot.getFlag(Flags.VEHICLE_BREAK).orElse(false)) {
|
||||
return true;
|
||||
}
|
||||
if (plot.hasOwner()) {
|
||||
if (Permissions.hasPermission(player,
|
||||
Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(),
|
||||
false)) {
|
||||
return true;
|
||||
}
|
||||
return !(!notifyPerms || MainUtil
|
||||
.sendMessage(player, Captions.FLAG_TUTORIAL_USAGE,
|
||||
Captions.FLAG_VEHICLE_BREAK.getTranslated()));
|
||||
}
|
||||
return Permissions.hasPermission(player,
|
||||
Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(),
|
||||
notifyPerms);
|
||||
case INTERACT_BLOCK: {
|
||||
if (plot == null) {
|
||||
return Permissions.hasPermission(player,
|
||||
@ -226,7 +130,7 @@ public abstract class EventUtil {
|
||||
Optional<Set<BlockType>> flagValue = plot.getFlag(Flags.USE);
|
||||
Set<BlockType> value = flagValue.orElse(null);
|
||||
if (value == null || !value.contains(BlockTypes.AIR) && !value
|
||||
.contains(block.get())) {
|
||||
.contains(blockType)) {
|
||||
return Permissions.hasPermission(player,
|
||||
Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(), false)
|
||||
|| !(!notifyPerms || MainUtil
|
||||
@ -235,31 +139,6 @@ public abstract class EventUtil {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
case PLACE_BLOCK: {
|
||||
if (plot == null) {
|
||||
return Permissions
|
||||
.hasPermission(player, Captions.PERMISSION_ADMIN_BUILD_ROAD.getTranslated(),
|
||||
notifyPerms);
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
return Permissions.hasPermission(player,
|
||||
Captions.PERMISSION_ADMIN_BUILD_UNOWNED.getTranslated(),
|
||||
notifyPerms);
|
||||
}
|
||||
Optional<Set<BlockType>> flagValue = plot.getFlag(Flags.PLACE);
|
||||
Set<BlockType> value = flagValue.orElse(null);
|
||||
if (value == null || !value.contains(BlockTypes.AIR) && !value
|
||||
.contains(block.get())) {
|
||||
if (Permissions.hasPermission(player,
|
||||
Captions.PERMISSION_ADMIN_BUILD_OTHER.getTranslated(), false)) {
|
||||
return true;
|
||||
}
|
||||
return !(!notifyPerms || MainUtil
|
||||
.sendMessage(player, Captions.FLAG_TUTORIAL_USAGE,
|
||||
Captions.FLAG_PLACE.getTranslated()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
case TRIGGER_PHYSICAL: {
|
||||
if (plot == null) {
|
||||
return Permissions.hasPermission(player,
|
||||
@ -276,7 +155,7 @@ public abstract class EventUtil {
|
||||
Optional<Set<BlockType>> flagValue = plot.getFlag(Flags.USE);
|
||||
Set<BlockType> value = flagValue.orElse(null);
|
||||
if (value == null || !value.contains(BlockTypes.AIR) && !value
|
||||
.contains(block.get())) {
|
||||
.contains(blockType)) {
|
||||
if (Permissions.hasPermission(player,
|
||||
Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(),
|
||||
false)) {
|
||||
@ -286,95 +165,6 @@ public abstract class EventUtil {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
case INTERACT_HANGING: {
|
||||
if (plot == null) {
|
||||
return Permissions.hasPermission(player,
|
||||
Captions.PERMISSION_ADMIN_INTERACT_ROAD.getTranslated(),
|
||||
notifyPerms);
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
return Permissions.hasPermission(player,
|
||||
Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(),
|
||||
notifyPerms);
|
||||
}
|
||||
if (plot.getFlag(Flags.HOSTILE_INTERACT).orElse(false)) {
|
||||
return true;
|
||||
}
|
||||
Optional<Set<BlockType>> flagValue = plot.getFlag(Flags.USE);
|
||||
Set<BlockType> value = flagValue.orElse(null);
|
||||
if (value == null || !value.contains(BlockTypes.AIR) && !value
|
||||
.contains(block.get())) {
|
||||
if (Permissions.hasPermission(player,
|
||||
Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(),
|
||||
false)) {
|
||||
return true;
|
||||
}
|
||||
return !(!notifyPerms || MainUtil
|
||||
.sendMessage(player, Captions.FLAG_TUTORIAL_USAGE,
|
||||
Captions.FLAG_USE.getTranslated()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
case INTERACT_MISC: {
|
||||
if (plot == null) {
|
||||
return Permissions.hasPermission(player,
|
||||
Captions.PERMISSION_ADMIN_INTERACT_ROAD.getTranslated(),
|
||||
notifyPerms);
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
return Permissions.hasPermission(player,
|
||||
Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(),
|
||||
notifyPerms);
|
||||
}
|
||||
if (plot.getFlag(Flags.MISC_INTERACT).orElse(false)) {
|
||||
return true;
|
||||
}
|
||||
Optional<Set<BlockType>> flag = plot.getFlag(Flags.USE);
|
||||
Set<BlockType> value = flag.orElse(null);
|
||||
if (value == null || !value.contains(BlockTypes.AIR) && !value
|
||||
.contains(block.get())) {
|
||||
if (Permissions.hasPermission(player,
|
||||
Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(),
|
||||
false)) {
|
||||
return true;
|
||||
}
|
||||
return !(!notifyPerms || MainUtil
|
||||
.sendMessage(player, Captions.FLAG_TUTORIAL_USAGE,
|
||||
Captions.FLAG_USE.getTranslated() + '/' + Captions.FLAG_MISC_INTERACT
|
||||
.getTranslated()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
case INTERACT_VEHICLE: {
|
||||
if (plot == null) {
|
||||
return Permissions.hasPermission(player,
|
||||
Captions.PERMISSION_ADMIN_INTERACT_ROAD.getTranslated(),
|
||||
notifyPerms);
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
return Permissions.hasPermission(player,
|
||||
Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(),
|
||||
notifyPerms);
|
||||
}
|
||||
if (plot.getFlag(Flags.VEHICLE_USE).orElse(false)) {
|
||||
return true;
|
||||
}
|
||||
Optional<Set<BlockType>> flag = plot.getFlag(Flags.USE);
|
||||
Set<BlockType> value = flag.orElse(null);
|
||||
if (value == null || !value.contains(BlockTypes.AIR) && !value
|
||||
.contains(block.get())) {
|
||||
if (Permissions.hasPermission(player,
|
||||
Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(),
|
||||
false)) {
|
||||
return true;
|
||||
}
|
||||
return !(!notifyPerms || MainUtil
|
||||
.sendMessage(player, Captions.FLAG_TUTORIAL_USAGE,
|
||||
Captions.FLAG_USE.getTranslated() + '/' + Captions.FLAG_VEHICLE_USE
|
||||
.getTranslated()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
case SPAWN_MOB: {
|
||||
if (plot == null) {
|
||||
return Permissions.hasPermission(player,
|
||||
@ -392,7 +182,7 @@ public abstract class EventUtil {
|
||||
Optional<Set<BlockType>> flagValue = plot.getFlag(Flags.PLACE);
|
||||
Set<BlockType> value = flagValue.orElse(null);
|
||||
if (value == null || !value.contains(BlockTypes.AIR) && !value
|
||||
.contains(block.get())) {
|
||||
.contains(blockType)) {
|
||||
if (Permissions.hasPermission(player,
|
||||
Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(),
|
||||
false)) {
|
||||
@ -422,7 +212,7 @@ public abstract class EventUtil {
|
||||
Optional<Set<BlockType>> flag = plot.getFlag(Flags.PLACE);
|
||||
Set<BlockType> value = flag.orElse(null);
|
||||
if (value == null || !value.contains(BlockTypes.AIR) && !value
|
||||
.contains(block.get())) {
|
||||
.contains(blockType)) {
|
||||
if (Permissions.hasPermission(player,
|
||||
Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(),
|
||||
false)) {
|
||||
@ -447,24 +237,8 @@ public abstract class EventUtil {
|
||||
Captions.PERMISSION_ADMIN_INTERACT_UNOWNED.getTranslated(),
|
||||
notifyPerms);
|
||||
}
|
||||
if (plot.getFlag(Flags.VEHICLE_PLACE).orElse(false)) {
|
||||
return true;
|
||||
}
|
||||
Optional<Set<BlockType>> flag = plot.getFlag(Flags.PLACE);
|
||||
Set<BlockType> value = flag.orElse(null);
|
||||
if (value == null || !value.contains(BlockTypes.AIR) && !value
|
||||
.contains(block.get())) {
|
||||
if (Permissions.hasPermission(player,
|
||||
Captions.PERMISSION_ADMIN_INTERACT_OTHER.getTranslated(),
|
||||
false)) {
|
||||
return true;
|
||||
}
|
||||
return !(!notifyPerms || MainUtil
|
||||
.sendMessage(player, Captions.FLAG_TUTORIAL_USAGE,
|
||||
Captions.FLAG_VEHICLE_PLACE.getTranslated() + '/' + Captions.FLAG_PLACE
|
||||
.getTranslated()));
|
||||
}
|
||||
return true;
|
||||
Optional<Boolean> flag1 = plot.getFlag(Flags.VEHICLE_PLACE);
|
||||
return flag1.orElse(false);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -81,7 +81,8 @@ import java.util.Map;
|
||||
@NonNull final String key, @NonNull final String block) {
|
||||
final BlockBucket bucket = this.blockToBucket(block);
|
||||
this.setString(section, key, bucket);
|
||||
PlotSquared.log(Captions.LEGACY_CONFIG_REPLACED.f(block, bucket.toString()));
|
||||
PlotSquared.log(Captions
|
||||
.format(Captions.LEGACY_CONFIG_REPLACED.getTranslated(), block, bucket.toString()));
|
||||
}
|
||||
|
||||
private void convertBlockList(@NonNull final ConfigurationSection section,
|
||||
@ -89,8 +90,9 @@ import java.util.Map;
|
||||
final BlockState[] blocks = this.splitBlockList(blockList);
|
||||
final BlockBucket bucket = this.blockListToBucket(blocks);
|
||||
this.setString(section, key, bucket);
|
||||
PlotSquared.log(
|
||||
Captions.LEGACY_CONFIG_REPLACED.f(plotBlockArrayString(blocks), bucket.toString()));
|
||||
PlotSquared.log(Captions
|
||||
.format(Captions.LEGACY_CONFIG_REPLACED.getTranslated(), plotBlockArrayString(blocks),
|
||||
bucket.toString()));
|
||||
}
|
||||
|
||||
private String plotBlockArrayString(@NonNull final BlockState[] blocks) {
|
||||
|
@ -789,7 +789,9 @@ public class MainUtil {
|
||||
value = df.format(value);
|
||||
}
|
||||
flags.append(prefix)
|
||||
.append(Captions.PLOT_FLAG_LIST.f(entry.getKey().getName(), value));
|
||||
.append(Captions
|
||||
.format(Captions.PLOT_FLAG_LIST.getTranslated(), entry.getKey().getName(),
|
||||
value));
|
||||
prefix = ", ";
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ public class Permissions {
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a PlotPlayer has a permission, and optionally send the no permission message if applicable.
|
||||
* Checks if a PlotPlayer has a permission, and optionally send the no permission message if applicable.
|
||||
*
|
||||
* @param player
|
||||
* @param permission
|
||||
|
@ -1,32 +0,0 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.util;
|
||||
|
||||
public enum PlotGameMode {
|
||||
NOT_SET(-1, ""), SURVIVAL(0, "survival"), CREATIVE(1, "creative"), ADVENTURE(2,
|
||||
"adventure"), SPECTATOR(3, "spectator");
|
||||
|
||||
private final int id;
|
||||
private final String name;
|
||||
|
||||
PlotGameMode(int id, String name) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* The magic-value id of the GameMode.
|
||||
*
|
||||
* @return the GameMode id
|
||||
*/
|
||||
public int getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of this GameMode
|
||||
*
|
||||
* @return the GameMode name
|
||||
*/
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
}
|
@ -161,19 +161,19 @@ public abstract class UUIDHandlerImplementation {
|
||||
});
|
||||
}
|
||||
try {
|
||||
UUID offline = this.uuidMap.put(name, uuid);
|
||||
if (offline != null) {
|
||||
if (!offline.equals(uuid)) {
|
||||
Set<Plot> plots = PlotSquared.get().getPlots(offline);
|
||||
UUID existing = this.uuidMap.put(name, uuid);
|
||||
if (existing != null) {
|
||||
if (!existing.equals(uuid)) {
|
||||
Set<Plot> plots = PlotSquared.get().getPlots(existing);
|
||||
if (!plots.isEmpty()) {
|
||||
for (Plot plot : plots) {
|
||||
plot.owner = uuid;
|
||||
}
|
||||
replace(offline, uuid, name.value);
|
||||
replace(existing, uuid, name.value);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
StringWrapper oName = this.uuidMap.inverse().get(offline);
|
||||
StringWrapper oName = this.uuidMap.inverse().get(existing);
|
||||
if (!oName.equals(name)) {
|
||||
this.uuidMap.remove(name);
|
||||
this.uuidMap.put(name, uuid);
|
||||
@ -191,6 +191,13 @@ public abstract class UUIDHandlerImplementation {
|
||||
PlotPlayer player = getPlayer(uuid);
|
||||
if (player == null || player.getName().equalsIgnoreCase(name.value)) {
|
||||
rename(uuid, name);
|
||||
return false;
|
||||
}
|
||||
StringWrapper newName = new StringWrapper(player.getName());
|
||||
UUID newUUID = player.getUUID();
|
||||
if (newUUID.equals(uuid) && !newName.equals(oldName)) {
|
||||
inverse.remove(uuid);
|
||||
this.uuidMap.put(newName, newUUID);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -41,8 +41,6 @@ public abstract class WorldUtil {
|
||||
|
||||
public abstract Location getSpawn(String world);
|
||||
|
||||
public abstract Location getSpawn(PlotPlayer pp);
|
||||
|
||||
public abstract void setSpawn(Location location);
|
||||
|
||||
public abstract void saveWorld(String world);
|
||||
|
@ -5,6 +5,7 @@ import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@ -14,13 +15,13 @@ public class ChunkBlockQueue extends ScopedLocalBlockQueue {
|
||||
public final BlockState[][][] result;
|
||||
private final int width;
|
||||
private final int length;
|
||||
private final int area;
|
||||
@Deprecated private final int area;
|
||||
private final BlockVector3 bot;
|
||||
private final BlockVector3 top;
|
||||
|
||||
public ChunkBlockQueue(BlockVector3 bot, BlockVector3 top, boolean biomes) {
|
||||
super(null, new Location(null, 0, 0, 0), new Location(null, 15, 255, 15));
|
||||
this.width = top.getX() - bot.getX()+ 1;
|
||||
this.width = top.getX() - bot.getX() + 1;
|
||||
this.length = top.getZ() - bot.getZ() + 1;
|
||||
this.area = width * length;
|
||||
this.result = new BlockState[256][][];
|
||||
@ -70,7 +71,9 @@ public class ChunkBlockQueue extends ScopedLocalBlockQueue {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override public BlockState getBlock(int x, int y, int z) {
|
||||
@Override
|
||||
@Nullable
|
||||
public BlockState getBlock(int x, int y, int z) {
|
||||
BlockState[][] blocksY = result[y];
|
||||
if (blocksY != null) {
|
||||
BlockState[] blocksYZ = blocksY[z];
|
||||
@ -81,7 +84,9 @@ public class ChunkBlockQueue extends ScopedLocalBlockQueue {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override public String getWorld() {
|
||||
@Override
|
||||
@Nullable
|
||||
public String getWorld() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ public final class BlockUtil {
|
||||
return FuzzyBlockState.builder().type(BlockTypes.AIR).build();
|
||||
}
|
||||
id = id.toLowerCase();
|
||||
BlockType type = BlockType.REGISTRY.get(id);
|
||||
BlockType type = BlockTypes.get(id);
|
||||
if (type != null) {
|
||||
return type.getDefaultState();
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.plot.util.world;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MathMan;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.item.ItemType;
|
||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
||||
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
||||
@ -27,4 +28,13 @@ public final class ItemUtil {
|
||||
if (!input.split("\\[", 2)[0].contains(":")) input = "minecraft:" + input;
|
||||
return ItemTypes.get(input);
|
||||
}
|
||||
|
||||
public static final ItemType[] parse(String commaDelimited) {
|
||||
String[] split = commaDelimited.split(",(?![^\\(\\[]*[\\]\\)])");
|
||||
ItemType[] result = new ItemType[split.length];
|
||||
for (int i = 0; i < split.length; i++) {
|
||||
result[i] = get(split[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
422
Core/src/main/resources/hu-HU.yml
Normal file
422
Core/src/main/resources/hu-HU.yml
Normal file
@ -0,0 +1,422 @@
|
||||
confirm:
|
||||
expired_confirm: $2Lejárt! Kérlek, írd be újra a parancsot!
|
||||
failed_confirm: $2Nincs függőben lévő művelet!
|
||||
requires_confirm: '$2Végre akarod hajtani: $1%s$2?&-$2Nem lehetséges!
|
||||
undone! If you are sure: $1/plot parancs az elfogadáshoz'
|
||||
move:
|
||||
move_success: $4Sikeresen áthelyezted.
|
||||
copy_success: $4Sikeresen másoltad.
|
||||
requires_unowned: $2Sikeresen elfoglaltad.
|
||||
debug:
|
||||
requires_unmerged: $2Nem lehet összeolvastani!
|
||||
debug_header: $1Debug Information&-
|
||||
debug_section: $2>> $1&l%val%
|
||||
debug_line: $2>> $1%var%$2:$1 %val%&-
|
||||
set:
|
||||
set_attribute: $4Successfully set %s0 set to %s1
|
||||
web:
|
||||
generating_link: $1Telek betöltése...
|
||||
generating_link_failed: $2Meghiúsult!
|
||||
save_failed: $2Sikertelen mentés
|
||||
load_null: $2Használd a $4/plot parancsot $2hogy vázlatos listát kapj
|
||||
load_failed: $2Sikertelen betöltés
|
||||
load_list: '$2Betöltéshez használd: $1/plot load #'
|
||||
save_success: $1Sikeresen mentve!
|
||||
compass:
|
||||
compass_target: $Sikeresen célbavetted a telked az iránytűvel!
|
||||
cluster:
|
||||
cluster_available_args: '$1A következő parancsokat használhatod: $4list$2, $4create$2,
|
||||
$4delete$2, $4resize$2, $4invite$2, $4kick$2, $4leave$2, $4members$2, $4info$2,
|
||||
$4tp$2, $4sethome'
|
||||
cluster_list_heading: $2Itt vannak a $1%s$2 telkek a világban
|
||||
cluster_list_element: $2 - $1%s&-
|
||||
cluster_intersection: '$2A tervezett terület átfedésben van, ennyivel : %s0'
|
||||
cluster_outside: '$2A tervezett terület kívül esik, ennyivel: %s0'
|
||||
cluster_added: $4Sikeresen megalkottad.
|
||||
cluster_deleted: $4Sikeresen törölted.
|
||||
cluster_resized: $4Sikeresen átméretezted.
|
||||
cluster_added_user: $4Sikeresen hozzáadtál egy játékost.
|
||||
cannot_kick_player: $2Nem tudod kizárni ezt a játékost
|
||||
cluster_invited: '$1Meghívást kaptál a következő telekhez: $2%s'
|
||||
cluster_removed: '$1Eltávolítottad: $2%s'
|
||||
cluster_kicked_user: $4Sikeresen kitiltottad a játékost
|
||||
invalid_cluster: '$1Érvénytelen teleknév: $2%s'
|
||||
cluster_not_added: $2A játékos nincs hozzáadva
|
||||
cluster_cannot_leave: $1Muszáj törölnöd, vagy átadnod a tulajdonjogot, mielőtt elhagyod.
|
||||
cluster_added_helper: $4Sikeresen hozzáadtál egy segítőt!
|
||||
cluster_removed_helper: $4Sikeresen eltávolítottál egy segítőt!
|
||||
cluster_regenerated: $4Újragenerálás folyamatban
|
||||
cluster_teleporting: $4Teleportálás...
|
||||
cluster_info: '$1Jelenlegi telek: $2%id%&-$1Név: $2%name%&-$1Tulaj: $2%owner%&-$1Méret:
|
||||
$2%size%&-$1Rights: $2%rights%'
|
||||
border:
|
||||
border: $2Határhoz értél
|
||||
worldedit masks:
|
||||
worldedit_bypass: $2&oKitérőhöz $4/plot wea
|
||||
worldedit_bypassed: $2A kitérő jelenleg akadályozva.
|
||||
gamemode:
|
||||
gamemode_was_bypassed: $1You bypassed the GameMode ($2{gamemode}$1) $1set for $2{plot}
|
||||
height limit:
|
||||
height_limit: $1A terület magasságlimitje $2{limit}
|
||||
records:
|
||||
notify_enter: $2%player $2belépett a telkedre ($1%plot$2)
|
||||
notify_leave: $2%player $2elhagyta a telked ($1%plot$2)
|
||||
swap:
|
||||
swap_overlap: $2A tervezett terület nem engedélyezi az átfedést
|
||||
swap_dimensions: $2A tervezett területnek hasonlónak kell lennie
|
||||
swap_syntax: $2/plot swap <id>
|
||||
swap_success: $4Sikeresen megváltoztatva
|
||||
comment:
|
||||
inbox_notification: '%s olvasatlan levél. Használd a /plot inbox parancsot'
|
||||
not_valid_inbox_index: $2Nincs üzenet %s
|
||||
inbox_item: $2 - $4%s
|
||||
comment_syntax: $2Hsználd /plot comment [X;Z] <%s> <comment>
|
||||
invalid_inbox: '$2Nem érvényes.&-$1Elfogadott érték: %s'
|
||||
no_perm_inbox: $2Nincs jogod
|
||||
no_perm_inbox_modify: $2Nincs jogod módosítani
|
||||
no_plot_inbox: $2You must stand in or supply a plot argument
|
||||
comment_removed_success: $4Sikeresen törölted a hozzászólást/s:n$2 - '$3%s$2'
|
||||
comment_removed_failure: $4Nem sikerült törölni a hozzászólást!
|
||||
comment_added: $4Hozzászóltál
|
||||
comment_header: $2&m---------&r $1Hozzászólások $2&m---------&r
|
||||
inbox_empty: $2Nincs hozzászólás
|
||||
console:
|
||||
not_console: $2Csak konzolról lehet végrehajtani.
|
||||
is_console: $2Csak egy játékos tudja végrehajtani.
|
||||
clipboard:
|
||||
paste_failed: '$2Nem sikerült másolni. Indok: $2%s'
|
||||
toggle:
|
||||
toggle_enabled: '$2Engedélyezett beállítások: %s'
|
||||
toggle_disabled: '$2Nem engedélyezett: %s'
|
||||
blocked command:
|
||||
command_blocked: $2Itt nem használhatod
|
||||
done:
|
||||
done_already_done: $2Ez a telek megkülönböztetett.
|
||||
done_not_done: $2Ez a telek nem megkülönböztetett.
|
||||
done_insufficient_complexity: $2Túl egyszerű. Adj meg több információt a parancs használatához!
|
||||
done_success: $1A telek megjelölve.
|
||||
done_removed: $1Folytathatod az építkezést.
|
||||
ratings:
|
||||
ratings_purged: $2Törölt értékelések a telekre
|
||||
rating_not_valid: $2Adj meg egy számot 1-től 10-ig
|
||||
rating_already_exists: $2Már értékelted a telket $2%s
|
||||
rating_applied: $4Sikeresen értékelted a telket $2%s
|
||||
rating_disliked: $4Sikeresen "dislikeoltad" a telket $2%s
|
||||
rating_liked: $4Sikeresen "likeoltad" a telket $2%s
|
||||
rating_not_your_own: $2Nem értékelheted saját telked
|
||||
rating_not_done: $2Csak a kész telkeket értékelheted
|
||||
rating_not_owned: $2Nem értékelheted a gazdátlan telket.
|
||||
tutorial:
|
||||
rate_this: $2Értékeld a telket!
|
||||
comment_this: '$2Hagyj visszajelzést: %s'
|
||||
economy:
|
||||
econ_disabled: $2Nem engedélyezett!
|
||||
cannot_afford_plot: "$2Nincs pénzed megvenni. Ennyibe kerül: $1%s"
|
||||
not_for_sale: $2Nem eladó telek
|
||||
cannot_buy_own: $2Nem veheted meg saját telked
|
||||
plot_sold: "$4A telked; $1%s0$4, eladva neki: $1%s1$4 ennyiért: $1$%s2"
|
||||
cannot_afford_merge: "$2Nincs pénzed egyesíteni. Ennyibe kerül: $1%s"
|
||||
added_balance: $1%s $2hozzáadva az egyenlegedhez
|
||||
removed_balance: $1%s $2levonva az egyenlegedből
|
||||
removed_granted_plot: $2Használsz %s plot grant(s), you've got $1%s $2left
|
||||
setup:
|
||||
setup_init: '$1Használd: $2/plot setup <value>'
|
||||
setup_step: '$3[$1Step %s0$3] $1%s1 $2- $1Várható: $2%s2 $1Alap: $2%s3'
|
||||
setup_invalid_arg: '$2%s0 nem érvényes %s1. Beállítás visszavonásához
|
||||
use: $1/plot setup cancel'
|
||||
setup_valid_arg: $2Érték $1%s0 $2változik %s1
|
||||
setup_finished: $4Teleportálva a megalkotott világba.
|
||||
setup_world_taken: $2%s már egy világ
|
||||
setup_missing_world: $2Meg kell adnod egy világnevet ($1/plot setup &l<world>$1
|
||||
<generator>$2)&-$1Additional commands:&-$2 - $1/plot setup <value>&-$2 - $1/plot
|
||||
setup back&-$2 - $1/plot setup cancel
|
||||
setup_missing_generator: $2Meg kell adnod egy generátort ($1/plot setup <world>
|
||||
&l<generator>&r$2)&-$1Additional commands:&-$2 - $1/plot setup <value>&-$2 - $1/plot
|
||||
setup back&-$2 - $1/plot setup cancel
|
||||
setup_invalid_generator: '$2Érvénytelen generátor. Lehetséges lehetőségek: %s'
|
||||
schematics:
|
||||
schematic_too_large: $2Túl nagy a telek ehhez!
|
||||
schematic_missing_arg: '$2Meg kell adnia egy argumentumot. Lehetséges értékek: $1save$2,
|
||||
$1paste $2, $1exportall$2, $1list'
|
||||
schematic_invalid: '$2Nem érvényes. Ok: $2%s'
|
||||
schematic_valid: $2Érvényes
|
||||
schematic_paste_failed: $2Sikertelen másolás
|
||||
schematic_paste_success: $4Sikeresen másoltad
|
||||
schematic_list: '$4Elmentve: $1%s'
|
||||
schematic_road_created: $1Új mentett útvonal.
|
||||
mca_file_size: "$1Jegyzet: .mca fileok mérete 512x512"
|
||||
schematic_exportall_started: "$1Exportálás indul..."
|
||||
schematic_exportall_world_args: "$1Szükség van világ érvre. Használd: $3/plot sch exportall <area>"
|
||||
schematic_exportall_mass_started: $1Megkezdődött az exportálás. Ez
|
||||
eltarthat egy ideig
|
||||
schematic_exportall_count: $1Talált $3%s $1telkek..
|
||||
schematic_exportall_finished: $1Kész az export
|
||||
schematic_exportall_single_finished: $1Kész az export
|
||||
schematic:
|
||||
schematic_exportall_world: $1Érvénytelen világ. Használd &3/plot sch exportall <area>
|
||||
error:
|
||||
task_in_process: $1A feladat már fut
|
||||
titles:
|
||||
title_entered_plot: '$1Telek: %world%;%x%;%z%'
|
||||
title_entered_plot_sub: "$4Tulajdonos %s"
|
||||
prefix_greeting: '$1%id%$2> '
|
||||
prefix_farewell: '$1%id%$2> '
|
||||
core:
|
||||
prefix: $3[$1P2$3] $2
|
||||
enabled: $1%s0 engedélyezve
|
||||
reload:
|
||||
reloaded_configs: $1A fordítások és a világbeállítások újra lettek töltve
|
||||
reload_failed: $2A fájlkonfigurációk újratöltése nem sikerült
|
||||
desc:
|
||||
desc_set: $2A telek leírása beállítva
|
||||
desc_unset: $2A telek leírása nincs beállítva
|
||||
alias:
|
||||
alias_set_to: $2név beállítása $1%alias%
|
||||
alias_removed: $2Teleknév törlése
|
||||
alias_too_long: $2A telek neve < 50 betű kell legyen
|
||||
alias_is_taken: $2Ez a név foglalt
|
||||
position:
|
||||
position_set: $1Az otthon az aktuális tartózkodási helyre van állítva
|
||||
position_unset: $1Az otthon visszaállt az alapértelmezett helyre
|
||||
home_argument: "$2Használd: a /plot set home [none]"
|
||||
permission:
|
||||
no_schematic_permission: $2Nincs engedélyezve, hogy használd
|
||||
$1%s
|
||||
no_permission: '$2Hiányzik az engedélyezési csomópont: $1%s'
|
||||
no_permission_event: '$2Hiányzik az engedélyezési csomópont: $1%s'
|
||||
no_plot_perms: $2Ehhez a telek tulajdonosának kell lenned
|
||||
cant_claim_more_plots: $2Nem tudsz több telket elfoglalni.
|
||||
cant_claim_more_clusters: $2Nem tudsz többet elfoglalni
|
||||
cant_transfer_more_plots: $2Nem tudsz több telket küldeni neki
|
||||
cant_claim_more_plots_num: $2Nem tudsz több, mint $1%s $2telket egyszerre
|
||||
merge_request_confirm: "Összeolvasztási kérelem tőle: %s"
|
||||
merge:
|
||||
merge_not_valid: $2Ez a kérelem lejárt.
|
||||
merge_accepted: $2Összeolvasztás elfogadva
|
||||
success_merge: $2Osszeolvsztva!
|
||||
merge_requested: $2Sikeresen elküldted az összeolvasztási kérelmet
|
||||
no_perm_merge: '$2Nem vagy ennek tuladonosa: $1%plot%'
|
||||
no_available_automerge: $2Nem rendelkezel a szomszédos telkekkel a megadott irányban
|
||||
vagy nem megengedett a kívánt méret.
|
||||
unlink_impossible: $2You can only unlink a mega-plot
|
||||
unmerge_cancelled: $1Unlink has been cancelled
|
||||
unlink_success: $2Successfully unlinked plots.
|
||||
commandconfig:
|
||||
not_valid_subcommand: $2Nem érvényes parancs
|
||||
did_you_mean: '$2erre gondoltál?: $1%s'
|
||||
subcommand_set_options_header: '$2Lehetséges értékek: '
|
||||
command_syntax: '$1Használat: $2%s'
|
||||
flag_tutorial_usage: '$1Adminisztrátor állítja be a zászlót: $2%s'
|
||||
errors:
|
||||
invalid_player: '$2Nem található: $1%s$2.'
|
||||
invalid_player_offline: '$2A játékos online: $1%s.'
|
||||
invalid_command_flag: '$2Érvénytelen parancs: %s0'
|
||||
error: '$2Hiba lépett fel: %s'
|
||||
command_went_wrong: $2Probléma merült fel...
|
||||
no_free_plots: $2Nincsenek szabad telkek
|
||||
not_in_plot: $2Nem egy telken vagy
|
||||
not_loaded: $2A telek nem tudott betölteni
|
||||
not_in_cluster: $2Ehez egy telekcsoporton kell legyél
|
||||
not_in_plot_world: $2Nem vagy a telek területén
|
||||
plotworld_incompatible: $2A két világnak kompatibilisnek kell lennie
|
||||
not_valid_world: $2Nem érvényes világ (kis- és nagybetűk fontosak)
|
||||
|
||||
not_valid_plot_world: $2Nem érvényes telek (kis- és magybetűk fontosak)
|
||||
no_plots: $2Nincs több telked
|
||||
wait_for_timer: $2A beállított blokkidőzítő hozzád van kötve.
|
||||
Várj, amíg befejeződik
|
||||
paste:
|
||||
debug_report_created: '$1Feltöltött egy teljes hibakeresést ide: $1%url%'
|
||||
purge:
|
||||
purge_success: $4Sikeresen kitisztítva %s telek
|
||||
trim:
|
||||
trim_in_progress: A világrendező már folyamatban van!
|
||||
block list:
|
||||
block_list_separator: '$1,$2 '
|
||||
biome:
|
||||
need_biome: $2Meg kell adnod egy érvényes biomot.
|
||||
biome_set_to: $2Telek biom változott $2
|
||||
teleport:
|
||||
teleported_to_plot: $1Teleportálva lettél
|
||||
teleported_to_road: $2Teleportálva lettél az útra
|
||||
teleport_in_seconds: $1Teleportálás %s másodperc múlva. Ne mozogj...
|
||||
teleport_failed: $2Teleportálás megszakadva mozgás vagy támadás miatt
|
||||
set block:
|
||||
set_block_action_finished: $1Az utolsó művelet befejeződött.
|
||||
unsafe:
|
||||
debugallowunsafe_on: $2Nem biztonságos tevékenységek megengedettek
|
||||
debugallowunsafe_off: $2Nem biztonságos tevékenységek nem megengedettek
|
||||
invalid:
|
||||
not_valid_block: '$2Ez''s nem érvényes : %s'
|
||||
not_allowed_block: '$2Nem engedélyezett: %s'
|
||||
not_valid_number: '$2Nem érvényes szám a tartományon belül: %s'
|
||||
not_valid_plot_id: $2Nem érvényes telek id.
|
||||
found_no_plots: $2Nem található ezzel telek
|
||||
need:
|
||||
need_block: $2Meg kell adnod a blokkot
|
||||
near:
|
||||
plot_near: '$1Játékosok: %s0'
|
||||
info:
|
||||
none: Senki
|
||||
now: Most
|
||||
never: Soha
|
||||
unknown: Ismeretlen
|
||||
server: Szerver
|
||||
everyone: Mindenki
|
||||
plot_unowned: $2Az aktuális telek tulajdonosának kell lennie a művelet végrehajtásához
|
||||
plot_info_unclaimed: $2 $1%s$2 nem foglalt
|
||||
plot_info_header: $3&m---------&r $1INFORMÁCIÓ $3&m---------
|
||||
plot_info_hidden: $2Nem tudod megnézni az információkat
|
||||
plot_info: '$1ID: $2%id%$1&-$1Teleknév: $2%alias%$1&-$1Tulaj: $2%owner%$1&-$1Biom:
|
||||
$2%biome%$1&-$1Építészek: $2%build%$1&-$1Értékelés: $2%rating%&-$1Megnézve: $2%seen%&-$1Trusted:
|
||||
$2%trusted%$1&-$1Tagok: $2%members%$1&-$1Kitiltva: $2%denied%$1&-$1Zászlók: $2%flags%'
|
||||
plot_info_footer: $3&m---------&r $1INFORMÁCIÓ $3&m---------
|
||||
plot_info_trusted: $1Hozzáadva:$2 %trusted%
|
||||
plot_info_members: $1Tagok:$2 %members%
|
||||
plot_info_denied: $1Kitiltva:$2 %denied%
|
||||
plot_info_flags: $1Zászlók:$2 %flags%
|
||||
plot_info_biome: $1Biom:$2 %biome%
|
||||
plot_info_rating: $1Értékelés:$2 %rating%
|
||||
plot_info_likes: $1Like arány:$2 %likes%%
|
||||
plot_info_owner: $1Tulaj:$2 %owner%
|
||||
plot_info_id: $1ID:$2 %id%
|
||||
plot_info_alias: $1Teleknév:$2 %alias%
|
||||
plot_info_size: $1Méret:$2 %size%
|
||||
plot_info_seen: $1Megnézve:$2 %seen%
|
||||
plot_user_list: ' $1%user%$2,'
|
||||
plot_flag_list: $1%s0:%s1$2
|
||||
info_syntax_console: $2/plot info X;Z
|
||||
working:
|
||||
generating_component: $1Megkezdődött a generálás a beállításokból
|
||||
clearing_done: $4Tisztítás sikeres! Took %sms.
|
||||
deleting_done: $4Törlés sikeres! Took %sms.
|
||||
plot_not_claimed: $2Tulajdonos nélküli
|
||||
plot_is_claimed: $2Elfoglalva
|
||||
claimed: $4Sikeresen elfoglaltad a telket!
|
||||
list:
|
||||
comment_list_header_paged: $2(Oldal $1%cur$2/$1%max$2) $1Lista %amount% comments
|
||||
clickable: ' (interactive)'
|
||||
area_list_header_paged: $2(Oldal $1%cur$2/$1%max$2) $1Lista %amount% területek
|
||||
plot_list_header_paged: $2(Oldal $1%cur$2/$1%max$2) $1Lista%amount% telkek
|
||||
plot_list_header: $1Lista %word% telkek
|
||||
plot_list_item: $2>> $1%id$2:$1%world $2- $1%owner
|
||||
plot_list_item_ordered: $2[$1%in$2] >> $1%id$2:$1%world $2- $1%owner
|
||||
plot_list_footer: $2>> $1%word% összesen $2%num% $1azzal %plot%.
|
||||
chat:
|
||||
plot_chat_spy_format: '$2[$1Plot Spy$2][$1%plot_id%$2] $1%sender%$2: $1%msg%'
|
||||
plot_chat_format: '$2[$1Plot Chat$2][$1%plot_id%$2] $1%sender%$2: $1%msg%'
|
||||
plot_chat_forced: $2This world forces everyone to use plot chat.
|
||||
plot_chat_on: $4A csevegési csevegés engedélyezve van.
|
||||
plot_chat_off: $4A csevegési csevegés letiltva.
|
||||
deny:
|
||||
denied_added: $4Sikeresen elutasította a játékost ebből a telekből
|
||||
denied_need_argument: $2Az érvek hiányoznak. $1/plot denied add <név> $2or $1/plot
|
||||
denied remove <név>
|
||||
was_not_denied: $2Ezt a játékost nem tagadták meg ezen a teleken
|
||||
you_got_denied: $4Elutasítják attól a cselekménytől, amelyen korábban volt, és teleportállak
|
||||
spawnra
|
||||
cant_remove_owner: $2Nem távolíthatja el a telek tulajdonosát
|
||||
kick:
|
||||
you_got_kicked: $4Ki rúgtak!
|
||||
flag:
|
||||
flag_key: '$2Kúlcs: %s'
|
||||
flag_type: '$2típus: %s'
|
||||
flag_desc: '$2leírás: %s'
|
||||
not_valid_flag: $2Ez nem érvényes érték
|
||||
not_valid_flag_suggested: '$2Ez nem érvényes érték. Úgy értetted: $1%s'
|
||||
not_valid_value: $2A jelző értékeknek alfanumerikusnak kell lenniük
|
||||
flag_not_removed: $2Az értéket nem lehetett eltávolítani
|
||||
flag_not_added: $2Az érték hozzáadása nem sikerült
|
||||
flag_removed: $4Az érték sikeresen eltávolítva
|
||||
flag_added: $4Az érték sikeresen hozzáadva
|
||||
flag_list_entry: '$2%s: $1%s'
|
||||
flags:
|
||||
flag_category_string: String Flags
|
||||
flag_category_integers: Integer Flags
|
||||
flag_category_teleport_deny: Teleport Deny Flag
|
||||
flag_category_string_list: String List Flags
|
||||
flag_category_weather: Weather Flags
|
||||
flag_category_block_list: Material Flags
|
||||
flag_category_intervals: Interval Flags
|
||||
flag_category_integer_list: Integer List Flags
|
||||
flag_category_gamemode: Game Mode Flags
|
||||
flag_category_enum: Generic Enum Flags
|
||||
flag_category_decimal: Decimal Flags
|
||||
flag_category_boolean: Boolean Flags
|
||||
flag_category_mixed: Mixed Value Flags
|
||||
flag_error_boolean: Flag value must be a boolean (true|false)
|
||||
flag_error_enum: 'Must be one of: %s'
|
||||
flag_error_gamemode: 'Flag value must be a gamemode: ''survival'', ''creative'',
|
||||
''adventure'' or ''spectator.'
|
||||
flag_error_integer: Flag value must be a whole number
|
||||
flag_error_integer_list: Flag value must be an integer list
|
||||
flag_error_interval: Value(s) must be numeric. /plot set flag <flag> <interval>
|
||||
[amount]
|
||||
flag_error_keep: Flag value must be a timestamp or a boolean
|
||||
flag_error_long: Flag value must be a whole number (large numbers allowed)
|
||||
flag_error_plotblocklist: Flag value must be a block list
|
||||
flag_error_price: Flag value must be a positive number.
|
||||
flag_error_string: Flag value must be alphanumeric. Some special characters are
|
||||
allowed.
|
||||
flag_error_stringlist: Flag value must be a string list
|
||||
flag_error_weather: 'Flag must be a weather: ''rain'' or ''sun'''
|
||||
trusted:
|
||||
trusted_added: $4Sikeresen megbízott egy játékosban a telekben
|
||||
was_not_added: $2A játékos nem volt megbízható ebben a telekben
|
||||
plot_removed_user: $1Plot %s of which you were added to has been deleted due to
|
||||
owner inactivity
|
||||
member:
|
||||
removed_players: $2Eltávolított %s játékosok ebből a telekből.
|
||||
already_owner: '$2Ez a felhasználó már a telek tulajdonosa: %s0'
|
||||
already_added: '$2A felhasználót már hozzáadják ehhez a kategóriához: %s0'
|
||||
member_added: $4Ez a felhasználó most építhet, amíg a telek tulajdonosa online
|
||||
plot_max_members: $2Ez a cselekmény nem adhat hozzá további játékosokat
|
||||
owner:
|
||||
set_owner: $4Sikeresen beállította a telek tulajdonosát
|
||||
set_owner_cancelled: $2A beállított tulajdonos műveletet töröltük
|
||||
set_owner_missing_player: '$1Meg kell adnia egy új tulajdonosot. A helyes használata:
|
||||
$2/plot setowner <tulaj>'
|
||||
now_owner: $4Most Ön a telek tulajdonosa %s
|
||||
signs:
|
||||
owner_sign_line_1: '$1ID: $1%id%'
|
||||
owner_sign_line_2: '$1tulaj:'
|
||||
owner_sign_line_3: $2%plr%
|
||||
owner_sign_line_4: $3elfoglalta
|
||||
help:
|
||||
help_header: $3&m---------&r $1Telek Segítség $3&m---------
|
||||
help_page_header: '$1Kategória: $2%category%$2,$1 Oldal: $2%current%$3/$2%max%$2'
|
||||
help_footer: $3&m---------&r $1Telek segítség $3&m---------
|
||||
help_info_item: $1/plot help %category% $3- $2%category_desc%
|
||||
help_item: $1%usage% [%alias%]&- $3- $2%desc%&-
|
||||
help_display_all_commands: Az összes parancs megjelenítése
|
||||
direction: '$1Jelenlegi irány: %dir%'
|
||||
generator_bucket:
|
||||
bucket_entries_ignored: $2A teljes vödörérték legalább 1 vagy annál nagyobb. Blokkok nélkül
|
||||
egy meghatározott esélyt figyelmen kívül hagynak
|
||||
category:
|
||||
command_category_claiming: Elfoglalás
|
||||
command_category_teleport: Teleportálás
|
||||
command_category_settings: Védelem
|
||||
command_category_chat: Chat
|
||||
command_category_schematic: Web
|
||||
command_category_appearance: Kozmetik
|
||||
command_category_info: Infó
|
||||
command_category_debug: Debug
|
||||
command_category_administration: Admin
|
||||
grants:
|
||||
granted_plots: '$1Eredmény: $2%s $1támogatások maradtak'
|
||||
granted_plot: $1Ön megadta %s0 telek $2%s1
|
||||
granted_plot_failed: '$1A támogatás nem sikerült: $2%s'
|
||||
legacyconfig:
|
||||
legacy_config_found: Régi konfigurációs fájlt észleltünk. A konverzió lesz
|
||||
kísérletet.
|
||||
legacy_config_backup: A copy of worlds.yml $1have been saved in the file worlds.yml.old$1.
|
||||
legacy_config_replaced: '> %s has been replaced with %s'
|
||||
legacy_config_done: The conversion has finished. PlotSquared will now be disabled
|
||||
and the new configuration file will be used at next startup. Please review the
|
||||
new worlds.yml file. Please note that schematics will not be converted, as we
|
||||
are now using WorldEdit to handle schematics. You need to re-generate the schematics.
|
||||
legacy_config_conversion_failed: Failed to convert the legacy configuration file.
|
||||
See stack trace for information.
|
||||
'-':
|
||||
custom_string: '-'
|
@ -10,6 +10,8 @@ import com.github.intellectualsites.plotsquared.plot.util.EventUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.EventUtilTest;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.world.BlockUtil;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.item.ItemType;
|
||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
@ -22,7 +24,7 @@ import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class FlagTest {
|
||||
|
||||
private Object testBlock;
|
||||
private ItemType testBlock;
|
||||
private Flag<? extends Collection<?>> use = Flags.USE;
|
||||
|
||||
@Before public void setUp() throws Exception {
|
||||
@ -30,23 +32,23 @@ public class FlagTest {
|
||||
DBFunc.dbManager = new AbstractDBTest();
|
||||
}
|
||||
|
||||
@Test public void flagTest() throws Exception {
|
||||
Plot plot = new Plot(null, new PlotId(0, 0));
|
||||
plot.owner = UUID.fromString("84499644-ad72-454b-a19d-f28c28df382b");
|
||||
//plot.setFlag(use, use.parseValue("33,33:1,6:4")); //TODO fix this so FlagTest will run during compile
|
||||
Optional<? extends Collection> flag = plot.getFlag(use);
|
||||
if (flag.isPresent()) {
|
||||
System.out.println(Flags.USE.valueToString(flag.get()));
|
||||
testBlock = BlockUtil.get((short) 1, (byte) 0);
|
||||
flag.get().add(testBlock);
|
||||
}
|
||||
flag.ifPresent(collection -> System.out.println(Flags.USE.valueToString(collection)));
|
||||
Optional<Set<BlockType>> flag2 = plot.getFlag(Flags.USE);
|
||||
if (flag2.isPresent()) {
|
||||
// assertThat(flag2.get(), (Matcher<? super Set<BlockType>>) IsCollectionContaining.hasItem(testBlock));
|
||||
}
|
||||
if (flag.isPresent() && flag2.isPresent()) {
|
||||
assertEquals(flag.get(), flag2.get());
|
||||
}
|
||||
}
|
||||
// @Test public void flagTest() throws Exception {
|
||||
// Plot plot = new Plot(null, new PlotId(0, 0));
|
||||
// plot.owner = UUID.fromString("84499644-ad72-454b-a19d-f28c28df382b");
|
||||
// //plot.setFlag(use, use.parseValue("33,33:1,6:4")); //TODO fix this so FlagTest will run during compile
|
||||
// Optional<? extends Collection> flag = plot.getFlag(use);
|
||||
// if (flag.isPresent()) {
|
||||
// System.out.println(Flags.USE.valueToString(flag.get()));
|
||||
// testBlock = ItemTypes.BONE_BLOCK;
|
||||
// flag.get().add(testBlock);
|
||||
// }
|
||||
// flag.ifPresent(collection -> System.out.println(Flags.USE.valueToString(collection)));
|
||||
// Optional<Set<BlockType>> flag2 = plot.getFlag(Flags.USE);
|
||||
// if (flag2.isPresent()) {
|
||||
// // assertThat(flag2.get(), (Matcher<? super Set<BlockType>>) IsCollectionContaining.hasItem(testBlock));
|
||||
// }
|
||||
// if (flag.isPresent() && flag2.isPresent()) {
|
||||
// assertEquals(flag.get(), flag2.get());
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import com.github.intellectualsites.plotsquared.nukkit.util.NukkitUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.TeleportCause;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.UUID;
|
||||
@ -107,7 +108,7 @@ public class NukkitPlayer extends PlotPlayer {
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void teleport(Location to) {
|
||||
@Override public void teleport(Location to, TeleportCause cause) {
|
||||
if (Math.abs(to.getX()) >= 30000000 || Math.abs(to.getZ()) >= 30000000) {
|
||||
return;
|
||||
}
|
||||
|
22
README.md
22
README.md
@ -4,6 +4,10 @@
|
||||
|
||||
---
|
||||
|
||||
PlotSquared is a land and world management plugin for Minecraft.
|
||||
It includes several highly configurable world generators.
|
||||
You can create plots of land in existing worlds using plot clusters, or you can have a full world of plots.
|
||||
|
||||
For the end user, PlotSquared is packed with a tonne of cool features.
|
||||
It allows you to merge plots, and build together with your friends.
|
||||
You can also change a lot of plot specific settings in the form of
|
||||
@ -25,7 +29,7 @@ is to provide a lag-free and smooth experience.
|
||||
### Developer Resources
|
||||
* [[JavaDoc](https://ci.athion.net/job/PlotSquared-Breaking/javadoc/)]
|
||||
* [[Maven Repo (CI)](http://ci.athion.net/job/PlotSquared-Breaking/ws/mvn/)]
|
||||
* [API Documentation](https://github.com/IntellectualSites/PlotSquared/wiki/Developer-documentation-(WIP))
|
||||
* [API Documentation](https://github.com/IntellectualSites/PlotSquared/wiki/Developer-Documentation)
|
||||
|
||||
# Building
|
||||
Gradle is the **recommended** way to build the project. Use `./gradlew build` in the main project directory to build the project. Gradle is required if you intend to build or develop the Sponge module.
|
||||
@ -48,17 +52,5 @@ Suggestions are welcome! We have a separate issue tracker for suggestions, that
|
||||
* [HoloPlots](https://www.spigotmc.org/resources/holoplots.4880/)
|
||||
|
||||
# Sponsors
|
||||
<p align="center"><a href="https://www.jetbrains.com/idea/" title="IntelliJ IDEA"><img height="75" src="https://i.imgur.com/xa2XsRN.png"/></a><br>
|
||||
IntelliJ IDEA is a Java integrated development environment (IDE) for developing computer software. It is developed by <a href="https://jetbrains.com">JetBrains</a> and our top used development tool. Every aspect of IntelliJ IDEA is specifically designed to maximize developer productivity.
|
||||
Together, the powerful static code analysis and ergonomic design make development not only productive but also an enjoyable experience.</p>
|
||||
<p align="center"><a href="https://www.yourkit.com/java/profiler/" title="YourKit Java Profiler"><img height="75" src="https://www.yourkit.com/images/yklogo.png"/></a><br>
|
||||
YourKit supports open source projects with innovative and intelligent tools for monitoring and profiling Java and .NET applications.
|
||||
YourKit is the creator of <a href="https://www.yourkit.com/java/profiler/">YourKit Java Profiler</a>, <a href="https://www.yourkit.com/.net/profiler/">YourKit .NET Profiler</a>, and <a href="https://www.yourkit.com/youmonitor/">YourKit YouMonitor</a>. We are using YourKit to profile the performance of our plugins.</p>
|
||||
<p align="center"><a href="https://www.athion.net/" title="Athion"><img height="150" src="https://i.imgur.com/Z4E1Hcb.png"/></a><br>
|
||||
<a href="https://athion.net">Athion</a> is the result of the merging of two of the oldest creative servers around in the community – Mithrintia and Pwego-Insomnia – fusing together to perfect a creative experience like no other to develop and harness your skills.</p>
|
||||
<p align="center"><a href="https://www.buildersrefuge.com/" title="Builder's Refuge"><img height="150" src="https://i.imgur.com/mjT5Ogz.png"/></a><br>
|
||||
Welcome to the <a href="https://www.buildersrefuge.com/">Builders's Refuge</a>. The refuge is a passion project we started to accommodate professional Minecraft builders who are looking for a personal or commercial space to build and create art. We offer premium services at no charge along with a network of other builders and resources to help you become successful.
|
||||
</p>
|
||||
<p align="center"><a href="https://ajgaming.net/" title="AJGaming Network"><img height="120" src="https://ajgaming.net/images/AJGaming.png"/></a><br>
|
||||
The <a href="https://ajgaming.net/">AJGaming Network</a> is a modded and vanilla network. Either delve into magic on our magic servers, fight your enemies on our hardcore PvP modpacks or have a good time on our vanilla servers. The mods for our modpacks are handpicked by suggestions from our community making sure we can crate packs you love to play.
|
||||
</p>
|
||||
Our official sponsor list can be found [here](https://intellectualsites.github.io/download/sponsors.html). <br>
|
||||
If you are interested and want to be listed here, [contact us](https://intellectualsites.github.io/download/contact.html).
|
||||
|
@ -5,6 +5,7 @@ import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.commands.RequiredType;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.TeleportCause;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.PlotGameMode;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.PlotWeather;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
||||
@ -85,7 +86,7 @@ public class SpongePlayer extends PlotPlayer {
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void teleport(Location location) {
|
||||
@Override public void teleport(Location location, TeleportCause cause) {
|
||||
if ((Math.abs(location.getX()) >= 30000000) || (Math.abs(location.getZ()) >= 30000000)) {
|
||||
return;
|
||||
}
|
||||
|
14
build.gradle
14
build.gradle
@ -12,14 +12,14 @@ buildscript {
|
||||
configurations.all {
|
||||
resolutionStrategy {
|
||||
force("org.ow2.asm:asm:7.2")
|
||||
force("org.jetbrains:annotations:17.0.0")
|
||||
force("org.jetbrains:annotations:18.0.0")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id "maven-publish"
|
||||
id "org.ajoberstar.grgit" version "3.1.1"
|
||||
id "org.ajoberstar.grgit" version "4.0.1"
|
||||
}
|
||||
|
||||
group = "com.github.intellectualsites.plotsquared"
|
||||
@ -83,26 +83,26 @@ subprojects {
|
||||
because("Minecraft uses Guava 21 as of 1.13")
|
||||
}
|
||||
compileOnly("org.jetbrains:annotations:17.0.0")
|
||||
compileClasspath("org.projectlombok:lombok:1.18.8")
|
||||
compileClasspath("org.projectlombok:lombok:1.18.10")
|
||||
testCompileOnly("org.projectlombok:lombok:1.18.8")
|
||||
annotationProcessor("org.projectlombok:lombok:1.18.8")
|
||||
testAnnotationProcessor("org.projectlombok:lombok:1.18.8")
|
||||
testImplementation("junit:junit:4.12")
|
||||
testImplementation("junit:junit:4.13")
|
||||
}
|
||||
|
||||
configurations.all {
|
||||
resolutionStrategy {
|
||||
force("junit:junit:4.12")
|
||||
force("com.google.guava:guava:21.0")
|
||||
force("org.jetbrains:annotations:17.0.0")
|
||||
force("org.jetbrains:annotations:18.0.0")
|
||||
force("com.google.code.findbugs:jsr305:3.0.2")
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url = "http://maven.sk89q.com/repo/" }
|
||||
maven { url = "http://repo.maven.apache.org/maven2" }
|
||||
maven { url = "https://maven.enginehub.org/repo/" }
|
||||
maven { url = "https://repo.maven.apache.org/maven2" }
|
||||
maven { url = "https://jitpack.io" }
|
||||
}
|
||||
|
||||
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
35
gradlew
vendored
35
gradlew
vendored
@ -7,7 +7,7 @@
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@ -125,8 +125,8 @@ if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
@ -154,19 +154,19 @@ if $cygwin ; then
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
@ -175,14 +175,9 @@ save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=$(save "$@")
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
fi
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
|
2
gradlew.bat
vendored
2
gradlew.bat
vendored
@ -5,7 +5,7 @@
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem http://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
Reference in New Issue
Block a user