Skip to content

Commit

Permalink
Demotion Message Modyfy
Browse files Browse the repository at this point in the history
「これ以下へ降格不能メッセージ」
自動の場合は非表示
手動の場合は操作者へ送信
に調整した
  • Loading branch information
kumaisu committed Dec 10, 2019
1 parent c499172 commit 3028f89
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
8 changes: 6 additions & 2 deletions src/main/java/com/mycompany/citizenship/Citizenship.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import java.net.UnknownHostException;
import org.bukkit.Bukkit;
import org.bukkit.Sound;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
Expand Down Expand Up @@ -64,12 +65,15 @@ public void onLoad() {
* @param event
* @throws UnknownHostException
*/
@EventHandler( priority = EventPriority.HIGH )
@EventHandler( priority = EventPriority.LOWEST )
public void onPlayerLogin( PlayerJoinEvent event ) throws UnknownHostException {
Player player = event.getPlayer();
Tools.Prt( "onPlayerLogin process", Tools.consoleMode.max, programCode );
RanksControl.CheckRank( player );
if ( player.hasPermission( "citizenship.yellow" ) ) YellowData.CardLog( player, Database.logout );
if ( player.hasPermission( "citizenship.yellow" ) ) {
YellowData.CardLog( player, Database.logout );
player.getLocation().getWorld().playSound( player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1, 1 );
}
}

/**
Expand Down
16 changes: 9 additions & 7 deletions src/main/java/com/mycompany/citizenship/RanksControl.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static boolean Promotion( Player player, Player target ) {
return false;
}
if ( Config.rankTime.get( baseGroup ).get( "E" ) != null ) {
Tools.Prt( player, ChatColor.LIGHT_PURPLE + "これ以上、昇格はできません", Tools.consoleMode.full, programCode );
Tools.Prt( player, ChatColor.LIGHT_PURPLE + "これ以上の昇格はできません", Tools.consoleMode.full, programCode );
return false;
}

Expand Down Expand Up @@ -97,7 +97,9 @@ public static boolean Demotion( Player player, Player target ){
return false;
}
if ( Config.rankName.indexOf( baseGroup ) == 0 ) {
Tools.Prt( player, "これ以上、降格はできません", Tools.consoleMode.full, programCode );
if ( player != target ) {
Tools.Prt( player, "これ以下へ降格はできません", Tools.consoleMode.full, programCode );
}
return false;
}

Expand All @@ -109,17 +111,17 @@ public static boolean Demotion( Player player, Player target ){
PlayerData.SetOffsetToSQL( target.getUniqueId(), TickTime.get( target ) );
PlayerData.SetBaseDateToSQL( target.getUniqueId() );

String LevelupMessage =
String LeveldownMessage =
ChatColor.YELLOW + target.getName() + " さんを " +
ChatColor.AQUA + NewGroup +
ChatColor.YELLOW + " に降格しました";

if ( Config.DemotBroadcast ) {
LevelupMessage = "<鯖アナウンス> " + LevelupMessage;
Bukkit.broadcastMessage( LevelupMessage );
Bukkit.getServer().dispatchCommand( Bukkit.getConsoleSender(), "discord broadcast " + LevelupMessage );
LeveldownMessage = "<鯖アナウンス> " + LeveldownMessage;
Bukkit.broadcastMessage( LeveldownMessage );
Bukkit.getServer().dispatchCommand( Bukkit.getConsoleSender(), "discord broadcast " + LeveldownMessage );
} else {
Tools.Prt( target, LevelupMessage, Tools.consoleMode.normal, programCode );
Tools.Prt( target, LeveldownMessage, Tools.consoleMode.normal, programCode );
}
Tools.Prt( "Player new Group is " + NewGroup, Tools.consoleMode.full, programCode );
return true;
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ Release:
# 警戒コマンド一覧
Aleart:
- /OP
- /LOGIN
- /GAMEMODE

# 指定回数以上の警告で自動的に投獄する
Expand Down

0 comments on commit 3028f89

Please sign in to comment.