Skip to content

Commit 8628f96

Browse files
author
magiclu550
committed
[JSMOD@2_475_COMMIT] finish events
1 parent edafccc commit 8628f96

23 files changed

+200
-53
lines changed

JSMod2API/src/main/java/cn/jsmod2/api/event/player/PlayerSetRoleEvent.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import cn.jsmod2.api.team.TeamRole;
1515
import cn.jsmod2.network.PacketSender;
1616
import cn.jsmod2.network.protocol.event.admin.PlayerSetRoleSetItemsPacket;
17+
import cn.jsmod2.network.protocol.event.newstream.GetTypes;
1718

1819
import java.util.List;
1920

@@ -45,15 +46,19 @@ public void setRole(Role role) {
4546
this.role = role;
4647
}
4748

49+
@SuppressWarnings("unchecked")
4850
public List<ItemType> getItems() {
51+
items = PacketSender.sendEventGetPacket(playerName,"Items",ItemType.class,List.class, GetTypes.GET_ARRAY);
4952
return items;
5053
}
5154

5255
public boolean isUsingDefaultItem() {
56+
usingDefaultItem = PacketSender.sendEventGetPacket(playerName,"UsingDefaultItem",Boolean.class);
5357
return usingDefaultItem;
5458
}
5559

5660
public Role getRole() {
61+
role = PacketSender.sendEventGetPacket(playerName,"Role",Role.class);
5762
return role;
5863
}
5964

JSMod2API/src/main/java/cn/jsmod2/api/event/player/PlayerShootEvent.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import cn.jsmod2.api.player.WeaponType;
1414
import cn.jsmod2.core.annotations.UseForServerInit;
1515
import cn.jsmod2.core.math.Vector;
16+
import cn.jsmod2.network.PacketSender;
1617

1718
/**
1819
* @author kevinj
@@ -29,26 +30,32 @@ public class PlayerShootEvent extends PlayerEvent implements IPlayerShootEvent{
2930
private Vector Direction;
3031

3132
public boolean isShouldSpawnHitmarker() {
33+
shouldSpawnHitmarker = PacketSender.sendEventGetPacket(playerName,"ShouldSpawnHitmarker",Boolean.class);
3234
return shouldSpawnHitmarker;
3335
}
3436

3537
public void setShouldSpawnHitmarker(boolean shouldSpawnHitmarker) {
38+
PacketSender.sendEventSetPacket(playerName,"ShouldSpawnHitmarker",shouldSpawnHitmarker);
3639
this.shouldSpawnHitmarker = shouldSpawnHitmarker;
3740
}
3841

3942
public boolean getShouldSpawnBloodDecal() {
43+
shouldSpawnHitmarker = PacketSender.sendEventGetPacket(playerName,"ShouldSpawnBloodDecal",Boolean.class);
4044
return ShouldSpawnBloodDecal;
4145
}
4246

4347
public void setShouldSpawnBloodDecal(boolean shouldSpawnBloodDecal) {
48+
PacketSender.sendEventSetPacket(playerName,"ShouldSpawnBloodDecal",shouldSpawnBloodDecal);
4449
ShouldSpawnBloodDecal = shouldSpawnBloodDecal;
4550
}
4651

4752
public Vector getDirection() {
53+
Direction = PacketSender.sendEventGetPacket(playerName,"Direction",Vector.class);
4854
return Direction;
4955
}
5056

5157
public void setDirection(Vector direction) {
58+
PacketSender.sendEventSetPacket(playerName,"Direction",direction);
5259
Direction = direction;
5360
}
5461

@@ -57,26 +64,32 @@ public Player getTarget() {
5764
}
5865

5966
public DamageType getWeapon() {
67+
weapon = PacketSender.sendEventGetPacket(playerName,"Weapon",DamageType.class);
6068
return weapon;
6169
}
6270

6371
public Vector getSourcePosition() {
72+
SourcePosition = PacketSender.sendEventGetPacket(playerName,"SourcePosition",Vector.class);
6473
return SourcePosition;
6574
}
6675

6776
public Vector getTargetPosition() {
77+
TargetPosition = PacketSender.sendEventGetPacket(playerName,"TargetPosition",Vector.class);
6878
return TargetPosition;
6979
}
7080

7181
public String getTargetHitbox() {
82+
TargetHitbox = PacketSender.sendEventGetPacket(playerName,"TargetHitbox",String.class);
7283
return TargetHitbox;
7384
}
7485

7586

7687
public WeaponType getWeaponSound() {
88+
WeaponSound = PacketSender.sendEventGetPacket(playerName,"WeaponSound",WeaponType.class);
7789
return WeaponSound;
7890
}
7991
public void setWeaponSound(WeaponType weaponSound) {
92+
PacketSender.sendEventSetPacket(playerName,"WeaponSound",weaponSound);
8093
WeaponSound = weaponSound;
8194
}
8295

JSMod2API/src/main/java/cn/jsmod2/api/event/player/PlayerSpawnEvent.java

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,43 +8,25 @@
88
*/
99
package cn.jsmod2.api.event.player;
1010

