Skip to content

Commit

Permalink
Revert "All dev changes from GreenSurvivors (#383)"
Browse files Browse the repository at this point in the history
This reverts commit 12c5168.
  • Loading branch information
addstar authored Mar 6, 2024
1 parent 12c5168 commit f34afbb
Show file tree
Hide file tree
Showing 104 changed files with 754 additions and 1,131 deletions.
22 changes: 6 additions & 16 deletions Minigames/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<dependency>
<groupId>io.papermc</groupId>
<artifactId>paperlib</artifactId>
<version>1.0.7</version>
<version>1.0.5</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -132,16 +132,6 @@
<include>config.yml</include>
<include>*.properties</include>
<include>presets/*.yml</include>
</includes>
</resource>
<!-- With maven-resources-plugin(shipped with maven 3.9.0+
filtering binary / compressed data breaks since it assumes UTF-8.
We don't need filtering of it anyway.-->
<resource>
<targetPath>.</targetPath>
<filtering>false</filtering>
<directory>src/main/resources</directory>
<includes>
<include>resourcepack/*.zip</include>
</includes>
</resource>
Expand All @@ -162,7 +152,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.1</version>
<version>3.4.0</version>
<configuration>
<filters>
<filter>
Expand Down Expand Up @@ -210,7 +200,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.0</version>
<version>3.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
Expand All @@ -224,7 +214,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.1</version>
<version>3.0.0-M6</version>
<configuration>
<skipTests>true</skipTests>
<forkCount>1</forkCount>
Expand All @@ -234,12 +224,12 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.6.1</version>
<version>3.5.0</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.16.1</version>
<version>2.8.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
65 changes: 17 additions & 48 deletions Minigames/src/main/java/au/com/mineauz/minigames/Events.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import org.bukkit.event.inventory.InventoryDragEvent;
import org.bukkit.event.player.*;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
Expand All @@ -49,7 +48,7 @@ public class Events implements Listener {
private final MinigameManager mdata = plugin.getMinigameManager();

@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerResourcePack(PlayerResourcePackStatusEvent event) { //todo 1.20.3 + add ressource pack not set
public void onPlayerResourcePack(PlayerResourcePackStatusEvent event) {
final MinigamePlayer ply = pdata.getMinigamePlayer(event.getPlayer());
List<MinigamePlayer> required = plugin.getPlayerManager().getApplyingPack();
if (ply.isInMinigame()) {
Expand Down Expand Up @@ -178,7 +177,7 @@ public void onPlayerDisconnect(PlayerQuitEvent event) {
MinigamePlayer ply = pdata.getMinigamePlayer(event.getPlayer());
if (ply.isInMinigame()) {
if (ply.getPlayer().isDead()) {
ply.getOfflineMinigamePlayer().setLoginLocation(ply.getMinigame().getQuitLocation());
ply.getOfflineMinigamePlayer().setLoginLocation(ply.getMinigame().getQuitPosition());
ply.getOfflineMinigamePlayer().savePlayerData();
}
pdata.quitMinigame(pdata.getMinigamePlayer(event.getPlayer()), false);
Expand Down Expand Up @@ -244,7 +243,7 @@ public void onPlayerConnect(PlayerJoinEvent event) {
}

@EventHandler
public void playerInteract(PlayerInteractEvent event) {
public void playerInterract(PlayerInteractEvent event) {
MinigamePlayer ply = pdata.getMinigamePlayer(event.getPlayer());

if (ply.isInMinigame() && !ply.canInteract()) {
Expand All @@ -253,11 +252,11 @@ public void playerInteract(PlayerInteractEvent event) {
}
if (ply.isInMenu() && ply.getNoClose() && ply.getManualEntry() != null) {
event.setCancelled(true);
ply.setNoClose(false);
if (event.getClickedBlock() != null) {
ply.setNoClose(false);
ply.getManualEntry().checkValidEntry(event.getClickedBlock().getBlockData().getAsString());
ply.setManualEntry(null);
}
ply.setManualEntry(null);
return;
}
if (event.getClickedBlock() != null && event.getClickedBlock().getType() == Material.DRAGON_EGG) {
Expand All @@ -272,7 +271,6 @@ public void playerInteract(PlayerInteractEvent event) {
if (cblock.getState() instanceof Sign sign && sign.getSide(Side.FRONT).getLine(0).equalsIgnoreCase(ChatColor.DARK_BLUE + "[Minigame]")) {
// wax signs automatically
sign.setWaxed(true);
sign.update();
if (event.getPlayer().hasPermission("minigame.sign.use.details")) {
if ((sign.getLine(1).equalsIgnoreCase(ChatColor.GREEN + "Join") || sign.getLine(1).equalsIgnoreCase(ChatColor.GREEN + "Bet")) && !ply.isInMinigame()) {
Minigame mgm = mdata.getMinigame(sign.getLine(2));
Expand Down Expand Up @@ -382,6 +380,7 @@ public void playerInteract(PlayerInteractEvent event) {
}
}


//Spectator disables:
if (ply.isInMinigame() && pdata.getMinigamePlayer(event.getPlayer()).getMinigame().isSpectator(pdata.getMinigamePlayer(event.getPlayer()))) {
event.setCancelled(true);
Expand Down Expand Up @@ -459,11 +458,7 @@ private void entityDamageEntity(EntityDamageByEntityEvent event) {
if (sb.getShooter() instanceof Player player) {
MinigamePlayer shooter = pdata.getMinigamePlayer(player);
Minigame mgm = ply.getMinigame();

if (shooter == null) {
return;
}

if (shooter == null) return;
if (shooter.isInMinigame() && shooter.getMinigame().equals(ply.getMinigame())) {
if (!shooter.canPvP()) {
event.setCancelled(true);
Expand Down Expand Up @@ -632,14 +627,13 @@ private void spectatorAttack(EntityDamageByEntityEvent event) {

@EventHandler(ignoreCancelled = true)
private void clickMenu(InventoryClickEvent event) {
MinigamePlayer mgPlayer = pdata.getMinigamePlayer(((Player) event.getWhoClicked()));
if (mgPlayer.isInMenu()) {
if (event.getRawSlot() < mgPlayer.getMenu().getSize()) {
if (!mgPlayer.getMenu().getAllowModify() || mgPlayer.getMenu().hasMenuItem(event.getRawSlot())) {
MinigamePlayer ply = pdata.getMinigamePlayer((Player) event.getWhoClicked());
if (ply.isInMenu()) {
if (event.getRawSlot() < ply.getMenu().getSize()) {
if (!ply.getMenu().getAllowModify() || ply.getMenu().hasMenuItem(event.getRawSlot()))
event.setCancelled(true);
}

MenuItem item = mgPlayer.getMenu().getClicked(event.getRawSlot());
MenuItem item = ply.getMenu().getClicked(event.getRawSlot());
if (item != null) {
ItemStack disItem = null;
switch (event.getClick()) {
Expand All @@ -657,38 +651,12 @@ private void clickMenu(InventoryClickEvent event) {

event.setCurrentItem(disItem);
}
/*
* Cancel special cases, where event.getRawSlot() is not in the Menu inventory,
* but the event modifies it anyway
*/
} else if (!mgPlayer.getMenu().getAllowModify()) {
Inventory topInv = event.getView().getTopInventory();
switch (event.getAction()) {
case PICKUP_ALL, PICKUP_SOME, PICKUP_HALF, PICKUP_ONE, DROP_ALL_SLOT, DROP_ONE_SLOT, HOTBAR_MOVE_AND_READD, // may take
PLACE_ALL, PLACE_SOME, PLACE_ONE, /*may place*/
SWAP_WITH_CURSOR, HOTBAR_SWAP /*may give and take*/ -> {
if (event.getClickedInventory() == topInv) {
event.setCancelled(true);
}
}
case COLLECT_TO_CURSOR -> { // may take complex
if (topInv.contains(event.getCursor().getType())) {
event.setCancelled(true);
}
}
case MOVE_TO_OTHER_INVENTORY -> {
event.setCancelled(true);
} // definitely one or the other
default -> {
} // do nothing for any other action
}
}

} else if (mgPlayer.isInMinigame()) {
if (!mgPlayer.getLoadout().allowOffHand() && event.getSlot() == 40) {
} else if (ply.isInMinigame()) {
if (!ply.getLoadout().allowOffHand() && event.getSlot() == 40) {
event.setCancelled(true);
} else if ((mgPlayer.getLoadout().isArmourLocked() && event.getSlot() >= 36 && event.getSlot() <= 39) ||
(mgPlayer.getLoadout().isInventoryLocked() && event.getSlot() >= 0 && event.getSlot() <= 35)) {
} else if ((ply.getLoadout().isArmourLocked() && event.getSlot() >= 36 && event.getSlot() <= 39) ||
(ply.getLoadout().isInventoryLocked() && event.getSlot() >= 0 && event.getSlot() <= 35)) {
event.setCancelled(true);
}
}
Expand Down Expand Up @@ -747,6 +715,7 @@ private void manualItemEntry(AsyncPlayerChatEvent event) {
ply.getManualEntry().checkValidEntry(event.getMessage());
ply.setManualEntry(null);
}

}

