Commit d32f706c authored by KingRainbow44's avatar KingRainbow44
Browse files

Merge branch 'development' into api

# Conflicts:
#	src/main/java/emu/grasscutter/plugin/api/ServerHook.java
parents 47d8fd3c f0d728b4
......@@ -2,33 +2,33 @@ package emu.grasscutter.server.packet.send;
import java.util.Collection;
import emu.grasscutter.game.inventory.GenshinItem;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.game.inventory.GameItem;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.StoreItemDelNotifyOuterClass.StoreItemDelNotify;
import emu.grasscutter.net.proto.StoreTypeOuterClass.StoreType;
public class PacketStoreItemDelNotify extends GenshinPacket {
public class PacketStoreItemDelNotify extends BasePacket {
private PacketStoreItemDelNotify() {
super(PacketOpcodes.StoreItemDelNotify);
}
public PacketStoreItemDelNotify(GenshinItem item) {
public PacketStoreItemDelNotify(GameItem item) {
this();
StoreItemDelNotify.Builder proto = StoreItemDelNotify.newBuilder()
.setStoreType(StoreType.StorePack)
.setStoreType(StoreType.STORE_PACK)
.addGuidList(item.getGuid());
this.setData(proto);
}
public PacketStoreItemDelNotify(Collection<GenshinItem> items) {
public PacketStoreItemDelNotify(Collection<GameItem> items) {
this();
StoreItemDelNotify.Builder proto = StoreItemDelNotify.newBuilder()
.setStoreType(StoreType.StorePack);
.setStoreType(StoreType.STORE_PACK);
items.stream().forEach(item -> proto.addGuidList(item.getGuid()));
......
package emu.grasscutter.server.packet.send;
import emu.grasscutter.Grasscutter;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.StoreTypeOuterClass.StoreType;
import emu.grasscutter.net.proto.StoreWeightLimitNotifyOuterClass.StoreWeightLimitNotify;
public class PacketStoreWeightLimitNotify extends GenshinPacket {
public class PacketStoreWeightLimitNotify extends BasePacket {
public PacketStoreWeightLimitNotify() {
super(PacketOpcodes.StoreWeightLimitNotify);
StoreWeightLimitNotify p = StoreWeightLimitNotify.newBuilder()
.setStoreType(StoreType.StorePack)
.setStoreType(StoreType.STORE_PACK)
.setWeightLimit(Grasscutter.getConfig().getGameServerOptions().InventoryLimitAll)
.setWeaponCountLimit(Grasscutter.getConfig().getGameServerOptions().InventoryLimitWeapon)
.setReliquaryCountLimit(Grasscutter.getConfig().getGameServerOptions().InventoryLimitRelic)
......
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.GenshinPlayer;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.SyncScenePlayTeamEntityNotifyOuterClass.SyncScenePlayTeamEntityNotify;
public class PacketSyncScenePlayTeamEntityNotify extends GenshinPacket {
public class PacketSyncScenePlayTeamEntityNotify extends BasePacket {
public PacketSyncScenePlayTeamEntityNotify(GenshinPlayer player) {
public PacketSyncScenePlayTeamEntityNotify(Player player) {
super(PacketOpcodes.SyncScenePlayTeamEntityNotify);
SyncScenePlayTeamEntityNotify proto = SyncScenePlayTeamEntityNotify.newBuilder()
......
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.GenshinPlayer;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.AbilitySyncStateInfoOuterClass.AbilitySyncStateInfo;
import emu.grasscutter.net.proto.SyncTeamEntityNotifyOuterClass.SyncTeamEntityNotify;
import emu.grasscutter.net.proto.TeamEntityInfoOuterClass.TeamEntityInfo;
public class PacketSyncTeamEntityNotify extends GenshinPacket {
public class PacketSyncTeamEntityNotify extends BasePacket {
public PacketSyncTeamEntityNotify(GenshinPlayer player) {
public PacketSyncTeamEntityNotify(Player player) {
super(PacketOpcodes.SyncTeamEntityNotify);
SyncTeamEntityNotify.Builder proto = SyncTeamEntityNotify.newBuilder()
.setSceneId(player.getSceneId());
if (player.getWorld().isMultiplayer()) {
for (GenshinPlayer p : player.getWorld().getPlayers()) {
for (Player p : player.getWorld().getPlayers()) {
// Skip if same player
if (player == p) {
continue;
......
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.TakePlayerLevelRewardRspOuterClass.TakePlayerLevelRewardRsp;
public class PacketTakePlayerLevelRewardRsp extends GenshinPacket {
public class PacketTakePlayerLevelRewardRsp extends BasePacket {
public PacketTakePlayerLevelRewardRsp(int level, int rewardId) {
super(PacketOpcodes.TakePlayerLevelRewardRsp);
......
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.TakeoffEquipRspOuterClass.TakeoffEquipRsp;
public class PacketTakeoffEquipRsp extends GenshinPacket {
public class PacketTakeoffEquipRsp extends BasePacket {
public PacketTakeoffEquipRsp(long avatarGuid, int slot) {
super(PacketOpcodes.TakeoffEquipRsp);
......
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.TowerAllDataRspOuterClass.TowerAllDataRsp;
import emu.grasscutter.net.proto.TowerCurLevelRecordOuterClass.TowerCurLevelRecord;
import emu.grasscutter.net.proto.TowerFloorRecordOuterClass.TowerFloorRecord;
public class PacketTowerAllDataRsp extends GenshinPacket {
public class PacketTowerAllDataRsp extends BasePacket {
public PacketTowerAllDataRsp() {
super(PacketOpcodes.TowerAllDataRsp);
......
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.avatar.GenshinAvatar;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.game.avatar.Avatar;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.UnlockAvatarTalentRspOuterClass.UnlockAvatarTalentRsp;
public class PacketUnlockAvatarTalentRsp extends GenshinPacket {
public class PacketUnlockAvatarTalentRsp extends BasePacket {
public PacketUnlockAvatarTalentRsp(GenshinAvatar avatar, int talentId) {
public PacketUnlockAvatarTalentRsp(Avatar avatar, int talentId) {
super(PacketOpcodes.UnlockAvatarTalentRsp);
UnlockAvatarTalentRsp proto = UnlockAvatarTalentRsp.newBuilder()
......
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.UnlockNameCardNotifyOuterClass.UnlockNameCardNotify;
public class PacketUnlockNameCardNotify extends GenshinPacket {
public class PacketUnlockNameCardNotify extends BasePacket {
public PacketUnlockNameCardNotify(int nameCard) {
super(PacketOpcodes.UnlockNameCardNotify);
......
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.inventory.GenshinItem;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.game.inventory.GameItem;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.RetcodeOuterClass;
import emu.grasscutter.net.proto.UseItemRspOuterClass.UseItemRsp;
public class PacketUseItemRsp extends GenshinPacket {
public class PacketUseItemRsp extends BasePacket {
public PacketUseItemRsp(long targetGuid, GenshinItem useItem) {
public PacketUseItemRsp(long targetGuid, GameItem useItem) {
super(PacketOpcodes.UseItemRsp);
UseItemRsp proto = UseItemRsp.newBuilder()
......@@ -22,7 +23,7 @@ public class PacketUseItemRsp extends GenshinPacket {
public PacketUseItemRsp() {
super(PacketOpcodes.UseItemRsp);
UseItemRsp proto = UseItemRsp.newBuilder().setRetcode(1).build();
UseItemRsp proto = UseItemRsp.newBuilder().setRetcode(RetcodeOuterClass.Retcode.RET_SVR_ERROR_VALUE).build();
this.setData(proto);
}
......
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.avatar.GenshinAvatar;
import emu.grasscutter.game.inventory.GenshinItem;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.game.avatar.Avatar;
import emu.grasscutter.game.inventory.GameItem;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.WeaponAwakenRspOuterClass.WeaponAwakenRsp;
public class PacketWeaponAwakenRsp extends GenshinPacket {
public class PacketWeaponAwakenRsp extends BasePacket {
public PacketWeaponAwakenRsp(GenshinAvatar avatar, GenshinItem item, GenshinItem feedWeapon, int oldRefineLevel) {
public PacketWeaponAwakenRsp(Avatar avatar, GameItem item, GameItem feedWeapon, int oldRefineLevel) {
super(PacketOpcodes.WeaponAwakenRsp);
WeaponAwakenRsp.Builder proto = WeaponAwakenRsp.newBuilder()
......
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.inventory.GenshinItem;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.game.inventory.GameItem;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.WeaponPromoteRspOuterClass.WeaponPromoteRsp;
public class PacketWeaponPromoteRsp extends GenshinPacket {
public class PacketWeaponPromoteRsp extends BasePacket {
public PacketWeaponPromoteRsp(GenshinItem item, int oldPromoteLevel) {
public PacketWeaponPromoteRsp(GameItem item, int oldPromoteLevel) {
super(PacketOpcodes.WeaponPromoteRsp);
WeaponPromoteRsp proto = WeaponPromoteRsp.newBuilder()
......
......@@ -2,15 +2,15 @@ package emu.grasscutter.server.packet.send;
import java.util.List;
import emu.grasscutter.game.inventory.GenshinItem;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.game.inventory.GameItem;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.ItemParamOuterClass.ItemParam;
import emu.grasscutter.net.proto.WeaponUpgradeRspOuterClass.WeaponUpgradeRsp;
public class PacketWeaponUpgradeRsp extends GenshinPacket {
public class PacketWeaponUpgradeRsp extends BasePacket {
public PacketWeaponUpgradeRsp(GenshinItem item, int oldLevel, List<ItemParam> leftoverOres) {
public PacketWeaponUpgradeRsp(GameItem item, int oldLevel, List<ItemParam> leftoverOres) {
super(PacketOpcodes.WeaponUpgradeRsp);
WeaponUpgradeRsp proto = WeaponUpgradeRsp.newBuilder()
......
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.WearEquipRspOuterClass.WearEquipRsp;
public class PacketWearEquipRsp extends GenshinPacket {
public class PacketWearEquipRsp extends BasePacket {
public PacketWearEquipRsp(long avatarGuid, long equipGuid) {
super(PacketOpcodes.WearEquipRsp);
......
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.World;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.game.world.World;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.PropValueOuterClass.PropValue;
import emu.grasscutter.net.proto.WorldDataNotifyOuterClass.WorldDataNotify;
public class PacketWorldDataNotify extends GenshinPacket {
public class PacketWorldDataNotify extends BasePacket {
public PacketWorldDataNotify(World world) {
super(PacketOpcodes.WorldDataNotify);
......
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.PlayerDieTypeOuterClass.PlayerDieType;
import emu.grasscutter.net.proto.WorldPlayerDieNotifyOuterClass.WorldPlayerDieNotify;
public class PacketWorldPlayerDieNotify extends GenshinPacket {
public class PacketWorldPlayerDieNotify extends BasePacket {
public PacketWorldPlayerDieNotify(PlayerDieType playerDieType, int killerId) {
super(PacketOpcodes.WorldPlayerDieNotify);
......
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.GenshinPlayer;
import emu.grasscutter.game.World;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.world.World;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.WorldPlayerInfoNotifyOuterClass.WorldPlayerInfoNotify;
public class PacketWorldPlayerInfoNotify extends GenshinPacket {
public class PacketWorldPlayerInfoNotify extends BasePacket {
public PacketWorldPlayerInfoNotify(World world) {
super(PacketOpcodes.WorldPlayerInfoNotify);
......@@ -14,7 +14,7 @@ public class PacketWorldPlayerInfoNotify extends GenshinPacket {
WorldPlayerInfoNotify.Builder proto = WorldPlayerInfoNotify.newBuilder();
for (int i = 0; i < world.getPlayers().size(); i++) {
GenshinPlayer p = world.getPlayers().get(i);
Player p = world.getPlayers().get(i);
proto.addPlayerInfoList(p.getOnlinePlayerInfo());
proto.addPlayerUidList(p.getUid());
......
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.GenshinPlayer;
import emu.grasscutter.game.World;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.world.World;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.WorldPlayerLocationNotifyOuterClass.WorldPlayerLocationNotify;
public class PacketWorldPlayerLocationNotify extends GenshinPacket {
public class PacketWorldPlayerLocationNotify extends BasePacket {
public PacketWorldPlayerLocationNotify(World world) {
super(PacketOpcodes.WorldPlayerLocationNotify);
WorldPlayerLocationNotify.Builder proto = WorldPlayerLocationNotify.newBuilder();
for (GenshinPlayer p : world.getPlayers()) {
proto.addPlayerLocList(p.getWorldPlayerLocationInfo());
for (Player p : world.getPlayers()) {
proto.addPlayerWorldLocList(p.getWorldPlayerLocationInfo());
}
this.setData(proto);
......
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.GenshinPlayer;
import emu.grasscutter.game.World;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.world.World;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.PlayerRTTInfoOuterClass.PlayerRTTInfo;
import emu.grasscutter.net.proto.WorldPlayerRTTNotifyOuterClass.WorldPlayerRTTNotify;
public class PacketWorldPlayerRTTNotify extends GenshinPacket {
public class PacketWorldPlayerRTTNotify extends BasePacket {
public PacketWorldPlayerRTTNotify(World world) {
super(PacketOpcodes.WorldPlayerRTTNotify);
WorldPlayerRTTNotify.Builder proto = WorldPlayerRTTNotify.newBuilder();
for (GenshinPlayer player : world.getPlayers()) {
for (Player player : world.getPlayers()) {
proto.addPlayerRttList(
PlayerRTTInfo.newBuilder()
.setUid(player.getUid())
......
package emu.grasscutter.task;
import org.quartz.JobDataMap;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/*
* So what is cron expression?
The format of a Cron expression is as follows.
Second Minute Hour Day Month Week Year
Seconds: 0-59
Minute: 0-59
hour: 0-23
Day: 1-31
Month: 1-12
Week: 1-7 (0-6 sometimes)
Year: Specify your own
If you want to express every second or every minute or something like that, use the * symbol in that position;
if you want to express more than one such as every 15 minutes and every 30 minutes, you can write:`15, 30`.
For the rest of the wildcard characters, please Google them yourself
*/
@Retention(RetentionPolicy.RUNTIME)
public @interface Task {
String taskName() default "NO_NAME";
String taskCronExpression() default "0 0 0 0 0 ?";
String triggerName() default "NO_NAME";
boolean executeImmediatelyAfterReset() default false;
boolean executeImmediately() default false;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment