forked from git-mirrors/GeyserConnect
Add disabled storage manager to prevent empty data (fixes #13)
This commit is contained in:
parent
883f752944
commit
efe9fc4a80
2 changed files with 61 additions and 7 deletions
|
@ -29,6 +29,7 @@ import com.nukkitx.protocol.bedrock.*;
|
|||
import com.nukkitx.protocol.bedrock.v408.Bedrock_v408;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.geysermc.connect.storage.DisabledStorageManager;
|
||||
import org.geysermc.connector.network.BedrockProtocol;
|
||||
import org.geysermc.connector.utils.FileUtils;
|
||||
import org.geysermc.connect.proxy.GeyserProxyBootstrap;
|
||||
|
@ -99,19 +100,23 @@ public class MasterServer {
|
|||
|
||||
this.generalThreadPool = Executors.newScheduledThreadPool(32);
|
||||
|
||||
boolean enableShutdownTimer = geyserConnectConfig.getGeyser().getShutdownTime() != -1;
|
||||
|
||||
// Start a timer to keep the thread running
|
||||
timer = new Timer();
|
||||
TimerTask task = new TimerTask() { public void run() { } };
|
||||
timer.scheduleAtFixedRate(task, 0L, 1000L);
|
||||
|
||||
if (!geyserConnectConfig.getCustomServers().isEnabled()) {
|
||||
// Force the storage manager if we have it disabled
|
||||
storageManager = new DisabledStorageManager();
|
||||
logger.info("Disabled custom player servers");
|
||||
} else {
|
||||
try {
|
||||
storageManager = geyserConnectConfig.getCustomServers().getStorageType().getStorageManager().newInstance();
|
||||
} catch (Exception e) {
|
||||
logger.severe("Invalid storage manager class!", e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
storageManager.setupStorage();
|
||||
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Copyright (c) 2019-2020 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author GeyserMC
|
||||
* @link https://github.com/GeyserMC/GeyserConnect
|
||||
*/
|
||||
|
||||
package org.geysermc.connect.storage;
|
||||
|
||||
import org.geysermc.connect.utils.Player;
|
||||
import org.geysermc.connect.utils.Server;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DisabledStorageManager extends AbstractStorageManager {
|
||||
|
||||
@Override
|
||||
public void setupStorage() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveServers(Player player) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Server> loadServers(Player player) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue