Added javadoc

This commit is contained in:
Stijn Bannink 2023-07-04 17:47:30 +02:00
parent 336d9626e1
commit 3ac1042894
10 changed files with 188 additions and 0 deletions

View file

@ -18,9 +18,17 @@
package tech.sbdevelopment.mapreflectionapi.api; package tech.sbdevelopment.mapreflectionapi.api;
/**
* A {@link MapWrapper} wraps one image.
*/
public abstract class MapWrapper extends AbstractMapWrapper { public abstract class MapWrapper extends AbstractMapWrapper {
protected ArrayImage content; protected ArrayImage content;
/**
* Construct a new {@link MapWrapper}
*
* @param image The {@link ArrayImage} to wrap
*/
public MapWrapper(ArrayImage image) { public MapWrapper(ArrayImage image) {
this.content = image; this.content = image;
} }

View file

@ -29,6 +29,9 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
/**
* The {@link MapSender_v1_12_R1} sends the Map packets to players.
*/
public class MapSender_v1_12_R1 { public class MapSender_v1_12_R1 {
private static final List<QueuedMap> sendQueue = new ArrayList<>(); private static final List<QueuedMap> sendQueue = new ArrayList<>();
private static int senderID = -1; private static int senderID = -1;
@ -36,6 +39,13 @@ public class MapSender_v1_12_R1 {
private MapSender_v1_12_R1() { private MapSender_v1_12_R1() {
} }
/**
* Add a map to the send queue
*
* @param id The ID of the map
* @param content The {@link ArrayImage} to view on the map
* @param player The {@link Player} to view for
*/
public static void addToQueue(final int id, final ArrayImage content, final Player player) { public static void addToQueue(final int id, final ArrayImage content, final Player player) {
QueuedMap toSend = new QueuedMap(id, content, player); QueuedMap toSend = new QueuedMap(id, content, player);
if (sendQueue.contains(toSend)) return; if (sendQueue.contains(toSend)) return;
@ -53,6 +63,9 @@ public class MapSender_v1_12_R1 {
sendQueue.removeIf(queuedMap -> queuedMap.id == s); sendQueue.removeIf(queuedMap -> queuedMap.id == s);
} }
/**
* Run the sender task
*/
private static void runSender() { private static void runSender() {
if (Bukkit.getScheduler().isQueued(senderID) || Bukkit.getScheduler().isCurrentlyRunning(senderID) || sendQueue.isEmpty()) if (Bukkit.getScheduler().isQueued(senderID) || Bukkit.getScheduler().isCurrentlyRunning(senderID) || sendQueue.isEmpty())
return; return;
@ -71,6 +84,13 @@ public class MapSender_v1_12_R1 {
}, 0, 2); }, 0, 2);
} }
/**
* Send a map to a player
*
* @param id0 The ID of the map
* @param content The {@link ArrayImage} to view on the map
* @param player The {@link Player} to view for
*/
public static void sendMap(final int id0, final ArrayImage content, final Player player) { public static void sendMap(final int id0, final ArrayImage content, final Player player) {
if (player == null || !player.isOnline()) { if (player == null || !player.isOnline()) {
List<QueuedMap> toRemove = new ArrayList<>(); List<QueuedMap> toRemove = new ArrayList<>();

View file

@ -29,6 +29,9 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
/**
* The {@link MapSender_v1_13_R2} sends the Map packets to players.
*/
public class MapSender_v1_13_R2 { public class MapSender_v1_13_R2 {
private static final List<QueuedMap> sendQueue = new ArrayList<>(); private static final List<QueuedMap> sendQueue = new ArrayList<>();
private static int senderID = -1; private static int senderID = -1;
@ -36,6 +39,13 @@ public class MapSender_v1_13_R2 {
private MapSender_v1_13_R2() { private MapSender_v1_13_R2() {
} }
/**
* Add a map to the send queue
*
* @param id The ID of the map
* @param content The {@link ArrayImage} to view on the map
* @param player The {@link Player} to view for
*/
public static void addToQueue(final int id, final ArrayImage content, final Player player) { public static void addToQueue(final int id, final ArrayImage content, final Player player) {
QueuedMap toSend = new QueuedMap(id, content, player); QueuedMap toSend = new QueuedMap(id, content, player);
if (sendQueue.contains(toSend)) return; if (sendQueue.contains(toSend)) return;
@ -53,6 +63,9 @@ public class MapSender_v1_13_R2 {
sendQueue.removeIf(queuedMap -> queuedMap.id == s); sendQueue.removeIf(queuedMap -> queuedMap.id == s);
} }
/**
* Run the sender task
*/
private static void runSender() { private static void runSender() {
if (Bukkit.getScheduler().isQueued(senderID) || Bukkit.getScheduler().isCurrentlyRunning(senderID) || sendQueue.isEmpty()) if (Bukkit.getScheduler().isQueued(senderID) || Bukkit.getScheduler().isCurrentlyRunning(senderID) || sendQueue.isEmpty())
return; return;
@ -71,6 +84,13 @@ public class MapSender_v1_13_R2 {
}, 0, 2); }, 0, 2);
} }
/**
* Send a map to a player
*
* @param id0 The ID of the map
* @param content The {@link ArrayImage} to view on the map
* @param player The {@link Player} to view for
*/
public static void sendMap(final int id0, final ArrayImage content, final Player player) { public static void sendMap(final int id0, final ArrayImage content, final Player player) {
if (player == null || !player.isOnline()) { if (player == null || !player.isOnline()) {
List<QueuedMap> toRemove = new ArrayList<>(); List<QueuedMap> toRemove = new ArrayList<>();

View file

@ -29,6 +29,9 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
/**
* The {@link MapSender_v1_14_R1} sends the Map packets to players.
*/
public class MapSender_v1_14_R1 { public class MapSender_v1_14_R1 {
private static final List<QueuedMap> sendQueue = new ArrayList<>(); private static final List<QueuedMap> sendQueue = new ArrayList<>();
private static int senderID = -1; private static int senderID = -1;
@ -36,6 +39,13 @@ public class MapSender_v1_14_R1 {
private MapSender_v1_14_R1() { private MapSender_v1_14_R1() {
} }
/**
* Add a map to the send queue
*
* @param id The ID of the map
* @param content The {@link ArrayImage} to view on the map
* @param player The {@link Player} to view for
*/
public static void addToQueue(final int id, final ArrayImage content, final Player player) { public static void addToQueue(final int id, final ArrayImage content, final Player player) {
QueuedMap toSend = new QueuedMap(id, content, player); QueuedMap toSend = new QueuedMap(id, content, player);
if (sendQueue.contains(toSend)) return; if (sendQueue.contains(toSend)) return;
@ -53,6 +63,9 @@ public class MapSender_v1_14_R1 {
sendQueue.removeIf(queuedMap -> queuedMap.id == s); sendQueue.removeIf(queuedMap -> queuedMap.id == s);
} }
/**
* Run the sender task
*/
private static void runSender() { private static void runSender() {
if (Bukkit.getScheduler().isQueued(senderID) || Bukkit.getScheduler().isCurrentlyRunning(senderID) || sendQueue.isEmpty()) if (Bukkit.getScheduler().isQueued(senderID) || Bukkit.getScheduler().isCurrentlyRunning(senderID) || sendQueue.isEmpty())
return; return;
@ -71,6 +84,13 @@ public class MapSender_v1_14_R1 {
}, 0, 2); }, 0, 2);
} }
/**
* Send a map to a player
*
* @param id0 The ID of the map
* @param content The {@link ArrayImage} to view on the map
* @param player The {@link Player} to view for
*/
public static void sendMap(final int id0, final ArrayImage content, final Player player) { public static void sendMap(final int id0, final ArrayImage content, final Player player) {
if (player == null || !player.isOnline()) { if (player == null || !player.isOnline()) {
List<QueuedMap> toRemove = new ArrayList<>(); List<QueuedMap> toRemove = new ArrayList<>();

View file

@ -29,6 +29,9 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
/**
* The {@link MapSender_v1_15_R1} sends the Map packets to players.
*/
public class MapSender_v1_15_R1 { public class MapSender_v1_15_R1 {
private static final List<QueuedMap> sendQueue = new ArrayList<>(); private static final List<QueuedMap> sendQueue = new ArrayList<>();
private static int senderID = -1; private static int senderID = -1;
@ -36,6 +39,13 @@ public class MapSender_v1_15_R1 {
private MapSender_v1_15_R1() { private MapSender_v1_15_R1() {
} }
/**
* Add a map to the send queue
*
* @param id The ID of the map
* @param content The {@link ArrayImage} to view on the map
* @param player The {@link Player} to view for
*/
public static void addToQueue(final int id, final ArrayImage content, final Player player) { public static void addToQueue(final int id, final ArrayImage content, final Player player) {
QueuedMap toSend = new QueuedMap(id, content, player); QueuedMap toSend = new QueuedMap(id, content, player);
if (sendQueue.contains(toSend)) return; if (sendQueue.contains(toSend)) return;
@ -53,6 +63,9 @@ public class MapSender_v1_15_R1 {
sendQueue.removeIf(queuedMap -> queuedMap.id == s); sendQueue.removeIf(queuedMap -> queuedMap.id == s);
} }
/**
* Run the sender task
*/
private static void runSender() { private static void runSender() {
if (Bukkit.getScheduler().isQueued(senderID) || Bukkit.getScheduler().isCurrentlyRunning(senderID) || sendQueue.isEmpty()) if (Bukkit.getScheduler().isQueued(senderID) || Bukkit.getScheduler().isCurrentlyRunning(senderID) || sendQueue.isEmpty())
return; return;
@ -71,6 +84,13 @@ public class MapSender_v1_15_R1 {
}, 0, 2); }, 0, 2);
} }
/**
* Send a map to a player
*
* @param id0 The ID of the map
* @param content The {@link ArrayImage} to view on the map
* @param player The {@link Player} to view for
*/
public static void sendMap(final int id0, final ArrayImage content, final Player player) { public static void sendMap(final int id0, final ArrayImage content, final Player player) {
if (player == null || !player.isOnline()) { if (player == null || !player.isOnline()) {
List<QueuedMap> toRemove = new ArrayList<>(); List<QueuedMap> toRemove = new ArrayList<>();

View file

@ -29,6 +29,9 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
/**
* The {@link MapSender_v1_16_R3} sends the Map packets to players.
*/
public class MapSender_v1_16_R3 { public class MapSender_v1_16_R3 {
private static final List<QueuedMap> sendQueue = new ArrayList<>(); private static final List<QueuedMap> sendQueue = new ArrayList<>();
private static int senderID = -1; private static int senderID = -1;
@ -36,6 +39,13 @@ public class MapSender_v1_16_R3 {
private MapSender_v1_16_R3() { private MapSender_v1_16_R3() {
} }
/**
* Add a map to the send queue
*
* @param id The ID of the map
* @param content The {@link ArrayImage} to view on the map
* @param player The {@link Player} to view for
*/
public static void addToQueue(final int id, final ArrayImage content, final Player player) { public static void addToQueue(final int id, final ArrayImage content, final Player player) {
QueuedMap toSend = new QueuedMap(id, content, player); QueuedMap toSend = new QueuedMap(id, content, player);
if (sendQueue.contains(toSend)) return; if (sendQueue.contains(toSend)) return;
@ -53,6 +63,9 @@ public class MapSender_v1_16_R3 {
sendQueue.removeIf(queuedMap -> queuedMap.id == s); sendQueue.removeIf(queuedMap -> queuedMap.id == s);
} }
/**
* Run the sender task
*/
private static void runSender() { private static void runSender() {
if (Bukkit.getScheduler().isQueued(senderID) || Bukkit.getScheduler().isCurrentlyRunning(senderID) || sendQueue.isEmpty()) if (Bukkit.getScheduler().isQueued(senderID) || Bukkit.getScheduler().isCurrentlyRunning(senderID) || sendQueue.isEmpty())
return; return;
@ -71,6 +84,13 @@ public class MapSender_v1_16_R3 {
}, 0, 2); }, 0, 2);
} }
/**
* Send a map to a player
*
* @param id0 The ID of the map
* @param content The {@link ArrayImage} to view on the map
* @param player The {@link Player} to view for
*/
public static void sendMap(final int id0, final ArrayImage content, final Player player) { public static void sendMap(final int id0, final ArrayImage content, final Player player) {
if (player == null || !player.isOnline()) { if (player == null || !player.isOnline()) {
List<QueuedMap> toRemove = new ArrayList<>(); List<QueuedMap> toRemove = new ArrayList<>();

View file

@ -29,6 +29,9 @@ import tech.sbdevelopment.mapreflectionapi.api.ArrayImage;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/**
* The {@link MapSender_v1_17_R1} sends the Map packets to players.
*/
public class MapSender_v1_17_R1 { public class MapSender_v1_17_R1 {
private static final List<QueuedMap> sendQueue = new ArrayList<>(); private static final List<QueuedMap> sendQueue = new ArrayList<>();
private static int senderID = -1; private static int senderID = -1;
@ -36,6 +39,13 @@ public class MapSender_v1_17_R1 {
private MapSender_v1_17_R1() { private MapSender_v1_17_R1() {
} }
/**
* Add a map to the send queue
*
* @param id The ID of the map
* @param content The {@link ArrayImage} to view on the map
* @param player The {@link Player} to view for
*/
public static void addToQueue(final int id, final ArrayImage content, final Player player) { public static void addToQueue(final int id, final ArrayImage content, final Player player) {
QueuedMap toSend = new QueuedMap(id, content, player); QueuedMap toSend = new QueuedMap(id, content, player);
if (sendQueue.contains(toSend)) return; if (sendQueue.contains(toSend)) return;
@ -53,6 +63,9 @@ public class MapSender_v1_17_R1 {
sendQueue.removeIf(queuedMap -> queuedMap.id == s); sendQueue.removeIf(queuedMap -> queuedMap.id == s);
} }
/**
* Run the sender task
*/
private static void runSender() { private static void runSender() {
if (Bukkit.getScheduler().isQueued(senderID) || Bukkit.getScheduler().isCurrentlyRunning(senderID) || sendQueue.isEmpty()) if (Bukkit.getScheduler().isQueued(senderID) || Bukkit.getScheduler().isCurrentlyRunning(senderID) || sendQueue.isEmpty())
return; return;
@ -71,6 +84,13 @@ public class MapSender_v1_17_R1 {
}, 0, 2); }, 0, 2);
} }
/**
* Send a map to a player
*
* @param id0 The ID of the map
* @param content The {@link ArrayImage} to view on the map
* @param player The {@link Player} to view for
*/
public static void sendMap(final int id0, final ArrayImage content, final Player player) { public static void sendMap(final int id0, final ArrayImage content, final Player player) {
if (player == null || !player.isOnline()) { if (player == null || !player.isOnline()) {
List<QueuedMap> toRemove = new ArrayList<>(); List<QueuedMap> toRemove = new ArrayList<>();

View file

@ -29,6 +29,9 @@ import tech.sbdevelopment.mapreflectionapi.api.ArrayImage;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/**
* The {@link MapSender_v1_18_R2} sends the Map packets to players.
*/
public class MapSender_v1_18_R2 { public class MapSender_v1_18_R2 {
private static final List<QueuedMap> sendQueue = new ArrayList<>(); private static final List<QueuedMap> sendQueue = new ArrayList<>();
private static int senderID = -1; private static int senderID = -1;
@ -36,6 +39,13 @@ public class MapSender_v1_18_R2 {
private MapSender_v1_18_R2() { private MapSender_v1_18_R2() {
} }
/**
* Add a map to the send queue
*
* @param id The ID of the map
* @param content The {@link ArrayImage} to view on the map
* @param player The {@link Player} to view for
*/
public static void addToQueue(final int id, final ArrayImage content, final Player player) { public static void addToQueue(final int id, final ArrayImage content, final Player player) {
QueuedMap toSend = new QueuedMap(id, content, player); QueuedMap toSend = new QueuedMap(id, content, player);
if (sendQueue.contains(toSend)) return; if (sendQueue.contains(toSend)) return;
@ -53,6 +63,9 @@ public class MapSender_v1_18_R2 {
sendQueue.removeIf(queuedMap -> queuedMap.id == s); sendQueue.removeIf(queuedMap -> queuedMap.id == s);
} }
/**
* Run the sender task
*/
private static void runSender() { private static void runSender() {
if (Bukkit.getScheduler().isQueued(senderID) || Bukkit.getScheduler().isCurrentlyRunning(senderID) || sendQueue.isEmpty()) if (Bukkit.getScheduler().isQueued(senderID) || Bukkit.getScheduler().isCurrentlyRunning(senderID) || sendQueue.isEmpty())
return; return;
@ -71,6 +84,13 @@ public class MapSender_v1_18_R2 {
}, 0, 2); }, 0, 2);
} }
/**
* Send a map to a player
*
* @param id0 The ID of the map
* @param content The {@link ArrayImage} to view on the map
* @param player The {@link Player} to view for
*/
public static void sendMap(final int id0, final ArrayImage content, final Player player) { public static void sendMap(final int id0, final ArrayImage content, final Player player) {
if (player == null || !player.isOnline()) { if (player == null || !player.isOnline()) {
List<QueuedMap> toRemove = new ArrayList<>(); List<QueuedMap> toRemove = new ArrayList<>();

View file

@ -29,6 +29,9 @@ import tech.sbdevelopment.mapreflectionapi.api.ArrayImage;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/**
* The {@link MapSender_v1_19_R3} sends the Map packets to players.
*/
public class MapSender_v1_19_R3 { public class MapSender_v1_19_R3 {
private static final List<QueuedMap> sendQueue = new ArrayList<>(); private static final List<QueuedMap> sendQueue = new ArrayList<>();
private static int senderID = -1; private static int senderID = -1;
@ -36,6 +39,13 @@ public class MapSender_v1_19_R3 {
private MapSender_v1_19_R3() { private MapSender_v1_19_R3() {
} }
/**
* Add a map to the send queue
*
* @param id The ID of the map
* @param content The {@link ArrayImage} to view on the map
* @param player The {@link Player} to view for
*/
public static void addToQueue(final int id, final ArrayImage content, final Player player) { public static void addToQueue(final int id, final ArrayImage content, final Player player) {
QueuedMap toSend = new QueuedMap(id, content, player); QueuedMap toSend = new QueuedMap(id, content, player);
if (sendQueue.contains(toSend)) return; if (sendQueue.contains(toSend)) return;
@ -53,6 +63,9 @@ public class MapSender_v1_19_R3 {
sendQueue.removeIf(queuedMap -> queuedMap.id == s); sendQueue.removeIf(queuedMap -> queuedMap.id == s);
} }
/**
* Run the sender task
*/
private static void runSender() { private static void runSender() {
if (Bukkit.getScheduler().isQueued(senderID) || Bukkit.getScheduler().isCurrentlyRunning(senderID) || sendQueue.isEmpty()) if (Bukkit.getScheduler().isQueued(senderID) || Bukkit.getScheduler().isCurrentlyRunning(senderID) || sendQueue.isEmpty())
return; return;
@ -71,6 +84,13 @@ public class MapSender_v1_19_R3 {
}, 0, 2); }, 0, 2);
} }
/**
* Send a map to a player
*
* @param id0 The ID of the map
* @param content The {@link ArrayImage} to view on the map
* @param player The {@link Player} to view for
*/
public static void sendMap(final int id0, final ArrayImage content, final Player player) { public static void sendMap(final int id0, final ArrayImage content, final Player player) {
if (player == null || !player.isOnline()) { if (player == null || !player.isOnline()) {
List<QueuedMap> toRemove = new ArrayList<>(); List<QueuedMap> toRemove = new ArrayList<>();

View file

@ -29,6 +29,9 @@ import tech.sbdevelopment.mapreflectionapi.api.ArrayImage;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/**
* The {@link MapSender_v1_20_R1} sends the Map packets to players.
*/
public class MapSender_v1_20_R1 { public class MapSender_v1_20_R1 {
private static final List<QueuedMap> sendQueue = new ArrayList<>(); private static final List<QueuedMap> sendQueue = new ArrayList<>();
private static int senderID = -1; private static int senderID = -1;
@ -36,6 +39,13 @@ public class MapSender_v1_20_R1 {
private MapSender_v1_20_R1() { private MapSender_v1_20_R1() {
} }
/**
* Add a map to the send queue
*
* @param id The ID of the map
* @param content The {@link ArrayImage} to view on the map
* @param player The {@link Player} to view for
*/
public static void addToQueue(final int id, final ArrayImage content, final Player player) { public static void addToQueue(final int id, final ArrayImage content, final Player player) {
QueuedMap toSend = new QueuedMap(id, content, player); QueuedMap toSend = new QueuedMap(id, content, player);
if (sendQueue.contains(toSend)) return; if (sendQueue.contains(toSend)) return;
@ -53,6 +63,9 @@ public class MapSender_v1_20_R1 {
sendQueue.removeIf(queuedMap -> queuedMap.id == s); sendQueue.removeIf(queuedMap -> queuedMap.id == s);
} }
/**
* Run the sender task
*/
private static void runSender() { private static void runSender() {
if (Bukkit.getScheduler().isQueued(senderID) || Bukkit.getScheduler().isCurrentlyRunning(senderID) || sendQueue.isEmpty()) if (Bukkit.getScheduler().isQueued(senderID) || Bukkit.getScheduler().isCurrentlyRunning(senderID) || sendQueue.isEmpty())
return; return;
@ -71,6 +84,13 @@ public class MapSender_v1_20_R1 {
}, 0, 2); }, 0, 2);
} }
/**
* Send a map to a player
*
* @param id0 The ID of the map
* @param content The {@link ArrayImage} to view on the map
* @param player The {@link Player} to view for
*/
public static void sendMap(final int id0, final ArrayImage content, final Player player) { public static void sendMap(final int id0, final ArrayImage content, final Player player) {
if (player == null || !player.isOnline()) { if (player == null || !player.isOnline()) {
List<QueuedMap> toRemove = new ArrayList<>(); List<QueuedMap> toRemove = new ArrayList<>();