Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreeam-qwq committed Aug 12, 2024
2 parents 6fe0d4b + 862762e commit 7ea138b
Show file tree
Hide file tree
Showing 49 changed files with 159 additions and 546 deletions.
17 changes: 3 additions & 14 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,16 @@
<parent>
<groupId>dev.geco.gsit</groupId>
<artifactId>GSit</artifactId>
<version>1.9.5</version>
<version>1.10.0</version>
</parent>

<properties>
<paper.version>1.21-R0.1-SNAPSHOT</paper.version>
<spigot.version>1.21-R0.1-SNAPSHOT</spigot.version>
<paper.version>1.21.1-R0.1-SNAPSHOT</paper.version>
<spigot.version>1.21.1-R0.1-SNAPSHOT</spigot.version>
<worldguard.version>7.0.10</worldguard.version>
<placeholderapi.version>2.11.6</placeholderapi.version>
<griefprevention.version>16.18.2</griefprevention.version>
<plotsquared.version>7.3.8</plotsquared.version>
<viaversion.version>4.10.2</viaversion.version>
</properties>

<repositories>
Expand All @@ -43,10 +42,6 @@
<id>jitpack.io</id>
<url>https://jitpack.io/</url>
</repository>
<repository>
<id>viaversion-repo</id>
<url>https://repo.viaversion.com</url>
</repository>
</repositories>

