本文整理汇总了Java中cn.nukkit.network.SourceInterface类的典型用法代码示例。如果您正苦于以下问题:Java SourceInterface类的具体用法?Java SourceInterface怎么用?Java SourceInterface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SourceInterface类属于cn.nukkit.network包,在下文中一共展示了SourceInterface类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: Player
import cn.nukkit.network.SourceInterface; //导入依赖的package包/类
public Player(SourceInterface interfaz, Long clientID, String ip, int port) {
super(null, new CompoundTag());
this.interfaz = interfaz;
this.windows = new HashMap<>();
this.perm = new PermissibleBase(this);
this.server = Server.getInstance();
this.lastBreak = Long.MAX_VALUE;
this.ip = ip;
this.port = port;
this.clientID = clientID;
this.loaderId = Level.generateChunkLoaderId(this);
this.chunksPerTick = (int) this.server.getConfig("chunk-sending.per-tick", 4);
this.spawnThreshold = (int) this.server.getConfig("chunk-sending.spawn-threshold", 56);
this.spawnPosition = null;
this.gamemode = this.server.getGamemode();
this.setLevel(this.server.getDefaultLevel());
this.viewDistance = this.server.getViewDistance();
this.chunkRadius = viewDistance;
//this.newPosition = new Vector3(0, 0, 0);
this.boundingBox = new AxisAlignedBB(0, 0, 0, 0, 0, 0);
this.uuid = null;
this.rawUUID = null;
this.creationTime = System.currentTimeMillis();
}
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:27,代码来源:Player.java
示例2: Player
import cn.nukkit.network.SourceInterface; //导入依赖的package包/类
public Player(SourceInterface interfaz, Long clientID, String ip, int port) {
super(null, new CompoundTag());
this.interfaz = interfaz;
this.windows = new HashMap<>();
this.perm = new PermissibleBase(this);
this.server = Server.getInstance();
this.lastBreak = Long.MAX_VALUE;
this.ip = ip;
this.port = port;
this.clientID = clientID;
this.loaderId = Level.generateChunkLoaderId(this);
this.chunksPerTick = (int) this.server.getConfig("chunk-sending.per-tick", 4);
this.spawnThreshold = (int) this.server.getConfig("chunk-sending.spawn-threshold", 56);
this.spawnPosition = null;
this.gamemode = this.server.getGamemode();
this.setLevel(this.server.getDefaultLevel());
this.viewDistance = this.server.getViewDistance();
//this.newPosition = new Vector3(0, 0, 0);
this.boundingBox = new AxisAlignedBB(0, 0, 0, 0, 0, 0);
this.uuid = null;
this.rawUUID = null;
this.creationTime = System.currentTimeMillis();
}
开发者ID:Creeperface01,项目名称:NukkitGT,代码行数:26,代码来源:Player.java
示例3: PlayerCreationEvent
import cn.nukkit.network.SourceInterface; //导入依赖的package包/类
public PlayerCreationEvent(SourceInterface interfaz, Class<? extends Player> baseClass, Class<? extends Player> playerClass, Long clientId, String address, int port) {
this.interfaz = interfaz;
this.clientId = clientId;
this.address = address;
this.port = port;
this.baseClass = baseClass;
this.playerClass = playerClass;
}
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:10,代码来源:PlayerCreationEvent.java
示例4: Player
import cn.nukkit.network.SourceInterface; //导入依赖的package包/类
public Player(SourceInterface interfaz, Long clientID, String ip, int port) {
super(null, new CompoundTag());
this.interfaz = interfaz;
this.windows = new HashMap<>();
this.perm = new PermissibleBase(this);
this.server = Server.getInstance();
this.lastBreak = Long.MAX_VALUE;
this.ip = ip;
this.port = port;
this.clientID = clientID;
this.loaderId = Level.generateChunkLoaderId(this);
this.chunksPerTick = (int) this.server.getConfig("chunk-sending.per-tick", 4);
this.spawnThreshold = (int) this.server.getConfig("chunk-sending.spawn-threshold", 56);
this.spawnPosition = null;
this.gamemode = this.server.getDefaultGamemode();
this.setLevel(this.server.getDefaultLevel());
this.viewDistance = this.server.getViewDistance();
this.chunkRadius = viewDistance;
//this.newPosition = new Vector3(0, 0, 0);
this.boundingBox = new AxisAlignedBB(0, 0, 0, 0, 0, 0);
this.uuid = null;
this.rawUUID = null;
this.creationTime = System.currentTimeMillis();
this.enableRevert = this.server.getJupiterConfigBoolean("enable-revert");
this.server.getJupiterConfigBoolean("allow-snowball");
this.server.getJupiterConfigBoolean("allow-egg");
this.server.getJupiterConfigBoolean("allow-enderpearl");
this.server.getJupiterConfigBoolean("allow-experience-bottle");
this.server.getJupiterConfigBoolean("allow-splash-potion");
this.server.getJupiterConfigBoolean("allow-bow");
this.server.getJupiterConfigBoolean("allow-fishing-rod");
this.printPackets = this.getServer().printPackets();
}
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:37,代码来源:Player.java
示例5: SynapseAPI
import cn.nukkit.network.SourceInterface; //导入依赖的package包/类
public SynapseAPI(Server server) {
instance = this;
this.server = server;
enable = (boolean) server.getAdvancedProperty("synapse.enable", true);
if (!enable) {
return;
}
this.serverIp = (String) server.getAdvancedProperty("synapse.server-ip", "127.0.0.1");
this.port = (int) server.getAdvancedProperty("synapse.server-port", 10305);
this.isMainServer = (boolean) server.getAdvancedProperty("synapse.is-main-server", true);
this.password = (String) server.getAdvancedProperty("synapse.password", "0123456789abcdef");
if (this.password.length() != 16) {
this.getLogger().warning("You must use a 16 bit length key!");
this.getLogger().warning("The Synapse will not be enabled!");
enable = false;
return;
}
this.serverDescription = (String) server.getAdvancedProperty("synapse.description", "A Synapse client");
for(SourceInterface interfaz : this.getServer().getNetwork().getInterfaces()){
if(interfaz instanceof RakNetInterface){
boolean disableRak = (boolean) server.getAdvancedProperty("synapse.disable-rak", false);
if(disableRak){
interfaz.shutdown();
this.getLogger().notice("RakNet has been disabled by synapse.disable-rak option.");
break;
}
}
}
this.synapseInterface = new SynapseInterface(this, this.serverIp, this.port);
this.synLibInterface = new SynLibInterface(this.synapseInterface);
this.lastUpdate = System.currentTimeMillis();
this.lastRecvInfo = System.currentTimeMillis();
try{
this.connect();
} catch(Exception e){
this.connect(); //Ya, this works!
}
}
开发者ID:PrismarineMC,项目名称:MagmaBlock,代码行数:39,代码来源:SynapseAPI.java
示例6: SynapsePlayerCreationEvent
import cn.nukkit.network.SourceInterface; //导入依赖的package包/类
public SynapsePlayerCreationEvent(SourceInterface interfaz, Class<? extends SynapsePlayer> baseClass, Class<? extends SynapsePlayer> playerClass, Long clientId, String address, int port) {
this.interfaz = interfaz;
this.clientId = clientId;
this.address = address;
this.port = port;
this.baseClass = baseClass;
this.playerClass = playerClass;
}
开发者ID:PrismarineMC,项目名称:MagmaBlock,代码行数:10,代码来源:SynapsePlayerCreationEvent.java
示例7: loadEntries
import cn.nukkit.network.SourceInterface; //导入依赖的package包/类
private void loadEntries() {
this.saveDefaultConfig();
enable = this.getConfig().getBoolean("enable", true);
this.autoCompress = this.getConfig().getBoolean("autoCompress", true);
if (!enable) {
this.getLogger().warning("The SynapseAPI is not be enabled!");
} else {
if (this.getConfig().getBoolean("disable-rak")) {
for (SourceInterface sourceInterface : this.getServer().getNetwork().getInterfaces()) {
if (sourceInterface instanceof RakNetInterface) {
sourceInterface.shutdown();
}
}
}
List entries = this.getConfig().getList("entries");
for (Object entry : entries) {
@SuppressWarnings("unchecked")
ConfigSection section = new ConfigSection((LinkedHashMap) entry);
String serverIp = section.getString("server-ip", "127.0.0.1");
int port = section.getInt("server-port", 10305);
boolean isMainServer = section.getBoolean("isMainServer");
String password = section.getString("password");
String serverDescription = section.getString("description");
this.autoConnect = section.getBoolean("autoConnect", true);
if (this.autoConnect) {
this.addSynapseAPI(new SynapseEntry(this, serverIp, port, isMainServer, password, serverDescription));
}
}
}
}
开发者ID:iTXTech,项目名称:SynapseAPI,代码行数:34,代码来源:SynapseAPI.java
示例8: run
import cn.nukkit.network.SourceInterface; //导入依赖的package包/类
@Override
public void run() {
PlayerLoginPacket playerLoginPacket;
while ((playerLoginPacket = playerLoginQueue.poll()) != null) {
SynapsePlayerCreationEvent ev = new SynapsePlayerCreationEvent(synLibInterface, SynapsePlayer.class, SynapsePlayer.class, new Random().nextLong(), playerLoginPacket.address, playerLoginPacket.port);
getSynapse().getServer().getPluginManager().callEvent(ev);
Class<? extends SynapsePlayer> clazz = ev.getPlayerClass();
try {
Constructor constructor = clazz.getConstructor(SourceInterface.class, SynapseEntry.class, Long.class, String.class, int.class);
SynapsePlayer player = (SynapsePlayer) constructor.newInstance(synLibInterface, this.entry, ev.getClientId(), ev.getAddress(), ev.getPort());
player.setUniqueId(playerLoginPacket.uuid);
players.put(playerLoginPacket.uuid, player);
getSynapse().getServer().addPlayer(playerLoginPacket.uuid.toString(), player);
player.handleLoginPacket(playerLoginPacket);
} catch (NoSuchMethodException | InvocationTargetException | InstantiationException | IllegalAccessException e) {
Server.getInstance().getLogger().logException(e);
}
}
RedirectPacketEntry redirectPacketEntry;
while ((redirectPacketEntry = redirectPacketQueue.poll()) != null) {
//Server.getInstance().getLogger().warning("C => S " + redirectPacketEntry.dataPacket.getClass().getSimpleName());
redirectPacketEntry.player.handleDataPacket(redirectPacketEntry.dataPacket);
}
PlayerLogoutPacket playerLogoutPacket;
while ((playerLogoutPacket = playerLogoutQueue.poll()) != null) {
UUID uuid1;
if(players.containsKey(uuid1 = playerLogoutPacket.uuid)){
players.get(uuid1).close(playerLogoutPacket.reason, playerLogoutPacket.reason, true);
removePlayer(uuid1);
}
}
}
开发者ID:iTXTech,项目名称:SynapseAPI,代码行数:35,代码来源:SynapseEntry.java
示例9: forceShutdown
import cn.nukkit.network.SourceInterface; //导入依赖的package包/类
public void forceShutdown() {
if (this.hasStopped) {
return;
}
try {
if (!this.isRunning) {
//todo sendUsage
}
// clean shutdown of console thread asap
this.console.shutdown();
this.hasStopped = true;
this.shutdown();
if (this.rcon != null) {
this.rcon.close();
}
this.getLogger().debug("Disabling all plugins");
this.pluginManager.disablePlugins();
for (Player player : new ArrayList<>(this.players.values())) {
player.close(player.getLeaveMessage(), (String) this.getConfig("settings.shutdown-message", "Server closed"));
}
this.getLogger().debug("Unloading all levels");
for (Level level : new ArrayList<>(this.getLevels().values())) {
this.unloadLevel(level, true);
}
this.getLogger().debug("Removing event handlers");
HandlerList.unregisterAll();
this.getLogger().debug("Stopping all tasks");
this.scheduler.cancelAllTasks();
this.scheduler.mainThreadHeartbeat(Integer.MAX_VALUE);
this.getLogger().debug("Closing console");
this.console.interrupt();
this.getLogger().debug("Stopping network interfaces");
for (SourceInterface interfaz : this.network.getInterfaces()) {
interfaz.shutdown();
this.network.unregisterInterface(interfaz);
}
this.getLogger().debug("Disabling timings");
Timings.stopServer();
//todo other things
} catch (Exception e) {
this.logger.logException(e); //todo remove this?
this.logger.emergency("Exception happened while shutting down, exit the process");
System.exit(1);
}
}
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:59,代码来源:Server.java
示例10: getInterface
import cn.nukkit.network.SourceInterface; //导入依赖的package包/类
public SourceInterface getInterface() {
return interfaz;
}
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:4,代码来源:PlayerCreationEvent.java
示例11: SynapsePlayer
import cn.nukkit.network.SourceInterface; //导入依赖的package包/类
public SynapsePlayer(SourceInterface interfaz, Long clientID, String ip, int port) {
super(interfaz, clientID, ip, port);
}
开发者ID:PrismarineMC,项目名称:MagmaBlock,代码行数:4,代码来源:SynapsePlayer.java
示例12: forceShutdown
import cn.nukkit.network.SourceInterface; //导入依赖的package包/类
public void forceShutdown() {
if (this.hasStopped) {
return;
}
try {
if (!this.isRunning) {
//todo sendUsage
}
// clean shutdown of console thread asap
this.console.shutdown();
this.hasStopped = true;
this.shutdown();
if (this.rcon != null) {
this.rcon.close();
}
this.getLogger().debug("Disabling all plugins");
this.pluginManager.disablePlugins();
for (Player player : new ArrayList<>(this.players.values())) {
player.close(player.getLeaveMessage(), (String) this.getConfig("settings.shutdown-message", "Server closed"));
}
this.getLogger().debug("Unloading all levels");
for (Level level : new ArrayList<>(this.getLevels().values())) {
this.unloadLevel(level, true);
}
this.getLogger().debug("Removing event handlers");
HandlerList.unregisterAll();
this.getLogger().debug("Stopping all tasks");
this.scheduler.cancelAllTasks();
this.scheduler.mainThreadHeartbeat(Integer.MAX_VALUE);
this.getLogger().debug("Closing console");
this.console.interrupt();
if(synapse != null) {
this.getLogger().debug("Stopping Synapse client");
synapse.shutdown();
}
this.getLogger().debug("Stopping network interfaces");
for (SourceInterface interfaz : this.network.getInterfaces()) {
interfaz.shutdown();
this.network.unregisterInterface(interfaz);
}
this.getLogger().debug("Disabling timings");
Timings.stopServer();
//todo other things
} catch (Exception e) {
this.logger.logException(e); //todo remove this?
this.logger.emergency("Exception happened while shutting down, exit the process");
System.exit(1);
}
}
开发者ID:PrismarineMC,项目名称:MagmaBlock,代码行数:64,代码来源:Server.java
示例13: SynapsePlayer
import cn.nukkit.network.SourceInterface; //导入依赖的package包/类
public SynapsePlayer(SourceInterface interfaz, SynapseEntry synapseEntry, Long clientID, String ip, int port) {
super(interfaz, clientID, ip, port);
this.synapseEntry = synapseEntry;
this.isSynapseLogin = this.synapseEntry != null;
}
开发者ID:iTXTech,项目名称:SynapseAPI,代码行数:6,代码来源:SynapsePlayer.java
注:本文中的cn.nukkit.network.SourceInterface类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论