mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-07-04 06:34:42 +02:00
Compare commits
13 Commits
fix/4024
...
fix/stop-i
Author | SHA1 | Date | |
---|---|---|---|
e2bb8a4b32 | |||
c523feeb79 | |||
958c66b28f | |||
c656190e14 | |||
e914cb210e | |||
94c6af74d2 | |||
ebb82bd66d | |||
66f907eb5d | |||
9ffede2c5c | |||
97172df0dc | |||
c9746b182c | |||
10a2b80ffc | |||
ca0f38255d |
@ -11,7 +11,7 @@ jobs:
|
|||||||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
||||||
DISCORD_USERNAME: PlotSquared Release
|
DISCORD_USERNAME: PlotSquared Release
|
||||||
DISCORD_AVATAR: https://raw.githubusercontent.com/IntellectualSites/Assets/main/plugins/PlotSquared/PlotSquared.png
|
DISCORD_AVATAR: https://raw.githubusercontent.com/IntellectualSites/Assets/main/plugins/PlotSquared/PlotSquared.png
|
||||||
uses: Ilshidur/action-discord@08d9328877d6954120eef2b07abbc79249bb6210 # ratchet:Ilshidur/action-discord@0.3.2
|
uses: Ilshidur/action-discord@0.3.2
|
||||||
with:
|
with:
|
||||||
args: |
|
args: |
|
||||||
"<@&525015541815967744> <@&679322738552471574> <@&699293353862496266>"
|
"<@&525015541815967744> <@&679322738552471574> <@&699293353862496266>"
|
||||||
|
2
.github/workflows/build-pr.yml
vendored
2
.github/workflows/build-pr.yml
vendored
@ -11,7 +11,7 @@ jobs:
|
|||||||
- name: Checkout Repository
|
- name: Checkout Repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Validate Gradle Wrapper
|
- name: Validate Gradle Wrapper
|
||||||
uses: gradle/wrapper-validation-action@55e685c48d84285a5b0418cd094606e199cca3b6 # v1
|
uses: gradle/wrapper-validation-action@v1
|
||||||
- name: Setup Java
|
- name: Setup Java
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
|
6
.github/workflows/build.yml
vendored
6
.github/workflows/build.yml
vendored
@ -11,7 +11,7 @@ jobs:
|
|||||||
- name: Checkout Repository
|
- name: Checkout Repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Validate Gradle Wrapper
|
- name: Validate Gradle Wrapper
|
||||||
uses: gradle/wrapper-validation-action@55e685c48d84285a5b0418cd094606e199cca3b6 # v1
|
uses: gradle/wrapper-validation-action@v1
|
||||||
- name: Setup Java
|
- name: Setup Java
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
@ -43,7 +43,7 @@ jobs:
|
|||||||
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
|
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
|
||||||
- name: Publish core javadoc
|
- name: Publish core javadoc
|
||||||
if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/main'}}
|
if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/main'}}
|
||||||
uses: cpina/github-action-push-to-another-repository@0a14457bb28b04dfa1652e0ffdfda866d2845c73
|
uses: cpina/github-action-push-to-another-repository@main
|
||||||
env:
|
env:
|
||||||
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
|
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
|
||||||
with:
|
with:
|
||||||
@ -55,7 +55,7 @@ jobs:
|
|||||||
target-directory: v7/core
|
target-directory: v7/core
|
||||||
- name: Publish bukkit javadoc
|
- name: Publish bukkit javadoc
|
||||||
if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/main'}}
|
if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/main'}}
|
||||||
uses: cpina/github-action-push-to-another-repository@0a14457bb28b04dfa1652e0ffdfda866d2845c73 # main
|
uses: cpina/github-action-push-to-another-repository@main
|
||||||
env:
|
env:
|
||||||
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
|
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
|
||||||
with:
|
with:
|
||||||
|
6
.github/workflows/codeql.yml
vendored
6
.github/workflows/codeql.yml
vendored
@ -22,10 +22,10 @@ jobs:
|
|||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@168b99b3c22180941ae7dbdd5f5c9678ede476ba # v2
|
uses: github/codeql-action/init@v2
|
||||||
with:
|
with:
|
||||||
languages: ${{ matrix.language }}
|
languages: ${{ matrix.language }}
|
||||||
- name: Autobuild
|
- name: Autobuild
|
||||||
uses: github/codeql-action/autobuild@168b99b3c22180941ae7dbdd5f5c9678ede476ba # v2
|
uses: github/codeql-action/autobuild@v2
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@168b99b3c22180941ae7dbdd5f5c9678ede476ba # v2
|
uses: github/codeql-action/analyze@v2
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.schematic;
|
package com.plotsquared.bukkit.schematic;
|
||||||
|
|
||||||
|
import com.destroystokyo.paper.profile.PlayerProfile;
|
||||||
|
import com.destroystokyo.paper.profile.ProfileProperty;
|
||||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||||
import com.sk89q.jnbt.ByteTag;
|
import com.sk89q.jnbt.ByteTag;
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
@ -28,13 +30,20 @@ import com.sk89q.jnbt.Tag;
|
|||||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||||
import com.sk89q.worldedit.world.item.ItemType;
|
import com.sk89q.worldedit.world.item.ItemType;
|
||||||
|
import io.papermc.lib.PaperLib;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.DyeColor;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.block.Banner;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.Container;
|
import org.bukkit.block.Container;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
import org.bukkit.block.Skull;
|
import org.bukkit.block.Skull;
|
||||||
|
import org.bukkit.block.banner.Pattern;
|
||||||
|
import org.bukkit.block.banner.PatternType;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -45,11 +54,15 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class StateWrapper {
|
public class StateWrapper {
|
||||||
|
|
||||||
public org.bukkit.block.BlockState state = null;
|
public CompoundTag tag;
|
||||||
public CompoundTag tag = null;
|
|
||||||
|
private boolean paperErrorTextureSent = false;
|
||||||
|
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + StateWrapper.class.getSimpleName());
|
||||||
|
|
||||||
public StateWrapper(CompoundTag tag) {
|
public StateWrapper(CompoundTag tag) {
|
||||||
this.tag = tag;
|
this.tag = tag;
|
||||||
@ -227,15 +240,64 @@ public class StateWrapper {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
String player = skullOwner.getString("Name");
|
String player = skullOwner.getString("Name");
|
||||||
if (player == null || player.isEmpty()) {
|
|
||||||
|
if (player != null && !player.isEmpty()) {
|
||||||
|
try {
|
||||||
|
skull.setOwningPlayer(Bukkit.getOfflinePlayer(player));
|
||||||
|
skull.update(true);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
final CompoundTag properties = (CompoundTag) skullOwner.getValue().get("Properties");
|
||||||
|
if (properties == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
try {
|
final ListTag textures = properties.getListTag("textures");
|
||||||
skull.setOwningPlayer(Bukkit.getOfflinePlayer(player));
|
if (textures.getValue().isEmpty()) {
|
||||||
skull.update(true);
|
return false;
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
final CompoundTag textureCompound = (CompoundTag) textures.getValue().get(0);
|
||||||
|
if (textureCompound == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
String textureValue = textureCompound.getString("Value");
|
||||||
|
if (textureValue == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!PaperLib.isPaper()) {
|
||||||
|
if (!paperErrorTextureSent) {
|
||||||
|
paperErrorTextureSent = true;
|
||||||
|
LOGGER.error("Failed to populate skull data in your road schematic - This is a Spigot limitation.");
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final PlayerProfile profile = Bukkit.createProfile(UUID.randomUUID());
|
||||||
|
profile.setProperty(new ProfileProperty("textures", textureValue));
|
||||||
|
skull.setPlayerProfile(profile);
|
||||||
|
skull.update(true);
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
case "banner" -> {
|
||||||
|
if (state instanceof Banner banner) {
|
||||||
|
List<Tag> patterns = this.tag.getListTag("Patterns").getValue();
|
||||||
|
if (patterns == null || patterns.isEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
banner.setPatterns(patterns.stream().map(t -> (CompoundTag) t).map(compoundTag -> {
|
||||||
|
DyeColor color = DyeColor.getByWoolData((byte) compoundTag.getInt("Color"));
|
||||||
|
PatternType patternType = PatternType.getByIdentifier(compoundTag.getString("Pattern"));
|
||||||
|
if (color == null || patternType == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new Pattern(color, patternType);
|
||||||
|
}).filter(Objects::nonNull).toList());
|
||||||
|
banner.update(true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -103,7 +103,7 @@ public class Done extends SubCommand {
|
|||||||
public void run(PlotAnalysis value) {
|
public void run(PlotAnalysis value) {
|
||||||
plot.removeRunning();
|
plot.removeRunning();
|
||||||
boolean result =
|
boolean result =
|
||||||
value.getComplexity(doneRequirements) <= doneRequirements.THRESHOLD;
|
value.getComplexity(doneRequirements) >= doneRequirements.THRESHOLD;
|
||||||
finish(plot, player, result);
|
finish(plot, player, result);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -20,7 +20,6 @@ package com.plotsquared.core.plot;
|
|||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.plotsquared.core.PlotSquared;
|
import com.plotsquared.core.PlotSquared;
|
||||||
import com.plotsquared.core.command.Like;
|
import com.plotsquared.core.command.Like;
|
||||||
@ -2418,7 +2417,6 @@ public class Plot {
|
|||||||
if (!this.isMerged()) {
|
if (!this.isMerged()) {
|
||||||
Location pos1 = this.getBottomAbs().withY(getArea().getMinBuildHeight());
|
Location pos1 = this.getBottomAbs().withY(getArea().getMinBuildHeight());
|
||||||
Location pos2 = this.getTopAbs().withY(getArea().getMaxBuildHeight());
|
Location pos2 = this.getTopAbs().withY(getArea().getMaxBuildHeight());
|
||||||
this.connectedCache = Sets.newHashSet(this);
|
|
||||||
CuboidRegion rg = new CuboidRegion(pos1.getBlockVector3(), pos2.getBlockVector3());
|
CuboidRegion rg = new CuboidRegion(pos1.getBlockVector3(), pos2.getBlockVector3());
|
||||||
return Collections.singleton(rg);
|
return Collections.singleton(rg);
|
||||||
}
|
}
|
||||||
|
@ -25,11 +25,17 @@ import com.plotsquared.core.plot.PlotAreaTerrainType;
|
|||||||
import com.plotsquared.core.plot.PlotAreaType;
|
import com.plotsquared.core.plot.PlotAreaType;
|
||||||
import com.plotsquared.core.plot.PlotId;
|
import com.plotsquared.core.plot.PlotId;
|
||||||
import com.plotsquared.core.util.SetupUtils;
|
import com.plotsquared.core.util.SetupUtils;
|
||||||
|
import org.jetbrains.annotations.Contract;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class PlotAreaBuilder {
|
public class PlotAreaBuilder {
|
||||||
|
|
||||||
private String generatorName;
|
private String generatorName;
|
||||||
private String plotManager;
|
private String plotManager;
|
||||||
|
@Nullable
|
||||||
private PlotAreaType plotAreaType;
|
private PlotAreaType plotAreaType;
|
||||||
private PlotAreaTerrainType terrainType;
|
private PlotAreaTerrainType terrainType;
|
||||||
private String worldName;
|
private String worldName;
|
||||||
@ -85,8 +91,10 @@ public class PlotAreaBuilder {
|
|||||||
return this.plotManager;
|
return this.plotManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Contract(" -> !null")
|
||||||
public PlotAreaType plotAreaType() {
|
public PlotAreaType plotAreaType() {
|
||||||
return this.plotAreaType;
|
return Objects.requireNonNullElse(this.plotAreaType, PlotAreaType.NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlotAreaTerrainType terrainType() {
|
public PlotAreaTerrainType terrainType() {
|
||||||
@ -127,7 +135,8 @@ public class PlotAreaBuilder {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlotAreaBuilder plotAreaType(PlotAreaType plotAreaType) {
|
public PlotAreaBuilder plotAreaType(@NotNull PlotAreaType plotAreaType) {
|
||||||
|
Objects.requireNonNull(plotAreaType, "PlotAreaType must not be null");
|
||||||
this.plotAreaType = plotAreaType;
|
this.plotAreaType = plotAreaType;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ plugins {
|
|||||||
eclipse
|
eclipse
|
||||||
idea
|
idea
|
||||||
|
|
||||||
id("xyz.jpenilla.run-paper") version "2.0.1"
|
id("xyz.jpenilla.run-paper") version "2.1.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "com.plotsquared"
|
group = "com.plotsquared"
|
||||||
@ -77,12 +77,12 @@ subprojects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(platform("com.intellectualsites.bom:bom-newest:1.25"))
|
implementation(platform("com.intellectualsites.bom:bom-newest:1.27"))
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// Tests
|
// Tests
|
||||||
testImplementation("org.junit.jupiter:junit-jupiter:5.9.2")
|
testImplementation("org.junit.jupiter:junit-jupiter:5.9.3")
|
||||||
}
|
}
|
||||||
|
|
||||||
plugins.withId("java") {
|
plugins.withId("java") {
|
||||||
|
@ -20,7 +20,7 @@ squirrelid = "0.3.2"
|
|||||||
# Gradle plugins
|
# Gradle plugins
|
||||||
shadow = "7.1.2"
|
shadow = "7.1.2"
|
||||||
grgit = "4.1.1"
|
grgit = "4.1.1"
|
||||||
spotless = "6.17.0"
|
spotless = "6.18.0"
|
||||||
nexus = "1.3.0"
|
nexus = "1.3.0"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
|
Reference in New Issue
Block a user