Skip to content

Commit

Permalink
Merge branch 'Gecolay:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreeam-qwq authored Apr 17, 2024
2 parents 8b85489 + 6138787 commit 4eb9b65
Show file tree
Hide file tree
Showing 28 changed files with 91 additions and 97 deletions.
19 changes: 9 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
## environment -->
.fleet/
.idea/
.vscode
.idea
.fleet
.DS_Store
## environment <--

## maven -->
target/
## build -->
target
*.iml
## maven <--

## gradle -->
build/
.gradle/
## gradle <--
build
.gradle
## build <--
6 changes: 3 additions & 3 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
<spigot.version>1.20.4-R0.1-SNAPSHOT</spigot.version>
<worldguard.version>7.0.9</worldguard.version>
<placeholderapi.version>2.11.5</placeholderapi.version>
<griefprevention.version>16.18.1</griefprevention.version>
<plotsquared.version>7.2.0</plotsquared.version>
<viaversion.version>4.9.2</viaversion.version>
<griefprevention.version>16.18.2</griefprevention.version>
<plotsquared.version>7.3.8</plotsquared.version>
<viaversion.version>4.9.3</viaversion.version>
</properties>

<repositories>
Expand Down
6 changes: 3 additions & 3 deletions core/src/main/java/dev/geco/gsit/manager/CManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ public class CManager {

public boolean CENTER_BLOCK;

public boolean CUSTOM_MESSAGE;


public final HashMap<Material, Double> S_SITMATERIALS = new HashMap<>();

Expand Down Expand Up @@ -63,8 +65,6 @@ public class CManager {
public boolean PS_DEFAULT_SIT_MODE;


public boolean P_POSE_MESSAGE;

public boolean P_INTERACT;

public boolean P_LAY_REST;
Expand Down Expand Up @@ -142,6 +142,7 @@ public void reload() {
ALLOW_UNSAFE = GPM.getConfig().getBoolean("Options.allow-unsafe", false);
SAME_BLOCK_REST = GPM.getConfig().getBoolean("Options.same-block-rest", false);
CENTER_BLOCK = GPM.getConfig().getBoolean("Options.center-block", true);
CUSTOM_MESSAGE = GPM.getConfig().getBoolean("Options.custom-message", true);

S_SITMATERIALS.clear();
for(String material : GPM.getConfig().getStringList("Options.Sit.SitMaterials")) {
Expand Down Expand Up @@ -177,7 +178,6 @@ public void reload() {
PS_MAX_DISTANCE = GPM.getConfig().getDouble("Options.PlayerSit.max-distance", 0d);
PS_DEFAULT_SIT_MODE = GPM.getConfig().getBoolean("Options.PlayerSit.default-sit-mode", true);

P_POSE_MESSAGE = GPM.getConfig().getBoolean("Options.Pose.pose-message", true);
P_INTERACT = GPM.getConfig().getBoolean("Options.Pose.interact", false);
P_LAY_REST = GPM.getConfig().getBoolean("Options.Pose.lay-rest", true);
P_LAY_SNORING_SOUNDS = GPM.getConfig().getBoolean("Options.Pose.lay-snoring-sounds", false);
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/dev/geco/gsit/manager/MManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void loadMessages() {

public String getMessageByLanguage(String Message, String LanguageCode, Object... ReplaceList) { return toFormattedMessage(getRawMessageByLanguage(Message, LanguageCode, ReplaceList)); }

public String getRawMessageByLanguage(String Message, String LanguageCode, Object... ReplaceList) { return replaceWithLanguageCode(Message == null || Message.isEmpty() ? "" : getMessages(LanguageCode).getString(Message, ""), LanguageCode, ReplaceList); }
public String getRawMessageByLanguage(String Message, String LanguageCode, Object... ReplaceList) { return replaceWithLanguageCode(Message == null || Message.isEmpty() ? "" : getMessages(LanguageCode).getString(Message, Message), LanguageCode, ReplaceList); }

public String getLanguage(CommandSender Target) {
if(!GPM.getCManager().L_CLIENT_LANG || !(Target instanceof Player)) return DEFAULT_LANG;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public boolean sitOnPlayer(Player Player, Player Target) {

UUID lastUUID = GPM.getEntityUtil().createPlayerSeatEntity(Target, Player);

GPM.getMManager().sendActionBarMessage(Player, "Messages.action-playersit-info");
if(GPM.getCManager().CUSTOM_MESSAGE) GPM.getMManager().sendActionBarMessage(Player, "Messages.action-playersit-info");

playersit_used++;

Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/dev/geco/gsit/manager/PoseManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public IGPoseSeat createPose(Block Block, Player Player, Pose Pose, double XOffs

if(seatEntity == null) return null;

if(GPM.getCManager().P_POSE_MESSAGE) {
if(GPM.getCManager().CUSTOM_MESSAGE) {

GPM.getMManager().sendActionBarMessage(Player, "Messages.action-pose-info");

Expand Down
10 changes: 6 additions & 4 deletions core/src/main/java/dev/geco/gsit/manager/SVManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,20 @@ public SVManager(GSitMain GPluginMain) {
GPM = GPluginMain;
String version = Bukkit.getServer().getBukkitVersion();
SERVER_VERSION = version.substring(0, version.indexOf('-'));
PACKAGE_PATH = GPM.getClass().getPackage().getName() + ".mcv." + getPackageVersion();
PACKAGE_PATH = GPM.getClass().getPackage().getName() + ".mcv." + getPackageVersion() + "_m";
if(hasPackageClass("objects.SeatEntity")) return;
PACKAGE_PATH += "_m";
PACKAGE_PATH = PACKAGE_PATH.substring(0, PACKAGE_PATH.length() - 2);
if(hasPackageClass("objects.SeatEntity")) return;
PACKAGE_PATH = GPM.getClass().getPackage().getName() + ".mcv." + LATEST;
PACKAGE_PATH = GPM.getClass().getPackage().getName() + ".mcv." + LATEST + "_m";
if(hasPackageClass("objects.SeatEntity")) return;
PACKAGE_PATH += "_m";
PACKAGE_PATH = PACKAGE_PATH.substring(0, PACKAGE_PATH.length() - 2);
if(!hasPackageClass("objects.SeatEntity")) AVAILABLE = false;
}

public String getServerVersion() { return SERVER_VERSION; }

public String getPackagePath() { return PACKAGE_PATH; }

public boolean isAvailable() { return AVAILABLE; }

public boolean isNewerOrVersion(int Version, int SubVersion) {
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/dev/geco/gsit/manager/SitManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public GSeat createSeat(Block Block, LivingEntity Entity, boolean Rotate, double

if(seatEntity == null) return null;

if(Entity instanceof Player) {
if(GPM.getCManager().CUSTOM_MESSAGE && Entity instanceof Player) {

GPM.getMManager().sendActionBarMessage((Player) Entity, "Messages.action-sit-info");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ public MSpigotManager(GSitMain GPluginMain) {

public void sendMessage(@NotNull CommandSender Target, String Message, Object... ReplaceList) { Target.sendMessage(getMessageByLanguage(Message, getLanguage(Target), ReplaceList)); }

public void sendActionBarMessage(@NotNull Player Target, String Message, Object... ReplaceList) {
if(!allowBungeeMessages) return;
String message = getMessageByLanguage(Message, getLanguage(Target), ReplaceList);
if(message.isEmpty()) return;
Target.spigot().sendMessage(ChatMessageType.ACTION_BAR, net.md_5.bungee.api.chat.TextComponent.fromLegacyText(message));
}
public void sendActionBarMessage(@NotNull Player Target, String Message, Object... ReplaceList) { if(allowBungeeMessages) Target.spigot().sendMessage(ChatMessageType.ACTION_BAR, net.md_5.bungee.api.chat.TextComponent.fromLegacyText(getMessageByLanguage(Message, getLanguage(Target), ReplaceList))); }

}
2 changes: 1 addition & 1 deletion dist/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.6.0</version>
<version>3.7.1</version>
<executions>
<execution>
<phase>package</phase>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public void registerPlayer(Player Player) {
try {
Channel channel = ((CraftPlayer) Player).getHandle().connection.connection.channel;
players.put(Player, channel);
channel.pipeline().addBefore("packet_handler", GPM.NAME.toLowerCase(), getHandler(Player));
if(channel.pipeline().get("packet_handler") != null) channel.pipeline().addBefore("packet_handler", GPM.NAME.toLowerCase(), getHandler(Player));
else channel.pipeline().addLast(GPM.NAME.toLowerCase(), getHandler(Player));
} catch (Exception e) { e.printStackTrace(); }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public void registerPlayer(Player Player) {
try {
Channel channel = ((CraftPlayer) Player).getHandle().connection.connection.channel;
players.put(Player, channel);
channel.pipeline().addBefore("packet_handler", GPM.NAME.toLowerCase(), getHandler(Player));
if(channel.pipeline().get("packet_handler") != null) channel.pipeline().addBefore("packet_handler", GPM.NAME.toLowerCase(), getHandler(Player));
else channel.pipeline().addLast(GPM.NAME.toLowerCase(), getHandler(Player));
} catch (Exception e) { e.printStackTrace(); }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public void registerPlayer(Player Player) {
try {
Channel channel = ((CraftPlayer) Player).getHandle().connection.connection.channel;
players.put(Player, channel);
channel.pipeline().addBefore("packet_handler", GPM.NAME.toLowerCase(), getHandler(Player));
if(channel.pipeline().get("packet_handler") != null) channel.pipeline().addBefore("packet_handler", GPM.NAME.toLowerCase(), getHandler(Player));
else channel.pipeline().addLast(GPM.NAME.toLowerCase(), getHandler(Player));
} catch (Exception e) { e.printStackTrace(); }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ public void registerPlayer(Player Player) {
ServerGamePacketListenerImpl packetListener = ((CraftPlayer) Player).getHandle().connection;
Channel channel = ((Connection) channelField.get(packetListener)).channel;
players.put(Player, channel);
channel.pipeline().addBefore("packet_handler", GPM.NAME.toLowerCase(), getHandler(Player));
if(channel.pipeline().get("packet_handler") != null) channel.pipeline().addBefore("packet_handler", GPM.NAME.toLowerCase(), getHandler(Player));
else channel.pipeline().addLast(GPM.NAME.toLowerCase(), getHandler(Player));
} catch (Exception e) { e.printStackTrace(); }
}

Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<version>3.13.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.1</version>
<version>3.5.2</version>
<configuration>
<minimizeJar>true</minimizeJar>
<createDependencyReducedPom>false</createDependencyReducedPom>
Expand Down
Loading

0 comments on commit 4eb9b65

Please sign in to comment.