更新
This commit is contained in:
@ -3,4 +3,6 @@ package com.alphaae.mcpe.servers;
|
|||||||
public interface Config {
|
public interface Config {
|
||||||
int JOIN_WAITING_TIME = 240;
|
int JOIN_WAITING_TIME = 240;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package com.alphaae.mcpe.servers.command;
|
|||||||
import cn.nukkit.Player;
|
import cn.nukkit.Player;
|
||||||
import cn.nukkit.command.Command;
|
import cn.nukkit.command.Command;
|
||||||
import cn.nukkit.command.CommandSender;
|
import cn.nukkit.command.CommandSender;
|
||||||
|
import cn.nukkit.item.Item;
|
||||||
import cn.nukkit.utils.TextFormat;
|
import cn.nukkit.utils.TextFormat;
|
||||||
import com.alphaae.mcpe.servers.MainPlugin;
|
import com.alphaae.mcpe.servers.MainPlugin;
|
||||||
import com.alphaae.mcpe.servers.StaticData;
|
import com.alphaae.mcpe.servers.StaticData;
|
||||||
@ -33,6 +34,8 @@ public class HiCommand extends Command {
|
|||||||
//测试指令
|
//测试指令
|
||||||
RePlayer rePlayer = StaticData.rePlayerMap.get(uuid);
|
RePlayer rePlayer = StaticData.rePlayerMap.get(uuid);
|
||||||
ChangePlayerCoinUtils.ReduceIcon(rePlayer, 100);
|
ChangePlayerCoinUtils.ReduceIcon(rePlayer, 100);
|
||||||
|
|
||||||
|
player.dropItem(new Item(347));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.alphaae.mcpe.servers.utils;
|
package com.alphaae.mcpe.servers.utils;
|
||||||
|
|
||||||
import cn.nukkit.Player;
|
import cn.nukkit.Player;
|
||||||
|
import cn.nukkit.item.Item;
|
||||||
import com.alphaae.mcpe.servers.MainPlugin;
|
import com.alphaae.mcpe.servers.MainPlugin;
|
||||||
import com.alphaae.mcpe.servers.model.RePlayer;
|
import com.alphaae.mcpe.servers.model.RePlayer;
|
||||||
|
|
||||||
@ -24,7 +25,7 @@ public class PlayerDataUtils {
|
|||||||
try {
|
try {
|
||||||
File playerDataFile = new File(PLAYER_DATA_FOLDER, uuid.toString() + FILE_TYPE);
|
File playerDataFile = new File(PLAYER_DATA_FOLDER, uuid.toString() + FILE_TYPE);
|
||||||
if (!playerDataFile.exists()) {
|
if (!playerDataFile.exists()) {
|
||||||
CreateNewPlayerData(playerDataFile, uuid);
|
CreateNewPlayerData(player);
|
||||||
}
|
}
|
||||||
ObjectInputStream inputStream = new ObjectInputStream(new FileInputStream(playerDataFile));
|
ObjectInputStream inputStream = new ObjectInputStream(new FileInputStream(playerDataFile));
|
||||||
RePlayer rePlayer = (RePlayer) inputStream.readObject();
|
RePlayer rePlayer = (RePlayer) inputStream.readObject();
|
||||||
@ -49,13 +50,15 @@ public class PlayerDataUtils {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean CreateNewPlayerData(File playerDataFile, UUID uuid) {
|
private static boolean CreateNewPlayerData(Player player) {
|
||||||
try {
|
try {
|
||||||
|
UUID uuid = player.getUniqueId();
|
||||||
|
//给予初始玩家的操作
|
||||||
|
|
||||||
|
RePlayer rePlayer = new RePlayer(uuid, "新火", 2000);
|
||||||
|
File playerDataFile = new File(PLAYER_DATA_FOLDER, uuid.toString() + FILE_TYPE);
|
||||||
playerDataFile.createNewFile();
|
playerDataFile.createNewFile();
|
||||||
ObjectOutputStream outputStream = new ObjectOutputStream(new FileOutputStream(playerDataFile));
|
ObjectOutputStream outputStream = new ObjectOutputStream(new FileOutputStream(playerDataFile));
|
||||||
RePlayer rePlayer = new RePlayer(uuid, "新火", 2000);
|
|
||||||
|
|
||||||
|
|
||||||
outputStream.writeObject(rePlayer);
|
outputStream.writeObject(rePlayer);
|
||||||
outputStream.close();
|
outputStream.close();
|
||||||
return true;
|
return true;
|
||||||
|
Reference in New Issue
Block a user