Skip to content

Commit

Permalink
[Remove] Unnecessary check
Browse files Browse the repository at this point in the history
  • Loading branch information
Mori01231 committed Jun 26, 2021
1 parent 5c908c1 commit 0ca6573
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 88 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,27 @@
import java.io.DataOutputStream;
import java.io.IOException;

import static org.bukkit.Bukkit.getServer;

public class Pve0CommandExecutor implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

if (sender instanceof Player){
Player player = (Player) sender;
String playerName = player.getName();

if(LifeCore.getInstance().getConfig().getBoolean("use-pve-command-as-teleport")){
String pve = LifeCore.getInstance().getConfig().getString("pve-teleport");
getServer().dispatchCommand(getServer().getConsoleSender(), "mvtp " + playerName + " " + pve);
sender.sendMessage(ChatColor.translateAlternateColorCodes('&',"&3ダンジョンロビーにテレポートしました。" ));

}else{
// create bytearray for sending player to server
ByteArrayOutputStream b = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(b);
try {
out.writeUTF("Connect");
out.writeUTF("lifepve");
} catch (IOException e) {
// never happens
}
player.sendPluginMessage(LifeCore.getInstance(), "BungeeCord", b.toByteArray());
// create bytearray for sending player to server
ByteArrayOutputStream b = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(b);
try {
out.writeUTF("Connect");
out.writeUTF("lifepve");
} catch (IOException e) {
// never happens
}

player.sendPluginMessage(LifeCore.getInstance(), "BungeeCord", b.toByteArray());
}
else{
sender.sendMessage(ChatColor.translateAlternateColorCodes('&',"&3このコマンドはコンソールから使用できません。" ));
}


return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,27 @@
import java.io.DataOutputStream;
import java.io.IOException;

import static org.bukkit.Bukkit.getServer;

public class Pve1CommandExecutor implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

if (sender instanceof Player){
Player player = (Player) sender;
String playerName = player.getName();

if(LifeCore.getInstance().getConfig().getBoolean("use-pve-command-as-teleport")){
String pve = LifeCore.getInstance().getConfig().getString("pve-teleport");
getServer().dispatchCommand(getServer().getConsoleSender(), "mvtp " + playerName + " " + pve);
sender.sendMessage(ChatColor.translateAlternateColorCodes('&',"&3ダンジョンロビーにテレポートしました。" ));

}else{
// create bytearray for sending player to server
ByteArrayOutputStream b = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(b);
try {
out.writeUTF("Connect");
out.writeUTF("lifepve1");
} catch (IOException e) {
// never happens
}
player.sendPluginMessage(LifeCore.getInstance(), "BungeeCord", b.toByteArray());
// create bytearray for sending player to server
ByteArrayOutputStream b = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(b);
try {
out.writeUTF("Connect");
out.writeUTF("lifepve1");
} catch (IOException e) {
// never happens
}

player.sendPluginMessage(LifeCore.getInstance(), "BungeeCord", b.toByteArray());
}
else{
sender.sendMessage(ChatColor.translateAlternateColorCodes('&',"&3このコマンドはコンソールから使用できません。" ));
}


return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,27 @@
import java.io.DataOutputStream;
import java.io.IOException;

import static org.bukkit.Bukkit.getServer;

public class Pve2CommandExecutor implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

if (sender instanceof Player){
Player player = (Player) sender;
String playerName = player.getName();

if(LifeCore.getInstance().getConfig().getBoolean("use-pve-command-as-teleport")){
String pve = LifeCore.getInstance().getConfig().getString("pve-teleport");
getServer().dispatchCommand(getServer().getConsoleSender(), "mvtp " + playerName + " " + pve);
sender.sendMessage(ChatColor.translateAlternateColorCodes('&',"&3ダンジョンロビーにテレポートしました。" ));

}else{
// create bytearray for sending player to server
ByteArrayOutputStream b = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(b);
try {
out.writeUTF("Connect");
out.writeUTF("lifepve2");
} catch (IOException e) {
// never happens
}
player.sendPluginMessage(LifeCore.getInstance(), "BungeeCord", b.toByteArray());
// create bytearray for sending player to server
ByteArrayOutputStream b = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(b);
try {
out.writeUTF("Connect");
out.writeUTF("lifepve2");
} catch (IOException e) {
// never happens
}

player.sendPluginMessage(LifeCore.getInstance(), "BungeeCord", b.toByteArray());
}
else{
sender.sendMessage(ChatColor.translateAlternateColorCodes('&',"&3このコマンドはコンソールから使用できません。" ));
}


return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,27 @@
import java.io.DataOutputStream;
import java.io.IOException;

import static org.bukkit.Bukkit.getServer;

public class Pve3CommandExecutor implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

if (sender instanceof Player){
Player player = (Player) sender;
String playerName = player.getName();

if(LifeCore.getInstance().getConfig().getBoolean("use-pve-command-as-teleport")){
String pve = LifeCore.getInstance().getConfig().getString("pve-teleport");
getServer().dispatchCommand(getServer().getConsoleSender(), "mvtp " + playerName + " " + pve);
sender.sendMessage(ChatColor.translateAlternateColorCodes('&',"&3ダンジョンロビーにテレポートしました。" ));

}else{
// create bytearray for sending player to server
ByteArrayOutputStream b = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(b);
try {
out.writeUTF("Connect");
out.writeUTF("lifepve3");
} catch (IOException e) {
// never happens
}
player.sendPluginMessage(LifeCore.getInstance(), "BungeeCord", b.toByteArray());
// create bytearray for sending player to server
ByteArrayOutputStream b = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(b);
try {
out.writeUTF("Connect");
out.writeUTF("lifepve");
} catch (IOException e) {
// never happens
}

player.sendPluginMessage(LifeCore.getInstance(), "BungeeCord", b.toByteArray());
}
else{
sender.sendMessage(ChatColor.translateAlternateColorCodes('&',"&3このコマンドはコンソールから使用できません。" ));
}


return true;
}
}

0 comments on commit 0ca6573

Please sign in to comment.