Skip to content

Commit f2ef8db

Browse files
author
magiclu550
committed
[JSMOD@2_475_COMMIT] add SimpleGet/SetStream And DoStream
1 parent a171604 commit f2ef8db

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package cn.jsmod2.network;
2+
3+
public class InvokeMethodPacket {
4+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package cn.jsmod2.network;
2+
3+
import cn.jsmod2.network.protocol.event.newstream.EventValueGetStream;
4+
5+
public class SimpleGetStream {
6+
7+
private EventValueGetStream stream;
8+
9+
public SimpleGetStream(Class<?> type){
10+
stream = new EventValueGetStream(type);
11+
}
12+
13+
public <T> T read(String id,String name,int type,Class<T> returnType){
14+
stream.getType = type;
15+
stream.name = name;
16+
stream.playerName = id;
17+
return returnType.cast(stream.send());
18+
}
19+
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package cn.jsmod2.network;
2+
3+
import cn.jsmod2.network.protocol.event.newstream.EventValueSetStream;
4+
5+
public class SimpleSetStream {
6+
7+
private EventValueSetStream setStream;
8+
9+
public SimpleSetStream(){
10+
setStream = new EventValueSetStream();
11+
}
12+
13+
public void write(String id,String key,String value){
14+
setStream.playerName = id;
15+
setStream.name = key;
16+
setStream.value = value;
17+
setStream.send();
18+
}
19+
20+
}

0 commit comments

Comments
 (0)