Skip to content

Commit 7a9bb78

Browse files
Merge branch '1.21.5' into datapacks-suck
2 parents 2254703 + a0c66bc commit 7a9bb78

Some content is hidden

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

45 files changed

+1763
-353
lines changed

api/build.gradle

Lines changed: 48 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
2+
import io.papermc.paperweight.userdev.ReobfArtifactConfiguration
23

34
plugins {
45
id 'net.minecrell.plugin-yml.bukkit'
@@ -7,28 +8,37 @@ plugins {
78

89
group = 'org.parallelmc'
910

10-
version = '4.2.2'
11+
version = '4.7.0'
1112
description = 'A set of utilities and features for use on the Parallel Minecraft server'
1213

1314
java {
14-
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
15+
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
1516
}
1617

18+
paperweight.reobfArtifactConfiguration = ReobfArtifactConfiguration.getMOJANG_PRODUCTION()
19+
1720
compileJava.options.encoding = "UTF-8"
1821
compileTestJava.options.encoding = "UTF-8"
1922
processResources.filteringCharset = "UTF-8"
2023

24+
repositories {
25+
mavenCentral()
26+
maven { url = "https://repo.papermc.io/repository/maven-public/" }
27+
}
2128

2229
dependencies {
30+
//compileOnly 'io.papermc.paper:paper-api:1.20.6-R0.1-SNAPSHOT'
31+
paperweightDevelopmentBundle("io.papermc.paper:dev-bundle:1.21.5-R0.1-SNAPSHOT")
32+
2333
implementation 'org.jetbrains:annotations:24.0.1'
2434
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.9.2'
25-
implementation 'net.dv8tion:JDA:5.0.0-beta.10'
26-
compileOnly 'me.clip:placeholderapi:2.11.3'
35+
implementation 'net.dv8tion:JDA:5.0.0-beta.24'
36+
compileOnly 'me.clip:placeholderapi:2.11.6'
2737
compileOnly fileTree('libs') { include '*.jar' }
28-
compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.8'
29-
implementation 'mysql:mysql-connector-java:8.0.33'
30-
compileOnly 'com.comphenix.protocol:ProtocolLib:5.0.0'
31-
compileOnly 'dev.esophose:playerparticles:8.4'
38+
compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.13'
39+
implementation 'com.mysql:mysql-connector-j:8.3.0'
40+
compileOnly 'com.comphenix.protocol:ProtocolLib:5.3.0'
41+
compileOnly 'dev.esophose:playerparticles:8.7'
3242
implementation 'org.reflections:reflections:0.10.2'
3343
}
3444

@@ -39,17 +49,17 @@ artifacts {
3949

4050
tasks {
4151
assemble {
42-
dependsOn(reobfJar)
52+
//dependsOn(reobfJar)
4353
}
4454

4555
build {
46-
dependsOn(reobfJar)
56+
//dependsOn(reobfJar)
4757
}
4858

4959
compileJava {
5060
// Set the release flag. This configures what version bytecode the compiler will emit, as well as what JDK APIs are usable.
5161
// See https://openjdk.java.net/jeps/247 for more information.
52-
options.release.set(17)
62+
options.release.set(21)
5363
}
5464

5565
shadowJar {
@@ -67,7 +77,7 @@ bukkit {
6777

6878
main = 'parallelmc.parallelutils.ParallelUtils'
6979

70-
apiVersion = '1.20'
80+
apiVersion = '1.21.5'
7181

7282
depend = ['PlaceholderAPI', 'ProtocolLib']
7383
softDepend = ['Multiverse-Core', 'FractalForest', 'WorldGuard', 'VoteParty', 'PlayerParticles', 'ProNouns']
@@ -279,6 +289,26 @@ bukkit {
279289
description = 'Opens Maggies Shop'
280290
usage = '/openmaggieshop (player)'
281291
}
292+
points {
293+
description = 'View your advancement points'
294+
usage = '/points'
295+
}
296+
recalculatepoints {
297+
description = 'Recalculates advancement points for all players'
298+
usage = '/recalculatepoints'
299+
permissionMessage = 'You do not have permission.'
300+
permission = 'parallelutils.recalculatepoints'
301+
}
302+
openpointsredemption {
303+
description = 'Opens the point redemption shop for a player'
304+
usage = '/openpointsredemption (player)'
305+
}
306+
hat {
307+
description = 'Allows you to wear the item in your main hand as a hat'
308+
usage = '/hat'
309+
permissionMessage = 'You do not have permission.'
310+
permission = 'parallelutils.hat.*'
311+
}
282312
}
283313

284314
permissions {
@@ -475,5 +505,11 @@ bukkit {
475505
description = 'Prevents being kicked from not accepting the resource pack'
476506
setDefault('FALSE')
477507
}
508+
'parallelutils.recalculatepoints' {
509+
description = 'Gives access to the /recalculatepoints dev command'
510+
}
511+
'parallelutils.hat.*' {
512+
description = 'Allows you to wear any item as a hat'
513+
}
478514
}
479515
}
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
package parallelmc.parallelutils;
22

3+
import net.kyori.adventure.text.Component;
4+
import net.kyori.adventure.text.minimessage.MiniMessage;
5+
36
public class Constants {
47

5-
public static final Version VERSION = new Version(4, 2, 2);
8+
public static final Version VERSION = new Version(4, 7, 0);
69
public static final String PLUGIN_NAME = "ParallelUtils";
10+
public static final Component PLUGIN_PREFIX = MiniMessage.miniMessage()
11+
.deserialize("<dark_aqua>[<white><bold>P</bold><dark_aqua>] <reset>");
712
public static final String DEFAULT_WORLD = "world2";
13+
14+
public static final String[] OVERWORLD_TYPE_WORLDS = {"world", "world2", "world_skyteaser"};
815
}

api/src/main/java/parallelmc/parallelutils/ParallelUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ public void onEnable() {
7777
config = this.getConfig();
7878

7979
config.options().copyDefaults(true);
80-
config.options().parseComments(true);
81-
config.options().setHeader(List.of(HEADER));
80+
//config.options().parseComments(true);
81+
config.options().header(HEADER);
8282

8383
// Read config
8484
this.saveDefaultConfig();

api/src/main/java/parallelmc/parallelutils/commands/Commands.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import org.bukkit.World;
66
import org.bukkit.block.Block;
77
import org.bukkit.command.*;
8-
import org.bukkit.craftbukkit.v1_20_R1.command.ServerCommandSender;
8+
import org.bukkit.craftbukkit.command.ServerCommandSender;
99
import org.bukkit.entity.Player;
1010
import org.jetbrains.annotations.NotNull;
1111
import org.jetbrains.annotations.Nullable;
@@ -220,9 +220,9 @@ public static Location convertLocation(CommandSender sender, String sx, String s
220220
*/
221221
public static List<String> getTargetedBlockTabHelper(@NotNull Player player, int depth) {
222222
ArrayList<String> list = new ArrayList<>();
223-
Block targetedBlock = player.getTargetBlockExact(5);
223+
Block targetedBlock = player.getTargetBlock(null,5);
224224

225-
if (targetedBlock != null && targetedBlock.isSolid()) {
225+
if (targetedBlock != null && !targetedBlock.isEmpty()) {
226226
// Autofill targeted coords
227227
if (depth >= 1) {
228228
list.add(String.format("%d", targetedBlock.getZ()));
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
package parallelmc.parallelutils.util;
2+
3+
import net.kyori.adventure.text.Component;
4+
import net.kyori.adventure.text.TextComponent;
5+
import net.kyori.adventure.text.format.NamedTextColor;
6+
import org.bukkit.Bukkit;
7+
import org.bukkit.entity.Player;
8+
import parallelmc.parallelutils.Constants;
9+
10+
/**
11+
* A set of utilities to make sending messages easier
12+
*/
13+
public class MessageTools {
14+
15+
/**
16+
* Sends a message to a player with the Parallel prefix prepended to it
17+
* (This version of the method sends an "INFO" style message)
18+
* @param player The player to send the message to
19+
* @param message The message without the prefix
20+
*/
21+
public static void sendMessage(Player player, String message) {
22+
TextComponent finalMessage = (TextComponent) Constants.PLUGIN_PREFIX
23+
.append(Component.text(message, NamedTextColor.AQUA));
24+
player.sendMessage(finalMessage);
25+
}
26+
27+
/**
28+
* Sends a message to a player with the Parallel prefix prepended to it
29+
* @param player The player to send the message to
30+
* @param message The message without the prefix
31+
* @param messageType The type of message; this determines the message color
32+
*/
33+
public static void sendMessage(Player player, String message, MessageType messageType) {
34+
TextComponent finalMessage = switch (messageType) {
35+
case INFO -> (TextComponent) Constants.PLUGIN_PREFIX.append(Component.text(message, NamedTextColor.AQUA));
36+
case SUCCESS -> (TextComponent) Constants.PLUGIN_PREFIX.append(Component.text(message, NamedTextColor.GREEN));
37+
case ERROR -> (TextComponent) Constants.PLUGIN_PREFIX.append(Component.text(message, NamedTextColor.RED));
38+
};
39+
player.sendMessage(finalMessage);
40+
}
41+
42+
/**
43+
* Sends a message to console with the Parallel prefix prepended to it
44+
* (This version of the method sends an "INFO" style message)
45+
* @param message The message without the prefix
46+
*/
47+
public static void sendConsoleMessage(String message) {
48+
TextComponent finalMessage = (TextComponent) Constants.PLUGIN_PREFIX
49+
.append(Component.text(message, NamedTextColor.AQUA));
50+
Bukkit.getConsoleSender().sendMessage(finalMessage);
51+
}
52+
53+
/**
54+
* Sends a message to console with the Parallel prefix prepended to it
55+
* @param message The message without the prefix
56+
* @param messageType The type of message; this determines the message color
57+
*/
58+
public static void sendConsoleMessage(String message, MessageType messageType) {
59+
TextComponent finalMessage = switch (messageType) {
60+
case INFO -> (TextComponent) Constants.PLUGIN_PREFIX.append(Component.text(message, NamedTextColor.AQUA));
61+
case SUCCESS -> (TextComponent) Constants.PLUGIN_PREFIX.append(Component.text(message, NamedTextColor.GREEN));
62+
case ERROR -> (TextComponent) Constants.PLUGIN_PREFIX.append(Component.text(message, NamedTextColor.RED));
63+
};
64+
Bukkit.getConsoleSender().sendMessage(finalMessage);
65+
}
66+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package parallelmc.parallelutils.util;
2+
3+
/**
4+
* An enum to allow sending a different color of Parallel message depending on the message type
5+
*/
6+
public enum MessageType {
7+
INFO,
8+
SUCCESS,
9+
ERROR
10+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package parallelmc.parallelutils.util;
2+
3+
import java.util.Random;
4+
5+
/**
6+
* A helper class for functions related to obtaining random values
7+
*/
8+
public class RandomTools {
9+
10+
private static final Random r = new Random();
11+
12+
/**
13+
* Calculates a random integer between two integer values
14+
* @param low The first integer
15+
* @param high The second integer
16+
* @return The random integer between low and high, inclusive
17+
*/
18+
public static int betweenTwoNumbers(int low, int high) {
19+
return r.nextInt(high - low + 1) + low;
20+
}
21+
}

api/src/main/resources/config.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,6 @@ announcements:
7676

7777
# Bits and Bobs
7878
disable-ender-chests: false
79-
prevent-spawner-mining: false
79+
prevent-spawner-mining: false
80+
enable-calling-bell: true
81+
enable-sweethearts: true

build.gradle

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1+
import io.papermc.paperweight.userdev.ReobfArtifactConfiguration
2+
13
plugins {
24
id 'java'
3-
id 'com.github.johnrengelman.shadow' version '8.1.1'
4-
id("io.papermc.paperweight.userdev") version "1.5.5"
5-
id "xyz.jpenilla.run-paper" version "2.1.0"
5+
id 'io.github.goooler.shadow' version '8.1.7'
6+
id "io.papermc.paperweight.userdev" version "2.0.0-beta.17"
7+
id "xyz.jpenilla.run-paper" version "2.3.1"
68
id 'net.minecrell.plugin-yml.bukkit' version '0.6.0'
79
}
810

9-
dependencies {
10-
paperweightDevelopmentBundle("io.papermc.paper:dev-bundle:1.20.1-R0.1-SNAPSHOT")
11+
java {
12+
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
1113
}
1214

15+
paperweight.reobfArtifactConfiguration = ReobfArtifactConfiguration.getMOJANG_PRODUCTION()
1316

14-
java {
15-
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
17+
dependencies {
18+
paperweightDevelopmentBundle("io.papermc.paper:dev-bundle:1.21.5-R0.1-SNAPSHOT")
1619
}
1720

1821
compileJava.options.encoding = "UTF-8"
@@ -21,12 +24,12 @@ processResources.filteringCharset = "UTF-8"
2124

2225
allprojects {
2326
apply plugin: 'java'
24-
apply plugin: 'com.github.johnrengelman.shadow'
27+
apply plugin: 'io.github.goooler.shadow'
2528
apply plugin: "io.papermc.paperweight.userdev"
2629

2730
repositories {
2831
mavenCentral()
29-
maven { url = "https://papermc.io/repo/repository/maven-public/" }
32+
maven { url = "https://repo.papermc.io/repository/maven-public/" }
3033
maven { url = 'https://oss.sonatype.org/content/repositories/snapshots/' }
3134
maven { url = "https://maven.enginehub.org/repo/" }
3235
maven { url = 'https://repo.md-5.net/content/groups/public/' }
@@ -36,15 +39,15 @@ allprojects {
3639
maven { url = 'https://repo.codemc.org/repository/maven-public/' }
3740
maven { url = 'https://repo.rosewooddev.io/repository/public/' }
3841
maven { url = 'https://jitpack.io' }
39-
4042
}
4143

4244
dependencies {
43-
paperweightDevelopmentBundle("io.papermc.paper:dev-bundle:1.20.1-R0.1-SNAPSHOT")
45+
paperweightDevelopmentBundle("io.papermc.paper:dev-bundle:1.21.5-R0.1-SNAPSHOT")
46+
//paperweight.paperDevBundle("1.20.6-R0.1-SNAPSHOT")
4447

45-
compileOnly "io.papermc.paper:paper-api:1.20.1-R0.1-SNAPSHOT"
48+
//compileOnly "io.papermc.paper:paper-api:1.20.6-R0.1-SNAPSHOT"
4649
compileOnly 'net.luckperms:api:5.4'
47-
compileOnly 'dev.esophose:playerparticles:8.4'
48-
compileOnly "com.github.MilkBowl:VaultAPI:1.7"
50+
compileOnly 'dev.esophose:playerparticles:8.7'
51+
compileOnly "com.github.MilkBowl:VaultAPI:1.7.1"
4952
}
5053
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)