11-
import cn.jsmod2.api.map.Door;
12-
import cn.jsmod2.api.player.Player;
13-
import cn.jsmod2.core.annotations.UseForServerInit;
11+
import cn.jsmod2.core.math.Vector;
12+
import cn.jsmod2.network.PacketSender;
13+
1414

1515
/**
1616
* @author kevinj
1717
*/
1818
public class PlayerSpawnEvent extends PlayerEvent implements IPlayerSpawnEvent{
19-
private Door door = new Door();
20-
private boolean allow;
21-
private boolean destroy;
22-
23-
public PlayerSpawnEvent(Player player, Door door) {
24-
super(player);
25-
this.door = door;
26-
}
27-
28-
public Door getDoor() {
29-
return door;
30-
}
3119

20+
public Vector spawnPos;
3221

33-
34-
public boolean isAllow() {
35-
return allow;
36-
}
37-
38-
public void setAllow(boolean allow) {
39-
this.allow = allow;
40-
}
41-
42-
public boolean isDestroy() {
43-
return destroy;
22+
public Vector getSpawnPos() {
23+
spawnPos = PacketSender.sendEventGetPacket(playerName,"SpawnPos",Vector.class);
24+
return spawnPos;
4425
}
4526

46-
public void setDestroy(boolean destroy) {
47-
this.destroy = destroy;
27+
public void setSpawnPos(Vector spawnPos) {
28+
PacketSender.sendEventSetPacket(playerName,"SpawnPos",spawnPos);
29+
this.spawnPos = spawnPos;
4830
}
4931

5032
public PlayerSpawnEvent(){

JSMod2API/src/main/java/cn/jsmod2/api/event/player/PlayerSpawnRagdollEvent.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import cn.jsmod2.core.annotations.UseForServerInit;
1515
import cn.jsmod2.core.event.Event;
1616
import cn.jsmod2.core.math.Vector;
17+
import cn.jsmod2.network.PacketSender;
1718

1819
/**
1920
* @author kevinj
@@ -27,42 +28,52 @@ public class PlayerSpawnRagdollEvent extends Event implements IPlayerSpawnRagdol
2728
private boolean allowRecall;
2829

2930
public Role getRole() {
31+
role = PacketSender.sendEventGetPacket(playerName,"Role",Role.class);
3032
return role;
3133
}
3234

3335
public void setRole(Role role) {
36+
PacketSender.sendEventSetPacket(playerName,"Role",role);
3437
this.role = role;
3538
}
3639

3740
public Vector getPosition() {
41+
position = PacketSender.sendEventGetPacket(playerName,"Position",Vector.class);
3842
return position;
3943
}
4044

4145
public void setPosition(Vector position) {
46+
PacketSender.sendEventSetPacket(playerName,"Position",position);
4247
this.position = position;
4348
}
4449

4550
public Vector getRotation() {
51+
Rotation = PacketSender.sendEventGetPacket(playerName,"Rotation",Vector.class);
4652
return Rotation;
4753
}
4854

4955
public void setRotation(Vector rotation) {
56+
PacketSender.sendEventGetPacket(playerName,"Rotation",Vector.class);
5057
Rotation = rotation;
5158
}
5259

5360
public DamageType getDamageType() {
61+
damageType = PacketSender.sendEventGetPacket(playerName,"DamageType",DamageType.class);
5462
return damageType;
5563
}
5664

5765
public void setDamageType(DamageType damageType) {
66+
PacketSender.sendEventSetPacket(playerName,"DamageType",damageType);
5867
this.damageType = damageType;
5968
}
6069

6170
public boolean isAllowRecall() {
71+
allowRecall = PacketSender.sendEventGetPacket(playerName,"AllowRecall",Boolean.class);
6272
return allowRecall;
6373
}
6474

6575
public void setAllowRecall(boolean allowRecall) {
76+
allowRecall = PacketSender.sendEventGetPacket(playerName,"AllowRecall",Boolean.class);
6677
this.allowRecall = allowRecall;
6778
}
6879

JSMod2API/src/main/java/cn/jsmod2/api/event/player/PlayerThrowGrenade.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,23 @@
88
*/
99
package cn.jsmod2.api.event.player;
1010

11-
import cn.jsmod2.api.item.ItemType;
11+
import cn.jsmod2.api.player.GrenadeType;
1212
import cn.jsmod2.api.player.Player;
13-
import cn.jsmod2.core.annotations.UseForServerInit;
1413
import cn.jsmod2.core.math.Vector;
14+
import cn.jsmod2.network.PacketSender;
1515

1616
/**
1717
* @author kevinj
1818
*/
1919
public class PlayerThrowGrenade extends PlayerEvent implements IPlayerThrowGrenade{
2020

21-
private ItemType GrenadeType;
21+
private GrenadeType grenadeType;
2222
private Vector direction;
2323
private boolean slowThrow;
2424

25-
public PlayerThrowGrenade(Player player, ItemType grenadeType, Vector direction, boolean slowThrow) {
25+
public PlayerThrowGrenade(Player player, GrenadeType grenadeType, Vector direction, boolean slowThrow) {
2626
super(player);
27-
GrenadeType = grenadeType;
27+
this.grenadeType = grenadeType;
2828
this.direction = direction;
2929
this.slowThrow = slowThrow;
3030
}
@@ -33,17 +33,20 @@ public PlayerThrowGrenade(){
3333

3434
}
3535

36-
public ItemType getGrenadeType() {
37-
return GrenadeType;
36+
public GrenadeType getGrenadeType() {
37+
grenadeType = PacketSender.sendEventGetPacket(playerName,"GrenadeType",GrenadeType.class);
38+
return grenadeType;
3839
}
3940

4041

4142
public Vector getDirection() {
43+
direction = PacketSender.sendEventGetPacket(playerName,"Direction",Vector.class);
4244
return direction;
4345
}
4446

4547

4648
public boolean isSlowThrow() {
49+
slowThrow = PacketSender.sendEventGetPacket(playerName,"SlowThrow",Boolean.class);
4750
return slowThrow;
4851
}
4952

JSMod2API/src/main/java/cn/jsmod2/api/event/player/PlayerTriggerTeslaEvent.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import cn.jsmod2.api.map.TeslaGate;
1212
import cn.jsmod2.api.player.Player;
1313
import cn.jsmod2.core.annotations.UseForServerInit;
14+
import cn.jsmod2.network.PacketSender;
1415

1516
/**
1617
* @author kevinj
@@ -31,14 +32,17 @@ public PlayerTriggerTeslaEvent(){
3132
}
3233

3334
public void setTriggerable(boolean triggerable) {
35+
PacketSender.sendEventSetPacket(playerName,"Triggerable",triggerable);
3436
Triggerable = triggerable;
3537
}
3638

3739
public TeslaGate getTeslaGate() {
40+
TeslaGate = PacketSender.sendEventGetPacket(playerName,"TeslaGate",TeslaGate.class);
3841
return TeslaGate;
3942
}
4043

4144
public boolean isTriggerable() {
45+
Triggerable = PacketSender.sendEventGetPacket(playerName,"Triggerable",Boolean.class);
4246
return Triggerable;
4347
}
4448

JSMod2API/src/main/java/cn/jsmod2/api/event/player/Scp096CooldownEndEvent.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,27 @@
1010

1111
import cn.jsmod2.api.player.Player;
1212

13+
import static cn.jsmod2.network.PacketSender.sendEventGetPacket;
14+
import static cn.jsmod2.network.PacketSender.sendEventSetPacket;
15+
1316
/**
1417
* @author kevinj
1518
*/
1619
public class Scp096CooldownEndEvent extends PlayerEvent implements IScp096CooldownEndEvent{
1720
private boolean allow;
1821

1922
public boolean isAllow() {
23+
allow = sendEventGetPacket(playerName,"Allow",Boolean.class);
2024
return allow;
2125
}
2226

27+
28+
2329
public void setAllow(boolean allow) {
30+
sendEventSetPacket(playerName,"Allow",allow);
2431
this.allow = allow;
2532
}
2633

27-
28-
2934
public Scp096CooldownEndEvent(Player player, boolean allow) {
3035
super(player);
3136
this.allow = allow;

JSMod2API/src/main/java/cn/jsmod2/api/event/player/Scp096CooldownStartEvent.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010

1111
import cn.jsmod2.api.player.Player;
1212

13+
import static cn.jsmod2.network.PacketSender.sendEventGetPacket;
14+
import static cn.jsmod2.network.PacketSender.sendEventSetPacket;
15+
1316
/**
1417
* @author kevinj
1518
*/
@@ -26,12 +29,15 @@ public Scp096CooldownStartEvent(){
2629
}
2730

2831
public boolean isAllow() {
32+
allow = sendEventGetPacket(playerName,"Allow",Boolean.class);
2933
return allow;
3034
}
3135

36+
37+
3238
public void setAllow(boolean allow) {
39+
sendEventSetPacket(playerName,"Allow",allow);
3340
this.allow = allow;
3441
}
3542

36-
3743
}

JSMod2API/src/main/java/cn/jsmod2/api/event/player/Scp096EnrageEvent.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010

1111
import cn.jsmod2.api.player.Player;
1212

13+
import static cn.jsmod2.network.PacketSender.sendEventGetPacket;
14+
import static cn.jsmod2.network.PacketSender.sendEventSetPacket;
15+
1316
/**
1417
* @author kevinj
1518
*/
@@ -26,10 +29,14 @@ public Scp096EnrageEvent(){
2629
}
2730

2831
public boolean isAllow() {
32+
allow = sendEventGetPacket(playerName,"Allow",Boolean.class);
2933
return allow;
3034
}
3135

36+
37+
3238
public void setAllow(boolean allow) {
39+
sendEventSetPacket(playerName,"Allow",allow);
3340
this.allow = allow;
3441
}
3542
}

0 commit comments

Comments
 (0)