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
fa9d703d
Commit
fa9d703d
authored
Apr 27, 2022
by
BaiSugar
Committed by
GitHub
Apr 27, 2022
Browse files
Merge branch 'Grasscutters:development' into development
parents
6a5d97a3
d1fc8c1f
Changes
279
Hide whitespace changes
Inline
Side-by-side
.github/workflows/build.yml
View file @
fa9d703d
...
@@ -3,6 +3,7 @@ on:
...
@@ -3,6 +3,7 @@ on:
push
:
push
:
branches
:
branches
:
-
"
stable"
-
"
stable"
-
"
development"
pull_request
:
pull_request
:
types
:
types
:
-
opened
-
opened
...
@@ -25,4 +26,4 @@ jobs:
...
@@ -25,4 +26,4 @@ jobs:
uses
:
actions/upload-artifact@v3
uses
:
actions/upload-artifact@v3
with
:
with
:
name
:
Grasscutter
name
:
Grasscutter
path
:
grasscutter.jar
path
:
grasscutter
-*-dev
.jar
build.gradle
View file @
fa9d703d
...
@@ -23,6 +23,8 @@ plugins {
...
@@ -23,6 +23,8 @@ plugins {
id
'com.google.protobuf'
version
"0.8.18"
id
'com.google.protobuf'
version
"0.8.18"
id
'idea'
id
'idea'
id
'eclipse'
// Apply the application plugin to add support for building a CLI application
// Apply the application plugin to add support for building a CLI application
id
'application'
id
'application'
...
@@ -189,6 +191,14 @@ idea {
...
@@ -189,6 +191,14 @@ idea {
}
}
}
}
eclipse
{
classpath
{
file
.
whenMerged
{
cp
->
cp
.
entries
.
add
(
new
org
.
gradle
.
plugins
.
ide
.
eclipse
.
model
.
SourceFolder
(
'src/generated/main/java'
,
null
)
)
}
}
}
signing
{
signing
{
sign
publishing
.
publications
.
mavenJava
sign
publishing
.
publications
.
mavenJava
}
}
...
@@ -197,4 +207,8 @@ javadoc {
...
@@ -197,4 +207,8 @@ javadoc {
if
(
JavaVersion
.
current
().
isJava9Compatible
())
{
if
(
JavaVersion
.
current
().
isJava9Compatible
())
{
options
.
addBooleanOption
(
'html5'
,
true
)
options
.
addBooleanOption
(
'html5'
,
true
)
}
}
}
processResources
{
dependsOn
"generateProto"
}
}
\ No newline at end of file
src/main/java/emu/grasscutter/G
enshin
Constants.java
→
src/main/java/emu/grasscutter/G
ame
Constants.java
View file @
fa9d703d
...
@@ -5,7 +5,7 @@ import java.util.Arrays;
...
@@ -5,7 +5,7 @@ import java.util.Arrays;
import
emu.grasscutter.utils.Position
;
import
emu.grasscutter.utils.Position
;
import
emu.grasscutter.utils.Utils
;
import
emu.grasscutter.utils.Utils
;
public
final
class
G
enshin
Constants
{
public
final
class
G
ame
Constants
{
public
static
String
VERSION
=
"2.6.0"
;
public
static
String
VERSION
=
"2.6.0"
;
public
static
final
int
MAX_TEAMS
=
4
;
public
static
final
int
MAX_TEAMS
=
4
;
...
...
src/main/java/emu/grasscutter/command/CommandHandler.java
View file @
fa9d703d
package
emu.grasscutter.command
;
package
emu.grasscutter.command
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.game.
Genshin
Player
;
import
emu.grasscutter.game.
player.
Player
;
import
java.util.List
;
import
java.util.List
;
...
@@ -12,7 +12,7 @@ public interface CommandHandler {
...
@@ -12,7 +12,7 @@ public interface CommandHandler {
* @param player The player to send the message to, or null for the server console.
* @param player The player to send the message to, or null for the server console.
* @param message The message to send.
* @param message The message to send.
*/
*/
static
void
sendMessage
(
Genshin
Player
player
,
String
message
)
{
static
void
sendMessage
(
Player
player
,
String
message
)
{
if
(
player
==
null
)
{
if
(
player
==
null
)
{
Grasscutter
.
getLogger
().
info
(
message
);
Grasscutter
.
getLogger
().
info
(
message
);
}
else
{
}
else
{
...
@@ -25,6 +25,6 @@ public interface CommandHandler {
...
@@ -25,6 +25,6 @@ public interface CommandHandler {
* @param sender The player/console that invoked the command.
* @param sender The player/console that invoked the command.
* @param args The arguments to the command.
* @param args The arguments to the command.
*/
*/
default
void
execute
(
Genshin
Player
sender
,
List
<
String
>
args
)
{
default
void
execute
(
Player
sender
,
List
<
String
>
args
)
{
}
}
}
}
src/main/java/emu/grasscutter/command/CommandMap.java
View file @
fa9d703d
...
@@ -2,7 +2,8 @@ package emu.grasscutter.command;
...
@@ -2,7 +2,8 @@ package emu.grasscutter.command;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.game.Account
;
import
emu.grasscutter.game.Account
;
import
emu.grasscutter.game.GenshinPlayer
;
import
emu.grasscutter.game.player.Player
;
import
org.reflections.Reflections
;
import
org.reflections.Reflections
;
import
java.util.*
;
import
java.util.*
;
...
@@ -103,7 +104,7 @@ public final class CommandMap {
...
@@ -103,7 +104,7 @@ public final class CommandMap {
* @param player The player invoking the command or null for the server console.
* @param player The player invoking the command or null for the server console.
* @param rawMessage The messaged used to invoke the command.
* @param rawMessage The messaged used to invoke the command.
*/
*/
public
void
invoke
(
Genshin
Player
player
,
String
rawMessage
)
{
public
void
invoke
(
Player
player
,
String
rawMessage
)
{
rawMessage
=
rawMessage
.
trim
();
rawMessage
=
rawMessage
.
trim
();
if
(
rawMessage
.
length
()
==
0
)
{
if
(
rawMessage
.
length
()
==
0
)
{
CommandHandler
.
sendMessage
(
player
,
"No command specified."
);
CommandHandler
.
sendMessage
(
player
,
"No command specified."
);
...
...
src/main/java/emu/grasscutter/command/commands/AccountCommand.java
View file @
fa9d703d
...
@@ -3,7 +3,7 @@ package emu.grasscutter.command.commands;
...
@@ -3,7 +3,7 @@ package emu.grasscutter.command.commands;
import
emu.grasscutter.command.Command
;
import
emu.grasscutter.command.Command
;
import
emu.grasscutter.command.CommandHandler
;
import
emu.grasscutter.command.CommandHandler
;
import
emu.grasscutter.database.DatabaseHelper
;
import
emu.grasscutter.database.DatabaseHelper
;
import
emu.grasscutter.game.
Genshin
Player
;
import
emu.grasscutter.game.
player.
Player
;
import
java.util.List
;
import
java.util.List
;
...
@@ -12,7 +12,7 @@ import java.util.List;
...
@@ -12,7 +12,7 @@ import java.util.List;
public
final
class
AccountCommand
implements
CommandHandler
{
public
final
class
AccountCommand
implements
CommandHandler
{
@Override
@Override
public
void
execute
(
Genshin
Player
sender
,
List
<
String
>
args
)
{
public
void
execute
(
Player
sender
,
List
<
String
>
args
)
{
if
(
sender
!=
null
)
{
if
(
sender
!=
null
)
{
CommandHandler
.
sendMessage
(
sender
,
"This command can only be run from the console."
);
CommandHandler
.
sendMessage
(
sender
,
"This command can only be run from the console."
);
return
;
return
;
...
...
src/main/java/emu/grasscutter/command/commands/BroadcastCommand.java
View file @
fa9d703d
...
@@ -3,7 +3,7 @@ package emu.grasscutter.command.commands;
...
@@ -3,7 +3,7 @@ package emu.grasscutter.command.commands;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.command.Command
;
import
emu.grasscutter.command.Command
;
import
emu.grasscutter.command.CommandHandler
;
import
emu.grasscutter.command.CommandHandler
;
import
emu.grasscutter.game.
Genshin
Player
;
import
emu.grasscutter.game.
player.
Player
;
import
java.util.List
;
import
java.util.List
;
...
@@ -12,7 +12,7 @@ import java.util.List;
...
@@ -12,7 +12,7 @@ import java.util.List;
public
final
class
BroadcastCommand
implements
CommandHandler
{
public
final
class
BroadcastCommand
implements
CommandHandler
{
@Override
@Override
public
void
execute
(
Genshin
Player
sender
,
List
<
String
>
args
)
{
public
void
execute
(
Player
sender
,
List
<
String
>
args
)
{
if
(
args
.
size
()
<
1
)
{
if
(
args
.
size
()
<
1
)
{
CommandHandler
.
sendMessage
(
sender
,
"Usage: broadcast <message>"
);
CommandHandler
.
sendMessage
(
sender
,
"Usage: broadcast <message>"
);
return
;
return
;
...
@@ -20,7 +20,7 @@ public final class BroadcastCommand implements CommandHandler {
...
@@ -20,7 +20,7 @@ public final class BroadcastCommand implements CommandHandler {
String
message
=
String
.
join
(
" "
,
args
.
subList
(
0
,
args
.
size
()));
String
message
=
String
.
join
(
" "
,
args
.
subList
(
0
,
args
.
size
()));
for
(
Genshin
Player
p
:
Grasscutter
.
getGameServer
().
getPlayers
().
values
())
{
for
(
Player
p
:
Grasscutter
.
getGameServer
().
getPlayers
().
values
())
{
CommandHandler
.
sendMessage
(
p
,
message
);
CommandHandler
.
sendMessage
(
p
,
message
);
}
}
...
...
src/main/java/emu/grasscutter/command/commands/ChangeSceneCommand.java
View file @
fa9d703d
...
@@ -2,7 +2,7 @@ package emu.grasscutter.command.commands;
...
@@ -2,7 +2,7 @@ package emu.grasscutter.command.commands;
import
emu.grasscutter.command.Command
;
import
emu.grasscutter.command.Command
;
import
emu.grasscutter.command.CommandHandler
;
import
emu.grasscutter.command.CommandHandler
;
import
emu.grasscutter.game.
Genshin
Player
;
import
emu.grasscutter.game.
player.
Player
;
import
java.util.List
;
import
java.util.List
;
...
@@ -10,7 +10,7 @@ import java.util.List;
...
@@ -10,7 +10,7 @@ import java.util.List;
description
=
"Changes your scene"
,
aliases
=
{
"scene"
},
permission
=
"player.changescene"
)
description
=
"Changes your scene"
,
aliases
=
{
"scene"
},
permission
=
"player.changescene"
)
public
final
class
ChangeSceneCommand
implements
CommandHandler
{
public
final
class
ChangeSceneCommand
implements
CommandHandler
{
@Override
@Override
public
void
execute
(
Genshin
Player
sender
,
List
<
String
>
args
)
{
public
void
execute
(
Player
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
;
...
...
src/main/java/emu/grasscutter/command/commands/ClearCommand.java
View file @
fa9d703d
...
@@ -3,9 +3,9 @@ package emu.grasscutter.command.commands;
...
@@ -3,9 +3,9 @@ package emu.grasscutter.command.commands;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.command.Command
;
import
emu.grasscutter.command.Command
;
import
emu.grasscutter.command.CommandHandler
;
import
emu.grasscutter.command.CommandHandler
;
import
emu.grasscutter.game.GenshinPlayer
;
import
emu.grasscutter.game.inventory.Inventory
;
import
emu.grasscutter.game.inventory.Inventory
;
import
emu.grasscutter.game.inventory.ItemType
;
import
emu.grasscutter.game.inventory.ItemType
;
import
emu.grasscutter.game.player.Player
;
import
java.util.List
;
import
java.util.List
;
...
@@ -16,7 +16,7 @@ import java.util.List;
...
@@ -16,7 +16,7 @@ import java.util.List;
public
final
class
ClearCommand
implements
CommandHandler
{
public
final
class
ClearCommand
implements
CommandHandler
{
@Override
@Override
public
void
execute
(
Genshin
Player
sender
,
List
<
String
>
args
)
{
public
void
execute
(
Player
sender
,
List
<
String
>
args
)
{
int
target
;
int
target
;
if
(
sender
==
null
)
{
if
(
sender
==
null
)
{
CommandHandler
.
sendMessage
(
null
,
"Run this command in-game."
);
CommandHandler
.
sendMessage
(
null
,
"Run this command in-game."
);
...
@@ -27,7 +27,7 @@ public final class ClearCommand implements CommandHandler {
...
@@ -27,7 +27,7 @@ public final class ClearCommand implements CommandHandler {
Inventory
playerInventory
=
sender
.
getInventory
();
Inventory
playerInventory
=
sender
.
getInventory
();
try
{
try
{
target
=
Integer
.
parseInt
(
args
.
get
(
0
));
target
=
Integer
.
parseInt
(
args
.
get
(
0
));
Genshin
Player
targetPlayer
=
Grasscutter
.
getGameServer
().
getPlayerByUid
(
target
);
Player
targetPlayer
=
Grasscutter
.
getGameServer
().
getPlayerByUid
(
target
);
if
(
targetPlayer
==
null
)
{
if
(
targetPlayer
==
null
)
{
target
=
sender
.
getUid
();
target
=
sender
.
getUid
();
}
else
{
}
else
{
...
@@ -92,7 +92,7 @@ public final class ClearCommand implements CommandHandler {
...
@@ -92,7 +92,7 @@ public final class ClearCommand implements CommandHandler {
return
;
return
;
}
}
Genshin
Player
targetPlayer
=
Grasscutter
.
getGameServer
().
getPlayerByUid
(
target
);
Player
targetPlayer
=
Grasscutter
.
getGameServer
().
getPlayerByUid
(
target
);
if
(
targetPlayer
==
null
)
{
if
(
targetPlayer
==
null
)
{
CommandHandler
.
sendMessage
(
sender
,
"Player not found."
);
CommandHandler
.
sendMessage
(
sender
,
"Player not found."
);
return
;
return
;
...
...
src/main/java/emu/grasscutter/command/commands/DropCommand.java
View file @
fa9d703d
...
@@ -2,10 +2,10 @@ package emu.grasscutter.command.commands;
...
@@ -2,10 +2,10 @@ package emu.grasscutter.command.commands;
import
emu.grasscutter.command.Command
;
import
emu.grasscutter.command.Command
;
import
emu.grasscutter.command.CommandHandler
;
import
emu.grasscutter.command.CommandHandler
;
import
emu.grasscutter.data.G
enshin
Data
;
import
emu.grasscutter.data.G
ame
Data
;
import
emu.grasscutter.data.def.ItemData
;
import
emu.grasscutter.data.def.ItemData
;
import
emu.grasscutter.game.GenshinPlayer
;
import
emu.grasscutter.game.entity.EntityItem
;
import
emu.grasscutter.game.entity.EntityItem
;
import
emu.grasscutter.game.player.Player
;
import
emu.grasscutter.utils.Position
;
import
emu.grasscutter.utils.Position
;
import
java.util.List
;
import
java.util.List
;
...
@@ -15,7 +15,7 @@ import java.util.List;
...
@@ -15,7 +15,7 @@ import java.util.List;
public
final
class
DropCommand
implements
CommandHandler
{
public
final
class
DropCommand
implements
CommandHandler
{
@Override
@Override
public
void
execute
(
Genshin
Player
sender
,
List
<
String
>
args
)
{
public
void
execute
(
Player
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
;
...
@@ -31,7 +31,7 @@ public final class DropCommand implements CommandHandler {
...
@@ -31,7 +31,7 @@ public final class DropCommand implements CommandHandler {
int
amount
=
1
;
int
amount
=
1
;
if
(
args
.
size
()
>
1
)
amount
=
Integer
.
parseInt
(
args
.
get
(
1
));
if
(
args
.
size
()
>
1
)
amount
=
Integer
.
parseInt
(
args
.
get
(
1
));
ItemData
itemData
=
G
enshin
Data
.
getItemDataMap
().
get
(
item
);
ItemData
itemData
=
G
ame
Data
.
getItemDataMap
().
get
(
item
);
if
(
itemData
==
null
)
{
if
(
itemData
==
null
)
{
CommandHandler
.
sendMessage
(
sender
,
"Invalid item id."
);
CommandHandler
.
sendMessage
(
sender
,
"Invalid item id."
);
return
;
return
;
...
...
src/main/java/emu/grasscutter/command/commands/GiveAllCommand.java
View file @
fa9d703d
...
@@ -3,13 +3,13 @@ package emu.grasscutter.command.commands;
...
@@ -3,13 +3,13 @@ package emu.grasscutter.command.commands;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.command.Command
;
import
emu.grasscutter.command.Command
;
import
emu.grasscutter.command.CommandHandler
;
import
emu.grasscutter.command.CommandHandler
;
import
emu.grasscutter.data.G
enshin
Data
;
import
emu.grasscutter.data.G
ame
Data
;
import
emu.grasscutter.data.def.AvatarData
;
import
emu.grasscutter.data.def.AvatarData
;
import
emu.grasscutter.data.def.ItemData
;
import
emu.grasscutter.data.def.ItemData
;
import
emu.grasscutter.game.GenshinPlayer
;
import
emu.grasscutter.game.avatar.Avatar
;
import
emu.grasscutter.game.avatar.GenshinAvatar
;
import
emu.grasscutter.game.inventory.GameItem
;
import
emu.grasscutter.game.inventory.GenshinItem
;
import
emu.grasscutter.game.inventory.ItemType
;
import
emu.grasscutter.game.inventory.ItemType
;
import
emu.grasscutter.game.player.Player
;
import
java.util.*
;
import
java.util.*
;
...
@@ -18,7 +18,7 @@ import java.util.*;
...
@@ -18,7 +18,7 @@ import java.util.*;
public
class
GiveAllCommand
implements
CommandHandler
{
public
class
GiveAllCommand
implements
CommandHandler
{
@Override
@Override
public
void
execute
(
Genshin
Player
sender
,
List
<
String
>
args
)
{
public
void
execute
(
Player
sender
,
List
<
String
>
args
)
{
int
target
,
amount
=
99999
;
int
target
,
amount
=
99999
;
switch
(
args
.
size
())
{
switch
(
args
.
size
())
{
...
@@ -63,7 +63,7 @@ public class GiveAllCommand implements CommandHandler {
...
@@ -63,7 +63,7 @@ public class GiveAllCommand implements CommandHandler {
return
;
return
;
}
}
Genshin
Player
targetPlayer
=
Grasscutter
.
getGameServer
().
getPlayerByUid
(
target
);
Player
targetPlayer
=
Grasscutter
.
getGameServer
().
getPlayerByUid
(
target
);
if
(
targetPlayer
==
null
)
{
if
(
targetPlayer
==
null
)
{
CommandHandler
.
sendMessage
(
sender
,
"Player not found."
);
CommandHandler
.
sendMessage
(
sender
,
"Player not found."
);
return
;
return
;
...
@@ -73,14 +73,14 @@ public class GiveAllCommand implements CommandHandler {
...
@@ -73,14 +73,14 @@ public class GiveAllCommand implements CommandHandler {
CommandHandler
.
sendMessage
(
sender
,
"Giving all items done"
);
CommandHandler
.
sendMessage
(
sender
,
"Giving all items done"
);
}
}
public
void
giveAllItems
(
Genshin
Player
player
,
int
amount
)
{
public
void
giveAllItems
(
Player
player
,
int
amount
)
{
CommandHandler
.
sendMessage
(
player
,
"Giving all items..."
);
CommandHandler
.
sendMessage
(
player
,
"Giving all items..."
);
for
(
AvatarData
avatarData:
G
enshin
Data
.
getAvatarDataMap
().
values
())
{
for
(
AvatarData
avatarData:
G
ame
Data
.
getAvatarDataMap
().
values
())
{
//Exclude test avatar
//Exclude test avatar
if
(
isTestAvatar
(
avatarData
.
getId
()))
continue
;
if
(
isTestAvatar
(
avatarData
.
getId
()))
continue
;
Genshin
Avatar
avatar
=
new
Genshin
Avatar
(
avatarData
);
Avatar
avatar
=
new
Avatar
(
avatarData
);
avatar
.
setLevel
(
90
);
avatar
.
setLevel
(
90
);
avatar
.
setPromoteLevel
(
6
);
avatar
.
setPromoteLevel
(
6
);
for
(
int
i
=
1
;
i
<=
6
;
++
i
)
{
for
(
int
i
=
1
;
i
<=
6
;
++
i
)
{
...
@@ -92,41 +92,41 @@ public class GiveAllCommand implements CommandHandler {
...
@@ -92,41 +92,41 @@ public class GiveAllCommand implements CommandHandler {
}
}
//some test items
//some test items
List
<
G
enshinItem
>
genshinI
temList
=
new
ArrayList
<>();
List
<
G
ameItem
>
i
temList
=
new
ArrayList
<>();
for
(
ItemData
itemdata:
G
enshin
Data
.
getItemDataMap
().
values
())
{
for
(
ItemData
itemdata:
G
ame
Data
.
getItemDataMap
().
values
())
{
//Exclude test item
//Exclude test item
if
(
isTestItem
(
itemdata
.
getId
()))
continue
;
if
(
isTestItem
(
itemdata
.
getId
()))
continue
;
if
(
itemdata
.
isEquip
())
{
if
(
itemdata
.
isEquip
())
{
for
(
int
i
=
0
;
i
<
10
;
++
i
)
{
for
(
int
i
=
0
;
i
<
10
;
++
i
)
{
G
enshinItem
genshinI
tem
=
new
G
enshin
Item
(
itemdata
);
G
ameItem
i
tem
=
new
G
ame
Item
(
itemdata
);
if
(
itemdata
.
getItemType
()
==
ItemType
.
ITEM_WEAPON
)
{
if
(
itemdata
.
getItemType
()
==
ItemType
.
ITEM_WEAPON
)
{
genshinI
tem
.
setLevel
(
90
);
i
tem
.
setLevel
(
90
);
genshinI
tem
.
setPromoteLevel
(
6
);
i
tem
.
setPromoteLevel
(
6
);
genshinI
tem
.
setRefinement
(
4
);
i
tem
.
setRefinement
(
4
);
}
}
genshinI
temList
.
add
(
genshinI
tem
);
i
temList
.
add
(
i
tem
);
}
}
}
}
else
{
else
{
G
enshinItem
genshinI
tem
=
new
G
enshin
Item
(
itemdata
);
G
ameItem
i
tem
=
new
G
ame
Item
(
itemdata
);
genshinI
tem
.
setCount
(
amount
);
i
tem
.
setCount
(
amount
);
genshinI
temList
.
add
(
genshinI
tem
);
i
temList
.
add
(
i
tem
);
}
}
}
}
int
packetNum
=
20
;
int
packetNum
=
20
;
int
itemLength
=
genshinI
temList
.
size
();
int
itemLength
=
i
temList
.
size
();
int
number
=
itemLength
/
packetNum
;
int
number
=
itemLength
/
packetNum
;
int
remainder
=
itemLength
%
packetNum
;
int
remainder
=
itemLength
%
packetNum
;
int
offset
=
0
;
int
offset
=
0
;
for
(
int
i
=
0
;
i
<
packetNum
;
++
i
)
{
for
(
int
i
=
0
;
i
<
packetNum
;
++
i
)
{
if
(
remainder
>
0
)
{
if
(
remainder
>
0
)
{
player
.
getInventory
().
addItems
(
genshinI
temList
.
subList
(
i
*
number
+
offset
,
(
i
+
1
)
*
number
+
offset
+
1
));
player
.
getInventory
().
addItems
(
i
temList
.
subList
(
i
*
number
+
offset
,
(
i
+
1
)
*
number
+
offset
+
1
));
--
remainder
;
--
remainder
;
++
offset
;
++
offset
;
}
}
else
{
else
{
player
.
getInventory
().
addItems
(
genshinI
temList
.
subList
(
i
*
number
+
offset
,
(
i
+
1
)
*
number
+
offset
));
player
.
getInventory
().
addItems
(
i
temList
.
subList
(
i
*
number
+
offset
,
(
i
+
1
)
*
number
+
offset
));
}
}
}
}
}
}
...
...
src/main/java/emu/grasscutter/command/commands/GiveCharCommand.java
View file @
fa9d703d
...
@@ -3,10 +3,10 @@ package emu.grasscutter.command.commands;
...
@@ -3,10 +3,10 @@ package emu.grasscutter.command.commands;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.command.Command
;
import
emu.grasscutter.command.Command
;
import
emu.grasscutter.command.CommandHandler
;
import
emu.grasscutter.command.CommandHandler
;
import
emu.grasscutter.data.G
enshin
Data
;
import
emu.grasscutter.data.G
ame
Data
;
import
emu.grasscutter.data.def.AvatarData
;
import
emu.grasscutter.data.def.AvatarData
;
import
emu.grasscutter.game.
GenshinPlaye
r
;
import
emu.grasscutter.game.
avatar.Avata
r
;
import
emu.grasscutter.game.
avatar.GenshinAvata
r
;
import
emu.grasscutter.game.
player.Playe
r
;
import
java.util.List
;
import
java.util.List
;
...
@@ -15,7 +15,7 @@ import java.util.List;
...
@@ -15,7 +15,7 @@ import java.util.List;
public
final
class
GiveCharCommand
implements
CommandHandler
{
public
final
class
GiveCharCommand
implements
CommandHandler
{
@Override
@Override
public
void
execute
(
Genshin
Player
sender
,
List
<
String
>
args
)
{
public
void
execute
(
Player
sender
,
List
<
String
>
args
)
{
int
target
,
avatarId
,
level
=
1
,
ascension
;
int
target
,
avatarId
,
level
=
1
,
ascension
;
if
(
sender
==
null
&&
args
.
size
()
<
2
)
{
if
(
sender
==
null
&&
args
.
size
()
<
2
)
{
...
@@ -61,13 +61,13 @@ public final class GiveCharCommand implements CommandHandler {
...
@@ -61,13 +61,13 @@ public final class GiveCharCommand implements CommandHandler {
break
;
break
;
}
}
Genshin
Player
targetPlayer
=
Grasscutter
.
getGameServer
().
getPlayerByUid
(
target
);
Player
targetPlayer
=
Grasscutter
.
getGameServer
().
getPlayerByUid
(
target
);
if
(
targetPlayer
==
null
)
{
if
(
targetPlayer
==
null
)
{
CommandHandler
.
sendMessage
(
sender
,
"Player not found."
);
CommandHandler
.
sendMessage
(
sender
,
"Player not found."
);
return
;
return
;
}
}
AvatarData
avatarData
=
G
enshin
Data
.
getAvatarDataMap
().
get
(
avatarId
);
AvatarData
avatarData
=
G
ame
Data
.
getAvatarDataMap
().
get
(
avatarId
);
if
(
avatarData
==
null
)
{
if
(
avatarData
==
null
)
{
CommandHandler
.
sendMessage
(
sender
,
"Invalid avatar id."
);
CommandHandler
.
sendMessage
(
sender
,
"Invalid avatar id."
);
return
;
return
;
...
@@ -80,7 +80,7 @@ public final class GiveCharCommand implements CommandHandler {
...
@@ -80,7 +80,7 @@ public final class GiveCharCommand implements CommandHandler {
ascension
=
(
int
)
Math
.
ceil
(
level
/
10
f
)
-
3
;
ascension
=
(
int
)
Math
.
ceil
(
level
/
10
f
)
-
3
;
}
}
Genshin
Avatar
avatar
=
new
Genshin
Avatar
(
avatarId
);
Avatar
avatar
=
new
Avatar
(
avatarId
);
avatar
.
setLevel
(
level
);
avatar
.
setLevel
(
level
);
avatar
.
setPromoteLevel
(
ascension
);
avatar
.
setPromoteLevel
(
ascension
);
...
...
src/main/java/emu/grasscutter/command/commands/GiveCommand.java
View file @
fa9d703d
...
@@ -3,10 +3,10 @@ package emu.grasscutter.command.commands;
...
@@ -3,10 +3,10 @@ package emu.grasscutter.command.commands;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.command.Command
;
import
emu.grasscutter.command.Command
;
import
emu.grasscutter.command.CommandHandler
;
import
emu.grasscutter.command.CommandHandler
;
import
emu.grasscutter.data.G
enshin
Data
;
import
emu.grasscutter.data.G
ame
Data
;
import
emu.grasscutter.data.def.ItemData
;
import
emu.grasscutter.data.def.ItemData
;
import
emu.grasscutter.game.
GenshinPlayer
;
import
emu.grasscutter.game.
inventory.GameItem
;
import
emu.grasscutter.game.
inventory.GenshinItem
;
import
emu.grasscutter.game.
player.Player
;
import
emu.grasscutter.game.props.ActionReason
;
import
emu.grasscutter.game.props.ActionReason
;
import
emu.grasscutter.server.packet.send.PacketItemAddHintNotify
;
import
emu.grasscutter.server.packet.send.PacketItemAddHintNotify
;
...
@@ -18,7 +18,7 @@ import java.util.List;
...
@@ -18,7 +18,7 @@ import java.util.List;
public
final
class
GiveCommand
implements
CommandHandler
{
public
final
class
GiveCommand
implements
CommandHandler
{
@Override
@Override
public
void
execute
(
Genshin
Player
sender
,
List
<
String
>
args
)
{
public
void
execute
(
Player
sender
,
List
<
String
>
args
)
{
int
target
,
item
,
lvl
,
amount
=
1
;
int
target
,
item
,
lvl
,
amount
=
1
;
if
(
sender
==
null
&&
args
.
size
()
<
2
)
{
if
(
sender
==
null
&&
args
.
size
()
<
2
)
{
CommandHandler
.
sendMessage
(
null
,
"Usage: give <player> <itemId|itemName> [amount] [level]"
);
CommandHandler
.
sendMessage
(
null
,
"Usage: give <player> <itemId|itemName> [amount] [level]"
);
...
@@ -99,14 +99,14 @@ public final class GiveCommand implements CommandHandler {
...
@@ -99,14 +99,14 @@ public final class GiveCommand implements CommandHandler {
break
;
break
;
}
}
Genshin
Player
targetPlayer
=
Grasscutter
.
getGameServer
().
getPlayerByUid
(
target
);
Player
targetPlayer
=
Grasscutter
.
getGameServer
().
getPlayerByUid
(
target
);
if
(
targetPlayer
==
null
)
{
if
(
targetPlayer
==
null
)
{
CommandHandler
.
sendMessage
(
sender
,
"Player not found."
);
CommandHandler
.
sendMessage
(
sender
,
"Player not found."
);
return
;
return
;
}
}
ItemData
itemData
=
G
enshin
Data
.
getItemDataMap
().
get
(
item
);
ItemData
itemData
=
G
ame
Data
.
getItemDataMap
().
get
(
item
);
if
(
itemData
==
null
)
{
if
(
itemData
==
null
)
{
CommandHandler
.
sendMessage
(
sender
,
"Invalid item id."
);
CommandHandler
.
sendMessage
(
sender
,
"Invalid item id."
);
return
;
return
;
...
@@ -121,11 +121,11 @@ public final class GiveCommand implements CommandHandler {
...
@@ -121,11 +121,11 @@ public final class GiveCommand implements CommandHandler {
String
.
format
(
"Given %s with level %s %s times to %s"
,
item
,
lvl
,
amount
,
target
));
String
.
format
(
"Given %s with level %s %s times to %s"
,
item
,
lvl
,
amount
,
target
));
}
}
private
void
item
(
Genshin
Player
player
,
ItemData
itemData
,
int
amount
,
int
lvl
)
{
private
void
item
(
Player
player
,
ItemData
itemData
,
int
amount
,
int
lvl
)
{
if
(
itemData
.
isEquip
())
{
if
(
itemData
.
isEquip
())
{
List
<
G
enshin
Item
>
items
=
new
LinkedList
<>();
List
<
G
ame
Item
>
items
=
new
LinkedList
<>();
for
(
int
i
=
0
;
i
<
amount
;
i
++)
{
for
(
int
i
=
0
;
i
<
amount
;
i
++)
{
G
enshin
Item
item
=
new
G
enshin
Item
(
itemData
);
G
ame
Item
item
=
new
G
ame
Item
(
itemData
);
item
.
setCount
(
amount
);
item
.
setCount
(
amount
);
item
.
setLevel
(
lvl
);
item
.
setLevel
(
lvl
);
item
.
setPromoteLevel
(
0
);
item
.
setPromoteLevel
(
0
);
...
@@ -144,13 +144,11 @@ public final class GiveCommand implements CommandHandler {
...
@@ -144,13 +144,11 @@ public final class GiveCommand implements CommandHandler {
}
}
items
.
add
(
item
);
items
.
add
(
item
);
}
}
player
.
getInventory
().
addItems
(
items
);
player
.
getInventory
().
addItems
(
items
,
ActionReason
.
SubfieldDrop
);
player
.
sendPacket
(
new
PacketItemAddHintNotify
(
items
,
ActionReason
.
SubfieldDrop
));
}
else
{
}
else
{
GenshinItem
genshinItem
=
new
GenshinItem
(
itemData
);
GameItem
item
=
new
GameItem
(
itemData
);
genshinItem
.
setCount
(
amount
);
item
.
setCount
(
amount
);
player
.
getInventory
().
addItem
(
genshinItem
);
player
.
getInventory
().
addItem
(
item
,
ActionReason
.
SubfieldDrop
);
player
.
sendPacket
(
new
PacketItemAddHintNotify
(
genshinItem
,
ActionReason
.
SubfieldDrop
));
}
}
}
}
}
}
src/main/java/emu/grasscutter/command/commands/GodModeCommand.java
View file @
fa9d703d
...
@@ -3,7 +3,7 @@ package emu.grasscutter.command.commands;
...
@@ -3,7 +3,7 @@ package emu.grasscutter.command.commands;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.command.Command
;
import
emu.grasscutter.command.Command
;
import
emu.grasscutter.command.CommandHandler
;
import
emu.grasscutter.command.CommandHandler
;
import
emu.grasscutter.game.
Genshin
Player
;
import
emu.grasscutter.game.
player.
Player
;
import
java.util.List
;
import
java.util.List
;
...
@@ -12,7 +12,7 @@ import java.util.List;
...
@@ -12,7 +12,7 @@ import java.util.List;
public
final
class
GodModeCommand
implements
CommandHandler
{
public
final
class
GodModeCommand
implements
CommandHandler
{
@Override
@Override
public
void
execute
(
Genshin
Player
sender
,
List
<
String
>
args
)
{
public
void
execute
(
Player
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
;
// TODO: toggle player's godmode statue from console or other players
return
;
// TODO: toggle player's godmode statue from console or other players
...
@@ -32,7 +32,7 @@ public final class GodModeCommand implements CommandHandler {
...
@@ -32,7 +32,7 @@ public final class GodModeCommand implements CommandHandler {
}
else
{
}
else
{
target
=
sender
.
getUid
();
target
=
sender
.
getUid
();
}
}
Genshin
Player
targetPlayer
=
Grasscutter
.
getGameServer
().
getPlayerByUid
(
target
);
Player
targetPlayer
=
Grasscutter
.
getGameServer
().
getPlayerByUid
(
target
);
if
(
targetPlayer
==
null
)
{
if
(
targetPlayer
==
null
)
{
CommandHandler
.
sendMessage
(
sender
,
"Player not found."
);
CommandHandler
.
sendMessage
(
sender
,
"Player not found."
);
return
;
return
;
...
...
src/main/java/emu/grasscutter/command/commands/HealCommand.java
View file @
fa9d703d
...
@@ -2,7 +2,7 @@ package emu.grasscutter.command.commands;
...
@@ -2,7 +2,7 @@ package emu.grasscutter.command.commands;
import
emu.grasscutter.command.Command
;
import
emu.grasscutter.command.Command
;
import
emu.grasscutter.command.CommandHandler
;
import
emu.grasscutter.command.CommandHandler
;
import
emu.grasscutter.game.
Genshin
Player
;
import
emu.grasscutter.game.
player.
Player
;
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
;
...
@@ -13,7 +13,7 @@ import java.util.List;
...
@@ -13,7 +13,7 @@ import java.util.List;
description
=
"Heal all characters in your current team."
,
permission
=
"player.heal"
)
description
=
"Heal all characters in your current team."
,
permission
=
"player.heal"
)
public
final
class
HealCommand
implements
CommandHandler
{
public
final
class
HealCommand
implements
CommandHandler
{
@Override
@Override
public
void
execute
(
Genshin
Player
sender
,
List
<
String
>
args
)
{
public
void
execute
(
Player
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
;
...
...
src/main/java/emu/grasscutter/command/commands/HelpCommand.java
View file @
fa9d703d
...
@@ -3,7 +3,7 @@ package emu.grasscutter.command.commands;
...
@@ -3,7 +3,7 @@ package emu.grasscutter.command.commands;
import
emu.grasscutter.command.Command
;
import
emu.grasscutter.command.Command
;
import
emu.grasscutter.command.CommandHandler
;
import
emu.grasscutter.command.CommandHandler
;
import
emu.grasscutter.command.CommandMap
;
import
emu.grasscutter.command.CommandMap
;
import
emu.grasscutter.game.
Genshin
Player
;
import
emu.grasscutter.game.
player.
Player
;
import
java.util.*
;
import
java.util.*
;
...
@@ -12,7 +12,7 @@ import java.util.*;
...
@@ -12,7 +12,7 @@ import java.util.*;
public
final
class
HelpCommand
implements
CommandHandler
{
public
final
class
HelpCommand
implements
CommandHandler
{
@Override
@Override
public
void
execute
(
Genshin
Player
player
,
List
<
String
>
args
)
{
public
void
execute
(
Player
player
,
List
<
String
>
args
)
{
if
(
args
.
size
()
<
1
)
{
if
(
args
.
size
()
<
1
)
{
HashMap
<
String
,
CommandHandler
>
handlers
=
CommandMap
.
getInstance
().
getHandlers
();
HashMap
<
String
,
CommandHandler
>
handlers
=
CommandMap
.
getInstance
().
getHandlers
();
List
<
Command
>
annotations
=
new
ArrayList
<>();
List
<
Command
>
annotations
=
new
ArrayList
<>();
...
@@ -53,7 +53,7 @@ public final class HelpCommand implements CommandHandler {
...
@@ -53,7 +53,7 @@ public final class HelpCommand implements CommandHandler {
}
}
}
}
void
SendAllHelpMessage
(
Genshin
Player
player
,
List
<
Command
>
annotations
)
{
void
SendAllHelpMessage
(
Player
player
,
List
<
Command
>
annotations
)
{
if
(
player
==
null
)
{
if
(
player
==
null
)
{
StringBuilder
builder
=
new
StringBuilder
(
"\nAvailable commands:\n"
);
StringBuilder
builder
=
new
StringBuilder
(
"\nAvailable commands:\n"
);
annotations
.
forEach
(
annotation
->
{
annotations
.
forEach
(
annotation
->
{
...
...
src/main/java/emu/grasscutter/command/commands/KickCommand.java
View file @
fa9d703d
...
@@ -3,7 +3,7 @@ package emu.grasscutter.command.commands;
...
@@ -3,7 +3,7 @@ package emu.grasscutter.command.commands;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.command.Command
;
import
emu.grasscutter.command.Command
;
import
emu.grasscutter.command.CommandHandler
;
import
emu.grasscutter.command.CommandHandler
;
import
emu.grasscutter.game.
Genshin
Player
;
import
emu.grasscutter.game.
player.
Player
;
import
java.util.List
;
import
java.util.List
;
...
@@ -12,10 +12,10 @@ import java.util.List;
...
@@ -12,10 +12,10 @@ import java.util.List;
public
final
class
KickCommand
implements
CommandHandler
{
public
final
class
KickCommand
implements
CommandHandler
{
@Override
@Override
public
void
execute
(
Genshin
Player
sender
,
List
<
String
>
args
)
{
public
void
execute
(
Player
sender
,
List
<
String
>
args
)
{
int
target
=
Integer
.
parseInt
(
args
.
get
(
0
));
int
target
=
Integer
.
parseInt
(
args
.
get
(
0
));
Genshin
Player
targetPlayer
=
Grasscutter
.
getGameServer
().
getPlayerByUid
(
target
);
Player
targetPlayer
=
Grasscutter
.
getGameServer
().
getPlayerByUid
(
target
);
if
(
targetPlayer
==
null
)
{
if
(
targetPlayer
==
null
)
{
CommandHandler
.
sendMessage
(
sender
,
"Player not found."
);
CommandHandler
.
sendMessage
(
sender
,
"Player not found."
);
return
;
return
;
...
...
src/main/java/emu/grasscutter/command/commands/KillAllCommand.java
View file @
fa9d703d
...
@@ -3,9 +3,9 @@ package emu.grasscutter.command.commands;
...
@@ -3,9 +3,9 @@ package emu.grasscutter.command.commands;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.command.Command
;
import
emu.grasscutter.command.Command
;
import
emu.grasscutter.command.CommandHandler
;
import
emu.grasscutter.command.CommandHandler
;
import
emu.grasscutter.game.GenshinPlayer
;
import
emu.grasscutter.game.GenshinScene
;
import
emu.grasscutter.game.entity.EntityMonster
;
import
emu.grasscutter.game.entity.EntityMonster
;
import
emu.grasscutter.game.player.Player
;
import
emu.grasscutter.game.world.Scene
;
import
java.util.List
;
import
java.util.List
;
...
@@ -14,9 +14,9 @@ import java.util.List;
...
@@ -14,9 +14,9 @@ import java.util.List;
public
final
class
KillAllCommand
implements
CommandHandler
{
public
final
class
KillAllCommand
implements
CommandHandler
{
@Override
@Override
public
void
execute
(
Genshin
Player
sender
,
List
<
String
>
args
)
{
public
void
execute
(
Player
sender
,
List
<
String
>
args
)
{
Genshin
Scene
s
cene
;
Scene
mainS
cene
;
GenshinPlayer
genshin
Player
;
Player
target
Player
;
try
{
try
{
switch
(
args
.
size
())
{
switch
(
args
.
size
())
{
...
@@ -25,38 +25,38 @@ public final class KillAllCommand implements CommandHandler {
...
@@ -25,38 +25,38 @@ public final class KillAllCommand implements CommandHandler {
CommandHandler
.
sendMessage
(
null
,
"Usage: killall [playerUid] [sceneId]"
);
CommandHandler
.
sendMessage
(
null
,
"Usage: killall [playerUid] [sceneId]"
);
return
;
return
;
}
}
s
cene
=
sender
.
getScene
();
mainS
cene
=
sender
.
getScene
();
break
;
break
;
case
1
:
// [playerUid]
case
1
:
// [playerUid]
genshin
Player
=
Grasscutter
.
getGameServer
().
getPlayerByUid
(
Integer
.
parseInt
(
args
.
get
(
0
)));
target
Player
=
Grasscutter
.
getGameServer
().
getPlayerByUid
(
Integer
.
parseInt
(
args
.
get
(
0
)));
if
(
genshin
Player
==
null
)
{
if
(
target
Player
==
null
)
{
CommandHandler
.
sendMessage
(
sender
,
"Player not found or offline."
);
CommandHandler
.
sendMessage
(
sender
,
"Player not found or offline."
);
return
;
return
;
}
}
s
cene
=
genshin
Player
.
getScene
();
mainS
cene
=
target
Player
.
getScene
();
break
;
break
;
case
2
:
// [playerUid] [sceneId]
case
2
:
// [playerUid] [sceneId]
genshin
Player
=
Grasscutter
.
getGameServer
().
getPlayerByUid
(
Integer
.
parseInt
(
args
.
get
(
0
)));
target
Player
=
Grasscutter
.
getGameServer
().
getPlayerByUid
(
Integer
.
parseInt
(
args
.
get
(
0
)));
if
(
genshin
Player
==
null
)
{
if
(
target
Player
==
null
)
{
CommandHandler
.
sendMessage
(
sender
,
"Player not found or offline."
);
CommandHandler
.
sendMessage
(
sender
,
"Player not found or offline."
);
return
;
return
;
}
}
GenshinScene
genshinS
cene
=
sender
.
getWorld
().
getSceneById
(
Integer
.
parseInt
(
args
.
get
(
1
)));
Scene
s
cene
=
sender
.
getWorld
().
getSceneById
(
Integer
.
parseInt
(
args
.
get
(
1
)));
if
(
genshinS
cene
==
null
)
{
if
(
s
cene
==
null
)
{
CommandHandler
.
sendMessage
(
sender
,
"Scene not found in player world"
);
CommandHandler
.
sendMessage
(
sender
,
"Scene not found in player world"
);
return
;
return
;
}
}
s
cene
=
genshinS
cene
;
mainS
cene
=
s
cene
;
break
;
break
;
default
:
default
:
CommandHandler
.
sendMessage
(
sender
,
"Usage: killall [playerUid] [sceneId]"
);
CommandHandler
.
sendMessage
(
sender
,
"Usage: killall [playerUid] [sceneId]"
);
return
;
return
;
}
}
s
cene
.
getEntities
().
values
().
stream
()
mainS
cene
.
getEntities
().
values
().
stream
()
.
filter
(
entity
->
entity
instanceof
EntityMonster
)
.
filter
(
entity
->
entity
instanceof
EntityMonster
)
.
forEach
(
entity
->
s
cene
.
killEntity
(
entity
,
0
));
.
forEach
(
entity
->
mainS
cene
.
killEntity
(
entity
,
0
));
CommandHandler
.
sendMessage
(
sender
,
"Killing all monsters in scene "
+
s
cene
.
getId
());
CommandHandler
.
sendMessage
(
sender
,
"Killing all monsters in scene "
+
mainS
cene
.
getId
());
}
catch
(
NumberFormatException
ignored
)
{
}
catch
(
NumberFormatException
ignored
)
{
CommandHandler
.
sendMessage
(
sender
,
"Invalid arguments."
);
CommandHandler
.
sendMessage
(
sender
,
"Invalid arguments."
);
}
}
...
...
src/main/java/emu/grasscutter/command/commands/KillCharacterCommand.java
View file @
fa9d703d
...
@@ -3,8 +3,8 @@ package emu.grasscutter.command.commands;
...
@@ -3,8 +3,8 @@ package emu.grasscutter.command.commands;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.command.Command
;
import
emu.grasscutter.command.Command
;
import
emu.grasscutter.command.CommandHandler
;
import
emu.grasscutter.command.CommandHandler
;
import
emu.grasscutter.game.GenshinPlayer
;
import
emu.grasscutter.game.entity.EntityAvatar
;
import
emu.grasscutter.game.entity.EntityAvatar
;
import
emu.grasscutter.game.player.Player
;
import
emu.grasscutter.game.props.FightProperty
;
import
emu.grasscutter.game.props.FightProperty
;
import
emu.grasscutter.game.props.LifeState
;
import
emu.grasscutter.game.props.LifeState
;
import
emu.grasscutter.server.packet.send.PacketEntityFightPropUpdateNotify
;
import
emu.grasscutter.server.packet.send.PacketEntityFightPropUpdateNotify
;
...
@@ -17,7 +17,7 @@ import java.util.List;
...
@@ -17,7 +17,7 @@ import java.util.List;
public
final
class
KillCharacterCommand
implements
CommandHandler
{
public
final
class
KillCharacterCommand
implements
CommandHandler
{
@Override
@Override
public
void
execute
(
Genshin
Player
sender
,
List
<
String
>
args
)
{
public
void
execute
(
Player
sender
,
List
<
String
>
args
)
{
int
target
;
int
target
;
if
(
sender
==
null
)
{
if
(
sender
==
null
)
{
// from console
// from console
...
@@ -48,7 +48,7 @@ public final class KillCharacterCommand implements CommandHandler {
...
@@ -48,7 +48,7 @@ public final class KillCharacterCommand implements CommandHandler {
}
}
}
}
Genshin
Player
targetPlayer
=
Grasscutter
.
getGameServer
().
getPlayerByUid
(
target
);
Player
targetPlayer
=
Grasscutter
.
getGameServer
().
getPlayerByUid
(
target
);
if
(
targetPlayer
==
null
)
{
if
(
targetPlayer
==
null
)
{
CommandHandler
.
sendMessage
(
sender
,
"Player not found or offline."
);
CommandHandler
.
sendMessage
(
sender
,
"Player not found or offline."
);
return
;
return
;
...
...
src/main/java/emu/grasscutter/command/commands/ListCommand.java
View file @
fa9d703d
...
@@ -3,7 +3,7 @@ package emu.grasscutter.command.commands;
...
@@ -3,7 +3,7 @@ package emu.grasscutter.command.commands;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.command.Command
;
import
emu.grasscutter.command.Command
;
import
emu.grasscutter.command.CommandHandler
;
import
emu.grasscutter.command.CommandHandler
;
import
emu.grasscutter.game.
Genshin
Player
;
import
emu.grasscutter.game.
player.
Player
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -12,8 +12,8 @@ import java.util.Map;
...
@@ -12,8 +12,8 @@ import java.util.Map;
public
final
class
ListCommand
implements
CommandHandler
{
public
final
class
ListCommand
implements
CommandHandler
{
@Override
@Override
public
void
execute
(
Genshin
Player
sender
,
List
<
String
>
args
)
{
public
void
execute
(
Player
sender
,
List
<
String
>
args
)
{
Map
<
Integer
,
Genshin
Player
>
playersMap
=
Grasscutter
.
getGameServer
().
getPlayers
();
Map
<
Integer
,
Player
>
playersMap
=
Grasscutter
.
getGameServer
().
getPlayers
();
CommandHandler
.
sendMessage
(
sender
,
String
.
format
(
"There are %s player(s) online:"
,
playersMap
.
size
()));
CommandHandler
.
sendMessage
(
sender
,
String
.
format
(
"There are %s player(s) online:"
,
playersMap
.
size
()));
...
...
Prev
1
2
3
4
5
…
14
Next
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