@EventHandler(ignoreCancelled = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

public enum MinigameMessageType {
INFO,
WARN,
ERROR,
WIN,
LOSS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,10 @@ public static MinigameTool giveMinigameTool(MinigamePlayer player) {
*/
public static boolean hasMinigameTool(MinigamePlayer player) {
for (ItemStack i : player.getPlayer().getInventory().getContents()) {
if (i != null && i.getItemMeta() != null &&
i.getItemMeta().getDisplayName().equals(ChatColor.GREEN + "Minigame Tool")) {
return true;
if (i != null && i.getItemMeta() != null) {
if (i.getItemMeta().getDisplayName().equals(ChatColor.GREEN + "Minigame Tool")) {
return true;
}
}
}
return false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package au.com.mineauz.minigames;

import au.com.mineauz.minigames.backend.BackendManager;
import au.com.mineauz.minigames.blockRecorder.BasicRecorder;
import au.com.mineauz.minigames.commands.CommandDispatcher;
import au.com.mineauz.minigames.config.MinigameSave;
import au.com.mineauz.minigames.display.DisplayManager;
Expand All @@ -13,7 +14,6 @@
import au.com.mineauz.minigames.minigame.reward.RewardsModule;
import au.com.mineauz.minigames.objects.MinigamePlayer;
import au.com.mineauz.minigames.objects.ResourcePack;
import au.com.mineauz.minigames.recorder.BasicRecorder;
import au.com.mineauz.minigames.signs.SignBase;
import au.com.mineauz.minigames.stats.MinigameStats;
import au.com.mineauz.minigames.stats.StatValueField;
Expand Down
Loading

0 comments on commit f34afbb

Please sign in to comment.