<dependencies>
Expand Down Expand Up @@ -86,12 +81,6 @@
<version>${plotsquared.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.viaversion</groupId>
<artifactId>viaversion-api</artifactId>
<version>${viaversion.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.papermc</groupId>
<artifactId>paperlib</artifactId>
Expand Down
17 changes: 0 additions & 17 deletions core/src/main/java/dev/geco/gsit/GSitMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ public class GSitMain extends JavaPlugin {
private IEntityUtil entityUtil;
public IEntityUtil getEntityUtil() { return entityUtil; }

private IPackageUtil packageUtil;
public IPackageUtil getPackageUtil() { return packageUtil; }

private GriefPreventionLink griefPreventionLink;
public GriefPreventionLink getGriefPreventionLink() { return griefPreventionLink; }

Expand All @@ -75,9 +72,6 @@ public class GSitMain extends JavaPlugin {
private PlotSquaredLink plotSquaredLink;
public PlotSquaredLink getPlotSquaredLink() { return plotSquaredLink; }

private ViaVersionLink viaVersionLink;
public ViaVersionLink getViaVersionLink() { return viaVersionLink; }

private WorldGuardLink worldGuardLink;
public WorldGuardLink getWorldGuardLink() { return worldGuardLink; }

Expand All @@ -100,8 +94,6 @@ private void loadSettings(CommandSender Sender) {
if(!connectDatabase(Sender)) return;

getToggleManager().createTable();

if(getPackageUtil() != null) getPackageUtil().registerPlayers();
}

private void linkBStats() {
Expand Down Expand Up @@ -153,7 +145,6 @@ public void onEnable() {
if(!versionCheck()) return;

entityUtil = getSVManager().isNewerOrVersion(17, 0) ? (IEntityUtil) getSVManager().getPackageObject("util.EntityUtil") : new EntityUtil();
packageUtil = getSVManager().isNewerOrVersion(17, 0) ? (IPackageUtil) getSVManager().getPackageObject("util.PackageUtil") : null;

loadSettings(Bukkit.getConsoleSender());

Expand Down Expand Up @@ -182,7 +173,6 @@ private void unload() {
getCrawlManager().clearCrawls();

if(getPlaceholderAPILink() != null) getPlaceholderAPILink().unregister();
if(getPackageUtil() != null) getPackageUtil().unregisterPlayers();
}

private void setupCommands() {
Expand Down Expand Up @@ -262,13 +252,6 @@ private void loadPluginDependencies(CommandSender Sender) {
else plotSquaredLink = null;
} else plotSquaredLink = null;

plugin = Bukkit.getPluginManager().getPlugin("ViaVersion");

if(getPackageUtil() != null && plugin != null && plugin.isEnabled()) {
viaVersionLink = new ViaVersionLink(getInstance());
getMManager().sendMessage(Sender, "Plugin.plugin-link", "%Link%", plugin.getName());
} else viaVersionLink = null;

plugin = Bukkit.getPluginManager().getPlugin("WorldGuard");

if(plugin != null && plugin.isEnabled()) {
Expand Down
14 changes: 7 additions & 7 deletions core/src/main/java/dev/geco/gsit/events/PlayerEvents.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ public void PJoiE(PlayerJoinEvent Event) {
Player player = Event.getPlayer();

GPM.getUManager().loginCheckForUpdates(player);

if(GPM.getPackageUtil() != null) GPM.getPackageUtil().registerPlayer(player);
}

@EventHandler(priority = EventPriority.LOWEST)
Expand All @@ -46,8 +44,6 @@ public void PQuiE(PlayerQuitEvent Event) {
GPM.getToggleManager().clearToggleCache(player.getUniqueId());

crawl_players.remove(player);

if(GPM.getPackageUtil() != null) GPM.getPackageUtil().unregisterPlayer(player);
}

@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
Expand All @@ -67,7 +63,7 @@ public void EDamE(EntityDamageEvent Event) {

Entity entity = Event.getEntity();

if(!GPM.getCManager().GET_UP_DAMAGE || !(entity instanceof Player) || Event.getFinalDamage() <= 0d) return;
if(!GPM.getCManager().GET_UP_DAMAGE || !(entity instanceof Player) || Event.getDamage() <= 0d) return;

Player player = (Player) entity;

Expand All @@ -81,15 +77,19 @@ public void EDamE(EntityDamageEvent Event) {
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void PComPE(PlayerCommandPreprocessEvent Event) {

List<String> commands = GPM.getCManager().COMMANDBLACKLIST;

if(commands.isEmpty()) return;

Player player = Event.getPlayer();

String message = Event.getMessage();

if(message.length() > 1 && (GPM.getSitManager().isSitting(player) || GPM.getPoseManager().isPosing(player))) {
if(message.length() > 1 && (GPM.getSitManager().isSitting(player) || GPM.getPoseManager().isPosing(player) || GPM.getPlayerSitManager().isUsingPlayerSit(player))) {

message = message.substring(1).split(" ")[0].toLowerCase();

if(GPM.getCManager().COMMANDBLACKLIST.stream().anyMatch(message::equalsIgnoreCase)) {
if(commands.stream().anyMatch(message::equalsIgnoreCase)) {

GPM.getMManager().sendMessage(player, "Messages.action-blocked-error");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import org.bukkit.entity.*;
import org.bukkit.event.*;
import org.bukkit.event.entity.*;
import org.bukkit.event.inventory.*;
import org.bukkit.event.player.*;

import dev.geco.gsit.GSitMain;
Expand Down
32 changes: 0 additions & 32 deletions core/src/main/java/dev/geco/gsit/link/ViaVersionLink.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ public void clearSeats() {
spawnTimes.clear();
}

public boolean isUsingPlayerSit(Player Player) {
if(Player.getVehicle() != null && Player.getVehicle().getScoreboardTags().contains(GPM.NAME + "_PlayerSeatEntity")) return true;
return Player.getPassengers().stream().filter(passenger -> passenger.getScoreboardTags().contains(GPM.NAME + "_PlayerSeatEntity")).findFirst().orElse(null) != null;
}

public boolean sitOnPlayer(Player Player, Player Target) {

PrePlayerPlayerSitEvent preEvent = new PrePlayerPlayerSitEvent(Player, Target);
Expand Down
16 changes: 7 additions & 9 deletions core/src/main/java/dev/geco/gsit/manager/SVManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ public class SVManager {

private final GSitMain GPM;

private final String LATEST_VERSION = "v1_20";
private final String SERVER_VERSION;
private final String PACKAGE_PATH;
private final boolean AVAILABLE;
private String PACKAGE_PATH;
private boolean AVAILABLE;

protected final HashMap<String, String> VERSION_MAPPING = new HashMap<>(); {

Expand All @@ -21,6 +22,7 @@ public class SVManager {
VERSION_MAPPING.put("v1_20_1", "v1_20");
VERSION_MAPPING.put("v1_20_4", "v1_20_3");
VERSION_MAPPING.put("v1_20_6", "v1_20_5");
VERSION_MAPPING.put("v1_21_1", "v1_21");
}

public SVManager(GSitMain GPluginMain) {
Expand All @@ -29,24 +31,20 @@ public SVManager(GSitMain GPluginMain) {
SERVER_VERSION = version.substring(0, version.indexOf('-'));
PACKAGE_PATH = GPM.getClass().getPackage().getName() + ".mcv." + getPackageVersion();
AVAILABLE = hasPackageClass("objects.SeatEntity");
if(AVAILABLE) return;
PACKAGE_PATH = GPM.getClass().getPackage().getName() + ".mcv." + LATEST_VERSION;
AVAILABLE = hasPackageClass("objects.SeatEntity");
}

public String getServerVersion() { return SERVER_VERSION; }

public String getPackagePath() { return PACKAGE_PATH; }

public boolean isAvailable() { return AVAILABLE; }

public boolean isNewerOrVersion(int Version, int SubVersion) {
String[] version = SERVER_VERSION.split("\\.");
return Integer.parseInt(version[1]) > Version || (Integer.parseInt(version[1]) == Version && (version.length > 2 ? Integer.parseInt(version[2]) >= SubVersion : SubVersion == 0));
}

public boolean isVersion(int Version, int SubVersion) {
String[] version = SERVER_VERSION.split("\\.");
return version.length > 2 ? Integer.parseInt(version[1]) == Version && Integer.parseInt(version[2]) == SubVersion : Integer.parseInt(version[1]) == Version && SubVersion == 0;
}

public Object getLegacyPackageObject(String ClassName, Object... Objects) {
try {
Class<?> mcvClass = Class.forName(GPM.getClass().getPackage().getName() + ".mcv.v1_17_1." + ClassName);
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/dev/geco/gsit/manager/SitManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ public boolean removeSeat(LivingEntity Entity, GetUpReason Reason, boolean Safe)
} catch (Throwable ignored) { }
}

if(seat.getEntity().isValid() && Safe && GPM.getPackageUtil() != null) GPM.getEntityUtil().posEntity(seat.getEntity(), returnLocation);
if(seat.getEntity().isValid() && Safe && GPM.getSVManager().isNewerOrVersion(17, 0)) GPM.getEntityUtil().posEntity(seat.getEntity(), returnLocation);

if(seat.getSeatEntity().isValid() && GPM.getPackageUtil() == null) GPM.getEntityUtil().posEntity(seat.getSeatEntity(), returnLocation);
if(seat.getSeatEntity().isValid() && !GPM.getSVManager().isNewerOrVersion(17, 0)) GPM.getEntityUtil().posEntity(seat.getSeatEntity(), returnLocation);

GPM.getEntityUtil().removeSeatEntity(seat.getSeatEntity());

Expand Down
17 changes: 0 additions & 17 deletions core/src/main/java/dev/geco/gsit/util/IPackageUtil.java

This file was deleted.

2 changes: 1 addition & 1 deletion dist/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>dev.geco.gsit</groupId>
<artifactId>GSit</artifactId>
<version>1.9.5</version>
<version>1.10.0</version>
</parent>

<build>
Expand Down
4 changes: 2 additions & 2 deletions jitpack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ before_install:
(mkdir BuildTools_1.20 && cd BuildTools_1.20 && curl -k -o BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar && $JAVA_17 -jar BuildTools.jar --rev 1.20.1 --remapped > /dev/null) &
(mkdir BuildTools_1.20.2 && cd BuildTools_1.20.2 && curl -k -o BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar && $JAVA_17 -jar BuildTools.jar --rev 1.20.2 --remapped > /dev/null) &
(mkdir BuildTools_1.20.4 && cd BuildTools_1.20.4 && curl -k -o BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar && $JAVA_17 -jar BuildTools.jar --rev 1.20.4 --remapped > /dev/null) &
(mkdir BuildTools_1.20.5 && cd BuildTools_1.20.5 && curl -k -o BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar && $JAVA_21 -jar BuildTools.jar --rev 1.20.5 --remapped > /dev/null) &
(mkdir BuildTools_1.21 && cd BuildTools_1.21 && curl -k -o BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar && $JAVA_21 -jar BuildTools.jar --rev 1.21 --remapped > /dev/null)
(mkdir BuildTools_1.20.6 && cd BuildTools_1.20.6 && curl -k -o BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar && $JAVA_21 -jar BuildTools.jar --rev 1.20.6 --remapped > /dev/null) &
(mkdir BuildTools_1.21.1 && cd BuildTools_1.21.1 && curl -k -o BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar && $JAVA_21 -jar BuildTools.jar --rev 1.21.1 --remapped > /dev/null)
- sdk use java 21.0.2-open
2 changes: 1 addition & 1 deletion mcv1_17/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>dev.geco.gsit</groupId>
<artifactId>GSit</artifactId>
<version>1.9.5</version>
<version>1.10.0</version>
</parent>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ public void EDisE(EntityDismountEvent Event) {

Entity bottom = GPM.getPassengerUtil().getBottomEntity(Event.getDismounted());

if(GPM.getCManager().PS_BOTTOM_RETURN && Event.getEntity().isValid() && Event.getEntity() instanceof Player && GPM.getPackageUtil() != null) io.papermc.lib.PaperLib.teleportAsync(Event.getEntity(), bottom.getLocation());

if(Event.getDismounted().getScoreboardTags().contains(GPM.NAME + "_PlayerSeatEntity") && GPM.getPackageUtil() == null) io.papermc.lib.PaperLib.teleportAsync(Event.getDismounted(), bottom.getLocation());
if(GPM.getCManager().PS_BOTTOM_RETURN && Event.getEntity().isValid() && Event.getEntity() instanceof Player) io.papermc.lib.PaperLib.teleportAsync(Event.getDismounted(), bottom.getLocation());

GPM.getPlayerSitManager().stopPlayerSit(Event.getDismounted(), GetUpReason.GET_UP);

Expand Down
Loading

0 comments on commit 7ea138b

Please sign in to comment.