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
415f22d9
Commit
415f22d9
authored
Apr 20, 2022
by
KingRainbow44
Browse files
Fix merge conflict
parents
a5061170
652a2154
Changes
22
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/command/commands/Stop.java
→
src/main/java/emu/grasscutter/command/commands/Stop
Command
.java
View file @
415f22d9
package
emu.grasscutter.command.commands
;
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.GenshinPlayer
;
import
java.util.List
;
import
java.util.List
;
@Command
(
label
=
"stop"
,
usage
=
"stop"
,
@Command
(
label
=
"stop"
,
usage
=
"stop"
,
description
=
"Stops the server"
,
permission
=
"server.stop"
)
description
=
"Stops the server"
,
permission
=
"server.stop"
)
public
class
Stop
implements
CommandHandler
{
public
final
class
Stop
Command
implements
CommandHandler
{
@Override
@Override
public
void
execute
(
GenshinPlayer
sender
,
List
<
String
>
args
)
{
public
void
execute
(
GenshinPlayer
sender
,
List
<
String
>
args
)
{
CommandHandler
.
sendMessage
(
null
,
"Server shutting down..."
);
CommandHandler
.
sendMessage
(
null
,
"Server shutting down..."
);
for
(
GenshinPlayer
p
:
Grasscutter
.
getGameServer
().
getPlayers
().
values
())
{
for
(
GenshinPlayer
p
:
Grasscutter
.
getGameServer
().
getPlayers
().
values
())
{
CommandHandler
.
sendMessage
(
p
,
"Server shutting down..."
);
CommandHandler
.
sendMessage
(
p
,
"Server shutting down..."
);
}
}
System
.
exit
(
1
);
System
.
exit
(
1
);
}
}
}
}
src/main/java/emu/grasscutter/command/commands/Weather.java
→
src/main/java/emu/grasscutter/command/commands/Weather
Command
.java
View file @
415f22d9
package
emu.grasscutter.command.commands
;
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.GenshinPlayer
;
import
emu.grasscutter.game.GenshinPlayer
;
import
emu.grasscutter.game.props.ClimateType
;
import
emu.grasscutter.game.props.ClimateType
;
import
emu.grasscutter.server.packet.send.PacketSceneAreaWeatherNotify
;
import
emu.grasscutter.server.packet.send.PacketSceneAreaWeatherNotify
;
import
java.util.List
;
import
java.util.List
;
@Command
(
label
=
"weather"
,
usage
=
"weather <weatherId>"
,
@Command
(
label
=
"weather"
,
usage
=
"weather <weatherId>"
,
description
=
"Changes the weather."
,
aliases
=
{
"w"
},
permission
=
"player.weather"
)
description
=
"Changes the weather."
,
aliases
=
{
"w"
},
permission
=
"player.weather"
)
public
class
Weather
implements
CommandHandler
{
public
final
class
Weather
Command
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
;
}
}
if
(
args
.
size
()
<
1
)
{
if
(
args
.
size
()
<
1
)
{
CommandHandler
.
sendMessage
(
sender
,
"Usage: weather <weatherId>"
);
CommandHandler
.
sendMessage
(
sender
,
"Usage: weather <weatherId>"
);
return
;
return
;
}
}
try
{
try
{
int
weatherId
=
Integer
.
parseInt
(
args
.
get
(
0
));
int
weatherId
=
Integer
.
parseInt
(
args
.
get
(
0
));
ClimateType
climate
=
ClimateType
.
getTypeByValue
(
weatherId
);
ClimateType
climate
=
ClimateType
.
getTypeByValue
(
weatherId
);
sender
.
getScene
().
setClimate
(
climate
);
sender
.
getScene
().
setClimate
(
climate
);
sender
.
getScene
().
broadcastPacket
(
new
PacketSceneAreaWeatherNotify
(
sender
));
sender
.
getScene
().
broadcastPacket
(
new
PacketSceneAreaWeatherNotify
(
sender
));
CommandHandler
.
sendMessage
(
sender
,
"Changed weather to "
+
weatherId
);
CommandHandler
.
sendMessage
(
sender
,
"Changed weather to "
+
weatherId
);
}
catch
(
NumberFormatException
ignored
)
{
}
catch
(
NumberFormatException
ignored
)
{
CommandHandler
.
sendMessage
(
sender
,
"Invalid weather ID."
);
CommandHandler
.
sendMessage
(
sender
,
"Invalid weather ID."
);
}
}
}
}
}
}
Prev
1
2
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