Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
### 1.4.3 Release (10.07.2025)
* Added 1.21.6-7 support!
* Updated XSeries to 13.3.3
* Updated FastBoard to 2.1.5
* Updated FastInv to 3.1.2
* Fixed NPE on ServerListPing if plugin isn't fully started / arenaregistry not ready
* Fixed NSM on CRAFTING TABLE usage at mc 1.8.8
* Internal Code Cleanup such as prefixes and MiscUtils
* Changed Hex code support to only support 6 digit long hex code!

### 1.4.2 Release (09.06.2025)
* Added BLOCK_IN_GAME_INTERACTIONS option to block interactions whileas ingame
* Added onArrowHitRemoveProjectile event to remove projectiles which got shoot from InGame Players
Expand Down
2 changes: 1 addition & 1 deletion .github/building/classic/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
<dependency>
<groupId>fr.mrmicky</groupId>
<artifactId>fastboard</artifactId>
<version>2.1.3</version>
<version>2.1.5</version>
<optional>true</optional>
</dependency>
<dependency>
Expand Down
4 changes: 2 additions & 2 deletions MiniGamesBox API/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<artifactId>minigamesbox</artifactId>
<groupId>plugily.projects</groupId>
<version>1.4.2</version>
<version>1.4.2-SNAPSHOT9</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down Expand Up @@ -53,7 +53,7 @@
<dependency>
<groupId>com.github.cryptomorin</groupId>
<artifactId>XSeries</artifactId>
<version>13.3.1</version>
<version>13.3.3</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
Expand Down
6 changes: 3 additions & 3 deletions MiniGamesBox Classic/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<artifactId>minigamesbox</artifactId>
<groupId>plugily.projects</groupId>
<version>1.4.2</version>
<version>1.4.2-SNAPSHOT9</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down Expand Up @@ -68,7 +68,7 @@
<dependency>
<groupId>fr.mrmicky</groupId>
<artifactId>fastboard</artifactId>
<version>2.1.4</version>
<version>2.1.5</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
Expand All @@ -87,7 +87,7 @@
<dependency>
<groupId>com.github.cryptomorin</groupId>
<artifactId>XSeries</artifactId>
<version>13.3.1</version>
<version>13.3.3</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ public void connectToHub(Player player) {

@EventHandler(priority = EventPriority.HIGHEST)
public void onServerListPing(ServerListPingEvent event) {
if(plugin.getArenaRegistry() == null) {
//can be null on early request after server startup
return;
}
if(plugin.getArenaRegistry().getArenas().isEmpty() || !config.getBoolean("MOTD.Manager")) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import plugily.projects.minigamesbox.classic.PluginMain;
import plugily.projects.minigamesbox.classic.handlers.language.MessageBuilder;
import plugily.projects.minigamesbox.classic.utils.version.ServerVersion;
import plugily.projects.minigamesbox.classic.utils.version.VersionUtils;
import plugily.projects.minigamesbox.classic.utils.version.events.api.PlugilyPlayerInteractEvent;
import plugily.projects.minigamesbox.classic.utils.version.events.api.PlugilyPlayerSwapHandItemsEvent;

Expand Down Expand Up @@ -189,13 +190,10 @@ public void onCraft(PlugilyPlayerInteractEvent event) {
return;
}
if(event.getPlayer().getTargetBlock(null, 7).getType() == XMaterial.CRAFTING_TABLE.parseMaterial()) {
if(event.getAction().isRightClick()) {
if(VersionUtils.isRightClick(event.getAction())) {
event.setCancelled(true);
}
}
if(event.getClickedBlock() == null) {
return;
}
if(event.getClickedBlock().getType() == XMaterial.PAINTING.parseMaterial() || event.getClickedBlock().getType() == XMaterial.FLOWER_POT.parseMaterial()) {
event.setCancelled(true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public Prompt acceptInput(ConversationContext context, String input) {
context.getForWhom().sendRawMessage(new MessageBuilder("&e✖ Only a value of the list is allowed, try again by clicking the item again").build());
return Prompt.END_OF_CONVERSATION;
}
context.getForWhom().sendRawMessage(new MessageBuilder("&e✔ Completed | &aSet " + name.toUpperCase() + " " + setupInventory.getArenaKey() + " to " + input).build());
context.getForWhom().sendRawMessage(new MessageBuilder("&e✔ Completed | &aSet " + name.toUpperCase() + " " + setupInventory.getArenaKey() + " to " + input).prefix().build());
setupInventory.setConfig(keyName, Boolean.valueOf(input));
return Prompt.END_OF_CONVERSATION;
}
Expand All @@ -113,7 +113,7 @@ public Prompt acceptInput(ConversationContext context, String input) {
boolean option = setupInventory.getConfig().getBoolean("instances." + setupInventory.getArenaKey() + "." + keyName, false);
int position = 2;
boolean newOption = !option;
event.getWhoClicked().sendMessage(new MessageBuilder("&e✔ Completed | &aSet " + name.toUpperCase() + " " + setupInventory.getArenaKey() + " to " + newOption).build());
event.getWhoClicked().sendMessage(new MessageBuilder("&e✔ Completed | &aSet " + name.toUpperCase() + " " + setupInventory.getArenaKey() + " to " + newOption).prefix().build());
setupInventory.setConfig(keyName, newOption);
InventoryHolder holder = event.getInventory().getHolder();
if(holder instanceof RefreshableFastInv) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public void onClick(InventoryClickEvent event) {
countInput = 1;
}
updateArenaFile(countInput);
conversationContext.getForWhom().sendRawMessage(new MessageBuilder("&e✔ Completed | &aCount for " + name.toUpperCase() + " on " + setupInventory.getArenaKey() + " set to " + countInput).build());
conversationContext.getForWhom().sendRawMessage(new MessageBuilder("&e✔ Completed | &aCount for " + name.toUpperCase() + " on " + setupInventory.getArenaKey() + " set to " + countInput).prefix().build());
//considerable to open setup inventory again?
return Prompt.END_OF_CONVERSATION;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public Prompt acceptInput(ConversationContext context, String input) {
context.getForWhom().sendRawMessage(new MessageBuilder("&e✖ Only a value of the list is allowed, try again by clicking the item again").build());
return Prompt.END_OF_CONVERSATION;
}
context.getForWhom().sendRawMessage(new MessageBuilder("&e✔ Completed | &aSet " + name.toUpperCase() + " " + setupInventory.getArenaKey() + " to " + input).build());
context.getForWhom().sendRawMessage(new MessageBuilder("&e✔ Completed | &aSet " + name.toUpperCase() + " " + setupInventory.getArenaKey() + " to " + input).prefix().build());
setupInventory.setConfig(keyName, input);
return Prompt.END_OF_CONVERSATION;
}
Expand All @@ -114,7 +114,7 @@ public Prompt acceptInput(ConversationContext context, String input) {
String option = setupInventory.getConfig().getString("instances." + setupInventory.getArenaKey() + "." + keyName, switches.get(0));
int position = switches.indexOf(option);
String newOption = switches.get(switches.size() - 1 <= position ? 0 : position + 1);
event.getWhoClicked().sendMessage(new MessageBuilder("&e✔ Completed | &aSet " + name.toUpperCase() + " " + setupInventory.getArenaKey() + " to " + newOption).build());
event.getWhoClicked().sendMessage(new MessageBuilder("&e✔ Completed | &aSet " + name.toUpperCase() + " " + setupInventory.getArenaKey() + " to " + newOption).prefix().build());
setupInventory.setConfig(keyName, newOption);
InventoryHolder holder = event.getInventory().getHolder();
if(holder instanceof RefreshableFastInv) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public void onClick(InventoryClickEvent event) {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
String name = new MessageBuilder(input, false).build();
context.getForWhom().sendRawMessage(new MessageBuilder("&e✔ Completed | &aName of &7" + setupInventory.getArenaKey() + " &aset to &r" + name).build());
context.getForWhom().sendRawMessage(new MessageBuilder("&e✔ Completed | &aName of &7" + setupInventory.getArenaKey() + " &aset to &r" + name).prefix().build());
setupInventory.setConfig(keyName, name);
return Prompt.END_OF_CONVERSATION;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,26 +50,26 @@
public class MiscUtils {

private static final Random RANDOM = new Random();
private static final Pattern PATTERN = Pattern.compile("&?#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})");
private static final Pattern PATTERN = Pattern.compile("&?#([A-Fa-f0-9]{6})");

private MiscUtils() {
}

public static String matchColorRegex(String s) {
public static String matchColorRegex(String message) {
if(Version.isCurrentLower(Version.v1_16)) {
return s;
return message;
}

Matcher matcher = PATTERN.matcher(s);
Matcher matcher = PATTERN.matcher(message);
while(matcher.find()) {
try {
s = s.replace(matcher.group(0), net.md_5.bungee.api.ChatColor.of("#" + matcher.group(1)).toString());
} catch(Exception e) {
System.err.println("Invalid hex color: " + e.getLocalizedMessage());
message = message.replace(matcher.group(0), net.md_5.bungee.api.ChatColor.of("#" + matcher.group(1)).toString());
} catch(Exception exception) {
System.err.println("Invalidh hex color: " + exception.getLocalizedMessage() + " && " + message);
}
}

return s;
return message;
}

@Deprecated
Expand All @@ -87,8 +87,8 @@ public static Optional<AttributeInstance> getEntityAttribute(LivingEntity entity
* @param location location to spawn firework there
*/
public static void spawnRandomFirework(Location location) {
Firework fw = (Firework) location.getWorld().spawnEntity(location, XEntityType.FIREWORK_ROCKET.get());
FireworkMeta fwm = fw.getFireworkMeta();
Firework firework = (Firework) location.getWorld().spawnEntity(location, XEntityType.FIREWORK_ROCKET.get());
FireworkMeta fireworkMeta = firework.getFireworkMeta();

//Get the type
FireworkEffect.Type type;
Expand Down Expand Up @@ -124,11 +124,11 @@ public static void spawnRandomFirework(Location location) {
.with(type).trail(RANDOM.nextBoolean()).build();

//Then apply the effect to the meta
fwm.addEffect(effect);
fireworkMeta.addEffect(effect);

//Generate some random power and set it
fwm.setPower(RANDOM.nextInt(2) + 1);
fw.setFireworkMeta(fwm);
fireworkMeta.setPower(RANDOM.nextInt(2) + 1);
firework.setFireworkMeta(fireworkMeta);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.bukkit.entity.HumanEntity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
Expand Down Expand Up @@ -445,7 +446,6 @@ public static double getMaxHealth(LivingEntity entity) {
}



java.util.Optional<org.bukkit.attribute.AttributeInstance> at = MiscUtils.getEntityAttribute(entity, XAttribute.MAX_HEALTH.get());
return at.map(AttributeInstance::getValue).orElse(20D);
}
Expand Down Expand Up @@ -643,16 +643,22 @@ public static Entity spawnEntity(Location location, EntityType entityType) {
}

public static BannerMeta setBaseColor(BannerMeta meta, DyeColor color) {
BlockStateMeta bsm = (BlockStateMeta) meta;
BlockState state = ((BlockStateMeta) meta).getBlockState();
if (state instanceof Banner) {
((Banner) state).setBaseColor(color);
state.update(true);
}
bsm.setBlockState(state);
BlockStateMeta bsm = (BlockStateMeta) meta;
BlockState state = ((BlockStateMeta) meta).getBlockState();
if(state instanceof Banner) {
((Banner) state).setBaseColor(color);
state.update(true);
}
bsm.setBlockState(state);
return meta;
}

public static boolean isLeftClick(Action action) {
return action == Action.LEFT_CLICK_AIR || action == Action.LEFT_CLICK_BLOCK;
}

}
public static boolean isRightClick(Action action) {
return action == Action.RIGHT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK;
}

}
2 changes: 1 addition & 1 deletion MiniGamesBox Database/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<artifactId>minigamesbox</artifactId>
<groupId>plugily.projects</groupId>
<version>1.4.2</version>
<version>1.4.2-SNAPSHOT9</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
4 changes: 2 additions & 2 deletions MiniGamesBox Inventory/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<artifactId>minigamesbox</artifactId>
<groupId>plugily.projects</groupId>
<version>1.4.2</version>
<version>1.4.2-SNAPSHOT9</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand All @@ -45,7 +45,7 @@
<dependency>
<groupId>fr.mrmicky</groupId>
<artifactId>FastInv</artifactId>
<version>3.1.1</version>
<version>v3.1.2</version>
</dependency>
</dependencies>

Expand Down
2 changes: 1 addition & 1 deletion MiniGamesBox Utils/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<artifactId>minigamesbox</artifactId>
<groupId>plugily.projects</groupId>
<version>1.4.2</version>
<version>1.4.2-SNAPSHOT9</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

<groupId>plugily.projects</groupId>
<artifactId>minigamesbox</artifactId>
<version>1.4.2</version>
<version>1.4.2-SNAPSHOT9</version>
<packaging>pom</packaging>

<modules>
Expand Down