mirror of
https://github.com/SunNetservers/MiniGames.git
synced 2025-04-03 10:16:26 +02:00
Fixes some minor issues
Adds some missing save arena method calls for parkourArena's edit methods. Adds a message when a player reaches a new parkour checkpoint, and makes sure to avoid repeated messages. Adds /dleave and /pleave as aliases to /minigamesleave
This commit is contained in:
parent
c68cafb925
commit
b0a72561f9
@ -32,7 +32,7 @@ public class ParkourArena implements Arena {
|
|||||||
/**
|
/**
|
||||||
* An unique and persistent identifier for this arena
|
* An unique and persistent identifier for this arena
|
||||||
*/
|
*/
|
||||||
private final UUID arenaId;
|
private final @NotNull UUID arenaId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A name used when listing and storing this arena.
|
* A name used when listing and storing this arena.
|
||||||
@ -78,9 +78,9 @@ public class ParkourArena implements Arena {
|
|||||||
/**
|
/**
|
||||||
* The arena data for this arena
|
* The arena data for this arena
|
||||||
*/
|
*/
|
||||||
private final ParkourArenaData parkourArenaData;
|
private final @NotNull ParkourArenaData parkourArenaData;
|
||||||
|
|
||||||
private final ParkourArenaHandler parkourArenaHandler;
|
private final @NotNull ParkourArenaHandler parkourArenaHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new parkour arena
|
* Instantiates a new parkour arena
|
||||||
@ -278,7 +278,7 @@ public class ParkourArena implements Arena {
|
|||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
this.spawnLocation = newLocation;
|
this.spawnLocation = newLocation;
|
||||||
parkourArenaHandler.saveArenas();
|
this.parkourArenaHandler.saveArenas();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -294,7 +294,7 @@ public class ParkourArena implements Arena {
|
|||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
this.exitLocation = newLocation;
|
this.exitLocation = newLocation;
|
||||||
parkourArenaHandler.saveArenas();
|
this.parkourArenaHandler.saveArenas();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -310,8 +310,8 @@ public class ParkourArena implements Arena {
|
|||||||
String oldName = this.getArenaNameSanitized();
|
String oldName = this.getArenaNameSanitized();
|
||||||
this.arenaName = arenaName;
|
this.arenaName = arenaName;
|
||||||
// Update the arena lookup map to make sure the new name can be used immediately
|
// Update the arena lookup map to make sure the new name can be used immediately
|
||||||
parkourArenaHandler.updateLookupName(oldName, this.getArenaNameSanitized());
|
this.parkourArenaHandler.updateLookupName(oldName, this.getArenaNameSanitized());
|
||||||
parkourArenaHandler.saveArenas();
|
this.parkourArenaHandler.saveArenas();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -331,7 +331,7 @@ public class ParkourArena implements Arena {
|
|||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
this.winBlockType = material;
|
this.winBlockType = material;
|
||||||
parkourArenaHandler.saveArenas();
|
this.parkourArenaHandler.saveArenas();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -347,7 +347,7 @@ public class ParkourArena implements Arena {
|
|||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
this.winLocation = newLocation.clone();
|
this.winLocation = newLocation.clone();
|
||||||
parkourArenaHandler.saveArenas();
|
this.parkourArenaHandler.saveArenas();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -367,6 +367,7 @@ public class ParkourArena implements Arena {
|
|||||||
}
|
}
|
||||||
this.killPlaneBlocks = parsed;
|
this.killPlaneBlocks = parsed;
|
||||||
}
|
}
|
||||||
|
this.parkourArenaHandler.saveArenas();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -382,6 +383,7 @@ public class ParkourArena implements Arena {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.checkpoints.add(checkpoint.clone());
|
this.checkpoints.add(checkpoint.clone());
|
||||||
|
this.parkourArenaHandler.saveArenas();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -392,6 +394,7 @@ public class ParkourArena implements Arena {
|
|||||||
*/
|
*/
|
||||||
public boolean clearCheckpoints() {
|
public boolean clearCheckpoints() {
|
||||||
this.checkpoints.clear();
|
this.checkpoints.clear();
|
||||||
|
this.parkourArenaHandler.saveArenas();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ public class MoveListener implements Listener {
|
|||||||
if (event.getTo() == null || event.getFrom().getBlock() == event.getTo().getBlock()) {
|
if (event.getTo() == null || event.getFrom().getBlock() == event.getTo().getBlock()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only do block type checking if the block beneath the player changes
|
// Only do block type checking if the block beneath the player changes
|
||||||
if (checkForSpecialBlock(arenaSession, event.getTo())) {
|
if (checkForSpecialBlock(arenaSession, event.getTo())) {
|
||||||
return;
|
return;
|
||||||
@ -71,8 +71,10 @@ public class MoveListener implements Listener {
|
|||||||
|
|
||||||
// Check if the player reached one of the checkpoints for the arena
|
// Check if the player reached one of the checkpoints for the arena
|
||||||
for (Location checkpoint : arenaSession.getArena().getCheckpoints()) {
|
for (Location checkpoint : arenaSession.getArena().getCheckpoints()) {
|
||||||
if (checkpoint.getBlock().equals(event.getTo().getBlock())) {
|
if (checkpoint.getBlock().equals(event.getTo().getBlock()) &&
|
||||||
|
!checkpoint.equals(arenaSession.getRegisteredCheckpoint())) {
|
||||||
arenaSession.registerCheckpoint(checkpoint.clone());
|
arenaSession.registerCheckpoint(checkpoint.clone());
|
||||||
|
event.getPlayer().sendMessage("Checkpoint reached!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,8 @@ commands:
|
|||||||
miniGamesLeave:
|
miniGamesLeave:
|
||||||
aliases:
|
aliases:
|
||||||
- mleave
|
- mleave
|
||||||
|
- dleave
|
||||||
|
- pleave
|
||||||
permission: minigames.join
|
permission: minigames.join
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
description: Used to leave the current dropper arena
|
description: Used to leave the current dropper arena
|
||||||
|
Loading…
x
Reference in New Issue
Block a user