1818import cn .jsmod2 .core .CommandSender ;
1919import cn .jsmod2 .core .Server ;
2020import cn .jsmod2 .core .math .Vector ;
21+ import cn .jsmod2 .network .DoGetStream ;
22+ import cn .jsmod2 .network .DoStream ;
2123import cn .jsmod2 .network .SimpleGetStream ;
2224import cn .jsmod2 .network .SimpleSetStream ;
2325
@@ -67,29 +69,40 @@ public String getIpAddress() {
6769
6870 public int getPlayerId () {
6971 SimpleGetStream stream = new SimpleGetStream (Integer .class );
72+ playerId = stream .read (playerName ,"PlayerId" ,Integer .class );
7073 return playerId ;
7174 }
7275
7376
7477 public String getSteamId () {
78+ SimpleGetStream stream = new SimpleGetStream (String .class );
79+ steamId = stream .read (playerName ,"SteamId" ,String .class );
7580 return steamId ;
7681 }
7782
7883
7984 public RadioStatus getRadioStatus () {
85+ SimpleGetStream stream = new SimpleGetStream (RadioStatus .class );
86+ radioStatus = stream .read (playerName ,"RadioStatus" ,RadioStatus .class );
8087 return radioStatus ;
8188 }
8289
8390 public void setRadioStatus (RadioStatus radioStatus ) {
91+ SimpleSetStream stream = new SimpleSetStream ();
92+ stream .write (playerName ,"RadioStatus" ,radioStatus );
8493 this .radioStatus = radioStatus ;
8594 }
8695
8796 public boolean isOverwatchMode () {
97+ SimpleGetStream stream = new SimpleGetStream (Boolean .class );
98+ overwatchMode = stream .read (playerName ,"OverWatchMode" ,Boolean .class );
8899 return overwatchMode ;
89100 }
90101
91102
92103 public boolean isDoNotTrack () {
104+ SimpleGetStream stream = new SimpleGetStream (Boolean .class );
105+ doNotTrack = stream .read (playerName ,"DoNotTrack" ,Boolean .class );
93106 return doNotTrack ;
94107 }
95108
@@ -100,78 +113,133 @@ public Scp079Data getScp079Data() {
100113
101114
102115 public void kill (DamageType type ){
103-
116+ DoStream stream = new DoStream ();
117+ stream .method = "Kill" ;
118+ stream .args = new String []{"'" +type +"'" };
119+ stream .playerName = playerName ;
120+ stream .send ();
104121 }
105122
106123 public void kill (){
107124 kill (DamageType .NUKE );
108125 }
109126
110127 public int getHealth (){
111- return 0 ;
128+ DoGetStream stream = new DoGetStream (Integer .class );
129+ stream .method = "GetHealth" ;
130+ return (Integer )stream .send ();
112131 }
113132
114133 public void addHealth (int amount ){
134+ DoStream stream = new DoStream ();
135+ stream .args = new String []{amount +"" };
136+ stream .method = "AddHealth" ;
137+ stream .playerName = playerName ;
138+ stream .send ();
115139 //发包
116140 }
117141
118142 public void damage (int amount ,DamageType type ){
119-
143+ DoStream stream = new DoStream ();
144+ stream .playerName = playerName ;
145+ stream .method = "Damage" ;
146+ stream .args = new String []{amount +"" ,"'" +type +"'" };
147+ stream .send ();
120148 }
121149
122150 public void damage (int amount ){
123151 damage (amount ,DamageType .NUKE );
124152 }
125153
126154 public void setHealth (int amount ,DamageType type ){
127-
155+ DoStream stream = new DoStream ();
156+ stream .method = "SetHealth" ;
157+ stream .playerName = playerName ;
158+ stream .args = new String []{amount +"" ,"'" +type +"'" };
128159 }
129160
130161 public void setHealth (int amount ){
131162 setHealth (amount ,DamageType .NUKE );
132163 }
133164
134165 public int getAmmo (AmmoType type ){
135- return 0 ;
166+ DoGetStream stream = new DoGetStream (AmmoType .class );
167+ stream .method = "GetAmmo" ;
168+ stream .args = new String []{"'" +type +"'" };
169+ stream .playerName = playerName ;
170+ return (Integer ) stream .send ();
136171 }
137172
138173 public void setAmmo (AmmoType type ,int amount ){
139-
174+ DoStream stream = new DoStream ();
175+ stream .playerName = playerName ;
176+ stream .method = "SetAmmo" ;
177+ stream .args = new String []{"'" +type +"'" ,amount +"" };
178+ stream .send ();
140179 }
141180
142181 public Vector getPosition (){
143- return null ;
182+ DoGetStream stream = new DoGetStream (Vector .class );
183+ stream .playerName = playerName ;
184+ stream .method = "GetPosition" ;
185+ return (Vector ) stream .send ();
144186 }
145187
146188 public void teleport (Vector pos ,boolean unstuck ){
147-
189+ DoGetStream stream = new DoGetStream (Vector .class );
190+ stream .method = "Teleport" ;
191+ stream .playerName = playerName ;
192+ stream .args = new String []{pos .toString (),unstuck +"" };
193+ stream .send ();
148194 }
149195
150196 public void teleport (Vector pos ){
151197 teleport (pos ,false );
152198 }
153199
154200 public void setRank (String color ,String text ,String group ){
155-
201+ DoStream stream = new DoStream ();
202+ stream .method = "SetRank" ;
203+ stream .playerName = playerName ;
204+ stream .args = new String []{color ,text ,group };
205+ stream .send ();
156206 }
157207
158208 public String getRankName (){
159- return "" ;
209+ DoGetStream stream = new DoGetStream (String .class );
210+ stream .method = "GetRankName" ;
211+ stream .playerName = playerName ;
212+ return (String ) stream .send ();
160213 }
161214
162215 public void disConnect (){
163-
216+ DoStream stream = new DoStream ();
217+ stream .method = "DisConnect" ;
218+ stream .playerName = playerName ;
219+ stream .send ();
164220 }
165221
166222 public void disConnect (String message ){
167-
223+ DoStream stream = new DoStream ();
224+ stream .playerName = playerName ;
225+ stream .method = "DisConnect" ;
226+ stream .args =new String []{message };
227+ stream .send ();
168228 }
169229 public void ban (int duration ){
170-
230+ DoStream stream = new DoStream ();
231+ stream .playerName = playerName ;
232+ stream .method = "Ban" ;
233+ stream .args = new String []{duration +"" };
234+ stream .send ();
171235 }
172236
173237 public void ban (int duration ,String message ){
174-
238+ DoStream stream = new DoStream ();
239+ stream .method = "Ban" ;
240+ stream .args = new String []{duration +"" ,message };
241+ stream .playerName = playerName ;
242+ stream .send ();
175243 }
176244
177245 public Item giveItem (ItemType type ){
0 commit comments