mirror of
https://github.com/LOOHP/Limbo.git
synced 2026-06-07 21:41:43 +00:00
Added /spawn
This commit is contained in:
@@ -37,6 +37,7 @@ import com.loohp.limbo.Server.Packets.PacketStatusInPing;
|
|||||||
import com.loohp.limbo.Server.Packets.PacketStatusInRequest;
|
import com.loohp.limbo.Server.Packets.PacketStatusInRequest;
|
||||||
import com.loohp.limbo.Server.Packets.PacketStatusOutPong;
|
import com.loohp.limbo.Server.Packets.PacketStatusOutPong;
|
||||||
import com.loohp.limbo.Server.Packets.PacketStatusOutResponse;
|
import com.loohp.limbo.Server.Packets.PacketStatusOutResponse;
|
||||||
|
import com.loohp.limbo.Utils.CustomStringUtils;
|
||||||
import com.loohp.limbo.Utils.DataTypeIO;
|
import com.loohp.limbo.Utils.DataTypeIO;
|
||||||
import com.loohp.limbo.Utils.SkinUtils;
|
import com.loohp.limbo.Utils.SkinUtils;
|
||||||
import com.loohp.limbo.Utils.SkinUtils.SkinResponse;
|
import com.loohp.limbo.Utils.SkinUtils.SkinResponse;
|
||||||
@@ -44,6 +45,7 @@ import com.loohp.limbo.World.BlockPosition;
|
|||||||
import com.loohp.limbo.World.DimensionRegistry;
|
import com.loohp.limbo.World.DimensionRegistry;
|
||||||
import com.loohp.limbo.World.World;
|
import com.loohp.limbo.World.World;
|
||||||
|
|
||||||
|
import net.md_5.bungee.api.ChatColor;
|
||||||
import net.md_5.bungee.api.chat.BaseComponent;
|
import net.md_5.bungee.api.chat.BaseComponent;
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
import net.md_5.bungee.chat.ComponentSerializer;
|
import net.md_5.bungee.chat.ComponentSerializer;
|
||||||
@@ -122,6 +124,18 @@ public class ClientConnection extends Thread {
|
|||||||
sendMessage(new BaseComponent[] {component});
|
sendMessage(new BaseComponent[] {component});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void teleport(Location location) {
|
||||||
|
try {
|
||||||
|
DataOutputStream output = new DataOutputStream(client_socket.getOutputStream());
|
||||||
|
PacketPlayOutPositionAndLook positionLook = new PacketPlayOutPositionAndLook(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch(), 1);
|
||||||
|
byte[] packetByte = positionLook.getBytes();
|
||||||
|
DataTypeIO.writeVarInt(output, packetByte.length);
|
||||||
|
output.write(packetByte);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void sendMessage(BaseComponent[] component) {
|
public void sendMessage(BaseComponent[] component) {
|
||||||
try {
|
try {
|
||||||
DataOutputStream output = new DataOutputStream(client_socket.getOutputStream());
|
DataOutputStream output = new DataOutputStream(client_socket.getOutputStream());
|
||||||
@@ -229,6 +243,7 @@ public class ClientConnection extends Thread {
|
|||||||
packetByte = spawnPos.getBytes();
|
packetByte = spawnPos.getBytes();
|
||||||
DataTypeIO.writeVarInt(output, packetByte.length);
|
DataTypeIO.writeVarInt(output, packetByte.length);
|
||||||
output.write(packetByte);
|
output.write(packetByte);
|
||||||
|
|
||||||
PacketPlayOutPositionAndLook positionLook = new PacketPlayOutPositionAndLook(s.getX(), s.getY(), s.getZ(), s.getYaw(), s.getPitch(), 1);
|
PacketPlayOutPositionAndLook positionLook = new PacketPlayOutPositionAndLook(s.getX(), s.getY(), s.getZ(), s.getYaw(), s.getPitch(), 1);
|
||||||
location = new Location(world, s.getX(), s.getY(), s.getZ(), s.getYaw(), s.getPitch());
|
location = new Location(world, s.getX(), s.getY(), s.getZ(), s.getYaw(), s.getPitch());
|
||||||
packetByte = positionLook.getBytes();
|
packetByte = positionLook.getBytes();
|
||||||
@@ -302,6 +317,12 @@ public class ClientConnection extends Thread {
|
|||||||
PacketPlayInChat chat = new PacketPlayInChat(input);
|
PacketPlayInChat chat = new PacketPlayInChat(input);
|
||||||
if (chat.getMessage().startsWith("/")) {
|
if (chat.getMessage().startsWith("/")) {
|
||||||
//TO-DO COMMANDS
|
//TO-DO COMMANDS
|
||||||
|
String[] command = CustomStringUtils.splitStringToArgs(chat.getMessage().substring(1));
|
||||||
|
if (command[0].equalsIgnoreCase("spawn")) {
|
||||||
|
teleport(p.getWorldSpawn());
|
||||||
|
Limbo.getInstance().getConsole().sendMessage(username + " executed server command: /spawn");
|
||||||
|
sendMessage(new TextComponent(ChatColor.GOLD + "Teleporting you to spawn!"));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
String message = "<" + username + "> " + chat.getMessage();
|
String message = "<" + username + "> " + chat.getMessage();
|
||||||
Limbo.getInstance().getConsole().sendMessage(message);
|
Limbo.getInstance().getConsole().sendMessage(message);
|
||||||
|
|||||||
-171852
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,32 +0,0 @@
|
|||||||
#Server max players, -1 for no limit
|
|
||||||
max-players=-1
|
|
||||||
|
|
||||||
#Server port
|
|
||||||
server-port=30000
|
|
||||||
|
|
||||||
#Server ip, localhost for local access only
|
|
||||||
server-ip=localhost
|
|
||||||
|
|
||||||
#World Name and the Schematic file containing map
|
|
||||||
level-name=world;spawn.schem
|
|
||||||
|
|
||||||
#Dimension, "minecraft:overworld", "minecraft:nether" or "minecraft:the_end"
|
|
||||||
level-dimension=minecraft:the_end
|
|
||||||
|
|
||||||
#Whether Flying is allowed
|
|
||||||
allow-flight=false
|
|
||||||
|
|
||||||
#GameMode, survival, creative, adventure, spectator
|
|
||||||
default-gamemode=creative
|
|
||||||
|
|
||||||
#Spawn location
|
|
||||||
world-spawn=world;20.5;17;22.5;-90;0
|
|
||||||
|
|
||||||
#Reduce debug info
|
|
||||||
reduced-debug-info=false
|
|
||||||
|
|
||||||
#Server list message in Json
|
|
||||||
motd={"text":"","extra":[{"text":"H ","color":"#E8162E"},{"text":"M ","color":"#F9D52B"},{"text":"G ","color":"#28B31F"},{"text":"! ","color":"blue"},{"text":"!","color":"dark_purple"},{"text":"\n"},{"text":"Be the first to join!","color":"yellow"}]}
|
|
||||||
|
|
||||||
#Server list version as string
|
|
||||||
version=Limbo!
|
|
||||||
Reference in New Issue
Block a user