Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
HUYDGD authored Jul 21, 2020
1 parent e99a727 commit 2cb1d38
Show file tree
Hide file tree
Showing 17 changed files with 87 additions and 82 deletions.
4 changes: 2 additions & 2 deletions src/falkirks/minereset/Mine.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function __construct(MineManager $api,
$this->register();
}
else{
$api->getApi()->getLogger()->warning("MineReset has detected corruption of the mines.yml file in mine with name {$this->name}, MineReset will not reset this mine.");
$api->getApi()->getLogger()->warning("MineReset đã PHÁT HIỆN ra được lỗi trong mine.yml ở khu mine có tên là {$this->name}, MineReset sẽ không reset khu mine này.");
}

}
Expand Down Expand Up @@ -109,7 +109,7 @@ public function onRun(int $currentTick){
$this->reset();
}
catch(MineResetException $e){
$this->getApi()->getApi()->getLogger()->debug("Background reset timer raised an exception --> " . $e->getMessage());
$this->getApi()->getApi()->getLogger()->debug("Hẹn giờ thiết lập lại nền đã đưa ra một ngoại lệ --> " . $e->getMessage());
}
}

Expand Down
12 changes: 6 additions & 6 deletions src/falkirks/minereset/MineManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public function __construct(MineReset $api, DataStore $store, $flag = MineManage
$this->mines = [];
if(file_exists($api->getDataFolder() . "mines.yml")){
rename($api->getDataFolder() . "mines.yml", $api->getDataFolder() . "_minesOLD.yml");
$api->getLogger()->info("MineReset is upgrading your old mines.yml to the newest config version");
$api->getLogger()->info("A backup of your old file will be placed at " . TextFormat::BLACK . "_minesOLD.yml" . TextFormat::RESET);
$api->getLogger()->info("MineReset đang nâng cấp file config mine.yml cũ của bạn lên phiên bản mới nhất");
$api->getLogger()->info("Một bản sao lưu của tập tin cũ của bạn sẽ được đặt tại " . TextFormat::BLACK . "_minesOLD.yml" . TextFormat::RESET);
$this->triggerConfigUpdate();

}
Expand Down Expand Up @@ -71,7 +71,7 @@ protected function loadMines(): array{
$out[$name] = Mine::fromJson($this, $data, $name);
}
catch(JsonFieldMissingException $e){
$this->getApi()->getLogger()->warning("Mine with name " . $name . " is missing data in save file. Will be deleted on next save.");
$this->getApi()->getLogger()->warning("Khu mine tên " . $name . " đang bị thiếu dữ liệu so với file đã lưu.");
}
//$out[$name] = $this->mineFromData($name, $data);
}
Expand Down Expand Up @@ -144,7 +144,7 @@ public function offsetSet($offset, $value){
}
}
else{
throw new \RuntimeException("Invalid \$offset for mine data.");
throw new \RuntimeException("\$offset không hợp lệ cho dữ liệu khu mine.");
}
}
/**
Expand Down Expand Up @@ -180,7 +180,7 @@ public function offsetUnset($offset){
protected function mineFromData($name, array $array){
if(count($array) === 9 || count($array) === 8) {
if(!$this->getApi()->getServer()->isLevelLoaded($array[7])){
$this->api->getLogger()->warning("A mine with the name " . TextFormat::AQUA . $name . TextFormat::RESET . " is connected to a level which is not loaded. You won't be able to use it until you load the level correctly.");
$this->api->getLogger()->warning("Khu mine tên " . TextFormat::AQUA . $name . TextFormat::RESET . " không thể reset do world chưa được load.");
}
return new Mine($this,
new Vector3(min($array[0], $array[1]), min($array[2], $array[3]), min($array[4], $array[5])),
Expand All @@ -190,7 +190,7 @@ protected function mineFromData($name, array $array){
(is_array($array[6]) ? $array[6] : []),
$array[8] ?? -1);
}
$this->api->getLogger()->critical("A mine with the name " . TextFormat::AQUA . $name . TextFormat::RESET . " is incomplete. It will be removed automatically when your server stops.");
$this->api->getLogger()->critical("Khu mine tên " . TextFormat::AQUA . $name . TextFormat::RESET . " chưa được reset xong. Nó sẽ tự động xóa khi bạn tắt máy chủ.");
return null;
}
/**
Expand Down
5 changes: 4 additions & 1 deletion src/falkirks/minereset/MineReset.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ class MineReset extends PluginBase{
private $creationListener;

public function onEnable(){
$this->getLogger()->info("§aMineReset bản ". $this->getDescription()->getVersion() ." §eFULL VIỆT HÓA §ađã được bật!");
$this->getLogger()->info("§aPlugin được dịch bởi Sói Oniichan.");
$this->getLogger()->info("§cYoutube: §ehttps://www.youtube.com/SoiOniichan");
self::detectChunkSetting();

@mkdir($this->getDataFolder());
Expand Down Expand Up @@ -80,7 +83,7 @@ public function onEnable(){
$this->mainCommand->registerSubCommand("edit", new EditCommand($this), ['e']);

if(!self::supportsChunkSetting()){
$this->getLogger()->warning("Your server does not support setting chunks without unloading them. This will cause tiles and entities to be lost when resetting mines. Upgrade to a newer pmmp to resolve this.");
$this->getLogger()->warning("Vui lòng nâng cấp PocketMine-MP lên bản mới nhất! (Nếu không khi reset khu mine sẽ có một số block bị mất.)");
}

}
Expand Down
4 changes: 2 additions & 2 deletions src/falkirks/minereset/ResetProgressManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct(MineReset $api){
public function notifyProgress(string $progress, string $mineName){
if(isset($this->subscriptions[$mineName])){
foreach ($this->subscriptions[$mineName] as $sender){
$sender->sendMessage("RESET {$mineName}: {$progress}");
$sender->sendMessage("TIẾN TRÌNH KHU {$mineName}: {$progress}");
}
}
}
Expand All @@ -35,7 +35,7 @@ public function notifyComplete(string $mineName){
}
if(isset($this->subscriptions[$mineName])){
foreach ($this->subscriptions[$mineName] as $sender){
$sender->sendMessage("Reset of {$mineName} has completed.");
$sender->sendMessage("Khu {$mineName} đã được reset.");
}
unset($this->subscriptions[$mineName]);
}
Expand Down
2 changes: 1 addition & 1 deletion src/falkirks/minereset/command/AboutCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function execute(CommandSender $sender, $commandLabel, array $args){
$this->getApi()->getServer()->getAsyncPool()->submitTask(new AboutPullTask($sender));
}
else{
$sender->sendMessage(TextFormat::RED . "You do not have permission to run this command." . TextFormat::RESET);
$sender->sendMessage(TextFormat::RED . "Bạn không có quyền để sử dụng lệnh này!" . TextFormat::RESET);
}
}
}
12 changes: 6 additions & 6 deletions src/falkirks/minereset/command/CreateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,22 @@ class CreateCommand extends SubCommand{

public function execute(CommandSender $sender, $commandLabel, array $args){
if(!$sender->hasPermission("minereset.command.create"))
return $sender->sendMessage(TextFormat::RED . "You do not have permission to run this command." . TextFormat::RESET);
return $sender->sendMessage(TextFormat::RED . "Bạn không có quyền để sử dụng lệnh này!" . TextFormat::RESET);

if (!($sender instanceof Player))
return $sender->sendMessage(TextFormat::RED . "This command can only be run in-game." . TextFormat::RESET);
return $sender->sendMessage(TextFormat::RED . "Sử dụng lệnh này trong GAME, làm ơn!" . TextFormat::RESET);

if(!isset($args[0]))
return $sender->sendMessage("Usage: /mine create <name>");
return $sender->sendMessage("Sử dụng: /mine create <tên>");

if($this->getApi()->getCreationListener()->playerHasSession($sender))
return $sender->sendMessage("Hold up! You are already in the process of creating a mine. You need to finish that first.");
return $sender->sendMessage("Ôi bạn ơi! Bạn chưa hoàn tất việc tạo khu mine kìa, hoàn thành nó ngay đi.");

if(isset($this->getApi()->getMineManager()[$args[0]]))
return $sender->sendMessage("That mine already exists. You must run \"/mine destroy {$args[0]}\" before creating a new one.");
return $sender->sendMessage("Khu mine bạn nhập đã TỒN TẠI. Vui lòng dùng \"/mine destroy {$args[0]}\" để phá hủy khu mine.");

$this->getApi()->getCreationListener()->addSession(new MineCreationSession($args[0], $sender));
$sender->sendMessage("Tap a block to set position A.");
$sender->sendMessage("Chạm vào một block để đặt điểm A.");
return true;
}
}
14 changes: 7 additions & 7 deletions src/falkirks/minereset/command/DestroyCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ public function __construct(MineReset $mineReset){
public function doDelete(CommandSender $sender, $name){
unset($this->getApi()->getMineManager()[$name]);
unset($this->senders[$sender->getName()]);
$sender->sendMessage("{$name[0]} has been destroyed.");
$sender->sendMessage("Khu mine {$name[0]} đã được phá hủy.");
}

private function formDelete(CommandSender $sender, $name){
$form = new class("Are you sure?", "You are about to delete the mine called $name.") extends ModalForm {
$form = new class("Bạn có chắc không?", "Bạn sắp xóa khu mine có tên $name.") extends ModalForm {
public function onSubmit(Player $player, $response) : void{
if($response){
$this->parent->doDelete($player, $this->name);
Expand All @@ -53,8 +53,8 @@ public function onSubmit(Player $player, $response) : void{

private function basicDelete(CommandSender $sender, $name){
$str = DestroyCommand::DESTROY_STRINGS[$this->offset];
$sender->sendMessage("Run: " . TextFormat::AQUA . "/mine destroy $name $str" . TextFormat::RESET);
$sender->sendMessage("To destroy mines faster, you can edit the config file directly.");
$sender->sendMessage("Sử dụng: " . TextFormat::AQUA . "/mine destroy $name $str" . TextFormat::RESET);
$sender->sendMessage("Mẹo: Bạn có thể xóa nhanh bằng cách vào file config.");
$this->senders[$sender->getName()] = $str;

if ($this->offset === count(DestroyCommand::DESTROY_STRINGS) - 1) {
Expand All @@ -67,15 +67,15 @@ private function basicDelete(CommandSender $sender, $name){

public function execute(CommandSender $sender, $commandLabel, array $args){
if(!$sender->hasPermission("minereset.command.destroy"))
return $sender->sendMessage(TextFormat::RED . "You do not have permission to run this command." . TextFormat::RESET);
return $sender->sendMessage(TextFormat::RED . "Bạn không có quyền để sử dụng lệnh này!" . TextFormat::RESET);

if (!isset($args[0]))
return $sender->sendMessage("Usage: /mine destroy <name>");
return $sender->sendMessage("Sử dụng: /mine destroy <tên>");

$name = $args[0];

if(!isset($this->getApi()->getMineManager()[$name]))
return $sender->sendMessage("{$args[0]} is not a valid mine.");
return $sender->sendMessage("Không thế tìm thấy khu mine {$args[0]}.");

if($sender instanceof Player && $this->formsSupported()){
$this->formDelete($sender, $name);
Expand Down
20 changes: 11 additions & 9 deletions src/falkirks/minereset/command/EditCommand.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

/* LỆNH EDIT BỊ LỖI ANH EM ƠI, KHI NÀO CÓ THỜI GIAN MÌNH SỬA */

