mirror of
https://github.com/sekwah41/Advanced-Portals.git
synced 2024-11-22 02:25:49 +01:00
Started adding container data
This commit is contained in:
parent
1267b81ee2
commit
3bcf0bdc94
@ -0,0 +1,16 @@
|
||||
package com.sekwah.advancedportals.connector.container;
|
||||
|
||||
public interface CommandSenderContainer {
|
||||
|
||||
void sendMessage(String message);
|
||||
|
||||
boolean isOp();
|
||||
|
||||
/**
|
||||
* @return null if there isnt a player e.g. the console
|
||||
*/
|
||||
PlayerContainer getPlayerContainer();
|
||||
|
||||
boolean hasPermission(String permission);
|
||||
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package com.sekwah.advancedportals.connector.container;
|
||||
|
||||
import com.sekwah.advancedportals.core.data.BlockLocation;
|
||||
import com.sekwah.advancedportals.core.data.PlayerLocation;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Just a temporary container for whenever advanced portals needs to get data from a player
|
||||
*/
|
||||
public interface PlayerContainer {
|
||||
|
||||
UUID getUUID();
|
||||
|
||||
public void sendMessage(String message);
|
||||
|
||||
boolean isOp();
|
||||
|
||||
PlayerLocation getLoc();
|
||||
|
||||
double getEyeHeight();
|
||||
|
||||
void teleport(PlayerLocation location);
|
||||
|
||||
boolean hasPermission(String permission);
|
||||
|
||||
WorldContainer getWorld();
|
||||
|
||||
/**
|
||||
* @param blockPos
|
||||
* @param material
|
||||
*/
|
||||
void sendFakeBlock(BlockLocation blockPos, String material);
|
||||
|
||||
/**
|
||||
* Only 1.12 and below supported
|
||||
* @param blockPos
|
||||
* @param material
|
||||
* @param data
|
||||
*/
|
||||
void sendFakeBlockWithData(BlockLocation blockPos, String material, byte data);
|
||||
|
||||
void giveWool(String dyeColor, String itemName, String... itemDescription);
|
||||
|
||||
void giveItem(String material, String itemName, String... itemDescription);
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package com.sekwah.advancedportals.connector.container;
|
||||
|
||||
public interface ServerContainer {
|
||||
|
||||
WorldContainer getWorld(String name);
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.sekwah.advancedportals.connector.container;
|
||||
|
||||
import com.sekwah.advancedportals.core.data.BlockLocation;
|
||||
|
||||
public interface WorldContainer {
|
||||
|
||||
void setBlock(BlockLocation location, String material);
|
||||
|
||||
void setBlockData(BlockLocation location, byte data);
|
||||
|
||||
String getBlock(BlockLocation location);
|
||||
|
||||
byte getBlockData(BlockLocation location);
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
package com.sekwah.advancedportals.core.api.commands;
|
||||
|
||||
public interface SubCommand {
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package com.sekwah.advancedportals.core.commands;
|
||||
|
||||
import com.sekwah.advancedportals.connector.container.CommandSenderContainer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SubCommand {
|
||||
|
||||
/**
|
||||
* @param sender
|
||||
* @param args arguments including the subcommand that has been specified.
|
||||
* @return if the command has worked (if false it will just display a message from the command suggesting to check help)
|
||||
*/
|
||||
void onCommand(CommandSenderContainer sender, String[] args);
|
||||
|
||||
boolean hasPermission(CommandSenderContainer sender);
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param sender
|
||||
* @param args arguments including the subcommand that has been specified.
|
||||
* @return tab completion for the subcommand
|
||||
*/
|
||||
List<String> onTabComplete(CommandSenderContainer sender, String[] args);
|
||||
|
||||
/**
|
||||
* @return the string to show next to the tag on the help menu.
|
||||
*/
|
||||
String getBasicHelpText();
|
||||
|
||||
/**
|
||||
* @return the string to show if help then the tag is listed.
|
||||
*/
|
||||
String getDetailedHelpText();
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.sekwah.advancedportals.core.data;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class BlockLocation {
|
||||
|
||||
@SerializedName("x")
|
||||
public final int posX;
|
||||
|
||||
@SerializedName("y")
|
||||
public final int posY;
|
||||
|
||||
@SerializedName("z")
|
||||
public final int posZ;
|
||||
|
||||
@SerializedName("w")
|
||||
public final String worldName;
|
||||
|
||||
public BlockLocation(String worldName, int posX, int posY, int posZ) {
|
||||
this.worldName = worldName;
|
||||
this.posX = posX;
|
||||
this.posY = posY;
|
||||
this.posZ = posZ;
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package com.sekwah.advancedportals.core.data;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class PlayerLocation extends WorldLocation {
|
||||
|
||||
@SerializedName("yaw")
|
||||
private final float yaw;
|
||||
|
||||
@SerializedName("p")
|
||||
private final float pitch;
|
||||
|
||||
public PlayerLocation(String worldName, double posX, double posY, double posZ) {
|
||||
super(worldName, posX, posY, posZ);
|
||||
this.yaw = 0;
|
||||
this.pitch = 0;
|
||||
}
|
||||
|
||||
public PlayerLocation(String worldName, double posX, double posY, double posZ, float yaw, float pitch) {
|
||||
super(worldName, posX, posY, posZ);
|
||||
this.yaw = yaw;
|
||||
this.pitch = pitch;
|
||||
}
|
||||
|
||||
public double getPosX() {
|
||||
return posX;
|
||||
}
|
||||
|
||||
public double getPosY() {
|
||||
return posY;
|
||||
}
|
||||
|
||||
public double getPosZ() {
|
||||
return posZ;
|
||||
}
|
||||
|
||||
public String getWorldName() {
|
||||
return worldName;
|
||||
}
|
||||
|
||||
public float getYaw() {
|
||||
return yaw;
|
||||
}
|
||||
|
||||
public float getPitch() {
|
||||
return pitch;
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.sekwah.advancedportals.core.data;
|
||||
|
||||
/**
|
||||
* Possibly one of the only files in this package not designed to be serialised.
|
||||
*
|
||||
* Any temporary data about players will be stored here and cleaned up when the player leaves the server.
|
||||
*
|
||||
* This is not a place to store long term data e.g. if you want to make a player unable to use a portal over hours/days.
|
||||
*/
|
||||
public class PlayerTempData {
|
||||
|
||||
private BlockLocation pos1;
|
||||
|
||||
private BlockLocation pos2;
|
||||
|
||||
private long lastAttempt;
|
||||
|
||||
private String selectedPortal;
|
||||
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.sekwah.advancedportals.core.data;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class WorldLocation {
|
||||
|
||||
@SerializedName("x")
|
||||
public final double posX;
|
||||
|
||||
@SerializedName("y")
|
||||
public final double posY;
|
||||
|
||||
@SerializedName("z")
|
||||
public final double posZ;
|
||||
|
||||
@SerializedName("w")
|
||||
public final String worldName;
|
||||
|
||||
public WorldLocation(String worldName, double posX, double posY, double posZ) {
|
||||
this.worldName = worldName;
|
||||
this.posX = posX;
|
||||
this.posY = posY;
|
||||
this.posZ = posZ;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user