Skip to content

Commit 1c464f7

Browse files
committed
Merge remote-tracking branch 'upstream/main'
2 parents 08a7de7 + 1b9b14e commit 1c464f7

File tree

62 files changed

+429
-102
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+429
-102
lines changed

build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
plugins {
22
`java-library`
33
`maven-publish`
4-
id("com.gradleup.shadow") version "9.0.0-beta16"
4+
id("com.gradleup.shadow") version "9.0.0-beta17"
55
id("io.papermc.paperweight.userdev") version "2.0.0-beta.17" apply false
66
}
77

@@ -44,7 +44,7 @@ dependencies {
4444
api(project(":v1_21_2", io.papermc.paperweight.util.constants.REOBF_CONFIG))
4545
api(project(":v1_21_4", io.papermc.paperweight.util.constants.REOBF_CONFIG))
4646
api(project(":v1_21_5", io.papermc.paperweight.util.constants.REOBF_CONFIG))
47-
api(project(":v1_21_6", "default"))
47+
api(project(":v1_21_6", io.papermc.paperweight.util.constants.REOBF_CONFIG))
4848
}
4949

5050
tasks {

core/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins {
33
}
44

55
dependencies {
6-
compileOnly("io.papermc.paper:paper-api:1.21.6-R0.1-SNAPSHOT")
6+
compileOnly("io.papermc.paper:paper-api:1.21.7-R0.1-SNAPSHOT")
77
compileOnly("com.sk89q.worldguard:worldguard-bukkit:7.0.13") {
88
exclude("com.google.guava", "guava")
99
exclude("com.google.code.gson", "gson")

core/src/main/java/dev/geco/gsit/GSitMain.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ private void loadFeatures() {
284284

285285
private void loadPluginDependencies() {
286286
Plugin plugin = Bukkit.getPluginManager().getPlugin("GriefPrevention");
287-
if(plugin != null && plugin.isEnabled()) griefPreventionLink = new GriefPreventionLink(this);
287+
if(plugin != null && plugin.isEnabled() && configService.TRUSTED_REGION_ONLY) griefPreventionLink = new GriefPreventionLink(this);
288288
else griefPreventionLink = null;
289289

290290
plugin = Bukkit.getPluginManager().getPlugin("PlaceholderAPI");
@@ -294,7 +294,7 @@ private void loadPluginDependencies() {
294294
} else placeholderAPILink = null;
295295

296296
plugin = Bukkit.getPluginManager().getPlugin("PlotSquared");
297-
if(plugin != null && plugin.isEnabled()) {
297+
if(plugin != null && plugin.isEnabled() && configService.TRUSTED_REGION_ONLY) {
298298
plotSquaredLink = new PlotSquaredLink(this);
299299
if(!plotSquaredLink.isPlotSquaredVersionSupported()) plotSquaredLink = null;
300300
} else plotSquaredLink = null;

core/src/main/java/dev/geco/gsit/event/PlayerSitEventHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public void playerInteractAtEntityEvent(PlayerInteractAtEntityEvent event) {
7676

7777
if(!gSitMain.getEnvironmentUtil().canUseInLocation(target.getLocation(), player, "playersit")) return;
7878

79-
if(gSitMain.getPassengerUtil().isEntityInEntityPassengerList(target, player) || gSitMain.getPassengerUtil().isEntityInEntityPassengerList(player, target)) return;
79+
if(gSitMain.getPassengerUtil().isEntityInPassengerList(target, player) || gSitMain.getPassengerUtil().isEntityInPassengerList(player, target)) return;
8080

8181
long amount = gSitMain.getPassengerUtil().getEntityPassengerCount(target) + 1 + gSitMain.getPassengerUtil().getEntityVehicleCount(target) + gSitMain.getPassengerUtil().getEntityPassengerCount(player);
8282
if(gSitMain.getConfigService().PS_MAX_STACK > 0 && gSitMain.getConfigService().PS_MAX_STACK <= amount) return;

core/src/main/java/dev/geco/gsit/link/GriefPreventionLink.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public GriefPreventionLink(GSitMain gSitMain) {
1919
public boolean canUseInLocation(Location location, Player player) {
2020
try {
2121
Claim claim = GriefPrevention.instance.dataStore.getClaimAt(location, false, null);
22-
return claim == null || (!gSitMain.getConfigService().TRUSTED_REGION_ONLY || claim.canSiege(player));
22+
return claim == null || claim.canSiege(player);
2323
} catch(Throwable e) { gSitMain.getLogger().log(Level.SEVERE, "Could not check GriefPrevention location!", e); }
2424
return true;
2525
}

core/src/main/java/dev/geco/gsit/link/PlaceholderAPILink.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public PlaceholderAPILink(GSitMain gSitMain) {
3232
public @NotNull String getVersion() { return gSitMain.getDescription().getVersion(); }
3333

3434
@Override
35-
public @NotNull List<String> getPlaceholders() { return Arrays.asList("crawling", "emoting", "playertoggle", "posing", "sitting", "toggle"); }
35+
public @NotNull List<String> getPlaceholders() { return Arrays.asList("crawling", "playertoggle", "posing", "sitting", "toggle"); }
3636

3737
@Override
3838
public boolean persist() { return true; }

core/src/main/java/dev/geco/gsit/link/PlotSquaredLink.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@ public boolean canUseInLocation(Location Location, Player Player) {
2727
PlotAPI plotAPI = new PlotAPI();
2828

2929
PlotPlayer<?> plotPlayer = plotAPI.wrapPlayer(Player.getUniqueId());
30-
if(plotPlayer == null) return !gSitMain.getConfigService().TRUSTED_REGION_ONLY;
30+
if(plotPlayer == null) return true;
3131

3232
com.plotsquared.core.location.Location location = com.plotsquared.core.location.Location.at(plotPlayer.getLocation().getWorld(), Location.getBlockX(), Location.getBlockY(), Location.getBlockZ());
3333

3434
PlotArea plotArea = plotAPI.getPlotSquared().getPlotAreaManager().getApplicablePlotArea(location);
35-
if(plotArea == null) return !gSitMain.getConfigService().TRUSTED_REGION_ONLY;
35+
if(plotArea == null) return true;
3636

3737
Plot plot = plotArea.getOwnedPlot(location);
38-
if(plot == null) return !gSitMain.getConfigService().TRUSTED_REGION_ONLY;
38+
if(plot == null) return true;
3939

40-
return !plot.isDenied(Player.getUniqueId()) && (!gSitMain.getConfigService().TRUSTED_REGION_ONLY || plot.isAdded(Player.getUniqueId()));
40+
return !plot.isDenied(Player.getUniqueId()) && plot.isAdded(Player.getUniqueId());
4141
} catch(Throwable e) { gSitMain.getLogger().log(Level.SEVERE, "Could not check PlotSquared location!", e); }
4242
return true;
4343
}

core/src/main/java/dev/geco/gsit/link/WorldGuardLink.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import com.sk89q.worldguard.LocalPlayer;
55
import com.sk89q.worldguard.WorldGuard;
66
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
7-
import com.sk89q.worldguard.protection.flags.Flags;
87
import com.sk89q.worldguard.protection.flags.StateFlag;
98
import com.sk89q.worldguard.protection.flags.registry.FlagRegistry;
109
import com.sk89q.worldguard.protection.regions.RegionContainer;
@@ -53,11 +52,9 @@ public boolean canUseInLocation(Location location, Player player, String flag) {
5352
if(container.get(BukkitAdapter.adapt(location.getWorld())) == null) return true;
5453
RegionQuery regionQuery = container.createQuery();
5554
com.sk89q.worldedit.util.Location regionLocation = BukkitAdapter.adapt(location);
56-
LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player);
57-
// If the player can't ride an entity in the region, we can't use sit anyway
58-
if(!flag.equalsIgnoreCase("crawl") && !regionQuery.testBuild(regionLocation, localPlayer, Flags.RIDE, Flags.INTERACT)) return false;
5955
FlagRegistry flagRegistry = WorldGuard.getInstance().getFlagRegistry();
6056
if(!(flagRegistry.get(flag) instanceof StateFlag stateFlag)) return true;
57+
LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player);
6158
return regionQuery.testState(regionLocation, localPlayer, stateFlag);
6259
} catch(Throwable e) { GSitMain.getInstance().getLogger().log(Level.SEVERE, "Could not check WorldGuard location!", e); }
6360
return true;

core/src/main/java/dev/geco/gsit/service/SitService.java

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public class SitService {
3131

3232
public static final double STAIR_XZ_OFFSET = 0.123d;
3333
public static final double STAIR_Y_OFFSET = 0.5d;
34+
public static final String SIT_TAG = GSitMain.NAME + "_sit";
3435

3536
private final GSitMain gSitMain;
3637
private final double baseOffset;
@@ -133,6 +134,7 @@ public boolean removeSeat(GSeat seat, GStopReason stopReason, boolean useSafeDis
133134
if(preEntityStopSitEvent.isCancelled() && stopReason.isCancellable()) return false;
134135

135136
Entity entity = seat.getEntity();
137+
entityBlocked.add(entity.getUniqueId());
136138
if(useSafeDismount) handleSafeSeatDismount(seat);
137139

138140
Set<GSeat> blockSeatList = blockSeats.remove(seat.getBlock());
@@ -142,6 +144,7 @@ public boolean removeSeat(GSeat seat, GStopReason stopReason, boolean useSafeDis
142144
}
143145
seats.remove(entity.getUniqueId());
144146
seat.getSeatEntity().remove();
147+
entityBlocked.remove(entity.getUniqueId());
145148
Bukkit.getPluginManager().callEvent(new EntityStopSitEvent(seat, stopReason));
146149
sitUsageNanoTime += seat.getLifetimeInNanoSeconds();
147150

@@ -156,25 +159,13 @@ public void handleSafeSeatDismount(GSeat seat) {
156159

157160
Location returnLocation = gSitMain.getConfigService().GET_UP_RETURN ? seat.getReturnLocation() : upLocation;
158161

159-
if(entity.isValid()) entityBlocked.add(entity.getUniqueId());
160-
161162
Location entityLocation = entity.getLocation();
162163

163164
returnLocation.setYaw(entityLocation.getYaw());
164165
returnLocation.setPitch(entityLocation.getPitch());
165166

166-
if(seat.getSeatEntity().isValid()) gSitMain.getEntityUtil().setEntityLocation(seat.getSeatEntity(), returnLocation);
167-
if(entity.isValid()) gSitMain.getEntityUtil().setEntityLocation(entity, returnLocation);
168-
169-
gSitMain.getTaskService().runDelayed(() -> {
170-
if(seat.getSeatEntity().isValid()) gSitMain.getEntityUtil().setEntityLocation(seat.getSeatEntity(), returnLocation);
171-
if(gSitMain.supportsFoliaFeature()) gSitMain.getTaskService().runDelayed(() -> {
172-
if(entity.isValid()) gSitMain.getEntityUtil().setEntityLocation(entity, returnLocation);
173-
}, true, Bukkit.isOwnedByCurrentRegion(entity) ? entity : null, 0);
174-
else if(entity.isValid()) gSitMain.getEntityUtil().setEntityLocation(entity, returnLocation);
175-
176-
entityBlocked.remove(entity.getUniqueId());
177-
}, returnLocation, 1);
167+
gSitMain.getEntityUtil().setEntityLocation(entity, returnLocation);
168+
if(!gSitMain.getVersionManager().isNewerOrVersion(17, 0)) gSitMain.getEntityUtil().setEntityLocation(seat.getSeatEntity(), returnLocation);
178169
}
179170

180171
public GSeat createStairSeatForEntity(Block block, LivingEntity entity) {

core/src/main/java/dev/geco/gsit/util/PassengerUtil.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ public long getEntityPassengerCount(Entity entity) {
2424
return passengerCount;
2525
}
2626

27-
public boolean isEntityInEntityPassengerList(Entity entity, Entity passenger) {
27+
public boolean isEntityInPassengerList(Entity entity, Entity passenger) {
2828
List<Entity> currentPassengers = entity.getPassengers();
2929
if(currentPassengers.contains(passenger)) return true;
30-
for(Entity currentPassenger : currentPassengers) if(isEntityInEntityPassengerList(currentPassenger, passenger)) return true;
30+
for(Entity currentPassenger : currentPassengers) if(isEntityInPassengerList(currentPassenger, passenger)) return true;
3131
return false;
3232
}
3333

0 commit comments

Comments
 (0)