Skip to content

Commit

Permalink
[Add] pve0 - pve3
Browse files Browse the repository at this point in the history
  • Loading branch information
Mori01231 committed Jun 26, 2021
1 parent 1c895f0 commit 5c908c1
Show file tree
Hide file tree
Showing 6 changed files with 216 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/java/com/github/mori01231/lifecore/LifeCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ public void onEnable() {
this.getCommand("guide").setExecutor(new GuideCommandExecutor());
this.getCommand("tutorial").setExecutor(new TutorialCommandExecutor());
this.getCommand("pve").setExecutor(new PveCommandExecutor());
this.getCommand("pve0").setExecutor(new Pve0CommandExecutor());
this.getCommand("pve1").setExecutor(new Pve1CommandExecutor());
this.getCommand("pve2").setExecutor(new Pve2CommandExecutor());
this.getCommand("pve3").setExecutor(new Pve3CommandExecutor());
this.getCommand("life").setExecutor(new LifeCommandExecutor());
this.getCommand("rank").setExecutor(new RankCommandExecutor());
this.getCommand("sara").setExecutor(new SaraCommandExecutor());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.github.mori01231.lifecore;

import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import java.io.ByteArrayOutputStream;
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());
}

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


return true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.github.mori01231.lifecore;

import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import java.io.ByteArrayOutputStream;
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());
}

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


return true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.github.mori01231.lifecore;

import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import java.io.ByteArrayOutputStream;
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());
}

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


return true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.github.mori01231.lifecore;

import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import java.io.ByteArrayOutputStream;
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());
}

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


return true;
}
}
16 changes: 16 additions & 0 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,22 @@ commands:
description: Teleport to dungeon.
permission: lifecore.pve
usage: Syntax error! Simply type /pve to teleport to dungeon.
pve0:
description: Teleport to dungeon.
permission: lifecore.pve
usage: Syntax error! Simply type /pve0 to teleport to dungeon.
pve1:
description: Teleport to dungeon.
permission: lifecore.pve
usage: Syntax error! Simply type /pve1 to teleport to dungeon.
pve2:
description: Teleport to dungeon.
permission: lifecore.pve
usage: Syntax error! Simply type /pve2 to teleport to dungeon.
pve3:
description: Teleport to dungeon.
permission: lifecore.pve
usage: Syntax error! Simply type /pve3 to teleport to dungeon.
life:
description: Teleport to Life server.
permission: lifecore.life
Expand Down

0 comments on commit 5c908c1

Please sign in to comment.