namespace falkirks\minereset\command;


Expand All @@ -18,25 +20,25 @@ public function execute(CommandSender $sender, $commandLabel, array $args){
if($sender->hasPermission("minereset.command.edit")) {
if($sender instanceof Player && $this->formsSupported()){
$sender->sendForm(new class("Mine: a", [
new Dropdown("Select product", ["beer", "cheese", "cola"]),
new Input("Mine name", "a"),
new Input("Reset interval", "-1"),
new Label("Reset interval is in seconds"), //popElement() does not work with label
new Input("Warp name", ""),
new Label("Name of the warp to link with the mine"),
new Dropdown("Chọn sản phẩm", ["beer", "cheese", "cola"]),
new Input("Tên khu mine", "a"),
new Input("Thời gian đặt lại", "-1"),
new Label("Thời gian đặt lại được tính bằng giây"), //popElement() does not work with label
new Input("Tên warp", ""),
new Label("Tên warp để kết nối với khu mine."),
]) extends CustomForm {
public function onSubmit(Player $player, $response) : void{
parent::onSubmit($player, $response);
$player->sendMessage("cool!");
$player->sendMessage("Tuyệt!");
}
});
}
else {
$sender->sendMessage(TextFormat::RED . "You must install EasyForms to use this command." . TextFormat::RESET);
$sender->sendMessage(TextFormat::RED . "Bạn phải cài đặt EasyForms để sử dụng lệnh này!" . TextFormat::RESET);
}
}
else{
$sender->sendMessage(TextFormat::RED . "You do not have permission to run this command." . TextFormat::RESET);
$sender->sendMessage(TextFormat::RED . "Bạn không có quyền để sử dụng lệnh này!" . TextFormat::RESET);
}


Expand Down
10 changes: 5 additions & 5 deletions src/falkirks/minereset/command/ListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@
class ListCommand extends SubCommand{
public function execute(CommandSender $sender, $commandLabel, array $args){
if($sender->hasPermission("minereset.command.list")) {
$sender->sendMessage("---- Mines ----");
$sender->sendMessage("---- DANH SÁCH KHU MINE ----");
foreach ($this->getApi()->getMineManager() as $mine) {
if ($mine instanceof Mine) {
if(!$mine->isValid()){
$sender->sendMessage("* " . TextFormat::RED . $mine . TextFormat::RESET);
$sender->sendMessage("* (Chưa hoàn thành) Khu mine " . TextFormat::RED . $mine . TextFormat::RESET);
}
else if($mine->isResetting()){
$sender->sendMessage("* " . TextFormat::BLUE . $mine . TextFormat::RESET);
$sender->sendMessage("* (Đang reset) Khu mine " . TextFormat::BLUE . $mine . TextFormat::RESET);
}
else {
$sender->sendMessage("* " . $mine);
$sender->sendMessage("* (Đã hoàn thành) Khu mine " . $mine);
}
}
}
}
else{
$sender->sendMessage(TextFormat::RED . "You do not have permission to run this command." . TextFormat::RESET);
$sender->sendMessage(TextFormat::RED . "Bạn không có quyền để sử dụng lệnh này!" . TextFormat::RESET);
}
}
}
2 changes: 1 addition & 1 deletion src/falkirks/minereset/command/MineCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class MineCommand extends Command implements PluginIdentifiableCommand {
/** @var SubCommand[] */
protected $subCommands;
public function __construct(MineReset $api){
parent::__construct("mine", "Mine reset command", "/mine <create|set|list|reset|reset-all|destroy|report> <name> [parameters]");
parent::__construct("mine", "Lệnh MineReset", "/mine <create|set|list|reset|reset-all|destroy|report> <tên> [thông số]");
$this->setPermission("mine.command");
$this->api = $api;
$this->subCommands = [];
Expand Down
8 changes: 4 additions & 4 deletions src/falkirks/minereset/command/ReportCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function execute(CommandSender $sender, $commandLabel, array $args){
if($sender->hasPermission("minereset.command.report")) {
$data = $this->getApi()->getDebugDumpFactory()->generate();
if ($sender instanceof ConsoleCommandSender) {
$issueContent = "\n\n(Explain your problem here)\n\n```\n$data\n```";
$issueContent = "\n\n(Giải thích vấn đề của bạn ở đây)\n\n```\n$data\n```";
$url = "https://github.com/Falkirks/MineReset/issues/new" . (count($args) > 0 ? "?title=" . urlencode(implode(" ", $args)) . "\&" : "?") . "body=" . urlencode($issueContent);
switch (Utils::getOS()) {
case 'win':
Expand All @@ -27,18 +27,18 @@ public function execute(CommandSender $sender, $commandLabel, array $args){
`xdg-open $url`;
break;
default:
$sender->sendMessage("Copy and paste the following URL into your browser to start a report.");
$sender->sendMessage("Sao chép và dán URL sau vào trình duyệt của bạn để bắt đầu báo cáo.");
$sender->sendMessage("------------------");
$sender->sendMessage($url);
$sender->sendMessage("------------------");
break;
}
}
$sender->sendMessage("--- MineReset Data ---");
$sender->sendMessage("--- Dữ liệu MineReset ---");
$sender->sendMessage($data);
}
else{
$sender->sendMessage(TextFormat::RED . "You do not have permission to run this command." . TextFormat::RESET);
$sender->sendMessage(TextFormat::RED . "Bạn không có quyền để sử dụng lệnh này!" . TextFormat::RESET);
}
}
}
6 changes: 3 additions & 3 deletions src/falkirks/minereset/command/ResetAllCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ public function execute(CommandSender $sender, $commandLabel, array $args){
$success++;
$this->getApi()->getResetProgressManager()->addObserver($mine->getName(), $sender);
} catch (MineResetException $exception){
$sender->sendMessage(TextFormat::RED . "Error raised for {$mine->getName()}, you can reset this mine directly for more info." . TextFormat::RESET);
$sender->sendMessage(TextFormat::RED . "Có lỗi được phát hiện trong khu {$mine->getName()}, vui lòng kiểm tra lại file config." . TextFormat::RESET);
}

}
}
$count = count($this->getApi()->getMineManager());
$sender->sendMessage("Queued reset for {$success}/{$count} mines.");
$sender->sendMessage("KẾT QUẢ: {$success} khu được reset thành công trên tổng {$count} khu mine.");
}
else{
$sender->sendMessage(TextFormat::RED . "You do not have permission to run this command." . TextFormat::RESET);
$sender->sendMessage(TextFormat::RED . "Bạn không có quyền để sử dụng lệnh này!" . TextFormat::RESET);
}
}
}
Loading

0 comments on commit 2cb1d38

Please sign in to comment.