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
03988414
Commit
03988414
authored
Apr 26, 2022
by
KingRainbow44
Browse files
Refactor classes
parent
c4bdcc38
Changes
5
Show whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/command/commands/HealCommand.java
View file @
03988414
...
@@ -6,20 +6,19 @@ import emu.grasscutter.game.GenshinPlayer;
...
@@ -6,20 +6,19 @@ import emu.grasscutter.game.GenshinPlayer;
import
emu.grasscutter.game.props.FightProperty
;
import
emu.grasscutter.game.props.FightProperty
;
import
emu.grasscutter.server.packet.send.PacketAvatarFightPropUpdateNotify
;
import
emu.grasscutter.server.packet.send.PacketAvatarFightPropUpdateNotify
;
import
emu.grasscutter.server.packet.send.PacketAvatarLifeStateChangeNotify
;
import
emu.grasscutter.server.packet.send.PacketAvatarLifeStateChangeNotify
;
import
emu.grasscutter.server.packet.send.PacketEntityFightPropUpdateNotify
;
import
emu.grasscutter.server.packet.send.PacketLifeStateChangeNotify
;
import
java.util.List
;
import
java.util.List
;
@Command
(
label
=
"heal"
,
usage
=
"heal|h"
,
@Command
(
label
=
"heal"
,
usage
=
"heal|h"
,
aliases
=
{
"h"
},
description
=
"Heal all characters in your current team."
,
aliases
=
{
"h"
},
permission
=
"player.heal"
)
description
=
"Heal all characters in your current team."
,
permission
=
"player.heal"
)
public
class
HealCommand
implements
CommandHandler
{
public
final
class
HealCommand
implements
CommandHandler
{
@Override
@Override
public
void
execute
(
GenshinPlayer
sender
,
List
<
String
>
args
)
{
public
void
execute
(
GenshinPlayer
sender
,
List
<
String
>
args
)
{
if
(
sender
==
null
)
{
if
(
sender
==
null
)
{
CommandHandler
.
sendMessage
(
null
,
"Run this command in-game."
);
CommandHandler
.
sendMessage
(
null
,
"Run this command in-game."
);
return
;
return
;
}
}
sender
.
getTeamManager
().
getActiveTeam
().
forEach
(
entity
->
{
sender
.
getTeamManager
().
getActiveTeam
().
forEach
(
entity
->
{
boolean
isAlive
=
entity
.
isAlive
();
boolean
isAlive
=
entity
.
isAlive
();
entity
.
setFightProperty
(
entity
.
setFightProperty
(
...
@@ -31,6 +30,6 @@ public class HealCommand implements CommandHandler {
...
@@ -31,6 +30,6 @@ public class HealCommand implements CommandHandler {
entity
.
getWorld
().
broadcastPacket
(
new
PacketAvatarLifeStateChangeNotify
(
entity
.
getAvatar
()));
entity
.
getWorld
().
broadcastPacket
(
new
PacketAvatarLifeStateChangeNotify
(
entity
.
getAvatar
()));
}
}
});
});
CommandHandler
.
sendMessage
(
sender
,
"All characters
are
healed."
);
CommandHandler
.
sendMessage
(
sender
,
"All characters
have been
healed."
);
}
}
}
}
src/main/java/emu/grasscutter/command/commands/ListCommand.java
View file @
03988414
...
@@ -9,7 +9,7 @@ import java.util.List;
...
@@ -9,7 +9,7 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Map
;
@Command
(
label
=
"list"
,
description
=
"List online players"
)
@Command
(
label
=
"list"
,
description
=
"List online players"
)
public
class
ListCommand
implements
CommandHandler
{
public
final
class
ListCommand
implements
CommandHandler
{
@Override
@Override
public
void
execute
(
GenshinPlayer
sender
,
List
<
String
>
args
)
{
public
void
execute
(
GenshinPlayer
sender
,
List
<
String
>
args
)
{
...
@@ -19,14 +19,10 @@ public class ListCommand implements CommandHandler {
...
@@ -19,14 +19,10 @@ public class ListCommand implements CommandHandler {
if
(
playersMap
.
size
()
!=
0
)
{
if
(
playersMap
.
size
()
!=
0
)
{
StringBuilder
playerSet
=
new
StringBuilder
();
StringBuilder
playerSet
=
new
StringBuilder
();
playersMap
.
values
().
forEach
(
player
->
for
(
Map
.
Entry
<
Integer
,
GenshinPlayer
>
entry
:
playersMap
.
entrySet
())
{
playerSet
.
append
(
player
.
getNickname
()).
append
(
", "
));
playerSet
.
append
(
entry
.
getValue
().
getNickname
());
playerSet
.
append
(
", "
);
}
String
players
=
playerSet
.
toString
();
String
players
=
playerSet
.
toString
();
CommandHandler
.
sendMessage
(
sender
,
players
.
substring
(
0
,
players
.
length
()
-
2
));
CommandHandler
.
sendMessage
(
sender
,
players
.
substring
(
0
,
players
.
length
()
-
2
));
}
}
}
}
...
...
src/main/java/emu/grasscutter/command/commands/TalentCommand.java
View file @
03988414
...
@@ -13,7 +13,7 @@ import java.util.List;
...
@@ -13,7 +13,7 @@ import java.util.List;
@Command
(
label
=
"talent"
,
usage
=
"talent <talentID> <value>"
,
@Command
(
label
=
"talent"
,
usage
=
"talent <talentID> <value>"
,
description
=
"Set talent level for your current active character"
,
permission
=
"player.settalent"
)
description
=
"Set talent level for your current active character"
,
permission
=
"player.settalent"
)
public
class
TalentCommand
implements
CommandHandler
{
public
final
class
TalentCommand
implements
CommandHandler
{
@Override
@Override
public
void
execute
(
GenshinPlayer
sender
,
List
<
String
>
args
)
{
public
void
execute
(
GenshinPlayer
sender
,
List
<
String
>
args
)
{
...
...
src/main/java/emu/grasscutter/command/commands/Tele
P
ortCommand.java
→
src/main/java/emu/grasscutter/command/commands/Tele
p
ortCommand.java
View file @
03988414
...
@@ -9,7 +9,7 @@ import java.util.List;
...
@@ -9,7 +9,7 @@ import java.util.List;
@Command
(
label
=
"teleport"
,
usage
=
"teleport <x> <y> <z>"
,
aliases
=
{
"tp"
},
@Command
(
label
=
"teleport"
,
usage
=
"teleport <x> <y> <z>"
,
aliases
=
{
"tp"
},
description
=
"Change the player's position."
,
permission
=
"player.teleport"
)
description
=
"Change the player's position."
,
permission
=
"player.teleport"
)
public
class
Tele
P
ortCommand
implements
CommandHandler
{
public
final
class
Tele
p
ortCommand
implements
CommandHandler
{
@Override
@Override
public
void
execute
(
GenshinPlayer
sender
,
List
<
String
>
args
)
{
public
void
execute
(
GenshinPlayer
sender
,
List
<
String
>
args
)
{
...
...
src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java
View file @
03988414
...
@@ -98,8 +98,8 @@ public final class DispatchServer {
...
@@ -98,8 +98,8 @@ public final class DispatchServer {
byte
[]
decoded2
=
Base64
.
getDecoder
().
decode
(
query_cur_region
);
byte
[]
decoded2
=
Base64
.
getDecoder
().
decode
(
query_cur_region
);
QueryCurrRegionHttpRsp
regionQuery
=
QueryCurrRegionHttpRsp
.
parseFrom
(
decoded2
);
QueryCurrRegionHttpRsp
regionQuery
=
QueryCurrRegionHttpRsp
.
parseFrom
(
decoded2
);
List
<
RegionSimpleInfo
>
servers
=
new
ArrayList
<
RegionSimpleInfo
>();
List
<
RegionSimpleInfo
>
servers
=
new
ArrayList
<>();
List
<
String
>
usedNames
=
new
ArrayList
<
String
>();
// List to check for potential naming conflicts
List
<
String
>
usedNames
=
new
ArrayList
<>();
// List to check for potential naming conflicts
if
(
Grasscutter
.
getConfig
().
RunMode
.
equalsIgnoreCase
(
"HYBRID"
))
{
// Automatically add the game server if in
if
(
Grasscutter
.
getConfig
().
RunMode
.
equalsIgnoreCase
(
"HYBRID"
))
{
// Automatically add the game server if in
// hybrid mode
// hybrid mode
RegionSimpleInfo
server
=
RegionSimpleInfo
.
newBuilder
()
RegionSimpleInfo
server
=
RegionSimpleInfo
.
newBuilder
()
...
...
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