fixed player time
This commit is contained in:
		
					parent
					
						
							
								3afe2ede2b
							
						
					
				
			
			
				commit
				
					
						6d39abe56c
					
				
			
		
					 2 changed files with 10 additions and 4 deletions
				
			
		| 
						 | 
					@ -27,10 +27,12 @@ public class AsyncPlayerTimeTask extends BukkitRunnable {
 | 
				
			||||||
	public void run() {
 | 
						public void run() {
 | 
				
			||||||
		for (Player player : server.getOnlinePlayers()) {
 | 
							for (Player player : server.getOnlinePlayers()) {
 | 
				
			||||||
			if (!player.hasPermission("realweather.dynamic")) continue;
 | 
								if (!player.hasPermission("realweather.dynamic")) continue;
 | 
				
			||||||
 | 
								if (!mapper.getWorlds().contains(player.getWorld())) continue;
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			Coordinates coordinates = mapper.locationToCoordinates(player.getLocation());
 | 
								Coordinates coordinates = mapper.locationToCoordinates(player.getLocation());
 | 
				
			||||||
			long offsetTicks = (long) ((coordinates.longitude / 15) * 1000 * timeConfig.scale);
 | 
								long offsetTicks = timeConfig.calculateTimeOffsetTicks(coordinates.longitude);
 | 
				
			||||||
			player.setPlayerTime(offsetTicks, true); // TODO can this be negative?
 | 
								
 | 
				
			||||||
 | 
								player.setPlayerTime(Math.floorMod(offsetTicks, 24000), true);
 | 
				
			||||||
			DebugLogger.info("Time for %s: %d", 2, player.getName(), offsetTicks);
 | 
								DebugLogger.info("Time for %s: %d", 2, player.getName(), offsetTicks);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -26,11 +26,12 @@ commands:
 | 
				
			||||||
    permission-message: You do not have permission to use this command.
 | 
					    permission-message: You do not have permission to use this command.
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
permissions:
 | 
					permissions:
 | 
				
			||||||
 | 
					  # Commands
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
  realweather.command:
 | 
					  realweather.command:
 | 
				
			||||||
    description: Allows /realweather (individual nodes are still necessary for subcommands)
 | 
					    description: Allows /realweather (individual nodes are still necessary for subcommands)
 | 
				
			||||||
  realweather.command.status:
 | 
					  realweather.command.status:
 | 
				
			||||||
    description: /realweather status
 | 
					    description: /realweather status
 | 
				
			||||||
    
 | 
					 | 
				
			||||||
  realweather.command.*:
 | 
					  realweather.command.*:
 | 
				
			||||||
    description: All /realweather commands
 | 
					    description: All /realweather commands
 | 
				
			||||||
    children:
 | 
					    children:
 | 
				
			||||||
| 
						 | 
					@ -42,15 +43,18 @@ permissions:
 | 
				
			||||||
    default: true
 | 
					    default: true
 | 
				
			||||||
  realweather.geo.tp:
 | 
					  realweather.geo.tp:
 | 
				
			||||||
    description: Allows teleportation using /geo
 | 
					    description: Allows teleportation using /geo
 | 
				
			||||||
    
 | 
					 | 
				
			||||||
  realweather.localtime:
 | 
					  realweather.localtime:
 | 
				
			||||||
    description: Allows /localtime
 | 
					    description: Allows /localtime
 | 
				
			||||||
    default: true
 | 
					    default: true
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
					  # Engine
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
  realweather.dynamic:
 | 
					  realweather.dynamic:
 | 
				
			||||||
    description: Includes player in dynamic conditions
 | 
					    description: Includes player in dynamic conditions
 | 
				
			||||||
    default: true
 | 
					    default: true
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
					  # Other
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
  realweather.actionbar:
 | 
					  realweather.actionbar:
 | 
				
			||||||
    description: Displays status on player's action bar
 | 
					    description: Displays status on player's action bar
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue