Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
ziqian zhang
Grasscutter
Commits
19572f46
Commit
19572f46
authored
Apr 20, 2022
by
Melledy
Committed by
GitHub
Apr 20, 2022
Browse files
Merge pull request #55 from memetrollsXD/development
Custom Y position on MarkMapReq
parents
f35f76f3
d5d90564
Changes
1
Show whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/server/packet/recv/HandlerMarkMapReq.java
View file @
19572f46
...
@@ -16,6 +16,18 @@ import emu.grasscutter.server.packet.send.PacketSceneEntityAppearNotify;
...
@@ -16,6 +16,18 @@ import emu.grasscutter.server.packet.send.PacketSceneEntityAppearNotify;
@Opcodes
(
PacketOpcodes
.
MarkMapReq
)
@Opcodes
(
PacketOpcodes
.
MarkMapReq
)
public
class
HandlerMarkMapReq
extends
PacketHandler
{
public
class
HandlerMarkMapReq
extends
PacketHandler
{
private
static
boolean
isInt
(
String
str
)
{
try
{
@SuppressWarnings
(
"unused"
)
int
x
=
Integer
.
parseInt
(
str
);
return
true
;
// String is an Integer
}
catch
(
NumberFormatException
e
)
{
return
false
;
// String is not an Integer
}
}
@Override
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
MarkMapReq
req
=
MarkMapReq
.
parseFrom
(
payload
);
MarkMapReq
req
=
MarkMapReq
.
parseFrom
(
payload
);
...
@@ -26,15 +38,18 @@ public class HandlerMarkMapReq extends PacketHandler {
...
@@ -26,15 +38,18 @@ public class HandlerMarkMapReq extends PacketHandler {
session
.
getPlayer
().
getPos
().
setX
(
req
.
getMark
().
getPos
().
getX
());
session
.
getPlayer
().
getPos
().
setX
(
req
.
getMark
().
getPos
().
getX
());
session
.
getPlayer
().
getPos
().
setZ
(
req
.
getMark
().
getPos
().
getZ
());
session
.
getPlayer
().
getPos
().
setZ
(
req
.
getMark
().
getPos
().
getZ
());
session
.
getPlayer
().
getPos
().
setY
(
300
);
Grasscutter
.
getLogger
().
info
(
"Player ["
+
session
.
getPlayer
().
getUid
()
+
":"
+
session
.
getPlayer
().
getNickname
()
+
"] tp to "
+
session
.
getPlayer
().
getPos
()
+
" Scene id: "
+
req
.
getMark
().
getSceneId
());
session
.
getPlayer
().
getPos
()
.
setY
(
isInt
(
req
.
getMark
().
getName
())
?
Integer
.
parseInt
(
req
.
getMark
().
getName
())
:
300
);
Grasscutter
.
getLogger
().
info
(
"Player ["
+
session
.
getPlayer
().
getUid
()
+
":"
+
session
.
getPlayer
().
getNickname
()
+
"] tp to "
+
session
.
getPlayer
().
getPos
()
+
" Scene id: "
+
req
.
getMark
().
getSceneId
());
if
(
req
.
getMark
().
getSceneId
()
!=
session
.
getPlayer
().
getSceneId
())
{
if
(
req
.
getMark
().
getSceneId
()
!=
session
.
getPlayer
().
getSceneId
())
{
session
.
getPlayer
().
getWorld
().
transferPlayerToScene
(
session
.
getPlayer
(),
req
.
getMark
().
getSceneId
(),
session
.
getPlayer
().
getPos
());
session
.
getPlayer
().
getWorld
().
transferPlayerToScene
(
session
.
getPlayer
(),
req
.
getMark
().
getSceneId
(),
session
.
getPlayer
().
getPos
());
}
else
{
}
else
{
session
.
getPlayer
().
getScene
().
broadcastPacket
(
new
PacketSceneEntityAppearNotify
(
session
.
getPlayer
()));
session
.
getPlayer
().
getScene
().
broadcastPacket
(
new
PacketSceneEntityAppearNotify
(
session
.
getPlayer
()));
}
}
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment