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
6 changes: 6 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### 2.1.5 Release (09.06.2025)
* Fixed startup issues on lower mc versions
* Added a onserverjoin message about wrong base arena setup if base cuboid is outside arena cuboid
* Added Death.Blindness in config.yml to change length of blindness effect after death
* Updated to minigamesbox 1.4.2

### 2.1.4 Release (03.05.2025)
* Fixed arena forcestop the game after a player leave the Fullgame and not enough players to continue are online
* Updated language.yml so by default base selection got prefix
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<groupId>plugily.projects</groupId>
<artifactId>thebridge</artifactId>
<version>2.1.4</version>
<version>2.1.4-SNAPSHOT4</version>
<name>TheBridge</name>

<properties>
Expand Down Expand Up @@ -58,7 +58,7 @@
<dependency>
<groupId>plugily.projects</groupId>
<artifactId>MiniGamesBox-Classic</artifactId>
<version>1.4.1</version>
<version>1.4.2</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/plugily/projects/thebridge/arena/Arena.java
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ public void resetPlayer(Player player) {
player.setExp(0);
player.setFireTicks(0);
player.setGameMode(GameMode.SURVIVAL);
XPotion.BLINDNESS.buildPotionEffect(30, 10).apply(player);
XPotion.BLINDNESS.buildPotionEffect(plugin.getConfig().getInt("Death.Blindness", 30), 10).apply(player);
VersionUtils.setMaxHealth(player, VersionUtils.getMaxHealth(player));
player.setHealth(VersionUtils.getMaxHealth(player));
player.setAllowFlight(false);
Expand Down
51 changes: 38 additions & 13 deletions src/main/java/plugily/projects/thebridge/events/PluginEvents.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

package plugily.projects.thebridge.events;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
Expand All @@ -27,18 +29,22 @@
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerItemConsumeEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.potion.PotionEffectType;
import plugily.projects.minigamesbox.api.arena.IArenaState;
import plugily.projects.minigamesbox.classic.handlers.language.MessageBuilder;
import plugily.projects.minigamesbox.classic.utils.services.UpdateChecker;
import plugily.projects.minigamesbox.classic.utils.version.VersionUtils;
import plugily.projects.minigamesbox.classic.utils.version.xseries.XMaterial;
import plugily.projects.minigamesbox.classic.utils.version.xseries.XPotion;
import plugily.projects.thebridge.Main;
import plugily.projects.thebridge.arena.Arena;
import plugily.projects.thebridge.arena.base.Base;

/**
* @author Tigerpanzer_02
* <p>Created at 23.11.2020
* <p>Created at 23.11.2020
*/
public class PluginEvents implements Listener {

Expand All @@ -49,9 +55,28 @@ public PluginEvents(Main plugin) {
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}

@EventHandler
public void onJoinCheckBases(PlayerJoinEvent event) {
if(!event.getPlayer().hasPermission(plugin.getPluginNamePrefixLong() + ".admin") || !event.getPlayer().isOp()) {
return;
}
Bukkit.getScheduler().runTaskLater(plugin, () -> {
for(Arena arena : plugin.getArenaRegistry().getPluginArenas()) {
for(Base base : arena.getBases()) {
if(!(arena.getArenaBorder().isIn(base.getBaseCuboid().getMinPoint()) && (arena.getArenaBorder().isIn(base.getBaseCuboid().getMaxPoint())))) {
event.getPlayer().sendMessage("");
event.getPlayer().sendMessage(ChatColor.BOLD + plugin.getPluginMessagePrefix() + "Your arena setup is broken. Please adjust your arena cuboid.");
event.getPlayer().sendMessage(new MessageBuilder("VALIDATOR_INVALID_ARENA_CONFIGURATION").asKey().arena(arena).value("YOUR BASE CUBOIDS ARE NOT INSIDE ARENA CUBOID").build());
event.getPlayer().sendMessage(ChatColor.YELLOW + plugin.getPluginMessagePrefix() + "[CHECK BASE INSIDE ARENA] " + arena.getId() + base.getColor() + " Locations amin" + arena.getArenaBorder().getMinPoint() + "amax" + arena.getArenaBorder().getMaxPoint() + "bmin" + base.getBaseCuboid().getMinPoint() + "bma" + base.getBaseCuboid().getMaxPoint());
}
}
}
}, 25);
}

@EventHandler
public void onDrop(PlayerDropItemEvent event) {
if (plugin.getArenaRegistry().isInArena(event.getPlayer())) {
if(plugin.getArenaRegistry().isInArena(event.getPlayer())) {
event.setCancelled(true);
}
}
Expand All @@ -60,10 +85,10 @@ public void onDrop(PlayerDropItemEvent event) {
public void onAppleConsume(PlayerItemConsumeEvent event) {
Player player = event.getPlayer();
Arena arena = plugin.getArenaRegistry().getArena(player);
if (arena == null) {
if(arena == null) {
return;
}
if (event.getItem().getType() == XMaterial.GOLDEN_APPLE.parseMaterial()) {
if(event.getItem().getType() == XMaterial.GOLDEN_APPLE.parseMaterial()) {
player.setFoodLevel(20);
player.setHealth(VersionUtils.getMaxHealth(player));
player.removePotionEffect(XPotion.REGENERATION.getPotionEffectType());
Expand All @@ -73,32 +98,32 @@ public void onAppleConsume(PlayerItemConsumeEvent event) {
@EventHandler(priority = EventPriority.HIGH)
// highest priority to fully protect our game
public void onBlockBreakEvent(BlockBreakEvent event) {
if (plugin.getArenaRegistry().isInArena(event.getPlayer())
&& plugin.getArenaRegistry().getArena(event.getPlayer()).getArenaState()
!= IArenaState.IN_GAME) {
if(plugin.getArenaRegistry().isInArena(event.getPlayer())
&& plugin.getArenaRegistry().getArena(event.getPlayer()).getArenaState()
!= IArenaState.IN_GAME) {
event.setCancelled(true);
}
}

@EventHandler(priority = EventPriority.HIGH)
// highest priority to fully protect our game
public void onBuild(BlockPlaceEvent event) {
if (plugin.getArenaRegistry().isInArena(event.getPlayer())
&& plugin.getArenaRegistry().getArena(event.getPlayer()).getArenaState()
!= IArenaState.IN_GAME) {
if(plugin.getArenaRegistry().isInArena(event.getPlayer())
&& plugin.getArenaRegistry().getArena(event.getPlayer()).getArenaState()
!= IArenaState.IN_GAME) {
event.setCancelled(true);
}
}

@EventHandler
public void onPlayerTeleport(PlayerTeleportEvent event) {
if (!plugin.getArenaRegistry().isInArena(event.getPlayer())) {
if(!plugin.getArenaRegistry().isInArena(event.getPlayer())) {
return;
}
if (event.getCause().equals(PlayerTeleportEvent.TeleportCause.END_PORTAL)) {
if(event.getCause().equals(PlayerTeleportEvent.TeleportCause.END_PORTAL)) {
event.setCancelled(true);
}
if (event.getCause().equals(PlayerTeleportEvent.TeleportCause.NETHER_PORTAL)) {
if(event.getCause().equals(PlayerTeleportEvent.TeleportCause.NETHER_PORTAL)) {
event.setCancelled(true);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void addItems(NormalFastInv gui) {
gui.setItem((getInventoryLine() * 9) + 4, midLocation);
getItemList().add(midLocation);

LocationSelectorItem arenaBorder = new LocationSelectorItem(getSetupInventory(), new ItemBuilder(XMaterial.BEDROCK.parseMaterial()), "Arena", "Location where all bases and lines are in \n (players will be able to build inside)", "arenalocation");
LocationSelectorItem arenaBorder = new LocationSelectorItem(getSetupInventory(), new ItemBuilder(XMaterial.BEDROCK.parseMaterial()), "Arena", "Location where all bases and lines are in \n (players will be able to build inside) \n MAKE SURE TO SET IT OUTSIDE \n OF THE BASES WHICH YOU SET BEFORE!", "arenalocation");
gui.setItem((getInventoryLine() * 9) + 5, arenaBorder);
getItemList().add(arenaBorder);
}
Expand Down
10 changes: 8 additions & 2 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ Block:
# Setting it to false means on all stages of the game the event will be cancelled.
# Setting it to true means only while IN_GAME the event will be cancelled.
Check: true
# Should all interactions with interactive materials such as doors / buttons / fences / redstone be blocked during ingame
# Full list see https://github.com/CryptoMorin/XSeries/blob/e84000a2bead7367d893cf8661f8d5432116adaa/core/src/main/java/com/cryptomorin/xseries/XTag.java#L2793
Interact: false


# Enable this option when you're using MySQL, otherwise it won't work.
Expand Down Expand Up @@ -210,6 +213,9 @@ Natural-Regeneration: false
# Should blocks when broken drop items during a game
Block-Break-Drop: true

# How long should be the blindness effect after death?
Death:
Blindness: 30

# Settings about cages on all bases
Cage:
Expand All @@ -230,5 +236,5 @@ Update-Notifier:
# Really, don't edit ;p
# You edited it, huh? Next time hurt yourself!
Do-Not-Edit:
File-Version: 2
Core-Version: 5
File-Version: 3
Core-Version: 6