mirror of
https://github.com/TotalFreedomMC/TF-PlotSquared.git
synced 2024-12-22 16:05:02 +00:00
Merge https://github.com/IntellectualSites/PlotSquared into 1.16
This commit is contained in:
commit
f9a49ee256
12 changed files with 92 additions and 88 deletions
16
.github/stale.yml
vendored
16
.github/stale.yml
vendored
|
@ -1,16 +0,0 @@
|
||||||
# Number of days of inactivity before an issue becomes stale
|
|
||||||
daysUntilStale: 60
|
|
||||||
# Number of days of inactivity before a stale issue is closed
|
|
||||||
daysUntilClose: 7
|
|
||||||
# Issues with these labels will never be considered stale
|
|
||||||
exemptLabels:
|
|
||||||
- [‼] high priority
|
|
||||||
# Label to use when marking an issue as stale
|
|
||||||
staleLabel: Old
|
|
||||||
# Comment to post when marking an issue as stale. Set to `false` to disable
|
|
||||||
markComment: >
|
|
||||||
This issue has been automatically marked as stale because it has not had
|
|
||||||
recent activity. It will be closed if no further activity occurs. Thank you
|
|
||||||
for your contributions.
|
|
||||||
# Comment to post when closing a stale issue. Set to `false` to disable
|
|
||||||
closeComment: false
|
|
20
.github/workflows/build.yml
vendored
Normal file
20
.github/workflows/build.yml
vendored
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
name: "build"
|
||||||
|
|
||||||
|
on: ["pull_request", "push"]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
java: ["1.8", "11"]
|
||||||
|
os: ["ubuntu-18.04"]
|
||||||
|
runs-on: "${{ matrix.os }}"
|
||||||
|
steps:
|
||||||
|
- name: "Checkout Repository"
|
||||||
|
uses: "actions/checkout@v2.3.4"
|
||||||
|
- name: "Setup JDK ${{ matrix.java }}"
|
||||||
|
uses: "actions/setup-java@v1.4.3"
|
||||||
|
with:
|
||||||
|
java-version: "${{ matrix.java }}"
|
||||||
|
- name: "Clean Build"
|
||||||
|
run: "./gradlew clean build"
|
27
.github/workflows/gradle.yml
vendored
27
.github/workflows/gradle.yml
vendored
|
@ -1,27 +0,0 @@
|
||||||
name: Java CI
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- 'v5'
|
|
||||||
- 'v6'
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- 'v5'
|
|
||||||
- 'v6'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
runs-on: ubuntu-18.04
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v2.0.0
|
|
||||||
- name: Setup Java JDK 1.8
|
|
||||||
uses: actions/setup-java@v1.3.0
|
|
||||||
with:
|
|
||||||
java-version: 1.8
|
|
||||||
- name: Gradle Wrapper Validation
|
|
||||||
uses: gradle/wrapper-validation-action@v1
|
|
||||||
- name: Test with Gradle
|
|
||||||
run: ./gradlew clean build
|
|
12
.github/workflows/validate-gradle-wrapper.yml
vendored
Normal file
12
.github/workflows/validate-gradle-wrapper.yml
vendored
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
name: "validate gradle wrapper"
|
||||||
|
|
||||||
|
on: ["pull_request", "push"]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: "ubuntu-18.04"
|
||||||
|
steps:
|
||||||
|
- name: "Checkout Repository"
|
||||||
|
uses: "actions/checkout@v2.3.4"
|
||||||
|
- name: "Validate Gradle Wrapper"
|
||||||
|
uses: "gradle/wrapper-validation-action@v1.0.3"
|
|
@ -187,17 +187,24 @@ public class BlockEventListener implements Listener {
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
||||||
public void onPhysicsEvent(BlockPhysicsEvent event) {
|
public void onPhysicsEvent(BlockPhysicsEvent event) {
|
||||||
|
Block block = event.getBlock();
|
||||||
|
Location location = BukkitUtil.getLocation(block.getLocation());
|
||||||
|
PlotArea area = location.getPlotArea();
|
||||||
|
if (area == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Plot plot = area.getOwnedPlotAbs(location);
|
||||||
|
if (plot == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (event.getChangedType().hasGravity() && plot.getFlag(DisablePhysicsFlag.class)) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
sendBlockChange(event.getBlock().getLocation(), event.getBlock().getBlockData());
|
||||||
|
plot.debug("Prevented block physics and resent block change because disable-physics = true");
|
||||||
|
return;
|
||||||
|
}
|
||||||
switch (event.getChangedType()) {
|
switch (event.getChangedType()) {
|
||||||
case COMPARATOR: {
|
case COMPARATOR: {
|
||||||
Block block = event.getBlock();
|
|
||||||
Location location = BukkitUtil.getLocation(block.getLocation());
|
|
||||||
if (location.isPlotArea()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Plot plot = location.getOwnedPlotAbs();
|
|
||||||
if (plot == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!plot.getFlag(RedstoneFlag.class)) {
|
if (!plot.getFlag(RedstoneFlag.class)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
plot.debug("Prevented comparator update because redstone = false");
|
plot.debug("Prevented comparator update because redstone = false");
|
||||||
|
@ -211,16 +218,6 @@ public class BlockEventListener implements Listener {
|
||||||
case TURTLE_EGG:
|
case TURTLE_EGG:
|
||||||
case TURTLE_HELMET:
|
case TURTLE_HELMET:
|
||||||
case TURTLE_SPAWN_EGG: {
|
case TURTLE_SPAWN_EGG: {
|
||||||
Block block = event.getBlock();
|
|
||||||
Location location = BukkitUtil.getLocation(block.getLocation());
|
|
||||||
PlotArea area = location.getPlotArea();
|
|
||||||
if (area == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Plot plot = area.getOwnedPlotAbs(location);
|
|
||||||
if (plot == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (plot.getFlag(DisablePhysicsFlag.class)) {
|
if (plot.getFlag(DisablePhysicsFlag.class)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
plot.debug("Prevented block physics because disable-physics = true");
|
plot.debug("Prevented block physics because disable-physics = true");
|
||||||
|
@ -229,21 +226,11 @@ public class BlockEventListener implements Listener {
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
if (Settings.Redstone.DETECT_INVALID_EDGE_PISTONS) {
|
if (Settings.Redstone.DETECT_INVALID_EDGE_PISTONS) {
|
||||||
Block block = event.getBlock();
|
|
||||||
switch (block.getType()) {
|
switch (block.getType()) {
|
||||||
case PISTON:
|
case PISTON:
|
||||||
case STICKY_PISTON:
|
case STICKY_PISTON:
|
||||||
org.bukkit.block.data.Directional piston =
|
org.bukkit.block.data.Directional piston =
|
||||||
(org.bukkit.block.data.Directional) block.getBlockData();
|
(org.bukkit.block.data.Directional) block.getBlockData();
|
||||||
Location location = BukkitUtil.getLocation(block.getLocation());
|
|
||||||
PlotArea area = location.getPlotArea();
|
|
||||||
if (area == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Plot plot = area.getOwnedPlotAbs(location);
|
|
||||||
if (plot == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
switch (piston.getFacing()) {
|
switch (piston.getFacing()) {
|
||||||
case EAST:
|
case EAST:
|
||||||
location.setX(location.getX() + 1);
|
location.setX(location.getX() + 1);
|
||||||
|
@ -261,8 +248,7 @@ public class BlockEventListener implements Listener {
|
||||||
Plot newPlot = area.getOwnedPlotAbs(location);
|
Plot newPlot = area.getOwnedPlotAbs(location);
|
||||||
if (!plot.equals(newPlot)) {
|
if (!plot.equals(newPlot)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
plot.debug(
|
plot.debug("Prevented piston update because of invalid edge piston detection");
|
||||||
"Prevented piston update because of invalid edge piston detection");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,6 +201,9 @@ public class EntityEventListener implements Listener {
|
||||||
if (plot == null || plot.getFlag(DisablePhysicsFlag.class)) {
|
if (plot == null || plot.getFlag(DisablePhysicsFlag.class)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
if (plot != null) {
|
if (plot != null) {
|
||||||
|
if (block.getType().hasGravity()) {
|
||||||
|
BlockEventListener.sendBlockChange(block.getLocation(), block.getBlockData());
|
||||||
|
}
|
||||||
plot.debug("Falling block event was cancelled because disable-physics = true");
|
plot.debug("Falling block event was cancelled because disable-physics = true");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -85,6 +85,7 @@ import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.block.data.Waterlogged;
|
import org.bukkit.block.data.Waterlogged;
|
||||||
import org.bukkit.command.PluginCommand;
|
import org.bukkit.command.PluginCommand;
|
||||||
import org.bukkit.entity.ArmorStand;
|
import org.bukkit.entity.ArmorStand;
|
||||||
|
import org.bukkit.entity.Boat;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.HumanEntity;
|
import org.bukkit.entity.HumanEntity;
|
||||||
|
@ -100,6 +101,7 @@ import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.event.block.Action;
|
||||||
import org.bukkit.event.entity.EntityPickupItemEvent;
|
import org.bukkit.event.entity.EntityPickupItemEvent;
|
||||||
|
import org.bukkit.event.entity.EntityPlaceEvent;
|
||||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||||
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
|
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
|
||||||
import org.bukkit.event.hanging.HangingPlaceEvent;
|
import org.bukkit.event.hanging.HangingPlaceEvent;
|
||||||
|
@ -1068,6 +1070,34 @@ public class PlayerEventListener extends PlotListener implements Listener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Boats can sometimes be placed on interactable blocks such as levers,
|
||||||
|
// see PS-175. Armor stands, minecarts and end crystals (the other entities
|
||||||
|
// supported by this event) don't have this issue.
|
||||||
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
|
public void onBoatPlace(EntityPlaceEvent event) {
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
if (player == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Entity placed = event.getEntity();
|
||||||
|
if (!(placed instanceof Boat)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
BukkitPlayer pp = BukkitUtil.getPlayer(player);
|
||||||
|
PlotArea area = pp.getPlotAreaAbs();
|
||||||
|
if (area == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PlayerBlockEventType eventType = PlayerBlockEventType.PLACE_VEHICLE;
|
||||||
|
Block block = event.getBlock();
|
||||||
|
BlockType blockType = BukkitAdapter.asBlockType(block.getType());
|
||||||
|
Location location = BukkitUtil.getLocation(block.getLocation());
|
||||||
|
if (!PlotSquared.get().getEventDispatcher()
|
||||||
|
.checkPlayerBlockEvent(pp, eventType, location, blockType, true)) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onBucketEmpty(PlayerBucketEmptyEvent event) {
|
public void onBucketEmpty(PlayerBucketEmptyEvent event) {
|
||||||
BlockFace bf = event.getBlockFace();
|
BlockFace bf = event.getBlockFace();
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class BukkitWorldManager implements PlatformWorldManager<World> {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setGenerator(@Nullable final String worldName, @Nullable final String generator) {
|
protected void setGenerator(@Nullable final String worldName, @Nullable final String generator) {
|
||||||
if (generator == null) {
|
if (generator == null || worldName != null && worldName.contains(".")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
File file = new File("bukkit.yml").getAbsoluteFile();
|
File file = new File("bukkit.yml").getAbsoluteFile();
|
||||||
|
|
|
@ -95,7 +95,7 @@ public class Deny extends SubCommand {
|
||||||
}
|
}
|
||||||
plot.addDenied(uuidMapping.getUuid());
|
plot.addDenied(uuidMapping.getUuid());
|
||||||
PlotSquared.get().getEventDispatcher().callDenied(player, plot, uuidMapping.getUuid(), true);
|
PlotSquared.get().getEventDispatcher().callDenied(player, plot, uuidMapping.getUuid(), true);
|
||||||
if (!uuidMapping.equals(DBFunc.EVERYONE)) {
|
if (!uuidMapping.getUuid().equals(DBFunc.EVERYONE)) {
|
||||||
handleKick(PlotSquared.imp().getPlayerManager().getPlayerIfExists(uuidMapping.getUuid()), plot);
|
handleKick(PlotSquared.imp().getPlayerManager().getPlayerIfExists(uuidMapping.getUuid()), plot);
|
||||||
} else {
|
} else {
|
||||||
for (PlotPlayer plotPlayer : plot.getPlayersInPlot()) {
|
for (PlotPlayer plotPlayer : plot.getPlayersInPlot()) {
|
||||||
|
|
|
@ -146,15 +146,7 @@ public class Owner extends SetCommand {
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PlotSquared.get().getImpromptuUUIDPipeline().getSingle(value, (uuid, throwable) -> {
|
PlotSquared.get().getImpromptuUUIDPipeline().getSingle(value, (uuid, throwable) -> uuidConsumer.accept(uuid));
|
||||||
if (throwable instanceof TimeoutException) {
|
|
||||||
MainUtil.sendMessage(player, Captions.FETCHING_PLAYERS_TIMEOUT);
|
|
||||||
} else if (throwable != null) {
|
|
||||||
MainUtil.sendMessage(player, Captions.INVALID_PLAYER, value);
|
|
||||||
} else {
|
|
||||||
uuidConsumer.accept(uuid);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -537,7 +537,7 @@ public abstract class SchematicHandler {
|
||||||
schematic.put("Palette", new CompoundTag(paletteTag));
|
schematic.put("Palette", new CompoundTag(paletteTag));
|
||||||
schematic.put("BlockData", new ByteArrayTag(buffer.toByteArray()));
|
schematic.put("BlockData", new ByteArrayTag(buffer.toByteArray()));
|
||||||
schematic
|
schematic
|
||||||
.put("TileEntities", new ListTag(CompoundTag.class, tileEntities));
|
.put("BlockEntities", new ListTag(CompoundTag.class, tileEntities));
|
||||||
|
|
||||||
schematic.put("BiomePaletteMax", new IntTag(biomePalette.size()));
|
schematic.put("BiomePaletteMax", new IntTag(biomePalette.size()));
|
||||||
|
|
||||||
|
@ -602,8 +602,6 @@ public abstract class SchematicHandler {
|
||||||
values.put(entry.getKey(),
|
values.put(entry.getKey(),
|
||||||
entry.getValue());
|
entry.getValue());
|
||||||
}
|
}
|
||||||
// Remove 'id' if it exists. We want 'Id'
|
|
||||||
values.remove("id");
|
|
||||||
|
|
||||||
// Positions are kept in NBT, we don't want that.
|
// Positions are kept in NBT, we don't want that.
|
||||||
values.remove("x");
|
values.remove("x");
|
||||||
|
@ -612,6 +610,11 @@ public abstract class SchematicHandler {
|
||||||
|
|
||||||
values.put("Id",
|
values.put("Id",
|
||||||
new StringTag(block.getNbtId()));
|
new StringTag(block.getNbtId()));
|
||||||
|
|
||||||
|
// Remove 'id' if it exists. We want 'Id'.
|
||||||
|
// Do this after we get "getNbtId" cos otherwise "getNbtId" doesn't work.
|
||||||
|
// Dum.
|
||||||
|
values.remove("id");
|
||||||
values.put("Pos", new IntArrayTag(
|
values.put("Pos", new IntArrayTag(
|
||||||
new int[] {rx, ry, rz}));
|
new int[] {rx, ry, rz}));
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ is to provide a lag-free and smooth experience.
|
||||||
* [Discord](https://discord.gg/KxkjDVg)
|
* [Discord](https://discord.gg/KxkjDVg)
|
||||||
* [Wiki](https://wiki.intellectualsites.com/plotsquared/home)
|
* [Wiki](https://wiki.intellectualsites.com/plotsquared/home)
|
||||||
* [Issues](https://issues.intellectualsites.com/projects/ps)
|
* [Issues](https://issues.intellectualsites.com/projects/ps)
|
||||||
|
* [Translations](https://intellectualsites.crowdin.com/plotsquared/)
|
||||||
|
|
||||||
### Developer Resources
|
### Developer Resources
|
||||||
* [API Documentation](https://wiki.intellectualsites.com/en/plotsquared/developer/development-portal)
|
* [API Documentation](https://wiki.intellectualsites.com/en/plotsquared/developer/development-portal)
|
||||||
|
|
Loading…
Reference in a new issue