📝 Added more API documentation
This commit is contained in:
parent
2dc4338cdb
commit
47cf6a26c0
15 changed files with 114 additions and 2 deletions
2
pom.xml
2
pom.xml
|
@ -149,6 +149,8 @@
|
||||||
<sourceFileExclude>**/com/bergerkiller/bukkit/common/map/*.java</sourceFileExclude>
|
<sourceFileExclude>**/com/bergerkiller/bukkit/common/map/*.java</sourceFileExclude>
|
||||||
<sourceFileExclude>**/com/bergerkiller/bukkit/common/map/color/*.java</sourceFileExclude>
|
<sourceFileExclude>**/com/bergerkiller/bukkit/common/map/color/*.java</sourceFileExclude>
|
||||||
<sourceFileExclude>**/tech/sbdevelopment/mapreflectionapi/*.java</sourceFileExclude>
|
<sourceFileExclude>**/tech/sbdevelopment/mapreflectionapi/*.java</sourceFileExclude>
|
||||||
|
<sourceFileExclude>**/tech/sbdevelopment/mapreflectionapi/cmd/*.java</sourceFileExclude>
|
||||||
|
<sourceFileExclude>**/tech/sbdevelopment/mapreflectionapi/managers/*.java</sourceFileExclude>
|
||||||
<sourceFileExclude>**/tech/sbdevelopment/mapreflectionapi/utils/*.java</sourceFileExclude>
|
<sourceFileExclude>**/tech/sbdevelopment/mapreflectionapi/utils/*.java</sourceFileExclude>
|
||||||
<sourceFileExclude>**/tech/sbdevelopment/mapreflectionapi/listeners/*.java</sourceFileExclude>
|
<sourceFileExclude>**/tech/sbdevelopment/mapreflectionapi/listeners/*.java</sourceFileExclude>
|
||||||
</sourceFileExcludes>
|
</sourceFileExcludes>
|
||||||
|
|
5
src/main/java/module-info.java
Normal file
5
src/main/java/module-info.java
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
/**
|
||||||
|
* This API helps developer with viewing images on maps or in inventories.
|
||||||
|
*/
|
||||||
|
module MapReflectionAPI {
|
||||||
|
}
|
|
@ -23,6 +23,9 @@
|
||||||
|
|
||||||
package tech.sbdevelopment.mapreflectionapi.api;
|
package tech.sbdevelopment.mapreflectionapi.api;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The abstract class of a wrapped map.
|
||||||
|
*/
|
||||||
public abstract class AbstractMapWrapper {
|
public abstract class AbstractMapWrapper {
|
||||||
/**
|
/**
|
||||||
* Get the controller of this wrapper
|
* Get the controller of this wrapper
|
||||||
|
|
|
@ -32,7 +32,7 @@ import java.awt.*;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class contains an image converted to a Minecraft byte array
|
* An {@link ArrayImage} contains an image converted to a Minecraft byte array.
|
||||||
*/
|
*/
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@EqualsAndHashCode
|
@EqualsAndHashCode
|
||||||
|
|
|
@ -28,6 +28,9 @@ import org.bukkit.entity.Player;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import tech.sbdevelopment.mapreflectionapi.api.exceptions.MapLimitExceededException;
|
import tech.sbdevelopment.mapreflectionapi.api.exceptions.MapLimitExceededException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This interface contains the methods for both the {@link MapController} and the {@link MultiMapController}.
|
||||||
|
*/
|
||||||
public interface IMapController {
|
public interface IMapController {
|
||||||
/**
|
/**
|
||||||
* Add a viewer
|
* Add a viewer
|
||||||
|
|
|
@ -28,6 +28,9 @@ import org.bukkit.World;
|
||||||
import org.bukkit.entity.ItemFrame;
|
import org.bukkit.entity.ItemFrame;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A {@link MapController} controls one {@link MapWrapper}.
|
||||||
|
*/
|
||||||
public interface MapController extends IMapController {
|
public interface MapController extends IMapController {
|
||||||
/**
|
/**
|
||||||
* @deprecated Please use {@link MapWrapper#getContent()}
|
* @deprecated Please use {@link MapWrapper#getContent()}
|
||||||
|
|
|
@ -35,6 +35,9 @@ import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@link MapManager} manages all the maps. It also contains functions for wrapping.
|
||||||
|
*/
|
||||||
public class MapManager {
|
public class MapManager {
|
||||||
protected final Set<Integer> occupiedIds = new HashSet<>();
|
protected final Set<Integer> occupiedIds = new HashSet<>();
|
||||||
protected final List<MapWrapper> managedMaps = new CopyOnWriteArrayList<>();
|
protected final List<MapWrapper> managedMaps = new CopyOnWriteArrayList<>();
|
||||||
|
|
|
@ -32,6 +32,9 @@ import tech.sbdevelopment.mapreflectionapi.utils.ReflectionUtil;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@link MapSender} sends the Map packets to players.
|
||||||
|
*/
|
||||||
public class MapSender {
|
public class MapSender {
|
||||||
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;
|
||||||
|
|
|
@ -38,6 +38,9 @@ import tech.sbdevelopment.mapreflectionapi.utils.ReflectionUtil;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A {@link MapWrapper} wraps one image.
|
||||||
|
*/
|
||||||
public class MapWrapper extends AbstractMapWrapper {
|
public class MapWrapper extends AbstractMapWrapper {
|
||||||
private static final String REFERENCE_METADATA = "MAP_WRAPPER_REF";
|
private static final String REFERENCE_METADATA = "MAP_WRAPPER_REF";
|
||||||
protected ArrayImage content;
|
protected ArrayImage content;
|
||||||
|
|
|
@ -29,6 +29,9 @@ import org.bukkit.entity.Player;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import tech.sbdevelopment.mapreflectionapi.api.exceptions.MapLimitExceededException;
|
import tech.sbdevelopment.mapreflectionapi.api.exceptions.MapLimitExceededException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A {@link MultiMapController} controls multiple {@link MapWrapper}s (a.k.a. the {@link MultiMapWrapper}).
|
||||||
|
*/
|
||||||
public interface MultiMapController extends IMapController {
|
public interface MultiMapController extends IMapController {
|
||||||
/**
|
/**
|
||||||
* Add a viewer
|
* Add a viewer
|
||||||
|
|
|
@ -36,6 +36,9 @@ import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A {@link MultiMapWrapper} wraps one image split in pieces.
|
||||||
|
*/
|
||||||
public class MultiMapWrapper extends AbstractMapWrapper {
|
public class MultiMapWrapper extends AbstractMapWrapper {
|
||||||
private final MapWrapper[][] wrapperMatrix;
|
private final MapWrapper[][] wrapperMatrix;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
/*
|
||||||
|
* This file is part of MapReflectionAPI.
|
||||||
|
* Copyright (c) 2022 inventivetalent / SBDevelopment - All Rights Reserved
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Events package contains all the custom events the API fires.
|
||||||
|
*/
|
||||||
|
package tech.sbdevelopment.mapreflectionapi.api.events;
|
|
@ -0,0 +1,27 @@
|
||||||
|
/*
|
||||||
|
* This file is part of MapReflectionAPI.
|
||||||
|
* Copyright (c) 2022 inventivetalent / SBDevelopment - All Rights Reserved
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Exceptions package contains all the custom exceptions the API may throw.
|
||||||
|
*/
|
||||||
|
package tech.sbdevelopment.mapreflectionapi.api.exceptions;
|
|
@ -0,0 +1,27 @@
|
||||||
|
/*
|
||||||
|
* This file is part of MapReflectionAPI.
|
||||||
|
* Copyright (c) 2022 inventivetalent / SBDevelopment - All Rights Reserved
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The API package contains all the API you can interact with.
|
||||||
|
*/
|
||||||
|
package tech.sbdevelopment.mapreflectionapi.api;
|
|
@ -3,7 +3,7 @@ version: '${project.version}'
|
||||||
main: tech.sbdevelopment.mapreflectionapi.MapReflectionAPI
|
main: tech.sbdevelopment.mapreflectionapi.MapReflectionAPI
|
||||||
api-version: 1.13
|
api-version: 1.13
|
||||||
authors: [ inventivetalent, SBDeveloper ]
|
authors: [ inventivetalent, SBDeveloper ]
|
||||||
description: This API helps developer with viewing images on maps.
|
description: This API helps developer with viewing images on maps or in inventories.
|
||||||
website: https://sbdevelopment.tech
|
website: https://sbdevelopment.tech
|
||||||
softdepend: [ ProtocolLib ]
|
softdepend: [ ProtocolLib ]
|
||||||
commands:
|
commands:
|
||||||
|
|
Loading…
Add table
Reference in a new issue